1oath_totp_validate3_callback(3)     liboath    oath_totp_validate3_callback(3)
2
3
4

NAME

6       oath_totp_validate3_callback - API function
7

SYNOPSIS

9       #include <oath.h>
10
11       int   oath_totp_validate3_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, int * otp_pos, uint64_t * otp_counter,
14       oath_validate_strcmp_function strcmp_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       int * otp_pos
39                   output search position in search window (may be NULL).
40
41       uint64_t * otp_counter
42                   counter value used to calculate OTP value (may be NULL).
43
44       oath_validate_strcmp_function strcmp_otp
45                   function pointer to a strcmp-like function.
46
47       void * strcmp_handle
48                   caller handle to be passed on to strcmp_otp.
49

DESCRIPTION

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

RETURNS

76       Returns  absolute  value of position in OTP window (zero is first posi‐
77       tion), or OATH_INVALID_OTP if no OTP was found in OTP window, or an er‐
78       ror code.
79

SINCE

81       2.4.0
82

REPORTING BUGS

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