From f06080cb3da93e99755edb5f19e7ccc132aeba36 Mon Sep 17 00:00:00 2001 From: FdaSilvaYY Date: Thu, 26 Apr 2018 12:06:17 -0400 Subject: [PATCH] Add missing error code when alloc-return-null Reviewed-by: Bernd Edlinger Reviewed-by: Rich Salz (Merged from https://github.com/openssl/openssl/pull/6085) --- crypto/bio/bf_nbio.c | 4 +++- crypto/bio/bio_err.c | 4 ++++ crypto/bio/bss_acpt.c | 4 +++- crypto/bio/bss_conn.c | 4 +++- crypto/bio/bss_log.c | 1 + crypto/bn/bn_err.c | 2 ++ crypto/bn/bn_mont.c | 4 +++- crypto/bn/bn_recp.c | 4 +++- crypto/ec/ec_err.c | 1 + crypto/ec/ec_lib.c | 6 ++++-- crypto/err/openssl.txt | 13 +++++++++++++ crypto/objects/obj_dat.c | 6 ++++-- crypto/objects/obj_err.c | 1 + crypto/pkcs12/p12_utl.c | 17 ++++++++++++----- crypto/pkcs12/pk12err.c | 8 +++++++- crypto/x509v3/pcy_tree.c | 5 ++++- crypto/x509v3/v3err.c | 1 + include/openssl/bioerr.h | 4 ++++ include/openssl/bnerr.h | 2 ++ include/openssl/ecerr.h | 1 + include/openssl/objectserr.h | 1 + include/openssl/pkcs12err.h | 4 ++++ include/openssl/x509v3err.h | 1 + 23 files changed, 82 insertions(+), 16 deletions(-) diff --git a/crypto/bio/bf_nbio.c b/crypto/bio/bf_nbio.c index d7972bfed7..4bc84eeba6 100644 --- a/crypto/bio/bf_nbio.c +++ b/crypto/bio/bf_nbio.c @@ -57,8 +57,10 @@ static int nbiof_new(BIO *bi) { NBIO_TEST *nt; - if ((nt = OPENSSL_zalloc(sizeof(*nt))) == NULL) + if ((nt = OPENSSL_zalloc(sizeof(*nt))) == NULL) { + BIOerr(BIO_F_NBIOF_NEW, ERR_R_MALLOC_FAILURE); return 0; + } nt->lrn = -1; nt->lwn = -1; bi->ptr = (char *)nt; diff --git a/crypto/bio/bio_err.c b/crypto/bio/bio_err.c index 2a4e478e38..7aa9dabb29 100644 --- a/crypto/bio/bio_err.c +++ b/crypto/bio/bio_err.c @@ -19,10 +19,12 @@ static const ERR_STRING_DATA BIO_str_functs[] = { {ERR_PACK(ERR_LIB_BIO, BIO_F_ADDR_STRINGS, 0), "addr_strings"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_ACCEPT, 0), "BIO_accept"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_ACCEPT_EX, 0), "BIO_accept_ex"}, + {ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_ACCEPT_NEW, 0), "BIO_ACCEPT_new"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_ADDR_NEW, 0), "BIO_ADDR_new"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_BIND, 0), "BIO_bind"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_CALLBACK_CTRL, 0), "BIO_callback_ctrl"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_CONNECT, 0), "BIO_connect"}, + {ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_CONNECT_NEW, 0), "BIO_CONNECT_new"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_CTRL, 0), "BIO_ctrl"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_GETS, 0), "BIO_gets"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_GET_HOST_IP, 0), "BIO_get_host_ip"}, @@ -65,6 +67,8 @@ static const ERR_STRING_DATA BIO_str_functs[] = { {ERR_PACK(ERR_LIB_BIO, BIO_F_LINEBUFFER_CTRL, 0), "linebuffer_ctrl"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_LINEBUFFER_NEW, 0), "linebuffer_new"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_MEM_WRITE, 0), "mem_write"}, + {ERR_PACK(ERR_LIB_BIO, BIO_F_NBIOF_NEW, 0), "nbiof_new"}, + {ERR_PACK(ERR_LIB_BIO, BIO_F_SLG_WRITE, 0), "slg_write"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_SSL_NEW, 0), "SSL_new"}, {0, NULL} }; diff --git a/crypto/bio/bss_acpt.c b/crypto/bio/bss_acpt.c index 64cc452891..993e5903a0 100644 --- a/crypto/bio/bss_acpt.c +++ b/crypto/bio/bss_acpt.c @@ -92,8 +92,10 @@ static BIO_ACCEPT *BIO_ACCEPT_new(void) { BIO_ACCEPT *ret; - if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) + if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { + BIOerr(BIO_F_BIO_ACCEPT_NEW, ERR_R_MALLOC_FAILURE); return NULL; + } ret->accept_family = BIO_FAMILY_IPANY; ret->accept_sock = (int)INVALID_SOCKET; return ret; diff --git a/crypto/bio/bss_conn.c b/crypto/bio/bss_conn.c index c87b431cdb..e9673fe783 100644 --- a/crypto/bio/bss_conn.c +++ b/crypto/bio/bss_conn.c @@ -223,8 +223,10 @@ BIO_CONNECT *BIO_CONNECT_new(void) { BIO_CONNECT *ret; - if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) + if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { + BIOerr(BIO_F_BIO_CONNECT_NEW, ERR_R_MALLOC_FAILURE); return NULL; + } ret->state = BIO_CONN_S_BEFORE; ret->connect_family = BIO_FAMILY_IPANY; return ret; diff --git a/crypto/bio/bss_log.c b/crypto/bio/bss_log.c index 10acba1dee..0376919017 100644 --- a/crypto/bio/bss_log.c +++ b/crypto/bio/bss_log.c @@ -197,6 +197,7 @@ static int slg_write(BIO *b, const char *in, int inl) }; if ((buf = OPENSSL_malloc(inl + 1)) == NULL) { + BIOerr(BIO_F_SLG_WRITE, ERR_R_MALLOC_FAILURE); return 0; } strncpy(buf, in, inl); diff --git a/crypto/bn/bn_err.c b/crypto/bn/bn_err.c index e6bfbf61c2..dd87c152cf 100644 --- a/crypto/bn/bn_err.c +++ b/crypto/bn/bn_err.c @@ -62,11 +62,13 @@ static const ERR_STRING_DATA BN_str_functs[] = { "BN_mod_inverse_no_branch"}, {ERR_PACK(ERR_LIB_BN, BN_F_BN_MOD_LSHIFT_QUICK, 0), "BN_mod_lshift_quick"}, {ERR_PACK(ERR_LIB_BN, BN_F_BN_MOD_SQRT, 0), "BN_mod_sqrt"}, + {ERR_PACK(ERR_LIB_BN, BN_F_BN_MONT_CTX_NEW, 0), "BN_MONT_CTX_new"}, {ERR_PACK(ERR_LIB_BN, BN_F_BN_MPI2BN, 0), "BN_mpi2bn"}, {ERR_PACK(ERR_LIB_BN, BN_F_BN_NEW, 0), "BN_new"}, {ERR_PACK(ERR_LIB_BN, BN_F_BN_POOL_GET, 0), "BN_POOL_get"}, {ERR_PACK(ERR_LIB_BN, BN_F_BN_RAND, 0), "BN_rand"}, {ERR_PACK(ERR_LIB_BN, BN_F_BN_RAND_RANGE, 0), "BN_rand_range"}, + {ERR_PACK(ERR_LIB_BN, BN_F_BN_RECP_CTX_NEW, 0), "BN_RECP_CTX_new"}, {ERR_PACK(ERR_LIB_BN, BN_F_BN_RSHIFT, 0), "BN_rshift"}, {ERR_PACK(ERR_LIB_BN, BN_F_BN_SET_WORDS, 0), "bn_set_words"}, {ERR_PACK(ERR_LIB_BN, BN_F_BN_STACK_PUSH, 0), "BN_STACK_push"}, diff --git a/crypto/bn/bn_mont.c b/crypto/bn/bn_mont.c index 362390a353..b85a8934c4 100644 --- a/crypto/bn/bn_mont.c +++ b/crypto/bn/bn_mont.c @@ -199,8 +199,10 @@ BN_MONT_CTX *BN_MONT_CTX_new(void) { BN_MONT_CTX *ret; - if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL) + if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL) { + BNerr(BN_F_BN_MONT_CTX_NEW, ERR_R_MALLOC_FAILURE); return NULL; + } BN_MONT_CTX_init(ret); ret->flags = BN_FLG_MALLOCED; diff --git a/crypto/bn/bn_recp.c b/crypto/bn/bn_recp.c index 130debdf20..9ab767f42f 100644 --- a/crypto/bn/bn_recp.c +++ b/crypto/bn/bn_recp.c @@ -21,8 +21,10 @@ BN_RECP_CTX *BN_RECP_CTX_new(void) { BN_RECP_CTX *ret; - if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) + if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { + BNerr(BN_F_BN_RECP_CTX_NEW, ERR_R_MALLOC_FAILURE); return NULL; + } bn_init(&(ret->N)); bn_init(&(ret->Nr)); diff --git a/crypto/ec/ec_err.c b/crypto/ec/ec_err.c index fba986d85a..807427f9aa 100644 --- a/crypto/ec/ec_err.c +++ b/crypto/ec/ec_err.c @@ -166,6 +166,7 @@ static const ERR_STRING_DATA EC_str_functs[] = { "EC_GROUP_set_curve_GFp"}, {ERR_PACK(ERR_LIB_EC, EC_F_EC_GROUP_SET_GENERATOR, 0), "EC_GROUP_set_generator"}, + {ERR_PACK(ERR_LIB_EC, EC_F_EC_GROUP_SET_SEED, 0), "EC_GROUP_set_seed"}, {ERR_PACK(ERR_LIB_EC, EC_F_EC_KEY_CHECK_KEY, 0), "EC_KEY_check_key"}, {ERR_PACK(ERR_LIB_EC, EC_F_EC_KEY_COPY, 0), "EC_KEY_copy"}, {ERR_PACK(ERR_LIB_EC, EC_F_EC_KEY_GENERATE_KEY, 0), "EC_KEY_generate_key"}, diff --git a/crypto/ec/ec_lib.c b/crypto/ec/ec_lib.c index 1d7e633726..10b0cb776b 100644 --- a/crypto/ec/ec_lib.c +++ b/crypto/ec/ec_lib.c @@ -394,8 +394,10 @@ size_t EC_GROUP_set_seed(EC_GROUP *group, const unsigned char *p, size_t len) if (!len || !p) return 1; - if ((group->seed = OPENSSL_malloc(len)) == NULL) + if ((group->seed = OPENSSL_malloc(len)) == NULL) { + ECerr(EC_F_EC_GROUP_SET_SEED, ERR_R_MALLOC_FAILURE); return 0; + } memcpy(group->seed, p, len); group->seed_len = len; @@ -558,7 +560,7 @@ EC_POINT *EC_POINT_new(const EC_GROUP *group) ECerr(EC_F_EC_POINT_NEW, ERR_R_PASSED_NULL_PARAMETER); return NULL; } - if (group->meth->point_init == 0) { + if (group->meth->point_init == NULL) { ECerr(EC_F_EC_POINT_NEW, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); return NULL; } diff --git a/crypto/err/openssl.txt b/crypto/err/openssl.txt index 1b547eab0f..b9457b910b 100644 --- a/crypto/err/openssl.txt +++ b/crypto/err/openssl.txt @@ -129,10 +129,12 @@ BIO_F_ADDRINFO_WRAP:148:addrinfo_wrap BIO_F_ADDR_STRINGS:134:addr_strings BIO_F_BIO_ACCEPT:101:BIO_accept BIO_F_BIO_ACCEPT_EX:137:BIO_accept_ex +BIO_F_BIO_ACCEPT_NEW:152:BIO_ACCEPT_new BIO_F_BIO_ADDR_NEW:144:BIO_ADDR_new BIO_F_BIO_BIND:147:BIO_bind BIO_F_BIO_CALLBACK_CTRL:131:BIO_callback_ctrl BIO_F_BIO_CONNECT:138:BIO_connect +BIO_F_BIO_CONNECT_NEW:153:BIO_CONNECT_new BIO_F_BIO_CTRL:103:BIO_ctrl BIO_F_BIO_GETS:104:BIO_gets BIO_F_BIO_GET_HOST_IP:106:BIO_get_host_ip @@ -175,6 +177,8 @@ BIO_F_FILE_READ:130:file_read BIO_F_LINEBUFFER_CTRL:129:linebuffer_ctrl BIO_F_LINEBUFFER_NEW:151:linebuffer_new BIO_F_MEM_WRITE:117:mem_write +BIO_F_NBIOF_NEW:154:nbiof_new +BIO_F_SLG_WRITE:155:slg_write BIO_F_SSL_NEW:118:SSL_new BN_F_BNRAND:127:bnrand BN_F_BNRAND_RANGE:138:bnrand_range @@ -214,11 +218,13 @@ BN_F_BN_MOD_INVERSE:110:BN_mod_inverse BN_F_BN_MOD_INVERSE_NO_BRANCH:139:BN_mod_inverse_no_branch BN_F_BN_MOD_LSHIFT_QUICK:119:BN_mod_lshift_quick BN_F_BN_MOD_SQRT:121:BN_mod_sqrt +BN_F_BN_MONT_CTX_NEW:149:BN_MONT_CTX_new BN_F_BN_MPI2BN:112:BN_mpi2bn BN_F_BN_NEW:113:BN_new BN_F_BN_POOL_GET:147:BN_POOL_get BN_F_BN_RAND:114:BN_rand BN_F_BN_RAND_RANGE:122:BN_rand_range +BN_F_BN_RECP_CTX_NEW:150:BN_RECP_CTX_new BN_F_BN_RSHIFT:146:BN_rshift BN_F_BN_SET_WORDS:144:bn_set_words BN_F_BN_STACK_PUSH:148:BN_STACK_push @@ -569,6 +575,7 @@ EC_F_EC_GROUP_NEW_FROM_ECPKPARAMETERS:264:EC_GROUP_new_from_ecpkparameters EC_F_EC_GROUP_SET_CURVE_GF2M:176:EC_GROUP_set_curve_GF2m EC_F_EC_GROUP_SET_CURVE_GFP:109:EC_GROUP_set_curve_GFp EC_F_EC_GROUP_SET_GENERATOR:111:EC_GROUP_set_generator +EC_F_EC_GROUP_SET_SEED:286:EC_GROUP_set_seed EC_F_EC_KEY_CHECK_KEY:177:EC_KEY_check_key EC_F_EC_KEY_COPY:178:EC_KEY_copy EC_F_EC_KEY_GENERATE_KEY:179:EC_KEY_generate_key @@ -798,6 +805,7 @@ OBJ_F_OBJ_NAME_NEW_INDEX:106:OBJ_NAME_new_index OBJ_F_OBJ_NID2LN:102:OBJ_nid2ln OBJ_F_OBJ_NID2OBJ:103:OBJ_nid2obj OBJ_F_OBJ_NID2SN:104:OBJ_nid2sn +OBJ_F_OBJ_TXT2OBJ:108:OBJ_txt2obj OCSP_F_D2I_OCSP_NONCE:102:d2i_ocsp_nonce OCSP_F_OCSP_BASIC_ADD1_STATUS:103:OCSP_basic_add1_status OCSP_F_OCSP_BASIC_SIGN:104:OCSP_basic_sign @@ -900,6 +908,10 @@ PEM_F_PEM_WRITE_PRIVATEKEY:139:PEM_write_PrivateKey PEM_F_PEM_X509_INFO_READ:115:PEM_X509_INFO_read PEM_F_PEM_X509_INFO_READ_BIO:116:PEM_X509_INFO_read_bio PEM_F_PEM_X509_INFO_WRITE_BIO:117:PEM_X509_INFO_write_bio +PKCS12_F_OPENSSL_ASC2UNI:121:OPENSSL_asc2uni +PKCS12_F_OPENSSL_UNI2ASC:124:OPENSSL_uni2asc +PKCS12_F_OPENSSL_UNI2UTF8:127:OPENSSL_uni2utf8 +PKCS12_F_OPENSSL_UTF82UNI:129:OPENSSL_utf82uni PKCS12_F_PKCS12_CREATE:105:PKCS12_create PKCS12_F_PKCS12_GEN_MAC:107:PKCS12_gen_mac PKCS12_F_PKCS12_INIT:109:PKCS12_init @@ -1607,6 +1619,7 @@ X509V3_F_SXNET_ADD_ID_INTEGER:126:SXNET_add_id_INTEGER X509V3_F_SXNET_ADD_ID_ULONG:127:SXNET_add_id_ulong X509V3_F_SXNET_GET_ID_ASC:128:SXNET_get_id_asc X509V3_F_SXNET_GET_ID_ULONG:129:SXNET_get_id_ulong +X509V3_F_TREE_INIT:172:tree_init X509V3_F_V2I_ASIDENTIFIERS:163:v2i_ASIdentifiers X509V3_F_V2I_ASN1_BIT_STRING:101:v2i_ASN1_BIT_STRING X509V3_F_V2I_AUTHORITY_INFO_ACCESS:139:v2i_AUTHORITY_INFO_ACCESS diff --git a/crypto/objects/obj_dat.c b/crypto/objects/obj_dat.c index fb82f25300..ef2d1e0dda 100644 --- a/crypto/objects/obj_dat.c +++ b/crypto/objects/obj_dat.c @@ -350,7 +350,7 @@ int OBJ_obj2nid(const ASN1_OBJECT *a) ASN1_OBJECT *OBJ_txt2obj(const char *s, int no_name) { int nid = NID_undef; - ASN1_OBJECT *op = NULL; + ASN1_OBJECT *op; unsigned char *buf; unsigned char *p; const unsigned char *cp; @@ -376,8 +376,10 @@ ASN1_OBJECT *OBJ_txt2obj(const char *s, int no_name) if (j < 0) return NULL; - if ((buf = OPENSSL_malloc(j)) == NULL) + if ((buf = OPENSSL_malloc(j)) == NULL) { + OBJerr(OBJ_F_OBJ_TXT2OBJ, ERR_R_MALLOC_FAILURE); return NULL; + } p = buf; /* Write out tag+length */ diff --git a/crypto/objects/obj_err.c b/crypto/objects/obj_err.c index 9b4779ad4d..be4f11ca20 100644 --- a/crypto/objects/obj_err.c +++ b/crypto/objects/obj_err.c @@ -22,6 +22,7 @@ static const ERR_STRING_DATA OBJ_str_functs[] = { {ERR_PACK(ERR_LIB_OBJ, OBJ_F_OBJ_NID2LN, 0), "OBJ_nid2ln"}, {ERR_PACK(ERR_LIB_OBJ, OBJ_F_OBJ_NID2OBJ, 0), "OBJ_nid2obj"}, {ERR_PACK(ERR_LIB_OBJ, OBJ_F_OBJ_NID2SN, 0), "OBJ_nid2sn"}, + {ERR_PACK(ERR_LIB_OBJ, OBJ_F_OBJ_TXT2OBJ, 0), "OBJ_txt2obj"}, {0, NULL} }; diff --git a/crypto/pkcs12/p12_utl.c b/crypto/pkcs12/p12_utl.c index 07014786f6..df5901ae40 100644 --- a/crypto/pkcs12/p12_utl.c +++ b/crypto/pkcs12/p12_utl.c @@ -22,8 +22,10 @@ unsigned char *OPENSSL_asc2uni(const char *asc, int asclen, if (asclen == -1) asclen = strlen(asc); ulen = asclen * 2 + 2; - if ((unitmp = OPENSSL_malloc(ulen)) == NULL) + if ((unitmp = OPENSSL_malloc(ulen)) == NULL) { + PKCS12err(PKCS12_F_OPENSSL_ASC2UNI, ERR_R_MALLOC_FAILURE); return NULL; + } for (i = 0; i < ulen - 2; i += 2) { unitmp[i] = 0; unitmp[i + 1] = asc[i >> 1]; @@ -50,8 +52,10 @@ char *OPENSSL_uni2asc(const unsigned char *uni, int unilen) if (!unilen || uni[unilen - 1]) asclen++; uni++; - if ((asctmp = OPENSSL_malloc(asclen)) == NULL) + if ((asctmp = OPENSSL_malloc(asclen)) == NULL) { + PKCS12err(PKCS12_F_OPENSSL_UNI2ASC, ERR_R_MALLOC_FAILURE); return NULL; + } for (i = 0; i < unilen; i += 2) asctmp[i >> 1] = uni[i]; asctmp[asclen - 1] = 0; @@ -110,9 +114,10 @@ unsigned char *OPENSSL_utf82uni(const char *asc, int asclen, ulen += 2; /* for trailing UTF16 zero */ - if ((ret = OPENSSL_malloc(ulen)) == NULL) + if ((ret = OPENSSL_malloc(ulen)) == NULL) { + PKCS12err(PKCS12_F_OPENSSL_UTF82UNI, ERR_R_MALLOC_FAILURE); return NULL; - + } /* re-run the loop writing down UTF-16 characters in big-endian order */ for (unitmp = ret, i = 0; i < asclen; i += j) { j = UTF8_getc((const unsigned char *)asc+i, asclen-i, &utf32chr); @@ -194,8 +199,10 @@ char *OPENSSL_uni2utf8(const unsigned char *uni, int unilen) if (!unilen || (uni[unilen-2]||uni[unilen - 1])) asclen++; - if ((asctmp = OPENSSL_malloc(asclen)) == NULL) + if ((asctmp = OPENSSL_malloc(asclen)) == NULL) { + PKCS12err(PKCS12_F_OPENSSL_UNI2UTF8, ERR_R_MALLOC_FAILURE); return NULL; + } /* re-run the loop emitting UTF-8 string */ for (asclen = 0, i = 0; i < unilen; ) { diff --git a/crypto/pkcs12/pk12err.c b/crypto/pkcs12/pk12err.c index 38e7c66eb5..38ce5197ee 100644 --- a/crypto/pkcs12/pk12err.c +++ b/crypto/pkcs12/pk12err.c @@ -1,6 +1,6 @@ /* * Generated by util/mkerr.pl DO NOT EDIT - * Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -14,6 +14,12 @@ #ifndef OPENSSL_NO_ERR static const ERR_STRING_DATA PKCS12_str_functs[] = { + {ERR_PACK(ERR_LIB_PKCS12, PKCS12_F_OPENSSL_ASC2UNI, 0), "OPENSSL_asc2uni"}, + {ERR_PACK(ERR_LIB_PKCS12, PKCS12_F_OPENSSL_UNI2ASC, 0), "OPENSSL_uni2asc"}, + {ERR_PACK(ERR_LIB_PKCS12, PKCS12_F_OPENSSL_UNI2UTF8, 0), + "OPENSSL_uni2utf8"}, + {ERR_PACK(ERR_LIB_PKCS12, PKCS12_F_OPENSSL_UTF82UNI, 0), + "OPENSSL_utf82uni"}, {ERR_PACK(ERR_LIB_PKCS12, PKCS12_F_PKCS12_CREATE, 0), "PKCS12_create"}, {ERR_PACK(ERR_LIB_PKCS12, PKCS12_F_PKCS12_GEN_MAC, 0), "PKCS12_gen_mac"}, {ERR_PACK(ERR_LIB_PKCS12, PKCS12_F_PKCS12_INIT, 0), "PKCS12_init"}, diff --git a/crypto/x509v3/pcy_tree.c b/crypto/x509v3/pcy_tree.c index b3d1983f9e..9e1d64077b 100644 --- a/crypto/x509v3/pcy_tree.c +++ b/crypto/x509v3/pcy_tree.c @@ -163,8 +163,10 @@ static int tree_init(X509_POLICY_TREE **ptree, STACK_OF(X509) *certs, return ret; /* If we get this far initialize the tree */ - if ((tree = OPENSSL_zalloc(sizeof(*tree))) == NULL) + if ((tree = OPENSSL_zalloc(sizeof(*tree))) == NULL) { + X509V3err(X509V3_F_TREE_INIT, ERR_R_MALLOC_FAILURE); return X509_PCY_TREE_INTERNAL; + } /* * http://tools.ietf.org/html/rfc5280#section-6.1.2, figure 3. @@ -175,6 +177,7 @@ static int tree_init(X509_POLICY_TREE **ptree, STACK_OF(X509) *certs, */ if ((tree->levels = OPENSSL_zalloc(sizeof(*tree->levels)*(n+1))) == NULL) { OPENSSL_free(tree); + X509V3err(X509V3_F_TREE_INIT, ERR_R_MALLOC_FAILURE); return X509_PCY_TREE_INTERNAL; } tree->nlevel = n+1; diff --git a/crypto/x509v3/v3err.c b/crypto/x509v3/v3err.c index d1b030830f..4f2ea52a4a 100644 --- a/crypto/x509v3/v3err.c +++ b/crypto/x509v3/v3err.c @@ -71,6 +71,7 @@ static const ERR_STRING_DATA X509V3_str_functs[] = { "SXNET_get_id_asc"}, {ERR_PACK(ERR_LIB_X509V3, X509V3_F_SXNET_GET_ID_ULONG, 0), "SXNET_get_id_ulong"}, + {ERR_PACK(ERR_LIB_X509V3, X509V3_F_TREE_INIT, 0), "tree_init"}, {ERR_PACK(ERR_LIB_X509V3, X509V3_F_V2I_ASIDENTIFIERS, 0), "v2i_ASIdentifiers"}, {ERR_PACK(ERR_LIB_X509V3, X509V3_F_V2I_ASN1_BIT_STRING, 0), diff --git a/include/openssl/bioerr.h b/include/openssl/bioerr.h index de703889d8..f119a59c36 100644 --- a/include/openssl/bioerr.h +++ b/include/openssl/bioerr.h @@ -24,10 +24,12 @@ int ERR_load_BIO_strings(void); # define BIO_F_ADDR_STRINGS 134 # define BIO_F_BIO_ACCEPT 101 # define BIO_F_BIO_ACCEPT_EX 137 +# define BIO_F_BIO_ACCEPT_NEW 152 # define BIO_F_BIO_ADDR_NEW 144 # define BIO_F_BIO_BIND 147 # define BIO_F_BIO_CALLBACK_CTRL 131 # define BIO_F_BIO_CONNECT 138 +# define BIO_F_BIO_CONNECT_NEW 153 # define BIO_F_BIO_CTRL 103 # define BIO_F_BIO_GETS 104 # define BIO_F_BIO_GET_HOST_IP 106 @@ -70,6 +72,8 @@ int ERR_load_BIO_strings(void); # define BIO_F_LINEBUFFER_CTRL 129 # define BIO_F_LINEBUFFER_NEW 151 # define BIO_F_MEM_WRITE 117 +# define BIO_F_NBIOF_NEW 154 +# define BIO_F_SLG_WRITE 155 # define BIO_F_SSL_NEW 118 /* diff --git a/include/openssl/bnerr.h b/include/openssl/bnerr.h index 297b8c54e8..8a022cc069 100644 --- a/include/openssl/bnerr.h +++ b/include/openssl/bnerr.h @@ -57,11 +57,13 @@ int ERR_load_BN_strings(void); # define BN_F_BN_MOD_INVERSE_NO_BRANCH 139 # define BN_F_BN_MOD_LSHIFT_QUICK 119 # define BN_F_BN_MOD_SQRT 121 +# define BN_F_BN_MONT_CTX_NEW 149 # define BN_F_BN_MPI2BN 112 # define BN_F_BN_NEW 113 # define BN_F_BN_POOL_GET 147 # define BN_F_BN_RAND 114 # define BN_F_BN_RAND_RANGE 122 +# define BN_F_BN_RECP_CTX_NEW 150 # define BN_F_BN_RSHIFT 146 # define BN_F_BN_SET_WORDS 144 # define BN_F_BN_STACK_PUSH 148 diff --git a/include/openssl/ecerr.h b/include/openssl/ecerr.h index 202088dc88..320c651886 100644 --- a/include/openssl/ecerr.h +++ b/include/openssl/ecerr.h @@ -114,6 +114,7 @@ int ERR_load_EC_strings(void); # define EC_F_EC_GROUP_SET_CURVE_GF2M 176 # define EC_F_EC_GROUP_SET_CURVE_GFP 109 # define EC_F_EC_GROUP_SET_GENERATOR 111 +# define EC_F_EC_GROUP_SET_SEED 286 # define EC_F_EC_KEY_CHECK_KEY 177 # define EC_F_EC_KEY_COPY 178 # define EC_F_EC_KEY_GENERATE_KEY 179 diff --git a/include/openssl/objectserr.h b/include/openssl/objectserr.h index e965791ae7..02308dfac8 100644 --- a/include/openssl/objectserr.h +++ b/include/openssl/objectserr.h @@ -27,6 +27,7 @@ int ERR_load_OBJ_strings(void); # define OBJ_F_OBJ_NID2LN 102 # define OBJ_F_OBJ_NID2OBJ 103 # define OBJ_F_OBJ_NID2SN 104 +# define OBJ_F_OBJ_TXT2OBJ 108 /* * OBJ reason codes. diff --git a/include/openssl/pkcs12err.h b/include/openssl/pkcs12err.h index ba8204385a..c7184ffe74 100644 --- a/include/openssl/pkcs12err.h +++ b/include/openssl/pkcs12err.h @@ -19,6 +19,10 @@ int ERR_load_PKCS12_strings(void); /* * PKCS12 function codes. */ +# define PKCS12_F_OPENSSL_ASC2UNI 121 +# define PKCS12_F_OPENSSL_UNI2ASC 124 +# define PKCS12_F_OPENSSL_UNI2UTF8 127 +# define PKCS12_F_OPENSSL_UTF82UNI 129 # define PKCS12_F_PKCS12_CREATE 105 # define PKCS12_F_PKCS12_GEN_MAC 107 # define PKCS12_F_PKCS12_INIT 109 diff --git a/include/openssl/x509v3err.h b/include/openssl/x509v3err.h index f961339fe0..6b3df12b63 100644 --- a/include/openssl/x509v3err.h +++ b/include/openssl/x509v3err.h @@ -54,6 +54,7 @@ int ERR_load_X509V3_strings(void); # define X509V3_F_SXNET_ADD_ID_ULONG 127 # define X509V3_F_SXNET_GET_ID_ASC 128 # define X509V3_F_SXNET_GET_ID_ULONG 129 +# define X509V3_F_TREE_INIT 172 # define X509V3_F_V2I_ASIDENTIFIERS 163 # define X509V3_F_V2I_ASN1_BIT_STRING 101 # define X509V3_F_V2I_AUTHORITY_INFO_ACCESS 139