rimage: openssl: add compatibility for openssl 1.1.0

Add compatibility support for openssl 1.0.2 support alongsid with
openssl 1.1.0

References:
https://wiki.openssl.org/index.php/OpenSSL_1.1.0_Changes
Compatibility Layer

Signed-off-by: Pan Xiuli <xiuli.pan@linux.intel.com>
This commit is contained in:
Pan Xiuli 2018-05-14 14:03:52 +08:00 committed by Daniel Leung
parent 82f6d74ee3
commit 82f6bfba4e
2 changed files with 42 additions and 0 deletions

View File

@ -30,6 +30,32 @@
#include "file_format.h"
#include "manifest.h"
#if OPENSSL_VERSION_NUMBER < 0x10100000L
void EVP_MD_CTX_free(EVP_MD_CTX *ctx);
EVP_MD_CTX *EVP_MD_CTX_new(void);
static void *OPENSSL_zalloc(size_t num)
{
void *ret = OPENSSL_malloc(num);
if (ret != NULL)
memset(ret, 0, num);
return ret;
}
EVP_MD_CTX *EVP_MD_CTX_new(void)
{
return OPENSSL_zalloc(sizeof(EVP_MD_CTX));
}
void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
{
EVP_MD_CTX_cleanup(ctx);
OPENSSL_free(ctx);
}
#endif
#define DEBUG_HASH 0
void module_sha256_create(struct image *image)

View File

@ -30,6 +30,22 @@
#include "css.h"
#include "manifest.h"
#if OPENSSL_VERSION_NUMBER < 0x10100000L
void RSA_get0_key(const RSA *r,
const BIGNUM **n, const BIGNUM **e, const BIGNUM **d);
void RSA_get0_key(const RSA *r,
const BIGNUM **n, const BIGNUM **e, const BIGNUM **d)
{
if (n != NULL)
*n = r->n;
if (e != NULL)
*e = r->e;
if (d != NULL)
*d = r->d;
}
#endif
#define DEBUG_PKCS 0
static void bytes_swap(uint8_t *ptr, uint32_t size)