All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Functions | Variables
extern.h File Reference
#include <freeradius-devel/radiusd.h>
#include <freeradius-devel/modules.h>
#include <sys/types.h>
#include <pthread.h>
#include "otp.h"
+ Include dependency graph for extern.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  rlm_otp_t
 

Macros

#define OTP_CHALLENGE_PROMPT   "Challenge: %{reply:OTP-Challenge}\n Response: "
 
#define OTP_MAX_RADSTATE_LEN   2 + (OTP_MAX_CHALLENGE_LEN * 2 + 8 + 8 + 32)*2 + 1
 
#define OTP_OTPD_RP   "/var/run/otpd/socket"
 
#define otp_pthread_mutex_init(a, b)   _otp_pthread_mutex_init((a), (b), __func__)
 
#define otp_pthread_mutex_lock(a)   _otp_pthread_mutex_lock((a), __func__)
 
#define otp_pthread_mutex_trylock(a)   _otp_pthread_mutex_trylock((a), __func__)
 
#define otp_pthread_mutex_unlock(a)   _otp_pthread_mutex_unlock((a), __func__)
 

Typedefs

typedef struct rlm_otp_t rlm_otp_t
 

Functions

void _otp_pthread_mutex_init (pthread_mutex_t *, pthread_mutexattr_t const *, char const *)
 Guaranteed initialization. More...
 
void _otp_pthread_mutex_lock (pthread_mutex_t *, char const *)
 Guaranteed lock. More...
 
int _otp_pthread_mutex_trylock (pthread_mutex_t *, char const *)
 Guaranteed trylock. More...
 
void _otp_pthread_mutex_unlock (pthread_mutex_t *, char const *)
 Guaranteed unlock. More...
 
ssize_t otp_a2x (uint8_t const *, size_t, uint8_t *)
 
void otp_async_challenge (char[OTP_MAX_CHALLENGE_LEN+1], size_t)
 Generate a random challenge (ascii chars 0-9) More...
 
size_t otp_gen_state (char[OTP_MAX_RADSTATE_LEN], char const [OTP_MAX_CHALLENGE_LEN], size_t, int32_t, int32_t, uint8_t const [16])
 Generate an OTP state value. More...
 
void otp_get_random (uint8_t *, size_t)
 Generate some random bytes. More...
 
void otp_mppe (REQUEST *, otp_pwe_t, rlm_otp_t const *, char const *)
 
int otp_pw_valid (REQUEST *, int, char const *, rlm_otp_t const *, char[])
 
void otp_pwe_init (void)
 
otp_pwe_t otp_pwe_present (REQUEST const *)
 

Variables

const fr_dict_attr_tpwattr [8]
 

Data Structure Documentation

struct rlm_otp_t

Definition at line 41 of file extern.h.

Data Fields
bool allow_async C/R mode allowed?
bool allow_sync Useful to override pwdfile card_type settings.
char const * chal_prompt Text to present challenge to user must have s.
uint32_t challenge_delay Max delay time for response, in seconds.
uint32_t challenge_len Challenge length, min 5 digits.
uint8_t hmac_key[16] because it doesn't track State
uint32_t mschap_mppe_policy Whether or not do to mppe for mschap .
uint32_t mschap_mppe_types key type/length for mschap/mppe.
uint32_t mschapv2_mppe_policy Whether or not do to mppe for mschapv2.
uint32_t mschapv2_mppe_types Key type/length for mschapv2/mppe.
char const * name Instance name for mod_authorize().
char const * otpd_rp Otpd rendezvous point.

Macro Definition Documentation

#define OTP_CHALLENGE_PROMPT   "Challenge: %{reply:OTP-Challenge}\n Response: "

Definition at line 39 of file extern.h.

#define OTP_MAX_RADSTATE_LEN   2 + (OTP_MAX_CHALLENGE_LEN * 2 + 8 + 8 + 32)*2 + 1

