The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Data Structures | Functions
totp.h File Reference
#include <freeradius-devel/server/request.h>
+ Include dependency graph for totp.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  fr_totp_t
 

Functions

int fr_totp_cmp (fr_totp_t const *cfg, request_t *request, time_t now, uint8_t const *key, size_t keylen, char const *totp))
 Implement RFC 6238 TOTP algorithm (HMAC-SHA1). More...
 

Data Structure Documentation

◆ fr_totp_t

struct fr_totp_t

Definition at line 33 of file totp.h.

Data Fields
uint32_t lookback_interval interval in seconds between steps
uint32_t lookback_steps number of steps to look back
uint32_t lookforward_steps number of steps to look forwards
uint32_t otp_length forced to 6 or 8
uint32_t time_step seconds

Function Documentation

◆ fr_totp_cmp()

int fr_totp_cmp ( fr_totp_t const *  cfg,
request_t request,
time_t  now,
uint8_t const *  key,
size_t  keylen,
char const *  totp 
)

Implement RFC 6238 TOTP algorithm (HMAC-SHA1).

Appendix B has test vectors.  Note that the test vectors are
for 8-character challenges, and not for 6 character
challenges!
Parameters
[in]cfgInstance of fr_totp_t
[in]requestThe current request
[in]nowThe current time
[in]keyKey to encrypt.
[in]keylenLength of key field.
[in]totpTOTP password entered by the user.
Returns
  • 0 On Success
  • -1 On Failure
  • -2 On incorrect arguments

Definition at line 71 of file totp.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function: