Merge pull request #491 from toddouska/rsab-fixes

fix rsablind other builds
This commit is contained in:
dgarske
2016-07-20 15:22:19 -07:00
committed by GitHub
4 changed files with 24 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
@@ -1173,6 +1174,8 @@ enum {
WOLFSSL_CHAIN_CA = 2 /* added to cache from trusted chain */
};
WOLFSSL_API WC_RNG* wolfSSL_GetRNG(WOLFSSL*);
WOLFSSL_API int wolfSSL_CTX_SetMinVersion(WOLFSSL_CTX* ctx, int version);
WOLFSSL_API int wolfSSL_SetMinVersion(WOLFSSL* ssl, int version);
WOLFSSL_API int wolfSSL_GetObjectSize(void); /* object size based on build */

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;