Skip to content

Commit 0e14849

Browse files
committed
addressed Copilot review comments
1 parent e3fd4cc commit 0e14849

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

doc/dox_comments/header_files/signature.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,12 @@
1111
\param sig_type A signature type enum value such as
1212
WC_SIGNATURE_TYPE_ECC or WC_SIGNATURE_TYPE_RSA.
1313
\param key Pointer to the key structure corresponding to sig_type:
14-
pass an ecc_key* (cast to const void*) for
15-
WC_SIGNATURE_TYPE_ECC, or a RsaKey* for
14+
pass an ecc_key* for WC_SIGNATURE_TYPE_ECC, or a RsaKey* for
1615
WC_SIGNATURE_TYPE_RSA / WC_SIGNATURE_TYPE_RSA_W_ENC.
1716
The caller is responsible for ensuring the pointer refers to the correct
1817
type; this function cannot verify the actual runtime type of the object.
19-
\param key_len Must be exactly sizeof(ecc_key) or
20-
sizeof(RsaKey) matching the sig_type. Passing any other value
18+
\param key_len If key is non-NULL, key_len Must be exactly sizeof(ecc_key)
19+
or sizeof(RsaKey) matching the sig_type. Passing any other value
2120
causes the function to return BAD_FUNC_ARG without dereferencing key.
2221
The conventional idiom is to pass sizeof(*key) at the call site.
2322

wolfcrypt/src/signature.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,10 @@ int wc_SignatureGetSize(enum wc_SignatureType sig_type,
9494
case WC_SIGNATURE_TYPE_ECC:
9595
#ifdef HAVE_ECC
9696
/* Verify that key_len matches exactly sizeof(ecc_key).
97-
* This is a necessary but not sufficient type check: the void*
98-
* API cannot verify the actual runtime type of the pointed-to
99-
* object. Callers must pass a valid ecc_key* cast to void*. */
97+
* This is a necessary but not sufficient type check:
98+
* the const void* API cannot verify the actual runtime
99+
* type of the pointed-to object.
100+
* Callers must pass a valid ecc_key* cast to const void*. */
100101
if (key_len == sizeof(ecc_key)) {
101102
#if defined(HAVE_SELFTEST) || (defined(HAVE_FIPS) && FIPS_VERSION3_LT(5,0,0))
102103
sig_len = wc_ecc_sig_size((ecc_key*)(wc_ptr_t)key);

0 commit comments

Comments
 (0)