From 56c0ece628d8ed49933afd3b14337cc941c8cd1d Mon Sep 17 00:00:00 2001 From: Charles-Edouard de la Vergne Date: Tue, 6 Feb 2024 16:46:25 +0100 Subject: [PATCH] PRODUCT: Remove deprecated RSA1024 --- src/gpg_data.c | 4 ---- src/gpg_gen.c | 9 --------- src/gpg_pso.c | 6 ------ src/gpg_types.h | 6 ------ 4 files changed, 25 deletions(-) diff --git a/src/gpg_data.c b/src/gpg_data.c index d32d49b..fe6fc37 100644 --- a/src/gpg_data.c +++ b/src/gpg_data.c @@ -407,10 +407,6 @@ int gpg_apdu_put_data(unsigned int ref) { rsa_pub = (cx_rsa_public_key_t *) &G_gpg_vstate.work.rsa.public; rsa_priv = (cx_rsa_private_key_t *) &G_gpg_vstate.work.rsa.private; switch (ksz) { - case 1024 / 8: - pkey_size = sizeof(cx_rsa_1024_private_key_t); - pq = G_gpg_vstate.work.rsa.public1024.n; - break; case 2048 / 8: pkey_size = sizeof(cx_rsa_2048_private_key_t); pq = G_gpg_vstate.work.rsa.public2048.n; diff --git a/src/gpg_gen.c b/src/gpg_gen.c index ec96dc5..17f4864 100644 --- a/src/gpg_gen.c +++ b/src/gpg_gen.c @@ -87,9 +87,6 @@ static int gpg_gen_rsa_kyey(gpg_key_t *keygpg, uint8_t *name) { rsa_pub = (cx_rsa_public_key_t *) &G_gpg_vstate.work.rsa.public; rsa_priv = (cx_rsa_private_key_t *) &G_gpg_vstate.work.rsa.private; switch (ksz) { - case 1024 / 8: - pkey_size = sizeof(cx_rsa_1024_private_key_t); - break; case 2048 / 8: pkey_size = sizeof(cx_rsa_2048_private_key_t); break; @@ -155,12 +152,6 @@ static int gpg_read_rsa_kyey(gpg_key_t *keygpg) { ksz = U2BE(keygpg->attributes.value, 1) >> 3; gpg_io_mark(); switch (ksz) { - case 1024 / 8: - if (keygpg->priv_key.rsa1024.size == 0) { - return SW_REFERENCED_DATA_NOT_FOUND; - } - gpg_io_insert_tlv(0x81, ksz, (unsigned char *) &keygpg->priv_key.rsa1024.n); - break; case 2048 / 8: if (keygpg->priv_key.rsa2048.size == 0) { return SW_REFERENCED_DATA_NOT_FOUND; diff --git a/src/gpg_pso.c b/src/gpg_pso.c index e01968b..7d92b8f 100644 --- a/src/gpg_pso.c +++ b/src/gpg_pso.c @@ -72,9 +72,6 @@ static int gpg_sign(gpg_key_t *sigkey) { unsigned int ksz, l; ksz = U2BE(sigkey->attributes.value, 1) >> 3; switch (ksz) { - case 1024 / 8: - key = (cx_rsa_private_key_t *) &sigkey->priv_key.rsa1024; - break; case 2048 / 8: key = (cx_rsa_private_key_t *) &sigkey->priv_key.rsa2048; break; @@ -262,9 +259,6 @@ int gpg_apdu_pso() { ksz = U2BE(G_gpg_vstate.mse_dec->attributes.value, 1) >> 3; key = NULL; switch (ksz) { - case 1024 / 8: - key = (cx_rsa_private_key_t *) &G_gpg_vstate.mse_dec->priv_key.rsa1024; - break; case 2048 / 8: key = (cx_rsa_private_key_t *) &G_gpg_vstate.mse_dec->priv_key.rsa2048; break; diff --git a/src/gpg_types.h b/src/gpg_types.h index d0f9239..bfb166c 100644 --- a/src/gpg_types.h +++ b/src/gpg_types.h @@ -75,12 +75,8 @@ typedef struct gpg_key_s { /* C1 C2 C3 */ LV(attributes, GPG_KEY_ATTRIBUTES_LENGTH); /* key value */ - /* WARN: changing the cx__t structures breaks backup/restore. Adapt backup/restore code - * to ensure backward compatibility. - */ union { cx_rsa_private_key_t rsa; - cx_rsa_1024_private_key_t rsa1024; cx_rsa_2048_private_key_t rsa2048; cx_rsa_3072_private_key_t rsa3072; cx_rsa_4096_private_key_t rsa4096; @@ -212,14 +208,12 @@ struct gpg_v_state_s { struct { union { cx_rsa_public_key_t public; - cx_rsa_1024_public_key_t public1024; cx_rsa_2048_public_key_t public2048; cx_rsa_3072_public_key_t public3072; cx_rsa_4096_public_key_t public4096; }; union { cx_rsa_private_key_t private; - cx_rsa_1024_private_key_t private1024; cx_rsa_2048_private_key_t private2048; cx_rsa_3072_private_key_t private3072; cx_rsa_4096_private_key_t private4096;