21.08.2015 Views

RSA-PSS – Provably secure RSA Signatures and their ...

RSA-PSS – Provably secure RSA Signatures and their ...

RSA-PSS – Provably secure RSA Signatures and their ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

static SECStatusemsa_pss_verify ( const unsigned char * mHash ,const unsigned char *em , unsigned int emLen ,unsigned int emBits , HASH_HashType hashAlg ,HASH_HashType maskHashAlg , unsigned int sLen ){const SECHashObject * hash ;void * hashContext ;unsigned char *db;unsigned char *H_; /* H’ from the RFC */unsigned int i, dbMaskLen , zeroBits ;SECStatus rv;hash = HASH_GetRawHashObject ( hashAlg );dbMaskLen = emLen - hash -> length - 1;/* Step 3 + 4 */if (( emLen < (hash -> length + sLen + 2)) ||(em[ emLen - 1] != 0 xbc )) {PORT_SetError ( SEC_ERROR_BAD_SIGNATURE );return SECFailure ;}/* Step 6 */zeroBits = emLen *8 - emBits ;if (( em [0] >> (8 - zeroBits )) != 0) {PORT_SetError ( SEC_ERROR_BAD_SIGNATURE );return SECFailure ;}/* Step 7 */db = ( unsigned char *) PORT_Alloc ( dbMaskLen );if (db == NULL ) {PORT_SetError ( SEC_ERROR_NO_MEMORY );return SECFailure ;}/* &em[ dbMaskLen ] points to H, used as mgfSeed */MGF1 ( maskHashAlg , db , dbMaskLen , &em[ dbMaskLen ], hash -> length );/* Step 8 */for (i = 0; i < dbMaskLen ; i ++) {db[i] ^= em[i];}Listing 3: Beginning of emsa pss verify from rsawrapr.c33

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!