1oath_totp_validate_callback(3)      liboath     oath_totp_validate_callback(3)
2
3
4

NAME

6       oath_totp_validate_callback - API function
7

SYNOPSIS

9       #include <oath.h>
10
11       int   oath_totp_validate_callback(const   char  *  secret,  size_t  se‐
12       cret_length, time_t now, unsigned time_step_size, time_t  start_offset,
13       unsigned  digits,  size_t  window,  oath_validate_strcmp_function  str‐
14       cmp_otp, void * strcmp_handle);
15

ARGUMENTS

17       const char * secret
18                   the shared secret string
19
20       size_t secret_length
21                   length of secret
22
23       time_t now  Unix time value to compute TOTP for
24
25       unsigned time_step_size
26                   time step system parameter (typically 30)
27
28       time_t start_offset
29                   Unix time of when to start counting time  steps  (typically
30                   0)
31
32       unsigned digits
33                   number of requested digits in the OTP
34
35       size_t window
36                   how many OTPs after start counter to test
37
38       oath_validate_strcmp_function strcmp_otp
39                   function pointer to a strcmp-like function.
40
41       void * strcmp_handle
42                   caller handle to be passed on to strcmp_otp.
43

DESCRIPTION

45       Validate an OTP according to OATH TOTP algorithm per RFC 6238.
46
47       Validation  is implemented by generating a number of potential OTPs and
48       performing a call to the strcmp_otp function, to compare the  potential
49       OTP against the given otp.  It has the following prototype:
50
51       int   (*oath_validate_strcmp_function)   (void   *handle,   const  char
52       *test_otp);
53
54       The function should be similar to strcmp in that it return  0  only  on
55       matches.   It differs by permitting use of negative return codes as in‐
56       dication of internal failures in the callback.  Positive  values  indi‐
57       cate OTP mismatch.
58
59       This callback interface is useful when you cannot compare OTPs directly
60       using normal strcmp, but instead for example only have  a  hashed  OTP.
61       You  would  then  typically pass in the hashed OTP in the strcmp_handle
62       and let your implementation of strcmp_otp hash the test_otp  OTP  using
63       the same hash, and then compare the results.
64
65       Currently only OTP lengths of 6, 7 or 8 digits are supported.  This re‐
66       strictions may be lifted in future versions, although some  limitations
67       are inherent in the protocol.
68

RETURNS

70       Returns  position  in  OTP window (zero is first position), or OATH_IN‐
71       VALID_OTP if no OTP was found in OTP window, or an error code.
72

SINCE

74       1.6.0
75

REPORTING BUGS

77       Report bugs  to  <oath-toolkit-help@nongnu.org>.   liboath  home  page:
78       https://www.nongnu.org/oath-toolkit/  General  help using GNU software:
79       http://www.gnu.org/gethelp/
80
82       Copyright © 2009-2020 Simon Josefsson.
83       Copying and distribution of this file, with  or  without  modification,
84       are  permitted in any medium without royalty provided the copyright no‐
85       tice and this notice are preserved.
86
87
88
89liboath                              2.6.7      oath_totp_validate_callback(3)
Impressum