summaryrefslogtreecommitdiff
path: root/deps/openssl/openssl/crypto/conf
diff options
context:
space:
mode:
Diffstat (limited to 'deps/openssl/openssl/crypto/conf')
-rw-r--r--deps/openssl/openssl/crypto/conf/conf_api.c25
-rw-r--r--deps/openssl/openssl/crypto/conf/conf_def.c295
-rw-r--r--deps/openssl/openssl/crypto/conf/conf_def.h109
-rw-r--r--deps/openssl/openssl/crypto/conf/conf_err.c123
-rw-r--r--deps/openssl/openssl/crypto/conf/conf_lib.c49
-rw-r--r--deps/openssl/openssl/crypto/conf/conf_mod.c18
-rw-r--r--deps/openssl/openssl/crypto/conf/conf_sap.c6
-rw-r--r--deps/openssl/openssl/crypto/conf/conf_ssl.c1
-rw-r--r--deps/openssl/openssl/crypto/conf/keysets.pl205
9 files changed, 509 insertions, 322 deletions
diff --git a/deps/openssl/openssl/crypto/conf/conf_api.c b/deps/openssl/openssl/crypto/conf/conf_api.c
index 36c91b1663..5e57d749ce 100644
--- a/deps/openssl/openssl/crypto/conf/conf_api.c
+++ b/deps/openssl/openssl/crypto/conf/conf_api.c
@@ -25,11 +25,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 */
@@ -42,7 +42,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)
@@ -74,27 +74,27 @@ 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 = ossl_safe_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 ossl_safe_getenv(name);
}
@@ -111,14 +111,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);
}
@@ -205,8 +205,7 @@ 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 (lh_CONF_VALUE_error(conf->data) > 0)
+ if (vv != NULL || lh_CONF_VALUE_error(conf->data) > 0)
goto err;
return v;
diff --git a/deps/openssl/openssl/crypto/conf/conf_def.c b/deps/openssl/openssl/crypto/conf/conf_def.c
index b443903f46..7f0d70ea69 100644
--- a/deps/openssl/openssl/crypto/conf/conf_def.c
+++ b/deps/openssl/openssl/crypto/conf/conf_def.c
@@ -1,5 +1,5 @@
/*
- * 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
@@ -12,13 +12,24 @@
#include <stdio.h>
#include <string.h>
#include "internal/cryptlib.h"
-#include <openssl/stack.h>
+#include "internal/o_dir.h"
#include <openssl/lhash.h>
#include <openssl/conf.h>
#include <openssl/conf_api.h>
#include "conf_def.h"
#include <openssl/buffer.h>
#include <openssl/err.h>
+#ifndef OPENSSL_NO_POSIX_IO
+# include <sys/stat.h>
+# ifdef _WIN32
+# define stat _stat
+# define strcasecmp _stricmp
+# endif
+#endif
+
+#ifndef S_ISDIR
+# define S_ISDIR(a) (((a) & S_IFMT) == S_IFDIR)
+#endif
/*
* The maximum length we can grow a value to after variable expansion. 64k
@@ -26,13 +37,20 @@
*/
#define MAX_CONF_VALUE_LENGTH 65536
+static int is_keytype(const CONF *conf, char c, unsigned short type);
static char *eat_ws(CONF *conf, char *p);
+static void trim_ws(CONF *conf, char *start);
static char *eat_alpha_numeric(CONF *conf, char *p);
static void clear_comments(CONF *conf, char *p);
static int str_copy(CONF *conf, char *section, char **to, char *from);
static char *scan_quote(CONF *conf, char *p);
static char *scan_dquote(CONF *conf, char *p);
#define scan_esc(conf,p) (((IS_EOF((conf),(p)[1]))?((p)+1):((p)+2)))
+#ifndef OPENSSL_NO_POSIX_IO
+static BIO *process_include(char *include, OPENSSL_DIR_CTX **dirctx,
+ char **dirpath);
+static BIO *get_next_file(const char *path, OPENSSL_DIR_CTX **dirctx);
+#endif
static CONF *def_create(CONF_METHOD *meth);
static int def_init_default(CONF *conf);
@@ -71,12 +89,12 @@ static CONF_METHOD WIN32_method = {
def_load
};
-CONF_METHOD *NCONF_default()
+CONF_METHOD *NCONF_default(void)
{
return &default_method;
}
-CONF_METHOD *NCONF_WIN32()
+CONF_METHOD *NCONF_WIN32(void)
{
return &WIN32_method;
}
@@ -174,6 +192,11 @@ static int def_load_bio(CONF *conf, BIO *in, long *line)
char *section = NULL, *buf;
char *start, *psection, *pname;
void *h = (void *)(conf->data);
+ STACK_OF(BIO) *biosk = NULL;
+#ifndef OPENSSL_NO_POSIX_IO
+ char *dirpath = NULL;
+ OPENSSL_DIR_CTX *dirctx = NULL;
+#endif
if ((buff = BUF_MEM_new()) == NULL) {
CONFerr(CONF_F_DEF_LOAD_BIO, ERR_R_BUF_LIB);
@@ -206,11 +229,39 @@ static int def_load_bio(CONF *conf, BIO *in, long *line)
}
p = &(buff->data[bufnum]);
*p = '\0';
+ read_retry:
BIO_gets(in, p, CONFBUFSIZE - 1);
p[CONFBUFSIZE - 1] = '\0';
ii = i = strlen(p);
- if (i == 0 && !again)
- break;
+ if (i == 0 && !again) {
+ /* the currently processed BIO is at EOF */
+ BIO *parent;
+
+#ifndef OPENSSL_NO_POSIX_IO
+ /* continue processing with the next file from directory */
+ if (dirctx != NULL) {
+ BIO *next;
+
+ if ((next = get_next_file(dirpath, &dirctx)) != NULL) {
+ BIO_vfree(in);
+ in = next;
+ goto read_retry;
+ } else {
+ OPENSSL_free(dirpath);
+ dirpath = NULL;
+ }
+ }
+#endif
+ /* no more files in directory, continue with processing parent */
+ if ((parent = sk_BIO_pop(biosk)) == NULL) {
+ /* everything processed get out of the loop */
+ break;
+ } else {
+ BIO_vfree(in);
+ in = parent;
+ goto read_retry;
+ }
+ }
again = 0;
while (i > 0) {
if ((p[i - 1] != '\r') && (p[i - 1] != '\n'))
@@ -286,7 +337,6 @@ static int def_load_bio(CONF *conf, BIO *in, long *line)
continue;
} else {
pname = s;
- psection = NULL;
end = eat_alpha_numeric(conf, s);
if ((end[0] == ':') && (end[1] == ':')) {
*end = '\0';
@@ -294,36 +344,63 @@ static int def_load_bio(CONF *conf, BIO *in, long *line)
psection = pname;
pname = end;
end = eat_alpha_numeric(conf, end);
+ } else {
+ psection = section;
}
p = eat_ws(conf, end);
- if (*p != '=') {
+ if (strncmp(pname, ".include", 8) == 0 && p != pname + 8) {
+ char *include = NULL;
+ BIO *next;
+
+ trim_ws(conf, p);
+ if (!str_copy(conf, psection, &include, p))
+ goto err;
+ /* get the BIO of the included file */
+#ifndef OPENSSL_NO_POSIX_IO
+ next = process_include(include, &dirctx, &dirpath);
+ if (include != dirpath) {
+ /* dirpath will contain include in case of a directory */
+ OPENSSL_free(include);
+ }
+#else
+ next = BIO_new_file(include, "r");
+ OPENSSL_free(include);
+#endif
+ if (next != NULL) {
+ /* push the currently processing BIO onto stack */
+ if (biosk == NULL) {
+ if ((biosk = sk_BIO_new_null()) == NULL) {
+ CONFerr(CONF_F_DEF_LOAD_BIO, ERR_R_MALLOC_FAILURE);
+ goto err;
+ }
+ }
+ if (!sk_BIO_push(biosk, in)) {
+ CONFerr(CONF_F_DEF_LOAD_BIO, ERR_R_MALLOC_FAILURE);
+ goto err;
+ }
+ /* continue with reading from the included BIO */
+ in = next;
+ }
+ continue;
+ } else if (*p != '=') {
CONFerr(CONF_F_DEF_LOAD_BIO, CONF_R_MISSING_EQUAL_SIGN);
goto err;
}
*end = '\0';
p++;
start = eat_ws(conf, p);
- while (!IS_EOF(conf, *p))
- p++;
- p--;
- while ((p != start) && (IS_WS(conf, *p)))
- p--;
- p++;
- *p = '\0';
+ trim_ws(conf, start);
if ((v = OPENSSL_malloc(sizeof(*v))) == NULL) {
CONFerr(CONF_F_DEF_LOAD_BIO, ERR_R_MALLOC_FAILURE);
goto err;
}
- 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,10 +424,31 @@ static int def_load_bio(CONF *conf, BIO *in, long *line)
}
BUF_MEM_free(buff);
OPENSSL_free(section);
- return (1);
+ /*
+ * No need to pop, since we only get here if the stack is empty.
+ * If this causes a BIO leak, THE ISSUE IS SOMEWHERE ELSE!
+ */
+ sk_BIO_free(biosk);
+ return 1;
err:
BUF_MEM_free(buff);
OPENSSL_free(section);
+ /*
+ * Since |in| is the first element of the stack and should NOT be freed
+ * here, we cannot use sk_BIO_pop_free(). Instead, we pop and free one
+ * BIO at a time, making sure that the last one popped isn't.
+ */
+ while (sk_BIO_num(biosk) > 0) {
+ BIO *popped = sk_BIO_pop(biosk);
+ BIO_vfree(in);
+ in = popped;
+ }
+ sk_BIO_free(biosk);
+#ifndef OPENSSL_NO_POSIX_IO
+ OPENSSL_free(dirpath);
+ if (dirctx != NULL)
+ OPENSSL_DIR_end(&dirctx);
+#endif
if (line != NULL)
*line = eline;
BIO_snprintf(btmp, sizeof(btmp), "%ld", eline);
@@ -364,7 +462,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 +509,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))
@@ -479,7 +577,7 @@ static int str_copy(CONF *conf, char *section, char **pto, char *from)
s++;
cp = section;
e = np = s;
- while (IS_ALPHA_NUMERIC(conf, *e))
+ while (IS_ALNUM(conf, *e))
e++;
if ((e[0] == ':') && (e[1] == ':')) {
cp = np;
@@ -488,7 +586,7 @@ static int str_copy(CONF *conf, char *section, char **pto, char *from)
*rrp = '\0';
e += 2;
np = e;
- while (IS_ALPHA_NUMERIC(conf, *e))
+ while (IS_ALNUM(conf, *e))
e++;
}
r = *e;
@@ -551,17 +649,150 @@ 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;
+}
+
+#ifndef OPENSSL_NO_POSIX_IO
+/*
+ * Check whether included path is a directory.
+ * Returns next BIO to process and in case of a directory
+ * also an opened directory context and the include path.
+ */
+static BIO *process_include(char *include, OPENSSL_DIR_CTX **dirctx,
+ char **dirpath)
+{
+ struct stat st = { 0 };
+ BIO *next;
+
+ if (stat(include, &st) < 0) {
+ SYSerr(SYS_F_STAT, errno);
+ ERR_add_error_data(1, include);
+ /* missing include file is not fatal error */
+ return NULL;
+ }
+
+ if (S_ISDIR(st.st_mode)) {
+ if (*dirctx != NULL) {
+ CONFerr(CONF_F_PROCESS_INCLUDE,
+ CONF_R_RECURSIVE_DIRECTORY_INCLUDE);
+ ERR_add_error_data(1, include);
+ return NULL;
+ }
+ /* a directory, load its contents */
+ if ((next = get_next_file(include, dirctx)) != NULL)
+ *dirpath = include;
+ return next;
+ }
+
+ next = BIO_new_file(include, "r");
+ return next;
+}
+
+/*
+ * Get next file from the directory path.
+ * Returns BIO of the next file to read and updates dirctx.
+ */
+static BIO *get_next_file(const char *path, OPENSSL_DIR_CTX **dirctx)
+{
+ const char *filename;
+
+ while ((filename = OPENSSL_DIR_read(dirctx, path)) != NULL) {
+ size_t namelen;
+
+ namelen = strlen(filename);
+
+
+ if ((namelen > 5 && strcasecmp(filename + namelen - 5, ".conf") == 0)
+ || (namelen > 4 && strcasecmp(filename + namelen - 4, ".cnf") == 0)) {
+ size_t newlen;
+ char *newpath;
+ BIO *bio;
+
+ newlen = strlen(path) + namelen + 2;
+ newpath = OPENSSL_zalloc(newlen);
+ if (newpath == NULL) {
+ CONFerr(CONF_F_GET_NEXT_FILE, ERR_R_MALLOC_FAILURE);
+ break;
+ }
+#ifdef OPENSSL_SYS_VMS
+ /*
+ * If the given path isn't clear VMS syntax,
+ * we treat it as on Unix.
+ */
+ {
+ size_t pathlen = strlen(path);
+
+ if (path[pathlen - 1] == ']' || path[pathlen - 1] == '>'
+ || path[pathlen - 1] == ':') {
+ /* Clear VMS directory syntax, just copy as is */
+ OPENSSL_strlcpy(newpath, path, newlen);
+ }
+ }
+#endif
+ if (newpath[0] == '\0') {
+ OPENSSL_strlcpy(newpath, path, newlen);
+ OPENSSL_strlcat(newpath, "/", newlen);
+ }
+ OPENSSL_strlcat(newpath, filename, newlen);
+
+ bio = BIO_new_file(newpath, "r");
+ OPENSSL_free(newpath);
+ /* Errors when opening files are non-fatal. */
+ if (bio != NULL)
+ return bio;
+ }
+ }
+ OPENSSL_DIR_end(dirctx);
+ *dirctx = NULL;
+ return NULL;
+}
+#endif
+
+static int is_keytype(const CONF *conf, char c, unsigned short type)
+{
+ const unsigned short * keytypes = (const unsigned short *) conf->meth_data;
+ unsigned char key = (unsigned char)c;
+
+#ifdef CHARSET_EBCDIC
+# if CHAR_BIT > 8
+ if (key > 255) {
+ /* key is out of range for os_toascii table */
+ return 0;
+ }
+# endif
+ /* convert key from ebcdic to ascii */
+ key = os_toascii[key];
+#endif
+
+ if (key > 127) {
+ /* key is not a seven bit ascii character */
+ return 0;
+ }
+
+ return (keytypes[key] & type) ? 1 : 0;
}
static char *eat_ws(CONF *conf, char *p)
{
while (IS_WS(conf, *p) && (!IS_EOF(conf, *p)))
p++;
- return (p);
+ return p;
+}
+
+static void trim_ws(CONF *conf, char *start)
+{
+ char *p = start;
+
+ while (!IS_EOF(conf, *p))
+ p++;
+ p--;
+ while ((p >= start) && IS_WS(conf, *p))
+ p--;
+ p++;
+ *p = '\0';
}
static char *eat_alpha_numeric(CONF *conf, char *p)
@@ -571,8 +802,8 @@ static char *eat_alpha_numeric(CONF *conf, char *p)
p = scan_esc(conf, p);
continue;
}
- if (!IS_ALPHA_NUMERIC_PUNCT(conf, *p))
- return (p);
+ if (!IS_ALNUM_PUNCT(conf, *p))
+ return p;
p++;
}
}
@@ -586,13 +817,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 +843,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)
diff --git a/deps/openssl/openssl/crypto/conf/conf_def.h b/deps/openssl/openssl/crypto/conf/conf_def.h
index da4767e196..73e88baa8b 100644
--- a/deps/openssl/openssl/crypto/conf/conf_def.h
+++ b/deps/openssl/openssl/crypto/conf/conf_def.h
@@ -2,63 +2,42 @@
* 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
* https://www.openssl.org/source/license.html
*/
-#define CONF_NUMBER 1
-#define CONF_UPPER 2
-#define CONF_LOWER 4
-#define CONF_UNDER 256
-#define CONF_PUNCTUATION 512
-#define CONF_WS 16
-#define CONF_ESC 32
-#define CONF_QUOTE 64
-#define CONF_DQUOTE 1024
-#define CONF_COMMENT 128
-#define CONF_FCOMMENT 2048
-#define CONF_EOF 8
-#define CONF_HIGHBIT 4096
-#define CONF_ALPHA (CONF_UPPER|CONF_LOWER)
-#define CONF_ALPHA_NUMERIC (CONF_ALPHA|CONF_NUMBER|CONF_UNDER)
-#define CONF_ALPHA_NUMERIC_PUNCT (CONF_ALPHA|CONF_NUMBER|CONF_UNDER| \
- CONF_PUNCTUATION)
+#define CONF_NUMBER 1
+#define CONF_UPPER 2
+#define CONF_LOWER 4
+#define CONF_UNDER 256
+#define CONF_PUNCT 512
+#define CONF_WS 16
+#define CONF_ESC 32
+#define CONF_QUOTE 64
+#define CONF_DQUOTE 1024
+#define CONF_COMMENT 128
+#define CONF_FCOMMENT 2048
+#define CONF_EOF 8
+#define CONF_ALPHA (CONF_UPPER|CONF_LOWER)
+#define CONF_ALNUM (CONF_ALPHA|CONF_NUMBER|CONF_UNDER)
+#define CONF_ALNUM_PUNCT (CONF_ALPHA|CONF_NUMBER|CONF_UNDER|CONF_PUNCT)
-#define KEYTYPES(c) ((const unsigned short *)((c)->meth_data))
-#ifndef CHARSET_EBCDIC
-# define IS_COMMENT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_COMMENT)
-# define IS_FCOMMENT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_FCOMMENT)
-# define IS_EOF(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_EOF)
-# define IS_ESC(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_ESC)
-# define IS_NUMBER(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_NUMBER)
-# define IS_WS(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_WS)
-# define IS_ALPHA_NUMERIC(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_ALPHA_NUMERIC)
-# define IS_ALPHA_NUMERIC_PUNCT(c,a) \
- (KEYTYPES(c)[(a)&0xff]&CONF_ALPHA_NUMERIC_PUNCT)
-# define IS_QUOTE(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_QUOTE)
-# define IS_DQUOTE(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_DQUOTE)
-# define IS_HIGHBIT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_HIGHBIT)
-#else /* CHARSET_EBCDIC */
+#define IS_COMMENT(conf,c) is_keytype(conf, c, CONF_COMMENT)
+#define IS_FCOMMENT(conf,c) is_keytype(conf, c, CONF_FCOMMENT)
+#define IS_EOF(conf,c) is_keytype(conf, c, CONF_EOF)
+#define IS_ESC(conf,c) is_keytype(conf, c, CONF_ESC)
+#define IS_NUMBER(conf,c) is_keytype(conf, c, CONF_NUMBER)
+#define IS_WS(conf,c) is_keytype(conf, c, CONF_WS)
+#define IS_ALNUM(conf,c) is_keytype(conf, c, CONF_ALNUM)
+#define IS_ALNUM_PUNCT(conf,c) is_keytype(conf, c, CONF_ALNUM_PUNCT)
+#define IS_QUOTE(conf,c) is_keytype(conf, c, CONF_QUOTE)
+#define IS_DQUOTE(conf,c) is_keytype(conf, c, CONF_DQUOTE)
-# define IS_COMMENT(c,a) (KEYTYPES(c)[os_toascii[a & 0xff]]&CONF_COMMENT)
-# define IS_FCOMMENT(c,a) (KEYTYPES(c)[os_toascii[a & 0xff]]&CONF_FCOMMENT)
-# define IS_EOF(c,a) (KEYTYPES(c)[os_toascii[a & 0xff]]&CONF_EOF)
-# define IS_ESC(c,a) (KEYTYPES(c)[os_toascii[a & 0xff]]&CONF_ESC)
-# define IS_NUMBER(c,a) (KEYTYPES(c)[os_toascii[a & 0xff]]&CONF_NUMBER)
-# define IS_WS(c,a) (KEYTYPES(c)[os_toascii[a & 0xff]]&CONF_WS)
-# define IS_ALPHA_NUMERIC(c,a) (KEYTYPES(c)[os_toascii[a & 0xff]]&CONF_ALPHA_NUMERIC)
-# define IS_ALPHA_NUMERIC_PUNCT(c,a) \
- (KEYTYPES(c)[os_toascii[a & 0xff]]&CONF_ALPHA_NUMERIC_PUNCT)
-# define IS_QUOTE(c,a) (KEYTYPES(c)[os_toascii[a & 0xff]]&CONF_QUOTE)
-# define IS_DQUOTE(c,a) (KEYTYPES(c)[os_toascii[a & 0xff]]&CONF_DQUOTE)
-# define IS_HIGHBIT(c,a) (KEYTYPES(c)[os_toascii[a & 0xff]]&CONF_HIGHBIT)
-#endif /* CHARSET_EBCDIC */
-
-static const unsigned short CONF_type_default[256] = {
+static const unsigned short CONF_type_default[128] = {
0x0008, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0010, 0x0010, 0x0000, 0x0000, 0x0010, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
@@ -75,25 +54,9 @@ static const unsigned short CONF_type_default[256] = {
0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
0x0004, 0x0004, 0x0004, 0x0000, 0x0200, 0x0000, 0x0200, 0x0000,
- 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
- 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
- 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
- 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
- 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
- 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
- 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
- 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
- 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
- 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
- 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
- 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
- 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
- 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
- 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
- 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
};
-static const unsigned short CONF_type_win32[256] = {
+static const unsigned short CONF_type_win32[128] = {
0x0008, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0010, 0x0010, 0x0000, 0x0000, 0x0010, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
@@ -110,20 +73,4 @@ static const unsigned short CONF_type_win32[256] = {
0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
0x0004, 0x0004, 0x0004, 0x0000, 0x0200, 0x0000, 0x0200, 0x0000,
- 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
- 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
- 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
- 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
- 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
- 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
- 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
- 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
- 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
- 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
- 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
- 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
- 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
- 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
- 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
- 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
};
diff --git a/deps/openssl/openssl/crypto/conf/conf_err.c b/deps/openssl/openssl/crypto/conf/conf_err.c
index 19f480d5b3..f7613584ec 100644
--- a/deps/openssl/openssl/crypto/conf/conf_err.c
+++ b/deps/openssl/openssl/crypto/conf/conf_err.c
@@ -8,68 +8,76 @@
* 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_SSL_MODULE_INIT), "ssl_module_init"},
- {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_GET_NEXT_FILE, 0), "get_next_file"},
+ {ERR_PACK(ERR_LIB_CONF, CONF_F_MODULE_ADD, 0), "module_add"},
+ {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_PROCESS_INCLUDE, 0), "process_include"},
+ {ERR_PACK(ERR_LIB_CONF, CONF_F_SSL_MODULE_INIT, 0), "ssl_module_init"},
+ {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_SSL_COMMAND_SECTION_EMPTY),
- "ssl command section empty"},
- {ERR_REASON(CONF_R_SSL_COMMAND_SECTION_NOT_FOUND),
- "ssl command section not found"},
- {ERR_REASON(CONF_R_SSL_SECTION_EMPTY), "ssl section empty"},
- {ERR_REASON(CONF_R_SSL_SECTION_NOT_FOUND), "ssl section not found"},
- {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_NUMBER_TOO_LARGE), "number too large"},
+ {ERR_PACK(ERR_LIB_CONF, 0, CONF_R_RECURSIVE_DIRECTORY_INCLUDE),
+ "recursive directory include"},
+ {ERR_PACK(ERR_LIB_CONF, 0, CONF_R_SSL_COMMAND_SECTION_EMPTY),
+ "ssl command section empty"},
+ {ERR_PACK(ERR_LIB_CONF, 0, CONF_R_SSL_COMMAND_SECTION_NOT_FOUND),
+ "ssl command section not found"},
+ {ERR_PACK(ERR_LIB_CONF, 0, CONF_R_SSL_SECTION_EMPTY), "ssl section empty"},
+ {ERR_PACK(ERR_LIB_CONF, 0, CONF_R_SSL_SECTION_NOT_FOUND),
+ "ssl section not found"},
+ {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}
};
@@ -78,10 +86,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;
diff --git a/deps/openssl/openssl/crypto/conf/conf_lib.c b/deps/openssl/openssl/crypto/conf/conf_lib.c
index 3532114917..07110d8502 100644
--- a/deps/openssl/openssl/crypto/conf/conf_lib.c
+++ b/deps/openssl/openssl/crypto/conf/conf_lib.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2000-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
@@ -7,15 +7,16 @@
* 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 "internal/ctype.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;
@@ -123,6 +124,7 @@ long CONF_get_number(LHASH_OF(CONF_VALUE) *conf, const char *group,
int status;
long result = 0;
+ ERR_set_mark();
if (conf == NULL) {
status = NCONF_get_number_e(NULL, group, name, &result);
} else {
@@ -130,12 +132,8 @@ long CONF_get_number(LHASH_OF(CONF_VALUE) *conf, const char *group,
CONF_set_nconf(&ctmp, conf);
status = NCONF_get_number_e(&ctmp, group, name, &result);
}
-
- if (status == 0) {
- /* This function does not believe in errors... */
- ERR_clear_error();
- }
- return result;
+ ERR_pop_to_mark();
+ return status == 0 ? 0L : result;
}
void CONF_free(LHASH_OF(CONF_VALUE) *conf)
@@ -186,7 +184,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;
@@ -277,10 +275,23 @@ char *NCONF_get_string(const CONF *conf, const char *group, const char *name)
return NULL;
}
+static int default_is_number(const CONF *conf, char c)
+{
+ return ossl_isdigit(c);
+}
+
+static int default_to_int(const CONF *conf, char c)
+{
+ return (int)(c - '0');
+}
+
int NCONF_get_number_e(const CONF *conf, const char *group, const char *name,
long *result)
{
char *str;
+ long res;
+ int (*is_number)(const CONF *, char) = &default_is_number;
+ int (*to_int)(const CONF *, char) = &default_to_int;
if (result == NULL) {
CONFerr(CONF_F_NCONF_GET_NUMBER_E, ERR_R_PASSED_NULL_PARAMETER);
@@ -292,11 +303,23 @@ int NCONF_get_number_e(const CONF *conf, const char *group, const char *name,
if (str == NULL)
return 0;
- for (*result = 0; conf->meth->is_number(conf, *str);) {
- *result = (*result) * 10 + conf->meth->to_int(conf, *str);
- str++;
+ if (conf != NULL) {
+ if (conf->meth->is_number != NULL)
+ is_number = conf->meth->is_number;
+ if (conf->meth->to_int != NULL)
+ to_int = conf->meth->to_int;
+ }
+ for (res = 0; is_number(conf, *str); str++) {
+ const int d = to_int(conf, *str);
+
+ if (res > (LONG_MAX - d) / 10L) {
+ CONFerr(CONF_F_NCONF_GET_NUMBER_E, CONF_R_NUMBER_TOO_LARGE);
+ return 0;
+ }
+ res = res * 10 + d;
}
+ *result = res;
return 1;
}
diff --git a/deps/openssl/openssl/crypto/conf/conf_mod.c b/deps/openssl/openssl/crypto/conf/conf_mod.c
index 722fe46061..51f262e774 100644
--- a/deps/openssl/openssl/crypto/conf/conf_mod.c
+++ b/deps/openssl/openssl/crypto/conf/conf_mod.c
@@ -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,
@@ -231,9 +232,10 @@ static CONF_MODULE *module_add(DSO *dso, const char *name,
supported_modules = sk_CONF_MODULE_new_null();
if (supported_modules == NULL)
return NULL;
- tmod = OPENSSL_zalloc(sizeof(*tmod));
- if (tmod == NULL)
+ if ((tmod = OPENSSL_zalloc(sizeof(*tmod))) == NULL) {
+ CONFerr(CONF_F_MODULE_ADD, ERR_R_MALLOC_FAILURE);
return NULL;
+ }
tmod->dso = dso;
tmod->name = OPENSSL_strdup(name);
@@ -475,7 +477,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;
if ((file = ossl_safe_getenv("OPENSSL_CONF")) != NULL)
@@ -484,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);
@@ -491,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;
}
diff --git a/deps/openssl/openssl/crypto/conf/conf_sap.c b/deps/openssl/openssl/crypto/conf/conf_sap.c
index bed95abea4..3d2e065e5b 100644
--- a/deps/openssl/openssl/crypto/conf/conf_sap.c
+++ b/deps/openssl/openssl/crypto/conf/conf_sap.c
@@ -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
diff --git a/deps/openssl/openssl/crypto/conf/conf_ssl.c b/deps/openssl/openssl/crypto/conf/conf_ssl.c
index 015c46c6da..024bdb4808 100644
--- a/deps/openssl/openssl/crypto/conf/conf_ssl.c
+++ b/deps/openssl/openssl/crypto/conf/conf_ssl.c
@@ -76,6 +76,7 @@ static int ssl_module_init(CONF_IMODULE *md, const CONF *cnf)
goto err;
}
cnt = sk_CONF_VALUE_num(cmd_lists);
+ ssl_module_free(md);
ssl_names = OPENSSL_zalloc(sizeof(*ssl_names) * cnt);
ssl_names_count = cnt;
for (i = 0; i < ssl_names_count; i++) {
diff --git a/deps/openssl/openssl/crypto/conf/keysets.pl b/deps/openssl/openssl/crypto/conf/keysets.pl
index 5af08ae20a..cfa230ec3a 100644
--- a/deps/openssl/openssl/crypto/conf/keysets.pl
+++ b/deps/openssl/openssl/crypto/conf/keysets.pl
@@ -1,141 +1,116 @@
#! /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
# in the file LICENSE in the source distribution or at
# https://www.openssl.org/source/license.html
-$NUMBER=0x01;
-$UPPER=0x02;
-$LOWER=0x04;
-$UNDER=0x100;
-$PUNCTUATION=0x200;
-$WS=0x10;
-$ESC=0x20;
-$QUOTE=0x40;
-$DQUOTE=0x400;
-$COMMENT=0x80;
-$FCOMMENT=0x800;
-$EOF=0x08;
-$HIGHBIT=0x1000;
-
-foreach (0 .. 255)
- {
- $v=0;
- $c=sprintf("%c",$_);
- $v|=$NUMBER if ($c =~ /[0-9]/);
- $v|=$UPPER if ($c =~ /[A-Z]/);
- $v|=$LOWER if ($c =~ /[a-z]/);
- $v|=$UNDER if ($c =~ /_/);
- $v|=$PUNCTUATION if ($c =~ /[!\.%&\*\+,\/;\?\@\^\~\|-]/);
- $v|=$WS if ($c =~ /[ \t\r\n]/);
- $v|=$ESC if ($c =~ /\\/);
- $v|=$QUOTE if ($c =~ /['`"]/); # for emacs: "`'}/)
- $v|=$COMMENT if ($c =~ /\#/);
- $v|=$EOF if ($c =~ /\0/);
- $v|=$HIGHBIT if ($c =~/[\x80-\xff]/);
-
- push(@V_def,$v);
- }
-
-foreach (0 .. 255)
- {
- $v=0;
- $c=sprintf("%c",$_);
- $v|=$NUMBER if ($c =~ /[0-9]/);
- $v|=$UPPER if ($c =~ /[A-Z]/);
- $v|=$LOWER if ($c =~ /[a-z]/);
- $v|=$UNDER if ($c =~ /_/);
- $v|=$PUNCTUATION if ($c =~ /[!\.%&\*\+,\/;\?\@\^\~\|-]/);
- $v|=$WS if ($c =~ /[ \t\r\n]/);
- $v|=$DQUOTE if ($c =~ /["]/); # for emacs: "}/)
- $v|=$FCOMMENT if ($c =~ /;/);
- $v|=$EOF if ($c =~ /\0/);
- $v|=$HIGHBIT if ($c =~/[\x80-\xff]/);
-
- push(@V_w32,$v);
- }
+use strict;
+use warnings;
+
+my $NUMBER = 0x0001;
+my $UPPER = 0x0002;
+my $LOWER = 0x0004;
+my $UNDER = 0x0100;
+my $PUNCTUATION = 0x0200;
+my $WS = 0x0010;
+my $ESC = 0x0020;
+my $QUOTE = 0x0040;
+my $DQUOTE = 0x0400;
+my $COMMENT = 0x0080;
+my $FCOMMENT = 0x0800;
+my $EOF = 0x0008;
+my @V_def;
+my @V_w32;
+
+my $v;
+my $c;
+foreach (0 .. 127) {
+ $c = sprintf("%c", $_);
+ $v = 0;
+ $v |= $NUMBER if $c =~ /[0-9]/;
+ $v |= $UPPER if $c =~ /[A-Z]/;
+ $v |= $LOWER if $c =~ /[a-z]/;
+ $v |= $UNDER if $c =~ /_/;
+ $v |= $PUNCTUATION if $c =~ /[!\.%&\*\+,\/;\?\@\^\~\|-]/;
+ $v |= $WS if $c =~ /[ \t\r\n]/;
+ $v |= $ESC if $c =~ /\\/;
+ $v |= $QUOTE if $c =~ /['`"]/; # for emacs: "`'
+ $v |= $COMMENT if $c =~ /\#/;
+ $v |= $EOF if $c =~ /\0/;
+ push(@V_def, $v);
+
+ $v = 0;
+ $v |= $NUMBER if $c =~ /[0-9]/;
+ $v |= $UPPER if $c =~ /[A-Z]/;
+ $v |= $LOWER if $c =~ /[a-z]/;
+ $v |= $UNDER if $c =~ /_/;
+ $v |= $PUNCTUATION if $c =~ /[!\.%&\*\+,\/;\?\@\^\~\|-]/;
+ $v |= $WS if $c =~ /[ \t\r\n]/;
+ $v |= $DQUOTE if $c =~ /["]/; # for emacs: "
+ $v |= $FCOMMENT if $c =~ /;/;
+ $v |= $EOF if $c =~ /\0/;
+ 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
* https://www.openssl.org/source/license.html
*/
-#define CONF_NUMBER $NUMBER
-#define CONF_UPPER $UPPER
-#define CONF_LOWER $LOWER
-#define CONF_UNDER $UNDER
-#define CONF_PUNCTUATION $PUNCTUATION
-#define CONF_WS $WS
-#define CONF_ESC $ESC
-#define CONF_QUOTE $QUOTE
-#define CONF_DQUOTE $DQUOTE
-#define CONF_COMMENT $COMMENT
-#define CONF_FCOMMENT $FCOMMENT
-#define CONF_EOF $EOF
-#define CONF_HIGHBIT $HIGHBIT
-#define CONF_ALPHA (CONF_UPPER|CONF_LOWER)
-#define CONF_ALPHA_NUMERIC (CONF_ALPHA|CONF_NUMBER|CONF_UNDER)
-#define CONF_ALPHA_NUMERIC_PUNCT (CONF_ALPHA|CONF_NUMBER|CONF_UNDER| \\
- CONF_PUNCTUATION)
-
-#define KEYTYPES(c) ((const unsigned short *)((c)->meth_data))
-#ifndef CHARSET_EBCDIC
-# define IS_COMMENT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_COMMENT)
-# define IS_FCOMMENT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_FCOMMENT)
-# define IS_EOF(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_EOF)
-# define IS_ESC(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_ESC)
-# define IS_NUMBER(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_NUMBER)
-# define IS_WS(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_WS)
-# define IS_ALPHA_NUMERIC(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_ALPHA_NUMERIC)
-# define IS_ALPHA_NUMERIC_PUNCT(c,a) \\
- (KEYTYPES(c)[(a)&0xff]&CONF_ALPHA_NUMERIC_PUNCT)
-# define IS_QUOTE(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_QUOTE)
-# define IS_DQUOTE(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_DQUOTE)
-# define IS_HIGHBIT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_HIGHBIT)
-
-#else /* CHARSET_EBCDIC */
-
-# define IS_COMMENT(c,a) (KEYTYPES(c)[os_toascii[a & 0xff]]&CONF_COMMENT)
-# define IS_FCOMMENT(c,a) (KEYTYPES(c)[os_toascii[a & 0xff]]&CONF_FCOMMENT)
-# define IS_EOF(c,a) (KEYTYPES(c)[os_toascii[a & 0xff]]&CONF_EOF)
-# define IS_ESC(c,a) (KEYTYPES(c)[os_toascii[a & 0xff]]&CONF_ESC)
-# define IS_NUMBER(c,a) (KEYTYPES(c)[os_toascii[a & 0xff]]&CONF_NUMBER)
-# define IS_WS(c,a) (KEYTYPES(c)[os_toascii[a & 0xff]]&CONF_WS)
-# define IS_ALPHA_NUMERIC(c,a) (KEYTYPES(c)[os_toascii[a & 0xff]]&CONF_ALPHA_NUMERIC)
-# define IS_ALPHA_NUMERIC_PUNCT(c,a) \\
- (KEYTYPES(c)[os_toascii[a & 0xff]]&CONF_ALPHA_NUMERIC_PUNCT)
-# define IS_QUOTE(c,a) (KEYTYPES(c)[os_toascii[a & 0xff]]&CONF_QUOTE)
-# define IS_DQUOTE(c,a) (KEYTYPES(c)[os_toascii[a & 0xff]]&CONF_DQUOTE)
-# define IS_HIGHBIT(c,a) (KEYTYPES(c)[os_toascii[a & 0xff]]&CONF_HIGHBIT)
-#endif /* CHARSET_EBCDIC */
+#define CONF_NUMBER $NUMBER
+#define CONF_UPPER $UPPER
+#define CONF_LOWER $LOWER
+#define CONF_UNDER $UNDER
+#define CONF_PUNCT $PUNCTUATION
+#define CONF_WS $WS
+#define CONF_ESC $ESC
+#define CONF_QUOTE $QUOTE
+#define CONF_DQUOTE $DQUOTE
+#define CONF_COMMENT $COMMENT
+#define CONF_FCOMMENT $FCOMMENT
+#define CONF_EOF $EOF
+#define CONF_ALPHA (CONF_UPPER|CONF_LOWER)
+#define CONF_ALNUM (CONF_ALPHA|CONF_NUMBER|CONF_UNDER)
+#define CONF_ALNUM_PUNCT (CONF_ALPHA|CONF_NUMBER|CONF_UNDER|CONF_PUNCT)
+
+
+#define IS_COMMENT(conf,c) is_keytype(conf, c, CONF_COMMENT)
+#define IS_FCOMMENT(conf,c) is_keytype(conf, c, CONF_FCOMMENT)
+#define IS_EOF(conf,c) is_keytype(conf, c, CONF_EOF)
+#define IS_ESC(conf,c) is_keytype(conf, c, CONF_ESC)
+#define IS_NUMBER(conf,c) is_keytype(conf, c, CONF_NUMBER)
+#define IS_WS(conf,c) is_keytype(conf, c, CONF_WS)
+#define IS_ALNUM(conf,c) is_keytype(conf, c, CONF_ALNUM)
+#define IS_ALNUM_PUNCT(conf,c) is_keytype(conf, c, CONF_ALNUM_PUNCT)
+#define IS_QUOTE(conf,c) is_keytype(conf, c, CONF_QUOTE)
+#define IS_DQUOTE(conf,c) is_keytype(conf, c, CONF_DQUOTE)
EOF
-print "static const unsigned short CONF_type_default[256] = {";
-
-for ($i=0; $i<256; $i++)
- {
- print "\n " if ($i % 8) == 0;
- printf " 0x%04X,",$V_def[$i];
- }
+my $i;
+print "static const unsigned short CONF_type_default[128] = {";
+for ($i = 0; $i < 128; $i++) {
+ print "\n " if ($i % 8) == 0;
+ printf " 0x%04X,", $V_def[$i];
+}
print "\n};\n\n";
-print "static const unsigned short CONF_type_win32[256] = {";
-
-for ($i=0; $i<256; $i++)
- {
- print "\n " if ($i % 8) == 0;
- printf " 0x%04X,",$V_w32[$i];
- }
-
+print "static const unsigned short CONF_type_win32[128] = {";
+for ($i = 0; $i < 128; $i++) {
+ print "\n " if ($i % 8) == 0;
+ printf " 0x%04X,", $V_w32[$i];
+}
print "\n};\n";