11164 libkmf: NULL pointer errors

Review Request #1949 - Created June 1, 2019 and submitted - Latest diff uploaded

Information
Toomas Soome
illumos-gate
11164
79694d3...
Reviewers
general
../common/pkcs11_spi.c: In function 'pk11_authenticate':
../common/pkcs11_spi.c:197:15: error: comparison between pointer and integer [-Werror]
  if (hSession == NULL)
               ^~
In file included from /code/illumos-gate/proto/root_i386/usr/include/iso/stdio_iso.h:53:0,
                 from /code/illumos-gate/proto/root_i386/usr/include/stdio.h:82,
                 from ../common/pkcs11_spi.c:26:
../common/pkcs11_spi.c: In function 'CreateCertObject':
/code/illumos-gate/proto/root_i386/usr/include/sys/null.h:28:14: error: initialization makes integer from pointer without a cast [-Werror=int-conversion]
 #define NULL ((void *)0)
              ^
../common/pkcs11_spi.c:1107:27: note: in expansion of macro 'NULL'
  CK_OBJECT_HANDLE hCert = NULL;
                           ^~~~
../common/pkcs11_spi.c: In function 'KMFPK11_SetTokenPin':
/code/illumos-gate/proto/root_i386/usr/include/sys/null.h:28:14: error: initialization makes integer from pointer without a cast [-Werror=int-conversion]
 #define NULL ((void *)0)
              ^
../common/pkcs11_spi.c:3745:30: note: in expansion of macro 'NULL'
  CK_SESSION_HANDLE session = NULL;
                              ^~~~
../common/pkcs11_spi.c:3822:14: error: comparison between pointer and integer [-Werror]
  if (session != NULL)
              ^~

In file included from /code/illumos-gate/proto/root_i386/usr/include/iso/stdlib_iso.h:50:0,
                 from /code/illumos-gate/proto/root_i386/usr/include/stdlib.h:37,
                 from ../common/openssl_spi.c:70:
../common/openssl_spi.c: In function 'readAltFormatPrivateKey':
/code/illumos-gate/proto/root_i386/usr/include/sys/null.h:28:14: error: initialization makes integer from pointer without a cast [-Werror=int-conversion]
 #define NULL ((void *)0)
              ^
../common/openssl_spi.c:821:19: note: in expansion of macro 'NULL'
  BerValue OID = { NULL, 0 };
                   ^~~~
/code/illumos-gate/proto/root_i386/usr/include/sys/null.h:28:14: note: (near initialization for 'OID.bv_len')
 #define NULL ((void *)0)
              ^
../common/openssl_spi.c:821:19: note: in expansion of macro 'NULL'
  BerValue OID = { NULL, 0 };
                   ^~~~
