Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
embhorn committed Jan 10, 2025
1 parent 139504b commit 53831d0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions tests/api.c
Original file line number Diff line number Diff line change
Expand Up @@ -26492,6 +26492,7 @@ static int test_wc_ecc_rs_to_sig(void)
byte s[KEY24];
word32 rlen = (word32)sizeof(r);
word32 slen = (word32)sizeof(s);
word32 zeroLen = 0;

/* Init stack variables. */
XMEMSET(sig, 0, ECC_MAX_SIG_SIZE);
Expand All @@ -26517,6 +26518,11 @@ static int test_wc_ecc_rs_to_sig(void)
WC_NO_ERR_TRACE(ECC_BAD_ARG_E));
ExpectIntEQ(wc_ecc_sig_to_rs(sig, siglen, r, &rlen, s, NULL),
WC_NO_ERR_TRACE(ECC_BAD_ARG_E));
ExpectIntEQ(wc_ecc_sig_to_rs(sig, siglen, r, &zeroLen, s, &slen),
WC_NO_ERR_TRACE(ASN_PARSE_E));
ExpectIntEQ(wc_ecc_sig_to_rs(sig, siglen, r, &rlen, s, &zeroLen),
WC_NO_ERR_TRACE(ASN_PARSE_E));

#endif
return EXPECT_RESULT();
} /* END test_wc_ecc_rs_to_sig */
Expand Down
4 changes: 2 additions & 2 deletions wolfcrypt/src/asn.c
Original file line number Diff line number Diff line change
Expand Up @@ -33784,7 +33784,7 @@ int DecodeECC_DSA_Sig_Bin(const byte* sig, word32 sigLen, byte* r, word32* rLen,
*rLen = (word32)len;
else {
/* Buffer too small to hold r value */
return BUFFER_E;
return ASN_PARSE_E;
}
}
if (r)
Expand All @@ -33799,7 +33799,7 @@ int DecodeECC_DSA_Sig_Bin(const byte* sig, word32 sigLen, byte* r, word32* rLen,
*sLen = (word32)len;
else {
/* Buffer too small to hold r value */
return BUFFER_E;
return ASN_PARSE_E;
}
}
if (s)
Expand Down

0 comments on commit 53831d0

Please sign in to comment.