From 7d3c502c47fa052da55af65f2872e32d52b5bd93 Mon Sep 17 00:00:00 2001 From: Jacob Barthelmeh Date: Tue, 9 Jan 2018 12:06:43 -0700 Subject: [PATCH] add dh header to test.h and adjust macro gaurds --- src/ssl.c | 46 +++++++++++++++++++++++----------------------- wolfssl/test.h | 3 +++ 2 files changed, 26 insertions(+), 23 deletions(-) diff --git a/src/ssl.c b/src/ssl.c index a4a8a8791..44a423b0a 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -23864,29 +23864,6 @@ void* wolfSSL_GetEccSharedSecretCtx(WOLFSSL* ssl) } #endif /* HAVE_ECC */ -#ifndef NO_DH - -void wolfSSL_CTX_SetDhAgreeCb(WOLFSSL_CTX* ctx, CallbackDhAgree cb) -{ - if (ctx) - ctx->DhAgreeCb = cb; -} - -void wolfSSL_SetDhAgreeCtx(WOLFSSL* ssl, void *ctx) -{ - if (ssl) - ssl->DhAgreeCtx = ctx; -} - -void* wolfSSL_GetDhAgreeCtx(WOLFSSL* ssl) -{ - if (ssl) - return ssl->DhAgreeCtx; - - return NULL; -} -#endif /* !NO_DH */ - #ifdef HAVE_ED25519 void wolfSSL_CTX_SetEd25519SignCb(WOLFSSL_CTX* ctx, CallbackEd25519Sign cb) { @@ -24102,6 +24079,29 @@ void* wolfSSL_GetRsaDecCtx(WOLFSSL* ssl) #endif /* HAVE_PK_CALLBACKS */ #endif /* NO_CERTS */ +#if defined(HAVE_PK_CALLBACKS) && !defined(NO_DH) + +void wolfSSL_CTX_SetDhAgreeCb(WOLFSSL_CTX* ctx, CallbackDhAgree cb) +{ + if (ctx) + ctx->DhAgreeCb = cb; +} + +void wolfSSL_SetDhAgreeCtx(WOLFSSL* ssl, void *ctx) +{ + if (ssl) + ssl->DhAgreeCtx = ctx; +} + +void* wolfSSL_GetDhAgreeCtx(WOLFSSL* ssl) +{ + if (ssl) + return ssl->DhAgreeCtx; + + return NULL; +} +#endif /* HAVE_PK_CALLBACKS && !NO_DH */ + #ifdef WOLFSSL_HAVE_WOLFSCEP /* Used by autoconf to see if wolfSCEP is available */ diff --git a/wolfssl/test.h b/wolfssl/test.h index 376d54532..67855b9df 100644 --- a/wolfssl/test.h +++ b/wolfssl/test.h @@ -24,6 +24,9 @@ #ifdef HAVE_ECC #include #endif /* HAVE_ECC */ + #ifndef NO_DH + #include + #endif /* !NO_DH */ #ifdef HAVE_ED25519 #include #endif /* HAVE_ED25519 */