sync code with last fixes and improvements from OpenBSD

This commit is contained in:
purplerain 2023-07-30 17:58:45 +00:00
parent f960599e67
commit 691f97cc10
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
215 changed files with 1520 additions and 11518 deletions

View file

@ -1,4 +1,4 @@
/* $OpenBSD: err.c,v 1.54 2023/07/07 19:37:53 beck Exp $ */
/* $OpenBSD: err.c,v 1.56 2023/07/28 10:23:19 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@ -125,6 +125,8 @@
DECLARE_LHASH_OF(ERR_STRING_DATA);
DECLARE_LHASH_OF(ERR_STATE);
typedef struct st_ERR_FNS ERR_FNS;
static void err_load_strings(int lib, ERR_STRING_DATA *str);
static void ERR_STATE_free(ERR_STATE *s);
@ -300,33 +302,6 @@ err_fns_check(void)
CRYPTO_w_unlock(CRYPTO_LOCK_ERR);
}
/* API functions to get or set the underlying ERR functions. */
const ERR_FNS *
ERR_get_implementation(void)
{
err_fns_check();
return err_fns;
}
LCRYPTO_ALIAS(ERR_get_implementation);
int
ERR_set_implementation(const ERR_FNS *fns)
{
int ret = 0;
CRYPTO_w_lock(CRYPTO_LOCK_ERR);
/* It's too late if 'err_fns' is non-NULL. BTW: not much point setting
* an error is there?! */
if (!err_fns) {
err_fns = fns;
ret = 1;
}
CRYPTO_w_unlock(CRYPTO_LOCK_ERR);
return ret;
}
LCRYPTO_ALIAS(ERR_set_implementation);
/* These are the callbacks provided to "lh_new()" when creating the LHASH tables
* internal to the "err_defaults" implementation. */
@ -977,28 +952,6 @@ ERR_error_string(unsigned long e, char *ret)
}
LCRYPTO_ALIAS(ERR_error_string);
LHASH_OF(ERR_STRING_DATA) *ERR_get_string_table(void)
{
err_fns_check();
return ERRFN(err_get)(0);
}
LCRYPTO_ALIAS(ERR_get_string_table);
LHASH_OF(ERR_STATE) *ERR_get_err_state_table(void)
{
err_fns_check();
return ERRFN(thread_get)(0);
}
LCRYPTO_ALIAS(ERR_get_err_state_table);
void
ERR_release_err_state_table(LHASH_OF(ERR_STATE) **hash)
{
err_fns_check();
ERRFN(thread_release)(hash);
}
LCRYPTO_ALIAS(ERR_release_err_state_table);
const char *
ERR_lib_error_string(unsigned long e)
{

View file

@ -1,4 +1,4 @@
/* $OpenBSD: err.h,v 1.29 2023/04/09 19:10:23 tb Exp $ */
/* $OpenBSD: err.h,v 1.31 2023/07/28 10:23:19 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@ -399,26 +399,11 @@ void ERR_remove_thread_state(const CRYPTO_THREADID *tid);
void ERR_remove_state(unsigned long pid);
ERR_STATE *ERR_get_state(void);
#ifndef OPENSSL_NO_LHASH
LHASH_OF(ERR_STRING_DATA) *ERR_get_string_table(void);
LHASH_OF(ERR_STATE) *ERR_get_err_state_table(void);
void ERR_release_err_state_table(LHASH_OF(ERR_STATE) **hash);
#endif
int ERR_get_next_error_library(void);
int ERR_set_mark(void);
int ERR_pop_to_mark(void);
/* Already defined in ossl_typ.h */
/* typedef struct st_ERR_FNS ERR_FNS; */
/* An application can use this function and provide the return value to loaded
* modules that should use the application's ERR state/functionality */
const ERR_FNS *ERR_get_implementation(void);
/* A loaded module should call this function prior to any ERR operations using
* the application's "ERR_FNS". */
int ERR_set_implementation(const ERR_FNS *fns);
#ifdef __cplusplus
}
#endif

View file

@ -1,4 +1,4 @@
/* $OpenBSD: err_all.c,v 1.29 2023/07/07 13:54:45 beck Exp $ */
/* $OpenBSD: err_all.c,v 1.32 2023/07/28 09:46:36 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@ -69,7 +69,6 @@
#include <openssl/comp.h>
#include <openssl/conf.h>
#include <openssl/ct.h>
#include <openssl/dso.h>
#include <openssl/err.h>
#include <openssl/evp.h>
#include <openssl/kdf.h>
@ -92,12 +91,6 @@
#ifndef OPENSSL_NO_EC
#include <openssl/ec.h>
#endif
#ifndef OPENSSL_NO_ECDH
#include <openssl/ecdh.h>
#endif
#ifndef OPENSSL_NO_ECDSA
#include <openssl/ecdsa.h>
#endif
#ifndef OPENSSL_NO_ENGINE
#include <openssl/engine.h>
#endif
@ -133,13 +126,6 @@ ERR_load_crypto_strings_internal(void)
#endif
#ifndef OPENSSL_NO_DSA
ERR_load_DSA_strings();
#endif
ERR_load_DSO_strings();
#ifndef OPENSSL_NO_ECDH
ERR_load_ECDH_strings();
#endif
#ifndef OPENSSL_NO_ECDSA
ERR_load_ECDSA_strings();
#endif
#ifndef OPENSSL_NO_EC
ERR_load_EC_strings();