Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[rom] Reduce number of real and fake RSA keys. #22058

Merged
merged 3 commits into from
Mar 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 0 additions & 24 deletions sw/device/silicon_creator/rom/keys/fake/rsa/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,9 @@ cc_library(
name = "rsa",
srcs = [
"dev_key_0_rsa_3072_exp_f4.h",
"dev_key_1_rsa_3072_exp_f4.h",
"prod_key_0_rsa_3072_exp_f4.h",
"prod_key_1_rsa_3072_exp_f4.h",
"prod_key_2_rsa_3072_exp_f4.h",
"sigverify_rsa_keys_fake.c",
"test_key_0_rsa_3072_exp_f4.h",
"test_key_1_rsa_3072_exp_f4.h",
],
deps = [
"//hw/ip/otp_ctrl/data:otp_ctrl_regs",
Expand Down Expand Up @@ -53,32 +49,12 @@ filegroup(
srcs = ["test_key_0_rsa_3072_exp_f4.der"],
)

filegroup(
name = "test_private_key_1",
srcs = ["test_key_1_rsa_3072_exp_f4.der"],
)

filegroup(
name = "dev_private_key_0",
srcs = ["dev_key_0_rsa_3072_exp_f4.der"],
)

filegroup(
name = "dev_private_key_1",
srcs = ["dev_key_1_rsa_3072_exp_f4.der"],
)

filegroup(
name = "prod_private_key_0",
srcs = ["prod_key_0_rsa_3072_exp_f4.der"],
)

filegroup(
name = "prod_private_key_1",
srcs = ["prod_key_1_rsa_3072_exp_f4.der"],
)

filegroup(
name = "prod_private_key_2",
srcs = ["prod_key_2_rsa_3072_exp_f4.der"],
)
Binary file not shown.

This file was deleted.

Binary file not shown.
Binary file not shown.

This file was deleted.

Binary file not shown.
Binary file not shown.

This file was deleted.

Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,8 @@

#include "sw/device/lib/base/macros.h"
#include "sw/device/silicon_creator/rom/keys/fake/rsa/dev_key_0_rsa_3072_exp_f4.h"
#include "sw/device/silicon_creator/rom/keys/fake/rsa/dev_key_1_rsa_3072_exp_f4.h"
#include "sw/device/silicon_creator/rom/keys/fake/rsa/prod_key_0_rsa_3072_exp_f4.h"
#include "sw/device/silicon_creator/rom/keys/fake/rsa/prod_key_1_rsa_3072_exp_f4.h"
#include "sw/device/silicon_creator/rom/keys/fake/rsa/prod_key_2_rsa_3072_exp_f4.h"
#include "sw/device/silicon_creator/rom/keys/fake/rsa/test_key_0_rsa_3072_exp_f4.h"
#include "sw/device/silicon_creator/rom/keys/fake/rsa/test_key_1_rsa_3072_exp_f4.h"
#include "sw/device/silicon_creator/rom/sigverify_keys_rsa.h"

#include "otp_ctrl_regs.h"
Expand All @@ -18,7 +14,7 @@
* Number of RSA public keys.
*/
enum {
kSigverifyRsaKeysCnt_ = 7,
kSigverifyRsaKeysCnt_ = 3,
};
const size_t kSigverifyRsaKeysCnt = kSigverifyRsaKeysCnt_;

Expand All @@ -28,7 +24,7 @@ const size_t kSigverifyRsaKeysCnt = kSigverifyRsaKeysCnt_;
* This must be coprime with and less than `kSigverifyNumRsaKeys`.
* Note: Step size is not applicable when `kSigverifyNumRsaKeys` is 1.
*/
const size_t kSigverifyRsaKeysStep = 5;
const size_t kSigverifyRsaKeysStep = 1;

/**
* Fake public keys for signature verification in tests.
Expand All @@ -44,48 +40,20 @@ const sigverify_rom_rsa_key_t kSigverifyRsaKeys[kSigverifyRsaKeysCnt_] = {
.key_type = kSigverifyKeyTypeTest,
},
},
{
.entry =
{
.key = TEST_KEY_1_RSA_3072_EXP_F4,
.key_type = kSigverifyKeyTypeTest,
},
},
{
.entry =
{
.key = DEV_KEY_0_RSA_3072_EXP_F4,
.key_type = kSigverifyKeyTypeDev,
},
},
{
.entry =
{
.key = DEV_KEY_1_RSA_3072_EXP_F4,
.key_type = kSigverifyKeyTypeDev,
},
},
{
.entry =
{
.key = PROD_KEY_0_RSA_3072_EXP_F4,
.key_type = kSigverifyKeyTypeProd,
},
},
{
.entry =
{
.key = PROD_KEY_1_RSA_3072_EXP_F4,
.key_type = kSigverifyKeyTypeProd,
},
},
{
.entry =
{
.key = PROD_KEY_2_RSA_3072_EXP_F4,
.key_type = kSigverifyKeyTypeProd,
},
},
};

static_assert(OTP_CTRL_PARAM_CREATOR_SW_CFG_SIGVERIFY_RSA_KEY_EN_SIZE >=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ struct RsaVerifyTestCase {
sigverify_rsa_buffer_t sig;
};

const RsaVerifyTestCase kRsaVerifyTestCases[7]{
const RsaVerifyTestCase kRsaVerifyTestCases[3]{
// message: "test"
{
.key = &kSigverifyRsaKeys[0].entry.key,
Expand Down Expand Up @@ -125,32 +125,6 @@ const RsaVerifyTestCase kRsaVerifyTestCases[7]{
},
{
.key = &kSigverifyRsaKeys[1].entry.key,
.sig =
{
0xef57ff30, 0x95aab770, 0x1111a0e3, 0x972d0115, 0x72caf9a6,
0x8322c9b7, 0xa627ef11, 0xeaf1a8ef, 0x5b231edf, 0x3bac5a7d,
0x7f6dade1, 0x121962ed, 0x3cbd4b08, 0xbb8ef889, 0x7e45411b,
0x92eecfce, 0xfaacdedc, 0x3a502da1, 0x9d2a2390, 0x78237336,
0x53c6e775, 0xe2e5af7a, 0x748eb8fb, 0x549807ca, 0x8b50584f,
0x9692c057, 0xbfa217da, 0xf5b4d228, 0x867c8492, 0xcf4700d2,
0xeab74029, 0x2939dff6, 0x6e0e32e5, 0x9e469bc6, 0xf8782d95,
0x3d30f149, 0xfb9a4784, 0xb433bfc4, 0x8d950344, 0xa972b015,
0xc508e1ee, 0x4f985d05, 0x9d0a2442, 0xad37ac1d, 0x84c73837,
0x22bd3c8b, 0x48d1b41a, 0x71b45377, 0x32fe54c0, 0x5eb819da,
0x61ceeca4, 0x6f0bb173, 0x2a7df150, 0x4130bd1c, 0xaca5135f,
0x42341c8e, 0x05aeb721, 0x864810e0, 0x62904801, 0xc492d5b1,
0x6cdea196, 0x725d4037, 0xa1d4d5d4, 0xd887b7ef, 0x0dc4b374,
0x5edb303e, 0x906051e0, 0x5e06e51f, 0x9db997dc, 0x6007d0a3,
0xeb90cb2d, 0x0016a74d, 0x3d88e6ed, 0xa7885167, 0xf1cfd78c,
0xe82411f3, 0x9cc3f0d2, 0x753d9e81, 0xb97140c7, 0x7d7888a1,
0xaed7688d, 0x0febbfe3, 0x84172081, 0x6b7ac93a, 0xff938ab6,
0x64e79866, 0xcc14c772, 0x1986d268, 0xfee820ac, 0xe80d0882,
0x1dce7b62, 0xdcf4192f, 0xbf4823ed, 0xf639ba95, 0xb3d5a2cf,
0x8968a8a9,
},
},
{
.key = &kSigverifyRsaKeys[2].entry.key,
.sig =
{
0x3106a8c5, 0xb7b48a3a, 0xb06af030, 0x9dca44b1, 0x55eaa90a,
Expand All @@ -176,34 +150,7 @@ const RsaVerifyTestCase kRsaVerifyTestCases[7]{
},
},
{
.key = &kSigverifyRsaKeys[3].entry.key,
.sig =
{
0x8402d200, 0x20710949, 0x14e1a980, 0xd8b157d4, 0x27b54e3e,
0xbe67e757, 0x80f7c98a, 0xc1ddfd8b, 0x9b18b904, 0xc896742d,
0x1fcee8ec, 0xdd9bfb3c, 0x73ade13d, 0x94eb5757, 0xb3220d27,
0xae818424, 0xa0ff0c3a, 0x252ee390, 0x324925e0, 0xcbba4047,
0xb7d32b18, 0xbc55e0e1, 0x0ba27a5e, 0x6a194fc0, 0x81553c9d,
0x94a918cb, 0xd960f4d3, 0x54efa60a, 0x7c092981, 0x5ce781a3,
0x458b9dad, 0x61666ba9, 0x9eda78dc, 0x71a80fd6, 0xa16f9727,
0x20454195, 0x0ca82c15, 0xf48bc41f, 0x35448689, 0x9825d4ed,
0xdfb4b7d5, 0xf0b5b7d3, 0x11ceedc4, 0x5279c565, 0xd59fd236,
0x4fc04eb4, 0xa77edd38, 0x373fce45, 0xdc4719be, 0x7601a9f1,
0x947a42ab, 0xac10049b, 0x98ab7ca6, 0xc2e2584f, 0x7e3097ec,
0x826b27c7, 0x3d634ce2, 0x7e02edd3, 0x04cfa408, 0x4ab368fc,
0xea5182d5, 0x15623948, 0xbd4e182f, 0x363dd200, 0xc38fe331,
0xf3a9e7f8, 0xfad88dbe, 0xa2dfa44d, 0x4804773e, 0x257e556c,
0x72cda358, 0x4f539e45, 0xb005b84d, 0x45d88360, 0xe142e88d,
0x88ca7e99, 0x1a5738b2, 0x79fc2500, 0x9220496d, 0xc1ace896,
0x0133c268, 0x9f3af45d, 0x9a82f6f7, 0x12541018, 0xf5315184,
0xbef0cca0, 0x659c63f6, 0xb5707c58, 0xda2d7f72, 0x78a85a65,
0x5121efc9, 0xfa335cd9, 0x30d87bf0, 0x50df50e7, 0x38cd6d9a,
0x7a51b1bb,
},

},
{
.key = &kSigverifyRsaKeys[4].entry.key,
.key = &kSigverifyRsaKeys[2].entry.key,
.sig =
{
0x39b92a38, 0xf584ed48, 0x25f5f323, 0x04dde936, 0x608871c1,
Expand All @@ -228,60 +175,6 @@ const RsaVerifyTestCase kRsaVerifyTestCases[7]{
0xc28540c8,
},
},
{
.key = &kSigverifyRsaKeys[5].entry.key,
.sig =
{
0x1000e846, 0x07169294, 0x127738d6, 0x8a7d4591, 0x1534d609,
0x828f8b3d, 0xba04c098, 0x2b5cb5f3, 0xc2f01bfe, 0xeb67c069,
0xe629a7d4, 0xc3010bed, 0xc83c2976, 0x4284ec1d, 0x5d948638,
0x2c19a493, 0x66a7b5e4, 0x0061a63b, 0x790b7653, 0x995344b0,
0x51fb62ba, 0x271b691c, 0x1a029630, 0x732e22c4, 0x49bfcb29,
0xb544d0e1, 0x5e850677, 0x2cda260e, 0x167c65e4, 0xe7f5a172,
0x703ec329, 0x095528be, 0xeda599bb, 0x5ccb46f2, 0xbbac39d2,
0x40f358e0, 0x94e8592f, 0x41ce65a0, 0x09580ffe, 0x80825ebe,
0xc944a075, 0xa7de79a5, 0xa36f5d9f, 0xbb120eb8, 0x2e31a7b6,
0xe6ed4cef, 0x49edfc2f, 0x9954867c, 0x5831aebc, 0x00df010f,
0x9f950511, 0xfa13bf21, 0xd50c3bbe, 0x58c0b5c3, 0xe942bb50,
0x06e2d763, 0xa0808d59, 0x40eab32a, 0x96e0ecb7, 0xa4c5712a,
0xe0cf6d67, 0x730dfac4, 0x1cf5ecaa, 0x4230aa3e, 0xbb193d33,
0x38b4685b, 0x62f208ff, 0x6b9f4ee5, 0xc0c58a59, 0x17b4b519,
0x0bb58e9e, 0xbe99c087, 0x9e2d7649, 0x15f9d0ad, 0xbcba7ff5,
0x4003b115, 0xf6a23bc9, 0x33ec053d, 0xfd8dcc01, 0x564b8169,
0xb51aa972, 0x0d0cc0e2, 0xf372dbc1, 0x50ef195f, 0x6d8c221c,
0x8588f6a1, 0xc56d5c4c, 0xea7396df, 0x7bb9bf11, 0xea147640,
0x5a26751b, 0x1908434e, 0xa83b8e1b, 0x33cfa993, 0xdfc60f10,
0x6d3b6394,
},

},
{
.key = &kSigverifyRsaKeys[6].entry.key,
.sig =
{
0x59d916ff, 0x520a007e, 0xde5fa666, 0x9c212e52, 0xc1bc4784,
0xd7c4e93e, 0x8128f84a, 0xf361f92c, 0xd6ef1c12, 0x6cd672d5,
0x46f5555e, 0xc1e8d1e6, 0x7e6af491, 0x978e4a1a, 0xae9673c3,
0xef0bc48f, 0xa0fefb7b, 0xa281deb3, 0x6b635b03, 0xdc35e3c0,
0x02f8df52, 0x7e0eed5c, 0x91f43905, 0x1f2683ac, 0xfcd8993e,
0x38dd36a7, 0x0cd5eded, 0x1de4d06a, 0x0463cee9, 0x19f032c7,
0x66e06317, 0x67bfa617, 0x95171697, 0xc2c8af6e, 0x6eb98222,
0x497f9941, 0xe5cf8175, 0xd6581df7, 0xc1f864c6, 0x1e22cf6c,
0x427f7917, 0x6306448d, 0xcb5c20fb, 0x97abe71f, 0xbfc6c93a,
0x25f1d638, 0x1f36ab56, 0xc89fa9bb, 0x038c2904, 0xe3029b6c,
0x3596ac5d, 0x5d4ecff6, 0x2e4483d4, 0x9abe0721, 0x388f1831,
0xa744f0b8, 0x2e44379a, 0x98b33358, 0xecaf5a9b, 0x999dd99f,
0x88ff3789, 0x345f384d, 0x5ee3e13e, 0xced78d56, 0x9ad1d667,
0x1353f133, 0xe349b83d, 0x5bf73b86, 0x2ae7f98c, 0x3374ca22,
0xaf0cd370, 0xfc2e990e, 0x43d02247, 0xf9a97493, 0xcd390b45,
0x6aeb242b, 0x0e0a7f5b, 0xe577a361, 0x82e21028, 0x8527e322,
0x56b63190, 0x5df87caf, 0x9e69de56, 0xa0092de1, 0xd2d452de,
0x3f9ebc02, 0xe4433770, 0xbc22c285, 0xa5963403, 0x7a7a6238,
0x4d1625f8, 0x349588b6, 0x0534cd93, 0x0d8cc92f, 0xcfdcafff,
0x0a9938f9,
},

},
};

TEST(RsaVerifyTestCases, AllKeys) {
Expand Down
Binary file not shown.
Loading
Loading