]> err.no Git - yubikey-personalization.old/commitdiff
Adapt to the changes in ykcore.
authorRichard Levitte <levitte@lp.se>
Thu, 7 May 2009 21:05:10 +0000 (21:05 +0000)
committerRichard Levitte <levitte@lp.se>
Thu, 7 May 2009 21:05:10 +0000 (21:05 +0000)
Makefile.am
ykpers.c
ykpers.h
ykpersonalize.c

index f8845a83a0a33e9542a59f9261c26f3f56b7e7c8..29ca7738c5b76eeb650cf83cd41e4d596f8b6b26 100644 (file)
@@ -36,8 +36,10 @@ AM_CPPFLAGS = -I$(srcdir)/ykcore -I$(srcdir)/rfc4634
 
 # The library.
 
+include_HEADERS = ykpers.h ykcore/ykstatus.h ykcore/ykcore.h
+
 lib_LTLIBRARIES = libykpers.la
-libykpers_la_SOURCES = ykpers.h ykpers.c ykpbkdf2.h ykpbkdf2.c
+libykpers_la_SOURCES = ykpers.c ykpbkdf2.h ykpbkdf2.c
 libykpers_la_SOURCES += rfc4634/hmac.c rfc4634/usha.c rfc4634/sha.h    \
        rfc4634/sha1.c rfc4634/sha224-256.c rfc4634/sha384-512.c        \
        rfc4634/sha-private.h
index 70bf803385b4dc12e4b201d397c7b246eebdf3da..305705c00844b802f3b4cb69b79163ddd21d916c 100644 (file)
--- a/ykpers.c
+++ b/ykpers.c
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include "ykcore_lcl.h"
+#include "ykpbkdf2.h"
+
 #include <ykpers.h>
-#include <ykcore.h>
-#include <ykdef.h>
-#include <ykpbkdf2.h>
 
 #include <stdio.h>
 #include <string.h>
@@ -41,7 +41,7 @@
 
 
 
