Use new asn1 structs.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
Pol Henarejos
2024-03-14 23:22:19 +01:00
parent ebec1b1022
commit d96bbb9b4b
4 changed files with 10 additions and 6 deletions

View File

@@ -476,7 +476,7 @@ file_t file_entries[] = {
/* 131 */ { .fid = 0x0000, .parent = 0, .name = openpgp_aid, .type = FILE_TYPE_WORKING_EF, /* 131 */ { .fid = 0x0000, .parent = 0, .name = openpgp_aid, .type = FILE_TYPE_WORKING_EF,
.data = NULL, .ef_structure = FILE_EF_TRANSPARENT, .acl = ACL_RO }, .data = NULL, .ef_structure = FILE_EF_TRANSPARENT, .acl = ACL_RO },
/* 132 */ { .fid = 0x0000, .parent = 0xff, .name = NULL, .type = FILE_TYPE_UNKNOWN, .data = NULL, /* 132 */ { .fid = 0x0000, .parent = 0xff, .name = NULL, .type = FILE_TYPE_NOT_KNOWN, .data = NULL,
.ef_structure = 0, .acl = ACL_NONE } //end .ef_structure = 0, .acl = ACL_NONE } //end
}; };

View File

@@ -22,8 +22,6 @@
#include "random.h" #include "random.h"
#include "eac.h" #include "eac.h"
#include "crypto_utils.h" #include "crypto_utils.h"
#include "mbedtls/rsa.h"
#include "mbedtls/ecdsa.h"
#include "mbedtls/ecdh.h" #include "mbedtls/ecdh.h"
#include "mbedtls/asn1.h" #include "mbedtls/asn1.h"
#include "asn1.h" #include "asn1.h"
@@ -821,8 +819,10 @@ static int cmd_get_data() {
uint16_t data_len = parse_do(fids, 1); uint16_t data_len = parse_do(fids, 1);
uint8_t *p = NULL; uint8_t *p = NULL;
uint16_t tg = 0; uint16_t tg = 0;
size_t tg_len = 0; uint16_t tg_len = 0;
if (walk_tlv(res_APDU, data_len, &p, &tg, &tg_len, NULL)) { asn1_ctx_t ctxi;
asn1_ctx_init(res_APDU, data_len, &ctxi);
if (walk_tlv(&ctxi, &p, &tg, &tg_len, NULL)) {
uint8_t dec = 2; uint8_t dec = 2;
if ((tg & 0x1f) == 0x1f) { if ((tg & 0x1f) == 0x1f) {
dec++; dec++;

View File

@@ -25,11 +25,15 @@
#include "pico_keys.h" #include "pico_keys.h"
#include "apdu.h" #include "apdu.h"
#include "mbedtls/rsa.h"
#include "mbedtls/ecdsa.h"
extern bool has_pw1; extern bool has_pw1;
extern bool has_pw3; extern bool has_pw3;
extern int store_keys(void *key_ctx, int type, uint16_t key_id); extern int store_keys(void *key_ctx, int type, uint16_t key_id);
extern void make_rsa_response(mbedtls_rsa_context *rsa);
extern void make_ecdsa_response(mbedtls_ecdsa_context *ecdsa);
#define ALGO_RSA 0x01 #define ALGO_RSA 0x01
#define ALGO_ECDH 0x12 #define ALGO_ECDH 0x12