aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-11-28 15:35:35 +0000
committerlloyd <[email protected]>2008-11-28 15:35:35 +0000
commit360506bec77e135919ec9d45fd1f441f3ca87303 (patch)
tree24bba04a9d08a967143e2a4e95369e4e0089e237 /src
parent45cd53a6adeadf417a77353d0443bbe67d337087 (diff)
Rickard Bondesson reported on the mailing list that he had noticed
a discrepency between OpenSSL and Botan when generating SHA-512/EMSA3 signatures. In fact it turns out that the EMSA3 identifier for SHA-512 contained a typo and was incorrect. Unfortunately this means that SHA-512/EMSA3 signatures generated by Botan up until now will not be accepted by other implementations, and the signatures by other implementations would not be accepted by Botan. Currently I am not making any provision for backwards compatability with the old incorrect hash identifier, since I am assuming/guessing that SHA-512/EMSA3 is not a very common combination.
Diffstat (limited to 'src')
-rw-r--r--src/pk_pad/hash_id/hash_id.cpp24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/pk_pad/hash_id/hash_id.cpp b/src/pk_pad/hash_id/hash_id.cpp
index 123a0de0e..7f375371f 100644
--- a/src/pk_pad/hash_id/hash_id.cpp
+++ b/src/pk_pad/hash_id/hash_id.cpp
@@ -1,7 +1,7 @@
-/*************************************************
-* Hash Function Identification Source File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
+/*
+* Hash Function Identification Source File
+* (C) 1999-2008 Jack Lloyd
+*/
#include <botan/hash_id.h>
#include <botan/exceptn.h>
@@ -39,7 +39,7 @@ const byte SHA_384_ID[] = {
0x65, 0x03, 0x04, 0x02, 0x02, 0x05, 0x00, 0x04, 0x30 };
const byte SHA_512_ID[] = {
-0x30, 0x31, 0x30, 0x0D, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01,
+0x30, 0x51, 0x30, 0x0D, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01,
0x65, 0x03, 0x04, 0x02, 0x03, 0x05, 0x00, 0x04, 0x40 };
const byte TIGER_ID[] = {
@@ -48,9 +48,11 @@ const byte TIGER_ID[] = {
}
-/*************************************************
-* Return the HashID, as specified by PKCS *
-*************************************************/
+/**
+* @return HashID as specified by PKCS
+* For details see RFC 3447 section 9.2
+* http://tools.ietf.org/html/rfc3447#section-9.2
+*/
MemoryVector<byte> pkcs_hash_id(const std::string& name)
{
MemoryVector<byte> out;
@@ -83,9 +85,9 @@ MemoryVector<byte> pkcs_hash_id(const std::string& name)
throw Invalid_Argument("No PKCS #1 identifier for " + name);
}
-/*************************************************
-* Return the HashID, as specified by IEEE 1363 *
-*************************************************/
+/**
+* @return HashID as specified by IEEE 1363/X9.31
+*/
byte ieee1363_hash_id(const std::string& name)
{
if(name == "RIPEMD-160") return 0x31;