From 5b9c51fb7e3b7157a5cf15f10567952929296562 Mon Sep 17 00:00:00 2001 From: merlokk <807634+merlokk@users.noreply.github.com> Date: Tue, 31 Mar 2020 18:30:44 +0300 Subject: [PATCH] signature decode r and s works --- client/mifare/ndef.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/client/mifare/ndef.c b/client/mifare/ndef.c index 66b00a159..e2399b0fd 100644 --- a/client/mifare/ndef.c +++ b/client/mifare/ndef.c @@ -244,15 +244,12 @@ static int ndefDecodeSig2(uint8_t *sig, size_t siglen) { } else { PrintAndLogEx(NORMAL, "\tsignature [%zu]: %s", intsiglen, sprint_hex_inrow(&sig[indx], intsiglen)); if (sigType == stECDSA_P192 || sigType == stECDSA_P256) { - PrintAndLogEx(NORMAL, "\tsignature: ECDSA"); - uint8_t rval[300] = {0}; - uint8_t sval[300] = {0}; - int res = ecdsa_asn1_get_signature(&sig[indx], intsiglen, rval, sval); - if (!res) { - PrintAndLogEx(NORMAL, "\t\tr: %s", sprint_hex(rval, 32)); - PrintAndLogEx(NORMAL, "\t\ts: %s", sprint_hex(sval, 32)); - } else { - PrintAndLogEx(NORMAL, "\t\error signature decode"); + int slen = intsiglen / 2; + if (slen == 24 || slen == 32) { + PrintAndLogEx(NORMAL, "\tsignature: ECDSA-%d", slen * 8); + PrintAndLogEx(NORMAL, "\t\tr: %s", sprint_hex(&sig[indx], slen)); + indx += slen; + PrintAndLogEx(NORMAL, "\t\ts: %s", sprint_hex(&sig[indx], slen)); } } else { PrintAndLogEx(NORMAL, "\tsignature: unknown type");