Fix #80: set 'URL of public key' on each slot

This commit is contained in:
Charles-Edouard de la Vergne 2024-03-13 15:40:31 +01:00
parent 7b7bd27fa3
commit 3e98639670
No known key found for this signature in database
GPG Key ID: F12296941B7BB9C6
2 changed files with 7 additions and 7 deletions

View File

@ -95,8 +95,8 @@ int gpg_apdu_get_data(unsigned int ref) {
break;
case 0x5F50:
/* Uniform resource locator */
gpg_io_insert((const unsigned char *) N_gpg_pstate->url.value,
N_gpg_pstate->url.length);
gpg_io_insert((const unsigned char *) N_gpg_pstate->keys[G_gpg_vstate.slot].url.value,
N_gpg_pstate->keys[G_gpg_vstate.slot].url.length);
break;
case 0x65:
/* Name, Language, salutation */
@ -571,14 +571,14 @@ int gpg_apdu_put_data(unsigned int ref) {
break;
/* Uniform resource locator */
case 0x5F50:
if (G_gpg_vstate.io_length > sizeof(N_gpg_pstate->url.value)) {
if (G_gpg_vstate.io_length > sizeof(N_gpg_pstate->keys[G_gpg_vstate.slot].url.value)) {
sw = SW_WRONG_LENGTH;
break;
}
nvm_write((void *) N_gpg_pstate->url.value,
nvm_write((void *) N_gpg_pstate->keys[G_gpg_vstate.slot].url.value,
G_gpg_vstate.work.io_buffer,
G_gpg_vstate.io_length);
nvm_write((void *) &N_gpg_pstate->url.length,
nvm_write((void *) &N_gpg_pstate->keys[G_gpg_vstate.slot].url.length,
&G_gpg_vstate.io_length,
sizeof(unsigned int));
sw = SW_OK;

View File

@ -129,6 +129,8 @@ typedef struct gpg_key_slot_s {
unsigned int sig_count;
/* D5 */
cx_aes_key_t AES_dec;
/* 5F50 */
LV(url, GPG_EXT_PRIVATE_DO_LENGTH);
} gpg_key_slot_t;
@ -152,8 +154,6 @@ struct gpg_nv_state_s {
/* 5E */
LV(login, GPG_EXT_PRIVATE_DO_LENGTH);
/* 5F50 */
LV(url, GPG_EXT_PRIVATE_DO_LENGTH);
/* -- Cardholder Related Data -- */
/* 5B */