mirror of https://github.com/thesofproject/sof.git
rimage: openssl: fix build for openssl 1.1.0
Openssl 1.1.0 is latest stable version with minor API differences. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
This commit is contained in:
parent
b199485177
commit
8aedb1c3e7
|
@ -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
|
||||
|
|
|
@ -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++)
|
||||
|
|
Loading…
Reference in New Issue