Correct MSE template mapping

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
Pol Henarejos
2026-08-14 19:10:58 +02:00
parent 3ffd5efb40
commit 81ee0735a4
2 changed files with 11 additions and 11 deletions
+10 -10
View File
@@ -26,16 +26,6 @@ int cmd_mse(void) {
return SW_WRONG_DATA();
}
if (P2(apdu) == 0xA4) {
if (apdu.data[2] == 0x2) {
algo_dec = EF_ALGO_PRIV2;
pk_dec = EF_PK_DEC;
}
else if (apdu.data[2] == 0x3) {
algo_dec = EF_ALGO_PRIV3;
pk_dec = EF_PK_AUT;
}
}
else if (P2(apdu) == 0xB8) {
if (apdu.data[2] == 0x2) {
algo_aut = EF_ALGO_PRIV2;
pk_aut = EF_PK_DEC;
@@ -45,5 +35,15 @@ int cmd_mse(void) {
pk_aut = EF_PK_AUT;
}
}
else if (P2(apdu) == 0xB8) {
if (apdu.data[2] == 0x2) {
algo_dec = EF_ALGO_PRIV2;
pk_dec = EF_PK_DEC;
}
else if (apdu.data[2] == 0x3) {
algo_dec = EF_ALGO_PRIV3;
pk_dec = EF_PK_AUT;
}
}
return SW_OK();
}
+1 -1
View File
@@ -463,7 +463,7 @@ def test_openpgp_mse_decipher_slot_swap(card):
eph = ec.generate_private_key(ec.SECP256R1())
peer = eph.public_key().public_bytes(serialization.Encoding.X962, serialization.PublicFormat.UncompressedPoint)
z_dec = card.cmd_pso(0x80, 0x86, decipher_apdu_data(peer))
expect(card, INS_MSE, 0x41, 0xA4, b"\x83\x01\x03")
expect(card, INS_MSE, 0x41, 0xB8, b"\x83\x01\x03")
z_aut = card.cmd_pso(0x80, 0x86, decipher_apdu_data(peer))
assert z_dec == dec_priv.exchange(ec.ECDH(), eph.public_key())
assert z_aut == aut_priv.exchange(ec.ECDH(), eph.public_key())