Skip to content

Commit

Permalink
Suppress clang-analyzer warnings
Browse files Browse the repository at this point in the history
This suppresses a couple of dead assignments and unlikely null pointer
dereferences.

Signed-off-by: Daiki Ueno <[email protected]>
  • Loading branch information
ueno committed Apr 17, 2024
1 parent cbc5d0e commit de08d11
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
1 change: 0 additions & 1 deletion src/interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ static CK_RV p11prov_interface_init(P11PROV_MODULE *mctx)
return CKR_HOST_MEMORY;
}

ret = CKR_FUNCTION_NOT_SUPPORTED;
intf->GetInterface = dlsym(mctx->dlhandle, "C_GetInterface");
if (!intf->GetInterface) {
char *err = dlerror();
Expand Down
1 change: 0 additions & 1 deletion src/objects.c
Original file line number Diff line number Diff line change
Expand Up @@ -1870,7 +1870,6 @@ static int p11prov_obj_export_public_ec_key(P11PROV_OBJ *obj,
switch (key_type) {
case CKK_EC:
attrs[0].type = CKA_P11PROV_CURVE_NID;
nattr = 1;
rv = get_public_attrs(obj, attrs, 1);
if (rv != CKR_OK) {
P11PROV_raise(obj->ctx, rv, "Failed to get EC key curve nid");
Expand Down
8 changes: 7 additions & 1 deletion src/signature.c
Original file line number Diff line number Diff line change
Expand Up @@ -877,6 +877,9 @@ static CK_RV p11prov_sig_operate(P11PROV_SIG_CTX *sigctx, unsigned char *sig,
if (sigctx->operation == CKF_VERIFY) {
return CKR_ARGUMENTS_BAD;
}
if (siglen == NULL) {
return CKR_ARGUMENTS_BAD;
}
return p11prov_sig_get_sig_size(sigctx, siglen);
}

Expand Down Expand Up @@ -1042,6 +1045,9 @@ static int p11prov_sig_digest_final(P11PROV_SIG_CTX *sigctx, unsigned char *sig,
if (sigctx->operation == CKF_VERIFY) {
goto done;
}
if (siglen == NULL) {
goto done;
}
ret = p11prov_sig_get_sig_size(sigctx, siglen);
if (ret == CKR_OK) {
result = RET_OSSL_OK;
Expand Down Expand Up @@ -1868,7 +1874,7 @@ static int p11prov_ecdsa_digest_sign_final(void *ctx, unsigned char *sig,
{
P11PROV_SIG_CTX *sigctx = (P11PROV_SIG_CTX *)ctx;
unsigned char raw[P11PROV_MAX_RAW_ECC_SIG_SIZE];
size_t rawlen;
size_t rawlen = 0;
int ret;

/* the siglen might be uninitialized when called from openssl */
Expand Down

0 comments on commit de08d11

Please sign in to comment.