diff options
author | Xin LI <delphij@FreeBSD.org> | 2016-12-22 16:19:05 +0000 |
---|---|---|
committer | Xin LI <delphij@FreeBSD.org> | 2016-12-22 16:19:05 +0000 |
commit | 2a3488342441b3296995c8a9eca705a468d0eff0 (patch) | |
tree | 0ddd6422cb1fb658884e045a0527f7a24e4df58e /contrib/ntp/libntp/ssl_init.c | |
parent | 59570923bc07f0e74f90b47bd0e10dc5db508d4a (diff) |
Notes
Diffstat (limited to 'contrib/ntp/libntp/ssl_init.c')
-rw-r--r-- | contrib/ntp/libntp/ssl_init.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/contrib/ntp/libntp/ssl_init.c b/contrib/ntp/libntp/ssl_init.c index a9d1d546dfb8..ef0f1c185a88 100644 --- a/contrib/ntp/libntp/ssl_init.c +++ b/contrib/ntp/libntp/ssl_init.c @@ -15,6 +15,7 @@ #ifdef OPENSSL #include "openssl/err.h" #include "openssl/evp.h" +#include "libssl_compat.h" void atexit_ssl_cleanup(void); @@ -62,6 +63,7 @@ ssl_check_version(void) INIT_SSL(); } + #endif /* OPENSSL */ @@ -84,7 +86,6 @@ keytype_from_text( u_char digest[EVP_MAX_MD_SIZE]; char * upcased; char * pch; - EVP_MD_CTX ctx; /* * OpenSSL digest short names are capitalized, so uppercase the @@ -110,8 +111,12 @@ keytype_from_text( if (NULL != pdigest_len) { #ifdef OPENSSL - EVP_DigestInit(&ctx, EVP_get_digestbynid(key_type)); - EVP_DigestFinal(&ctx, digest, &digest_len); + EVP_MD_CTX *ctx; + + ctx = EVP_MD_CTX_new(); + EVP_DigestInit(ctx, EVP_get_digestbynid(key_type)); + EVP_DigestFinal(ctx, digest, &digest_len); + EVP_MD_CTX_free(ctx); if (digest_len > max_digest_len) { fprintf(stderr, "key type %s %u octet digests are too big, max %lu\n", |