1oath_totp_validate2_callback(3)     liboath    oath_totp_validate2_callback(3)
2
3
4

NAME

6       oath_totp_validate2_callback - API function
7

SYNOPSIS

9       #include <oath.h>
10
11       int    oath_totp_validate2_callback(const   char   *   secret,   size_t
12       secret_length, time_t now, unsigned time_step_size,  time_t  start_off‐
13       set,  unsigned digits, size_t window, int * otp_pos, oath_validate_str‐
14       cmp_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       oath_validate_strcmp_function strcmp_otp
42                   function pointer to a strcmp-like function.
43
44       void * strcmp_handle
45                   caller handle to be passed on to strcmp_otp.
46

DESCRIPTION

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

RETURNS

73       Returns  absolute  value of position in OTP window (zero is first posi‐
74       tion), or OATH_INVALID_OTP if no OTP was found in  OTP  window,  or  an
75       error code.
76

SINCE

78       1.10.0
79

REPORTING BUGS

81       Report  bugs  to  <oath-toolkit-help@nongnu.org>.   liboath  home page:
82       http://www.gnu.org/software/liboath/ General help using  GNU  software:
83       http://www.gnu.org/gethelp/
84
86       Copyright © 2009-2016 Simon Josefsson.
87       Copying  and  distribution  of this file, with or without modification,
88       are permitted in any medium  without  royalty  provided  the  copyright
89       notice and this notice are preserved.
90
91
92
93liboath                              2.6.2     oath_totp_validate2_callback(3)
Impressum