return strlen(json);
}
-int _ykp_json_import_cfg(const char *json, size_t len, YKP_CONFIG *cfg) {
+int _ykp_json_import_cfg(YKP_CONFIG *cfg, const char *json, size_t len) {
if(cfg) {
json_object *jobj = json_tokener_parse(json);
json_object *yprod_json = json_object_object_get(jobj, "yubiProdConfig");
# endif
int _ykp_json_export_cfg(const YKP_CONFIG *cfg, char *json, size_t len);
-int _ykp_json_import_cfg(const char *json, size_t len, YKP_CONFIG *cfg);
+int _ykp_json_import_cfg(YKP_CONFIG *cfg, const char *json, size_t len);
# ifdef __cplusplus
}
}
-int ykp_import_config(const char *buf, size_t len, YKP_CONFIG *cfg,
+int ykp_import_config(YKP_CONFIG *cfg, const char *buf, size_t len,
int format) {
if(format == YKP_FORMAT_YCFG) {
- return _ykp_json_import_cfg(buf, len, cfg);
+ return _ykp_json_import_cfg(cfg, buf, len);
} else if(format == YKP_FORMAT_LEGACY) {
ykp_errno = YKP_ENOTYETIMPL;
}
int ykp_config_num(YKP_CONFIG *cfg);
int ykp_export_config(const YKP_CONFIG *cfg, char *buf, size_t len, int format);
-int ykp_import_config(const char *buf, size_t len, YKP_CONFIG *cfg, int format);
+int ykp_import_config(YKP_CONFIG *cfg, const char *buf, size_t len, int format);
#define YKP_FORMAT_LEGACY 0x01
#define YKP_FORMAT_YCFG 0x02
if (inf) {
if(!fread(data, 1, 1024, inf))
goto err;
- if (!ykp_import_config(data, strlen(data), cfg, data_format))
+ if (!ykp_import_config(cfg, data, strlen(data), data_format))
goto err;
} else if (! aesviahash && ! zap && (ykp_command(cfg) == SLOT_CONFIG || ykp_command(cfg) == SLOT_CONFIG2)) {
char passphrasebuf[256]; size_t passphraselen;