Add missing error code when alloc-return-null

Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6085)
This commit is contained in:
FdaSilvaYY 2018-04-26 12:06:17 -04:00 committed by Rich Salz
parent d1f7a1e62a
commit f06080cb3d
23 changed files with 82 additions and 16 deletions

View file

@ -57,8 +57,10 @@ static int nbiof_new(BIO *bi)
{ {
NBIO_TEST *nt; 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; return 0;
}
nt->lrn = -1; nt->lrn = -1;
nt->lwn = -1; nt->lwn = -1;
bi->ptr = (char *)nt; bi->ptr = (char *)nt;

View file

@ -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_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, 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_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_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_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_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, 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_CTRL, 0), "BIO_ctrl"},
{ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_GETS, 0), "BIO_gets"}, {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"}, {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_CTRL, 0), "linebuffer_ctrl"},
{ERR_PACK(ERR_LIB_BIO, BIO_F_LINEBUFFER_NEW, 0), "linebuffer_new"}, {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_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"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_SSL_NEW, 0), "SSL_new"},
{0, NULL} {0, NULL}
}; };

View file

@ -92,8 +92,10 @@ static BIO_ACCEPT *BIO_ACCEPT_new(void)
{ {
BIO_ACCEPT *ret; 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; return NULL;
}
ret->accept_family = BIO_FAMILY_IPANY; ret->accept_family = BIO_FAMILY_IPANY;
ret->accept_sock = (int)INVALID_SOCKET; ret->accept_sock = (int)INVALID_SOCKET;
return ret; return ret;

View file

@ -223,8 +223,10 @@ BIO_CONNECT *BIO_CONNECT_new(void)
{ {
BIO_CONNECT *ret; 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; return NULL;
}
ret->state = BIO_CONN_S_BEFORE; ret->state = BIO_CONN_S_BEFORE;
ret->connect_family = BIO_FAMILY_IPANY; ret->connect_family = BIO_FAMILY_IPANY;
return ret; return ret;

View file

@ -197,6 +197,7 @@ static int slg_write(BIO *b, const char *in, int inl)
}; };
if ((buf = OPENSSL_malloc(inl + 1)) == NULL) { if ((buf = OPENSSL_malloc(inl + 1)) == NULL) {
BIOerr(BIO_F_SLG_WRITE, ERR_R_MALLOC_FAILURE);
return 0; return 0;
} }
strncpy(buf, in, inl); strncpy(buf, in, inl);

View file

@ -62,11 +62,13 @@ static const ERR_STRING_DATA BN_str_functs[] = {
"BN_mod_inverse_no_branch"}, "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_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_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_MPI2BN, 0), "BN_mpi2bn"},
{ERR_PACK(ERR_LIB_BN, BN_F_BN_NEW, 0), "BN_new"}, {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_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, 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_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_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_SET_WORDS, 0), "bn_set_words"},
{ERR_PACK(ERR_LIB_BN, BN_F_BN_STACK_PUSH, 0), "BN_STACK_push"}, {ERR_PACK(ERR_LIB_BN, BN_F_BN_STACK_PUSH, 0), "BN_STACK_push"},

View file

@ -199,8 +199,10 @@ BN_MONT_CTX *BN_MONT_CTX_new(void)
{ {
BN_MONT_CTX *ret; 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; return NULL;
}
BN_MONT_CTX_init(ret); BN_MONT_CTX_init(ret);
ret->flags = BN_FLG_MALLOCED; ret->flags = BN_FLG_MALLOCED;

View file

@ -21,8 +21,10 @@ BN_RECP_CTX *BN_RECP_CTX_new(void)
{ {
BN_RECP_CTX *ret; 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; return NULL;
}
bn_init(&(ret->N)); bn_init(&(ret->N));
bn_init(&(ret->Nr)); bn_init(&(ret->Nr));

View file

@ -166,6 +166,7 @@ static const ERR_STRING_DATA EC_str_functs[] = {
"EC_GROUP_set_curve_GFp"}, "EC_GROUP_set_curve_GFp"},
{ERR_PACK(ERR_LIB_EC, EC_F_EC_GROUP_SET_GENERATOR, 0), {ERR_PACK(ERR_LIB_EC, EC_F_EC_GROUP_SET_GENERATOR, 0),
"EC_GROUP_set_generator"}, "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_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_COPY, 0), "EC_KEY_copy"},
{ERR_PACK(ERR_LIB_EC, EC_F_EC_KEY_GENERATE_KEY, 0), "EC_KEY_generate_key"}, {ERR_PACK(ERR_LIB_EC, EC_F_EC_KEY_GENERATE_KEY, 0), "EC_KEY_generate_key"},

View file

@ -394,8 +394,10 @@ size_t EC_GROUP_set_seed(EC_GROUP *group, const unsigned char *p, size_t len)
if (!len || !p) if (!len || !p)
return 1; 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; return 0;
}
memcpy(group->seed, p, len); memcpy(group->seed, p, len);
group->seed_len = 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); ECerr(EC_F_EC_POINT_NEW, ERR_R_PASSED_NULL_PARAMETER);
return NULL; 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); ECerr(EC_F_EC_POINT_NEW, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
return NULL; return NULL;
} }

