aboutsummaryrefslogtreecommitdiff
path: root/libstb
diff options
context:
space:
mode:
Diffstat (limited to 'libstb')
-rw-r--r--libstb/secvar/backend/edk2-compat-process.c22
-rw-r--r--libstb/secvar/test/data/pkcs7_sha512.h181
-rw-r--r--libstb/secvar/test/secvar-test-edk2-compat.c13
3 files changed, 216 insertions, 0 deletions
diff --git a/libstb/secvar/backend/edk2-compat-process.c b/libstb/secvar/backend/edk2-compat-process.c
index 037c1b4..f36cc97 100644
--- a/libstb/secvar/backend/edk2-compat-process.c
+++ b/libstb/secvar/backend/edk2-compat-process.c
@@ -11,6 +11,7 @@
#include <stdint.h>
#include <ccan/endian/endian.h>
#include <mbedtls/error.h>
+#include <mbedtls/oid.h>
#include <device.h>
#include <assert.h>
#include "libstb/crypto/pkcs7/pkcs7.h"
@@ -460,6 +461,7 @@ static int verify_signature(const struct efi_variable_authentication_2 *auth,
{
mbedtls_pkcs7 *pkcs7 = NULL;
mbedtls_x509_crt x509;
+ mbedtls_md_type_t md_alg;
char *signing_cert = NULL;
char *x509_buf = NULL;
int signing_cert_size;
@@ -478,6 +480,25 @@ static int verify_signature(const struct efi_variable_authentication_2 *auth,
if (!pkcs7)
return OPAL_PARAMETER;
+ /*
+ * We only support sha256, which has a hash length of 32.
+ * If the alg is not sha256, then we should bail now.
+ */
+ rc = mbedtls_oid_get_md_alg(&pkcs7->signed_data.digest_alg_identifiers,
+ &md_alg);
+ if (rc != 0) {
+ prlog(PR_ERR, "Failed to get the Digest Algorithm Identifier: %d\n", rc);
+ rc = OPAL_PARAMETER;
+ goto err_pkcs7;
+ }
+
+ if (md_alg != MBEDTLS_MD_SHA256) {
+ prlog(PR_ERR, "Unexpected digest algorithm: expected %d (SHA-256), got %d\n",
+ MBEDTLS_MD_SHA256, md_alg);
+ rc = OPAL_PARAMETER;
+ goto err_pkcs7;
+ }
+
prlog(PR_INFO, "Load the signing certificate from the keystore");
eslvarsize = avar->data_size;
@@ -562,6 +583,7 @@ static int verify_signature(const struct efi_variable_authentication_2 *auth,
}
free(signing_cert);
+err_pkcs7:
mbedtls_pkcs7_free(pkcs7);
free(pkcs7);
diff --git a/libstb/secvar/test/data/pkcs7_sha512.h b/libstb/secvar/test/data/pkcs7_sha512.h
new file mode 100644
index 0000000..bd120b1
--- /dev/null
+++ b/libstb/secvar/test/data/pkcs7_sha512.h
@@ -0,0 +1,181 @@
+unsigned char pkcs7_sha512[] = {
+ 0xe5, 0x07, 0x06, 0x18, 0x12, 0x0e, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xe8, 0x04, 0x00, 0x00, 0x00, 0x02, 0xf1, 0x0e,
+ 0x9d, 0xd2, 0xaf, 0x4a, 0xdf, 0x68, 0xee, 0x49, 0x8a, 0xa9, 0x34, 0x7d,
+ 0x37, 0x56, 0x65, 0xa7, 0x30, 0x82, 0x04, 0xcc, 0x06, 0x09, 0x2a, 0x86,
+ 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x07, 0x02, 0xa0, 0x82, 0x04, 0xbd, 0x30,
+ 0x82, 0x04, 0xb9, 0x02, 0x01, 0x01, 0x31, 0x0d, 0x30, 0x0b, 0x06, 0x09,
+ 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x03, 0x30, 0x0b, 0x06,
+ 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x07, 0x01, 0xa0, 0x82,
+ 0x03, 0x2d, 0x30, 0x82, 0x03, 0x29, 0x30, 0x82, 0x02, 0x11, 0xa0, 0x03,
+ 0x02, 0x01, 0x02, 0x02, 0x14, 0x6b, 0x7b, 0x12, 0xf0, 0xc6, 0x66, 0x78,
+ 0x78, 0xa1, 0xa2, 0xe8, 0x79, 0x4b, 0x31, 0xa5, 0xa8, 0x9e, 0x58, 0x7a,
+ 0x41, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01,
+ 0x01, 0x0b, 0x05, 0x00, 0x30, 0x24, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03,
+ 0x55, 0x04, 0x06, 0x13, 0x02, 0x4e, 0x43, 0x31, 0x15, 0x30, 0x13, 0x06,
+ 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x0c, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e,
+ 0x67, 0x20, 0x63, 0x6f, 0x72, 0x70, 0x30, 0x1e, 0x17, 0x0d, 0x32, 0x30,
+ 0x31, 0x30, 0x31, 0x36, 0x31, 0x39, 0x30, 0x38, 0x30, 0x35, 0x5a, 0x17,
+ 0x0d, 0x32, 0x30, 0x31, 0x31, 0x31, 0x35, 0x31, 0x39, 0x30, 0x38, 0x30,
+ 0x35, 0x5a, 0x30, 0x24, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04,
+ 0x06, 0x13, 0x02, 0x4e, 0x43, 0x31, 0x15, 0x30, 0x13, 0x06, 0x03, 0x55,
+ 0x04, 0x0a, 0x0c, 0x0c, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x20,
+ 0x63, 0x6f, 0x72, 0x70, 0x30, 0x82, 0x01, 0x22, 0x30, 0x0d, 0x06, 0x09,
+ 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03,
+ 0x82, 0x01, 0x0f, 0x00, 0x30, 0x82, 0x01, 0x0a, 0x02, 0x82, 0x01, 0x01,
+ 0x00, 0xcf, 0xf3, 0x6e, 0xc9, 0xaf, 0x12, 0x42, 0xdb, 0xa9, 0x59, 0x6d,
+ 0xef, 0xf6, 0x0e, 0x54, 0xe8, 0x21, 0x57, 0xc4, 0x78, 0x3f, 0x6d, 0x83,
+ 0x37, 0x1a, 0x29, 0x10, 0xd2, 0xb8, 0xb7, 0x24, 0x49, 0x5f, 0x5f, 0x32,
+ 0xc9, 0x39, 0xdc, 0x40, 0xa4, 0x5d, 0xea, 0x7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17, 0x0d, 0x32, 0x30, 0x31, 0x30, 0x31, 0x36, 0x31, 0x39,
+ 0x30, 0x38, 0x30, 0x37, 0x5a, 0x17, 0x0d, 0x32, 0x30, 0x31, 0x31, 0x31,
+ 0x35, 0x31, 0x39, 0x30, 0x38, 0x30, 0x37, 0x5a, 0x30, 0x24, 0x31, 0x0b,
+ 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x4e, 0x43, 0x31,
+ 0x15, 0x30, 0x13, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x0c, 0x74, 0x65,
+ 0x73, 0x74, 0x69, 0x6e, 0x67, 0x20, 0x63, 0x6f, 0x72, 0x70, 0x30, 0x82,
+ 0x01, 0x22, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d,
+ 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x82, 0x01, 0x0f, 0x00, 0x30, 0x82,
+ 0x01, 0x0a, 0x02, 0x82, 0x01, 0x01, 0x00, 0xde, 0x05, 0xb4, 0x0a, 0x74,
+ 0x02, 0x1d, 0x88, 0x92, 0x6b, 0x58, 0x72, 0x77, 0xf4, 0xa0, 0x71, 0x69,
+ 0xf4, 0x9f, 0x24, 0x00, 0xab, 0x7f, 0x62, 0x39, 0xfb, 0x56, 0xd0, 0x4c,
+ 0xc5, 0xb1, 0x7e, 0x16, 0x7f, 0x44, 0xfb, 0xc9, 0x9d, 0xb6, 0x7c, 0x9e,
+ 0x86, 0x38, 0xc2, 0x56, 0x4e, 0x39, 0x7a, 0x2b, 0x79, 0xbf, 0x4b, 0x2e,
+ 0xe1, 0x49, 0xd6, 0xce, 0x62, 0x44, 0xc1, 0xbc, 0xbe, 0x12, 0x98, 0xfd,
+ 0x62, 0x51, 0x29, 0x1d, 0x66, 0xd1, 0x71, 0x6e, 0x2c, 0xfb, 0xa9, 0x19,
+ 0x11, 0xac, 0x01, 0xee, 0x3a, 0xd4, 0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 0x22,
+ 0xed, 0x9f, 0xea, 0x87, 0x6c
+};
+unsigned int pkcs7_sha512_len = 2129;
diff --git a/libstb/secvar/test/secvar-test-edk2-compat.c b/libstb/secvar/test/secvar-test-edk2-compat.c
index 8259ffa..87c3fe3 100644
--- a/libstb/secvar/test/secvar-test-edk2-compat.c
+++ b/libstb/secvar/test/secvar-test-edk2-compat.c
@@ -22,6 +22,7 @@
#include "./data/dbxcert.h"
#include "./data/dbxsha512.h"
#include "./data/dbxmalformed.h"
+#include "./data/pkcs7_sha512.h"
bool test_hw_key_hash = false;
@@ -383,6 +384,18 @@ int run_test()
ASSERT(0 != tmp->data_size);
ASSERT(!setup_mode);
+ /* updates with pkcs#7 messages with sha512 hashes should be rejected */
+ printf("Add db where auth has sha512 in PKCS#7\n");
+ tmp = new_secvar("db", 3, pkcs7_sha512, pkcs7_sha512_len, 0);
+ ASSERT(0 == edk2_compat_validate(tmp));
+ list_add_tail(&update_bank, &tmp->link);
+ ASSERT(1 == list_length(&update_bank));
+
+ rc = edk2_compat_process(&variable_bank, &update_bank);
+ ASSERT(OPAL_PARAMETER == rc);
+ ASSERT(5 == list_length(&variable_bank));
+ ASSERT(0 == list_length(&update_bank));
+
/* Delete PK. */
printf("Delete PK\n");
/* Add hw_key_hash explicitly to ensure it is deleted as part of PK deletion. */