The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Functions
totp.c File Reference

Common function for TOTP validation. More...

#include <freeradius-devel/util/sha1.h>
#include <freeradius-devel/util/debug.h>
#include "totp.h"
+ Include dependency graph for totp.c:

Go to the source code of this file.

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...
 

Detailed Description

Common function for TOTP validation.

Id
681eebdea02c7757b79d4d0d2a3f7f9bdccb412e

Definition in file totp.c.

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: