fix mcapi with blinding API addition

pull/499/head
toddouska 2016-07-25 15:57:38 -07:00
parent cd5486a4e6
commit 51042e166f
3 changed files with 18 additions and 2 deletions

View File

@ -536,7 +536,16 @@ int CRYPT_RSA_EncryptSizeGet(CRYPT_RSA_CTX* rsa)
return BAD_FUNC_ARG;
return RsaEncryptSize((RsaKey*)rsa->holder);
}
}
int CRYPT_RSA_SetRng(CRYPT_RSA_CTX* rsa, CRYPT_RNG_CTX* rng)
{
if (rsa == NULL)
return BAD_FUNC_ARG;
return wc_RsaSetRNG((RsaKey*)rsa->holder, (WC_RNG*)rng);
}
/* ECC init */

View File

@ -220,7 +220,8 @@ int CRYPT_RSA_PrivateDecrypt(CRYPT_RSA_CTX*, unsigned char*,
unsigned int, const unsigned char*, unsigned int);
/* helpers */
int CRYPT_RSA_EncryptSizeGet(CRYPT_RSA_CTX*);
int CRYPT_RSA_EncryptSizeGet(CRYPT_RSA_CTX*);
int CRYPT_RSA_SetRng(CRYPT_RSA_CTX*, CRYPT_RNG_CTX*);

View File

@ -1296,6 +1296,12 @@ static int check_rsa(void)
return -1;
}
ret = CRYPT_RSA_SetRng(&mcRsa, &mcRng);
if (ret != 0) {
printf("mcapi rsa set rng failed\n");
return -1;
}
ret = CRYPT_RSA_PublicEncrypt(&mcRsa, out1, sizeof(out1), ourData,
RSA_TEST_SIZE, &mcRng);
if (ret < 0) {