mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-30 10:47:28 +02:00
fix curve25519 test sanitizer errors
This commit is contained in:
@ -35110,12 +35110,14 @@ static wc_test_ret_t curve255519_der_test(void)
|
|||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
ret = WC_TEST_RET_ENC_EC(ret);
|
ret = WC_TEST_RET_ENC_EC(ret);
|
||||||
}
|
}
|
||||||
/* Decode private key */
|
if (ret == 0) {
|
||||||
idx = 0;
|
/* Decode private key */
|
||||||
ret = wc_Curve25519KeyDecode(kCurve25519PrivDer, &idx, &key,
|
idx = 0;
|
||||||
(word32)sizeof(kCurve25519PrivDer));
|
ret = wc_Curve25519KeyDecode(kCurve25519PrivDer, &idx, &key,
|
||||||
if (ret < 0) {
|
(word32)sizeof(kCurve25519PrivDer));
|
||||||
ret = WC_TEST_RET_ENC_EC(ret);
|
if (ret < 0) {
|
||||||
|
ret = WC_TEST_RET_ENC_EC(ret);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/* Both public and private flags should be set */
|
/* Both public and private flags should be set */
|
||||||
if ((ret == 0) && (!key.pubSet && !key.privSet)) {
|
if ((ret == 0) && (!key.pubSet && !key.privSet)) {
|
||||||
@ -35123,16 +35125,23 @@ static wc_test_ret_t curve255519_der_test(void)
|
|||||||
}
|
}
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
/* Export key to temporary DER */
|
/* Export key to temporary DER */
|
||||||
ret = wc_Curve25519KeyToDer(&key, output, sizeof(output), 1);
|
outputSz = (word32)sizeof(output);
|
||||||
if (ret < 0) {
|
ret = wc_Curve25519KeyToDer(&key, output, outputSz, 1);
|
||||||
|
if (ret >= 0) {
|
||||||
|
outputSz = (word32)ret;
|
||||||
|
ret = 0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
ret = WC_TEST_RET_ENC_EC(ret);
|
ret = WC_TEST_RET_ENC_EC(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Re-import temporary DER */
|
/* Re-import temporary DER */
|
||||||
idx = 0;
|
if (ret == 0) {
|
||||||
ret = wc_Curve25519KeyDecode(output, &idx, &key, sizeof(output));
|
idx = 0;
|
||||||
if (ret < 0) {
|
ret = wc_Curve25519KeyDecode(output, &idx, &key, sizeof(output));
|
||||||
ret = WC_TEST_RET_ENC_EC(ret);
|
if (ret < 0) {
|
||||||
|
ret = WC_TEST_RET_ENC_EC(ret);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ensure public and private keys survived combined keypair
|
/* Ensure public and private keys survived combined keypair
|
||||||
|
Reference in New Issue
Block a user