Skip to content

Commit

Permalink
conditional code for older openssl versions
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Baentsch <[email protected]>
  • Loading branch information
baentsch committed Dec 4, 2024
1 parent 8ef2757 commit 1073b43
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions oqsprov/oqs_sig.c
Original file line number Diff line number Diff line change
Expand Up @@ -1320,13 +1320,16 @@ static int oqs_sig_set_ctx_params(void *vpoqs_sigctx,
if (!oqs_sig_setup_md(poqs_sigctx, mdname, mdprops))
return 0;
}
p = OSSL_PARAM_locate_const(params, OSSL_SIGNATURE_PARAM_CONTEXT_STRING);
if (p != NULL) {
if (!OSSL_PARAM_get_octet_string(
p, &poqs_sigctx->context_string, 0,
&(poqs_sigctx->context_string_length))) {
poqs_sigctx->context_string_length = 0;
return 0;
if (OPENSSL_VERSION_PREREQ(3, 2)) {
p = OSSL_PARAM_locate_const(params,
OSSL_SIGNATURE_PARAM_CONTEXT_STRING);
if (p != NULL) {
if (!OSSL_PARAM_get_octet_string(
p, &poqs_sigctx->context_string, 0,
&(poqs_sigctx->context_string_length))) {
poqs_sigctx->context_string_length = 0;
return 0;
}
}
}

Expand All @@ -1337,7 +1340,9 @@ static int oqs_sig_set_ctx_params(void *vpoqs_sigctx,
static const OSSL_PARAM known_settable_ctx_params[] = {
OSSL_PARAM_utf8_string(OSSL_SIGNATURE_PARAM_DIGEST, NULL, 0),
OSSL_PARAM_utf8_string(OSSL_SIGNATURE_PARAM_PROPERTIES, NULL, 0),
#if (OPENSSL_VERSION_PREREQ(3, 2))
OSSL_PARAM_octet_string(OSSL_SIGNATURE_PARAM_CONTEXT_STRING, NULL, 0),
#endif
OSSL_PARAM_END};

static const OSSL_PARAM *
Expand Down

0 comments on commit 1073b43

Please sign in to comment.