View file

@ -129,10 +129,12 @@ BIO_F_ADDRINFO_WRAP:148:addrinfo_wrap
BIO_F_ADDR_STRINGS:134:addr_strings BIO_F_ADDR_STRINGS:134:addr_strings
BIO_F_BIO_ACCEPT:101:BIO_accept BIO_F_BIO_ACCEPT:101:BIO_accept
BIO_F_BIO_ACCEPT_EX:137:BIO_accept_ex 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_ADDR_NEW:144:BIO_ADDR_new
BIO_F_BIO_BIND:147:BIO_bind BIO_F_BIO_BIND:147:BIO_bind
BIO_F_BIO_CALLBACK_CTRL:131:BIO_callback_ctrl BIO_F_BIO_CALLBACK_CTRL:131:BIO_callback_ctrl
BIO_F_BIO_CONNECT:138:BIO_connect 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_CTRL:103:BIO_ctrl
BIO_F_BIO_GETS:104:BIO_gets BIO_F_BIO_GETS:104:BIO_gets
BIO_F_BIO_GET_HOST_IP:106:BIO_get_host_ip 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_CTRL:129:linebuffer_ctrl
BIO_F_LINEBUFFER_NEW:151:linebuffer_new BIO_F_LINEBUFFER_NEW:151:linebuffer_new
BIO_F_MEM_WRITE:117:mem_write 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 BIO_F_SSL_NEW:118:SSL_new
BN_F_BNRAND:127:bnrand BN_F_BNRAND:127:bnrand
BN_F_BNRAND_RANGE:138:bnrand_range 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_INVERSE_NO_BRANCH:139:BN_mod_inverse_no_branch
BN_F_BN_MOD_LSHIFT_QUICK:119:BN_mod_lshift_quick BN_F_BN_MOD_LSHIFT_QUICK:119:BN_mod_lshift_quick
BN_F_BN_MOD_SQRT:121:BN_mod_sqrt 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_MPI2BN:112:BN_mpi2bn
BN_F_BN_NEW:113:BN_new BN_F_BN_NEW:113:BN_new
BN_F_BN_POOL_GET:147:BN_POOL_get BN_F_BN_POOL_GET:147:BN_POOL_get
BN_F_BN_RAND:114:BN_rand BN_F_BN_RAND:114:BN_rand
BN_F_BN_RAND_RANGE:122:BN_rand_range 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_RSHIFT:146:BN_rshift
BN_F_BN_SET_WORDS:144:bn_set_words BN_F_BN_SET_WORDS:144:bn_set_words
BN_F_BN_STACK_PUSH:148:BN_STACK_push 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_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_CURVE_GFP:109:EC_GROUP_set_curve_GFp
EC_F_EC_GROUP_SET_GENERATOR:111:EC_GROUP_set_generator 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_CHECK_KEY:177:EC_KEY_check_key
EC_F_EC_KEY_COPY:178:EC_KEY_copy EC_F_EC_KEY_COPY:178:EC_KEY_copy
EC_F_EC_KEY_GENERATE_KEY:179:EC_KEY_generate_key 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_NID2LN:102:OBJ_nid2ln
OBJ_F_OBJ_NID2OBJ:103:OBJ_nid2obj OBJ_F_OBJ_NID2OBJ:103:OBJ_nid2obj
OBJ_F_OBJ_NID2SN:104:OBJ_nid2sn 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_D2I_OCSP_NONCE:102:d2i_ocsp_nonce
OCSP_F_OCSP_BASIC_ADD1_STATUS:103:OCSP_basic_add1_status OCSP_F_OCSP_BASIC_ADD1_STATUS:103:OCSP_basic_add1_status
OCSP_F_OCSP_BASIC_SIGN:104:OCSP_basic_sign 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:115:PEM_X509_INFO_read
PEM_F_PEM_X509_INFO_READ_BIO:116:PEM_X509_INFO_read_bio 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 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_CREATE:105:PKCS12_create
PKCS12_F_PKCS12_GEN_MAC:107:PKCS12_gen_mac PKCS12_F_PKCS12_GEN_MAC:107:PKCS12_gen_mac
PKCS12_F_PKCS12_INIT:109:PKCS12_init 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_ADD_ID_ULONG:127:SXNET_add_id_ulong
X509V3_F_SXNET_GET_ID_ASC:128:SXNET_get_id_asc X509V3_F_SXNET_GET_ID_ASC:128:SXNET_get_id_asc
X509V3_F_SXNET_GET_ID_ULONG:129:SXNET_get_id_ulong 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_ASIDENTIFIERS:163:v2i_ASIdentifiers
X509V3_F_V2I_ASN1_BIT_STRING:101:v2i_ASN1_BIT_STRING X509V3_F_V2I_ASN1_BIT_STRING:101:v2i_ASN1_BIT_STRING
X509V3_F_V2I_AUTHORITY_INFO_ACCESS:139:v2i_AUTHORITY_INFO_ACCESS X509V3_F_V2I_AUTHORITY_INFO_ACCESS:139:v2i_AUTHORITY_INFO_ACCESS

