diff options
author | Brian Smith <brian@briansmith.org> | 2016-03-04 22:20:07 +0300 |
---|---|---|
committer | David Benjamin <davidben@google.com> | 2016-04-18 23:40:41 +0300 |
commit | 9902262af6fa38acd9bf4e55f2a6d3389faba7e8 (patch) | |
tree | fc6b6cb1ab66bff3ed071c7ee03c40a5d57262ac /crypto/rsa | |
parent | c0b196d4ebc75c9f9cb61411b8fe291e70059d58 (diff) |
Remove redundant check of |sig_len| in |RSA_verify|.
The same check is already done in |RSA_verify_raw|, so |RSA_verify|
doesn't need to do it.
Also, move the |RSA_verify_raw| check earlier.
Change-Id: I15f7db0aad386c0f764bba53e77dfc46574f7635
Reviewed-on: https://boringssl-review.googlesource.com/7463
Reviewed-by: David Benjamin <davidben@google.com>
Diffstat (limited to 'crypto/rsa')
-rw-r--r-- | crypto/rsa/rsa.c | 5 | ||||
-rw-r--r-- | crypto/rsa/rsa_impl.c | 10 |
2 files changed, 5 insertions, 10 deletions
diff --git a/crypto/rsa/rsa.c b/crypto/rsa/rsa.c index 1d932c04..daaa082f 100644 --- a/crypto/rsa/rsa.c +++ b/crypto/rsa/rsa.c @@ -475,11 +475,6 @@ int RSA_verify(int hash_nid, const uint8_t *msg, size_t msg_len, size_t signed_msg_len, len; int signed_msg_is_alloced = 0; - if (sig_len != rsa_size) { - OPENSSL_PUT_ERROR(RSA, RSA_R_WRONG_SIGNATURE_LENGTH); - return 0; - } - if (hash_nid == NID_md5_sha1 && msg_len != SSL_SIG_LENGTH) { OPENSSL_PUT_ERROR(RSA, RSA_R_INVALID_MESSAGE_LENGTH); return 0; diff --git a/crypto/rsa/rsa_impl.c b/crypto/rsa/rsa_impl.c index c9158958..fecb911f 100644 --- a/crypto/rsa/rsa_impl.c +++ b/crypto/rsa/rsa_impl.c @@ -445,6 +445,11 @@ int RSA_verify_raw(RSA *rsa, size_t *out_len, uint8_t *out, size_t max_out, return 0; } + if (in_len != rsa_size) { + OPENSSL_PUT_ERROR(RSA, RSA_R_DATA_LEN_NOT_EQUAL_TO_MOD_LEN); + return 0; + } + if (!check_modulus_and_exponent_sizes(rsa)) { return 0; } @@ -472,11 +477,6 @@ int RSA_verify_raw(RSA *rsa, size_t *out_len, uint8_t *out, size_t max_out, goto err; } - if (in_len != rsa_size) { - OPENSSL_PUT_ERROR(RSA, RSA_R_DATA_LEN_NOT_EQUAL_TO_MOD_LEN); - goto err; - } - if (BN_bin2bn(in, in_len, f) == NULL) { goto err; } |