summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/rsa
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/rsa')
-rw-r--r--src/lib/libcrypto/rsa/rsa.h4
-rw-r--r--src/lib/libcrypto/rsa/rsa_eay.c2
-rw-r--r--src/lib/libcrypto/rsa/rsa_gen.c3
-rw-r--r--src/lib/libcrypto/rsa/rsa_saos.c7
-rw-r--r--src/lib/libcrypto/rsa/rsa_sign.c9
5 files changed, 19 insertions, 6 deletions
diff --git a/src/lib/libcrypto/rsa/rsa.h b/src/lib/libcrypto/rsa/rsa.h
index 62fa745f79..fc3bb5f86d 100644
--- a/src/lib/libcrypto/rsa/rsa.h
+++ b/src/lib/libcrypto/rsa/rsa.h
@@ -72,6 +72,10 @@
72#error RSA is disabled. 72#error RSA is disabled.
73#endif 73#endif
74 74
75#if defined(OPENSSL_FIPS)
76#define FIPS_RSA_SIZE_T int
77#endif
78
75#ifdef __cplusplus 79#ifdef __cplusplus
76extern "C" { 80extern "C" {
77#endif 81#endif
diff --git a/src/lib/libcrypto/rsa/rsa_eay.c b/src/lib/libcrypto/rsa/rsa_eay.c
index e0d286266e..d4caab3f95 100644
--- a/src/lib/libcrypto/rsa/rsa_eay.c
+++ b/src/lib/libcrypto/rsa/rsa_eay.c
@@ -62,7 +62,7 @@
62#include <openssl/rsa.h> 62#include <openssl/rsa.h>
63#include <openssl/rand.h> 63#include <openssl/rand.h>
64 64
65#ifndef RSA_NULL 65#if !defined(RSA_NULL) && !defined(OPENSSL_FIPS)
66 66
67static int RSA_eay_public_encrypt(int flen, const unsigned char *from, 67static int RSA_eay_public_encrypt(int flen, const unsigned char *from,
68 unsigned char *to, RSA *rsa,int padding); 68 unsigned char *to, RSA *rsa,int padding);
diff --git a/src/lib/libcrypto/rsa/rsa_gen.c b/src/lib/libcrypto/rsa/rsa_gen.c
index 00c25adbc5..adb5e34da5 100644
--- a/src/lib/libcrypto/rsa/rsa_gen.c
+++ b/src/lib/libcrypto/rsa/rsa_gen.c
@@ -62,6 +62,8 @@
62#include <openssl/bn.h> 62#include <openssl/bn.h>
63#include <openssl/rsa.h> 63#include <openssl/rsa.h>
64 64
65#ifndef OPENSSL_FIPS
66
65RSA *RSA_generate_key(int bits, unsigned long e_value, 67RSA *RSA_generate_key(int bits, unsigned long e_value,
66 void (*callback)(int,int,void *), void *cb_arg) 68 void (*callback)(int,int,void *), void *cb_arg)
67 { 69 {
@@ -195,3 +197,4 @@ err:
195 return(rsa); 197 return(rsa);
196 } 198 }
197 199
200#endif
diff --git a/src/lib/libcrypto/rsa/rsa_saos.c b/src/lib/libcrypto/rsa/rsa_saos.c
index f462716a57..24fc94835e 100644
--- a/src/lib/libcrypto/rsa/rsa_saos.c
+++ b/src/lib/libcrypto/rsa/rsa_saos.c
@@ -139,8 +139,11 @@ int RSA_verify_ASN1_OCTET_STRING(int dtype,
139 ret=1; 139 ret=1;
140err: 140err:
141 if (sig != NULL) M_ASN1_OCTET_STRING_free(sig); 141 if (sig != NULL) M_ASN1_OCTET_STRING_free(sig);
142 OPENSSL_cleanse(s,(unsigned int)siglen); 142 if (s != NULL)
143 OPENSSL_free(s); 143 {
144 OPENSSL_cleanse(s,(unsigned int)siglen);
145 OPENSSL_free(s);
146 }
144 return(ret); 147 return(ret);
145 } 148 }
146 149
diff --git a/src/lib/libcrypto/rsa/rsa_sign.c b/src/lib/libcrypto/rsa/rsa_sign.c
index 8a1e642183..cee09eccb1 100644
--- a/src/lib/libcrypto/rsa/rsa_sign.c
+++ b/src/lib/libcrypto/rsa/rsa_sign.c
@@ -169,7 +169,7 @@ int RSA_verify(int dtype, const unsigned char *m, unsigned int m_len,
169 } 169 }
170 if((dtype == NID_md5_sha1) && (m_len != SSL_SIG_LENGTH) ) { 170 if((dtype == NID_md5_sha1) && (m_len != SSL_SIG_LENGTH) ) {
171 RSAerr(RSA_F_RSA_VERIFY,RSA_R_INVALID_MESSAGE_LENGTH); 171 RSAerr(RSA_F_RSA_VERIFY,RSA_R_INVALID_MESSAGE_LENGTH);
172 return(0); 172 goto err;
173 } 173 }
174 i=RSA_public_decrypt((int)siglen,sigbuf,s,rsa,RSA_PKCS1_PADDING); 174 i=RSA_public_decrypt((int)siglen,sigbuf,s,rsa,RSA_PKCS1_PADDING);
175 175
@@ -222,8 +222,11 @@ int RSA_verify(int dtype, const unsigned char *m, unsigned int m_len,
222 } 222 }
223err: 223err:
224 if (sig != NULL) X509_SIG_free(sig); 224 if (sig != NULL) X509_SIG_free(sig);
225 OPENSSL_cleanse(s,(unsigned int)siglen); 225 if (s != NULL)
226 OPENSSL_free(s); 226 {
227 OPENSSL_cleanse(s,(unsigned int)siglen);
228 OPENSSL_free(s);
229 }
227 return(ret); 230 return(ret);
228 } 231 }
229 232