summaryrefslogtreecommitdiff
path: root/include/u2f_impl.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/u2f_impl.h')
-rw-r--r--include/u2f_impl.h34
1 files changed, 25 insertions, 9 deletions
diff --git a/include/u2f_impl.h b/include/u2f_impl.h
index 0732a1b72d..5bd69309c6 100644
--- a/include/u2f_impl.h
+++ b/include/u2f_impl.h
@@ -10,6 +10,7 @@
#include "common.h"
#include "cryptoc/p256.h"
+#include "u2f.h"
/* ---- Physical presence ---- */
@@ -58,14 +59,30 @@ int u2f_origin_key(const uint8_t *seed, p256_int *d);
*
* @param origin pointer to origin id
* @param user pointer to user secret
- * @param pointer to origin-specific random seed
+ * @param seed pointer to origin-specific random seed
+ * @param key_handle buffer to hold the output key handle
*
* @return EC_SUCCESS if a valid keypair was created.
*/
-int u2f_origin_user_keyhandle(const uint8_t *origin,
- const uint8_t *user,
+int u2f_origin_user_keyhandle(const uint8_t *origin, const uint8_t *user,
const uint8_t *seed,
- uint8_t *key_handle);
+ struct u2f_key_handle *key_handle);
+
+/**
+ * Pack the specified origin, user secret, origin-specific seed and version
+ * byte into a key handle.
+ *
+ * @param origin pointer to origin id
+ * @param user pointer to user secret
+ * @param seed pointer to origin-specific random seed
+ * @param version the version byte to pack; should be greater than 0.
+ * @param key_handle buffer to hold the output key handle
+ *
+ * @return EC_SUCCESS if a valid keypair was created.
+ */
+int u2f_origin_user_versioned_keyhandle(
+ const uint8_t *origin, const uint8_t *user, const uint8_t *seed,
+ uint8_t version, struct u2f_versioned_key_handle *key_handle);
/**
* Generate an origin and user-specific ECDSA keypair from the specified
@@ -73,17 +90,16 @@ int u2f_origin_user_keyhandle(const uint8_t *origin,
*
* If pk_x and pk_y are NULL, public key generation will be skipped.
*
- * @param key_handle pointer to the 64 byte key handle
+ * @param key_handle pointer to the key handle
+ * @param key_handle_size size of the key handle in bytes
* @param d pointer to ECDSA private key
* @param pk_x pointer to public key point
* @param pk_y pointer to public key point
*
* @return EC_SUCCESS if a valid keypair was created.
*/
-int u2f_origin_user_keypair(const uint8_t *key_handle,
- p256_int *d,
- p256_int *pk_x,
- p256_int *pk_y);
+int u2f_origin_user_keypair(const uint8_t *key_handle, size_t key_handle_size,
+ p256_int *d, p256_int *pk_x, p256_int *pk_y);
/***
* Generate a hardware derived 256b private key.