All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions | Variables
rlm_yubikey.c File Reference

Authentication for yubikey OTP tokens. More...

#include "rlm_yubikey.h"
+ Include dependency graph for rlm_yubikey.c:

Go to the source code of this file.

Macros

#define is_modhex(x)   (memchr(modhextab, tolower(x), 16))
 

Functions

static int CC_HINT (nonnull)
 
static int mod_bootstrap (CONF_SECTION *conf, void *instance)
 
static int mod_instantiate (CONF_SECTION *conf, void *instance)
 
static ssize_t modhex2hex (char const *modhex, uint8_t *hex, size_t len)
 Convert yubikey modhex to normal hex. More...
 
static ssize_t modhex_to_hex_xlat (char **out, size_t outlen, UNUSED void const *mod_inst, UNUSED void const *xlat_inst, REQUEST *request, char const *fmt)
 Convert Yubikey modhex to standard hex. More...
 

Variables

static char const hextab [] = "0123456789abcdef"
 
static char const modhextab [] = "cbdefghijklnrtuv"
 
static const CONF_PARSER module_config []
 
module_t rlm_yubikey
 

Detailed Description

Authentication for yubikey OTP tokens.

Id:
bf91acbd24b86fb09604e41809fedfe6a11daccd
Author
Arran Cudbard-Bell a.cud.nosp@m.bard.nosp@m.b@net.nosp@m.work.nosp@m.radiu.nosp@m.s.co.nosp@m.m

Definition in file rlm_yubikey.c.

Macro Definition Documentation

#define is_modhex (   x)    (memchr(modhextab, tolower(x), 16))

Definition at line 62 of file rlm_yubikey.c.

Function Documentation

static int CC_HINT ( nonnull  )
static

Definition at line 199 of file rlm_yubikey.c.

static int mod_bootstrap ( CONF_SECTION conf,
void *  instance 
)
static

Definition at line 130 of file rlm_yubikey.c.

+ Here is the call graph for this function:

static int mod_instantiate ( CONF_SECTION conf,
void *  instance 
)
static

Definition at line 161 of file rlm_yubikey.c.

+ Here is the call graph for this function:

static ssize_t modhex2hex ( char const *  modhex,
uint8_t *  hex,
size_t  len 
)
static

Convert yubikey modhex to normal hex.

The same buffer may be passed as modhex and hex to convert the modhex in place.

Modhex and hex must be the same size.

Parameters
[in]modhexdata.
[in]lenof input and output buffers.
[out]hexwhere to write the standard hexits.
Returns
  • The number of bytes written to the output buffer.
  • -1 on failure.

Definition at line 77 of file rlm_yubikey.c.

+ Here is the caller graph for this function:

static ssize_t modhex_to_hex_xlat ( char **  out,
size_t  outlen,
UNUSED void const *  mod_inst,
UNUSED void const *  xlat_inst,
REQUEST request,
char const *  fmt 
)
static

Convert Yubikey modhex to standard hex.

Example: "%{modhextohex:vvrbuctetdhc}" == "ffc1e0d3d260"

Definition at line 109 of file rlm_yubikey.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

char const hextab[] = "0123456789abcdef"
static

Definition at line 60 of file rlm_yubikey.c.

char const modhextab[] = "cbdefghijklnrtuv"
static

Definition at line 59 of file rlm_yubikey.c.

const CONF_PARSER module_config[]
static
Initial value:
= {
{ FR_CONF_OFFSET("id_length", PW_TYPE_INTEGER, rlm_yubikey_t, id_len), .dflt = "12" },
{ FR_CONF_OFFSET("split", PW_TYPE_BOOLEAN, rlm_yubikey_t, split), .dflt = "yes" },
{ FR_CONF_OFFSET("decrypt", PW_TYPE_BOOLEAN, rlm_yubikey_t, decrypt), .dflt = "no" },
{ FR_CONF_OFFSET("validate", PW_TYPE_BOOLEAN, rlm_yubikey_t, validate), .dflt = "no" },
}
#define CONF_PARSER_TERMINATOR
Definition: conffile.h:289
A truth value.
Definition: radius.h:56
32 Bit unsigned integer.
Definition: radius.h:34
#define FR_CONF_OFFSET(_n, _t, _s, _f)
Definition: conffile.h:168

Definition at line 48 of file rlm_yubikey.c.

module_t rlm_yubikey
Initial value:
= {
.magic = RLM_MODULE_INIT,
.name = "yubikey",
.inst_size = sizeof(rlm_yubikey_t),
.config = module_config,
.bootstrap = mod_bootstrap,
.instantiate = mod_instantiate,
.methods = {
},
}
static int mod_instantiate(CONF_SECTION *conf, void *instance)
Definition: rlm_yubikey.c:161
static rlm_rcode_t mod_authorize(void *instance, REQUEST *request)
Handle authorization requests using Couchbase document data.
#define RLM_TYPE_THREAD_SAFE
Module is threadsafe.
Definition: modules.h:75
#define RLM_MODULE_INIT
Definition: modules.h:86
static const CONF_PARSER module_config[]
Definition: rlm_yubikey.c:48
static rlm_rcode_t mod_authenticate(void *instance, REQUEST *request) CC_HINT(nonnull)
static int mod_bootstrap(CONF_SECTION *conf, void *instance)
Definition: rlm_yubikey.c:130
0 methods index for authenticate section.
Definition: modules.h:41
struct rlm_yubikey_t rlm_yubikey_t
1 methods index for authorize section.
Definition: modules.h:42

Definition at line 425 of file rlm_yubikey.c.