Skip to content

Commit

Permalink
Only pass access_info to imaevm_signhash if an engine is provided
Browse files Browse the repository at this point in the history
Avoid the access_info parameter from being passed to imaevm_signhash
if no engine is provided.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
  • Loading branch information
stefanberger committed Aug 29, 2024
1 parent e43ea90 commit d15dce2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/libimaevm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1447,12 +1447,16 @@ int sign_hash(const char *hashalgo, const unsigned char *hash, int size,
.type = IMAEVM_OSSL_ACCESS_TYPE_ENGINE,
.u.engine = imaevm_params.eng,
};
struct imaevm_ossl_access const *paccess_info = NULL;
if (imaevm_params.eng)
paccess_info = &access_info;

int sigflags = imaevm_params.x509 ? 0 : IMAEVM_SIGFLAG_SIGNATURE_V1;
if (!keypass) /* Avoid breaking existing libimaevm usage */
keypass = imaevm_params.keypass;

return imaevm_signhash(hashalgo, hash, size, keyfile, keypass, sig,
sigflags, &access_info, imaevm_params.keyid);
sigflags, paccess_info, imaevm_params.keyid);
}

static void libinit()
Expand Down

0 comments on commit d15dce2

Please sign in to comment.