Fixed API unit test for wc_ecc_sig_size
to allow smaller result.
This commit is contained in:
parent
ae9ef3998c
commit
bd618970c1
@ -14737,7 +14737,7 @@ static int test_wc_ecc_sig_size (void)
|
||||
|
||||
if (ret == 0) {
|
||||
ret = wc_ecc_sig_size(&key);
|
||||
if (ret == (2 * keySz + SIG_HEADER_SZ + ECC_MAX_PAD_SZ)) {
|
||||
if (ret <= (2 * keySz + SIG_HEADER_SZ + ECC_MAX_PAD_SZ)) {
|
||||
ret = 0;
|
||||
}
|
||||
}
|
||||
|
@ -4236,7 +4236,6 @@ static int wc_ecc_get_curve_order_bit_count(const ecc_set_type* dp)
|
||||
word32 orderBits;
|
||||
DECLARE_CURVE_SPECS(curve, 1);
|
||||
|
||||
/* if the input is larger than curve order, we must truncate */
|
||||
ALLOC_CURVE_SPECS(1);
|
||||
err = wc_ecc_curve_load(dp, &curve, ECC_CURVE_FIELD_ORDER);
|
||||
if (err != 0) {
|
||||
@ -4272,6 +4271,7 @@ static int wc_ecc_sign_hash_hw(const byte* in, word32 inlen,
|
||||
return ECC_BAD_ARG_E;
|
||||
}
|
||||
|
||||
/* if the input is larger than curve order, we must truncate */
|
||||
if ((inlen * WOLFSSL_BIT_SIZE) > orderBits) {
|
||||
inlen = (orderBits + WOLFSSL_BIT_SIZE - 1) / WOLFSSL_BIT_SIZE;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user