fix rsablind other builds

This commit is contained in:
toddouska
2016-07-19 11:29:22 -07:00
parent 8423ad0e96
commit 1b980867d6
4 changed files with 23 additions and 2 deletions

View File

@@ -572,6 +572,16 @@ int wolfSSL_negotiate(WOLFSSL* ssl)
}
WC_RNG* wolfSSL_GetRNG(WOLFSSL* ssl)
{
if (ssl) {
return ssl->rng;
}
return NULL;
}
#ifndef WOLFSSL_LEANPSK
/* object size based on build */
int wolfSSL_GetObjectSize(void)

View File

@@ -1495,6 +1495,9 @@ WOLFSSL_API int wc_PKCS7_DecodeEnvelopedData(PKCS7* pkcs7, byte* pkiMsg,
int encryptedContentSz;
byte padLen;
byte* encryptedContent = NULL;
#ifdef WC_RSA_BLINDING
WC_RNG rng;
#endif
if (pkcs7 == NULL || pkcs7->singleCert == NULL ||
pkcs7->singleCertSz == 0 || pkcs7->privateKey == NULL ||
@@ -1770,11 +1773,17 @@ WOLFSSL_API int wc_PKCS7_DecodeEnvelopedData(PKCS7* pkcs7, byte* pkiMsg,
/* decrypt encryptedKey */
#ifdef WC_RSA_BLINDING
ret = wc_RsaSetRNG(key, ssl->rng);
ret = wc_InitRng(&rng);
if (ret == 0) {
ret = wc_RsaSetRNG(privKey, &rng);
}
#endif
if (ret == 0) {
keySz = wc_RsaPrivateDecryptInline(encryptedKey, encryptedKeySz,
&decryptedKey, privKey);
#ifdef WC_RSA_BLINDING
wc_FreeRng(&rng);
#endif
} else {
keySz = ret;
}

View File

@@ -74,6 +74,7 @@ typedef struct WOLFSSL_X509_CHAIN WOLFSSL_X509_CHAIN;
typedef struct WOLFSSL_CERT_MANAGER WOLFSSL_CERT_MANAGER;
typedef struct WOLFSSL_SOCKADDR WOLFSSL_SOCKADDR;
typedef struct WC_RNG WC_RNG;
/* redeclare guard */
#define WOLFSSL_TYPES_DEFINED
@@ -991,6 +992,7 @@ WOLFSSL_API int wolfSSL_CTX_SetTmpDH_buffer(WOLFSSL_CTX*, const unsigned char*
WOLFSSL_API int wolfSSL_CTX_SetMinDhKey_Sz(WOLFSSL_CTX*, unsigned short);
WOLFSSL_API int wolfSSL_SetMinDhKey_Sz(WOLFSSL*, unsigned short);
WOLFSSL_API int wolfSSL_GetDhKey_Sz(WOLFSSL*);
WOLFSSL_API WC_RNG* wolfSSL_GetRNG(WOLFSSL*);
#endif /* NO_DH */
#ifndef NO_RSA

View File

@@ -1774,7 +1774,7 @@ static INLINE int myRsaDec(WOLFSSL* ssl, byte* in, word32 inSz,
ret = wc_RsaPrivateKeyDecode(key, &idx, &myKey, keySz);
if (ret == 0) {
#ifdef WC_RSA_BLINDING
ret = wc_RsaSetRNG(&myKey, ssl->rng);
ret = wc_RsaSetRNG(&myKey, wolfSSL_GetRNG(ssl));
if (ret != 0) {
wc_FreeRsaKey(&myKey);
return ret;