View file

@ -350,7 +350,7 @@ int OBJ_obj2nid(const ASN1_OBJECT *a)
ASN1_OBJECT *OBJ_txt2obj(const char *s, int no_name) ASN1_OBJECT *OBJ_txt2obj(const char *s, int no_name)
{ {
int nid = NID_undef; int nid = NID_undef;
ASN1_OBJECT *op = NULL; ASN1_OBJECT *op;
unsigned char *buf; unsigned char *buf;
unsigned char *p; unsigned char *p;
const unsigned char *cp; const unsigned char *cp;
@ -376,8 +376,10 @@ ASN1_OBJECT *OBJ_txt2obj(const char *s, int no_name)
if (j < 0) if (j < 0)
return NULL; 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; return NULL;
}
p = buf; p = buf;
/* Write out tag+length */ /* Write out tag+length */

View file

@ -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_NID2LN, 0), "OBJ_nid2ln"},
{ERR_PACK(ERR_LIB_OBJ, OBJ_F_OBJ_NID2OBJ, 0), "OBJ_nid2obj"}, {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_NID2SN, 0), "OBJ_nid2sn"},
{ERR_PACK(ERR_LIB_OBJ, OBJ_F_OBJ_TXT2OBJ, 0), "OBJ_txt2obj"},
{0, NULL} {0, NULL}
}; };

View file

