FreeCalypso > hg > fc-pcsc-tools
view libcommon/pinentry.c @ 128:01aed8d0685a
doc/Low-level-commands: raw apdu command documented
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sat, 20 Feb 2021 20:10:18 +0000 |
parents | e9e8ce12f5a5 |
children |
line wrap: on
line source
#include <sys/types.h> #include <ctype.h> #include <stdio.h> encode_pin_entry(arg, dest) char *arg; u_char *dest; { unsigned n; n = 0; while (*arg) { if (!isdigit(*arg)) { fprintf(stderr, "error: PIN argument contains a non-digit character\n"); return(-1); } if (n >= 8) { fprintf(stderr, "error: PIN argument is too long\n"); return(-1); } *dest++ = *arg++; n++; } for (; n < 8; n++) *dest++ = 0xFF; return(0); }