ykpiv: fix length when encoding exactly 0xff bytes

this should be encoded as 81 ff, not 82 00 ff

relates #154
This commit is contained in:
Klas Lindfors
2018-08-16 14:23:16 +02:00
parent 7b1c8197fb
commit c15efbfdd7
+1 -1
View File
@@ -134,7 +134,7 @@ int _ykpiv_set_length(unsigned char *buffer, size_t length) {
if(length < 0x80) { if(length < 0x80) {
*buffer++ = (unsigned char)length; *buffer++ = (unsigned char)length;
return 1; return 1;
} else if(length < 0xff) { } else if(length < 0x100) {
*buffer++ = 0x81; *buffer++ = 0x81;
*buffer++ = (unsigned char)length; *buffer++ = (unsigned char)length;
return 2; return 2;