@ -22,8 +22,10 @@ unsigned char *OPENSSL_asc2uni(const char *asc, int asclen,
if (asclen == -1) if (asclen == -1)
asclen = strlen(asc); asclen = strlen(asc);
ulen = asclen * 2 + 2; 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; return NULL;
}
for (i = 0; i < ulen - 2; i += 2) { for (i = 0; i < ulen - 2; i += 2) {
unitmp[i] = 0; unitmp[i] = 0;
unitmp[i + 1] = asc[i >> 1]; unitmp[i + 1] = asc[i >> 1];
@ -50,8 +52,10 @@ char *OPENSSL_uni2asc(const unsigned char *uni, int unilen)
if (!unilen || uni[unilen - 1]) if (!unilen || uni[unilen - 1])
asclen++; asclen++;
uni++; uni++;
if ((asctmp = OPENSSL_malloc(asclen)) == NULL) if ((asctmp = OPENSSL_malloc(asclen)) == NULL) {
PKCS12err(PKCS12_F_OPENSSL_UNI2ASC, ERR_R_MALLOC_FAILURE);
return NULL; return NULL;
}
for (i = 0; i < unilen; i += 2) for (i = 0; i < unilen; i += 2)
asctmp[i >> 1] = uni[i]; asctmp[i >> 1] = uni[i];
asctmp[asclen - 1] = 0; asctmp[asclen - 1] = 0;
@ -110,9 +114,10 @@ unsigned char *OPENSSL_utf82uni(const char *asc, int asclen,
ulen += 2; /* for trailing UTF16 zero */ 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; return NULL;
}
/* re-run the loop writing down UTF-16 characters in big-endian order */ /* re-run the loop writing down UTF-16 characters in big-endian order */
for (unitmp = ret, i = 0; i < asclen; i += j) { for (unitmp = ret, i = 0; i < asclen; i += j) {
j = UTF8_getc((const unsigned char *)asc+i, asclen-i, &utf32chr); 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])) if (!unilen || (uni[unilen-2]||uni[unilen - 1]))
asclen++; asclen++;
if ((asctmp = OPENSSL_malloc(asclen)) == NULL) if ((asctmp = OPENSSL_malloc(asclen)) == NULL) {
PKCS12err(PKCS12_F_OPENSSL_UNI2UTF8, ERR_R_MALLOC_FAILURE);
return NULL; return NULL;
}
/* re-run the loop emitting UTF-8 string */ /* re-run the loop emitting UTF-8 string */
for (asclen = 0, i = 0; i < unilen; ) { for (asclen = 0, i = 0; i < unilen; ) {

View file

@ -1,6 +1,6 @@
/* /*
* Generated by util/mkerr.pl DO NOT EDIT * 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 * Licensed under the OpenSSL license (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy * this file except in compliance with the License. You can obtain a copy
@ -14,6 +14,12 @@
#ifndef OPENSSL_NO_ERR #ifndef OPENSSL_NO_ERR
static const ERR_STRING_DATA PKCS12_str_functs[] = { 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_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_GEN_MAC, 0), "PKCS12_gen_mac"},
{ERR_PACK(ERR_LIB_PKCS12, PKCS12_F_PKCS12_INIT, 0), "PKCS12_init"}, {ERR_PACK(ERR_LIB_PKCS12, PKCS12_F_PKCS12_INIT, 0), "PKCS12_init"},

View file

@ -163,8 +163,10 @@ static int tree_init(X509_POLICY_TREE **ptree, STACK_OF(X509) *certs,
return ret; return ret;
/* If we get this far initialize the tree */ /* 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; return X509_PCY_TREE_INTERNAL;
}
/* /*
* http://tools.ietf.org/html/rfc5280#section-6.1.2, figure 3. * 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) { if ((tree->levels = OPENSSL_zalloc(sizeof(*tree->levels)*(n+1))) == NULL) {
OPENSSL_free(tree); OPENSSL_free(tree);
X509V3err(X509V3_F_TREE_INIT, ERR_R_MALLOC_FAILURE);
return X509_PCY_TREE_INTERNAL; return X509_PCY_TREE_INTERNAL;
} }
tree->nlevel = n+1; tree->nlevel = n+1;

View file

@ -71,6 +71,7 @@ static const ERR_STRING_DATA X509V3_str_functs[] = {
"SXNET_get_id_asc"}, "SXNET_get_id_asc"},
{ERR_PACK(ERR_LIB_X509V3, X509V3_F_SXNET_GET_ID_ULONG, 0), {ERR_PACK(ERR_LIB_X509V3, X509V3_F_SXNET_GET_ID_ULONG, 0),
"SXNET_get_id_ulong"}, "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), {ERR_PACK(ERR_LIB_X509V3, X509V3_F_V2I_ASIDENTIFIERS, 0),
"v2i_ASIdentifiers"}, "v2i_ASIdentifiers"},
{ERR_PACK(ERR_LIB_X509V3, X509V3_F_V2I_ASN1_BIT_STRING, 0), {ERR_PACK(ERR_LIB_X509V3, X509V3_F_V2I_ASN1_BIT_STRING, 0),

View file

@ -24,10 +24,12 @@ int ERR_load_BIO_strings(void);
# define BIO_F_ADDR_STRINGS 134 # define BIO_F_ADDR_STRINGS 134
# define BIO_F_BIO_ACCEPT 101 # define BIO_F_BIO_ACCEPT 101
# define BIO_F_BIO_ACCEPT_EX 137 # 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_ADDR_NEW 144
# define BIO_F_BIO_BIND 147 # define BIO_F_BIO_BIND 147
# define BIO_F_BIO_CALLBACK_CTRL 131 # define BIO_F_BIO_CALLBACK_CTRL 131
# define BIO_F_BIO_CONNECT 138 # define BIO_F_BIO_CONNECT 138
# define BIO_F_BIO_CONNECT_NEW 153
# define BIO_F_BIO_CTRL 103 # define BIO_F_BIO_CTRL 103
# define BIO_F_BIO_GETS 104 # define BIO_F_BIO_GETS 104
# define BIO_F_BIO_GET_HOST_IP 106 # 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_CTRL 129
# define BIO_F_LINEBUFFER_NEW 151 # define BIO_F_LINEBUFFER_NEW 151
# define BIO_F_MEM_WRITE 117 # define BIO_F_MEM_WRITE 117
# define BIO_F_NBIOF_NEW 154
# define BIO_F_SLG_WRITE 155
# define BIO_F_SSL_NEW 118 # define BIO_F_SSL_NEW 118
/* /*

View file

@ -57,11 +57,13 @@ int ERR_load_BN_strings(void);
# define BN_F_BN_MOD_INVERSE_NO_BRANCH 139 # define BN_F_BN_MOD_INVERSE_NO_BRANCH 139
# define BN_F_BN_MOD_LSHIFT_QUICK 119 # define BN_F_BN_MOD_LSHIFT_QUICK 119
# define BN_F_BN_MOD_SQRT 121 # 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_MPI2BN 112
# define BN_F_BN_NEW 113 # define BN_F_BN_NEW 113
# define BN_F_BN_POOL_GET 147 # define BN_F_BN_POOL_GET 147
# define BN_F_BN_RAND 114 # define BN_F_BN_RAND 114
# define BN_F_BN_RAND_RANGE 122 # 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_RSHIFT 146
# define BN_F_BN_SET_WORDS 144 # define BN_F_BN_SET_WORDS 144
# define BN_F_BN_STACK_PUSH 148 # define BN_F_BN_STACK_PUSH 148

View file

@ -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_GF2M 176
# define EC_F_EC_GROUP_SET_CURVE_GFP 109 # define EC_F_EC_GROUP_SET_CURVE_GFP 109
# define EC_F_EC_GROUP_SET_GENERATOR 111 # 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_CHECK_KEY 177
# define EC_F_EC_KEY_COPY 178 # define EC_F_EC_KEY_COPY 178
# define EC_F_EC_KEY_GENERATE_KEY 179 # define EC_F_EC_KEY_GENERATE_KEY 179

View file

@ -27,6 +27,7 @@ int ERR_load_OBJ_strings(void);
# define OBJ_F_OBJ_NID2LN 102 # define OBJ_F_OBJ_NID2LN 102
# define OBJ_F_OBJ_NID2OBJ 103 # define OBJ_F_OBJ_NID2OBJ 103
# define OBJ_F_OBJ_NID2SN 104 # define OBJ_F_OBJ_NID2SN 104
# define OBJ_F_OBJ_TXT2OBJ 108
/* /*
* OBJ reason codes. * OBJ reason codes.

View file

@ -19,6 +19,10 @@ int ERR_load_PKCS12_strings(void);
/* /*
* PKCS12 function codes. * 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_CREATE 105
# define PKCS12_F_PKCS12_GEN_MAC 107 # define PKCS12_F_PKCS12_GEN_MAC 107
# define PKCS12_F_PKCS12_INIT 109 # define PKCS12_F_PKCS12_INIT 109

View file

@ -54,6 +54,7 @@ int ERR_load_X509V3_strings(void);
# define X509V3_F_SXNET_ADD_ID_ULONG 127 # define X509V3_F_SXNET_ADD_ID_ULONG 127
# define X509V3_F_SXNET_GET_ID_ASC 128 # define X509V3_F_SXNET_GET_ID_ASC 128
# define X509V3_F_SXNET_GET_ID_ULONG 129 # define X509V3_F_SXNET_GET_ID_ULONG 129
# define X509V3_F_TREE_INIT 172
# define X509V3_F_V2I_ASIDENTIFIERS 163 # define X509V3_F_V2I_ASIDENTIFIERS 163
# define X509V3_F_V2I_ASN1_BIT_STRING 101 # define X509V3_F_V2I_ASN1_BIT_STRING 101
# define X509V3_F_V2I_AUTHORITY_INFO_ACCESS 139 # define X509V3_F_V2I_AUTHORITY_INFO_ACCESS 139