diff options
author | djm <> | 2009-01-09 12:14:11 +0000 |
---|---|---|
committer | djm <> | 2009-01-09 12:14:11 +0000 |
commit | a0fdc9ec41594852f67ec77dfad9cb06bacc4186 (patch) | |
tree | c43f6b3a4d93ad2cb3dcf93275295679d895a033 /src/lib/libcrypto/rsa/rsa_sign.c | |
parent | 5a3c0a05c7f2c5d3c584b7c8d6aec836dd724c80 (diff) | |
download | openbsd-a0fdc9ec41594852f67ec77dfad9cb06bacc4186.tar.gz openbsd-a0fdc9ec41594852f67ec77dfad9cb06bacc4186.tar.bz2 openbsd-a0fdc9ec41594852f67ec77dfad9cb06bacc4186.zip |
import openssl-0.9.8j
Diffstat (limited to 'src/lib/libcrypto/rsa/rsa_sign.c')
-rw-r--r-- | src/lib/libcrypto/rsa/rsa_sign.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/src/lib/libcrypto/rsa/rsa_sign.c b/src/lib/libcrypto/rsa/rsa_sign.c index 71aabeea1b..5488c06f6d 100644 --- a/src/lib/libcrypto/rsa/rsa_sign.c +++ b/src/lib/libcrypto/rsa/rsa_sign.c | |||
@@ -90,6 +90,14 @@ int RSA_sign(int type, const unsigned char *m, unsigned int m_len, | |||
90 | i = SSL_SIG_LENGTH; | 90 | i = SSL_SIG_LENGTH; |
91 | s = m; | 91 | s = m; |
92 | } else { | 92 | } else { |
93 | /* NB: in FIPS mode block anything that isn't a TLS signature */ | ||
94 | #ifdef OPENSSL_FIPS | ||
95 | if(FIPS_mode() && !(rsa->flags & RSA_FLAG_NON_FIPS_ALLOW)) | ||
96 | { | ||
97 | RSAerr(RSA_F_RSA_SIGN, RSA_R_OPERATION_NOT_ALLOWED_IN_FIPS_MODE); | ||
98 | return 0; | ||
99 | } | ||
100 | #endif | ||
93 | sig.algor= &algor; | 101 | sig.algor= &algor; |
94 | sig.algor->algorithm=OBJ_nid2obj(type); | 102 | sig.algor->algorithm=OBJ_nid2obj(type); |
95 | if (sig.algor->algorithm == NULL) | 103 | if (sig.algor->algorithm == NULL) |
@@ -167,10 +175,22 @@ int RSA_verify(int dtype, const unsigned char *m, unsigned int m_len, | |||
167 | RSAerr(RSA_F_RSA_VERIFY,ERR_R_MALLOC_FAILURE); | 175 | RSAerr(RSA_F_RSA_VERIFY,ERR_R_MALLOC_FAILURE); |
168 | goto err; | 176 | goto err; |
169 | } | 177 | } |
170 | if((dtype == NID_md5_sha1) && (m_len != SSL_SIG_LENGTH) ) { | 178 | if(dtype == NID_md5_sha1) |
179 | { | ||
180 | if (m_len != SSL_SIG_LENGTH) | ||
181 | { | ||
171 | RSAerr(RSA_F_RSA_VERIFY,RSA_R_INVALID_MESSAGE_LENGTH); | 182 | RSAerr(RSA_F_RSA_VERIFY,RSA_R_INVALID_MESSAGE_LENGTH); |
172 | goto err; | 183 | goto err; |
173 | } | 184 | } |
185 | } | ||
186 | /* NB: in FIPS mode block anything that isn't a TLS signature */ | ||
187 | #ifdef OPENSSL_FIPS | ||
188 | else if(FIPS_mode() && !(rsa->flags & RSA_FLAG_NON_FIPS_ALLOW)) | ||
189 | { | ||
190 | RSAerr(RSA_F_RSA_VERIFY, RSA_R_OPERATION_NOT_ALLOWED_IN_FIPS_MODE); | ||
191 | return 0; | ||
192 | } | ||
193 | #endif | ||
174 | i=RSA_public_decrypt((int)siglen,sigbuf,s,rsa,RSA_PKCS1_PADDING); | 194 | i=RSA_public_decrypt((int)siglen,sigbuf,s,rsa,RSA_PKCS1_PADDING); |
175 | 195 | ||
176 | if (i <= 0) goto err; | 196 | if (i <= 0) goto err; |