mirror of
https://github.com/LedgerHQ/openpgp-card-app
synced 2024-11-09 07:10:30 +00:00
Fix EC templates on Stax
This commit is contained in:
parent
285fbcfaf3
commit
4390142ffa
@ -280,14 +280,7 @@ static void template_key_cb(int token, uint8_t index) {
|
||||
uint32_t size = 0;
|
||||
uint8_t key_type = index + FIRST_USER_TOKEN;
|
||||
|
||||
switch (token) {
|
||||
case TOKEN_TYPE_BACK:
|
||||
break;
|
||||
case TOKEN_TYPE_RSA2048:
|
||||
case TOKEN_TYPE_RSA3072:
|
||||
case TOKEN_TYPE_RSA4096:
|
||||
case TOKEN_TYPE_SECP256K1:
|
||||
case TOKEN_TYPE_Ed25519:
|
||||
if (token != TOKEN_TYPE_BACK) {
|
||||
memset(&attributes, 0, sizeof(attributes));
|
||||
switch (key_type) {
|
||||
case TOKEN_TYPE_RSA2048:
|
||||
@ -320,7 +313,7 @@ static void template_key_cb(int token, uint8_t index) {
|
||||
attributes.value[0] = KEY_ID_ECDSA;
|
||||
}
|
||||
oid = gpg_curve2oid(CX_CURVE_SECP256R1, &oid_len);
|
||||
memmove(attributes.value + 1, oid, sizeof(oid_len));
|
||||
memmove(attributes.value + 1, oid, oid_len);
|
||||
attributes.length = 1 + oid_len;
|
||||
break;
|
||||
|
||||
@ -332,7 +325,7 @@ static void template_key_cb(int token, uint8_t index) {
|
||||
attributes.value[0] = KEY_ID_EDDSA;
|
||||
oid = gpg_curve2oid(CX_CURVE_Ed25519, &oid_len);
|
||||
}
|
||||
memmove(attributes.value + 1, oid, sizeof(oid_len));
|
||||
memmove(attributes.value + 1, oid, oid_len);
|
||||
attributes.length = 1 + oid_len;
|
||||
break;
|
||||
}
|
||||
@ -351,11 +344,9 @@ static void template_key_cb(int token, uint8_t index) {
|
||||
|
||||
if (dest && attributes.value[0] &&
|
||||
memcmp(&dest->attributes, &attributes, sizeof(attributes)) != 0) {
|
||||
PRINTF("TEMPLATE NVM_WRITE!!!!!\n");
|
||||
nvm_write(dest, NULL, sizeof(gpg_key_t));
|
||||
nvm_write(&dest->attributes, &attributes, sizeof(attributes));
|
||||
}
|
||||
break;
|
||||
}
|
||||
ui_settings_template();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user