diff options
author | Jack Lloyd <[email protected]> | 2018-08-16 13:41:17 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2018-08-16 13:41:17 -0400 |
commit | dd5c97b25c1dd16c2097a254eb98a1655da61b7f (patch) | |
tree | 7f45d6b8e2a3a16550ca1cb92267080420afdcb2 /src/lib/ffi/ffi.h | |
parent | 25b13af42e05b0522306cee2a1218a5557d25f42 (diff) |
Add TOTP to FFI
Diffstat (limited to 'src/lib/ffi/ffi.h')
-rw-r--r-- | src/lib/ffi/ffi.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/lib/ffi/ffi.h b/src/lib/ffi/ffi.h index 8a4570c52..27eb8f6d1 100644 --- a/src/lib/ffi/ffi.h +++ b/src/lib/ffi/ffi.h @@ -1448,6 +1448,7 @@ typedef struct botan_hotp_struct* botan_hotp_t; /** * Initialize an HOTP instance */ +BOTAN_PUBLIC_API(2,8) int botan_hotp_init(botan_hotp_t* hotp, const uint8_t key[], size_t key_len, const char* hash_algo, @@ -1456,11 +1457,13 @@ int botan_hotp_init(botan_hotp_t* hotp, /** * Destroy a HOTP instance */ +BOTAN_PUBLIC_API(2,8) int botan_hotp_destroy(botan_hotp_t hotp); /** * Generate an HOTP code for the provided counter */ +BOTAN_PUBLIC_API(2,8) int botan_hotp_generate(botan_hotp_t hotp, uint32_t* hotp_code, uint64_t hotp_counter); @@ -1468,6 +1471,7 @@ int botan_hotp_generate(botan_hotp_t hotp, /** * Verify an HOTP code */ +BOTAN_PUBLIC_API(2,8) int botan_hotp_check(botan_hotp_t hotp, uint64_t* next_hotp_counter, uint32_t hotp_code, @@ -1476,6 +1480,49 @@ int botan_hotp_check(botan_hotp_t hotp, /** +* TOTP +*/ + +typedef struct botan_totp_struct* botan_totp_t; + +/** +* Initialize an TOTP instance +*/ +BOTAN_PUBLIC_API(2,8) +int botan_totp_init(botan_totp_t* totp, + const uint8_t key[], size_t key_len, + const char* hash_algo, + size_t digits, + size_t time_step); + +/** +* Destroy a TOTP instance +*/ +BOTAN_PUBLIC_API(2,8) +int botan_totp_destroy(botan_totp_t totp); + +/** +* Generate an TOTP code for the provided counter +*/ +BOTAN_PUBLIC_API(2,8) +int botan_totp_generate(botan_totp_t totp, + uint32_t* totp_code, + uint64_t timestamp); + +/** +* Verify an TOTP code +* @param totp the TOTP object +* @param clock_drift if non-null and otp code is valid, +* set to the drift between the two clocks. +*/ +BOTAN_PUBLIC_API(2,8) +int botan_totp_check(botan_totp_t totp, + uint32_t totp_code, + uint64_t timestamp, + size_t acceptable_clock_drift); + + +/** * Format Preserving Encryption */ |