[Sound-open-firmware] [PATCH] rimage: openssl: fix build for openssl 1.1.0

Liam Girdwood liam.r.girdwood at linux.intel.com
Thu May 10 22:31:31 CEST 2018


Openssl 1.1.0 is latest stable version with minor API differences.

Signed-off-by: Liam Girdwood <liam.r.girdwood at linux.intel.com>
---
 rimage/hash.c    | 4 ++--
 rimage/pkcs1_5.c | 7 +++++--
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/rimage/hash.c b/rimage/hash.c
index d586e07f..2905d893 100644
--- a/rimage/hash.c
+++ b/rimage/hash.c
@@ -35,7 +35,7 @@
 void module_sha256_create(struct image *image)
 {
 	image->md = EVP_sha256();
-	image->mdctx = EVP_MD_CTX_create();
+	image->mdctx = EVP_MD_CTX_new();
 
 	EVP_DigestInit_ex(image->mdctx, image->md, NULL);
 }
@@ -53,7 +53,7 @@ void module_sha256_complete(struct image *image, uint8_t *hash)
 	int i;
 #endif
 	EVP_DigestFinal_ex(image->mdctx, md_value, &md_len);
-	EVP_MD_CTX_destroy(image->mdctx);
+	EVP_MD_CTX_free(image->mdctx);
 
 	memcpy(hash, md_value, md_len);
 #if DEBUG_HASH
diff --git a/rimage/pkcs1_5.c b/rimage/pkcs1_5.c
index 64a4b250..7df531bf 100644
--- a/rimage/pkcs1_5.c
+++ b/rimage/pkcs1_5.c
@@ -21,6 +21,7 @@
 #include <openssl/bio.h>
 #include <openssl/sha.h>
 #include <openssl/objects.h>
+#include <openssl/bn.h>
 #include <stdio.h>
 #include <errno.h>
 
@@ -56,6 +57,7 @@ int pkcs_sign(struct image *image, struct fw_image_manifest *man,
 	RSA *priv_rsa = NULL;
 	EVP_PKEY *privkey;
 	FILE *fp;
+	const BIGNUM *n, *e, *d;
 	unsigned char digest[SHA256_DIGEST_LENGTH], mod[MAN_RSA_KEY_MODULUS_LEN];
 	unsigned int siglen = MAN_RSA_SIGNATURE_LEN;
 	char path[256];
@@ -114,8 +116,9 @@ int pkcs_sign(struct image *image, struct fw_image_manifest *man,
 		fprintf(stderr, "error: failed to sign manifest\n");
 
 	/* copy public key modulus and exponent to manifest */
-	BN_bn2bin(priv_rsa->n, mod);
-	BN_bn2bin(priv_rsa->e, (unsigned char *)man->css.exponent);
+	RSA_get0_key(priv_rsa, &n, &e, &d);
+	BN_bn2bin(n, mod);
+	BN_bn2bin(e, (unsigned char *)man->css.exponent);
 
 	/* modulus is reveresd  */
 	for (i = 0; i < MAN_RSA_KEY_MODULUS_LEN; i++)
-- 
2.17.0



More information about the Sound-open-firmware mailing list