canokeys / canokey-core

Core implementations of an open-source secure key
https://canokeys.org/
Apache License 2.0
324 stars 37 forks source link

Fix off-by-one-error in openpgp_generate_asymmetric_key_pair #43

Closed hko-s closed 2 years ago

hko-s commented 2 years ago

Before applying this patch, when retrieving an ED25519 key from the card (with P1=0x81), a malformed TLV was returned, e.g.:

[7f, 49, 22, 86, 20, 96, e7, 2a, 33, d8, db, f0, dc, c1, d7, 1e, 63, 6a, 19, 1c, ce, bd, 9c, 46, f, b3, 66, 15, cd, 98, 48, af, 80, ab, a, a8, fc, 3c, 90, 0]

Note that the lengths in the TLV don't add up. The last byte before the status code (0x3c) is extraneous.

dangfan commented 2 years ago

Thanks a lot!