const char *outfname = NULL;
bool verbose = false;
bool dry_run = false;
- bool aesviahash = false;
+ char keylocation;
bool use_access_code = false;
unsigned char access_code[256];
YK_KEY *yk = 0;
int data_format = YKP_FORMAT_LEGACY;
/* Options */
- char *salt = NULL;
char ndef[128];
char ndef_type = 0;
unsigned char usb_mode = 0;
/* call args_to_config from ykpers-args.c with a fake set of program arguments */
rc = args_to_config(argc, argv, cfg, yk,
&infname, &outfname,
- &data_format,
- &autocommit, &salt,
+ &data_format, &autocommit,
st, &verbose, &dry_run,
access_code, &use_access_code,
- &aesviahash, &ndef_type, ndef, &usb_mode, &zap,
+ &keylocation, &ndef_type, ndef, &usb_mode, &zap,
scan_map, &cr_timeout, &autoeject_timeout, &num_modes_seen,
&exit_code);
const char *outfname = NULL;
bool verbose = false;
bool dry_run = false;
- bool aesviahash = false;
+ char keylocation;
bool use_access_code = false;
unsigned char access_code[256];
YK_KEY *yk = 0;
int data_format = YKP_FORMAT_LEGACY;
/* Options */
- char *salt = NULL;
char ndef[128];
char ndef_type = 0;
unsigned char usb_mode = 0;
/* call args_to_config from ykpers-args.c with a fake set of program arguments */
rc = args_to_config(argc, argv, cfg, yk,
&infname, &outfname,
- &data_format,
- &autocommit, &salt,
+ &data_format, &autocommit,
st, &verbose, &dry_run,
access_code, &use_access_code,
- &aesviahash, &ndef_type, ndef, &usb_mode, &zap,
+ &keylocation, &ndef_type, ndef, &usb_mode, &zap,
scan_map, &cr_timeout, &autoeject_timeout, &num_modes_seen,
&exit_code);
assert(rc == 1);
free(st);
}
-int _test_salt(void)
-{
- char *argv[] = {
- "unittest", "-1", "-osalt=kaka",
- NULL
- };
- YKP_CONFIG *cfg = ykp_alloc();
- YK_STATUS *st = _test_init_st(2, 2, 0);
- const char *infname = NULL;
- const char *outfname = NULL;
- bool verbose = false;
- bool dry_run = false;
- bool aesviahash = false;
- bool use_access_code = false;
- unsigned char access_code[256];
- YK_KEY *yk = 0;
- bool autocommit = false;
- int exit_code = 0;
- int data_format = YKP_FORMAT_LEGACY;
-
- /* Options */
- char *salt = NULL;
- char ndef[128];
- char ndef_type = 0;
- unsigned char usb_mode = 0;
- unsigned char cr_timeout = 0;
- unsigned char autoeject_timeout = 0;
- int num_modes_seen = 0;
- bool zap = false;
-
- unsigned char scan_map[sizeof(SCAN_MAP)];
-
- int rc;
-
- ykp_errno = 0;
-
-/* getopt reinit (BSD systems use optreset and a different optind value) */
-#if defined(__GLIBC__) || defined(_WIN32)
- optind = 0;
-#else
- optind = optreset = 1;
-#endif
-
- /* copy version number from st into cfg */
- assert(ykp_configure_for(cfg, 1, st) == 1);
-
- /* call args_to_config from ykpers-args.c with a fake set of program arguments */
- rc = args_to_config(3, argv, cfg, yk,
- &infname, &outfname,
- &data_format,
- &autocommit, &salt,
- st, &verbose, &dry_run,
- access_code, &use_access_code,
- &aesviahash, &ndef_type, ndef, &usb_mode, &zap,
- scan_map, &cr_timeout, &autoeject_timeout, &num_modes_seen,
- &exit_code);
-
- assert(rc == 1);
- assert(strncmp(salt, "kaka", 4) == 0);
-}
-
int main (int argc, char **argv)
{
_test_config_slot1();
_test_slot_two_with_neo_beta();
_test_ndef2_with_neo();
_test_ndef2_with_neo_beta();
- _test_salt();
return 0;
}
"-S0605.. Set the scanmap to use with the YubiKey NEO. Must be 45 unique bytes,\n"
" in hex. Use with no argument to reset to the default.\n"
"-oOPTION change configuration option. Possible OPTION arguments are:\n"
-" salt=ssssssss Salt to be used when deriving key from a\n"
-" password. If none is given, a unique random\n"
-" one will be generated.\n"
" fixed=xxxxxxxxxxx The public identity of key, in MODHEX.\n"
" This is 0-16 characters long.\n"
" uid=xxxxxx The uid part of the generated ticket, in HEX.\n"
*/
int args_to_config(int argc, char **argv, YKP_CONFIG *cfg, YK_KEY *yk,
const char **infname, const char **outfname,
- int *data_format,
- bool *autocommit, char **salt,
+ int *data_format, bool *autocommit,
YK_STATUS *st, bool *verbose, bool *dry_run,
unsigned char *access_code, bool *use_access_code,
char *keylocation, char *ndef_type, char *ndef,
*exit_code = 1;
return 0;
}
- if (strncmp(optarg, "salt=", 5) == 0)
- *salt = strdup(optarg+5);
- else if (strncmp(optarg, "fixed=", 6) == 0) {
+ if (strncmp(optarg, "fixed=", 6) == 0) {
if (_set_fixed(optarg + 6, cfg) != 1) {
fprintf(stderr,
"Invalid fixed string: %s\n",