fix jpaketest and correct comment
[openssl.git] / include / openssl / crypto.h
index a85b02125300d9b157f5ca91d7de6deaa6dbb4ec..a32f373724a55b6db05e661268296ad88d4878cf 100644 (file)
@@ -249,10 +249,10 @@ typedef struct {
  * The following can be used to detect memory leaks in the library. If
  * used, it turns on malloc checking
  */
-# define CRYPTO_MEM_CHECK_OFF     0x0
-# define CRYPTO_MEM_CHECK_ON      0x1
-# define CRYPTO_MEM_CHECK_ENABLE  0x2
-# define CRYPTO_MEM_CHECK_DISABLE 0x3
+# define CRYPTO_MEM_CHECK_OFF     0x0   /* Control only */
+# define CRYPTO_MEM_CHECK_ON      0x1   /* Control and mode bit */
+# define CRYPTO_MEM_CHECK_ENABLE  0x2   /* Control and mode bit */
+# define CRYPTO_MEM_CHECK_DISABLE 0x3   /* Control only */
 
 /* predec of the BIO type */
 typedef struct bio_st BIO_dummy;
@@ -291,19 +291,9 @@ DEFINE_STACK_OF(void)
 #define OPENSSL_malloc_init() \
     CRYPTO_set_mem_functions(CRYPTO_malloc, CRYPTO_realloc, CRYPTO_free)
 
-/*
- * Set standard debugging functions (not done by default unless CRYPTO_MDEBUG
- * is defined)
- */
-# if defined CRYPTO_MDEBUG_ABORT
-#  ifndef CRYPTO_MDEBUG
-#   define CRYPTO_MDEBUG
-#  endif
-# endif
-
 int CRYPTO_mem_ctrl(int mode);
 
-# ifdef CRYPTO_MDEBUG
+# ifndef OPENSSL_NO_CRYPTO_MDEBUG
 #  define OPENSSL_malloc(num) \
         CRYPTO_malloc(num, __FILE__, __LINE__)
 #  define OPENSSL_zalloc(num) \
@@ -326,6 +316,8 @@ int CRYPTO_mem_ctrl(int mode);
         CRYPTO_secure_malloc(num, __FILE__, __LINE__)
 #  define OPENSSL_secure_free(addr) \
         CRYPTO_secure_free(addr)
+#  define OPENSSL_secure_actual_size(ptr) \
+        CRYPTO_secure_actual_size(ptr)
 # else
 #  define OPENSSL_malloc(num) \
         CRYPTO_malloc(num, NULL, 0)
@@ -349,6 +341,8 @@ int CRYPTO_mem_ctrl(int mode);
         CRYPTO_secure_malloc(num, NULL, 0)
 #  define OPENSSL_secure_free(addr) \
         CRYPTO_secure_free(addr)
+#  define OPENSSL_secure_actual_size(ptr) \
+        CRYPTO_secure_actual_size(ptr)
 
 # endif
 
@@ -431,13 +425,7 @@ int CRYPTO_THREADID_cmp(const CRYPTO_THREADID *a, const CRYPTO_THREADID *b);
 void CRYPTO_THREADID_cpy(CRYPTO_THREADID *dest, const CRYPTO_THREADID *src);
 unsigned long CRYPTO_THREADID_hash(const CRYPTO_THREADID *id);
 DEPRECATEDIN_1_0_0(void CRYPTO_set_id_callback(unsigned long (*func) (void)))
-/*
- * mkdef.pl cannot handle this next one so not inside DEPRECATEDIN_1_0_0,
- * but still conditional on a lower or unknown source API version.
- */
-# if OPENSSL_API_COMPAT < 0x10000000L
-unsigned long (*CRYPTO_get_id_callback(void)) (void);
-# endif
+DEPRECATEDIN_1_0_0(unsigned long (*CRYPTO_get_id_callback(void)) (void))
 DEPRECATEDIN_1_0_0(unsigned long CRYPTO_thread_id(void))
 
 const char *CRYPTO_get_lock_name(int type);
@@ -495,19 +483,21 @@ void *CRYPTO_secure_malloc(size_t num, const char *file, int line);
 void CRYPTO_secure_free(void *ptr);
 int CRYPTO_secure_allocated(const void *ptr);
 int CRYPTO_secure_malloc_initialized(void);
+size_t CRYPTO_secure_actual_size(void *ptr);
 size_t CRYPTO_secure_used(void);
 
 void OPENSSL_cleanse(void *ptr, size_t len);
 
-# define OPENSSL_mem_debug_push(info) \
+# ifndef OPENSSL_NO_CRYPTO_MDEBUG
+#  define OPENSSL_mem_debug_push(info) \
         CRYPTO_mem_debug_push(info, __FILE__, __LINE__)
-# define OPENSSL_mem_debug_pop() \
+#  define OPENSSL_mem_debug_pop() \
         CRYPTO_mem_debug_pop()
 int CRYPTO_mem_debug_push(const char *info, const char *file, int line);
 int CRYPTO_mem_debug_pop(void);
 
 /*-
- * Debugging functions (enabled by CRYPTO_set_mem_debug_functions(1))
+ * Debugging functions (enabled by CRYPTO_set_mem_debug(1))
  * The flag 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
@@ -518,10 +508,11 @@ void CRYPTO_mem_debug_realloc(void *addr1, void *addr2, size_t num, int flag,
         const char *file, int line);
 void CRYPTO_mem_debug_free(void *addr, int flag);
 
-# ifndef OPENSSL_NO_STDIO
-void CRYPTO_mem_leaks_fp(FILE *);
+#  ifndef OPENSSL_NO_STDIO
+int CRYPTO_mem_leaks_fp(FILE *);
+#  endif
+int CRYPTO_mem_leaks(struct bio_st *bio);
 # endif
-void CRYPTO_mem_leaks(struct bio_st *bio);
 
 /* die if we have to */
 void OpenSSLDie(const char *file, int line, const char *assertion);