Definition at line 70 of file extern.h.

#define OTP_OTPD_RP   "/var/run/otpd/socket"

Definition at line 36 of file extern.h.

#define otp_pthread_mutex_init (   a,
 
)    _otp_pthread_mutex_init((a), (b), __func__)

Definition at line 93 of file extern.h.

#define otp_pthread_mutex_lock (   a)    _otp_pthread_mutex_lock((a), __func__)

Definition at line 94 of file extern.h.

#define otp_pthread_mutex_trylock (   a)    _otp_pthread_mutex_trylock((a), __func__)

Definition at line 95 of file extern.h.

#define otp_pthread_mutex_unlock (   a)    _otp_pthread_mutex_unlock((a), __func__)

Definition at line 96 of file extern.h.

Typedef Documentation

typedef struct rlm_otp_t rlm_otp_t

Function Documentation

void _otp_pthread_mutex_init ( pthread_mutex_t *  mutexp,
pthread_mutexattr_t const *  attr,
char const *  caller 
)

Guaranteed initialization.

Definition at line 82 of file otp_util.c.

+ Here is the call graph for this function:

void _otp_pthread_mutex_lock ( pthread_mutex_t *  mutexp,
char const *  caller 
)

Guaranteed lock.

Definition at line 98 of file otp_util.c.

+ Here is the call graph for this function:

int _otp_pthread_mutex_trylock ( pthread_mutex_t *  mutexp,
char const *  caller 
)

Guaranteed trylock.

Definition at line 114 of file otp_util.c.

+ Here is the call graph for this function:

void _otp_pthread_mutex_unlock ( pthread_mutex_t *  mutexp,
char const *  caller 
)

Guaranteed unlock.

Definition at line 132 of file otp_util.c.

+ Here is the call graph for this function:

ssize_t otp_a2x ( uint8_t const *  ,
size_t  ,
uint8_t *   
)
void otp_async_challenge ( char  challenge[OTP_MAX_CHALLENGE_LEN+1],
size_t  len 
)

Generate a random challenge (ascii chars 0-9)

Note
This is really cryptocard-specific (automatic ASCII conversion
and null termination).
Parameters
[out]challengeBuffer to write random string to.
[in]lenNumber of random bytes to write to buffer.

Definition at line 63 of file otp_util.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

size_t otp_gen_state ( char  state[OTP_MAX_RADSTATE_LEN],
char const  challenge[OTP_MAX_CHALLENGE_LEN],
size_t  clen,
int32_t  flags,
int32_t  when,
uint8_t const  key[16] 
)

Generate an OTP state value.

Generates an OTP state value (an string of ASCII hexits in an opaque binary string).

Parameters
[out]statebuffer in which to write the generated state value.
[in]challengeThe challenge value.
[in]clenThe length of the challenge data.
[in]flagsto remember.
[in]whenthe challenge was originally generated.
[in]keyHMAC key.
Returns
the amount of data written into the state buffer.

Definition at line 108 of file otp_radstate.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void otp_get_random ( uint8_t *  rnd_data,
size_t  len 
)

Generate some random bytes.

Parameters
rnd_dataBuffer to write bytes to.
lenNumber of bytes to write.

Definition at line 37 of file otp_util.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void otp_mppe ( REQUEST ,
otp_pwe_t  ,
rlm_otp_t const *  ,
char const *   
)

Definition at line 45 of file otp_mppe.c.

+ Here is the call graph for this function:

int otp_pw_valid ( REQUEST ,
int  ,
char const *  ,
rlm_otp_t const *  ,
char  [] 
)
void otp_pwe_init ( void  )

Definition at line 53 of file otp_pwe.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

otp_pwe_t otp_pwe_present ( REQUEST const *  )

Definition at line 120 of file otp_pwe.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

const fr_dict_attr_t* pwattr[8]

Definition at line 48 of file otp_pwe.c.