-static const ykp_cfg default_config = {
+static const YK_CONFIG default_config = {
        { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* fixed */
        { 0, 0, 0, 0, 0, 0 },   /* uid */
        { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* key */
@@ -54,9 +54,9 @@ static const ykp_cfg default_config = {
        0                       /* crc */
 };
 
-ykp_cfg *ykp_create_config(void)
+YK_CONFIG *ykp_create_config(void)
 {
-       ykp_cfg *cfg = malloc(sizeof(ykp_cfg));
+       YK_CONFIG *cfg = malloc(sizeof(YK_CONFIG));
        if (cfg) {
                memcpy(cfg, &default_config,
                       sizeof(default_config));
@@ -65,7 +65,7 @@ ykp_cfg *ykp_create_config(void)
        return 0;
 }
 
-int ykp_free_config(ykp_cfg *cfg)
+int ykp_free_config(YK_CONFIG *cfg)
 {
        if (cfg) {
                free(cfg);
@@ -74,7 +74,7 @@ int ykp_free_config(ykp_cfg *cfg)
        return 0;
 }
 
-int ykp_AES_key_from_hex(ykp_cfg *cfg, const char *hexkey) {
+int ykp_AES_key_from_hex(YK_CONFIG *cfg, const char *hexkey) {
        char aesbin[256];
        unsigned long int aeslong;
 
@@ -99,7 +99,7 @@ int ykp_AES_key_from_hex(ykp_cfg *cfg, const char *hexkey) {
        return 0;
 }
 
-int ykp_AES_key_from_passphrase(ykp_cfg *cfg, const char *passphrase,
+int ykp_AES_key_from_passphrase(YK_CONFIG *cfg, const char *passphrase,
                                const char *salt)
 {
        if (cfg) {
@@ -166,7 +166,7 @@ int ykp_AES_key_from_passphrase(ykp_cfg *cfg, const char *passphrase,
 }
 
 #define def_set_charfield(fnname,fieldname,size,extra)         \
-int ykp_set_ ## fnname(ykp_cfg *cfg, unsigned char *input, size_t len) \
+int ykp_set_ ## fnname(YK_CONFIG *cfg, unsigned char *input, size_t len)       \
 {                                                              \
        if (cfg) {                                              \
                size_t max_chars = len;                         \
@@ -190,7 +190,7 @@ def_set_charfield(fixed,fixed,FIXED_SIZE,cfg->fixedSize = max_chars)
 def_set_charfield(uid,uid,UID_SIZE,)
 
 #define def_set_tktflag(type)                                  \
-int ykp_set_tktflag_ ## type(ykp_cfg *cfg, bool state)         \
+int ykp_set_tktflag_ ## type(YK_CONFIG *cfg, bool state)               \
 {                                                              \
        if (cfg) {                                              \
                if (state)                                      \
@@ -204,7 +204,7 @@ int ykp_set_tktflag_ ## type(ykp_cfg *cfg, bool state)              \
 }
 
 #define def_set_cfgflag(type)                                  \
-int ykp_set_cfgflag_ ## type(ykp_cfg *cfg, bool state)         \
+int ykp_set_cfgflag_ ## type(YK_CONFIG *cfg, bool state)               \
 {                                                              \
        if (cfg) {                                              \
                if (state)                                      \
@@ -267,7 +267,7 @@ struct map_st config_flags_map[] = {
        { 0, "" }
 };
 
-int ykp_write_config(const ykp_cfg *cfg,
+int ykp_write_config(const YK_CONFIG *cfg,
                     int (*writer)(const char *buf, size_t count,
                                   void *userdata),
                     void *userdata)
@@ -348,7 +348,7 @@ int ykp_write_config(const ykp_cfg *cfg,
        }
        return 0;
 }
-int ykp_read_config(ykp_cfg *cfg,
+int ykp_read_config(YK_CONFIG *cfg,
                    int (*reader)(char *buf, size_t count,
                                  void *userdata),
                    void *userdata)
index 2957fbf275c25f442578e2d87c5e5014a8dbca4b..1b0861f1f03250ad319087f788f792e66c1a3a7b 100644 (file)
--- a/ykpers.h
+++ b/ykpers.h
 #include <stddef.h>
 #include <stdbool.h>
 
-typedef struct config_st ykp_cfg;
+#include <ykcore.h>
 
-ykp_cfg *ykp_create_config(void);
-int ykp_free_config(ykp_cfg *cfg);
+YK_CONFIG *ykp_create_config(void);
+int ykp_free_config(YK_CONFIG *cfg);
 
-int ykp_AES_key_from_hex(ykp_cfg *cfg, const char *hexkey);
-int ykp_AES_key_from_passphrase(ykp_cfg *cfg, const char *passphrase,
+int ykp_AES_key_from_hex(YK_CONFIG *cfg, const char *hexkey);
+int ykp_AES_key_from_passphrase(YK_CONFIG *cfg, const char *passphrase,
                                const char *salt);
 
-int ykp_set_access_code(ykp_cfg *cfg, unsigned char *access_code, size_t len);
-int ykp_set_fixed(ykp_cfg *cfg, unsigned char *fixed, size_t len);
-int ykp_set_uid(ykp_cfg *cfg, unsigned char *uid, size_t len);
+int ykp_set_access_code(YK_CONFIG *cfg, unsigned char *access_code, size_t len);
+int ykp_set_fixed(YK_CONFIG *cfg, unsigned char *fixed, size_t len);
+int ykp_set_uid(YK_CONFIG *cfg, unsigned char *uid, size_t len);
 
-int ykp_set_tktflag_TAB_FIRST(ykp_cfg *cfg, bool state);
-int ykp_set_tktflag_APPEND_TAB1(ykp_cfg *cfg, bool state);
-int ykp_set_tktflag_APPEND_TAB2(ykp_cfg *cfg, bool state);
-int ykp_set_tktflag_APPEND_DELAY1(ykp_cfg *cfg, bool state);
-int ykp_set_tktflag_APPEND_DELAY2(ykp_cfg *cfg, bool state);
-int ykp_set_tktflag_APPEND_CR(ykp_cfg *cfg, bool state);
+int ykp_set_tktflag_TAB_FIRST(YK_CONFIG *cfg, bool state);
+int ykp_set_tktflag_APPEND_TAB1(YK_CONFIG *cfg, bool state);
+int ykp_set_tktflag_APPEND_TAB2(YK_CONFIG *cfg, bool state);
+int ykp_set_tktflag_APPEND_DELAY1(YK_CONFIG *cfg, bool state);
+int ykp_set_tktflag_APPEND_DELAY2(YK_CONFIG *cfg, bool state);
+int ykp_set_tktflag_APPEND_CR(YK_CONFIG *cfg, bool state);
 
-int ykp_set_cfgflag_SEND_REF(ykp_cfg *cfg, bool state);
-int ykp_set_cfgflag_TICKET_FIRST(ykp_cfg *cfg, bool state);
-int ykp_set_cfgflag_PACING_10MS(ykp_cfg *cfg, bool state);
-int ykp_set_cfgflag_PACING_20MS(ykp_cfg *cfg, bool state);
-int ykp_set_cfgflag_ALLOW_HIDTRIG(ykp_cfg *cfg, bool state);
-int ykp_set_cfgflag_STATIC_TICKET(ykp_cfg *cfg, bool state);
+int ykp_set_cfgflag_SEND_REF(YK_CONFIG *cfg, bool state);
+int ykp_set_cfgflag_TICKET_FIRST(YK_CONFIG *cfg, bool state);
+int ykp_set_cfgflag_PACING_10MS(YK_CONFIG *cfg, bool state);
+int ykp_set_cfgflag_PACING_20MS(YK_CONFIG *cfg, bool state);
+int ykp_set_cfgflag_ALLOW_HIDTRIG(YK_CONFIG *cfg, bool state);
+int ykp_set_cfgflag_STATIC_TICKET(YK_CONFIG *cfg, bool state);
 
-int ykp_write_config(const ykp_cfg *cfg,
+int ykp_write_config(const YK_CONFIG *cfg,
                     int (*writer)(const char *buf, size_t count,
                                   void *userdata),
                     void *userdata);
-int ykp_read_config(ykp_cfg *cfg,
+int ykp_read_config(YK_CONFIG *cfg,
                    int (*reader)(char *buf, size_t count,
                                  void *userdata),
                    void *userdata);
index c8470c8960be9debd46f99169d39070dbeadbc3c..3b4228851cf0bb2e5e7447e0ca992c7d9cf2dbdf 100644 (file)
@@ -105,9 +105,9 @@ main(int argc, char **argv)
        FILE *outf = NULL; const char *outfname = NULL;
        bool verbose = false;
        bool aesviahash = false; const char *aeshash = NULL;
-       YUBIKEY *yk = NULL;
-       CONFIG *cfg = ykp_create_config();
-       STATUS *st = ykds_alloc();
+       YK_KEY *yk = NULL;
+       YK_CONFIG *cfg = ykp_create_config();
+       YK_STATUS *st = ykds_alloc();
 
        bool error = false;
        int exit_code = 0;