summaryrefslogtreecommitdiffstats
path: root/ssl/t1_lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'ssl/t1_lib.c')
-rw-r--r--ssl/t1_lib.c40
1 files changed, 10 insertions, 30 deletions
diff --git a/ssl/t1_lib.c b/ssl/t1_lib.c
index b165a4c4f0..ab539513bf 100644
--- a/ssl/t1_lib.c
+++ b/ssl/t1_lib.c
@@ -257,10 +257,8 @@ static int add_provider_groups(const OSSL_PARAM params[], void *data)
(ctx->group_list_max_len
+ TLS_GROUP_LIST_MALLOC_BLOCK_SIZE)
* sizeof(TLS_GROUP_INFO));
- if (tmp == NULL) {
- ERR_raise(ERR_LIB_SSL, ERR_R_MALLOC_FAILURE);
+ if (tmp == NULL)
return 0;
- }
ctx->group_list = tmp;
memset(tmp + ctx->group_list_max_len,
0,
@@ -276,10 +274,8 @@ static int add_provider_groups(const OSSL_PARAM params[], void *data)
goto err;
}
ginf->tlsname = OPENSSL_strdup(p->data);
- if (ginf->tlsname == NULL) {
- ERR_raise(ERR_LIB_SSL, ERR_R_MALLOC_FAILURE);
+ if (ginf->tlsname == NULL)
goto err;
- }
p = OSSL_PARAM_locate_const(params, OSSL_CAPABILITY_TLS_GROUP_NAME_INTERNAL);
if (p == NULL || p->data_type != OSSL_PARAM_UTF8_STRING) {
@@ -287,10 +283,8 @@ static int add_provider_groups(const OSSL_PARAM params[], void *data)
goto err;
}
ginf->realname = OPENSSL_strdup(p->data);
- if (ginf->realname == NULL) {
- ERR_raise(ERR_LIB_SSL, ERR_R_MALLOC_FAILURE);
+ if (ginf->realname == NULL)
goto err;
- }
p = OSSL_PARAM_locate_const(params, OSSL_CAPABILITY_TLS_GROUP_ID);
if (p == NULL || !OSSL_PARAM_get_uint(p, &gid) || gid > UINT16_MAX) {
@@ -305,10 +299,8 @@ static int add_provider_groups(const OSSL_PARAM params[], void *data)
goto err;
}
ginf->algorithm = OPENSSL_strdup(p->data);
- if (ginf->algorithm == NULL) {
- ERR_raise(ERR_LIB_SSL, ERR_R_MALLOC_FAILURE);
+ if (ginf->algorithm == NULL)
goto err;
- }
p = OSSL_PARAM_locate_const(params, OSSL_CAPABILITY_TLS_GROUP_SECURITY_BITS);
if (p == NULL || !OSSL_PARAM_get_uint(p, &ginf->secbits)) {
@@ -419,10 +411,8 @@ int ssl_load_groups(SSL_CTX *ctx)
ctx->ext.supported_groups_default
= OPENSSL_malloc(sizeof(uint16_t) * num_deflt_grps);
- if (ctx->ext.supported_groups_default == NULL) {
- ERR_raise(ERR_LIB_SSL, ERR_R_MALLOC_FAILURE);
+ if (ctx->ext.supported_groups_default == NULL)
return 0;
- }
memcpy(ctx->ext.supported_groups_default,
tmp_supp_groups,
@@ -725,10 +715,8 @@ int tls1_set_groups(uint16_t **pext, size_t *pextlen,
ERR_raise(ERR_LIB_SSL, SSL_R_BAD_LENGTH);
return 0;
}
- if ((glist = OPENSSL_malloc(ngroups * sizeof(*glist))) == NULL) {
- ERR_raise(ERR_LIB_SSL, ERR_R_MALLOC_FAILURE);
+ if ((glist = OPENSSL_malloc(ngroups * sizeof(*glist))) == NULL)
return 0;
- }
for (i = 0; i < ngroups; i++) {
unsigned long idmask;
uint16_t id;
@@ -2335,10 +2323,8 @@ static int tls1_set_shared_sigalgs(SSL_CONNECTION *s)
}
nmatch = tls12_shared_sigalgs(s, NULL, pref, preflen, allow, allowlen);
if (nmatch) {
- if ((salgs = OPENSSL_malloc(nmatch * sizeof(*salgs))) == NULL) {
- ERR_raise(ERR_LIB_SSL, ERR_R_MALLOC_FAILURE);
+ if ((salgs = OPENSSL_malloc(nmatch * sizeof(*salgs))) == NULL)
return 0;
- }
nmatch = tls12_shared_sigalgs(s, salgs, pref, preflen, allow, allowlen);
} else {
salgs = NULL;
@@ -2362,10 +2348,8 @@ int tls1_save_u16(PACKET *pkt, uint16_t **pdest, size_t *pdestlen)
size >>= 1;
- if ((buf = OPENSSL_malloc(size * sizeof(*buf))) == NULL) {
- ERR_raise(ERR_LIB_SSL, ERR_R_MALLOC_FAILURE);
+ if ((buf = OPENSSL_malloc(size * sizeof(*buf))) == NULL)
return 0;
- }
for (i = 0; i < size && PACKET_get_net_2(pkt, &stmp); i++)
buf[i] = stmp;
@@ -2606,10 +2590,8 @@ int tls1_set_raw_sigalgs(CERT *c, const uint16_t *psigs, size_t salglen,
{
uint16_t *sigalgs;
- if ((sigalgs = OPENSSL_malloc(salglen * sizeof(*sigalgs))) == NULL) {
- ERR_raise(ERR_LIB_SSL, ERR_R_MALLOC_FAILURE);
+ if ((sigalgs = OPENSSL_malloc(salglen * sizeof(*sigalgs))) == NULL)
return 0;
- }
memcpy(sigalgs, psigs, salglen * sizeof(*sigalgs));
if (client) {
@@ -2632,10 +2614,8 @@ int tls1_set_sigalgs(CERT *c, const int *psig_nids, size_t salglen, int client)
if (salglen & 1)
return 0;
- if ((sigalgs = OPENSSL_malloc((salglen / 2) * sizeof(*sigalgs))) == NULL) {
- ERR_raise(ERR_LIB_SSL, ERR_R_MALLOC_FAILURE);
+ if ((sigalgs = OPENSSL_malloc((salglen / 2) * sizeof(*sigalgs))) == NULL)
return 0;
- }
for (i = 0, sptr = sigalgs; i < salglen; i += 2) {
size_t j;
const SIGALG_LOOKUP *curr;