Skip to content

Commit

Permalink
Test for more error codes which can result from bad sig (as opposed t…
Browse files Browse the repository at this point in the history
…o lib failure or malloc error)
  • Loading branch information
davedoesdev committed Aug 27, 2013
1 parent 236ebfa commit 9473eba
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/ursaNative.cc
Expand Up @@ -883,7 +883,13 @@ Handle<Value> RsaWrap::Verify(const Arguments& args) {
(reason == RSA_R_BAD_PAD_BYTE_COUNT) ||
(reason == RSA_R_DATA_TOO_LARGE) ||
(reason == RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE) ||
(reason == RSA_R_BLOCK_TYPE_IS_NOT_02))) {
(reason == RSA_R_BLOCK_TYPE_IS_NOT_02) ||
(reason == RSA_R_MODULUS_TOO_LARGE) ||
(reason == RSA_R_BAD_E_VALUE) ||
(reason == RSA_R_DATA_GREATER_THAN_MOD_LEN) ||
(reason == RSA_R_DATA_TOO_LARGE_FOR_MODULUS) ||
(reason == RSA_R_UNKNOWN_PADDING_TYPE) ||
(reason == RSA_R_PADDING_CHECK_FAILED))) {
// This just means that the signature didn't match
// (as opposed to, say, a more dire failure in the library
// warranting an exception throw).
Expand Down Expand Up @@ -979,7 +985,13 @@ Handle<Value> RsaWrap::VerifyPSSPadding(const v8::Arguments& args)
(reason == RSA_R_DATA_TOO_LARGE) ||
(reason == RSA_R_LAST_OCTET_INVALID) ||
(reason == RSA_R_SLEN_RECOVERY_FAILED) ||
(reason == RSA_R_BAD_SIGNATURE))) {
(reason == RSA_R_BAD_SIGNATURE) ||
(reason == RSA_R_MODULUS_TOO_LARGE) ||
(reason == RSA_R_BAD_E_VALUE) ||
(reason == RSA_R_DATA_GREATER_THAN_MOD_LEN) ||
(reason == RSA_R_DATA_TOO_LARGE_FOR_MODULUS) ||
(reason == RSA_R_UNKNOWN_PADDING_TYPE) ||
(reason == RSA_R_PADDING_CHECK_FAILED))) {
// This just means that the signature didn't match
// (as opposed to, say, a more dire failure in the library
// warranting an exception throw).
Expand Down

0 comments on commit 9473eba

Please sign in to comment.