From 7cc684f4f7fbcdc5cf4683eaf025d4f915acbf3c Mon Sep 17 00:00:00 2001 From: "Dr. Stephen Henson" Date: Thu, 27 Jan 2011 17:23:43 +0000 Subject: Redirect FIPS memory allocation to FIPS_malloc() routine, remove OpenSSL malloc dependencies. --- crypto/bn/bn_blind.c | 6 ++++++ crypto/bn/bn_ctx.c | 6 ++++++ crypto/bn/bn_exp.c | 5 +++++ crypto/bn/bn_lib.c | 5 +++++ crypto/bn/bn_rand.c | 5 +++++ crypto/bn/bn_recp.c | 5 +++++ crypto/buffer/buf_str.c | 5 +++++ crypto/dsa/dsa_sign.c | 5 +++++ crypto/rsa/rsa_gen.c | 2 ++ crypto/rsa/rsa_oaep.c | 4 ++++ crypto/rsa/rsa_pss.c | 4 ++++ 11 files changed, 52 insertions(+) (limited to 'crypto') diff --git a/crypto/bn/bn_blind.c b/crypto/bn/bn_blind.c index 6e00f43c66..d2bba48b0d 100644 --- a/crypto/bn/bn_blind.c +++ b/crypto/bn/bn_blind.c @@ -113,6 +113,12 @@ #include "cryptlib.h" #include "bn_lcl.h" +#define OPENSSL_FIPSAPI + +#ifdef OPENSSL_FIPS +#include +#endif + #define BN_BLINDING_COUNTER 32 struct bn_blinding_st diff --git a/crypto/bn/bn_ctx.c b/crypto/bn/bn_ctx.c index 3f2256f675..f16fb35f5a 100644 --- a/crypto/bn/bn_ctx.c +++ b/crypto/bn/bn_ctx.c @@ -60,12 +60,18 @@ #endif #endif +#define OPENSSL_FIPSAPI + #include #include #include "cryptlib.h" #include "bn_lcl.h" +#ifdef OPENSSL_FIPS +#include +#endif + /* TODO list * * 1. Check a bunch of "(words+1)" type hacks in various bignum functions and diff --git a/crypto/bn/bn_exp.c b/crypto/bn/bn_exp.c index d9b6c737fc..2267367793 100644 --- a/crypto/bn/bn_exp.c +++ b/crypto/bn/bn_exp.c @@ -113,6 +113,11 @@ #include "cryptlib.h" #include "bn_lcl.h" +#define OPENSSL_FIPSAPI +#ifdef OPENSSL_FIPS +#include +#endif + /* maximum precomputation table size for *variable* sliding windows */ #define TABLE_SIZE 32 diff --git a/crypto/bn/bn_lib.c b/crypto/bn/bn_lib.c index 7a5676de69..503762b31e 100644 --- a/crypto/bn/bn_lib.c +++ b/crypto/bn/bn_lib.c @@ -67,6 +67,11 @@ #include "cryptlib.h" #include "bn_lcl.h" +#define OPENSSL_FIPSAPI +#ifdef OPENSSL_FIPS +#include +#endif + const char BN_version[]="Big Number" OPENSSL_VERSION_PTEXT; /* This stuff appears to be completely unused, so is deprecated */ diff --git a/crypto/bn/bn_rand.c b/crypto/bn/bn_rand.c index b376c28ff3..070b1e4ed2 100644 --- a/crypto/bn/bn_rand.c +++ b/crypto/bn/bn_rand.c @@ -115,6 +115,11 @@ #include "bn_lcl.h" #include +#define OPENSSL_FIPSAPI +#ifdef OPENSSL_FIPS +#include +#endif + static int bnrand(int pseudorand, BIGNUM *rnd, int bits, int top, int bottom) { unsigned char *buf=NULL; diff --git a/crypto/bn/bn_recp.c b/crypto/bn/bn_recp.c index 2e8efb8dae..dde27ae71a 100644 --- a/crypto/bn/bn_recp.c +++ b/crypto/bn/bn_recp.c @@ -60,6 +60,11 @@ #include "cryptlib.h" #include "bn_lcl.h" +#define OPENSSL_FIPSAPI +#ifdef OPENSSL_FIPS +#include +#endif + void BN_RECP_CTX_init(BN_RECP_CTX *recp) { BN_init(&(recp->N)); diff --git a/crypto/buffer/buf_str.c b/crypto/buffer/buf_str.c index 151f5ea971..6d94942df8 100644 --- a/crypto/buffer/buf_str.c +++ b/crypto/buffer/buf_str.c @@ -60,6 +60,11 @@ #include "cryptlib.h" #include +#define OPENSSL_FIPSAPI +#ifdef OPENSSL_FIPS +#include +#endif + char *BUF_strdup(const char *str) { if (str == NULL) return(NULL); diff --git a/crypto/dsa/dsa_sign.c b/crypto/dsa/dsa_sign.c index e02365a8b1..3684960203 100644 --- a/crypto/dsa/dsa_sign.c +++ b/crypto/dsa/dsa_sign.c @@ -63,6 +63,11 @@ #include #include +#define OPENSSL_FIPSAPI +#ifdef OPENSSL_FIPS +#include +#endif + DSA_SIG * DSA_do_sign(const unsigned char *dgst, int dlen, DSA *dsa) { return dsa->meth->dsa_do_sign(dgst, dlen, dsa); diff --git a/crypto/rsa/rsa_gen.c b/crypto/rsa/rsa_gen.c index b8676ad020..e82a81b03a 100644 --- a/crypto/rsa/rsa_gen.c +++ b/crypto/rsa/rsa_gen.c @@ -70,6 +70,8 @@ #ifdef OPENSSL_FIPS +#define OPENSSL_FIPSAPI + #include #include diff --git a/crypto/rsa/rsa_oaep.c b/crypto/rsa/rsa_oaep.c index eaae712236..48cd89dd48 100644 --- a/crypto/rsa/rsa_oaep.c +++ b/crypto/rsa/rsa_oaep.c @@ -30,6 +30,10 @@ #include #include +#ifdef OPENSSL_FIPS +#include +#endif + static int MGF1(unsigned char *mask, long len, const unsigned char *seed, long seedlen); diff --git a/crypto/rsa/rsa_pss.c b/crypto/rsa/rsa_pss.c index e8f6798bbd..0d008c33f3 100644 --- a/crypto/rsa/rsa_pss.c +++ b/crypto/rsa/rsa_pss.c @@ -67,6 +67,10 @@ #include #include "rsa_locl.h" +#ifdef OPENSSL_FIPS +#include +#endif + static const unsigned char zeroes[] = {0,0,0,0,0,0,0,0}; #if defined(_MSC_VER) && defined(_ARM_) -- cgit v1.2.3