forked from wolfSSL/wolfssl
update based on PR comments
This commit is contained in:
@ -25938,7 +25938,7 @@ int wc_RsaKeyToDer(RsaKey* key, byte* output, word32 inLen)
|
|||||||
#ifndef WOLFSSL_ASN_TEMPLATE
|
#ifndef WOLFSSL_ASN_TEMPLATE
|
||||||
int ret = 0, i;
|
int ret = 0, i;
|
||||||
int mpSz;
|
int mpSz;
|
||||||
word32 rawLen;
|
word32 rawLen;
|
||||||
word32 seqSz = 0, verSz = 0, intTotalLen = 0, outLen = 0;
|
word32 seqSz = 0, verSz = 0, intTotalLen = 0, outLen = 0;
|
||||||
word32 sizes[RSA_INTS];
|
word32 sizes[RSA_INTS];
|
||||||
byte seq[MAX_SEQ_SZ];
|
byte seq[MAX_SEQ_SZ];
|
||||||
@ -25966,7 +25966,7 @@ int wc_RsaKeyToDer(RsaKey* key, byte* output, word32 inLen)
|
|||||||
/* free outstanding tmps */
|
/* free outstanding tmps */
|
||||||
for (i = 0; i < RSA_INTS; i++) {
|
for (i = 0; i < RSA_INTS; i++) {
|
||||||
if (tmps[i] != NULL)
|
if (tmps[i] != NULL)
|
||||||
XFREE(tmps[i]);
|
XFREE(tmps[i], key->heap, DYNAMIC_TYPE_RSA);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return ret;
|
return ret;
|
||||||
@ -26020,19 +26020,19 @@ int wc_RsaKeyToDer(RsaKey* key, byte* output, word32 inLen)
|
|||||||
XMEMCPY(output + j, tmps[i], sizes[i]);
|
XMEMCPY(output + j, tmps[i], sizes[i]);
|
||||||
j += sizes[i];
|
j += sizes[i];
|
||||||
#else
|
#else
|
||||||
keyInt = GetRsaInt(key, i);
|
keyInt = GetRsaInt(key, i);
|
||||||
ret = mp_unsigned_bin_size(keyInt);
|
ret = mp_unsigned_bin_size(keyInt);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
rawLen = (word32)ret + 1;
|
rawLen = (word32)ret + 1;
|
||||||
ret = 0;
|
ret = 0;
|
||||||
mpSz = SetASNIntMP(keyInt, MAX_RSA_INT_SZ, output + j);
|
mpSz = SetASNIntMP(keyInt, MAX_RSA_INT_SZ, output + j);
|
||||||
if (mpSz < 0) {
|
if (mpSz < 0) {
|
||||||
ret = mpSz;
|
ret = mpSz;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
j += mpSz;
|
j += mpSz;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user