OpenPGP: only add keys with legal algorithm identifier
This commit is contained in:
parent
671ac54b71
commit
0283a6f24e
|
@ -215,6 +215,8 @@ sc_pkcs15emu_openpgp_init(sc_pkcs15_card_t *p15card)
|
|||
return SC_ERROR_INTERNAL;
|
||||
}
|
||||
|
||||
/* only add valid keys, i.e. those with a legal algorithm identifier */
|
||||
if (buffer[0] != 0) {
|
||||
prkey_info.id.len = 1;
|
||||
prkey_info.id.value[0] = i + 1;
|
||||
prkey_info.usage = key_cfg[i].prkey_usage;
|
||||
|
@ -231,6 +233,7 @@ sc_pkcs15emu_openpgp_init(sc_pkcs15_card_t *p15card)
|
|||
if (r < 0)
|
||||
return SC_ERROR_INTERNAL;
|
||||
}
|
||||
}
|
||||
/* Add public keys */
|
||||
for (i = 0; i < 3; i++) {
|
||||
sc_pkcs15_pubkey_info_t pubkey_info;
|
||||
|
@ -248,6 +251,8 @@ sc_pkcs15emu_openpgp_init(sc_pkcs15_card_t *p15card)
|
|||
return SC_ERROR_INTERNAL;
|
||||
}
|
||||
|
||||
/* only add valid keys, i.e. those with a legal algorithm identifier */
|
||||
if (buffer[0] != 0) {
|
||||
pubkey_info.id.len = 1;
|
||||
pubkey_info.id.value[0] = i + 1;
|
||||
pubkey_info.modulus_length = bebytes2ushort(buffer + 1);
|
||||
|
@ -261,6 +266,7 @@ sc_pkcs15emu_openpgp_init(sc_pkcs15_card_t *p15card)
|
|||
if (r < 0)
|
||||
return SC_ERROR_INTERNAL;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
|
|
Loading…
Reference in New Issue