Fixed defects

List of Defects

Error: CLANG_WARNING: [#def1]
pkcs11-provider-0.3-build/pkcs11-provider-0.3/src/interface.c:168:5: warning[deadcode.DeadStores]: Value stored to 'ret' is never read
#  166|       }
#  167|   
#  168|->     ret = CKR_FUNCTION_NOT_SUPPORTED;
#  169|       intf->GetInterface = dlsym(mctx->dlhandle, "C_GetInterface");
#  170|       if (!intf->GetInterface) {

Error: CLANG_WARNING: [#def2]
pkcs11-provider-0.3-build/pkcs11-provider-0.3/src/objects.c:1867:9: warning[deadcode.DeadStores]: Value stored to 'nattr' is never read
# 1865|       case CKK_EC:
# 1866|           attrs[0].type = CKA_P11PROV_CURVE_NID;
# 1867|->         nattr = 1;
# 1868|           rv = get_public_attrs(obj, attrs, 1);
# 1869|           if (rv != CKR_OK) {

Error: GCC_ANALYZER_WARNING (CWE-476): [#def3]
pkcs11-provider-0.3-build/pkcs11-provider-0.3/src/signature.c: scope_hint: In function 'p11prov_sig_get_sig_size'
pkcs11-provider-0.3-build/pkcs11-provider-0.3/src/signature.c:580:17: warning[-Wanalyzer-null-dereference]: dereference of NULL 'siglen'
#  578|       switch (type) {
#  579|       case CKK_RSA:
#  580|->         *siglen = size;
#  581|           break;
#  582|       case CKK_EC:

Error: CLANG_WARNING: [#def4]
pkcs11-provider-0.3-build/pkcs11-provider-0.3/src/signature.c:580:17: warning[core.NullDereference]: Dereference of null pointer (loaded from variable 'siglen')
#  578|       switch (type) {
#  579|       case CKK_RSA:
#  580|->         *siglen = size;
#  581|           break;
#  582|       case CKK_EC:

Error: GCC_ANALYZER_WARNING (CWE-476): [#def5]
pkcs11-provider-0.3-build/pkcs11-provider-0.3/src/signature.c:584:17: warning[-Wanalyzer-null-dereference]: dereference of NULL 'siglen'
#  582|       case CKK_EC:
#  583|           /* add room for ECDSA Signature DER overhead */
#  584|->         *siglen = 3 + (size + 4) * 2;
#  585|           break;
#  586|       case CKK_EC_EDWARDS:

Error: CLANG_WARNING: [#def6]
pkcs11-provider-0.3-build/pkcs11-provider-0.3/src/signature.c:584:17: warning[core.NullDereference]: Dereference of null pointer (loaded from variable 'siglen')
#  582|       case CKK_EC:
#  583|           /* add room for ECDSA Signature DER overhead */
#  584|->         *siglen = 3 + (size + 4) * 2;
#  585|           break;
#  586|       case CKK_EC_EDWARDS:

Error: GCC_ANALYZER_WARNING (CWE-476): [#def7]
pkcs11-provider-0.3-build/pkcs11-provider-0.3/src/signature.c:588:21: warning[-Wanalyzer-null-dereference]: dereference of NULL 'siglen'
#  586|       case CKK_EC_EDWARDS:
#  587|           if (size == ED25519_BYTE_SIZE) {
#  588|->             *siglen = ED25519_SIG_SIZE;
#  589|           } else if (size == ED448_BYTE_SIZE) {
#  590|               *siglen = ED448_SIG_SIZE;

Error: CLANG_WARNING: [#def8]
pkcs11-provider-0.3-build/pkcs11-provider-0.3/src/signature.c:588:21: warning[core.NullDereference]: Dereference of null pointer (loaded from variable 'siglen')
#  586|       case CKK_EC_EDWARDS:
#  587|           if (size == ED25519_BYTE_SIZE) {
#  588|->             *siglen = ED25519_SIG_SIZE;
#  589|           } else if (size == ED448_BYTE_SIZE) {
#  590|               *siglen = ED448_SIG_SIZE;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def9]
pkcs11-provider-0.3-build/pkcs11-provider-0.3/src/signature.c:590:21: warning[-Wanalyzer-null-dereference]: dereference of NULL 'siglen'
#  588|               *siglen = ED25519_SIG_SIZE;
#  589|           } else if (size == ED448_BYTE_SIZE) {
#  590|->             *siglen = ED448_SIG_SIZE;
#  591|           } else {
#  592|               return CKR_KEY_TYPE_INCONSISTENT;

Error: CLANG_WARNING: [#def10]
pkcs11-provider-0.3-build/pkcs11-provider-0.3/src/signature.c:590:21: warning[core.NullDereference]: Dereference of null pointer (loaded from variable 'siglen')
#  588|               *siglen = ED25519_SIG_SIZE;
#  589|           } else if (size == ED448_BYTE_SIZE) {
#  590|->             *siglen = ED448_SIG_SIZE;
#  591|           } else {
#  592|               return CKR_KEY_TYPE_INCONSISTENT;

Error: CLANG_WARNING: [#def11]
pkcs11-provider-0.3-build/pkcs11-provider-0.3/src/signature.c:1899:11: warning[core.CallAndMessage]: 2nd function call argument is an uninitialized value
# 1897|       }
# 1898|   
# 1899|->     ret = convert_ecdsa_raw_to_der(raw, rawlen, sig, siglen, sigsize);
# 1900|       OPENSSL_cleanse(raw, rawlen);
# 1901|       return ret;

Scan Properties

analyzer-version-clang18.1.7
analyzer-version-cppcheck2.14.2
analyzer-version-gcc14.1.1
analyzer-version-gcc-analyzer14.1.1
analyzer-version-shellcheck0.10.0
diffbase-analyzer-version-clang18.1.7
diffbase-analyzer-version-cppcheck2.14.2
diffbase-analyzer-version-gcc14.1.1
diffbase-analyzer-version-gcc-analyzer14.1.1
diffbase-analyzer-version-shellcheck0.10.0
diffbase-enabled-pluginsclang, cppcheck, gcc, shellcheck
diffbase-exit-code0
diffbase-hostip-172-16-1-227.us-west-2.compute.internal
diffbase-mock-configfedora-41-x86_64
diffbase-project-namepkcs11-provider-0.5-2.fc41
diffbase-store-results-to/tmp/tmphvog89hx/pkcs11-provider-0.5-2.fc41.tar.xz
diffbase-time-created2024-07-03 16:55:58
diffbase-time-finished2024-07-03 16:57:03
diffbase-toolcsmock
diffbase-tool-args'/usr/bin/csmock' '-r' 'fedora-41-x86_64' '-t' 'cppcheck,gcc,clang,shellcheck' '-o' '/tmp/tmphvog89hx/pkcs11-provider-0.5-2.fc41.tar.xz' '--gcc-analyze' '/tmp/tmphvog89hx/pkcs11-provider-0.5-2.fc41.src.rpm'
diffbase-tool-versioncsmock-3.5.3-1.el9
enabled-pluginsclang, cppcheck, gcc, shellcheck
exit-code0
hostip-172-16-1-227.us-west-2.compute.internal
mock-configfedora-41-x86_64
project-namepkcs11-provider-0.3-2.fc40
store-results-to/tmp/tmp6aqw4lym/pkcs11-provider-0.3-2.fc40.tar.xz
time-created2024-07-03 16:53:56
time-finished2024-07-03 16:55:43
titleFixed defects
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-41-x86_64' '-t' 'cppcheck,gcc,clang,shellcheck' '-o' '/tmp/tmp6aqw4lym/pkcs11-provider-0.3-2.fc40.tar.xz' '--gcc-analyze' '/tmp/tmp6aqw4lym/pkcs11-provider-0.3-2.fc40.src.rpm'
tool-versioncsmock-3.5.3-1.el9