Latest update.
This commit is contained in:
@@ -22,6 +22,8 @@
|
||||
#include "crypto/x509.h"
|
||||
#include "x509_local.h"
|
||||
|
||||
DEFINE_STACK_OF(X509_OBJECT)
|
||||
|
||||
struct lookup_dir_hashes_st {
|
||||
unsigned long hash;
|
||||
int suffix;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -17,6 +17,8 @@
|
||||
#include <openssl/pem.h>
|
||||
#include "x509_local.h"
|
||||
|
||||
DEFINE_STACK_OF(X509_INFO)
|
||||
|
||||
static int by_file_ctrl(X509_LOOKUP *ctx, int cmd, const char *argc,
|
||||
long argl, char **ret);
|
||||
static X509_LOOKUP_METHOD x509_file_lookup = {
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
#include "crypto/x509.h"
|
||||
#include "x509_local.h"
|
||||
|
||||
DEFINE_STACK_OF_STRING()
|
||||
|
||||
/* Generic object loader, given expected type and criterion */
|
||||
static int cache_objects(X509_LOOKUP *lctx, const char *uri,
|
||||
const OSSL_STORE_SEARCH *criterion,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2004-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2004-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -14,6 +14,8 @@
|
||||
|
||||
#include "pcy_local.h"
|
||||
|
||||
DEFINE_STACK_OF(POLICYINFO)
|
||||
|
||||
static int policy_data_cmp(const X509_POLICY_DATA *const *a,
|
||||
const X509_POLICY_DATA *const *b);
|
||||
static int policy_cache_set_int(long *out, ASN1_INTEGER *value);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2004-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2004-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -13,6 +13,9 @@
|
||||
|
||||
#include "pcy_local.h"
|
||||
|
||||
DEFINE_STACK_OF(ASN1_OBJECT)
|
||||
DEFINE_STACK_OF(POLICYQUALINFO)
|
||||
|
||||
/* Policy Node routines */
|
||||
|
||||
void policy_data_free(X509_POLICY_DATA *data)
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
|
||||
#include "pcy_local.h"
|
||||
|
||||
DEFINE_STACK_OF(X509_POLICY_NODE)
|
||||
|
||||
/* accessor functions */
|
||||
|
||||
/* X509_POLICY_TREE stuff */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2004-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2004-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -14,6 +14,9 @@
|
||||
|
||||
#include "pcy_local.h"
|
||||
|
||||
DEFINE_STACK_OF(POLICY_MAPPING)
|
||||
DEFINE_STACK_OF(ASN1_OBJECT)
|
||||
|
||||
/*
|
||||
* Set policy mapping entries in cache. Note: this modifies the passed
|
||||
* POLICY_MAPPINGS structure
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2004-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2004-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -14,6 +14,9 @@
|
||||
|
||||
#include "pcy_local.h"
|
||||
|
||||
DEFINE_STACK_OF(X509_POLICY_NODE)
|
||||
DEFINE_STACK_OF(ASN1_OBJECT)
|
||||
|
||||
static int node_cmp(const X509_POLICY_NODE *const *a,
|
||||
const X509_POLICY_NODE *const *b)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2004-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2004-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -14,6 +14,10 @@
|
||||
|
||||
#include "pcy_local.h"
|
||||
|
||||
DEFINE_STACK_OF(ASN1_OBJECT)
|
||||
DEFINE_STACK_OF(X509)
|
||||
DEFINE_STACK_OF(X509_POLICY_NODE)
|
||||
|
||||
static void expected_print(BIO *channel,
|
||||
X509_POLICY_LEVEL *lev, X509_POLICY_NODE *node,
|
||||
int indent)
|
||||
|
||||
+3
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1999-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1999-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -15,6 +15,8 @@
|
||||
#include <openssl/x509.h>
|
||||
#include <openssl/x509v3.h>
|
||||
|
||||
DEFINE_STACK_OF(X509_REVOKED)
|
||||
|
||||
#ifndef OPENSSL_NO_STDIO
|
||||
int X509_CRL_print_fp(FILE *fp, X509_CRL *x)
|
||||
{
|
||||
|
||||
+3
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -17,6 +17,8 @@
|
||||
#include <openssl/rsa.h>
|
||||
#include <openssl/dsa.h>
|
||||
|
||||
DEFINE_STACK_OF(X509_EXTENSION)
|
||||
|
||||
#ifndef OPENSSL_NO_STDIO
|
||||
int X509_REQ_print_fp(FILE *fp, X509_REQ *x)
|
||||
{
|
||||
|
||||
+42
-10
@@ -17,6 +17,9 @@
|
||||
#include "crypto/asn1.h"
|
||||
#include "crypto/x509.h"
|
||||
|
||||
DEFINE_STACK_OF(X509)
|
||||
DEFINE_STACK_OF(ASN1_OBJECT)
|
||||
|
||||
#ifndef OPENSSL_NO_STDIO
|
||||
int X509_print_fp(FILE *fp, X509 *x)
|
||||
{
|
||||
@@ -449,17 +452,46 @@ int X509_STORE_CTX_print_verify_cb(int ok, X509_STORE_CTX *ctx)
|
||||
{
|
||||
if (ok == 0 && ctx != NULL) {
|
||||
int cert_error = X509_STORE_CTX_get_error(ctx);
|
||||
int depth = X509_STORE_CTX_get_error_depth(ctx);
|
||||
X509 *cert = X509_STORE_CTX_get_current_cert(ctx);
|
||||
BIO *bio = BIO_new(BIO_s_mem()); /* may be NULL */
|
||||
|
||||
BIO_printf(bio, "%s at depth=%d error=%d (%s)\n",
|
||||
BIO_printf(bio, "%s at depth = %d error = %d (%s)\n",
|
||||
X509_STORE_CTX_get0_parent_ctx(ctx) != NULL
|
||||
? "CRL path validation" : "certificate verification",
|
||||
depth, cert_error,
|
||||
X509_verify_cert_error_string(cert_error));
|
||||
BIO_printf(bio, "failure for:\n");
|
||||
x509_print_ex_brief(bio, cert, X509_FLAG_NO_EXTENSIONS);
|
||||
? "CRL path validation"
|
||||
: "Certificate verification",
|
||||
X509_STORE_CTX_get_error_depth(ctx),
|
||||
cert_error, X509_verify_cert_error_string(cert_error));
|
||||
{
|
||||
X509_STORE *ts = X509_STORE_CTX_get0_store(ctx);
|
||||
X509_VERIFY_PARAM *vpm = X509_STORE_get0_param(ts);
|
||||
char *str;
|
||||
int idx = 0;
|
||||
|
||||
switch (cert_error) {
|
||||
case X509_V_ERR_HOSTNAME_MISMATCH:
|
||||
BIO_printf(bio, "Expected hostname(s) = ");
|
||||
while ((str = X509_VERIFY_PARAM_get0_host(vpm, idx++)) != NULL)
|
||||
BIO_printf(bio, "%s%s", idx == 1 ? "" : ", ", str);
|
||||
BIO_printf(bio, "\n");
|
||||
break;
|
||||
case X509_V_ERR_EMAIL_MISMATCH:
|
||||
str = X509_VERIFY_PARAM_get0_email(vpm);
|
||||
if (str != NULL)
|
||||
BIO_printf(bio, "Expected email address = %s\n", str);
|
||||
break;
|
||||
case X509_V_ERR_IP_ADDRESS_MISMATCH:
|
||||
str = X509_VERIFY_PARAM_get1_ip_asc(vpm);
|
||||
if (str != NULL)
|
||||
BIO_printf(bio, "Expected IP address = %s\n", str);
|
||||
OPENSSL_free(str);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
BIO_printf(bio, "Failure for:\n");
|
||||
x509_print_ex_brief(bio, X509_STORE_CTX_get_current_cert(ctx),
|
||||
X509_FLAG_NO_EXTENSIONS);
|
||||
if (cert_error == X509_V_ERR_CERT_UNTRUSTED
|
||||
|| cert_error == X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT
|
||||
|| cert_error == X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN
|
||||
@@ -467,9 +499,9 @@ int X509_STORE_CTX_print_verify_cb(int ok, X509_STORE_CTX *ctx)
|
||||
|| cert_error == X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY
|
||||
|| cert_error == X509_V_ERR_UNABLE_TO_GET_CRL_ISSUER
|
||||
|| cert_error == X509_V_ERR_STORE_LOOKUP) {
|
||||
BIO_printf(bio, "non-trusted certs:\n");
|
||||
BIO_printf(bio, "Non-trusted certs:\n");
|
||||
print_certs(bio, X509_STORE_CTX_get0_untrusted(ctx));
|
||||
BIO_printf(bio, "certs in trust store:\n");
|
||||
BIO_printf(bio, "Certs in trust store:\n");
|
||||
print_store_certs(bio, X509_STORE_CTX_get0_store(ctx));
|
||||
}
|
||||
X509err(0, X509_R_CERTIFICATE_VERIFICATION_FAILED);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2006-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -25,6 +25,11 @@
|
||||
|
||||
#ifndef OPENSSL_NO_RFC3779
|
||||
|
||||
DEFINE_STACK_OF(IPAddressOrRange)
|
||||
DEFINE_STACK_OF(IPAddressFamily)
|
||||
DEFINE_STACK_OF(CONF_VALUE)
|
||||
DEFINE_STACK_OF(X509)
|
||||
|
||||
/*
|
||||
* OpenSSL ASN.1 template translation of RFC 3779 2.2.3.
|
||||
*/
|
||||
@@ -139,6 +144,7 @@ static int i2r_address(BIO *out,
|
||||
return 0;
|
||||
BIO_printf(out, "%d.%d.%d.%d", addr[0], addr[1], addr[2], addr[3]);
|
||||
break;
|
||||
/* TODO possibly combine with ipaddr_to_asc() */
|
||||
case IANA_AFI_IPV6:
|
||||
if (!addr_expand(addr, bs, 16, fill))
|
||||
return 0;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2017-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -20,6 +20,10 @@
|
||||
#include "v3_admis.h"
|
||||
#include "ext_dat.h"
|
||||
|
||||
DEFINE_STACK_OF(ADMISSIONS)
|
||||
DEFINE_STACK_OF(PROFESSION_INFO)
|
||||
DEFINE_STACK_OF(ASN1_STRING)
|
||||
DEFINE_STACK_OF(ASN1_OBJECT)
|
||||
|
||||
ASN1_SEQUENCE(NAMING_AUTHORITY) = {
|
||||
ASN1_OPT(NAMING_AUTHORITY, namingAuthorityId, ASN1_OBJECT),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1999-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1999-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -15,6 +15,9 @@
|
||||
#include <openssl/x509v3.h>
|
||||
#include "ext_dat.h"
|
||||
|
||||
DEFINE_STACK_OF(CONF_VALUE)
|
||||
DEFINE_STACK_OF(GENERAL_NAME)
|
||||
|
||||
static STACK_OF(CONF_VALUE) *i2v_AUTHORITY_KEYID(X509V3_EXT_METHOD *method,
|
||||
AUTHORITY_KEYID *akeyid,
|
||||
STACK_OF(CONF_VALUE)
|
||||
|
||||
+38
-40
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1999-2017 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1999-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -11,8 +11,12 @@
|
||||
#include "internal/cryptlib.h"
|
||||
#include <openssl/conf.h>
|
||||
#include <openssl/x509v3.h>
|
||||
#include <openssl/bio.h>
|
||||
#include "ext_dat.h"
|
||||
|
||||
DEFINE_STACK_OF(CONF_VALUE)
|
||||
DEFINE_STACK_OF(GENERAL_NAME)
|
||||
|
||||
static GENERAL_NAMES *v2i_subject_alt(X509V3_EXT_METHOD *method,
|
||||
X509V3_CTX *ctx,
|
||||
STACK_OF(CONF_VALUE) *nval);
|
||||
@@ -78,9 +82,8 @@ STACK_OF(CONF_VALUE) *i2v_GENERAL_NAME(X509V3_EXT_METHOD *method,
|
||||
GENERAL_NAME *gen,
|
||||
STACK_OF(CONF_VALUE) *ret)
|
||||
{
|
||||
unsigned char *p;
|
||||
char oline[256], htmp[5];
|
||||
int i;
|
||||
char othername[300];
|
||||
char oline[256], *tmp;
|
||||
|
||||
switch (gen->type) {
|
||||
case GEN_OTHERNAME:
|
||||
@@ -121,7 +124,26 @@ STACK_OF(CONF_VALUE) *i2v_GENERAL_NAME(X509V3_EXT_METHOD *method,
|
||||
return NULL;
|
||||
break;
|
||||
default:
|
||||
if (!X509V3_add_value("othername", "<unsupported>", &ret))
|
||||
if (OBJ_obj2txt(oline, sizeof(oline), gen->d.otherName->type_id, 0) > 0)
|
||||
BIO_snprintf(othername, sizeof(othername), "othername: %s:",
|
||||
oline);
|
||||
else
|
||||
strncpy(othername, "othername:", sizeof(othername));
|
||||
|
||||
/* check if the value is something printable */
|
||||
if (gen->d.otherName->value->type == V_ASN1_IA5STRING) {
|
||||
if (X509V3_add_value_uchar(othername,
|
||||
gen->d.otherName->value->value.ia5string->data,
|
||||
&ret))
|
||||
return ret;
|
||||
}
|
||||
if (gen->d.otherName->value->type == V_ASN1_UTF8STRING) {
|
||||
if (X509V3_add_value_uchar(othername,
|
||||
gen->d.otherName->value->value.utf8string->data,
|
||||
&ret))
|
||||
return ret;
|
||||
}
|
||||
if (!X509V3_add_value(othername, "<unsupported>", &ret))
|
||||
return NULL;
|
||||
break;
|
||||
}
|
||||
@@ -159,26 +181,10 @@ STACK_OF(CONF_VALUE) *i2v_GENERAL_NAME(X509V3_EXT_METHOD *method,
|
||||
break;
|
||||
|
||||
case GEN_IPADD:
|
||||
p = gen->d.ip->data;
|
||||
if (gen->d.ip->length == 4)
|
||||
BIO_snprintf(oline, sizeof(oline), "%d.%d.%d.%d",
|
||||
p[0], p[1], p[2], p[3]);
|
||||
else if (gen->d.ip->length == 16) {
|
||||
oline[0] = 0;
|
||||
for (i = 0; i < 8; i++) {
|
||||
BIO_snprintf(htmp, sizeof(htmp), "%X", p[0] << 8 | p[1]);
|
||||
p += 2;
|
||||
strcat(oline, htmp);
|
||||
if (i != 7)
|
||||
strcat(oline, ":");
|
||||
}
|
||||
} else {
|
||||
if (!X509V3_add_value("IP Address", "<invalid>", &ret))
|
||||
return NULL;
|
||||
break;
|
||||
}
|
||||
if (!X509V3_add_value("IP Address", oline, &ret))
|
||||
return NULL;
|
||||
tmp = ipaddr_to_asc(gen->d.ip->data, gen->d.ip->length);
|
||||
if (tmp == NULL || !X509V3_add_value("IP Address", tmp, &ret))
|
||||
ret = NULL;
|
||||
OPENSSL_free(tmp);
|
||||
break;
|
||||
|
||||
case GEN_RID:
|
||||
@@ -192,8 +198,8 @@ STACK_OF(CONF_VALUE) *i2v_GENERAL_NAME(X509V3_EXT_METHOD *method,
|
||||
|
||||
int GENERAL_NAME_print(BIO *out, GENERAL_NAME *gen)
|
||||
{
|
||||
unsigned char *p;
|
||||
int i, nid;
|
||||
char *tmp;
|
||||
int nid;
|
||||
|
||||
switch (gen->type) {
|
||||
case GEN_OTHERNAME:
|
||||
@@ -264,19 +270,11 @@ int GENERAL_NAME_print(BIO *out, GENERAL_NAME *gen)
|
||||
break;
|
||||
|
||||
case GEN_IPADD:
|
||||
p = gen->d.ip->data;
|
||||
if (gen->d.ip->length == 4)
|
||||
BIO_printf(out, "IP Address:%d.%d.%d.%d", p[0], p[1], p[2], p[3]);
|
||||
else if (gen->d.ip->length == 16) {
|
||||
BIO_printf(out, "IP Address");
|
||||
for (i = 0; i < 8; i++) {
|
||||
BIO_printf(out, ":%X", p[0] << 8 | p[1]);
|
||||
p += 2;
|
||||
}
|
||||
} else {
|
||||
BIO_printf(out, "IP Address:<invalid>");
|
||||
break;
|
||||
}
|
||||
tmp = ipaddr_to_asc(gen->d.ip->data, gen->d.ip->length);
|
||||
if (tmp == NULL)
|
||||
return 0;
|
||||
BIO_printf(out, "IP Address:%s", tmp);
|
||||
OPENSSL_free(tmp);
|
||||
break;
|
||||
|
||||
case GEN_RID:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2006-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -55,6 +55,10 @@ IMPLEMENT_ASN1_FUNCTIONS(ASIdOrRange)
|
||||
IMPLEMENT_ASN1_FUNCTIONS(ASIdentifierChoice)
|
||||
IMPLEMENT_ASN1_FUNCTIONS(ASIdentifiers)
|
||||
|
||||
DEFINE_STACK_OF(ASIdOrRange)
|
||||
DEFINE_STACK_OF(CONF_VALUE)
|
||||
DEFINE_STACK_OF(X509)
|
||||
|
||||
/*
|
||||
* i2r method for an ASIdentifierChoice.
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1999-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1999-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -15,6 +15,8 @@
|
||||
#include <openssl/x509v3.h>
|
||||
#include "ext_dat.h"
|
||||
|
||||
DEFINE_STACK_OF(CONF_VALUE)
|
||||
|
||||
static STACK_OF(CONF_VALUE) *i2v_BASIC_CONSTRAINTS(X509V3_EXT_METHOD *method,
|
||||
BASIC_CONSTRAINTS *bcons,
|
||||
STACK_OF(CONF_VALUE)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1999-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1999-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -13,6 +13,8 @@
|
||||
#include <openssl/x509v3.h>
|
||||
#include "ext_dat.h"
|
||||
|
||||
DEFINE_STACK_OF(CONF_VALUE)
|
||||
|
||||
static BIT_STRING_BITNAME ns_cert_type_table[] = {
|
||||
{0, "SSL Client", "client"},
|
||||
{1, "SSL Server", "server"},
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1999-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1999-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -17,6 +17,9 @@
|
||||
#include "crypto/x509.h"
|
||||
#include <openssl/x509v3.h>
|
||||
|
||||
DEFINE_STACK_OF(CONF_VALUE)
|
||||
DEFINE_STACK_OF(X509_EXTENSION)
|
||||
|
||||
static int v3_check_critical(const char **value);
|
||||
static int v3_check_generic(const char **value);
|
||||
static X509_EXTENSION *do_ext_nconf(CONF *conf, X509V3_CTX *ctx, int ext_nid,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1999-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1999-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -17,6 +17,11 @@
|
||||
#include "pcy_local.h"
|
||||
#include "ext_dat.h"
|
||||
|
||||
DEFINE_STACK_OF(CONF_VALUE)
|
||||
DEFINE_STACK_OF(POLICYINFO)
|
||||
DEFINE_STACK_OF(POLICYQUALINFO)
|
||||
DEFINE_STACK_OF(ASN1_INTEGER)
|
||||
|
||||
/* Certificate policies extension support: this one is a bit complex... */
|
||||
|
||||
static int i2r_certpol(X509V3_EXT_METHOD *method, STACK_OF(POLICYINFO) *pol,
|
||||
|
||||
@@ -17,6 +17,11 @@
|
||||
#include "crypto/x509.h"
|
||||
#include "ext_dat.h"
|
||||
|
||||
DEFINE_STACK_OF(CONF_VALUE)
|
||||
DEFINE_STACK_OF(GENERAL_NAME)
|
||||
DEFINE_STACK_OF(DIST_POINT)
|
||||
DEFINE_STACK_OF(X509_NAME_ENTRY)
|
||||
|
||||
static void *v2i_crld(const X509V3_EXT_METHOD *method,
|
||||
X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval);
|
||||
static int i2r_crldp(const X509V3_EXT_METHOD *method, void *pcrldp, BIO *out,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1999-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1999-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -14,6 +14,9 @@
|
||||
#include <openssl/x509v3.h>
|
||||
#include "ext_dat.h"
|
||||
|
||||
DEFINE_STACK_OF(ASN1_OBJECT)
|
||||
DEFINE_STACK_OF(CONF_VALUE)
|
||||
|
||||
static void *v2i_EXTENDED_KEY_USAGE(const X509V3_EXT_METHOD *method,
|
||||
X509V3_CTX *ctx,
|
||||
STACK_OF(CONF_VALUE) *nval);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1999-2017 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1999-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -15,6 +15,9 @@
|
||||
#include <openssl/x509v3.h>
|
||||
#include "ext_dat.h"
|
||||
|
||||
DEFINE_STACK_OF(ACCESS_DESCRIPTION)
|
||||
DEFINE_STACK_OF(CONF_VALUE)
|
||||
|
||||
static STACK_OF(CONF_VALUE) *i2v_AUTHORITY_INFO_ACCESS(X509V3_EXT_METHOD
|
||||
*method, AUTHORITY_INFO_ACCESS
|
||||
*ainfo, STACK_OF(CONF_VALUE)
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
#include <openssl/x509v3.h>
|
||||
#include "ext_dat.h"
|
||||
|
||||
DEFINE_STACK_OF(CONF_VALUE)
|
||||
|
||||
/*
|
||||
* Issuer Sign Tool (1.2.643.100.112) The name of the tool used to signs the subject (ASN1_SEQUENCE)
|
||||
* This extention is required to obtain the status of a qualified certificate at Russian Federation.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1999-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1999-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -16,6 +16,9 @@
|
||||
|
||||
#include "ext_dat.h"
|
||||
|
||||
DEFINE_STACK_OF(X509V3_EXT_METHOD)
|
||||
DEFINE_STACK_OF(X509_EXTENSION)
|
||||
|
||||
static STACK_OF(X509V3_EXT_METHOD) *ext_list = NULL;
|
||||
|
||||
static int ext_cmp(const X509V3_EXT_METHOD *const *a,
|
||||
|
||||
+15
-20
@@ -19,6 +19,10 @@
|
||||
#include "crypto/x509.h"
|
||||
#include "ext_dat.h"
|
||||
|
||||
DEFINE_STACK_OF(CONF_VALUE)
|
||||
DEFINE_STACK_OF(GENERAL_NAME)
|
||||
DEFINE_STACK_OF(GENERAL_SUBTREE)
|
||||
|
||||
static void *v2i_NAME_CONSTRAINTS(const X509V3_EXT_METHOD *method,
|
||||
X509V3_CTX *ctx,
|
||||
STACK_OF(CONF_VALUE) *nval);
|
||||
@@ -188,26 +192,17 @@ static int do_i2r_name_constraints(const X509V3_EXT_METHOD *method,
|
||||
|
||||
static int print_nc_ipadd(BIO *bp, ASN1_OCTET_STRING *ip)
|
||||
{
|
||||
int i, len;
|
||||
unsigned char *p;
|
||||
p = ip->data;
|
||||
len = ip->length;
|
||||
BIO_puts(bp, "IP:");
|
||||
if (len == 8) {
|
||||
BIO_printf(bp, "%d.%d.%d.%d/%d.%d.%d.%d",
|
||||
p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7]);
|
||||
} else if (len == 32) {
|
||||
for (i = 0; i < 16; i++) {
|
||||
BIO_printf(bp, "%X", p[0] << 8 | p[1]);
|
||||
p += 2;
|
||||
if (i == 7)
|
||||
BIO_puts(bp, "/");
|
||||
else if (i != 15)
|
||||
BIO_puts(bp, ":");
|
||||
}
|
||||
} else
|
||||
BIO_printf(bp, "IP Address:<invalid>");
|
||||
return 1;
|
||||
/* ip->length should be 8 or 32 and len1 == len2 == 4 or len1 == len2 == 16 */
|
||||
int len1 = ip->length >= 16 ? 16 : ip->length >= 4 ? 4 : ip->length;
|
||||
int len2 = ip->length - len1;
|
||||
char *ip1 = ipaddr_to_asc(ip->data, len1);
|
||||
char *ip2 = ipaddr_to_asc(ip->data + len1, len2);
|
||||
int ret = ret = ip1 != NULL && ip2 != NULL
|
||||
&& BIO_printf(bp, "IP:%s/%s", ip1, ip2) > 0;
|
||||
|
||||
OPENSSL_free(ip1);
|
||||
OPENSSL_free(ip2);
|
||||
return ret;
|
||||
}
|
||||
|
||||
#define NAME_CHECK_MAX (1 << 20)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2004-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2004-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -49,6 +49,8 @@
|
||||
#include <openssl/x509v3.h>
|
||||
#include "ext_dat.h"
|
||||
|
||||
DEFINE_STACK_OF(CONF_VALUE)
|
||||
|
||||
static int i2r_pci(X509V3_EXT_METHOD *method, PROXY_CERT_INFO_EXTENSION *ext,
|
||||
BIO *out, int indent);
|
||||
static PROXY_CERT_INFO_EXTENSION *r2i_pci(X509V3_EXT_METHOD *method,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2003-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2003-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -15,6 +15,8 @@
|
||||
#include <openssl/x509v3.h>
|
||||
#include "ext_dat.h"
|
||||
|
||||
DEFINE_STACK_OF(CONF_VALUE)
|
||||
|
||||
static STACK_OF(CONF_VALUE) *i2v_POLICY_CONSTRAINTS(const X509V3_EXT_METHOD
|
||||
*method, void *bcons, STACK_OF(CONF_VALUE)
|
||||
*extlist);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2003-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2003-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -14,6 +14,9 @@
|
||||
#include <openssl/x509v3.h>
|
||||
#include "ext_dat.h"
|
||||
|
||||
DEFINE_STACK_OF(POLICY_MAPPING)
|
||||
DEFINE_STACK_OF(CONF_VALUE)
|
||||
|
||||
static void *v2i_POLICY_MAPPINGS(const X509V3_EXT_METHOD *method,
|
||||
X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval);
|
||||
static STACK_OF(CONF_VALUE) *i2v_POLICY_MAPPINGS(const X509V3_EXT_METHOD
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1999-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1999-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -14,6 +14,9 @@
|
||||
#include <openssl/conf.h>
|
||||
#include <openssl/x509v3.h>
|
||||
|
||||
DEFINE_STACK_OF(CONF_VALUE)
|
||||
DEFINE_STACK_OF(X509_EXTENSION)
|
||||
|
||||
/* Extension printing routines */
|
||||
|
||||
static int unknown_ext_print(BIO *out, const unsigned char *ext, int extlen,
|
||||
|
||||
@@ -15,6 +15,11 @@
|
||||
#include "crypto/x509.h"
|
||||
#include "internal/tsan_assist.h"
|
||||
|
||||
DEFINE_STACK_OF(GENERAL_NAME)
|
||||
DEFINE_STACK_OF(DIST_POINT)
|
||||
DEFINE_STACK_OF(X509_PURPOSE)
|
||||
DEFINE_STACK_OF(ASN1_OBJECT)
|
||||
|
||||
static int check_ssl_ca(const X509 *x);
|
||||
static int check_purpose_ssl_client(const X509_PURPOSE *xp, const X509 *x,
|
||||
int ca);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1999-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1999-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -15,6 +15,9 @@
|
||||
#include <openssl/x509v3.h>
|
||||
#include "ext_dat.h"
|
||||
|
||||
DEFINE_STACK_OF(SXNETID)
|
||||
DEFINE_STACK_OF(CONF_VALUE)
|
||||
|
||||
/* Support for Thawte strong extranet extension */
|
||||
|
||||
#define SXNET_TEST
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2015-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -15,6 +15,9 @@
|
||||
#include <openssl/x509v3.h>
|
||||
#include "ext_dat.h"
|
||||
|
||||
DEFINE_STACK_OF(ASN1_INTEGER)
|
||||
DEFINE_STACK_OF(CONF_VALUE)
|
||||
|
||||
static STACK_OF(CONF_VALUE) *i2v_TLS_FEATURE(const X509V3_EXT_METHOD *method,
|
||||
TLS_FEATURE *tls_feature,
|
||||
STACK_OF(CONF_VALUE) *ext_list);
|
||||
@@ -88,7 +91,7 @@ static TLS_FEATURE *v2i_TLS_FEATURE(const X509V3_EXT_METHOD *method,
|
||||
{
|
||||
TLS_FEATURE *tlsf;
|
||||
char *extval, *endptr;
|
||||
ASN1_INTEGER *ai;
|
||||
ASN1_INTEGER *ai = NULL;
|
||||
CONF_VALUE *val;
|
||||
int i;
|
||||
size_t j;
|
||||
@@ -127,10 +130,13 @@ static TLS_FEATURE *v2i_TLS_FEATURE(const X509V3_EXT_METHOD *method,
|
||||
X509V3err(X509V3_F_V2I_TLS_FEATURE, ERR_R_MALLOC_FAILURE);
|
||||
goto err;
|
||||
}
|
||||
/* So it doesn't get purged if an error occurs next time around */
|
||||
ai = NULL;
|
||||
}
|
||||
return tlsf;
|
||||
|
||||
err:
|
||||
sk_ASN1_INTEGER_pop_free(tlsf, ASN1_INTEGER_free);
|
||||
ASN1_INTEGER_free(ai);
|
||||
return NULL;
|
||||
}
|
||||
+64
-17
@@ -20,12 +20,19 @@
|
||||
#include <openssl/bn.h>
|
||||
#include "ext_dat.h"
|
||||
|
||||
DEFINE_STACK_OF(CONF_VALUE)
|
||||
DEFINE_STACK_OF(GENERAL_NAME)
|
||||
DEFINE_STACK_OF(ACCESS_DESCRIPTION)
|
||||
DEFINE_STACK_OF(X509_EXTENSION)
|
||||
DEFINE_STACK_OF_STRING()
|
||||
|
||||
static char *strip_spaces(char *name);
|
||||
static int sk_strcmp(const char *const *a, const char *const *b);
|
||||
static STACK_OF(OPENSSL_STRING) *get_email(const X509_NAME *name,
|
||||
GENERAL_NAMES *gens);
|
||||
static void str_free(OPENSSL_STRING str);
|
||||
static int append_ia5(STACK_OF(OPENSSL_STRING) **sk, const ASN1_IA5STRING *email);
|
||||
static int append_ia5(STACK_OF(OPENSSL_STRING) **sk,
|
||||
const ASN1_IA5STRING *email);
|
||||
|
||||
static int ipv4_from_asc(unsigned char *v4, const char *in);
|
||||
static int ipv6_from_asc(unsigned char *v6, const char *in);
|
||||
@@ -172,6 +179,7 @@ ASN1_INTEGER *s2i_ASN1_INTEGER(X509V3_EXT_METHOD *method, const char *value)
|
||||
ASN1_INTEGER *aint;
|
||||
int isneg, ishex;
|
||||
int ret;
|
||||
|
||||
if (value == NULL) {
|
||||
X509V3err(X509V3_F_S2I_ASN1_INTEGER, X509V3_R_INVALID_NULL_VALUE);
|
||||
return NULL;
|
||||
@@ -184,14 +192,16 @@ ASN1_INTEGER *s2i_ASN1_INTEGER(X509V3_EXT_METHOD *method, const char *value)
|
||||
if (value[0] == '-') {
|
||||
value++;
|
||||
isneg = 1;
|
||||
} else
|
||||
} else {
|
||||
isneg = 0;
|
||||
}
|
||||
|
||||
if (value[0] == '0' && ((value[1] == 'x') || (value[1] == 'X'))) {
|
||||
value += 2;
|
||||
ishex = 1;
|
||||
} else
|
||||
} else {
|
||||
ishex = 0;
|
||||
}
|
||||
|
||||
if (ishex)
|
||||
ret = BN_hex2bn(&bn, value);
|
||||
@@ -291,6 +301,7 @@ STACK_OF(CONF_VALUE) *X509V3_parse_list(const char *line)
|
||||
STACK_OF(CONF_VALUE) *values = NULL;
|
||||
char *linebuf;
|
||||
int state;
|
||||
|
||||
/* We are going to modify the line so copy it first */
|
||||
linebuf = OPENSSL_strdup(line);
|
||||
if (linebuf == NULL) {
|
||||
@@ -376,6 +387,7 @@ STACK_OF(CONF_VALUE) *X509V3_parse_list(const char *line)
|
||||
static char *strip_spaces(char *name)
|
||||
{
|
||||
char *p, *q;
|
||||
|
||||
/* Skip over leading spaces */
|
||||
p = name;
|
||||
while (*p && ossl_isspace(*p))
|
||||
@@ -401,6 +413,7 @@ int v3_name_cmp(const char *name, const char *cmp)
|
||||
{
|
||||
int len, ret;
|
||||
char c;
|
||||
|
||||
len = strlen(cmp);
|
||||
if ((ret = strncmp(name, cmp, len)))
|
||||
return ret;
|
||||
@@ -496,9 +509,11 @@ static void str_free(OPENSSL_STRING str)
|
||||
OPENSSL_free(str);
|
||||
}
|
||||
|
||||
static int append_ia5(STACK_OF(OPENSSL_STRING) **sk, const ASN1_IA5STRING *email)
|
||||
static int append_ia5(STACK_OF(OPENSSL_STRING) **sk,
|
||||
const ASN1_IA5STRING *email)
|
||||
{
|
||||
char *emtmp;
|
||||
|
||||
/* First some sanity checks */
|
||||
if (email->type != V_ASN1_IA5STRING)
|
||||
return 1;
|
||||
@@ -513,7 +528,7 @@ static int append_ia5(STACK_OF(OPENSSL_STRING) **sk, const ASN1_IA5STRING *email
|
||||
return 1;
|
||||
emtmp = OPENSSL_strdup((char *)email->data);
|
||||
if (emtmp == NULL || !sk_OPENSSL_STRING_push(*sk, emtmp)) {
|
||||
OPENSSL_free(emtmp); /* free on push failure */
|
||||
OPENSSL_free(emtmp); /* free on push failure */
|
||||
X509_email_free(*sk);
|
||||
*sk = NULL;
|
||||
return 0;
|
||||
@@ -570,9 +585,10 @@ static int equal_nocase(const unsigned char *pattern, size_t pattern_len,
|
||||
skip_prefix(&pattern, &pattern_len, subject_len, flags);
|
||||
if (pattern_len != subject_len)
|
||||
return 0;
|
||||
while (pattern_len) {
|
||||
while (pattern_len != 0) {
|
||||
unsigned char l = *pattern;
|
||||
unsigned char r = *subject;
|
||||
|
||||
/* The pattern must not contain NUL characters. */
|
||||
if (l == 0)
|
||||
return 0;
|
||||
@@ -611,6 +627,7 @@ static int equal_email(const unsigned char *a, size_t a_len,
|
||||
unsigned int unused_flags)
|
||||
{
|
||||
size_t i = a_len;
|
||||
|
||||
if (a_len != b_len)
|
||||
return 0;
|
||||
/*
|
||||
@@ -698,6 +715,7 @@ static const unsigned char *valid_star(const unsigned char *p, size_t len,
|
||||
size_t i;
|
||||
int state = LABEL_START;
|
||||
int dots = 0;
|
||||
|
||||
for (i = 0; i < len; ++i) {
|
||||
/*
|
||||
* Locate first and only legal wildcard, either at the start
|
||||
@@ -739,8 +757,9 @@ static const unsigned char *valid_star(const unsigned char *p, size_t len,
|
||||
if ((state & LABEL_START) != 0)
|
||||
return NULL;
|
||||
state |= LABEL_HYPHEN;
|
||||
} else
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -856,6 +875,7 @@ static int do_x509_check(X509 *x, const char *chk, size_t chklen,
|
||||
for (i = 0; i < sk_GENERAL_NAME_num(gens); i++) {
|
||||
GENERAL_NAME *gen;
|
||||
ASN1_STRING *cstr;
|
||||
|
||||
gen = sk_GENERAL_NAME_value(gens, i);
|
||||
if (gen->type != check_type)
|
||||
continue;
|
||||
@@ -955,6 +975,29 @@ int X509_check_ip_asc(X509 *x, const char *ipasc, unsigned int flags)
|
||||
return do_x509_check(x, (char *)ipout, iplen, flags, GEN_IPADD, NULL);
|
||||
}
|
||||
|
||||
char *ipaddr_to_asc(unsigned char *p, int len)
|
||||
{
|
||||
char buf[40], *out;
|
||||
|
||||
switch (len) {
|
||||
case 4: /* IPv4 */
|
||||
BIO_snprintf(buf, sizeof(buf), "%d.%d.%d.%d", p[0], p[1], p[2], p[3]);
|
||||
break;
|
||||
/* TODO possibly combine with static i2r_address() in v3_addr.c */
|
||||
case 16: /* IPv6 */
|
||||
for (out = buf; out < buf + 8 * 3; out += 3) {
|
||||
BIO_snprintf(out, 3 + 1, "%X:", p[0] << 8 | p[1]);
|
||||
p += 2;
|
||||
}
|
||||
out[-1] = '\0';
|
||||
break;
|
||||
default:
|
||||
BIO_snprintf(buf, sizeof(buf), "<invalid length=%d>", len);
|
||||
break;
|
||||
}
|
||||
return OPENSSL_strdup(buf);
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert IP addresses both IPv4 and IPv6 into an OCTET STRING compatible
|
||||
* with RFC3280.
|
||||
@@ -1044,6 +1087,7 @@ int a2i_ipadd(unsigned char *ipout, const char *ipasc)
|
||||
static int ipv4_from_asc(unsigned char *v4, const char *in)
|
||||
{
|
||||
int a0, a1, a2, a3;
|
||||
|
||||
if (sscanf(in, "%d.%d.%d.%d", &a0, &a1, &a2, &a3) != 4)
|
||||
return 0;
|
||||
if ((a0 < 0) || (a0 > 255) || (a1 < 0) || (a1 > 255)
|
||||
@@ -1070,6 +1114,7 @@ typedef struct {
|
||||
static int ipv6_from_asc(unsigned char *v6, const char *in)
|
||||
{
|
||||
IPV6_STAT v6stat;
|
||||
|
||||
v6stat.total = 0;
|
||||
v6stat.zero_pos = -1;
|
||||
v6stat.zero_cnt = 0;
|
||||
@@ -1092,21 +1137,19 @@ static int ipv6_from_asc(unsigned char *v6, const char *in)
|
||||
if (v6stat.total == 16)
|
||||
return 0;
|
||||
/* More than three zeroes is an error */
|
||||
if (v6stat.zero_cnt > 3)
|
||||
if (v6stat.zero_cnt > 3) {
|
||||
return 0;
|
||||
/* Can only have three zeroes if nothing else present */
|
||||
else if (v6stat.zero_cnt == 3) {
|
||||
} else if (v6stat.zero_cnt == 3) {
|
||||
if (v6stat.total > 0)
|
||||
return 0;
|
||||
}
|
||||
/* Can only have two zeroes if at start or end */
|
||||
else if (v6stat.zero_cnt == 2) {
|
||||
} else if (v6stat.zero_cnt == 2) {
|
||||
/* Can only have two zeroes if at start or end */
|
||||
if ((v6stat.zero_pos != 0)
|
||||
&& (v6stat.zero_pos != v6stat.total))
|
||||
return 0;
|
||||
} else
|
||||
} else {
|
||||
/* Can only have one zero if *not* start or end */
|
||||
{
|
||||
if ((v6stat.zero_pos == 0)
|
||||
|| (v6stat.zero_pos == v6stat.total))
|
||||
return 0;
|
||||
@@ -1125,8 +1168,9 @@ static int ipv6_from_asc(unsigned char *v6, const char *in)
|
||||
memcpy(v6 + v6stat.zero_pos + 16 - v6stat.total,
|
||||
v6stat.tmp + v6stat.zero_pos,
|
||||
v6stat.total - v6stat.zero_pos);
|
||||
} else
|
||||
} else {
|
||||
memcpy(v6, v6stat.tmp, 16);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -1134,6 +1178,7 @@ static int ipv6_from_asc(unsigned char *v6, const char *in)
|
||||
static int ipv6_cb(const char *elem, int len, void *usr)
|
||||
{
|
||||
IPV6_STAT *s = usr;
|
||||
|
||||
/* Error if 16 bytes written */
|
||||
if (s->total == 16)
|
||||
return 0;
|
||||
@@ -1197,6 +1242,7 @@ int X509V3_NAME_from_section(X509_NAME *nm, STACK_OF(CONF_VALUE) *dn_sk,
|
||||
CONF_VALUE *v;
|
||||
int i, mval, spec_char, plus_char;
|
||||
char *p, *type;
|
||||
|
||||
if (!nm)
|
||||
return 0;
|
||||
|
||||
@@ -1211,7 +1257,7 @@ int X509V3_NAME_from_section(X509_NAME *nm, STACK_OF(CONF_VALUE) *dn_sk,
|
||||
spec_char = ((*p == ':') || (*p == ',') || (*p == '.'));
|
||||
#else
|
||||
spec_char = ((*p == os_toascii[':']) || (*p == os_toascii[','])
|
||||
|| (*p == os_toascii['.']));
|
||||
|| (*p == os_toascii['.']));
|
||||
#endif
|
||||
if (spec_char) {
|
||||
p++;
|
||||
@@ -1228,8 +1274,9 @@ int X509V3_NAME_from_section(X509_NAME *nm, STACK_OF(CONF_VALUE) *dn_sk,
|
||||
if (plus_char) {
|
||||
mval = -1;
|
||||
type++;
|
||||
} else
|
||||
} else {
|
||||
mval = 0;
|
||||
}
|
||||
if (!X509_NAME_add_entry_by_txt(nm, type, chtype,
|
||||
(unsigned char *)v->value, -1, -1,
|
||||
mval))
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -17,6 +17,9 @@
|
||||
#include <openssl/x509v3.h>
|
||||
#include "x509_local.h"
|
||||
|
||||
DEFINE_STACK_OF(X509_ATTRIBUTE)
|
||||
DEFINE_STACK_OF(ASN1_TYPE)
|
||||
|
||||
int X509at_get_attr_count(const STACK_OF(X509_ATTRIBUTE) *x)
|
||||
{
|
||||
return sk_X509_ATTRIBUTE_num(x);
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
#include <openssl/core_names.h>
|
||||
#include "crypto/x509.h"
|
||||
|
||||
DEFINE_STACK_OF(X509)
|
||||
|
||||
int X509_issuer_and_serial_cmp(const X509 *a, const X509 *b)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -15,6 +15,11 @@
|
||||
#include <openssl/x509v3.h>
|
||||
#include "x509_local.h"
|
||||
|
||||
DEFINE_STACK_OF(X509_LOOKUP)
|
||||
DEFINE_STACK_OF(X509_OBJECT)
|
||||
DEFINE_STACK_OF(X509_CRL)
|
||||
DEFINE_STACK_OF(X509)
|
||||
|
||||
X509_LOOKUP *X509_LOOKUP_new(X509_LOOKUP_METHOD *method)
|
||||
{
|
||||
X509_LOOKUP *ret = OPENSSL_zalloc(sizeof(*ret));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -14,6 +14,8 @@
|
||||
#include <openssl/buffer.h>
|
||||
#include "crypto/x509.h"
|
||||
|
||||
DEFINE_STACK_OF(X509_NAME_ENTRY)
|
||||
|
||||
/*
|
||||
* Limit to ensure we don't overflow: much greater than
|
||||
* anything encountered in practice.
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
#include <openssl/objects.h>
|
||||
#include <openssl/buffer.h>
|
||||
|
||||
DEFINE_STACK_OF(X509_ATTRIBUTE)
|
||||
|
||||
X509 *X509_REQ_to_X509(X509_REQ *r, int days, EVP_PKEY *pkey)
|
||||
{
|
||||
X509 *ret = NULL;
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
#include <openssl/x509v3.h>
|
||||
#include "crypto/x509.h"
|
||||
|
||||
DEFINE_STACK_OF(X509_TRUST)
|
||||
DEFINE_STACK_OF(ASN1_OBJECT)
|
||||
|
||||
static int tr_cmp(const X509_TRUST *const *a, const X509_TRUST *const *b);
|
||||
static void trtable_free(X509_TRUST *p);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -17,6 +17,8 @@
|
||||
#include <openssl/x509v3.h>
|
||||
#include "x509_local.h"
|
||||
|
||||
DEFINE_STACK_OF(X509_EXTENSION)
|
||||
|
||||
int X509v3_get_ext_count(const STACK_OF(X509_EXTENSION) *x)
|
||||
{
|
||||
if (x == NULL)
|
||||
|
||||
@@ -25,6 +25,13 @@
|
||||
#include "crypto/x509.h"
|
||||
#include "x509_local.h"
|
||||
|
||||
DEFINE_STACK_OF(X509)
|
||||
DEFINE_STACK_OF(X509_REVOKED)
|
||||
DEFINE_STACK_OF(GENERAL_NAME)
|
||||
DEFINE_STACK_OF(X509_CRL)
|
||||
DEFINE_STACK_OF(DIST_POINT)
|
||||
DEFINE_STACK_OF_STRING()
|
||||
|
||||
/* CRL score values */
|
||||
|
||||
/* No unhandled critical extensions */
|
||||
@@ -3251,6 +3258,7 @@ static int build_chain(X509_STORE_CTX *ctx)
|
||||
if (ss < 0) {
|
||||
X509err(X509_F_BUILD_CHAIN, ERR_R_INTERNAL_ERROR);
|
||||
ctx->error = X509_V_ERR_UNSPECIFIED;
|
||||
sk_X509_free(sktmp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
+40
-6
@@ -18,6 +18,10 @@
|
||||
|
||||
#include "x509_local.h"
|
||||
|
||||
DEFINE_STACK_OF(ASN1_OBJECT)
|
||||
DEFINE_STACK_OF(X509_VERIFY_PARAM)
|
||||
DEFINE_STACK_OF_STRING()
|
||||
|
||||
/* X509_VERIFY_PARAM functions */
|
||||
|
||||
#define SET_HOST 0
|
||||
@@ -142,14 +146,14 @@ void X509_VERIFY_PARAM_free(X509_VERIFY_PARAM *param)
|
||||
/* Macro to test if a field should be copied from src to dest */
|
||||
|
||||
#define test_x509_verify_param_copy(field, def) \
|
||||
(to_overwrite || \
|
||||
((src->field != def) && (to_default || (dest->field == def))))
|
||||
(to_overwrite \
|
||||
|| ((src->field != def) && (to_default || (dest->field == def))))
|
||||
|
||||
/* Macro to test and copy a field if necessary */
|
||||
|
||||
#define x509_verify_param_copy(field, def) \
|
||||
if (test_x509_verify_param_copy(field, def)) \
|
||||
dest->field = src->field
|
||||
if (test_x509_verify_param_copy(field, def)) \
|
||||
dest->field = src->field;
|
||||
|
||||
int X509_VERIFY_PARAM_inherit(X509_VERIFY_PARAM *dest,
|
||||
const X509_VERIFY_PARAM *src)
|
||||
@@ -239,14 +243,16 @@ int X509_VERIFY_PARAM_set1(X509_VERIFY_PARAM *to,
|
||||
static int int_x509_param_set1(char **pdest, size_t *pdestlen,
|
||||
const char *src, size_t srclen)
|
||||
{
|
||||
void *tmp;
|
||||
char *tmp;
|
||||
if (src) {
|
||||
if (srclen == 0)
|
||||
srclen = strlen(src);
|
||||
|
||||
tmp = OPENSSL_memdup(src, srclen);
|
||||
tmp = OPENSSL_malloc(srclen + 1);
|
||||
if (tmp == NULL)
|
||||
return 0;
|
||||
memcpy(tmp, src, srclen);
|
||||
tmp[srclen] = '\0'; /* enforce NUL termination */
|
||||
} else {
|
||||
tmp = NULL;
|
||||
srclen = 0;
|
||||
@@ -375,6 +381,11 @@ int X509_VERIFY_PARAM_set1_policies(X509_VERIFY_PARAM *param,
|
||||
return 1;
|
||||
}
|
||||
|
||||
char *X509_VERIFY_PARAM_get0_host(X509_VERIFY_PARAM *param, int idx)
|
||||
{
|
||||
return sk_OPENSSL_STRING_value(param->hosts, idx);
|
||||
}
|
||||
|
||||
int X509_VERIFY_PARAM_set1_host(X509_VERIFY_PARAM *param,
|
||||
const char *name, size_t namelen)
|
||||
{
|
||||
@@ -421,6 +432,11 @@ void X509_VERIFY_PARAM_move_peername(X509_VERIFY_PARAM *to,
|
||||
from->peername = NULL;
|
||||
}
|
||||
|
||||
char *X509_VERIFY_PARAM_get0_email(X509_VERIFY_PARAM *param)
|
||||
{
|
||||
return param->email;
|
||||
}
|
||||
|
||||
int X509_VERIFY_PARAM_set1_email(X509_VERIFY_PARAM *param,
|
||||
const char *email, size_t emaillen)
|
||||
{
|
||||
@@ -428,6 +444,24 @@ int X509_VERIFY_PARAM_set1_email(X509_VERIFY_PARAM *param,
|
||||
email, emaillen);
|
||||
}
|
||||
|
||||
static unsigned char
|
||||
*int_X509_VERIFY_PARAM_get0_ip(X509_VERIFY_PARAM *param, size_t *plen)
|
||||
{
|
||||
if (param == NULL || param->ip == NULL)
|
||||
return NULL;
|
||||
if (plen != NULL)
|
||||
*plen = param->iplen;
|
||||
return param->ip;
|
||||
}
|
||||
|
||||
char *X509_VERIFY_PARAM_get1_ip_asc(X509_VERIFY_PARAM *param)
|
||||
{
|
||||
size_t iplen;
|
||||
unsigned char *ip = int_X509_VERIFY_PARAM_get0_ip(param, &iplen);
|
||||
|
||||
return ip == NULL ? NULL : ipaddr_to_asc(ip, iplen);
|
||||
}
|
||||
|
||||
int X509_VERIFY_PARAM_set1_ip(X509_VERIFY_PARAM *param,
|
||||
const unsigned char *ip, size_t iplen)
|
||||
{
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
#include <openssl/x509.h>
|
||||
#include "crypto/x509.h"
|
||||
|
||||
DEFINE_STACK_OF(X509_REVOKED)
|
||||
|
||||
int X509_CRL_set_version(X509_CRL *x, long version)
|
||||
{
|
||||
if (x == NULL)
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
#include <openssl/x509.h>
|
||||
#include "crypto/x509.h"
|
||||
|
||||
DEFINE_STACK_OF(X509_NAME_ENTRY)
|
||||
|
||||
int X509_NAME_get_text_by_NID(const X509_NAME *name, int nid,
|
||||
char *buf, int len)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -14,6 +14,8 @@
|
||||
#include <openssl/x509.h>
|
||||
#include "x509_local.h"
|
||||
|
||||
DEFINE_STACK_OF(ASN1_TYPE)
|
||||
|
||||
/*-
|
||||
* X509_ATTRIBUTE: this has the following form:
|
||||
*
|
||||
|
||||
@@ -15,6 +15,11 @@
|
||||
#include <openssl/x509v3.h>
|
||||
#include "x509_local.h"
|
||||
|
||||
DEFINE_STACK_OF(GENERAL_NAME)
|
||||
DEFINE_STACK_OF(GENERAL_NAMES)
|
||||
DEFINE_STACK_OF(X509_REVOKED)
|
||||
DEFINE_STACK_OF(X509_EXTENSION)
|
||||
|
||||
static int X509_REVOKED_cmp(const X509_REVOKED *const *a,
|
||||
const X509_REVOKED *const *b);
|
||||
static int setup_idp(X509_CRL *crl, ISSUING_DIST_POINT *idp);
|
||||
|
||||
@@ -16,6 +16,9 @@
|
||||
#include "crypto/asn1.h"
|
||||
#include "x509_local.h"
|
||||
|
||||
DEFINE_STACK_OF(X509_NAME_ENTRY)
|
||||
DEFINE_STACK_OF(ASN1_VALUE)
|
||||
|
||||
/*
|
||||
* Maximum length of X509_NAME: much larger than anything we should
|
||||
* ever see in practice.
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
#include <openssl/x509.h>
|
||||
#include "crypto/x509.h"
|
||||
|
||||
DEFINE_STACK_OF(X509_ATTRIBUTE)
|
||||
|
||||
/*-
|
||||
* X509_REQ_INFO is handled in an unusual way to get round
|
||||
* invalid encodings. Some broken certificate requests don't
|
||||
|
||||
@@ -15,6 +15,10 @@
|
||||
#include <openssl/x509v3.h>
|
||||
#include "crypto/x509.h"
|
||||
|
||||
#ifndef OPENSSL_NO_RFC3779
|
||||
DEFINE_STACK_OF(IPAddressFamily)
|
||||
#endif
|
||||
|
||||
ASN1_SEQUENCE_enc(X509_CINF, enc, 0) = {
|
||||
ASN1_EXP_OPT(X509_CINF, version, ASN1_INTEGER, 0),
|
||||
ASN1_EMBED(X509_CINF, serialNumber, ASN1_INTEGER),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1999-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1999-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -14,6 +14,8 @@
|
||||
#include <openssl/x509.h>
|
||||
#include "crypto/x509.h"
|
||||
|
||||
DEFINE_STACK_OF(ASN1_OBJECT)
|
||||
|
||||
/*
|
||||
* X509_CERT_AUX routines. These are used to encode additional user
|
||||
* modifiable data about a certificate. This data is appended to the X509
|
||||
|
||||
Reference in New Issue
Block a user