Import OpenSSL 1.1.0j

This commit is contained in:
Steve Dower
2018-12-07 11:30:36 -08:00
parent 6960e8d7c7
commit 697f7e1f24
114 changed files with 9043 additions and 3633 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 1998-2016 The OpenSSL Project Authors. All Rights Reserved.
* Copyright 1998-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
@@ -16,27 +16,26 @@
#include <openssl/objects.h>
#include <openssl/safestack.h>
#include <openssl/e_os2.h>
#include <internal/thread_once.h>
#include "internal/thread_once.h"
#include "internal/lhash.h"
#include "obj_lcl.h"
#include "e_os.h"
/*
* We define this wrapper for two reasons. Firstly, later versions of
* DEC C add linkage information to certain functions, which makes it
* tricky to use them as values to regular function pointers.
* Secondly, in the EDK2 build environment, the strcmp function is
* actually an external function (AsciiStrCmp) with the Microsoft ABI,
* so we can't transparently assign function pointers to it.
* Arguably the latter is a stupidity of the UEFI environment, but
* since the wrapper solves the DEC C issue too, let's just use the
* same solution.
* Secondly, in the EDK2 build environment, the strcasecmp function is
* actually an external function with the Microsoft ABI, so we can't
* transparently assign function pointers to it.
*/
#if defined(OPENSSL_SYS_VMS_DECC) || defined(OPENSSL_SYS_UEFI)
static int obj_strcmp(const char *a, const char *b)
static int obj_strcasecmp(const char *a, const char *b)
{
return strcmp(a, b);
return strcasecmp(a, b);
}
#else
#define obj_strcmp strcmp
#define obj_strcasecmp strcasecmp
#endif
/*
@@ -111,8 +110,8 @@ int OBJ_NAME_new_index(unsigned long (*hash_func) (const char *),
ret = 0;
goto out;
}
name_funcs->hash_func = OPENSSL_LH_strhash;
name_funcs->cmp_func = obj_strcmp;
name_funcs->hash_func = openssl_lh_strcasehash;
name_funcs->cmp_func = obj_strcasecmp;
CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE);
push = sk_NAME_FUNCS_push(name_funcs_stack, name_funcs);
@@ -149,7 +148,7 @@ static int obj_name_cmp(const OBJ_NAME *a, const OBJ_NAME *b)
ret = sk_NAME_FUNCS_value(name_funcs_stack,
a->type)->cmp_func(a->name, b->name);
} else
ret = strcmp(a->name, b->name);
ret = strcasecmp(a->name, b->name);
}
return ret;
}
@@ -164,7 +163,7 @@ static unsigned long obj_name_hash(const OBJ_NAME *a)
sk_NAME_FUNCS_value(name_funcs_stack,
a->type)->hash_func(a->name);
} else {
ret = OPENSSL_LH_strhash(a->name);
ret = openssl_lh_strcasehash(a->name);
}
ret ^= a->type;
return ret;
@@ -214,8 +213,6 @@ int OBJ_NAME_add(const char *name, int type, const char *data)
if (!OBJ_NAME_init())
return 0;
CRYPTO_THREAD_write_lock(lock);
alias = type & OBJ_NAME_ALIAS;
type &= ~OBJ_NAME_ALIAS;
@@ -230,6 +227,8 @@ int OBJ_NAME_add(const char *name, int type, const char *data)
onp->type = type;
onp->data = data;
CRYPTO_THREAD_write_lock(lock);
ret = lh_OBJ_NAME_insert(names_lh, onp);
if (ret != NULL) {
/* free things */