forked from wolfSSL/wolfssl
Merge pull request #256 from JacobBarthelmeh/fast-rsa
fix for size of buffer when reading fast-rsa BN data
This commit is contained in:
@@ -2353,7 +2353,7 @@ static int SetRsaPublicKey(byte* output, RsaKey* key,
|
|||||||
if ( (nSz + rawLen) < MAX_RSA_INT_SZ) {
|
if ( (nSz + rawLen) < MAX_RSA_INT_SZ) {
|
||||||
if (leadingBit)
|
if (leadingBit)
|
||||||
n[nSz] = 0;
|
n[nSz] = 0;
|
||||||
err = ippsGetOctString_BN((Ipp8u*)n + nSz, rawLen, key->n);
|
err = ippsGetOctString_BN((Ipp8u*)n + nSz, rawLen - leadingBit, key->n);
|
||||||
if (err == ippStsNoErr)
|
if (err == ippStsNoErr)
|
||||||
nSz += rawLen;
|
nSz += rawLen;
|
||||||
else {
|
else {
|
||||||
@@ -2394,7 +2394,7 @@ static int SetRsaPublicKey(byte* output, RsaKey* key,
|
|||||||
if ( (eSz + rawLen) < MAX_RSA_E_SZ) {
|
if ( (eSz + rawLen) < MAX_RSA_E_SZ) {
|
||||||
if (leadingBit)
|
if (leadingBit)
|
||||||
e[eSz] = 0;
|
e[eSz] = 0;
|
||||||
err = ippsGetOctString_BN((Ipp8u*)e + eSz, rawLen, key->e);
|
err = ippsGetOctString_BN((Ipp8u*)e + eSz, rawLen - leadingBit, key->e);
|
||||||
if (err == ippStsNoErr)
|
if (err == ippStsNoErr)
|
||||||
eSz += rawLen;
|
eSz += rawLen;
|
||||||
else {
|
else {
|
||||||
@@ -2587,7 +2587,7 @@ int wc_RsaKeyToDer(RsaKey* key, byte* output, word32 inLen)
|
|||||||
|
|
||||||
/* extract data*/
|
/* extract data*/
|
||||||
err = ippsGetOctString_BN((Ipp8u*)(tmps[i] + sizes[i]),
|
err = ippsGetOctString_BN((Ipp8u*)(tmps[i] + sizes[i]),
|
||||||
rawLen, keyInt);
|
rawLen - lbit, keyInt);
|
||||||
if (err == ippStsOk) {
|
if (err == ippStsOk) {
|
||||||
sizes[i] += (rawLen-lbit); /* lbit included in rawLen */
|
sizes[i] += (rawLen-lbit); /* lbit included in rawLen */
|
||||||
intTotalLen += sizes[i];
|
intTotalLen += sizes[i];
|
||||||
|
Reference in New Issue
Block a user