This was neutered early on in the fork and has been rotting ever since.
Some parts of the API are still used, but it's easier to clean up when
most of the mess is gone.
ok jsing
CRYPTO_cleanup_all_ex_data
CRYPTO_ctr128_encrypt
CRYPTO_ctr128_encrypt_ctr32
-CRYPTO_dbg_free
-CRYPTO_dbg_get_options
-CRYPTO_dbg_malloc
-CRYPTO_dbg_realloc
-CRYPTO_dbg_set_options
CRYPTO_destroy_dynlockid
CRYPTO_dup_ex_data
CRYPTO_free
CRYPTO_free_ex_data
-CRYPTO_free_locked
CRYPTO_gcm128_aad
CRYPTO_gcm128_decrypt
CRYPTO_gcm128_decrypt_ctr32
CRYPTO_get_ex_new_index
CRYPTO_get_id_callback
CRYPTO_get_lock_name
-CRYPTO_get_locked_mem_ex_functions
-CRYPTO_get_locked_mem_functions
CRYPTO_get_locking_callback
-CRYPTO_get_mem_debug_functions
-CRYPTO_get_mem_debug_options
-CRYPTO_get_mem_ex_functions
-CRYPTO_get_mem_functions
CRYPTO_get_new_dynlockid
CRYPTO_get_new_lockid
CRYPTO_hchacha_20
-CRYPTO_is_mem_check_on
CRYPTO_lock
CRYPTO_malloc
-CRYPTO_malloc_locked
CRYPTO_mem_ctrl
-CRYPTO_mem_leaks
-CRYPTO_mem_leaks_cb
-CRYPTO_mem_leaks_fp
CRYPTO_memcmp
CRYPTO_new_ex_data
CRYPTO_num_locks
CRYPTO_poly1305_update
CRYPTO_pop_info
CRYPTO_push_info_
-CRYPTO_realloc
-CRYPTO_realloc_clean
-CRYPTO_remalloc
CRYPTO_remove_all_info
CRYPTO_set_add_lock_callback
CRYPTO_set_dynlock_create_callback
CRYPTO_set_dynlock_lock_callback
CRYPTO_set_ex_data
CRYPTO_set_id_callback
-CRYPTO_set_locked_mem_ex_functions
-CRYPTO_set_locked_mem_functions
CRYPTO_set_locking_callback
-CRYPTO_set_mem_debug_functions
-CRYPTO_set_mem_debug_options
CRYPTO_set_mem_ex_functions
CRYPTO_set_mem_functions
CRYPTO_strdup
_libre_CRYPTO_set_mem_ex_functions
_libre_CRYPTO_set_locked_mem_ex_functions
_libre_CRYPTO_set_mem_debug_functions
-_libre_CRYPTO_get_mem_functions
-_libre_CRYPTO_get_locked_mem_functions
-_libre_CRYPTO_get_mem_ex_functions
-_libre_CRYPTO_get_locked_mem_ex_functions
-_libre_CRYPTO_get_mem_debug_functions
_libre_CRYPTO_realloc_clean
_libre_CRYPTO_remalloc
_libre_CRYPTO_set_mem_debug_options
-_libre_CRYPTO_get_mem_debug_options
_libre_CRYPTO_push_info_
_libre_CRYPTO_pop_info
_libre_CRYPTO_remove_all_info
-_libre_CRYPTO_dbg_malloc
-_libre_CRYPTO_dbg_realloc
-_libre_CRYPTO_dbg_free
-_libre_CRYPTO_dbg_set_options
-_libre_CRYPTO_dbg_get_options
-_libre_CRYPTO_mem_leaks_fp
-_libre_CRYPTO_mem_leaks
-_libre_CRYPTO_mem_leaks_cb
_libre_OpenSSLDie
_libre_OPENSSL_cpu_caps
_libre_OPENSSL_init_crypto
-/* $OpenBSD: crypto.h,v 1.65 2024/03/02 09:15:03 tb Exp $ */
+/* $OpenBSD: crypto.h,v 1.66 2024/03/02 11:28:46 tb Exp $ */
/* ====================================================================
* Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved.
*
#endif
int CRYPTO_mem_ctrl(int mode);
-int CRYPTO_is_mem_check_on(void);
-
-/* for applications */
-#define MemCheck_start() CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON)
-#define MemCheck_stop() CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_OFF)
#define OPENSSL_malloc(num) CRYPTO_malloc((int)num,NULL,0)
#define OPENSSL_strdup(str) CRYPTO_strdup((str),NULL,0)
-#define OPENSSL_realloc(addr,num) \
- CRYPTO_realloc((char *)addr,(int)num,NULL,0)
-#define OPENSSL_realloc_clean(addr,old_num,num) \
- CRYPTO_realloc_clean(addr,old_num,num,NULL,0)
-#define OPENSSL_remalloc(addr,num) \
- CRYPTO_remalloc((char **)addr,(int)num,NULL,0)
-#define OPENSSL_freeFunc CRYPTO_free
#define OPENSSL_free(addr) CRYPTO_free(addr)
-
-#define OPENSSL_malloc_locked(num) \
- CRYPTO_malloc_locked((int)num,NULL,0)
-#define OPENSSL_free_locked(addr) CRYPTO_free_locked(addr)
#endif
const char *OpenSSL_version(int type);
/* CRYPTO_set_mem_functions includes CRYPTO_set_locked_mem_functions --
* call the latter last if you need different functions */
int CRYPTO_set_mem_functions(void *(*m)(size_t), void *(*r)(void *, size_t), void (*f)(void *));
-int CRYPTO_set_locked_mem_functions(void *(*m)(size_t), void (*free_func)(void *));
int CRYPTO_set_mem_ex_functions(void *(*m)(size_t, const char *, int),
void *(*r)(void *, size_t, const char *, int), void (*f)(void *));
-int CRYPTO_set_locked_mem_ex_functions(void *(*m)(size_t, const char *, int),
- void (*free_func)(void *));
-int CRYPTO_set_mem_debug_functions(
- void (*m)(void *, int, const char *, int, int),
- void (*r)(void *, void *, int, const char *, int, int),
- void (*f)(void *, int), void (*so)(long), long (*go)(void));
-void CRYPTO_get_mem_functions(void *(**m)(size_t), void *(**r)(void *, size_t),
- void (**f)(void *));
-void CRYPTO_get_locked_mem_functions(void *(**m)(size_t), void (**f)(void *));
-void CRYPTO_get_mem_ex_functions(void *(**m)(size_t, const char *, int),
- void *(**r)(void *, size_t, const char *, int), void (**f)(void *));
-void CRYPTO_get_locked_mem_ex_functions(void *(**m)(size_t, const char *, int),
- void (**f)(void *));
-void CRYPTO_get_mem_debug_functions(
- void (**m)(void *, int, const char *, int, int),
- void (**r)(void *, void *, int, const char *, int, int),
- void (**f)(void *, int), void (**so)(long), long (**go)(void));
#ifndef LIBRESSL_INTERNAL
-void *CRYPTO_malloc_locked(int num, const char *file, int line);
-void CRYPTO_free_locked(void *ptr);
void *CRYPTO_malloc(int num, const char *file, int line);
char *CRYPTO_strdup(const char *str, const char *file, int line);
void CRYPTO_free(void *ptr);
-void *CRYPTO_realloc(void *addr, int num, const char *file, int line);
#endif
-void *CRYPTO_realloc_clean(void *addr, int old_num, int num,
- const char *file, int line);
-void *CRYPTO_remalloc(void *addr, int num, const char *file, int line);
-
#ifndef LIBRESSL_INTERNAL
void OPENSSL_cleanse(void *ptr, size_t len);
#endif
-void CRYPTO_set_mem_debug_options(long bits);
-long CRYPTO_get_mem_debug_options(void);
-
#define CRYPTO_push_info(info) \
CRYPTO_push_info_(info, NULL, 0);
int CRYPTO_push_info_(const char *info, const char *file, int line);
int CRYPTO_pop_info(void);
int CRYPTO_remove_all_info(void);
-
-/* Default debugging functions (enabled by CRYPTO_malloc_debug_init() macro;
- * used as default in CRYPTO_MDEBUG compilations): */
-/* The last argument has the following significance:
- *
- * 0: called before the actual memory allocation has taken place
- * 1: called after the actual memory allocation has taken place
- */
-void CRYPTO_dbg_malloc(void *addr, int num, const char *file, int line, int before_p)
- __attribute__ ((deprecated));
-void CRYPTO_dbg_realloc(void *addr1, void *addr2, int num, const char *file, int line, int before_p)
- __attribute__ ((deprecated));
-void CRYPTO_dbg_free(void *addr, int before_p)
- __attribute__ ((deprecated));
-/* Tell the debugging code about options. By default, the following values
- * apply:
- *
- * 0: Clear all options.
- * V_CRYPTO_MDEBUG_TIME (1): Set the "Show Time" option.
- * V_CRYPTO_MDEBUG_THREAD (2): Set the "Show Thread Number" option.
- * V_CRYPTO_MDEBUG_ALL (3): 1 + 2
- */
-void CRYPTO_dbg_set_options(long bits)
- __attribute__ ((deprecated));
-long CRYPTO_dbg_get_options(void)
- __attribute__ ((deprecated));
-
-
-int CRYPTO_mem_leaks_fp(FILE *);
-int CRYPTO_mem_leaks(struct bio_st *bio);
-/* unsigned long order, char *file, int line, int num_bytes, char *addr */
-typedef int *CRYPTO_MEM_LEAK_CB(unsigned long, const char *, int, int, void *);
-int CRYPTO_mem_leaks_cb(CRYPTO_MEM_LEAK_CB *cb);
-
/*
* Because this is a public header, use a portable method of indicating the
* function does not return, rather than __dead.
-/* $OpenBSD: crypto.h,v 1.3 2024/03/01 07:38:33 tb Exp $ */
+/* $OpenBSD: crypto.h,v 1.4 2024/03/02 11:28:46 tb Exp $ */
/*
* Copyright (c) 2023 Bob Beck <beck@openbsd.org>
*
LCRYPTO_USED(CRYPTO_THREADID_cpy);
LCRYPTO_USED(CRYPTO_THREADID_hash);
LCRYPTO_USED(CRYPTO_set_mem_functions);
-LCRYPTO_USED(CRYPTO_set_locked_mem_functions);
LCRYPTO_USED(CRYPTO_set_mem_ex_functions);
-LCRYPTO_USED(CRYPTO_set_locked_mem_ex_functions);
-LCRYPTO_USED(CRYPTO_set_mem_debug_functions);
-LCRYPTO_USED(CRYPTO_get_mem_functions);
-LCRYPTO_USED(CRYPTO_get_locked_mem_functions);
-LCRYPTO_USED(CRYPTO_get_mem_ex_functions);
-LCRYPTO_USED(CRYPTO_get_locked_mem_ex_functions);
-LCRYPTO_USED(CRYPTO_get_mem_debug_functions);
-LCRYPTO_USED(CRYPTO_realloc_clean);
-LCRYPTO_USED(CRYPTO_remalloc);
-LCRYPTO_USED(CRYPTO_set_mem_debug_options);
-LCRYPTO_USED(CRYPTO_get_mem_debug_options);
LCRYPTO_USED(CRYPTO_push_info_);
LCRYPTO_USED(CRYPTO_pop_info);
LCRYPTO_USED(CRYPTO_remove_all_info);
-LCRYPTO_USED(CRYPTO_dbg_malloc);
-LCRYPTO_USED(CRYPTO_dbg_realloc);
-LCRYPTO_USED(CRYPTO_dbg_free);
-LCRYPTO_USED(CRYPTO_dbg_set_options);
-LCRYPTO_USED(CRYPTO_dbg_get_options);
-LCRYPTO_USED(CRYPTO_mem_leaks_fp);
-LCRYPTO_USED(CRYPTO_mem_leaks);
-LCRYPTO_USED(CRYPTO_mem_leaks_cb);
LCRYPTO_USED(OpenSSLDie);
LCRYPTO_USED(OPENSSL_cpu_caps);
LCRYPTO_USED(OPENSSL_init_crypto);
-/* $OpenBSD: malloc-wrapper.c,v 1.8 2023/07/08 08:28:23 beck Exp $ */
+/* $OpenBSD: malloc-wrapper.c,v 1.9 2024/03/02 11:28:46 tb Exp $ */
/*
* Copyright (c) 2014 Bob Beck
*
}
LCRYPTO_ALIAS(CRYPTO_set_mem_ex_functions);
-int
-CRYPTO_set_locked_mem_functions(void *(*m)(size_t), void (*f)(void *))
-{
- return 0;
-}
-LCRYPTO_ALIAS(CRYPTO_set_locked_mem_functions);
-
-int
-CRYPTO_set_locked_mem_ex_functions(void *(*m)(size_t, const char *, int),
- void (*f)(void *))
-{
- return 0;
-}
-LCRYPTO_ALIAS(CRYPTO_set_locked_mem_ex_functions);
-
-int
-CRYPTO_set_mem_debug_functions(void (*m)(void *, int, const char *, int, int),
- void (*r)(void *, void *, int, const char *, int, int),
- void (*f)(void *, int), void (*so)(long), long (*go)(void))
-{
- return 0;
-}
-LCRYPTO_ALIAS(CRYPTO_set_mem_debug_functions);
-
-
-void
-CRYPTO_get_mem_functions(void *(**m)(size_t), void *(**r)(void *, size_t),
- void (**f)(void *))
-{
- if (m != NULL)
- *m = malloc;
- if (r != NULL)
- *r = realloc;
- if (f != NULL)
- *f = free;
-}
-LCRYPTO_ALIAS(CRYPTO_get_mem_functions);
-
-void
-CRYPTO_get_mem_ex_functions(void *(**m)(size_t, const char *, int),
- void *(**r)(void *, size_t, const char *, int), void (**f)(void *))
-{
- if (m != NULL)
- *m = NULL;
- if (r != NULL)
- *r = NULL;
- if (f != NULL)
- *f = free;
-}
-LCRYPTO_ALIAS(CRYPTO_get_mem_ex_functions);
-
-void
-CRYPTO_get_locked_mem_functions(void *(**m)(size_t), void (**f)(void *))
-{
- if (m != NULL)
- *m = malloc;
- if (f != NULL)
- *f = free;
-}
-LCRYPTO_ALIAS(CRYPTO_get_locked_mem_functions);
-
-void
-CRYPTO_get_locked_mem_ex_functions(void *(**m)(size_t, const char *, int),
- void (**f)(void *))
-{
- if (m != NULL)
- *m = NULL;
- if (f != NULL)
- *f = free;
-}
-LCRYPTO_ALIAS(CRYPTO_get_locked_mem_ex_functions);
-
-void
-CRYPTO_get_mem_debug_functions(void (**m)(void *, int, const char *, int, int),
- void (**r)(void *, void *, int, const char *, int, int),
- void (**f)(void *, int), void (**so)(long), long (**go)(void))
-{
- if (m != NULL)
- *m = NULL;
- if (r != NULL)
- *r = NULL;
- if (f != NULL)
- *f = NULL;
- if (so != NULL)
- *so = NULL;
- if (go != NULL)
- *go = NULL;
-}
-LCRYPTO_ALIAS(CRYPTO_get_mem_debug_functions);
-
-
-void *
-CRYPTO_malloc_locked(int num, const char *file, int line)
-{
- if (num <= 0)
- return NULL;
- return malloc(num);
-}
-
-void
-CRYPTO_free_locked(void *ptr)
-{
- free(ptr);
-}
-
void *
CRYPTO_malloc(int num, const char *file, int line)
{
return strdup(str);
}
-void *
-CRYPTO_realloc(void *ptr, int num, const char *file, int line)
-{
- if (num <= 0)
- return NULL;
- return realloc(ptr, num);
-}
-
-void *
-CRYPTO_realloc_clean(void *ptr, int old_len, int num, const char *file,
- int line)
-{
- if (num <= 0)
- return NULL;
- /* Original does not support shrinking. */
- if (num < old_len)
- return NULL;
- return recallocarray(ptr, old_len, num, 1);
-}
-LCRYPTO_ALIAS(CRYPTO_realloc_clean);
-
void
CRYPTO_free(void *ptr)
{
free(ptr);
}
-
-void *
-CRYPTO_remalloc(void *a, int num, const char *file, int line)
-{
- free(a);
- return malloc(num);
-}
-LCRYPTO_ALIAS(CRYPTO_remalloc);
-
-void
-CRYPTO_set_mem_debug_options(long bits)
-{
- return;
-}
-LCRYPTO_ALIAS(CRYPTO_set_mem_debug_options);
-
-long
-CRYPTO_get_mem_debug_options(void)
-{
- return 0;
-}
-LCRYPTO_ALIAS(CRYPTO_get_mem_debug_options);
-/* $OpenBSD: mem_dbg.c,v 1.25 2023/07/08 08:28:23 beck Exp $ */
+/* $OpenBSD: mem_dbg.c,v 1.26 2024/03/02 11:28:46 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
return (CRYPTO_MEM_CHECK_OFF);
}
-int
-CRYPTO_is_mem_check_on(void)
-{
- return (0);
-}
-
-
-void
-CRYPTO_dbg_set_options(long bits)
-{
- return;
-}
-LCRYPTO_ALIAS(CRYPTO_dbg_set_options);
-
-long
-CRYPTO_dbg_get_options(void)
-{
- return (0);
-}
-LCRYPTO_ALIAS(CRYPTO_dbg_get_options);
-
int
CRYPTO_push_info_(const char *info, const char *file, int line)
{
return (0);
}
LCRYPTO_ALIAS(CRYPTO_remove_all_info);
-
-void
-CRYPTO_dbg_malloc(void *addr, int num, const char *file, int line,
- int before_p)
-{
- OPENSSL_assert("CRYPTO_dbg_malloc is no longer permitted");
-}
-LCRYPTO_ALIAS(CRYPTO_dbg_malloc);
-
-void
-CRYPTO_dbg_free(void *addr, int before_p)
-{
- OPENSSL_assert("CRYPTO_dbg_free is no longer permitted");
-}
-LCRYPTO_ALIAS(CRYPTO_dbg_free);
-
-void
-CRYPTO_dbg_realloc(void *addr1, void *addr2, int num,
- const char *file, int line, int before_p)
-{
- OPENSSL_assert("CRYPTO_dbg_realloc is no longer permitted");
-}
-LCRYPTO_ALIAS(CRYPTO_dbg_realloc);
-
-int
-CRYPTO_mem_leaks(BIO *b)
-{
- return -1;
-}
-LCRYPTO_ALIAS(CRYPTO_mem_leaks);
-
-int
-CRYPTO_mem_leaks_fp(FILE *fp)
-{
- return -1;
-}
-LCRYPTO_ALIAS(CRYPTO_mem_leaks_fp);
-
-
-int
-CRYPTO_mem_leaks_cb(CRYPTO_MEM_LEAK_CB *cb)
-{
- return -1;
-}
-LCRYPTO_ALIAS(CRYPTO_mem_leaks_cb);