]> err.no Git - yubikey-personalization/commitdiff
Add new libykpers functions.
authorFredrik Thulin <fredrik@yubico.com>
Tue, 8 Mar 2011 19:29:47 +0000 (20:29 +0100)
committerFredrik Thulin <fredrik@yubico.com>
Tue, 8 Mar 2011 19:29:47 +0000 (20:29 +0100)
libykpers-1.map
ykcore/ykcore.c
ykcore/ykcore.h

index f18d42ed91e56ffdfba5d6bddea57818c0ab3b39..3fb110c6f4cd1e320bb4826a9e4f0b9353fd08ba 100644 (file)
@@ -115,5 +115,6 @@ LIBYKPERS_1.5 {
 # Functions:
   yk_wait_for_key_status;
   yk_read_response_from_key;
+  yk_get_serial;
 # Variables:
 } LIBYKPERS_1.4;
index ed2afd4c7555aef32a2d1862f236ec9db9b721cb..88aff0e8f488e9aa615f3b6171d04a2101b74ef0 100644 (file)
@@ -470,6 +470,13 @@ int yk_read_response_from_key(YK_KEY *yk, uint8_t slot, unsigned int flags,
        return 0;
 }
 
+/*
+ * Send something to the YubiKey. The command, as well as the slot, is
+ * given in the 'slot' parameter (e.g. SLOT_CHAL_HMAC2 to send a HMAC-SHA1
+ * challenge to slot 2).
+ *
+ * The slot parameter is here for future purposes only.
+ */
 int yk_write_to_key(YK_KEY *yk, uint8_t slot, const void *buf, int bufcount)
 {
        YK_FRAME frame;
index 305a9ecfb5788a800b3241012fb71858e07d2999..1cb56b87b2338e6f41fcd6a191d056be561d801f 100644 (file)
@@ -84,6 +84,17 @@ extern int yk_close_key(YK_KEY *k);          /* closes a previously opened key */
 extern int yk_get_status(YK_KEY *k, YK_STATUS *status /*, int forceUpdate */);
 /* checks that the firmware revision of the key is supported */
 extern int yk_check_firmware_version(YK_KEY *k);
+/* Read the factory set serial number from a YubiKey 2.0 or higher. */
+extern int yk_get_serial(YK_KEY *yk, uint8_t slot, unsigned int flags, unsigned int *serial);
+/* Wait for the key to either set or clear bits in it's status byte */
+extern int yk_wait_for_key_status(YK_KEY *yk, uint8_t slot, unsigned int flags,
+                                 unsigned int max_time_ms,
+                                 bool logic_and, unsigned char mask,
+                                 unsigned char *last_data);
+/* Read the response to a command from the YubiKey */
+extern int yk_read_response_from_key(YK_KEY *yk, uint8_t slot, unsigned int flags,
+                                    void *buf, unsigned int bufsize, unsigned int expect_bytes,
+                                    unsigned int *bytes_read);
 
 /*************************************************************************
  *
@@ -96,6 +107,8 @@ extern int yk_check_firmware_version(YK_KEY *k);
    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, int confnum,
                           unsigned char *acc_code);
+/* Write something to the YubiKey (a command that is). */
+extern int yk_write_to_key(YK_KEY *yk, uint8_t slot, const void *buf, int bufcount);
 
 /*************************************************************************
  *