1 // SPDX-License-Identifier: GPL-2.0-or-later 1 2 /* Self-tests for PKCS#7 ECDSA signature verif 3 * 4 * Copyright (C) 2024 Joachim Vandersmissen <g 5 */ 6 7 #include <linux/module.h> 8 #include "selftest.h" 9 10 /* 11 * Set of X.509 certificates to provide public 12 * be loaded into a temporary keyring for the 13 */ 14 static const u8 certs_selftest_ecdsa_keys[] __ 15 /* P-256 ECDSA certificate */ 16 "\x30\x82\x01\xd4\x30\x82\x01\x7b\xa0\ 17 "\xea\x64\x8d\x7f\x17\xe6\x2e\x9e\x58\ 18 "\xf8\x6f\xde\x30\x0a\x06\x08\x2a\x86\ 19 "\x3a\x31\x38\x30\x36\x06\x03\x55\x04\ 20 "\x69\x66\x69\x63\x61\x74\x65\x20\x76\ 21 "\x74\x69\x6f\x6e\x20\x45\x43\x44\x53\ 22 "\x74\x65\x73\x74\x69\x6e\x67\x20\x6b\ 23 "\x34\x30\x34\x31\x33\x32\x32\x31\x36\ 24 "\x32\x34\x30\x33\x32\x30\x32\x32\x31\ 25 "\x38\x30\x36\x06\x03\x55\x04\x03\x0c\ 26 "\x69\x63\x61\x74\x65\x20\x76\x65\x72\ 27 "\x6f\x6e\x20\x45\x43\x44\x53\x41\x20\ 28 "\x73\x74\x69\x6e\x67\x20\x6b\x65\x79\ 29 "\x86\x48\xce\x3d\x02\x01\x06\x08\x2a\ 30 "\x03\x42\x00\x04\x07\xe5\x6b\x51\xaf\ 31 "\x77\x57\x71\x03\x9e\xe2\xfe\x6e\x6a\ 32 "\x77\x18\x9f\xc2\xe7\x0a\x82\xd0\x8a\ 33 "\xfb\x25\xb9\x5b\x1e\x24\x8c\x73\x9f\ 34 "\x19\xc0\x22\xc6\xa3\x5d\x30\x5b\x30\ 35 "\x16\x04\x14\x29\x00\xbc\xea\x1d\xeb\ 36 "\x75\x8e\xfd\xfd\xd2\xb2\xd3\x30\x1f\ 37 "\x30\x16\x80\x14\x29\x00\xbc\xea\x1d\ 38 "\x3d\x75\x8e\xfd\xfd\xd2\xb2\xd3\x30\ 39 "\x01\xff\x04\x02\x30\x00\x30\x0b\x06\ 40 "\x02\x07\x80\x30\x0a\x06\x08\x2a\x86\ 41 "\x47\x00\x30\x44\x02\x20\x1a\xd7\xac\ 42 "\x7e\xc7\x66\x6e\xa5\x00\x7c\x12\x1d\ 43 "\x26\x5d\xe9\x70\x5c\xb4\x02\x20\x73\ 44 "\x96\x42\x19\xcf\x4f\x67\x4f\x35\x6a\ 45 "\x14\x9d\x79\x69\x1c\x7a\xd7\x5d" 46 }; 47 48 /* 49 * Signed data and detached signature blobs th 50 */ 51 static const u8 certs_selftest_ecdsa_data[] __ 52 "\x54\x68\x69\x73\x20\x69\x73\x20\x73\ 53 "\x74\x20\x64\x61\x74\x61\x20\x75\x73\ 54 "\x73\x65\x6c\x66\x2d\x74\x65\x73\x74\ 55 "\x74\x69\x66\x69\x63\x61\x74\x65\x20\ 56 "\x61\x74\x69\x6f\x6e\x2e\x0a" 57 }; 58 59 static const u8 certs_selftest_ecdsa_sig[] __i 60 /* ECDSA signature using SHA-256 */ 61 "\x30\x81\xf4\x06\x09\x2a\x86\x48\x86\ 62 "\xe6\x30\x81\xe3\x02\x01\x01\x31\x0f\ 63 "\x01\x65\x03\x04\x02\x01\x05\x00\x30\ 64 "\xf7\x0d\x01\x07\x01\x31\x81\xbf\x30\ 65 "\x30\x3a\x31\x38\x30\x36\x06\x03\x55\ 66 "\x74\x69\x66\x69\x63\x61\x74\x65\x20\ 67 "\x61\x74\x69\x6f\x6e\x20\x45\x43\x44\ 68 "\x2d\x74\x65\x73\x74\x69\x6e\x67\x20\ 69 "\x64\x8d\x7f\x17\xe6\x2e\x9e\x58\x69\ 70 "\x6f\xde\x30\x0d\x06\x09\x60\x86\x48\ 71 "\x00\x30\x0a\x06\x08\x2a\x86\x48\xce\ 72 "\x46\x02\x21\x00\x86\xd1\xf4\x06\xb6\ 73 "\x94\x7e\x0e\x1a\x12\x4d\xd9\xe6\x2a\ 74 "\xe0\x35\xf3\xeb\x02\x21\x00\xdf\x11\ 75 "\x43\x94\xe2\xb8\x35\xc9\xf3\x12\x4e\ 76 "\x43\x0a\x5f\xf5\xfd\xa2\xf1" 77 }; 78 79 void __init fips_signature_selftest_ecdsa(void 80 { 81 fips_signature_selftest("ECDSA", 82 certs_selftest 83 sizeof(certs_s 84 certs_selftest 85 sizeof(certs_s 86 certs_selftest 87 sizeof(certs_s 88 } 89
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.