Get kore to at least build with openssl 3

This commit is contained in:
Joris Vink 2021-12-06 21:21:21 +01:00
parent 93bf18be81
commit 06803e2592
3 changed files with 21 additions and 0 deletions

View File

@ -79,6 +79,11 @@ extern int daemon(int, int);
#endif
#endif
/* Ignore deprecation warnings for OpenSSL 3 for now. */
#if defined(OPENSSL_VERSION_MAJOR)
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#if defined(__OpenBSD__)
#define KORE_USE_PLATFORM_PLEDGE 1
#endif

View File

@ -26,6 +26,12 @@
#include <openssl/err.h>
#include <openssl/pem.h>
#include <openssl/x509v3.h>
/* Ignore deprecation warnings for OpenSSL 3 for now. */
#if defined(OPENSSL_VERSION_MAJOR)
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#endif
#include <ctype.h>

View File

@ -689,7 +689,12 @@ keymgr_rsa_encrypt(struct kore_msg *msg, const void *data, struct key *key)
u_int8_t buf[1024];
req = (const struct kore_keyreq *)data;
#if defined(OPENSSL_VERSION_MAJOR)
rsa = EVP_PKEY_get0(key->pkey);
#else
rsa = EVP_PKEY_get0_RSA(key->pkey);
#endif
keylen = RSA_size(rsa);
if (req->data_len > keylen || keylen > sizeof(buf))
@ -713,7 +718,12 @@ keymgr_ecdsa_sign(struct kore_msg *msg, const void *data, struct key *key)
u_int8_t sig[1024];
req = (const struct kore_keyreq *)data;
#if defined(OPENSSL_VERSION_MAJOR)
ec = EVP_PKEY_get0(key->pkey);
#else
ec = EVP_PKEY_get0_EC_KEY(key->pkey);
#endif
len = ECDSA_size(ec);
if (req->data_len > len || len > sizeof(sig))