Skip to content

Commit

Permalink
Avoid passing unnecessary access_info parameter
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 since this would pass an unnecessary parameter
in this case.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
  • Loading branch information
stefanberger committed Aug 30, 2024
1 parent 12b44d2 commit 452d099
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 452d099

Please sign in to comment.