Latest update.
This commit is contained in:
@@ -19,8 +19,8 @@
|
||||
#endif
|
||||
|
||||
#include <openssl/x509.h>
|
||||
#include "internal/x509_int.h"
|
||||
#include "x509_lcl.h"
|
||||
#include "crypto/x509.h"
|
||||
#include "x509_local.h"
|
||||
|
||||
struct lookup_dir_hashes_st {
|
||||
unsigned long hash;
|
||||
@@ -156,7 +156,7 @@ static int add_cert_dir(BY_DIR *ctx, const char *dir, int type)
|
||||
size_t len;
|
||||
const char *s, *ss, *p;
|
||||
|
||||
if (dir == NULL || !*dir) {
|
||||
if (dir == NULL || *dir == '\0') {
|
||||
X509err(X509_F_ADD_CERT_DIR, X509_R_INVALID_DIRECTORY);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include <openssl/buffer.h>
|
||||
#include <openssl/x509.h>
|
||||
#include <openssl/pem.h>
|
||||
#include "x509_lcl.h"
|
||||
#include "x509_local.h"
|
||||
|
||||
static int by_file_ctrl(X509_LOOKUP *ctx, int cmd, const char *argc,
|
||||
long argl, char **ret);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
int name_cmp(const char *name, const char *cmp);
|
||||
int v3_name_cmp(const char *name, const char *cmp);
|
||||
|
||||
extern const X509V3_EXT_METHOD v3_bcons, v3_nscert, v3_key_usage, v3_ext_ku;
|
||||
extern const X509V3_EXT_METHOD v3_pkey_usage_period, v3_sxnet, v3_info, v3_sinfo;
|
||||
|
||||
@@ -10,9 +10,9 @@
|
||||
#include "internal/cryptlib.h"
|
||||
#include <openssl/x509.h>
|
||||
#include <openssl/x509v3.h>
|
||||
#include "internal/x509_int.h"
|
||||
#include "crypto/x509.h"
|
||||
|
||||
#include "pcy_int.h"
|
||||
#include "pcy_local.h"
|
||||
|
||||
static int policy_data_cmp(const X509_POLICY_DATA *const *a,
|
||||
const X509_POLICY_DATA *const *b);
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include <openssl/x509.h>
|
||||
#include <openssl/x509v3.h>
|
||||
|
||||
#include "pcy_int.h"
|
||||
#include "pcy_local.h"
|
||||
|
||||
/* Policy Node routines */
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include <openssl/x509.h>
|
||||
#include <openssl/x509v3.h>
|
||||
|
||||
#include "pcy_int.h"
|
||||
#include "pcy_local.h"
|
||||
|
||||
/* accessor functions */
|
||||
|
||||
|
||||
@@ -10,9 +10,9 @@
|
||||
#include "internal/cryptlib.h"
|
||||
#include <openssl/x509.h>
|
||||
#include <openssl/x509v3.h>
|
||||
#include "internal/x509_int.h"
|
||||
#include "crypto/x509.h"
|
||||
|
||||
#include "pcy_int.h"
|
||||
#include "pcy_local.h"
|
||||
|
||||
/*
|
||||
* Set policy mapping entries in cache. Note: this modifies the passed
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include <openssl/x509v3.h>
|
||||
#include <openssl/err.h>
|
||||
|
||||
#include "pcy_int.h"
|
||||
#include "pcy_local.h"
|
||||
|
||||
static int node_cmp(const X509_POLICY_NODE *const *a,
|
||||
const X509_POLICY_NODE *const *b)
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include <openssl/x509.h>
|
||||
#include <openssl/x509v3.h>
|
||||
|
||||
#include "pcy_int.h"
|
||||
#include "pcy_local.h"
|
||||
|
||||
static void expected_print(BIO *channel,
|
||||
X509_POLICY_LEVEL *lev, X509_POLICY_NODE *node,
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include <openssl/objects.h>
|
||||
#include <openssl/x509.h>
|
||||
#include <openssl/x509v3.h>
|
||||
#include "internal/asn1_int.h"
|
||||
#include "crypto/asn1.h"
|
||||
|
||||
#ifndef OPENSSL_NO_STDIO
|
||||
int X509_print_fp(FILE *fp, X509 *x)
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include <openssl/asn1t.h>
|
||||
#include <openssl/buffer.h>
|
||||
#include <openssl/x509v3.h>
|
||||
#include "internal/x509_int.h"
|
||||
#include "crypto/x509.h"
|
||||
#include "ext_dat.h"
|
||||
|
||||
#ifndef OPENSSL_NO_RFC3779
|
||||
@@ -906,14 +906,14 @@ static void *v2i_IPAddrBlocks(const struct v3_ext_method *method,
|
||||
const char *addr_chars = NULL;
|
||||
int prefixlen, i1, i2, delim, length;
|
||||
|
||||
if (!name_cmp(val->name, "IPv4")) {
|
||||
if (!v3_name_cmp(val->name, "IPv4")) {
|
||||
afi = IANA_AFI_IPV4;
|
||||
} else if (!name_cmp(val->name, "IPv6")) {
|
||||
} else if (!v3_name_cmp(val->name, "IPv6")) {
|
||||
afi = IANA_AFI_IPV6;
|
||||
} else if (!name_cmp(val->name, "IPv4-SAFI")) {
|
||||
} else if (!v3_name_cmp(val->name, "IPv4-SAFI")) {
|
||||
afi = IANA_AFI_IPV4;
|
||||
safi = &safi_;
|
||||
} else if (!name_cmp(val->name, "IPv6-SAFI")) {
|
||||
} else if (!v3_name_cmp(val->name, "IPv6-SAFI")) {
|
||||
afi = IANA_AFI_IPV6;
|
||||
safi = &safi_;
|
||||
} else {
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include <stdio.h>
|
||||
#include "internal/cryptlib.h"
|
||||
#include <openssl/conf.h>
|
||||
#include <openssl/ossl_typ.h>
|
||||
#include <openssl/types.h>
|
||||
#include <openssl/asn1.h>
|
||||
#include <openssl/asn1t.h>
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_V3_ADMISSION_H
|
||||
# define HEADER_V3_ADMISSION_H
|
||||
#ifndef OSSL_CRYPTO_X509_V3_ADMIS_H
|
||||
# define OSSL_CRYPTO_X509_V3_ADMIS_H
|
||||
|
||||
struct NamingAuthority_st {
|
||||
ASN1_OBJECT* namingAuthorityId;
|
||||
|
||||
+10
-10
@@ -252,7 +252,7 @@ static GENERAL_NAMES *v2i_issuer_alt(X509V3_EXT_METHOD *method,
|
||||
for (i = 0; i < num; i++) {
|
||||
CONF_VALUE *cnf = sk_CONF_VALUE_value(nval, i);
|
||||
|
||||
if (!name_cmp(cnf->name, "issuer")
|
||||
if (!v3_name_cmp(cnf->name, "issuer")
|
||||
&& cnf->value && strcmp(cnf->value, "copy") == 0) {
|
||||
if (!copy_issuer(ctx, gens))
|
||||
goto err;
|
||||
@@ -331,11 +331,11 @@ static GENERAL_NAMES *v2i_subject_alt(X509V3_EXT_METHOD *method,
|
||||
|
||||
for (i = 0; i < num; i++) {
|
||||
cnf = sk_CONF_VALUE_value(nval, i);
|
||||
if (!name_cmp(cnf->name, "email")
|
||||
if (!v3_name_cmp(cnf->name, "email")
|
||||
&& cnf->value && strcmp(cnf->value, "copy") == 0) {
|
||||
if (!copy_email(ctx, gens, 0))
|
||||
goto err;
|
||||
} else if (!name_cmp(cnf->name, "email")
|
||||
} else if (!v3_name_cmp(cnf->name, "email")
|
||||
&& cnf->value && strcmp(cnf->value, "move") == 0) {
|
||||
if (!copy_email(ctx, gens, 1))
|
||||
goto err;
|
||||
@@ -551,19 +551,19 @@ GENERAL_NAME *v2i_GENERAL_NAME_ex(GENERAL_NAME *out,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!name_cmp(name, "email"))
|
||||
if (!v3_name_cmp(name, "email"))
|
||||
type = GEN_EMAIL;
|
||||
else if (!name_cmp(name, "URI"))
|
||||
else if (!v3_name_cmp(name, "URI"))
|
||||
type = GEN_URI;
|
||||
else if (!name_cmp(name, "DNS"))
|
||||
else if (!v3_name_cmp(name, "DNS"))
|
||||
type = GEN_DNS;
|
||||
else if (!name_cmp(name, "RID"))
|
||||
else if (!v3_name_cmp(name, "RID"))
|
||||
type = GEN_RID;
|
||||
else if (!name_cmp(name, "IP"))
|
||||
else if (!v3_name_cmp(name, "IP"))
|
||||
type = GEN_IPADD;
|
||||
else if (!name_cmp(name, "dirName"))
|
||||
else if (!v3_name_cmp(name, "dirName"))
|
||||
type = GEN_DIRNAME;
|
||||
else if (!name_cmp(name, "otherName"))
|
||||
else if (!v3_name_cmp(name, "otherName"))
|
||||
type = GEN_OTHERNAME;
|
||||
else {
|
||||
X509V3err(X509V3_F_V2I_GENERAL_NAME_EX, X509V3_R_UNSUPPORTED_OPTION);
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include <openssl/asn1t.h>
|
||||
#include <openssl/x509v3.h>
|
||||
#include <openssl/x509.h>
|
||||
#include "internal/x509_int.h"
|
||||
#include "crypto/x509.h"
|
||||
#include <openssl/bn.h>
|
||||
#include "ext_dat.h"
|
||||
|
||||
@@ -534,9 +534,9 @@ static void *v2i_ASIdentifiers(const struct v3_ext_method *method,
|
||||
/*
|
||||
* Figure out whether this is an AS or an RDI.
|
||||
*/
|
||||
if (!name_cmp(val->name, "AS")) {
|
||||
if (!v3_name_cmp(val->name, "AS")) {
|
||||
which = V3_ASID_ASNUM;
|
||||
} else if (!name_cmp(val->name, "RDI")) {
|
||||
} else if (!v3_name_cmp(val->name, "RDI")) {
|
||||
which = V3_ASID_RDI;
|
||||
} else {
|
||||
X509V3err(X509V3_F_V2I_ASIDENTIFIERS,
|
||||
|
||||
@@ -10,11 +10,11 @@
|
||||
/* extension creation utilities */
|
||||
|
||||
#include <stdio.h>
|
||||
#include "internal/ctype.h"
|
||||
#include "crypto/ctype.h"
|
||||
#include "internal/cryptlib.h"
|
||||
#include <openssl/conf.h>
|
||||
#include <openssl/x509.h>
|
||||
#include "internal/x509_int.h"
|
||||
#include "crypto/x509.h"
|
||||
#include <openssl/x509v3.h>
|
||||
|
||||
static int v3_check_critical(const char **value);
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include <openssl/asn1t.h>
|
||||
#include <openssl/x509v3.h>
|
||||
|
||||
#include "pcy_int.h"
|
||||
#include "pcy_local.h"
|
||||
#include "ext_dat.h"
|
||||
|
||||
/* Certificate policies extension support: this one is a bit complex... */
|
||||
@@ -124,8 +124,9 @@ static STACK_OF(POLICYINFO) *r2i_certpol(X509V3_EXT_METHOD *method,
|
||||
continue;
|
||||
} else if (*pstr == '@') {
|
||||
STACK_OF(CONF_VALUE) *polsect;
|
||||
|
||||
polsect = X509V3_get_section(ctx, pstr + 1);
|
||||
if (!polsect) {
|
||||
if (polsect == NULL) {
|
||||
X509V3err(X509V3_F_R2I_CERTPOL, X509V3_R_INVALID_SECTION);
|
||||
|
||||
X509V3_conf_err(cnf);
|
||||
@@ -186,7 +187,7 @@ static POLICYINFO *policy_section(X509V3_CTX *ctx,
|
||||
}
|
||||
pol->policyid = pobj;
|
||||
|
||||
} else if (!name_cmp(cnf->name, "CPS")) {
|
||||
} else if (!v3_name_cmp(cnf->name, "CPS")) {
|
||||
if (pol->qualifiers == NULL)
|
||||
pol->qualifiers = sk_POLICYQUALINFO_new_null();
|
||||
if ((qual = POLICYQUALINFO_new()) == NULL)
|
||||
@@ -202,7 +203,7 @@ static POLICYINFO *policy_section(X509V3_CTX *ctx,
|
||||
if (!ASN1_STRING_set(qual->d.cpsuri, cnf->value,
|
||||
strlen(cnf->value)))
|
||||
goto merr;
|
||||
} else if (!name_cmp(cnf->name, "userNotice")) {
|
||||
} else if (!v3_name_cmp(cnf->name, "userNotice")) {
|
||||
STACK_OF(CONF_VALUE) *unot;
|
||||
if (*cnf->value != '@') {
|
||||
X509V3err(X509V3_F_POLICY_SECTION,
|
||||
@@ -221,7 +222,7 @@ static POLICYINFO *policy_section(X509V3_CTX *ctx,
|
||||
X509V3_section_free(ctx, unot);
|
||||
if (!qual)
|
||||
goto err;
|
||||
if (!pol->qualifiers)
|
||||
if (pol->qualifiers == NULL)
|
||||
pol->qualifiers = sk_POLICYQUALINFO_new_null();
|
||||
if (!sk_POLICYQUALINFO_push(pol->qualifiers, qual))
|
||||
goto merr;
|
||||
@@ -232,7 +233,7 @@ static POLICYINFO *policy_section(X509V3_CTX *ctx,
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
if (!pol->policyid) {
|
||||
if (pol->policyid == NULL) {
|
||||
X509V3err(X509V3_F_POLICY_SECTION, X509V3_R_NO_POLICY_IDENTIFIER);
|
||||
goto err;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include <openssl/asn1t.h>
|
||||
#include <openssl/x509v3.h>
|
||||
|
||||
#include "internal/x509_int.h"
|
||||
#include "crypto/x509.h"
|
||||
#include "ext_dat.h"
|
||||
|
||||
static void *v2i_crld(const X509V3_EXT_METHOD *method,
|
||||
@@ -168,7 +168,7 @@ static int set_reasons(ASN1_BIT_STRING **preas, char *value)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!pbn->lname)
|
||||
if (pbn->lname == NULL)
|
||||
goto err;
|
||||
}
|
||||
ret = 1;
|
||||
@@ -222,7 +222,7 @@ static DIST_POINT *crldp_from_section(X509V3_CTX *ctx,
|
||||
goto err;
|
||||
} else if (strcmp(cnf->name, "CRLissuer") == 0) {
|
||||
point->CRLissuer = gnames_from_sectname(ctx, cnf->value);
|
||||
if (!point->CRLissuer)
|
||||
if (point->CRLissuer == NULL)
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
@@ -258,7 +258,7 @@ static void *v2i_crld(const X509V3_EXT_METHOD *method,
|
||||
goto err;
|
||||
point = crldp_from_section(ctx, dpsect);
|
||||
X509V3_section_free(ctx, dpsect);
|
||||
if (!point)
|
||||
if (point == NULL)
|
||||
goto err;
|
||||
sk_DIST_POINT_push(crld, point); /* no failure as it was reserved */
|
||||
} else {
|
||||
|
||||
@@ -123,7 +123,7 @@ static AUTHORITY_INFO_ACCESS *v2i_AUTHORITY_INFO_ACCESS(X509V3_EXT_METHOD
|
||||
}
|
||||
sk_ACCESS_DESCRIPTION_push(ainfo, acc); /* Cannot fail due to reserve */
|
||||
ptmp = strchr(cnf->name, ';');
|
||||
if (!ptmp) {
|
||||
if (ptmp == NULL) {
|
||||
X509V3err(X509V3_F_V2I_AUTHORITY_INFO_ACCESS,
|
||||
X509V3_R_INVALID_SYNTAX);
|
||||
goto err;
|
||||
|
||||
@@ -10,13 +10,13 @@
|
||||
#include "internal/cryptlib.h"
|
||||
#include "internal/numbers.h"
|
||||
#include <stdio.h>
|
||||
#include "internal/asn1_int.h"
|
||||
#include "crypto/asn1.h"
|
||||
#include <openssl/asn1t.h>
|
||||
#include <openssl/conf.h>
|
||||
#include <openssl/x509v3.h>
|
||||
#include <openssl/bn.h>
|
||||
|
||||
#include "internal/x509_int.h"
|
||||
#include "crypto/x509.h"
|
||||
#include "ext_dat.h"
|
||||
|
||||
static void *v2i_NAME_CONSTRAINTS(const X509V3_EXT_METHOD *method,
|
||||
@@ -561,8 +561,9 @@ static int nc_dns(ASN1_IA5STRING *dns, ASN1_IA5STRING *base)
|
||||
{
|
||||
char *baseptr = (char *)base->data;
|
||||
char *dnsptr = (char *)dns->data;
|
||||
|
||||
/* Empty matches everything */
|
||||
if (!*baseptr)
|
||||
if (*baseptr == '\0')
|
||||
return X509_V_OK;
|
||||
/*
|
||||
* Otherwise can add zero or more components on the left so compare RHS
|
||||
@@ -628,8 +629,9 @@ static int nc_uri(ASN1_IA5STRING *uri, ASN1_IA5STRING *base)
|
||||
const char *hostptr = (char *)uri->data;
|
||||
const char *p = strchr(hostptr, ':');
|
||||
int hostlen;
|
||||
|
||||
/* Check for foo:// and skip past it */
|
||||
if (!p || (p[1] != '/') || (p[2] != '/'))
|
||||
if (p == NULL || p[1] != '/' || p[2] != '/')
|
||||
return X509_V_ERR_UNSUPPORTED_NAME_SYNTAX;
|
||||
hostptr = p + 3;
|
||||
|
||||
@@ -639,10 +641,10 @@ static int nc_uri(ASN1_IA5STRING *uri, ASN1_IA5STRING *base)
|
||||
|
||||
p = strchr(hostptr, ':');
|
||||
/* Otherwise look for trailing slash */
|
||||
if (!p)
|
||||
if (p == NULL)
|
||||
p = strchr(hostptr, '/');
|
||||
|
||||
if (!p)
|
||||
if (p == NULL)
|
||||
hostlen = strlen(hostptr);
|
||||
else
|
||||
hostlen = p - hostptr;
|
||||
|
||||
@@ -116,7 +116,8 @@ static int process_pci_value(CONF_VALUE *val,
|
||||
} else if (strcmp(val->name, "policy") == 0) {
|
||||
unsigned char *tmp_data = NULL;
|
||||
long val_len;
|
||||
if (!*policy) {
|
||||
|
||||
if (*policy == NULL) {
|
||||
*policy = ASN1_OCTET_STRING_new();
|
||||
if (*policy == NULL) {
|
||||
X509V3err(X509V3_F_PROCESS_PCI_VALUE, ERR_R_MALLOC_FAILURE);
|
||||
|
||||
@@ -78,7 +78,8 @@ static void *v2i_POLICY_CONSTRAINTS(const X509V3_EXT_METHOD *method,
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
if (!pcons->inhibitPolicyMapping && !pcons->requireExplicitPolicy) {
|
||||
if (pcons->inhibitPolicyMapping == NULL
|
||||
&& pcons->requireExplicitPolicy == NULL) {
|
||||
X509V3err(X509V3_F_V2I_POLICY_CONSTRAINTS,
|
||||
X509V3_R_ILLEGAL_EMPTY_EXTENSION);
|
||||
goto err;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "internal/numbers.h"
|
||||
#include <openssl/x509v3.h>
|
||||
#include <openssl/x509_vfy.h>
|
||||
#include "internal/x509_int.h"
|
||||
#include "crypto/x509.h"
|
||||
#include "internal/tsan_assist.h"
|
||||
|
||||
static void x509v3_cache_extensions(X509 *x);
|
||||
@@ -178,7 +178,7 @@ int X509_PURPOSE_add(int id, int trust, int flags,
|
||||
/* dup supplied name */
|
||||
ptmp->name = OPENSSL_strdup(name);
|
||||
ptmp->sname = OPENSSL_strdup(sname);
|
||||
if (!ptmp->name || !ptmp->sname) {
|
||||
if (ptmp->name == NULL|| ptmp->sname == NULL) {
|
||||
X509V3err(X509V3_F_X509_PURPOSE_ADD, ERR_R_MALLOC_FAILURE);
|
||||
goto err;
|
||||
}
|
||||
@@ -216,7 +216,7 @@ int X509_PURPOSE_add(int id, int trust, int flags,
|
||||
|
||||
static void xptable_free(X509_PURPOSE *p)
|
||||
{
|
||||
if (!p)
|
||||
if (p == NULL)
|
||||
return;
|
||||
if (p->flags & X509_PURPOSE_DYNAMIC) {
|
||||
if (p->flags & X509_PURPOSE_DYNAMIC_NAME) {
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <stdio.h>
|
||||
#include "internal/cryptlib.h"
|
||||
#include <openssl/x509v3.h>
|
||||
#include "internal/x509_int.h"
|
||||
#include "crypto/x509.h"
|
||||
#include "ext_dat.h"
|
||||
|
||||
static ASN1_OCTET_STRING *s2i_skey_id(X509V3_EXT_METHOD *method,
|
||||
|
||||
@@ -139,7 +139,8 @@ int SXNET_add_id_INTEGER(SXNET **psx, ASN1_INTEGER *zone, const char *user,
|
||||
{
|
||||
SXNET *sx = NULL;
|
||||
SXNETID *id = NULL;
|
||||
if (!psx || !zone || !user) {
|
||||
|
||||
if (psx == NULL || zone == NULL || user == NULL) {
|
||||
X509V3err(X509V3_F_SXNET_ADD_ID_INTEGER,
|
||||
X509V3_R_INVALID_NULL_ARGUMENT);
|
||||
return 0;
|
||||
|
||||
@@ -12,11 +12,11 @@
|
||||
#include "e_os.h"
|
||||
#include "internal/cryptlib.h"
|
||||
#include <stdio.h>
|
||||
#include "internal/ctype.h"
|
||||
#include "crypto/ctype.h"
|
||||
#include <openssl/conf.h>
|
||||
#include <openssl/crypto.h>
|
||||
#include <openssl/x509v3.h>
|
||||
#include "internal/x509_int.h"
|
||||
#include "crypto/x509.h"
|
||||
#include <openssl/bn.h>
|
||||
#include "ext_dat.h"
|
||||
|
||||
@@ -380,14 +380,14 @@ static char *strip_spaces(char *name)
|
||||
p = name;
|
||||
while (*p && ossl_isspace(*p))
|
||||
p++;
|
||||
if (!*p)
|
||||
if (*p == '\0')
|
||||
return NULL;
|
||||
q = p + strlen(p) - 1;
|
||||
while ((q != p) && ossl_isspace(*q))
|
||||
q--;
|
||||
if (p != q)
|
||||
q[1] = 0;
|
||||
if (!*p)
|
||||
if (*p == '\0')
|
||||
return NULL;
|
||||
return p;
|
||||
}
|
||||
@@ -397,7 +397,7 @@ static char *strip_spaces(char *name)
|
||||
* V2I name comparison function: returns zero if 'name' matches cmp or cmp.*
|
||||
*/
|
||||
|
||||
int name_cmp(const char *name, const char *cmp)
|
||||
int v3_name_cmp(const char *name, const char *cmp)
|
||||
{
|
||||
int len, ret;
|
||||
char c;
|
||||
@@ -989,11 +989,12 @@ ASN1_OCTET_STRING *a2i_IPADDRESS_NC(const char *ipasc)
|
||||
unsigned char ipout[32];
|
||||
char *iptmp = NULL, *p;
|
||||
int iplen1, iplen2;
|
||||
|
||||
p = strchr(ipasc, '/');
|
||||
if (!p)
|
||||
if (p == NULL)
|
||||
return NULL;
|
||||
iptmp = OPENSSL_strdup(ipasc);
|
||||
if (!iptmp)
|
||||
if (iptmp == NULL)
|
||||
return NULL;
|
||||
p = iptmp + (p - ipasc);
|
||||
*p++ = 0;
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/x509.h>
|
||||
#include <openssl/x509v3.h>
|
||||
#include "x509_lcl.h"
|
||||
#include "x509_local.h"
|
||||
|
||||
int X509at_get_attr_count(const STACK_OF(X509_ATTRIBUTE) *x)
|
||||
{
|
||||
|
||||
@@ -13,7 +13,8 @@
|
||||
#include <openssl/objects.h>
|
||||
#include <openssl/x509.h>
|
||||
#include <openssl/x509v3.h>
|
||||
#include "internal/x509_int.h"
|
||||
#include <openssl/core_names.h>
|
||||
#include "crypto/x509.h"
|
||||
|
||||
int X509_issuer_and_serial_cmp(const X509 *a, const X509 *b)
|
||||
{
|
||||
@@ -205,23 +206,26 @@ unsigned long X509_NAME_hash(X509_NAME *x)
|
||||
|
||||
unsigned long X509_NAME_hash_old(X509_NAME *x)
|
||||
{
|
||||
EVP_MD *md5 = EVP_MD_fetch(NULL, OSSL_DIGEST_NAME_MD5, "-fips");
|
||||
EVP_MD_CTX *md_ctx = EVP_MD_CTX_new();
|
||||
unsigned long ret = 0;
|
||||
unsigned char md[16];
|
||||
|
||||
if (md_ctx == NULL)
|
||||
return ret;
|
||||
if (md5 == NULL || md_ctx == NULL)
|
||||
goto end;
|
||||
|
||||
/* Make sure X509_NAME structure contains valid cached encoding */
|
||||
i2d_X509_NAME(x, NULL);
|
||||
EVP_MD_CTX_set_flags(md_ctx, EVP_MD_CTX_FLAG_NON_FIPS_ALLOW);
|
||||
if (EVP_DigestInit_ex(md_ctx, EVP_md5(), NULL)
|
||||
if (EVP_DigestInit_ex(md_ctx, md5, NULL)
|
||||
&& EVP_DigestUpdate(md_ctx, x->bytes->data, x->bytes->length)
|
||||
&& EVP_DigestFinal_ex(md_ctx, md, NULL))
|
||||
ret = (((unsigned long)md[0]) | ((unsigned long)md[1] << 8L) |
|
||||
((unsigned long)md[2] << 16L) | ((unsigned long)md[3] << 24L)
|
||||
) & 0xffffffffL;
|
||||
|
||||
end:
|
||||
EVP_MD_CTX_free(md_ctx);
|
||||
EVP_MD_free(md5);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include <openssl/objects.h>
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/x509.h>
|
||||
#include "internal/x509_int.h"
|
||||
#include "crypto/x509.h"
|
||||
#include <openssl/x509v3.h>
|
||||
|
||||
int X509_CRL_get_ext_count(const X509_CRL *x)
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
#include "internal/cryptlib.h"
|
||||
#include "internal/refcount.h"
|
||||
#include <openssl/x509.h>
|
||||
#include "internal/x509_int.h"
|
||||
#include "crypto/x509.h"
|
||||
#include <openssl/x509v3.h>
|
||||
#include "x509_lcl.h"
|
||||
#include "x509_local.h"
|
||||
|
||||
X509_LOOKUP *X509_LOOKUP_new(X509_LOOKUP_METHOD *method)
|
||||
{
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
#include "internal/cryptlib.h"
|
||||
#include <openssl/asn1.h>
|
||||
#include <openssl/x509.h>
|
||||
#include <openssl/ossl_typ.h>
|
||||
#include "x509_lcl.h"
|
||||
#include <openssl/types.h>
|
||||
#include "x509_local.h"
|
||||
|
||||
X509_LOOKUP_METHOD *X509_LOOKUP_meth_new(const char *name)
|
||||
{
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include <openssl/objects.h>
|
||||
#include <openssl/x509.h>
|
||||
#include <openssl/buffer.h>
|
||||
#include "internal/x509_int.h"
|
||||
#include "crypto/x509.h"
|
||||
|
||||
/*
|
||||
* Limit to ensure we don't overflow: much greater than
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/asn1.h>
|
||||
#include <openssl/x509.h>
|
||||
#include "internal/x509_int.h"
|
||||
#include "crypto/x509.h"
|
||||
#include <openssl/objects.h>
|
||||
#include <openssl/buffer.h>
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include <openssl/asn1.h>
|
||||
#include <openssl/asn1t.h>
|
||||
#include <openssl/x509.h>
|
||||
#include "internal/x509_int.h"
|
||||
#include "crypto/x509.h"
|
||||
#include <openssl/objects.h>
|
||||
#include <openssl/buffer.h>
|
||||
#include <openssl/pem.h>
|
||||
|
||||
@@ -15,9 +15,9 @@
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/x509.h>
|
||||
#include <openssl/x509v3.h>
|
||||
#include "internal/asn1_int.h"
|
||||
#include "internal/x509_int.h"
|
||||
#include "x509_lcl.h"
|
||||
#include "crypto/asn1.h"
|
||||
#include "crypto/x509.h"
|
||||
#include "x509_local.h"
|
||||
|
||||
int X509_set_version(X509 *x, long version)
|
||||
{
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <stdio.h>
|
||||
#include "internal/cryptlib.h"
|
||||
#include <openssl/x509v3.h>
|
||||
#include "internal/x509_int.h"
|
||||
#include "crypto/x509.h"
|
||||
|
||||
static int tr_cmp(const X509_TRUST *const *a, const X509_TRUST *const *b);
|
||||
static void trtable_free(X509_TRUST *p);
|
||||
@@ -184,7 +184,7 @@ int X509_TRUST_add(int id, int flags, int (*ck) (X509_TRUST *, X509 *, int),
|
||||
|
||||
static void trtable_free(X509_TRUST *p)
|
||||
{
|
||||
if (!p)
|
||||
if (p == NULL)
|
||||
return;
|
||||
if (p->flags & X509_TRUST_DYNAMIC) {
|
||||
if (p->flags & X509_TRUST_DYNAMIC_NAME)
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/x509.h>
|
||||
#include <openssl/x509v3.h>
|
||||
#include "x509_lcl.h"
|
||||
#include "x509_local.h"
|
||||
|
||||
int X509v3_get_ext_count(const STACK_OF(X509_EXTENSION) *x)
|
||||
{
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include "internal/ctype.h"
|
||||
#include "crypto/ctype.h"
|
||||
#include "internal/cryptlib.h"
|
||||
#include <openssl/crypto.h>
|
||||
#include <openssl/buffer.h>
|
||||
@@ -22,8 +22,8 @@
|
||||
#include <openssl/x509v3.h>
|
||||
#include <openssl/objects.h>
|
||||
#include "internal/dane.h"
|
||||
#include "internal/x509_int.h"
|
||||
#include "x509_lcl.h"
|
||||
#include "crypto/x509.h"
|
||||
#include "x509_local.h"
|
||||
|
||||
/* CRL score values */
|
||||
|
||||
@@ -2134,10 +2134,10 @@ int X509_STORE_CTX_purpose_inherit(X509_STORE_CTX *ctx, int def_purpose,
|
||||
{
|
||||
int idx;
|
||||
/* If purpose not set use default */
|
||||
if (!purpose)
|
||||
if (purpose == 0)
|
||||
purpose = def_purpose;
|
||||
/* If we have a purpose then check it is valid */
|
||||
if (purpose) {
|
||||
if (purpose != 0) {
|
||||
X509_PURPOSE *ptmp;
|
||||
idx = X509_PURPOSE_get_by_id(purpose);
|
||||
if (idx == -1) {
|
||||
@@ -2502,8 +2502,9 @@ int X509_STORE_CTX_get_num_untrusted(X509_STORE_CTX *ctx)
|
||||
int X509_STORE_CTX_set_default(X509_STORE_CTX *ctx, const char *name)
|
||||
{
|
||||
const X509_VERIFY_PARAM *param;
|
||||
|
||||
param = X509_VERIFY_PARAM_lookup(name);
|
||||
if (!param)
|
||||
if (param == NULL)
|
||||
return 0;
|
||||
return X509_VERIFY_PARAM_inherit(ctx->param, param);
|
||||
}
|
||||
|
||||
@@ -14,9 +14,9 @@
|
||||
#include <openssl/buffer.h>
|
||||
#include <openssl/x509.h>
|
||||
#include <openssl/x509v3.h>
|
||||
#include "internal/x509_int.h"
|
||||
#include "crypto/x509.h"
|
||||
|
||||
#include "x509_lcl.h"
|
||||
#include "x509_local.h"
|
||||
|
||||
/* X509_VERIFY_PARAM functions */
|
||||
|
||||
@@ -332,9 +332,9 @@ void X509_VERIFY_PARAM_set_time(X509_VERIFY_PARAM *param, time_t t)
|
||||
int X509_VERIFY_PARAM_add0_policy(X509_VERIFY_PARAM *param,
|
||||
ASN1_OBJECT *policy)
|
||||
{
|
||||
if (!param->policies) {
|
||||
if (param->policies == NULL) {
|
||||
param->policies = sk_ASN1_OBJECT_new_null();
|
||||
if (!param->policies)
|
||||
if (param->policies == NULL)
|
||||
return 0;
|
||||
}
|
||||
if (!sk_ASN1_OBJECT_push(param->policies, policy))
|
||||
@@ -348,17 +348,17 @@ int X509_VERIFY_PARAM_set1_policies(X509_VERIFY_PARAM *param,
|
||||
int i;
|
||||
ASN1_OBJECT *oid, *doid;
|
||||
|
||||
if (!param)
|
||||
if (param == NULL)
|
||||
return 0;
|
||||
sk_ASN1_OBJECT_pop_free(param->policies, ASN1_OBJECT_free);
|
||||
|
||||
if (!policies) {
|
||||
if (policies == NULL) {
|
||||
param->policies = NULL;
|
||||
return 1;
|
||||
}
|
||||
|
||||
param->policies = sk_ASN1_OBJECT_new_null();
|
||||
if (!param->policies)
|
||||
if (param->policies == NULL)
|
||||
return 0;
|
||||
|
||||
for (i = 0; i < sk_ASN1_OBJECT_num(policies); i++) {
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include <openssl/objects.h>
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/x509.h>
|
||||
#include "internal/x509_int.h"
|
||||
#include "crypto/x509.h"
|
||||
|
||||
int X509_CRL_set_version(X509_CRL *x, long version)
|
||||
{
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include <openssl/objects.h>
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/x509.h>
|
||||
#include "internal/x509_int.h"
|
||||
#include "crypto/x509.h"
|
||||
|
||||
int X509_NAME_get_text_by_NID(X509_NAME *name, int nid, char *buf, int len)
|
||||
{
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include <openssl/objects.h>
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/x509.h>
|
||||
#include "internal/x509_int.h"
|
||||
#include "crypto/x509.h"
|
||||
|
||||
int X509_REQ_set_version(X509_REQ *x, long version)
|
||||
{
|
||||
|
||||
+7
-5
@@ -13,7 +13,7 @@
|
||||
#include <openssl/asn1.h>
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/x509.h>
|
||||
#include "internal/x509_int.h"
|
||||
#include "crypto/x509.h"
|
||||
#include <openssl/ocsp.h>
|
||||
#include <openssl/rsa.h>
|
||||
#include <openssl/dsa.h>
|
||||
@@ -21,8 +21,8 @@
|
||||
|
||||
#ifndef OPENSSL_NO_SM2
|
||||
|
||||
# include "internal/asn1_int.h"
|
||||
# include "internal/evp_int.h"
|
||||
# include "crypto/asn1.h"
|
||||
# include "crypto/evp.h"
|
||||
|
||||
static int common_verify_sm2(void *data, EVP_PKEY *pkey,
|
||||
int mdnid, int pknid, int req)
|
||||
@@ -607,8 +607,9 @@ int i2d_PKCS8PrivateKeyInfo_fp(FILE *fp, const EVP_PKEY *key)
|
||||
{
|
||||
PKCS8_PRIV_KEY_INFO *p8inf;
|
||||
int ret;
|
||||
|
||||
p8inf = EVP_PKEY2PKCS8(key);
|
||||
if (!p8inf)
|
||||
if (p8inf == NULL)
|
||||
return 0;
|
||||
ret = i2d_PKCS8_PRIV_KEY_INFO_fp(fp, p8inf);
|
||||
PKCS8_PRIV_KEY_INFO_free(p8inf);
|
||||
@@ -654,8 +655,9 @@ int i2d_PKCS8PrivateKeyInfo_bio(BIO *bp, const EVP_PKEY *key)
|
||||
{
|
||||
PKCS8_PRIV_KEY_INFO *p8inf;
|
||||
int ret;
|
||||
|
||||
p8inf = EVP_PKEY2PKCS8(key);
|
||||
if (!p8inf)
|
||||
if (p8inf == NULL)
|
||||
return 0;
|
||||
ret = i2d_PKCS8_PRIV_KEY_INFO_bio(bp, p8inf);
|
||||
PKCS8_PRIV_KEY_INFO_free(p8inf);
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include <openssl/objects.h>
|
||||
#include <openssl/asn1t.h>
|
||||
#include <openssl/x509.h>
|
||||
#include "x509_lcl.h"
|
||||
#include "x509_local.h"
|
||||
|
||||
/*-
|
||||
* X509_ATTRIBUTE: this has the following form:
|
||||
|
||||
+2
-2
@@ -11,9 +11,9 @@
|
||||
#include "internal/cryptlib.h"
|
||||
#include <openssl/asn1t.h>
|
||||
#include <openssl/x509.h>
|
||||
#include "internal/x509_int.h"
|
||||
#include "crypto/x509.h"
|
||||
#include <openssl/x509v3.h>
|
||||
#include "x509_lcl.h"
|
||||
#include "x509_local.h"
|
||||
|
||||
static int X509_REVOKED_cmp(const X509_REVOKED *const *a,
|
||||
const X509_REVOKED *const *b);
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include <openssl/x509.h>
|
||||
#include <openssl/asn1.h>
|
||||
#include <openssl/asn1t.h>
|
||||
#include "x509_lcl.h"
|
||||
#include "x509_local.h"
|
||||
|
||||
ASN1_SEQUENCE(X509_EXTENSION) = {
|
||||
ASN1_SIMPLE(X509_EXTENSION, object, ASN1_OBJECT),
|
||||
|
||||
@@ -8,13 +8,13 @@
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "internal/ctype.h"
|
||||
#include "crypto/ctype.h"
|
||||
#include "internal/cryptlib.h"
|
||||
#include <openssl/asn1t.h>
|
||||
#include <openssl/x509.h>
|
||||
#include "internal/x509_int.h"
|
||||
#include "internal/asn1_int.h"
|
||||
#include "x509_lcl.h"
|
||||
#include "crypto/x509.h"
|
||||
#include "crypto/asn1.h"
|
||||
#include "x509_local.h"
|
||||
|
||||
/*
|
||||
* Maximum length of X509_NAME: much larger than anything we should
|
||||
@@ -114,7 +114,7 @@ static void x509_name_ex_free(ASN1_VALUE **pval, const ASN1_ITEM *it)
|
||||
{
|
||||
X509_NAME *a;
|
||||
|
||||
if (!pval || !*pval)
|
||||
if (pval == NULL || *pval == NULL)
|
||||
return;
|
||||
a = (X509_NAME *)*pval;
|
||||
|
||||
@@ -503,9 +503,9 @@ int X509_NAME_print(BIO *bp, const X509_NAME *name, int obase)
|
||||
l = 80 - 2 - obase;
|
||||
|
||||
b = X509_NAME_oneline(name, NULL, 0);
|
||||
if (!b)
|
||||
if (b == NULL)
|
||||
return 0;
|
||||
if (!*b) {
|
||||
if (*b == '\0') {
|
||||
OPENSSL_free(b);
|
||||
return 1;
|
||||
}
|
||||
|
||||
+21
-16
@@ -11,9 +11,9 @@
|
||||
#include "internal/cryptlib.h"
|
||||
#include <openssl/asn1t.h>
|
||||
#include <openssl/x509.h>
|
||||
#include "internal/asn1_int.h"
|
||||
#include "internal/evp_int.h"
|
||||
#include "internal/x509_int.h"
|
||||
#include "crypto/asn1.h"
|
||||
#include "crypto/evp.h"
|
||||
#include "crypto/x509.h"
|
||||
#include <openssl/rsa.h>
|
||||
#include <openssl/dsa.h>
|
||||
|
||||
@@ -185,16 +185,17 @@ EVP_PKEY *d2i_PUBKEY(EVP_PKEY **a, const unsigned char **pp, long length)
|
||||
X509_PUBKEY *xpk;
|
||||
EVP_PKEY *pktmp;
|
||||
const unsigned char *q;
|
||||
|
||||
q = *pp;
|
||||
xpk = d2i_X509_PUBKEY(NULL, &q, length);
|
||||
if (!xpk)
|
||||
if (xpk == NULL)
|
||||
return NULL;
|
||||
pktmp = X509_PUBKEY_get(xpk);
|
||||
X509_PUBKEY_free(xpk);
|
||||
if (!pktmp)
|
||||
if (pktmp == NULL)
|
||||
return NULL;
|
||||
*pp = q;
|
||||
if (a) {
|
||||
if (a != NULL) {
|
||||
EVP_PKEY_free(*a);
|
||||
*a = pktmp;
|
||||
}
|
||||
@@ -230,16 +231,17 @@ RSA *d2i_RSA_PUBKEY(RSA **a, const unsigned char **pp, long length)
|
||||
EVP_PKEY *pkey;
|
||||
RSA *key;
|
||||
const unsigned char *q;
|
||||
|
||||
q = *pp;
|
||||
pkey = d2i_PUBKEY(NULL, &q, length);
|
||||
if (!pkey)
|
||||
if (pkey == NULL)
|
||||
return NULL;
|
||||
key = EVP_PKEY_get1_RSA(pkey);
|
||||
EVP_PKEY_free(pkey);
|
||||
if (!key)
|
||||
if (key == NULL)
|
||||
return NULL;
|
||||
*pp = q;
|
||||
if (a) {
|
||||
if (a != NULL) {
|
||||
RSA_free(*a);
|
||||
*a = key;
|
||||
}
|
||||
@@ -271,16 +273,17 @@ DSA *d2i_DSA_PUBKEY(DSA **a, const unsigned char **pp, long length)
|
||||
EVP_PKEY *pkey;
|
||||
DSA *key;
|
||||
const unsigned char *q;
|
||||
|
||||
q = *pp;
|
||||
pkey = d2i_PUBKEY(NULL, &q, length);
|
||||
if (!pkey)
|
||||
if (pkey == NULL)
|
||||
return NULL;
|
||||
key = EVP_PKEY_get1_DSA(pkey);
|
||||
EVP_PKEY_free(pkey);
|
||||
if (!key)
|
||||
if (key == NULL)
|
||||
return NULL;
|
||||
*pp = q;
|
||||
if (a) {
|
||||
if (a != NULL) {
|
||||
DSA_free(*a);
|
||||
*a = key;
|
||||
}
|
||||
@@ -312,16 +315,17 @@ EC_KEY *d2i_EC_PUBKEY(EC_KEY **a, const unsigned char **pp, long length)
|
||||
EVP_PKEY *pkey;
|
||||
EC_KEY *key;
|
||||
const unsigned char *q;
|
||||
|
||||
q = *pp;
|
||||
pkey = d2i_PUBKEY(NULL, &q, length);
|
||||
if (!pkey)
|
||||
if (pkey == NULL)
|
||||
return NULL;
|
||||
key = EVP_PKEY_get1_EC_KEY(pkey);
|
||||
EVP_PKEY_free(pkey);
|
||||
if (!key)
|
||||
if (key == NULL)
|
||||
return NULL;
|
||||
*pp = q;
|
||||
if (a) {
|
||||
if (a != NULL) {
|
||||
EC_KEY_free(*a);
|
||||
*a = key;
|
||||
}
|
||||
@@ -332,7 +336,8 @@ int i2d_EC_PUBKEY(const EC_KEY *a, unsigned char **pp)
|
||||
{
|
||||
EVP_PKEY *pktmp;
|
||||
int ret;
|
||||
if (!a)
|
||||
|
||||
if (a == NULL)
|
||||
return 0;
|
||||
if ((pktmp = EVP_PKEY_new()) == NULL) {
|
||||
ASN1err(ASN1_F_I2D_EC_PUBKEY, ERR_R_MALLOC_FAILURE);
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@
|
||||
#include "internal/cryptlib.h"
|
||||
#include <openssl/asn1t.h>
|
||||
#include <openssl/x509.h>
|
||||
#include "internal/x509_int.h"
|
||||
#include "crypto/x509.h"
|
||||
|
||||
/*-
|
||||
* X509_REQ_INFO is handled in an unusual way to get round
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include <openssl/asn1t.h>
|
||||
#include <openssl/x509.h>
|
||||
#include <openssl/x509v3.h>
|
||||
#include "internal/x509_int.h"
|
||||
#include "crypto/x509.h"
|
||||
|
||||
ASN1_SEQUENCE_enc(X509_CINF, enc, 0) = {
|
||||
ASN1_EXP_OPT(X509_CINF, version, ASN1_INTEGER, 0),
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/asn1t.h>
|
||||
#include <openssl/x509.h>
|
||||
#include "internal/x509_int.h"
|
||||
#include "crypto/x509.h"
|
||||
|
||||
/*
|
||||
* X509_CERT_AUX routines. These are used to encode additional user
|
||||
|
||||
Reference in New Issue
Block a user