summaryrefslogtreecommitdiff
path: root/ssl/ssl_locl.h
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2014-07-23 13:18:06 +0100
committerJanusz Kozerski <j.kozerski@samsung.com>2014-10-20 15:25:32 +0200
commit14008ec5123d465333de63310729f5008410a411 (patch)
tree7df271b3dcedf380c8accd7272922406e0a66b51 /ssl/ssl_locl.h
parentae25ee5cb1f4bb7ae9c83bddef98735ba271e4cb (diff)
downloadopenssl-14008ec5123d465333de63310729f5008410a411.tar.gz
openssl-14008ec5123d465333de63310729f5008410a411.tar.bz2
openssl-14008ec5123d465333de63310729f5008410a411.zip
Add conditional unit testing interface.
Don't call internal functions directly call them through SSL_test_functions(). This also makes unit testing work on Windows and platforms that don't export internal functions from shared libraries. By default unit testing is not enabled: it requires the compile time option "enable-unit-test". Reviewed-by: Geoff Thorpe <geoff@openssl.org> (cherry picked from commit e0fc7961c4fbd27577fb519d9aea2dc788742715) Conflicts: ssl/Makefile util/mkdef.pl
Diffstat (limited to 'ssl/ssl_locl.h')
-rw-r--r--ssl/ssl_locl.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/ssl/ssl_locl.h b/ssl/ssl_locl.h
index 97cde40..1dcce42 100644
--- a/ssl/ssl_locl.h
+++ b/ssl/ssl_locl.h
@@ -810,6 +810,16 @@ const SSL_METHOD *func_name(void) \
return &func_name##_data; \
}
+struct openssl_ssl_test_functions
+ {
+ int (*p_ssl_init_wbio_buffer)(SSL *s, int push);
+ int (*p_ssl3_setup_buffers)(SSL *s);
+ int (*p_tls1_process_heartbeat)(SSL *s);
+ int (*p_dtls1_process_heartbeat)(SSL *s);
+ };
+
+#ifndef OPENSSL_UNIT_TEST
+
void ssl_clear_cipher_ctx(SSL *s);
int ssl_clear_bad_session(SSL *s);
CERT *ssl_cert_new(void);
@@ -1174,5 +1184,12 @@ void ssl3_cbc_digest_record(
void tls_fips_digest_extra(
const EVP_CIPHER_CTX *cipher_ctx, EVP_MD_CTX *mac_ctx,
const unsigned char *data, size_t data_len, size_t orig_len);
+#else
+
+#define ssl_init_wbio_buffer SSL_test_functions()->p_ssl_init_wbio_buffer
+#define ssl3_setup_buffers SSL_test_functions()->p_ssl3_setup_buffers
+#define tls1_process_heartbeat SSL_test_functions()->p_tls1_process_heartbeat
+#define dtls1_process_heartbeat SSL_test_functions()->p_dtls1_process_heartbeat
#endif
+#endif