-/* $OpenBSD: x509cset.c,v 1.21 2024/03/26 22:45:38 tb Exp $ */
+/* $OpenBSD: x509cset.c,v 1.22 2024/03/26 23:41:45 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2001.
*/
int
X509_CRL_up_ref(X509_CRL *x)
{
- int refs = CRYPTO_add(&x->references, 1, CRYPTO_LOCK_X509_CRL);
- return (refs > 1) ? 1 : 0;
+ return CRYPTO_add(&x->references, 1, CRYPTO_LOCK_X509_CRL) > 1;
}
LCRYPTO_ALIAS(X509_CRL_up_ref);
X509_CRL_set_version(X509_CRL *x, long version)
{
if (x == NULL)
- return (0);
+ return 0;
/*
* RFC 5280, 4.1: versions 1 - 3 are specified as follows.
* Version ::= INTEGER { v1(0), v2(1), v3(2) }
* The only specified versions for CRLs are 1 and 2.
*/
if (version < 0 || version > 1)
- return (0);
+ return 0;
if (x->crl->version == NULL) {
if ((x->crl->version = ASN1_INTEGER_new()) == NULL)
- return (0);
+ return 0;
}
- return (ASN1_INTEGER_set(x->crl->version, version));
+ return ASN1_INTEGER_set(x->crl->version, version);
}
LCRYPTO_ALIAS(X509_CRL_set_version);
int
X509_CRL_set_issuer_name(X509_CRL *x, X509_NAME *name)
{
- if ((x == NULL) || (x->crl == NULL))
- return (0);
- return (X509_NAME_set(&x->crl->issuer, name));
+ if (x == NULL || x->crl == NULL)
+ return 0;
+ return X509_NAME_set(&x->crl->issuer, name);
}
LCRYPTO_ALIAS(X509_CRL_set_issuer_name);
ASN1_TIME *in;
if (x == NULL)
- return (0);
+ return 0;
in = x->crl->lastUpdate;
if (in != tm) {
in = ASN1_STRING_dup(tm);
x->crl->lastUpdate = in;
}
}
- return (in != NULL);
+ return in != NULL;
}
LCRYPTO_ALIAS(X509_CRL_set_lastUpdate);
ASN1_TIME *in;
if (x == NULL)
- return (0);
+ return 0;
in = x->crl->nextUpdate;
if (in != tm) {
in = ASN1_STRING_dup(tm);
x->crl->nextUpdate = in;
}
}
- return (in != NULL);
+ return in != NULL;
}
LCRYPTO_ALIAS(X509_CRL_set_nextUpdate);
int
X509_CRL_sort(X509_CRL *c)
{
- int i;
X509_REVOKED *r;
+ int i;
- /* sort the data so it will be written in serial
- * number order */
+ /* Sort the data so it will be written in serial number order */
sk_X509_REVOKED_sort(c->crl->revoked);
for (i = 0; i < sk_X509_REVOKED_num(c->crl->revoked); i++) {
r = sk_X509_REVOKED_value(c->crl->revoked, i);
ASN1_TIME *in;
if (x == NULL)
- return (0);
+ return 0;
in = x->revocationDate;
if (in != tm) {
in = ASN1_STRING_dup(tm);
x->revocationDate = in;
}
}
- return (in != NULL);
+ return in != NULL;
}
LCRYPTO_ALIAS(X509_REVOKED_set_revocationDate);
ASN1_INTEGER *in;
if (x == NULL)
- return (0);
+ return 0;
in = x->serialNumber;
if (in != serial) {
in = ASN1_INTEGER_dup(serial);
x->serialNumber = in;
}
}
- return (in != NULL);
+ return in != NULL;
}
LCRYPTO_ALIAS(X509_REVOKED_set_serialNumber);