sync code with last improvements from OpenBSD

This commit is contained in:
purplerain 2023-08-30 17:35:22 +00:00
parent 708141b7a2
commit 085b88af82
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
18 changed files with 307 additions and 35 deletions

View file

@ -1,4 +1,4 @@
/* $OpenBSD: x509_alt.c,v 1.15 2023/02/16 08:38:17 tb Exp $ */
/* $OpenBSD: x509_alt.c,v 1.16 2023/08/30 00:49:32 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project.
*/
@ -354,10 +354,11 @@ err:
static int
copy_issuer(X509V3_CTX *ctx, GENERAL_NAMES *gens)
{
GENERAL_NAMES *ialt;
GENERAL_NAME *gen;
GENERAL_NAMES *ialt = NULL;
GENERAL_NAME *gen = NULL;
X509_EXTENSION *ext;
int i;
int ret = 0;
if (ctx && (ctx->flags == CTX_TEST))
return 1;
@ -375,19 +376,24 @@ copy_issuer(X509V3_CTX *ctx, GENERAL_NAMES *gens)
}
for (i = 0; i < sk_GENERAL_NAME_num(ialt); i++) {
gen = sk_GENERAL_NAME_value(ialt, i);
GENERAL_NAME *val = sk_GENERAL_NAME_value(ialt, i);
if ((gen = GENERAL_NAME_dup(val)) == NULL)
goto err;
if (!sk_GENERAL_NAME_push(gens, gen)) {
X509V3error(ERR_R_MALLOC_FAILURE);
goto err;
}
gen = NULL;
}
sk_GENERAL_NAME_free(ialt);
return 1;
ret = 1;
err:
return 0;
err:
sk_GENERAL_NAME_pop_free(ialt, GENERAL_NAME_free);
GENERAL_NAME_free(gen);
return ret;
}
static GENERAL_NAMES *