From 222374e0676a2b941e2f912a2a7d9ce5845c83a3 Mon Sep 17 00:00:00 2001 From: Michael Baentsch <57787676+baentsch@users.noreply.github.com> Date: Thu, 15 Sep 2022 06:49:03 +0200 Subject: [PATCH] addressing sig length questions (#1306) * addressing sig length questions Co-authored-by: Douglas Stebila --- src/sig/sig.h | 2 +- tests/speed_sig.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/sig/sig.h b/src/sig/sig.h index 8a67b833bf..6dec651664 100644 --- a/src/sig/sig.h +++ b/src/sig/sig.h @@ -242,7 +242,7 @@ typedef struct OQS_SIG { * compile-time macros `OQS_SIG_*_length_*`. * * @param[out] signature The signature on the message represented as a byte string. - * @param[out] signature_len The length of the signature. + * @param[out] signature_len The actual length of the signature. May be smaller than `length_signature` for some algorithms since some algorithms have variable length signatures. * @param[in] message The message to sign represented as a byte string. * @param[in] message_len The length of the message to sign. * @param[in] secret_key The secret key represented as a byte string. diff --git a/tests/speed_sig.c b/tests/speed_sig.c index 4a9bd9aa9b..3fba4546a0 100644 --- a/tests/speed_sig.c +++ b/tests/speed_sig.c @@ -52,6 +52,9 @@ static OQS_STATUS sig_speed_wrapper(const char *method_name, uint64_t duration, if (printInfo) { printf("public key bytes: %zu, secret key bytes: %zu, signature bytes: %zu\n", sig->length_public_key, sig->length_secret_key, sig->length_signature); + if (signature_len != sig->length_signature) { + printf(" Actual signature length returned (%zu) less than declared maximum signature length (%zu)\n", signature_len, sig->length_signature); + } } ret = OQS_SUCCESS;