make signature output format configurable

This commit is contained in:
Michele Balistreri 2024-07-05 13:53:56 +02:00
parent 05f4e7438f
commit f351fc1437
No known key found for this signature in database
GPG Key ID: E9567DA33A4F791A
3 changed files with 4 additions and 4 deletions

View File

@ -48,7 +48,7 @@ static app_err_t core_eth_sign(keycard_t* kc, uint8_t* out) {
uint8_t digest[SHA3_256_DIGEST_LENGTH];
keccak_Final(&g_core.hash_ctx, digest);
if ((keycard_cmd_sign(kc, g_core.bip44_path, g_core.bip44_path_len, digest) != ERR_OK) || (APDU_SW(&kc->apdu) != 0x9000)) {
if ((keycard_cmd_sign(kc, g_core.bip44_path, g_core.bip44_path_len, digest, 1) != ERR_OK) || (APDU_SW(&kc->apdu) != 0x9000)) {
return ERR_CRYPTO;
}

View File

@ -178,12 +178,12 @@ app_err_t keycard_cmd_export_key(keycard_t* kc, uint8_t export_type, uint8_t* pa
return securechannel_send_apdu(&kc->sc, &kc->ch, &kc->apdu, path, len);
}
app_err_t keycard_cmd_sign(keycard_t* kc, uint8_t* path, uint8_t path_len, uint8_t* hash) {
app_err_t keycard_cmd_sign(keycard_t* kc, uint8_t* path, uint8_t path_len, uint8_t* hash, uint8_t prefer_recoverable) {
APDU_RESET(&kc->apdu);
APDU_CLA(&kc->apdu) = 0x80;
APDU_INS(&kc->apdu) = 0xc0;
APDU_P1(&kc->apdu) = 1;
APDU_P2(&kc->apdu) = 1;
APDU_P2(&kc->apdu) = prefer_recoverable;
SC_BUF(data, 72);

View File

@ -21,7 +21,7 @@ app_err_t keycard_cmd_init(keycard_t* kc, uint8_t* sc_pub, uint8_t* pin, uint8_t
app_err_t keycard_cmd_generate_mnemonic(keycard_t* kc, uint8_t len);
app_err_t keycard_cmd_load_seed(keycard_t* kc, uint8_t* seed);
app_err_t keycard_cmd_export_key(keycard_t* kc, uint8_t export_type, uint8_t* path, uint8_t len);
app_err_t keycard_cmd_sign(keycard_t* kc, uint8_t* path, uint8_t path_len, uint8_t* hash);
app_err_t keycard_cmd_sign(keycard_t* kc, uint8_t* path, uint8_t path_len, uint8_t* hash, uint8_t prefer_recoverable);
app_err_t keycard_cmd_factory_reset(keycard_t* kc);
app_err_t keycard_cmd_get_data(keycard_t* kc);
app_err_t keycard_cmd_set_data(keycard_t* kc, uint8_t* data, int8_t len);