From 4b41056970264494a9b5b45eaa4b99b99aa72845 Mon Sep 17 00:00:00 2001 From: Lans Zhang Date: Wed, 16 Aug 2017 10:12:21 +0800 Subject: [PATCH] sbsigntool: fix build failure with openssl-1.0.x Signed-off-by: Lans Zhang --- .../sbsigntool/sbsigntool-native_git.bb | 2 +- ...d-ASN1_STRING_data-in-openssl-1.1.0.patch} | 40 +++++++++++++++---- 2 files changed, 33 insertions(+), 9 deletions(-) rename meta-efi-secure-boot/recipes-devtools/sbsigntool/sbsigntool/{Fix-the-deprecated-ASN1_STRING_data.patch => Fix-the-deprecated-ASN1_STRING_data-in-openssl-1.1.0.patch} (61%) diff --git a/meta-efi-secure-boot/recipes-devtools/sbsigntool/sbsigntool-native_git.bb b/meta-efi-secure-boot/recipes-devtools/sbsigntool/sbsigntool-native_git.bb index 431144a..f52b5fc 100644 --- a/meta-efi-secure-boot/recipes-devtools/sbsigntool/sbsigntool-native_git.bb +++ b/meta-efi-secure-boot/recipes-devtools/sbsigntool/sbsigntool-native_git.bb @@ -19,7 +19,7 @@ SRC_URI = "\ file://Fix-for-multi-sign.patch \ file://sbsign-add-x-option-to-avoid-overwrite-existing-sign.patch \ file://image-fix-the-segment-fault-caused-by-the-uninitiali.patch \ - file://Fix-the-deprecated-ASN1_STRING_data.patch \ + file://Fix-the-deprecated-ASN1_STRING_data-in-openssl-1.1.0.patch \ file://Update-OpenSSL-API-usage-to-support-OpenSSL-1.1.patch \ " SRCREV="951ee95a301674c046f55330cd7460e1314deff2" diff --git a/meta-efi-secure-boot/recipes-devtools/sbsigntool/sbsigntool/Fix-the-deprecated-ASN1_STRING_data.patch b/meta-efi-secure-boot/recipes-devtools/sbsigntool/sbsigntool/Fix-the-deprecated-ASN1_STRING_data-in-openssl-1.1.0.patch similarity index 61% rename from meta-efi-secure-boot/recipes-devtools/sbsigntool/sbsigntool/Fix-the-deprecated-ASN1_STRING_data.patch rename to meta-efi-secure-boot/recipes-devtools/sbsigntool/sbsigntool/Fix-the-deprecated-ASN1_STRING_data-in-openssl-1.1.0.patch index 6ffbde2..3619945 100644 --- a/meta-efi-secure-boot/recipes-devtools/sbsigntool/sbsigntool/Fix-the-deprecated-ASN1_STRING_data.patch +++ b/meta-efi-secure-boot/recipes-devtools/sbsigntool/sbsigntool/Fix-the-deprecated-ASN1_STRING_data-in-openssl-1.1.0.patch @@ -1,16 +1,17 @@ -From c5d321ded2020441b0d064e03b7b07358d3f71da Mon Sep 17 00:00:00 2001 +From 6ef94a67490176a6d84b4968f303e6d1c51a49ce Mon Sep 17 00:00:00 2001 From: Lans Zhang -Date: Tue, 15 Aug 2017 10:55:40 +0800 -Subject: [PATCH] Fix the deprecated ASN1_STRING_data() +Date: Wed, 16 Aug 2017 10:09:43 +0800 +Subject: [PATCH] Fix the deprecated ASN1_STRING_data() in openssl-1.1.0 Signed-off-by: Lans Zhang --- src/idc.c | 4 ++-- - src/sbkeysync.c | 2 +- - 2 files changed, 3 insertions(+), 3 deletions(-) + src/idc.h | 4 ++++ + src/sbkeysync.c | 3 ++- + 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/idc.c b/src/idc.c -index 236cefd..8feaa11 100644 +index 236cefd..7f99a53 100644 --- a/src/idc.c +++ b/src/idc.c @@ -238,7 +238,7 @@ struct idc *IDC_get(PKCS7 *p7, BIO *bio) @@ -31,11 +32,34 @@ index 236cefd..8feaa11 100644 if (memcmp(buf, sha, sizeof(sha))) { fprintf(stderr, "Hash doesn't match image\n"); fprintf(stderr, " got: %s\n", sha256_str(buf)); +diff --git a/src/idc.h b/src/idc.h +index a6526de..8011237 100644 +--- a/src/idc.h ++++ b/src/idc.h +@@ -36,6 +36,10 @@ + + #include + ++#if OPENSSL_VERSION_NUMBER < 0x10100000L ++#define ASN1_STRING_get0_data ASN1_STRING_data ++#endif ++ + struct idc; + + int IDC_set(PKCS7 *p7, PKCS7_SIGNER_INFO *si, struct image *image); diff --git a/src/sbkeysync.c b/src/sbkeysync.c -index a63d3b8..ef028ef 100644 +index a63d3b8..223a047 100644 --- a/src/sbkeysync.c +++ b/src/sbkeysync.c -@@ -210,7 +210,7 @@ static int x509_key_parse(struct key *key, uint8_t *data, size_t len) +@@ -54,6 +54,7 @@ + + #include "fileio.h" + #include "efivars.h" ++#include "idc.h" + + #define EFIVARS_MOUNTPOINT "/sys/firmware/efi/efivars" + #define PSTORE_FSTYPE 0x6165676C +@@ -210,7 +211,7 @@ static int x509_key_parse(struct key *key, uint8_t *data, size_t len) serial = x509->cert_info->serialNumber; key->id_len = ASN1_STRING_length(serial);