return 1;
}
-int yk_write_config(YK_KEY *yk, YK_CONFIG *cfg, unsigned char *acc_code)
+int yk_write_config(YK_KEY *yk, YK_CONFIG *cfg, int confnum,
+ unsigned char *acc_code)
{
unsigned char buf[sizeof(YK_CONFIG) + ACC_CODE_SIZE];
YK_STATUS stat;
/* Write to Yubikey */
- if (!yk_write_to_key(yk, SLOT_CONFIG, buf, sizeof(buf)))
- return 0;
+ switch(confnum) {
+ case 1:
+ if (!yk_write_to_key(yk, SLOT_CONFIG, buf, sizeof(buf)))
+ return 0;
+ break;
+ case 2:
+ if (!yk_write_to_key(yk, SLOT_CONFIG2, buf, sizeof(buf)))
+ return 0;
+ break;
+ }
/* Verify update */
/* writes the given configuration to the key. If the configuration is NULL,
zap the key configuration.
acc_code has to be provided of the key has a protecting access code. */
-extern int yk_write_config(YK_KEY *k, YK_CONFIG *cfg, unsigned char *acc_code);
+extern int yk_write_config(YK_KEY *k, YK_CONFIG *cfg, int confnum,
+ unsigned char *acc_code);
/*************************************************************************
*