From 62324627aa3309e4f72e3ff0241801f4286fa242 Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Sun, 17 Sep 2000 18:21:27 +0000 Subject: [PATCH] Use sk_*_new_null() instead of sk_*_new(NULL), since that takes care of complaints from the compiler about data pointers and function pointers not being compatible with each other. --- apps/apps.c | 2 +- apps/crl2p7.c | 6 +++--- apps/nseq.c | 2 +- apps/pkcs12.c | 10 +++++----- crypto/asn1/a_set.c | 2 +- crypto/dso/dso_lib.c | 4 ++-- crypto/pkcs12/p12_attr.c | 12 ++++++------ crypto/pkcs12/p12_crt.c | 6 +++--- crypto/pkcs12/p12_kiss.c | 2 +- crypto/pkcs12/p12_npas.c | 2 +- crypto/pkcs7/pk7_doit.c | 2 +- crypto/pkcs7/pk7_mime.c | 2 +- crypto/pkcs7/pk7_smime.c | 4 ++-- crypto/x509v3/v3_akey.c | 2 +- crypto/x509v3/v3_alt.c | 6 +++--- crypto/x509v3/v3_crld.c | 2 +- crypto/x509v3/v3_extku.c | 2 +- crypto/x509v3/v3_genn.c | 2 +- crypto/x509v3/v3_info.c | 4 ++-- crypto/x509v3/v3_utl.c | 2 +- ssl/ssl_cert.c | 2 +- ssl/ssl_ciph.c | 2 +- ssl/ssl_lib.c | 2 +- 23 files changed, 41 insertions(+), 41 deletions(-) diff --git a/apps/apps.c b/apps/apps.c index e5a42d4d97..c22550b294 100644 --- a/apps/apps.c +++ b/apps/apps.c @@ -660,7 +660,7 @@ STACK_OF(X509) *load_certs(BIO *err, char *file, int format) if (format == FORMAT_PEM) { - othercerts = sk_X509_new(NULL); + othercerts = sk_X509_new_null(); if(!othercerts) { sk_X509_free(othercerts); diff --git a/apps/crl2p7.c b/apps/crl2p7.c index ebf5fe90ec..d02862710d 100644 --- a/apps/crl2p7.c +++ b/apps/crl2p7.c @@ -141,7 +141,7 @@ int MAIN(int argc, char **argv) else if (strcmp(*argv,"-certfile") == 0) { if (--argc < 1) goto bad; - if(!certflst) certflst = sk_new(NULL); + if(!certflst) certflst = sk_new_null(); sk_push(certflst,*(++argv)); } else @@ -215,7 +215,7 @@ bad: p7s->contents->type=OBJ_nid2obj(NID_pkcs7_data); if (!ASN1_INTEGER_set(p7s->version,1)) goto end; - if ((crl_stack=sk_X509_CRL_new(NULL)) == NULL) goto end; + if ((crl_stack=sk_X509_CRL_new_null()) == NULL) goto end; p7s->crl=crl_stack; if (crl != NULL) { @@ -223,7 +223,7 @@ bad: crl=NULL; /* now part of p7 for OPENSSL_freeing */ } - if ((cert_stack=sk_X509_new(NULL)) == NULL) goto end; + if ((cert_stack=sk_X509_new_null()) == NULL) goto end; p7s->cert=cert_stack; if(certflst) for(i = 0; i < sk_num(certflst); i++) { diff --git a/apps/nseq.c b/apps/nseq.c index cc88d50ceb..7210fbdb5e 100644 --- a/apps/nseq.c +++ b/apps/nseq.c @@ -123,7 +123,7 @@ int MAIN(int argc, char **argv) if (toseq) { seq = NETSCAPE_CERT_SEQUENCE_new(); - seq->certs = sk_X509_new(NULL); + seq->certs = sk_X509_new_null(); while((x509 = PEM_read_bio_X509(in, NULL, NULL, NULL))) sk_X509_push(seq->certs,x509); diff --git a/apps/pkcs12.c b/apps/pkcs12.c index 0f3ac4977a..261139565d 100644 --- a/apps/pkcs12.c +++ b/apps/pkcs12.c @@ -197,7 +197,7 @@ int MAIN(int argc, char **argv) } else if (!strcmp (*args, "-caname")) { if (args[1]) { args++; - if (!canames) canames = sk_new(NULL); + if (!canames) canames = sk_new_null(); sk_push(canames, *args); } else badarg = 1; } else if (!strcmp (*args, "-in")) { @@ -404,7 +404,7 @@ int MAIN(int argc, char **argv) CRYPTO_push_info("reading certs from input"); #endif - certs = sk_X509_new(NULL); + certs = sk_X509_new_null(); /* Load in all certs in input file */ if(!cert_load(in, certs)) { @@ -436,7 +436,7 @@ int MAIN(int argc, char **argv) CRYPTO_push_info("reading certs from certfile"); #endif - bags = sk_PKCS12_SAFEBAG_new (NULL); + bags = sk_PKCS12_SAFEBAG_new_null (); /* Add any more certificates asked for */ if (certsin) { @@ -527,7 +527,7 @@ int MAIN(int argc, char **argv) goto export_end; } - safes = sk_PKCS7_new (NULL); + safes = sk_PKCS7_new_null (); sk_PKCS7_push (safes, authsafe); #ifdef CRYPTO_MDEBUG @@ -543,7 +543,7 @@ int MAIN(int argc, char **argv) p8 = NULL; if (name) PKCS12_add_friendlyname (bag, name, -1); PKCS12_add_localkeyid (bag, keyid, keyidlen); - bags = sk_PKCS12_SAFEBAG_new(NULL); + bags = sk_PKCS12_SAFEBAG_new_null(); sk_PKCS12_SAFEBAG_push (bags, bag); #ifdef CRYPTO_MDEBUG diff --git a/crypto/asn1/a_set.c b/crypto/asn1/a_set.c index 1921f5eaa1..caf5a1419c 100644 --- a/crypto/asn1/a_set.c +++ b/crypto/asn1/a_set.c @@ -158,7 +158,7 @@ STACK *d2i_ASN1_SET(STACK **a, unsigned char **pp, long length, STACK *ret=NULL; if ((a == NULL) || ((*a) == NULL)) - { if ((ret=sk_new(NULL)) == NULL) goto err; } + { if ((ret=sk_new_null()) == NULL) goto err; } else ret=(*a); diff --git a/crypto/dso/dso_lib.c b/crypto/dso/dso_lib.c index d1d50cc5e6..acd166697e 100644 --- a/crypto/dso/dso_lib.c +++ b/crypto/dso/dso_lib.c @@ -107,8 +107,8 @@ DSO *DSO_new_method(DSO_METHOD *meth) return(NULL); } memset(ret, 0, sizeof(DSO)); - ret->meth_data = sk_new(NULL); - if((ret->meth_data = sk_new(NULL)) == NULL) + ret->meth_data = sk_new_null(); + if((ret->meth_data = sk_new_null()) == NULL) { /* sk_new doesn't generate any errors so we do */ DSOerr(DSO_F_DSO_NEW_METHOD,ERR_R_MALLOC_FAILURE); diff --git a/crypto/pkcs12/p12_attr.c b/crypto/pkcs12/p12_attr.c index b370c9cf3f..f1a210b5d2 100644 --- a/crypto/pkcs12/p12_attr.c +++ b/crypto/pkcs12/p12_attr.c @@ -87,13 +87,13 @@ int PKCS12_add_localkeyid (PKCS12_SAFEBAG *bag, unsigned char *name, return 0; } attrib->object = OBJ_nid2obj(NID_localKeyID); - if (!(attrib->value.set = sk_ASN1_TYPE_new(NULL))) { + if (!(attrib->value.set = sk_ASN1_TYPE_new_null())) { PKCS12err(PKCS12_F_PKCS12_ADD_LOCALKEYID, ERR_R_MALLOC_FAILURE); return 0; } sk_ASN1_TYPE_push (attrib->value.set,keyid); attrib->set = 1; - if (!bag->attrib && !(bag->attrib = sk_X509_ATTRIBUTE_new (NULL))) { + if (!bag->attrib && !(bag->attrib = sk_X509_ATTRIBUTE_new_null ())) { PKCS12err(PKCS12_F_PKCS12_ADD_LOCALKEYID, ERR_R_MALLOC_FAILURE); return 0; } @@ -129,14 +129,14 @@ int PKCS8_add_keyusage (PKCS8_PRIV_KEY_INFO *p8, int usage) return 0; } attrib->object = OBJ_nid2obj(NID_key_usage); - if (!(attrib->value.set = sk_ASN1_TYPE_new(NULL))) { + if (!(attrib->value.set = sk_ASN1_TYPE_new_null())) { PKCS12err(PKCS12_F_PKCS8_ADD_KEYUSAGE, ERR_R_MALLOC_FAILURE); return 0; } sk_ASN1_TYPE_push (attrib->value.set,keyid); attrib->set = 1; if (!p8->attributes - && !(p8->attributes = sk_X509_ATTRIBUTE_new (NULL))) { + && !(p8->attributes = sk_X509_ATTRIBUTE_new_null ())) { PKCS12err(PKCS12_F_PKCS8_ADD_KEYUSAGE, ERR_R_MALLOC_FAILURE); return 0; } @@ -195,14 +195,14 @@ int PKCS12_add_friendlyname_uni (PKCS12_SAFEBAG *bag, return 0; } attrib->object = OBJ_nid2obj(NID_friendlyName); - if (!(attrib->value.set = sk_ASN1_TYPE_new(NULL))) { + if (!(attrib->value.set = sk_ASN1_TYPE_new_null())) { PKCS12err(PKCS12_F_PKCS12_ADD_FRIENDLYNAME, ERR_R_MALLOC_FAILURE); return 0; } sk_ASN1_TYPE_push (attrib->value.set,fname); attrib->set = 1; - if (!bag->attrib && !(bag->attrib = sk_X509_ATTRIBUTE_new (NULL))) { + if (!bag->attrib && !(bag->attrib = sk_X509_ATTRIBUTE_new_null ())) { PKCS12err(PKCS12_F_PKCS12_ADD_FRIENDLYNAME_UNI, ERR_R_MALLOC_FAILURE); return 0; diff --git a/crypto/pkcs12/p12_crt.c b/crypto/pkcs12/p12_crt.c index 5641a00898..a8f7b48882 100644 --- a/crypto/pkcs12/p12_crt.c +++ b/crypto/pkcs12/p12_crt.c @@ -88,7 +88,7 @@ PKCS12 *PKCS12_create(char *pass, char *name, EVP_PKEY *pkey, X509 *cert, if(!X509_check_private_key(cert, pkey)) return NULL; - if(!(bags = sk_PKCS12_SAFEBAG_new (NULL))) { + if(!(bags = sk_PKCS12_SAFEBAG_new_null ())) { PKCS12err(PKCS12_F_PKCS12_CREATE,ERR_R_MALLOC_FAILURE); return NULL; } @@ -123,7 +123,7 @@ PKCS12 *PKCS12_create(char *pass, char *name, EVP_PKEY *pkey, X509 *cert, if (!authsafe) return NULL; - if(!(safes = sk_PKCS7_new (NULL)) + if(!(safes = sk_PKCS7_new_null ()) || !sk_PKCS7_push(safes, authsafe)) { PKCS12err(PKCS12_F_PKCS12_CREATE,ERR_R_MALLOC_FAILURE); return NULL; @@ -137,7 +137,7 @@ PKCS12 *PKCS12_create(char *pass, char *name, EVP_PKEY *pkey, X509 *cert, PKCS8_PRIV_KEY_INFO_free(p8); if (name && !PKCS12_add_friendlyname (bag, name, -1)) return NULL; if(!PKCS12_add_localkeyid (bag, keyid, keyidlen)) return NULL; - if(!(bags = sk_PKCS12_SAFEBAG_new(NULL)) + if(!(bags = sk_PKCS12_SAFEBAG_new_null()) || !sk_PKCS12_SAFEBAG_push (bags, bag)) { PKCS12err(PKCS12_F_PKCS12_CREATE,ERR_R_MALLOC_FAILURE); return NULL; diff --git a/crypto/pkcs12/p12_kiss.c b/crypto/pkcs12/p12_kiss.c index 368c98765c..1fbbd6c99f 100644 --- a/crypto/pkcs12/p12_kiss.c +++ b/crypto/pkcs12/p12_kiss.c @@ -93,7 +93,7 @@ int PKCS12_parse (PKCS12 *p12, const char *pass, EVP_PKEY **pkey, X509 **cert, /* Allocate stack for ca certificates if needed */ if ((ca != NULL) && (*ca == NULL)) { - if (!(*ca = sk_X509_new(NULL))) { + if (!(*ca = sk_X509_new_null())) { PKCS12err(PKCS12_F_PKCS12_PARSE,ERR_R_MALLOC_FAILURE); return 0; } diff --git a/crypto/pkcs12/p12_npas.c b/crypto/pkcs12/p12_npas.c index eed494a3f3..84e31a7f21 100644 --- a/crypto/pkcs12/p12_npas.c +++ b/crypto/pkcs12/p12_npas.c @@ -114,7 +114,7 @@ static int newpass_p12(PKCS12 *p12, char *oldpass, char *newpass) unsigned int maclen; if (!(asafes = M_PKCS12_unpack_authsafes(p12))) return 0; - if(!(newsafes = sk_PKCS7_new(NULL))) return 0; + if(!(newsafes = sk_PKCS7_new_null())) return 0; for (i = 0; i < sk_PKCS7_num (asafes); i++) { p7 = sk_PKCS7_value(asafes, i); bagnid = OBJ_obj2nid(p7->type); diff --git a/crypto/pkcs7/pk7_doit.c b/crypto/pkcs7/pk7_doit.c index 2768247818..099e9651c1 100644 --- a/crypto/pkcs7/pk7_doit.c +++ b/crypto/pkcs7/pk7_doit.c @@ -909,7 +909,7 @@ static int add_attribute(STACK_OF(X509_ATTRIBUTE) **sk, int nid, int atrtype, if (*sk == NULL) { - *sk = sk_X509_ATTRIBUTE_new(NULL); + *sk = sk_X509_ATTRIBUTE_new_null(); new_attrib: attr=X509_ATTRIBUTE_create(nid,atrtype,value); sk_X509_ATTRIBUTE_push(*sk,attr); diff --git a/crypto/pkcs7/pk7_mime.c b/crypto/pkcs7/pk7_mime.c index a7b6929436..994473c0bd 100644 --- a/crypto/pkcs7/pk7_mime.c +++ b/crypto/pkcs7/pk7_mime.c @@ -372,7 +372,7 @@ static int multi_split(BIO *bio, char *bound, STACK_OF(BIO) **ret) part = 0; state = 0; first = 1; - parts = sk_BIO_new(NULL); + parts = sk_BIO_new_null(); *ret = parts; while ((len = BIO_gets(bio, linebuf, MAX_SMLEN)) > 0) { state = mime_bound_check(linebuf, len, bound, blen); diff --git a/crypto/pkcs7/pk7_smime.c b/crypto/pkcs7/pk7_smime.c index c8cd5a7f73..2ececcd07e 100644 --- a/crypto/pkcs7/pk7_smime.c +++ b/crypto/pkcs7/pk7_smime.c @@ -111,7 +111,7 @@ PKCS7 *PKCS7_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs, /* Add SMIMECapabilities */ if(!(flags & PKCS7_NOSMIMECAP)) { - if(!(smcap = sk_X509_ALGOR_new(NULL))) { + if(!(smcap = sk_X509_ALGOR_new_null())) { PKCS7err(PKCS7_F_PKCS7_SIGN,ERR_R_MALLOC_FAILURE); return NULL; } @@ -285,7 +285,7 @@ STACK_OF(X509) *PKCS7_get0_signers(PKCS7 *p7, STACK_OF(X509) *certs, int flags) PKCS7err(PKCS7_F_PKCS7_GET0_SIGNERS,PKCS7_R_WRONG_CONTENT_TYPE); return NULL; } - if(!(signers = sk_X509_new(NULL))) { + if(!(signers = sk_X509_new_null())) { PKCS7err(PKCS7_F_PKCS7_GET0_SIGNERS,ERR_R_MALLOC_FAILURE); return NULL; } diff --git a/crypto/x509v3/v3_akey.c b/crypto/x509v3/v3_akey.c index 877ae7da7b..0889a18993 100644 --- a/crypto/x509v3/v3_akey.c +++ b/crypto/x509v3/v3_akey.c @@ -224,7 +224,7 @@ if((issuer && !ikeyid) || (issuer == 2)) { if(!(akeyid = AUTHORITY_KEYID_new())) goto err; if(isname) { - if(!(gens = sk_GENERAL_NAME_new(NULL)) || !(gen = GENERAL_NAME_new()) + if(!(gens = sk_GENERAL_NAME_new_null()) || !(gen = GENERAL_NAME_new()) || !sk_GENERAL_NAME_push(gens, gen)) { X509V3err(X509V3_F_V2I_AUTHORITY_KEYID,ERR_R_MALLOC_FAILURE); goto err; diff --git a/crypto/x509v3/v3_alt.c b/crypto/x509v3/v3_alt.c index 5ccd1e0e3d..733919f250 100644 --- a/crypto/x509v3/v3_alt.c +++ b/crypto/x509v3/v3_alt.c @@ -160,7 +160,7 @@ static STACK_OF(GENERAL_NAME) *v2i_issuer_alt(X509V3_EXT_METHOD *method, STACK_OF(GENERAL_NAME) *gens = NULL; CONF_VALUE *cnf; int i; - if(!(gens = sk_GENERAL_NAME_new(NULL))) { + if(!(gens = sk_GENERAL_NAME_new_null())) { X509V3err(X509V3_F_V2I_GENERAL_NAMES,ERR_R_MALLOC_FAILURE); return NULL; } @@ -225,7 +225,7 @@ static STACK_OF(GENERAL_NAME) *v2i_subject_alt(X509V3_EXT_METHOD *method, STACK_OF(GENERAL_NAME) *gens = NULL; CONF_VALUE *cnf; int i; - if(!(gens = sk_GENERAL_NAME_new(NULL))) { + if(!(gens = sk_GENERAL_NAME_new_null())) { X509V3err(X509V3_F_V2I_GENERAL_NAMES,ERR_R_MALLOC_FAILURE); return NULL; } @@ -304,7 +304,7 @@ STACK_OF(GENERAL_NAME) *v2i_GENERAL_NAMES(X509V3_EXT_METHOD *method, STACK_OF(GENERAL_NAME) *gens = NULL; CONF_VALUE *cnf; int i; - if(!(gens = sk_GENERAL_NAME_new(NULL))) { + if(!(gens = sk_GENERAL_NAME_new_null())) { X509V3err(X509V3_F_V2I_GENERAL_NAMES,ERR_R_MALLOC_FAILURE); return NULL; } diff --git a/crypto/x509v3/v3_crld.c b/crypto/x509v3/v3_crld.c index 5ca5373f39..67feea4017 100644 --- a/crypto/x509v3/v3_crld.c +++ b/crypto/x509v3/v3_crld.c @@ -109,7 +109,7 @@ static STACK_OF(DIST_POINT) *v2i_crld(X509V3_EXT_METHOD *method, GENERAL_NAME *gen = NULL; CONF_VALUE *cnf; int i; - if(!(crld = sk_DIST_POINT_new(NULL))) goto merr; + if(!(crld = sk_DIST_POINT_new_null())) goto merr; for(i = 0; i < sk_CONF_VALUE_num(nval); i++) { DIST_POINT *point; cnf = sk_CONF_VALUE_value(nval, i); diff --git a/crypto/x509v3/v3_extku.c b/crypto/x509v3/v3_extku.c index e039d21cbf..53ec40a027 100644 --- a/crypto/x509v3/v3_extku.c +++ b/crypto/x509v3/v3_extku.c @@ -129,7 +129,7 @@ ASN1_OBJECT *objtmp; CONF_VALUE *val; int i; -if(!(extku = sk_ASN1_OBJECT_new(NULL))) { +if(!(extku = sk_ASN1_OBJECT_new_null())) { X509V3err(X509V3_F_V2I_EXT_KU,ERR_R_MALLOC_FAILURE); return NULL; } diff --git a/crypto/x509v3/v3_genn.c b/crypto/x509v3/v3_genn.c index 2de1c4b428..d44751458e 100644 --- a/crypto/x509v3/v3_genn.c +++ b/crypto/x509v3/v3_genn.c @@ -220,7 +220,7 @@ void GENERAL_NAME_free(GENERAL_NAME *a) STACK_OF(GENERAL_NAME) *GENERAL_NAMES_new() { - return sk_GENERAL_NAME_new(NULL); + return sk_GENERAL_NAME_new_null(); } void GENERAL_NAMES_free(STACK_OF(GENERAL_NAME) *a) diff --git a/crypto/x509v3/v3_info.c b/crypto/x509v3/v3_info.c index 9ada0b310b..a045a629ee 100644 --- a/crypto/x509v3/v3_info.c +++ b/crypto/x509v3/v3_info.c @@ -119,7 +119,7 @@ static STACK_OF(ACCESS_DESCRIPTION) *v2i_AUTHORITY_INFO_ACCESS(X509V3_EXT_METHOD ACCESS_DESCRIPTION *acc; int i, objlen; char *objtmp, *ptmp; - if(!(ainfo = sk_ACCESS_DESCRIPTION_new(NULL))) { + if(!(ainfo = sk_ACCESS_DESCRIPTION_new_null())) { X509V3err(X509V3_F_V2I_ACCESS_DESCRIPTION,ERR_R_MALLOC_FAILURE); return NULL; } @@ -209,7 +209,7 @@ void ACCESS_DESCRIPTION_free(ACCESS_DESCRIPTION *a) STACK_OF(ACCESS_DESCRIPTION) *AUTHORITY_INFO_ACCESS_new(void) { - return sk_ACCESS_DESCRIPTION_new(NULL); + return sk_ACCESS_DESCRIPTION_new_null(); } void AUTHORITY_INFO_ACCESS_free(STACK_OF(ACCESS_DESCRIPTION) *a) diff --git a/crypto/x509v3/v3_utl.c b/crypto/x509v3/v3_utl.c index e6e99b2d5c..619f161b58 100644 --- a/crypto/x509v3/v3_utl.c +++ b/crypto/x509v3/v3_utl.c @@ -80,7 +80,7 @@ int X509V3_add_value(const char *name, const char *value, if(name && !(tname = BUF_strdup(name))) goto err; if(value && !(tvalue = BUF_strdup(value))) goto err;; if(!(vtmp = (CONF_VALUE *)OPENSSL_malloc(sizeof(CONF_VALUE)))) goto err; - if(!*extlist && !(*extlist = sk_CONF_VALUE_new(NULL))) goto err; + if(!*extlist && !(*extlist = sk_CONF_VALUE_new_null())) goto err; vtmp->section = NULL; vtmp->name = tname; vtmp->value = tvalue; diff --git a/ssl/ssl_cert.c b/ssl/ssl_cert.c index 7579a3432d..c26df62c20 100644 --- a/ssl/ssl_cert.c +++ b/ssl/ssl_cert.c @@ -589,7 +589,7 @@ STACK_OF(X509_NAME) *SSL_load_client_CA_file(const char *file) X509_NAME *xn=NULL; STACK_OF(X509_NAME) *ret,*sk; - ret=sk_X509_NAME_new(NULL); + ret=sk_X509_NAME_new_null(); sk=sk_X509_NAME_new(xname_cmp); in=BIO_new(BIO_s_file_internal()); diff --git a/ssl/ssl_ciph.c b/ssl/ssl_ciph.c index ce73213b12..f63163f26c 100644 --- a/ssl/ssl_ciph.c +++ b/ssl/ssl_ciph.c @@ -799,7 +799,7 @@ STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *ssl_method, * Allocate new "cipherstack" for the result, return with error * if we cannot get one. */ - if ((cipherstack = sk_SSL_CIPHER_new(NULL)) == NULL) + if ((cipherstack = sk_SSL_CIPHER_new_null()) == NULL) { OPENSSL_free(list); return(NULL); diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c index 1483fad19a..635b25062e 100644 --- a/ssl/ssl_lib.c +++ b/ssl/ssl_lib.c @@ -1036,7 +1036,7 @@ STACK_OF(SSL_CIPHER) *ssl_bytes_to_cipher_list(SSL *s,unsigned char *p,int num, return(NULL); } if ((skp == NULL) || (*skp == NULL)) - sk=sk_SSL_CIPHER_new(NULL); /* change perhaps later */ + sk=sk_SSL_CIPHER_new_null(); /* change perhaps later */ else { sk= *skp; -- 2.25.1