OpenSSL 1.1.1-pre2

This commit is contained in:
Hakase
2018-04-07 17:29:40 +09:00
parent 82a44d2483
commit bbac8ca55d
17755 changed files with 221242 additions and 98415 deletions
+15 -14
View File
@@ -9,11 +9,11 @@
/* Part of the code in here was originally in conf.c, which is now removed */
#include "e_os.h"
#include <stdlib.h>
#include <string.h>
#include <openssl/conf.h>
#include <openssl/conf_api.h>
#include "e_os.h"
static void value_free_hash(const CONF_VALUE *a, LHASH_OF(CONF_VALUE) *conf);
static void value_free_stack_doall(CONF_VALUE *a);
@@ -24,11 +24,11 @@ CONF_VALUE *_CONF_get_section(const CONF *conf, const char *section)
CONF_VALUE *v, vv;
if ((conf == NULL) || (section == NULL))
return (NULL);
return NULL;
vv.name = NULL;
vv.section = (char *)section;
v = lh_CONF_VALUE_retrieve(conf->data, &vv);
return (v);
return v;
}
/* Up until OpenSSL 0.9.5a, this was CONF_get_section */
@@ -41,7 +41,7 @@ STACK_OF(CONF_VALUE) *_CONF_get_section_values(const CONF *conf,
if (v != NULL)
return ((STACK_OF(CONF_VALUE) *)v->value);
else
return (NULL);
return NULL;
}
int _CONF_add_string(CONF *conf, CONF_VALUE *section, CONF_VALUE *value)
@@ -73,29 +73,29 @@ char *_CONF_get_string(const CONF *conf, const char *section,
char *p;
if (name == NULL)
return (NULL);
return NULL;
if (conf != NULL) {
if (section != NULL) {
vv.name = (char *)name;
vv.section = (char *)section;
v = lh_CONF_VALUE_retrieve(conf->data, &vv);
if (v != NULL)
return (v->value);
return v->value;
if (strcmp(section, "ENV") == 0) {
p = getenv(name);
if (p != NULL)
return (p);
return p;
}
}
vv.section = "default";
vv.name = (char *)name;
v = lh_CONF_VALUE_retrieve(conf->data, &vv);
if (v != NULL)
return (v->value);
return v->value;
else
return (NULL);
return NULL;
} else
return (getenv(name));
return getenv(name);
}
static unsigned long conf_value_hash(const CONF_VALUE *v)
@@ -110,14 +110,14 @@ static int conf_value_cmp(const CONF_VALUE *a, const CONF_VALUE *b)
if (a->section != b->section) {
i = strcmp(a->section, b->section);
if (i)
return (i);
return i;
}
if ((a->name != NULL) && (b->name != NULL)) {
i = strcmp(a->name, b->name);
return (i);
return i;
} else if (a->name == b->name)
return (0);
return 0;
else
return ((a->name == NULL) ? -1 : 1);
}
@@ -204,7 +204,8 @@ CONF_VALUE *_CONF_new_section(CONF *conf, const char *section)
v->value = (char *)sk;
vv = lh_CONF_VALUE_insert(conf->data, v);
OPENSSL_assert(vv == NULL);
if (vv != NULL)
goto err;
return v;
err:
+12 -14
View File
@@ -1,5 +1,5 @@
/*
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
* Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the OpenSSL license (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -12,7 +12,6 @@
#include <stdio.h>
#include <string.h>
#include "internal/cryptlib.h"
#include <openssl/stack.h>
#include <openssl/lhash.h>
#include <openssl/conf.h>
#include <openssl/conf_api.h>
@@ -317,13 +316,12 @@ static int def_load_bio(CONF *conf, BIO *in, long *line)
}
if (psection == NULL)
psection = section;
v->name = OPENSSL_malloc(strlen(pname) + 1);
v->name = OPENSSL_strdup(pname);
v->value = NULL;
if (v->name == NULL) {
CONFerr(CONF_F_DEF_LOAD_BIO, ERR_R_MALLOC_FAILURE);
goto err;
}
OPENSSL_strlcpy(v->name, pname, strlen(pname) + 1);
if (!str_copy(conf, psection, &(v->value), start))
goto err;
@@ -347,7 +345,7 @@ static int def_load_bio(CONF *conf, BIO *in, long *line)
}
BUF_MEM_free(buff);
OPENSSL_free(section);
return (1);
return 1;
err:
BUF_MEM_free(buff);
OPENSSL_free(section);
@@ -364,7 +362,7 @@ static int def_load_bio(CONF *conf, BIO *in, long *line)
OPENSSL_free(v->value);
OPENSSL_free(v);
}
return (0);
return 0;
}
static void clear_comments(CONF *conf, char *p)
@@ -411,7 +409,7 @@ static int str_copy(CONF *conf, char *section, char **pto, char *from)
BUF_MEM *buf;
if ((buf = BUF_MEM_new()) == NULL)
return (0);
return 0;
len = strlen(from) + 1;
if (!BUF_MEM_grow(buf, len))
@@ -551,17 +549,17 @@ static int str_copy(CONF *conf, char *section, char **pto, char *from)
OPENSSL_free(*pto);
*pto = buf->data;
OPENSSL_free(buf);
return (1);
return 1;
err:
BUF_MEM_free(buf);
return (0);
return 0;
}
static char *eat_ws(CONF *conf, char *p)
{
while (IS_WS(conf, *p) && (!IS_EOF(conf, *p)))
p++;
return (p);
return p;
}
static char *eat_alpha_numeric(CONF *conf, char *p)
@@ -572,7 +570,7 @@ static char *eat_alpha_numeric(CONF *conf, char *p)
continue;
}
if (!IS_ALPHA_NUMERIC_PUNCT(conf, *p))
return (p);
return p;
p++;
}
}
@@ -586,13 +584,13 @@ static char *scan_quote(CONF *conf, char *p)
if (IS_ESC(conf, *p)) {
p++;
if (IS_EOF(conf, *p))
return (p);
return p;
}
p++;
}
if (*p == q)
p++;
return (p);
return p;
}
static char *scan_dquote(CONF *conf, char *p)
@@ -612,7 +610,7 @@ static char *scan_dquote(CONF *conf, char *p)
}
if (*p == q)
p++;
return (p);
return p;
}
static void dump_value_doall_arg(const CONF_VALUE *a, BIO *out)
+1 -1
View File
@@ -2,7 +2,7 @@
* WARNING: do not edit!
* Generated by crypto/conf/keysets.pl
*
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
* Licensed under the OpenSSL license (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
* in the file LICENSE in the source distribution or at
+51 -51
View File
@@ -8,61 +8,62 @@
* https://www.openssl.org/source/license.html
*/
#include <stdio.h>
#include <openssl/err.h>
#include <openssl/conf.h>
#include <openssl/conferr.h>
/* BEGIN ERROR CODES */
#ifndef OPENSSL_NO_ERR
# define ERR_FUNC(func) ERR_PACK(ERR_LIB_CONF,func,0)
# define ERR_REASON(reason) ERR_PACK(ERR_LIB_CONF,0,reason)
static ERR_STRING_DATA CONF_str_functs[] = {
{ERR_FUNC(CONF_F_CONF_DUMP_FP), "CONF_dump_fp"},
{ERR_FUNC(CONF_F_CONF_LOAD), "CONF_load"},
{ERR_FUNC(CONF_F_CONF_LOAD_FP), "CONF_load_fp"},
{ERR_FUNC(CONF_F_CONF_PARSE_LIST), "CONF_parse_list"},
{ERR_FUNC(CONF_F_DEF_LOAD), "def_load"},
{ERR_FUNC(CONF_F_DEF_LOAD_BIO), "def_load_bio"},
{ERR_FUNC(CONF_F_MODULE_INIT), "module_init"},
{ERR_FUNC(CONF_F_MODULE_LOAD_DSO), "module_load_dso"},
{ERR_FUNC(CONF_F_MODULE_RUN), "module_run"},
{ERR_FUNC(CONF_F_NCONF_DUMP_BIO), "NCONF_dump_bio"},
{ERR_FUNC(CONF_F_NCONF_DUMP_FP), "NCONF_dump_fp"},
{ERR_FUNC(CONF_F_NCONF_GET_NUMBER_E), "NCONF_get_number_e"},
{ERR_FUNC(CONF_F_NCONF_GET_SECTION), "NCONF_get_section"},
{ERR_FUNC(CONF_F_NCONF_GET_STRING), "NCONF_get_string"},
{ERR_FUNC(CONF_F_NCONF_LOAD), "NCONF_load"},
{ERR_FUNC(CONF_F_NCONF_LOAD_BIO), "NCONF_load_bio"},
{ERR_FUNC(CONF_F_NCONF_LOAD_FP), "NCONF_load_fp"},
{ERR_FUNC(CONF_F_NCONF_NEW), "NCONF_new"},
{ERR_FUNC(CONF_F_STR_COPY), "str_copy"},
static const ERR_STRING_DATA CONF_str_functs[] = {
{ERR_PACK(ERR_LIB_CONF, CONF_F_CONF_DUMP_FP, 0), "CONF_dump_fp"},
{ERR_PACK(ERR_LIB_CONF, CONF_F_CONF_LOAD, 0), "CONF_load"},
{ERR_PACK(ERR_LIB_CONF, CONF_F_CONF_LOAD_FP, 0), "CONF_load_fp"},
{ERR_PACK(ERR_LIB_CONF, CONF_F_CONF_PARSE_LIST, 0), "CONF_parse_list"},
{ERR_PACK(ERR_LIB_CONF, CONF_F_DEF_LOAD, 0), "def_load"},
{ERR_PACK(ERR_LIB_CONF, CONF_F_DEF_LOAD_BIO, 0), "def_load_bio"},
{ERR_PACK(ERR_LIB_CONF, CONF_F_MODULE_INIT, 0), "module_init"},
{ERR_PACK(ERR_LIB_CONF, CONF_F_MODULE_LOAD_DSO, 0), "module_load_dso"},
{ERR_PACK(ERR_LIB_CONF, CONF_F_MODULE_RUN, 0), "module_run"},
{ERR_PACK(ERR_LIB_CONF, CONF_F_NCONF_DUMP_BIO, 0), "NCONF_dump_bio"},
{ERR_PACK(ERR_LIB_CONF, CONF_F_NCONF_DUMP_FP, 0), "NCONF_dump_fp"},
{ERR_PACK(ERR_LIB_CONF, CONF_F_NCONF_GET_NUMBER_E, 0),
"NCONF_get_number_e"},
{ERR_PACK(ERR_LIB_CONF, CONF_F_NCONF_GET_SECTION, 0), "NCONF_get_section"},
{ERR_PACK(ERR_LIB_CONF, CONF_F_NCONF_GET_STRING, 0), "NCONF_get_string"},
{ERR_PACK(ERR_LIB_CONF, CONF_F_NCONF_LOAD, 0), "NCONF_load"},
{ERR_PACK(ERR_LIB_CONF, CONF_F_NCONF_LOAD_BIO, 0), "NCONF_load_bio"},
{ERR_PACK(ERR_LIB_CONF, CONF_F_NCONF_LOAD_FP, 0), "NCONF_load_fp"},
{ERR_PACK(ERR_LIB_CONF, CONF_F_NCONF_NEW, 0), "NCONF_new"},
{ERR_PACK(ERR_LIB_CONF, CONF_F_STR_COPY, 0), "str_copy"},
{0, NULL}
};
static ERR_STRING_DATA CONF_str_reasons[] = {
{ERR_REASON(CONF_R_ERROR_LOADING_DSO), "error loading dso"},
{ERR_REASON(CONF_R_LIST_CANNOT_BE_NULL), "list cannot be null"},
{ERR_REASON(CONF_R_MISSING_CLOSE_SQUARE_BRACKET),
"missing close square bracket"},
{ERR_REASON(CONF_R_MISSING_EQUAL_SIGN), "missing equal sign"},
{ERR_REASON(CONF_R_MISSING_INIT_FUNCTION), "missing init function"},
{ERR_REASON(CONF_R_MODULE_INITIALIZATION_ERROR),
"module initialization error"},
{ERR_REASON(CONF_R_NO_CLOSE_BRACE), "no close brace"},
{ERR_REASON(CONF_R_NO_CONF), "no conf"},
{ERR_REASON(CONF_R_NO_CONF_OR_ENVIRONMENT_VARIABLE),
"no conf or environment variable"},
{ERR_REASON(CONF_R_NO_SECTION), "no section"},
{ERR_REASON(CONF_R_NO_SUCH_FILE), "no such file"},
{ERR_REASON(CONF_R_NO_VALUE), "no value"},
{ERR_REASON(CONF_R_UNABLE_TO_CREATE_NEW_SECTION),
"unable to create new section"},
{ERR_REASON(CONF_R_UNKNOWN_MODULE_NAME), "unknown module name"},
{ERR_REASON(CONF_R_VARIABLE_EXPANSION_TOO_LONG),
"variable expansion too long"},
{ERR_REASON(CONF_R_VARIABLE_HAS_NO_VALUE), "variable has no value"},
static const ERR_STRING_DATA CONF_str_reasons[] = {
{ERR_PACK(ERR_LIB_CONF, 0, CONF_R_ERROR_LOADING_DSO), "error loading dso"},
{ERR_PACK(ERR_LIB_CONF, 0, CONF_R_LIST_CANNOT_BE_NULL),
"list cannot be null"},
{ERR_PACK(ERR_LIB_CONF, 0, CONF_R_MISSING_CLOSE_SQUARE_BRACKET),
"missing close square bracket"},
{ERR_PACK(ERR_LIB_CONF, 0, CONF_R_MISSING_EQUAL_SIGN),
"missing equal sign"},
{ERR_PACK(ERR_LIB_CONF, 0, CONF_R_MISSING_INIT_FUNCTION),
"missing init function"},
{ERR_PACK(ERR_LIB_CONF, 0, CONF_R_MODULE_INITIALIZATION_ERROR),
"module initialization error"},
{ERR_PACK(ERR_LIB_CONF, 0, CONF_R_NO_CLOSE_BRACE), "no close brace"},
{ERR_PACK(ERR_LIB_CONF, 0, CONF_R_NO_CONF), "no conf"},
{ERR_PACK(ERR_LIB_CONF, 0, CONF_R_NO_CONF_OR_ENVIRONMENT_VARIABLE),
"no conf or environment variable"},
{ERR_PACK(ERR_LIB_CONF, 0, CONF_R_NO_SECTION), "no section"},
{ERR_PACK(ERR_LIB_CONF, 0, CONF_R_NO_SUCH_FILE), "no such file"},
{ERR_PACK(ERR_LIB_CONF, 0, CONF_R_NO_VALUE), "no value"},
{ERR_PACK(ERR_LIB_CONF, 0, CONF_R_UNABLE_TO_CREATE_NEW_SECTION),
"unable to create new section"},
{ERR_PACK(ERR_LIB_CONF, 0, CONF_R_UNKNOWN_MODULE_NAME),
"unknown module name"},
{ERR_PACK(ERR_LIB_CONF, 0, CONF_R_VARIABLE_EXPANSION_TOO_LONG),
"variable expansion too long"},
{ERR_PACK(ERR_LIB_CONF, 0, CONF_R_VARIABLE_HAS_NO_VALUE),
"variable has no value"},
{0, NULL}
};
@@ -71,10 +72,9 @@ static ERR_STRING_DATA CONF_str_reasons[] = {
int ERR_load_CONF_strings(void)
{
#ifndef OPENSSL_NO_ERR
if (ERR_func_error_string(CONF_str_functs[0].error) == NULL) {
ERR_load_strings(0, CONF_str_functs);
ERR_load_strings(0, CONF_str_reasons);
ERR_load_strings_const(CONF_str_functs);
ERR_load_strings_const(CONF_str_reasons);
}
#endif
return 1;
+3 -3
View File
@@ -7,15 +7,15 @@
* https://www.openssl.org/source/license.html
*/
#include "e_os.h"
#include <stdio.h>
#include <string.h>
#include <internal/conf.h>
#include "internal/conf.h"
#include <openssl/crypto.h>
#include <openssl/err.h>
#include <openssl/conf.h>
#include <openssl/conf_api.h>
#include <openssl/lhash.h>
#include "e_os.h"
static CONF_METHOD *default_CONF_method = NULL;
@@ -186,7 +186,7 @@ CONF *NCONF_new(CONF_METHOD *meth)
ret = meth->create(meth);
if (ret == NULL) {
CONFerr(CONF_F_NCONF_NEW, ERR_R_MALLOC_FAILURE);
return (NULL);
return NULL;
}
return ret;
+7 -8
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved.
* Copyright 2002-2017 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the OpenSSL license (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -7,10 +7,10 @@
* https://www.openssl.org/source/license.html
*/
#include "internal/cryptlib.h"
#include <stdio.h>
#include <ctype.h>
#include <openssl/crypto.h>
#include "internal/cryptlib.h"
#include "internal/conf.h"
#include "internal/dso.h"
#include <openssl/x509.h>
@@ -170,6 +170,7 @@ static int module_run(const CONF *cnf, const char *name, const char *value,
if (ret <= 0) {
if (!(flags & CONF_MFLAGS_SILENT)) {
char rcode[DECIMAL_SIZE(ret) + 1];
CONFerr(CONF_F_MODULE_RUN, CONF_R_MODULE_INITIALIZATION_ERROR);
BIO_snprintf(rcode, sizeof(rcode), "%-8d", ret);
ERR_add_error_data(6, "module=", name, ", value=", value,
@@ -475,7 +476,7 @@ void CONF_module_set_usr_data(CONF_MODULE *pmod, void *usr_data)
char *CONF_get1_default_config_file(void)
{
char *file;
char *file, *sep = "";
int len;
file = getenv("OPENSSL_CONF");
@@ -485,6 +486,7 @@ char *CONF_get1_default_config_file(void)
len = strlen(X509_get_default_cert_area());
#ifndef OPENSSL_SYS_VMS
len++;
sep = "/";
#endif
len += strlen(OPENSSL_CONF);
@@ -492,11 +494,8 @@ char *CONF_get1_default_config_file(void)
if (file == NULL)
return NULL;
OPENSSL_strlcpy(file, X509_get_default_cert_area(), len + 1);
#ifndef OPENSSL_SYS_VMS
OPENSSL_strlcat(file, "/", len + 1);
#endif
OPENSSL_strlcat(file, OPENSSL_CONF, len + 1);
BIO_snprintf(file, len + 1, "%s%s%s", X509_get_default_cert_area(),
sep, OPENSSL_CONF);
return file;
}
+5 -1
View File
@@ -10,11 +10,15 @@
#include <stdio.h>
#include <openssl/crypto.h>
#include "internal/cryptlib.h"
#include <internal/conf.h>
#include "internal/conf.h"
#include <openssl/x509.h>
#include <openssl/asn1.h>
#include <openssl/engine.h>
#ifdef _WIN32
# define strdup _strdup
#endif
/*
* This is the automatic configuration loader: it is called automatically by
* OpenSSL when any of a number of standard initialisation functions are
+4 -2
View File
@@ -1,5 +1,5 @@
#! /usr/bin/env perl
# Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
# Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
#
# Licensed under the OpenSSL license (the "License"). You may not use
# this file except in compliance with the License. You can obtain a copy
@@ -57,12 +57,14 @@ foreach (0 .. 255)
push(@V_w32,$v);
}
# Output year depends on the year of the script.
my $YEAR = [localtime([stat($0)]->[9])]->[5] + 1900;
print <<"EOF";
/*
* WARNING: do not edit!
* Generated by crypto/conf/keysets.pl
*
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
* Copyright 1995-$YEAR The OpenSSL Project Authors. All Rights Reserved.
* Licensed under the OpenSSL license (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
* in the file LICENSE in the source distribution or at