aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/pk_pad
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2017-10-05 11:27:28 -0400
committerJack Lloyd <[email protected]>2017-10-05 11:27:28 -0400
commit91430f402a1ccd23f5c8fea6ee25b12628dc3700 (patch)
tree99132818cba51729d517700e126261997afab716 /src/lib/pk_pad
parent0cf2e5491e8f7297face6d011752969100e725ab (diff)
Correct the SHA-3 PKCSv1.5 IDs
Thanks to @noloader for pointing me at draft-jivsov-openpgp-sha3-01 which has the correct values. Adds a test so this can't happen again.
Diffstat (limited to 'src/lib/pk_pad')
-rw-r--r--src/lib/pk_pad/hash_id/hash_id.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/lib/pk_pad/hash_id/hash_id.cpp b/src/lib/pk_pad/hash_id/hash_id.cpp
index ce92ad5e9..ec317f969 100644
--- a/src/lib/pk_pad/hash_id/hash_id.cpp
+++ b/src/lib/pk_pad/hash_id/hash_id.cpp
@@ -45,16 +45,20 @@ const uint8_t SHA_512_256_PKCS_ID[] = {
0x65, 0x03, 0x04, 0x02, 0x06, 0x05, 0x00, 0x04, 0x20 };
const uint8_t SHA3_224_PKCS_ID[] = {
-0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x03, 0x0D };
+0x30, 0x2D, 0x30, 0x0D, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65,
+0x03, 0x04, 0x02, 0x07, 0x05, 0x00, 0x04, 0x1C };
const uint8_t SHA3_256_PKCS_ID[] = {
-0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x03, 0x0E };
+0x30, 0x31, 0x30, 0x0D, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65,
+0x03, 0x04, 0x02, 0x08, 0x05, 0x00, 0x04, 0x20 };
const uint8_t SHA3_384_PKCS_ID[] = {
-0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x03, 0x0F };
+0x30, 0x41, 0x30, 0x0D, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65,
+0x03, 0x04, 0x02, 0x09, 0x05, 0x00, 0x04, 0x30 };
const uint8_t SHA3_512_PKCS_ID[] = {
-0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x03, 0x10 };
+0x30, 0x51, 0x30, 0x0D, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65,
+0x03, 0x04, 0x02, 0x0A, 0x05, 0x00, 0x04, 0x40 };
const uint8_t SM3_PKCS_ID[] = {
0x30, 0x30, 0x30, 0x0C, 0x06, 0x08, 0x2A, 0x81, 0x1C, 0xCF,
@@ -76,6 +80,8 @@ std::vector<uint8_t> pkcs_hash_id(const std::string& name)
if(name == "Parallel(MD5,SHA-160)")
return std::vector<uint8_t>();
+ // If you add a value to this function, also update test_hash_id.cpp
+
if(name == "MD5")
return std::vector<uint8_t>(MD5_PKCS_ID,
MD5_PKCS_ID + sizeof(MD5_PKCS_ID));