[openssl-commits] [openssl] master update

Rich Salz rsalz at openssl.org
Sun Jan 10 00:13:35 UTC 2016


The branch master has been updated
       via  d594199bb47362306060db0e185582ffcfd7b6a6 (commit)
      from  f820b79248140419c1c2ced9873aa1d78b665a76 (commit)


- Log -----------------------------------------------------------------
commit d594199bb47362306060db0e185582ffcfd7b6a6
Author: Rich Salz <rsalz at akamai.com>
Date:   Thu Jan 7 16:05:45 2016 -0500

    RT41897: Add an CRYPTO_secure_actual_size
    
    This is already documented, I just forgot to include the code :)
    
    Reviewed-by: Viktor Dukhovni <viktor at openssl.org>

-----------------------------------------------------------------------

Summary of changes:
 crypto/mem_sec.c         | 13 +++++++++++++
 include/openssl/crypto.h |  5 +++++
 util/libeay.num          |  1 +
 3 files changed, 19 insertions(+)

diff --git a/crypto/mem_sec.c b/crypto/mem_sec.c
index 5f4f733..9adc124 100644
--- a/crypto/mem_sec.c
+++ b/crypto/mem_sec.c
@@ -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 */
diff --git a/include/openssl/crypto.h b/include/openssl/crypto.h
index e8b9fcb..2d1a983 100644
--- a/include/openssl/crypto.h
+++ b/include/openssl/crypto.h
@@ -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);
diff --git a/util/libeay.num b/util/libeay.num
index d71e980..1af1a2e 100755
--- a/util/libeay.num
+++ b/util/libeay.num
@@ -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:


More information about the openssl-commits mailing list