Hello,
trying to step in with a working example.
If you use the sss API layer all these steps are done automatically and you don't need to construct the APDU.
To replicate your use case: When you replace in the MW example ex_md the line
sss_digest_one_go(&ctx_digest, input, inputLen, digest, &digestLen);
with
sss_digest_init(&ctx_digest);
sss_digest_update(&ctx_digest, input, inputLen);
sss_digest_finish(&ctx_digest, digest, &digestLen);
then the SSS API takes care to generate these APDUs which include digest init/update/final:
VCOM:INFO :Waiting for card ........
smCom:INFO :APDU Tx> (Len=5)
00 A4 04 00 00
smCom:INFO :APDU Rx< (Len=20)
6F 10 84 08 A0 00 00 01 51 00 00 00 A5 04 9F 65
01 FF 90 00
smCom:INFO :APDU Tx> (Len=21)
00 A4 04 00 0F A0 00 00 03 96 54 53 00 00 00 01
03 00 00 00 00
smCom:INFO :APDU Rx< (Len=9)
03 01 00 6F FF 01 0B 90 00
smCom:INFO :APDU Tx> (Len=5)
80 02 10 25 00
smCom:INFO :APDU Rx< (Len=6)
41 82 00 00 90 00
smCom:INFO :APDU Tx> (Len=15)
80 01 10 00 0A 41 02 00 03 42 01 01 43 01 04
smCom:INFO :APDU Rx< (Len=2)
90 00
smCom:INFO :APDU Tx> (Len=9)
80 03 00 0B 04 42 02 00 03
smCom:INFO :APDU Rx< (Len=2)
90 00
smCom:INFO :APDU Tx> (Len=21)
80 03 00 0C 10 42 02 00 03 43 0A 48 65 6C 6C 6F
57 6F 72 6C 64
smCom:INFO :APDU Rx< (Len=2)
90 00
smCom:INFO :APDU Tx> (Len=11)
80 03 00 0D 06 42 02 00 03 43 00
smCom:INFO :APDU Rx< (Len=38)
41 82 00 20 87 2E 4E 50 CE 99 90 D8 B0 41 33 0C
47 C9 DD D1 1B EC 6B 50 3A E9 38 6A 99 DA 85 84
E9 BB 12 C4 90 00
smCom:INFO :APDU Tx> (Len=9)
80 04 10 28 04 41 02 00 03
smCom:INFO :APDU Rx< (Len=2)
90 00
VCOM:INFO :Closing connection
Kind regards,
Michael