Update from review

This commit is contained in:
Eric Blankenhorn
2018-06-29 11:02:10 -05:00
parent c6890d518e
commit ebb3eb87d1

View File

@@ -22163,6 +22163,7 @@ int wolfSSL_BN_hex2bn(WOLFSSL_BIGNUM** bn, const char* str)
#else
byte decoded[1024];
#endif
int weOwn = 0;
WOLFSSL_MSG("wolfSSL_BN_hex2bn");
@@ -22179,15 +22180,21 @@ int wolfSSL_BN_hex2bn(WOLFSSL_BIGNUM** bn, const char* str)
else if (bn == NULL)
ret = decSz;
else {
if (*bn == NULL)
if (*bn == NULL) {
*bn = wolfSSL_BN_new();
if (*bn != NULL) {
weOwn = 1;
}
}
if (*bn == NULL)
WOLFSSL_MSG("BN new failed");
else if (wolfSSL_BN_bin2bn(decoded, decSz, *bn) == NULL) {
WOLFSSL_MSG("Bad bin2bn error");
if (weOwn == 1) {
wolfSSL_BN_free(*bn); /* Free new BN */
}
}
else
ret = WOLFSSL_SUCCESS;
}