mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-19 03:18:15 -04:00
added v3 signature verification codes for ripemd-160, sha224, sha512 and sha384
git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-OpenPGP@5233 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
ef424a1e11
commit
b603ef9d9f
1 changed files with 85 additions and 64 deletions
|
@ -87,10 +87,24 @@ static unsigned char prefix_md5[]={ 0x30,0x20,0x30,0x0C,0x06,0x08,0x2A,0x86,
|
|||
static unsigned char prefix_sha1[]={ 0x30,0x21,0x30,0x09,0x06,0x05,0x2b,0x0E,
|
||||
0x03,0x02,0x1A,0x05,0x00,0x04,0x14 };
|
||||
|
||||
static unsigned char prefix_sha224[]={ 0x30, 0x31, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86,
|
||||
0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x04, 0x05,
|
||||
0x00, 0x04, 0x1C };
|
||||
|
||||
static unsigned char prefix_sha256[]={ 0x30,0x31,0x30,0x0d,0x06,0x09,0x60,0x86,
|
||||
0x48,0x01,0x65,0x03,0x04,0x02,0x01,0x05,
|
||||
0x00,0x04,0x20 };
|
||||
|
||||
static unsigned char prefix_sha384[]={ 0x30, 0x41, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86,
|
||||
0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x02, 0x05,
|
||||
0x00, 0x04, 0x30 };
|
||||
|
||||
static unsigned char prefix_sha512[]={ 0x30, 0x51, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86,
|
||||
0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x03, 0x05,
|
||||
0x00, 0x04, 0x40 };
|
||||
|
||||
static unsigned char prefix_ripemd[]={ 0x30, 0x21, 0x30, 0x09, 0x06, 0x05, 0x2B, 0x24,
|
||||
0x03, 0x02, 0x01, 0x05, 0x00, 0x04, 0x14 };
|
||||
/**
|
||||
\ingroup Core_Create
|
||||
implementation of EMSA-PKCS1-v1_5, as defined in OpenPGP RFC
|
||||
|
@ -289,8 +303,15 @@ static ops_boolean_t rsa_verify(ops_hash_algorithm_t type,
|
|||
{
|
||||
case OPS_HASH_MD5 : prefix=prefix_md5 ; plen=sizeof prefix_md5; break;
|
||||
case OPS_HASH_SHA1 : prefix=prefix_sha1 ; plen=sizeof prefix_sha1; break;
|
||||
case OPS_HASH_SHA224 : prefix=prefix_sha224 ; plen=sizeof prefix_sha224; break;
|
||||
case OPS_HASH_SHA256 : prefix=prefix_sha256 ; plen=sizeof prefix_sha256; break;
|
||||
default: assert(0); break;
|
||||
case OPS_HASH_SHA384 : prefix=prefix_sha384 ; plen=sizeof prefix_sha384; break;
|
||||
case OPS_HASH_SHA512 : prefix=prefix_sha512 ; plen=sizeof prefix_sha512; break;
|
||||
case OPS_HASH_RIPEMD : prefix=prefix_ripemd ; plen=sizeof prefix_ripemd; break;
|
||||
|
||||
default:
|
||||
fprintf(stderr,"Warning: unhandled hash type in signature verification code: %d\n",type) ;
|
||||
assert(0); break;
|
||||
}
|
||||
|
||||
if(keysize-plen-hash_length < 10)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue