summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/rsa/rsa_pss.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/rsa/rsa_pss.c')
-rw-r--r--src/lib/libcrypto/rsa/rsa_pss.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/lib/libcrypto/rsa/rsa_pss.c b/src/lib/libcrypto/rsa/rsa_pss.c
index 4c6a90c1c7..09bf32439b 100644
--- a/src/lib/libcrypto/rsa/rsa_pss.c
+++ b/src/lib/libcrypto/rsa/rsa_pss.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: rsa_pss.c,v 1.6 2014/07/09 08:20:08 miod Exp $ */ 1/* $OpenBSD: rsa_pss.c,v 1.7 2014/07/09 19:51:38 jsing Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2005. 3 * project 2005.
4 */ 4 */
@@ -10,7 +10,7 @@
10 * are met: 10 * are met:
11 * 11 *
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 14 *
15 * 2. Redistributions in binary form must reproduce the above copyright 15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in 16 * notice, this list of conditions and the following disclaimer in
@@ -121,7 +121,8 @@ RSA_verify_PKCS1_PSS_mgf1(RSA *rsa, const unsigned char *mHash,
121 EM++; 121 EM++;
122 emLen--; 122 emLen--;
123 } 123 }
124 if (emLen < (hLen + sLen + 2)) { /* sLen can be small negative */ 124 if (emLen < (hLen + sLen + 2)) {
125 /* sLen can be small negative */
125 RSAerr(RSA_F_RSA_VERIFY_PKCS1_PSS_MGF1, RSA_R_DATA_TOO_LARGE); 126 RSAerr(RSA_F_RSA_VERIFY_PKCS1_PSS_MGF1, RSA_R_DATA_TOO_LARGE);
126 goto err; 127 goto err;
127 } 128 }
@@ -143,7 +144,7 @@ RSA_verify_PKCS1_PSS_mgf1(RSA *rsa, const unsigned char *mHash,
143 DB[i] ^= EM[i]; 144 DB[i] ^= EM[i];
144 if (MSBits) 145 if (MSBits)
145 DB[0] &= 0xFF >> (8 - MSBits); 146 DB[0] &= 0xFF >> (8 - MSBits);
146 for (i = 0; DB[i] == 0 && i < (maskedDBLen-1); i++) 147 for (i = 0; DB[i] == 0 && i < (maskedDBLen - 1); i++)
147 ; 148 ;
148 if (DB[i++] != 0x1) { 149 if (DB[i++] != 0x1) {
149 RSAerr(RSA_F_RSA_VERIFY_PKCS1_PSS_MGF1, 150 RSAerr(RSA_F_RSA_VERIFY_PKCS1_PSS_MGF1,
@@ -168,7 +169,7 @@ RSA_verify_PKCS1_PSS_mgf1(RSA *rsa, const unsigned char *mHash,
168 if (memcmp(H_, H, hLen)) { 169 if (memcmp(H_, H, hLen)) {
169 RSAerr(RSA_F_RSA_VERIFY_PKCS1_PSS_MGF1, RSA_R_BAD_SIGNATURE); 170 RSAerr(RSA_F_RSA_VERIFY_PKCS1_PSS_MGF1, RSA_R_BAD_SIGNATURE);
170 ret = 0; 171 ret = 0;
171 } else 172 } else
172 ret = 1; 173 ret = 1;
173 174
174err: 175err: