RT41897: Add an CRYPTO_secure_actual_size

This is already documented, I just forgot to include the code :)

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
This commit is contained in:
Rich Salz 2016-01-07 16:05:45 -05:00 committed by Rich Salz
parent f820b79248
commit d594199bb4
3 changed files with 19 additions and 0 deletions

View file

@ -157,6 +157,19 @@ size_t CRYPTO_secure_used()
#endif /* IMPLEMENTED */
}
size_t CRYPTO_secure_actual_size(void *ptr)
{
#ifdef IMPLEMENTED
size_t actual_size;
LOCK();
actual_size = sh_actual_size(ptr);
UNLOCK();
return actual_size;
#else
return 0;
#endif
}
/* END OF PAGE ...
... START OF PAGE */

View file

@ -327,6 +327,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)
@ -350,6 +352,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
@ -490,6 +494,7 @@ 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);

View file

@ -4723,3 +4723,4 @@ CRYPTO_clear_realloc 5117 1_1_0 EXIST::FUNCTION:
CRYPTO_mem_debug_push 5118 1_1_0 EXIST::FUNCTION:CRYPTO_MDEBUG
CRYPTO_set_mem_debug 5119 1_1_0 EXIST::FUNCTION:
CRYPTO_mem_debug_pop 5120 1_1_0 EXIST::FUNCTION:CRYPTO_MDEBUG
CRYPTO_secure_actual_size 5121 1_1_0 EXIST::FUNCTION: