diff --git a/rimage/hash.c b/rimage/hash.c index 2905d893d..73b6d72df 100644 --- a/rimage/hash.c +++ b/rimage/hash.c @@ -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) diff --git a/rimage/pkcs1_5.c b/rimage/pkcs1_5.c index 0c91df039..d80cf8d57 100644 --- a/rimage/pkcs1_5.c +++ b/rimage/pkcs1_5.c @@ -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)