From 388d023df664e634daa46f2ac1e77eec178021b9 Mon Sep 17 00:00:00 2001 From: toddouska Date: Tue, 28 Jul 2015 09:29:47 -0700 Subject: [PATCH] put rsa non public enums back into c file for FIPS --- src/ssl.c | 4 ++-- wolfcrypt/src/rsa.c | 16 ++++++++++++++++ wolfssl/wolfcrypt/rsa.h | 13 ------------- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/src/ssl.c b/src/ssl.c index 0cb454215..637db8d61 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -12514,8 +12514,8 @@ int wolfSSL_RSA_generate_key_ex(WOLFSSL_RSA* rsa, int bits, WOLFSSL_BIGNUM* bn, WOLFSSL_ENTER("wolfSSL_RSA_generate_key_ex"); - if (rsa == NULL || rsa->internal == NULL || - bits < RSA_MIN_SIZE || bits > RSA_MAX_SIZE) { + if (rsa == NULL || rsa->internal == NULL) { + /* bit size checked during make key call */ WOLFSSL_MSG("bad arguments"); return SSL_FAILURE; } diff --git a/wolfcrypt/src/rsa.c b/wolfcrypt/src/rsa.c index bc85a949e..5cd6e6331 100644 --- a/wolfcrypt/src/rsa.c +++ b/wolfcrypt/src/rsa.c @@ -144,6 +144,22 @@ int wc_RsaFlattenPublicKey(RsaKey* key, byte* a, word32* aSz, byte* b, word32 outLen, RsaKey* key); #endif +enum { + RSA_PUBLIC_ENCRYPT = 0, + RSA_PUBLIC_DECRYPT = 1, + RSA_PRIVATE_ENCRYPT = 2, + RSA_PRIVATE_DECRYPT = 3, + + RSA_BLOCK_TYPE_1 = 1, + RSA_BLOCK_TYPE_2 = 2, + + RSA_MIN_SIZE = 512, + RSA_MAX_SIZE = 4096, + + RSA_MIN_PAD_SZ = 11 /* seperator + 0 + pad value + 8 pads */ +}; + + int wc_InitRsaKey(RsaKey* key, void* heap) { #ifdef HAVE_CAVIUM diff --git a/wolfssl/wolfcrypt/rsa.h b/wolfssl/wolfcrypt/rsa.h index 1f12df941..df650b3db 100644 --- a/wolfssl/wolfcrypt/rsa.h +++ b/wolfssl/wolfcrypt/rsa.h @@ -47,19 +47,6 @@ enum { RSA_PUBLIC = 0, RSA_PRIVATE = 1, - - RSA_PUBLIC_ENCRYPT = 0, - RSA_PUBLIC_DECRYPT = 1, - RSA_PRIVATE_ENCRYPT = 2, - RSA_PRIVATE_DECRYPT = 3, - - RSA_BLOCK_TYPE_1 = 1, - RSA_BLOCK_TYPE_2 = 2, - - RSA_MIN_SIZE = 512, - RSA_MAX_SIZE = 4096, - - RSA_MIN_PAD_SZ = 11 /* seperator + 0 + pad value + 8 pads */ };