../common/openssl_spi.c: In function 'check_response_signature':
../common/openssl_spi.c:2638:40: error: comparison between pointer and integer [-Werror]
   if (sk_X509_push(cert_stack, issuer) == NULL) {
                                        ^~
In file included from /code/illumos-gate/proto/root_i386/usr/include/iso/stdlib_iso.h:50:0,
                 from /code/illumos-gate/proto/root_i386/usr/include/stdlib.h:37,
                 from ../common/openssl_spi.c:70:
../common/openssl_spi.c: In function 'OpenSSL_ExportPK12':
/code/illumos-gate/proto/root_i386/usr/include/sys/null.h:28:14: error: incompatible type for argument 5 of 'kmf_load_cert'
 #define NULL ((void *)0)
              ^
../common/openssl_spi.c:3634:46: note: in expansion of macro 'NULL'
   rv = kmf_load_cert(kmfh, NULL, NULL, NULL, NULL,
                                              ^~~~
../common/openssl_spi.c:772:1: note: expected 'KMF_CERT_VALIDITY {aka enum <anonymous>}' but argument is of type 'void *'
 kmf_load_cert(KMF_HANDLE *kmfh,
 ^~~~~~~~~~~~~
../common/openssl_spi.c: In function 'openssl_parse_bag':
../common/openssl_spi.c:3943:12: error: comparison between pointer and integer [-Werror]
      if (r == NULL) {
            ^~
../common/openssl_spi.c: In function 'openssl_pkcs12_parse':
../common/openssl_spi.c:4029:26: error: comparison between pointer and integer [-Werror]
  if (pin == NULL || *pin == NULL) {
                          ^~

../common/pk11tokens.c: In function 'kmf_select_token':
../common/pk11tokens.c:524:25: error: comparison between pointer and integer [-Werror]
  if (handle->pk11handle != NULL) {
                         ^~
In file included from /code/illumos-gate/proto/root_i386/usr/include/iso/time_iso.h:49:0,
                 from /code/illumos-gate/proto/root_i386/usr/include/time.h:40,
                 from /code/illumos-gate/proto/root_i386/usr/include/sys/time.h:462,
                 from /code/illumos-gate/proto/root_i386/usr/include/sys/select.h:53,
                 from /code/illumos-gate/proto/root_i386/usr/include/sys/types.h:640,
                 from /code/illumos-gate/proto/root_i386/usr/include/kmftypes.h:11,
                 from /code/illumos-gate/proto/root_i386/usr/include/kmfapi.h:31,
                 from ../../include/kmfapiP.h:26,
                 from ../common/pk11keys.c:9:
/code/illumos-gate/proto/root_i386/usr/include/sys/null.h:28:14: error: initialization makes integer from pointer without a cast [-Werror=int-conversion]
 #define NULL ((void *)0)
              ^
../common/pk11keys.c:29:56: note: in expansion of macro 'NULL'
  { KMF_ALGID_RSA, CKK_RSA, CKM_RSA_PKCS, CKM_RSA_PKCS, NULL},
                                                        ^~~~
/code/illumos-gate/proto/root_i386/usr/include/sys/null.h:28:14: note: (near initialization for 'alg_info_map[0].hashmech')
 #define NULL ((void *)0)
              ^
../common/pk11keys.c:29:56: note: in expansion of macro 'NULL'
  { KMF_ALGID_RSA, CKK_RSA, CKM_RSA_PKCS, CKM_RSA_PKCS, NULL},
                                                        ^~~~
../common/pk11keys.c: In function 'PKCS_EncryptData':
/code/illumos-gate/proto/root_i386/usr/include/sys/null.h:28:14: error: initialization makes integer from pointer without a cast [-Werror=int-conversion]
 #define NULL ((void *)0)
              ^
../common/pk11keys.c:557:32: note: in expansion of macro 'NULL'
  CK_SESSION_HANDLE ckSession = NULL;
                                ^~~~
../common/certgetsetop.c: In function 'kmf_set_cert_validity':
../common/certgetsetop.c:1946:16: error: comparison between pointer and integer [-Werror]
  if (notBefore == NULL)
                ^~
../common/certgetsetop.c: In function 'set_bigint':
../common/certgetsetop.c:2005:52: error: comparison between pointer and integer [-Werror]
  if (data == NULL || bigint == NULL || bigint->len == NULL)
                                                    ^~
../common/certop.c: In function 'kmf_encode_cert_record':
../common/certop.c:279:47: error: comparison between pointer and integer [-Werror]
 #define NODATA(d) (d.Data == NULL || d.Length == NULL)
                                               ^
../common/certop.c:294:6: note: in expansion of macro 'NODATA'
  if (NODATA(tbs_cert->version) ||
      ^~~~~~
../common/certop.c:279:47: error: comparison between pointer and integer [-Werror]
 #define NODATA(d) (d.Data == NULL || d.Length == NULL)
                                               ^
../common/certop.c:295:6: note: in expansion of macro 'NODATA'
      NODATA(tbs_cert->signature.algorithm) ||
      ^~~~~~
../common/certop.c:279:47: error: comparison between pointer and integer [-Werror]
 #define NODATA(d) (d.Data == NULL || d.Length == NULL)
                                               ^
../common/certop.c:296:6: note: in expansion of macro 'NODATA'
      NODATA(tbs_cert->subjectPublicKeyInfo.subjectPublicKey) ||
      ^~~~~~

../common/generalop.c: In function 'Cleanup_PK11_Session':
../common/generalop.c:426:26: error: comparison between pointer and integer [-Werror]
   if (handle->pk11handle != NULL) {
                          ^~
../common/generalop.c:428:23: error: assignment makes integer from pointer without a cast [-Werror=int-conversion]
    handle->pk11handle = NULL;
                       ^
cc1: all warnings being treated as errors

  
Loading...