This commit is contained in:
purplerain 2023-06-24 02:57:55 +00:00
parent be633fa56a
commit 82bafdd0b3
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
18 changed files with 514 additions and 213 deletions

View file

@ -1,4 +1,4 @@
/* $OpenBSD: bn_convert.c,v 1.9 2023/05/28 10:34:17 jsing Exp $ */
/* $OpenBSD: bn_convert.c,v 1.12 2023/06/23 10:48:40 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@ -281,7 +281,7 @@ BN_asc2bn(BIGNUM **bnp, const char *s)
return 0;
}
/* Try parsing as hexidecimal with a 0x prefix. */
/* Try parsing as hexadecimal with a 0x prefix. */
CBS_dup(&cbs, &cbs_hex);
if (!CBS_get_u8(&cbs_hex, &v))
goto decimal;
@ -291,17 +291,18 @@ BN_asc2bn(BIGNUM **bnp, const char *s)
goto decimal;
if (v != 'X' && v != 'x')
goto decimal;
if (!bn_hex2bn_cbs(bnp, &cbs_hex))
if (bn_hex2bn_cbs(bnp, &cbs_hex) == 0)
return 0;
goto done;
decimal:
if (!bn_dec2bn_cbs(bnp, &cbs))
if (bn_dec2bn_cbs(bnp, &cbs) == 0)
return 0;
done:
BN_set_negative(*bnp, neg);
if (bnp != NULL && *bnp != NULL)
BN_set_negative(*bnp, neg);
return 1;
}

View file

@ -1,4 +1,4 @@
/* $OpenBSD: ec_print.c,v 1.11 2023/03/08 05:45:31 jsing Exp $ */
/* $OpenBSD: ec_print.c,v 1.12 2023/06/23 10:34:16 tb Exp $ */
/* ====================================================================
* Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved.
*
@ -167,7 +167,7 @@ EC_POINT_hex2point(const EC_GROUP *group, const char *buf,
EC_POINT *ret = NULL;
BIGNUM *tmp_bn = NULL;
if (!BN_hex2bn(&tmp_bn, buf))
if (BN_hex2bn(&tmp_bn, buf) == 0)
return NULL;
ret = EC_POINT_bn2point(group, tmp_bn, point, ctx);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: x509_set.c,v 1.25 2023/04/25 10:18:39 job Exp $ */
/* $OpenBSD: x509_set.c,v 1.26 2023/06/23 08:00:28 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@ -106,7 +106,7 @@ X509_set_serialNumber(X509 *x, ASN1_INTEGER *serial)
ASN1_INTEGER *in;
if (x == NULL)
return (0);
return 0;
in = x->cert_info->serialNumber;
if (in != serial) {
in = ASN1_INTEGER_dup(serial);
@ -116,17 +116,17 @@ X509_set_serialNumber(X509 *x, ASN1_INTEGER *serial)
x->cert_info->serialNumber = in;
}
}
return (in != NULL);
return in != NULL;
}
LCRYPTO_ALIAS(X509_set_serialNumber);
int
X509_set_issuer_name(X509 *x, X509_NAME *name)
{
if ((x == NULL) || (x->cert_info == NULL))
return (0);
if (x == NULL || x->cert_info == NULL)
return 0;
x->cert_info->enc.modified = 1;
return (X509_NAME_set(&x->cert_info->issuer, name));
return X509_NAME_set(&x->cert_info->issuer, name);
}
LCRYPTO_ALIAS(X509_set_issuer_name);
@ -134,9 +134,9 @@ int
X509_set_subject_name(X509 *x, X509_NAME *name)
{
if (x == NULL || x->cert_info == NULL)
return (0);
return 0;
x->cert_info->enc.modified = 1;
return (X509_NAME_set(&x->cert_info->subject, name));
return X509_NAME_set(&x->cert_info->subject, name);
}
LCRYPTO_ALIAS(X509_set_subject_name);
@ -151,7 +151,7 @@ ASN1_TIME *
X509_getm_notBefore(const X509 *x)
{
if (x == NULL || x->cert_info == NULL || x->cert_info->validity == NULL)
return (NULL);
return NULL;
return x->cert_info->validity->notBefore;
}
LCRYPTO_ALIAS(X509_getm_notBefore);
@ -162,7 +162,7 @@ X509_set_notBefore(X509 *x, const ASN1_TIME *tm)
ASN1_TIME *in;
if (x == NULL || x->cert_info->validity == NULL)
return (0);
return 0;
in = x->cert_info->validity->notBefore;
if (in != tm) {
in = ASN1_STRING_dup(tm);
@ -172,7 +172,7 @@ X509_set_notBefore(X509 *x, const ASN1_TIME *tm)
x->cert_info->validity->notBefore = in;
}
}
return (in != NULL);
return in != NULL;
}
LCRYPTO_ALIAS(X509_set_notBefore);
@ -194,7 +194,7 @@ ASN1_TIME *
X509_getm_notAfter(const X509 *x)
{
if (x == NULL || x->cert_info == NULL || x->cert_info->validity == NULL)
return (NULL);
return NULL;
return x->cert_info->validity->notAfter;
}
LCRYPTO_ALIAS(X509_getm_notAfter);
@ -205,7 +205,7 @@ X509_set_notAfter(X509 *x, const ASN1_TIME *tm)
ASN1_TIME *in;
if (x == NULL || x->cert_info->validity == NULL)
return (0);
return 0;
in = x->cert_info->validity->notAfter;
if (in != tm) {
in = ASN1_STRING_dup(tm);
@ -215,7 +215,7 @@ X509_set_notAfter(X509 *x, const ASN1_TIME *tm)
x->cert_info->validity->notAfter = in;
}
}
return (in != NULL);
return in != NULL;
}
LCRYPTO_ALIAS(X509_set_notAfter);
@ -229,10 +229,10 @@ LCRYPTO_ALIAS(X509_set1_notAfter);
int
X509_set_pubkey(X509 *x, EVP_PKEY *pkey)
{
if ((x == NULL) || (x->cert_info == NULL))
return (0);
if (x == NULL || x->cert_info == NULL)
return 0;
x->cert_info->enc.modified = 1;
return (X509_PUBKEY_set(&(x->cert_info->key), pkey));
return X509_PUBKEY_set(&x->cert_info->key, pkey);
}
LCRYPTO_ALIAS(X509_set_pubkey);