From: Klas Lindfors Date: Tue, 16 Apr 2013 13:33:10 +0000 (+0200) Subject: change signature of import fuction, cfg first X-Git-Tag: v1.13.0~26 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3c877bf7972a40475cb747cb6abe2cef4685e1bd;p=yubikey-personalization change signature of import fuction, cfg first --- diff --git a/ykpers-json.c b/ykpers-json.c index f4985cc..dfca414 100644 --- a/ykpers-json.c +++ b/ykpers-json.c @@ -164,7 +164,7 @@ int _ykp_json_export_cfg(const YKP_CONFIG *cfg, char *json, size_t len) { 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"); diff --git a/ykpers-json.h b/ykpers-json.h index 9708b30..ed05538 100644 --- a/ykpers-json.h +++ b/ykpers-json.h @@ -38,7 +38,7 @@ extern "C" { # 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 } diff --git a/ykpers.c b/ykpers.c index 18b3608..1f83981 100644 --- a/ykpers.c +++ b/ykpers.c @@ -1006,10 +1006,10 @@ int ykp_export_config(const YKP_CONFIG *cfg, char *buf, size_t len, } -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; } diff --git a/ykpers.h b/ykpers.h index 8369703..3584e67 100644 --- a/ykpers.h +++ b/ykpers.h @@ -138,7 +138,7 @@ int ykp_command(YKP_CONFIG *cfg); 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 diff --git a/ykpersonalize.c b/ykpersonalize.c index b6f8643..5aaaa06 100644 --- a/ykpersonalize.c +++ b/ykpersonalize.c @@ -177,7 +177,7 @@ int main(int argc, char **argv) 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;