libssl_compat.c (310419) | libssl_compat.c (316722) |
---|---|
1/* 2 * libssl_compat.c -- OpenSSL v1.1 compatibility functions 3 * 4 * --------------------------------------------------------------------- 5 * Written by Juergen Perlinger <perlinger@ntp.org> for the NTP project 6 * 7 * Based on an idea by Kurt Roeckx <kurt@roeckx.be> 8 * 9 * --------------------------------------------------------------------- 10 * This is a clean room implementation of shim functions that have 11 * counterparts in the OpenSSL v1.1 API but not in earlier versions. So 12 * while OpenSSL broke binary compatibility with v1.1, this shim module 13 * should provide the necessary source code compatibility with older 14 * versions of OpenSSL. 15 * --------------------------------------------------------------------- 16 */ 17#include "config.h" | 1/* 2 * libssl_compat.c -- OpenSSL v1.1 compatibility functions 3 * 4 * --------------------------------------------------------------------- 5 * Written by Juergen Perlinger <perlinger@ntp.org> for the NTP project 6 * 7 * Based on an idea by Kurt Roeckx <kurt@roeckx.be> 8 * 9 * --------------------------------------------------------------------- 10 * This is a clean room implementation of shim functions that have 11 * counterparts in the OpenSSL v1.1 API but not in earlier versions. So 12 * while OpenSSL broke binary compatibility with v1.1, this shim module 13 * should provide the necessary source code compatibility with older 14 * versions of OpenSSL. 15 * --------------------------------------------------------------------- 16 */ 17#include "config.h" |
18 19#include <string.h> 20#include <openssl/bn.h> 21#include <openssl/evp.h> 22 | |
23#include "ntp_types.h" 24 25/* ----------------------------------------------------------------- */ | 18#include "ntp_types.h" 19 20/* ----------------------------------------------------------------- */ |
26#if OPENSSL_VERSION_NUMBER < 0x10100000L | 21#ifdef OPENSSL 22# include <string.h> 23# include <openssl/bn.h> 24# include <openssl/evp.h> 25#endif |
27/* ----------------------------------------------------------------- */ 28 | 26/* ----------------------------------------------------------------- */ 27 |
28/* ----------------------------------------------------------------- */ 29#if defined(OPENSSL) && OPENSSL_VERSION_NUMBER < 0x10100000L 30/* ----------------------------------------------------------------- */ 31 |
|
29#include "libssl_compat.h" 30#include "ntp_assert.h" 31 32/* -------------------------------------------------------------------- 33 * replace a BIGNUM owned by the caller with another one if it's not 34 * NULL, taking over the ownership of the new value. This clears & frees 35 * the old value -- the clear might be overkill, but it's better to err 36 * on the side of paranoia here. --- 283 unchanged lines hidden (view full) --- 320sslshim_X509_get_signature_nid( 321 const X509 *x 322 ) 323{ 324 return OBJ_obj2nid(x->sig_alg->algorithm); 325} 326 327/* ----------------------------------------------------------------- */ | 32#include "libssl_compat.h" 33#include "ntp_assert.h" 34 35/* -------------------------------------------------------------------- 36 * replace a BIGNUM owned by the caller with another one if it's not 37 * NULL, taking over the ownership of the new value. This clears & frees 38 * the old value -- the clear might be overkill, but it's better to err 39 * on the side of paranoia here. --- 283 unchanged lines hidden (view full) --- 323sslshim_X509_get_signature_nid( 324 const X509 *x 325 ) 326{ 327 return OBJ_obj2nid(x->sig_alg->algorithm); 328} 329 330/* ----------------------------------------------------------------- */ |
328#else /* OPENSSL_VERSION_NUMBER >= v1.1.0 */ | 331#else /* OPENSSL && OPENSSL_VERSION_NUMBER >= v1.1.0 */ |
329/* ----------------------------------------------------------------- */ 330 331NONEMPTY_TRANSLATION_UNIT 332 333/* ----------------------------------------------------------------- */ 334#endif 335/* ----------------------------------------------------------------- */ | 332/* ----------------------------------------------------------------- */ 333 334NONEMPTY_TRANSLATION_UNIT 335 336/* ----------------------------------------------------------------- */ 337#endif 338/* ----------------------------------------------------------------- */ |