summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/crypto.h
diff options
context:
space:
mode:
authortb <>2024-03-02 11:28:46 +0000
committertb <>2024-03-02 11:28:46 +0000
commit9b9fc000d4d482c0c3086b0e54b4c1a88c76ee34 (patch)
treef40142fa94b70538607eebd6e277749aa7bb40c1 /src/lib/libcrypto/crypto.h
parente26a003ae69c592a266ff1b2331d6206111a56db (diff)
downloadopenbsd-9b9fc000d4d482c0c3086b0e54b4c1a88c76ee34.tar.gz
openbsd-9b9fc000d4d482c0c3086b0e54b4c1a88c76ee34.tar.bz2
openbsd-9b9fc000d4d482c0c3086b0e54b4c1a88c76ee34.zip
Remove a bunch of CRYPTO memory API
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
Diffstat (limited to 'src/lib/libcrypto/crypto.h')
-rw-r--r--src/lib/libcrypto/crypto.h80
1 files changed, 1 insertions, 79 deletions
diff --git a/src/lib/libcrypto/crypto.h b/src/lib/libcrypto/crypto.h
index f37ec3106d..19732ced32 100644
--- a/src/lib/libcrypto/crypto.h
+++ b/src/lib/libcrypto/crypto.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: crypto.h,v 1.65 2024/03/02 09:15:03 tb Exp $ */ 1/* $OpenBSD: crypto.h,v 1.66 2024/03/02 11:28:46 tb Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved.
4 * 4 *
@@ -272,26 +272,10 @@ DECLARE_STACK_OF(void)
272#endif 272#endif
273 273
274int CRYPTO_mem_ctrl(int mode); 274int CRYPTO_mem_ctrl(int mode);
275int CRYPTO_is_mem_check_on(void);
276
277/* for applications */
278#define MemCheck_start() CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON)
279#define MemCheck_stop() CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_OFF)
280 275
281#define OPENSSL_malloc(num) CRYPTO_malloc((int)num,NULL,0) 276#define OPENSSL_malloc(num) CRYPTO_malloc((int)num,NULL,0)
282#define OPENSSL_strdup(str) CRYPTO_strdup((str),NULL,0) 277#define OPENSSL_strdup(str) CRYPTO_strdup((str),NULL,0)
283#define OPENSSL_realloc(addr,num) \
284 CRYPTO_realloc((char *)addr,(int)num,NULL,0)
285#define OPENSSL_realloc_clean(addr,old_num,num) \
286 CRYPTO_realloc_clean(addr,old_num,num,NULL,0)
287#define OPENSSL_remalloc(addr,num) \
288 CRYPTO_remalloc((char **)addr,(int)num,NULL,0)
289#define OPENSSL_freeFunc CRYPTO_free
290#define OPENSSL_free(addr) CRYPTO_free(addr) 278#define OPENSSL_free(addr) CRYPTO_free(addr)
291
292#define OPENSSL_malloc_locked(num) \
293 CRYPTO_malloc_locked((int)num,NULL,0)
294#define OPENSSL_free_locked(addr) CRYPTO_free_locked(addr)
295#endif 279#endif
296 280
297const char *OpenSSL_version(int type); 281const char *OpenSSL_version(int type);
@@ -376,87 +360,25 @@ void (*CRYPTO_get_dynlock_destroy_callback(void))(struct CRYPTO_dynlock_value *l
376/* CRYPTO_set_mem_functions includes CRYPTO_set_locked_mem_functions -- 360/* CRYPTO_set_mem_functions includes CRYPTO_set_locked_mem_functions --
377 * call the latter last if you need different functions */ 361 * call the latter last if you need different functions */
378int CRYPTO_set_mem_functions(void *(*m)(size_t), void *(*r)(void *, size_t), void (*f)(void *)); 362int CRYPTO_set_mem_functions(void *(*m)(size_t), void *(*r)(void *, size_t), void (*f)(void *));
379int CRYPTO_set_locked_mem_functions(void *(*m)(size_t), void (*free_func)(void *));
380int CRYPTO_set_mem_ex_functions(void *(*m)(size_t, const char *, int), 363int CRYPTO_set_mem_ex_functions(void *(*m)(size_t, const char *, int),
381 void *(*r)(void *, size_t, const char *, int), void (*f)(void *)); 364 void *(*r)(void *, size_t, const char *, int), void (*f)(void *));
382int CRYPTO_set_locked_mem_ex_functions(void *(*m)(size_t, const char *, int),
383 void (*free_func)(void *));
384int CRYPTO_set_mem_debug_functions(
385 void (*m)(void *, int, const char *, int, int),
386 void (*r)(void *, void *, int, const char *, int, int),
387 void (*f)(void *, int), void (*so)(long), long (*go)(void));
388void CRYPTO_get_mem_functions(void *(**m)(size_t), void *(**r)(void *, size_t),
389 void (**f)(void *));
390void CRYPTO_get_locked_mem_functions(void *(**m)(size_t), void (**f)(void *));
391void CRYPTO_get_mem_ex_functions(void *(**m)(size_t, const char *, int),
392 void *(**r)(void *, size_t, const char *, int), void (**f)(void *));
393void CRYPTO_get_locked_mem_ex_functions(void *(**m)(size_t, const char *, int),
394 void (**f)(void *));
395void CRYPTO_get_mem_debug_functions(
396 void (**m)(void *, int, const char *, int, int),
397 void (**r)(void *, void *, int, const char *, int, int),
398 void (**f)(void *, int), void (**so)(long), long (**go)(void));
399 365
400#ifndef LIBRESSL_INTERNAL 366#ifndef LIBRESSL_INTERNAL
401void *CRYPTO_malloc_locked(int num, const char *file, int line);
402void CRYPTO_free_locked(void *ptr);
403void *CRYPTO_malloc(int num, const char *file, int line); 367void *CRYPTO_malloc(int num, const char *file, int line);
404char *CRYPTO_strdup(const char *str, const char *file, int line); 368char *CRYPTO_strdup(const char *str, const char *file, int line);
405void CRYPTO_free(void *ptr); 369void CRYPTO_free(void *ptr);
406void *CRYPTO_realloc(void *addr, int num, const char *file, int line);
407#endif 370#endif
408 371
409void *CRYPTO_realloc_clean(void *addr, int old_num, int num,
410 const char *file, int line);
411void *CRYPTO_remalloc(void *addr, int num, const char *file, int line);
412
413#ifndef LIBRESSL_INTERNAL 372#ifndef LIBRESSL_INTERNAL
414void OPENSSL_cleanse(void *ptr, size_t len); 373void OPENSSL_cleanse(void *ptr, size_t len);
415#endif 374#endif
416 375
417void CRYPTO_set_mem_debug_options(long bits);
418long CRYPTO_get_mem_debug_options(void);
419
420#define CRYPTO_push_info(info) \ 376#define CRYPTO_push_info(info) \
421 CRYPTO_push_info_(info, NULL, 0); 377 CRYPTO_push_info_(info, NULL, 0);
422int CRYPTO_push_info_(const char *info, const char *file, int line); 378int CRYPTO_push_info_(const char *info, const char *file, int line);
423int CRYPTO_pop_info(void); 379int CRYPTO_pop_info(void);
424int CRYPTO_remove_all_info(void); 380int CRYPTO_remove_all_info(void);
425 381
426
427/* Default debugging functions (enabled by CRYPTO_malloc_debug_init() macro;
428 * used as default in CRYPTO_MDEBUG compilations): */
429/* The last argument has the following significance:
430 *
431 * 0: called before the actual memory allocation has taken place
432 * 1: called after the actual memory allocation has taken place
433 */
434void CRYPTO_dbg_malloc(void *addr, int num, const char *file, int line, int before_p)
435 __attribute__ ((deprecated));
436void CRYPTO_dbg_realloc(void *addr1, void *addr2, int num, const char *file, int line, int before_p)
437 __attribute__ ((deprecated));
438void CRYPTO_dbg_free(void *addr, int before_p)
439 __attribute__ ((deprecated));
440/* Tell the debugging code about options. By default, the following values
441 * apply:
442 *
443 * 0: Clear all options.
444 * V_CRYPTO_MDEBUG_TIME (1): Set the "Show Time" option.
445 * V_CRYPTO_MDEBUG_THREAD (2): Set the "Show Thread Number" option.
446 * V_CRYPTO_MDEBUG_ALL (3): 1 + 2
447 */
448void CRYPTO_dbg_set_options(long bits)
449 __attribute__ ((deprecated));
450long CRYPTO_dbg_get_options(void)
451 __attribute__ ((deprecated));
452
453
454int CRYPTO_mem_leaks_fp(FILE *);
455int CRYPTO_mem_leaks(struct bio_st *bio);
456/* unsigned long order, char *file, int line, int num_bytes, char *addr */
457typedef int *CRYPTO_MEM_LEAK_CB(unsigned long, const char *, int, int, void *);
458int CRYPTO_mem_leaks_cb(CRYPTO_MEM_LEAK_CB *cb);
459
460/* 382/*
461 * Because this is a public header, use a portable method of indicating the 383 * Because this is a public header, use a portable method of indicating the
462 * function does not return, rather than __dead. 384 * function does not return, rather than __dead.