All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions
otp_util.c File Reference
#include "extern.h"
#include <inttypes.h>
#include <pthread.h>
#include <sys/types.h>
#include <stdlib.h>
#include <string.h>
+ Include dependency graph for otp_util.c:

Go to the source code of this file.

Functions

void _otp_pthread_mutex_init (pthread_mutex_t *mutexp, pthread_mutexattr_t const *attr, char const *caller)
 Guaranteed initialization. More...
 
void _otp_pthread_mutex_lock (pthread_mutex_t *mutexp, char const *caller)
 Guaranteed lock. More...
 
int _otp_pthread_mutex_trylock (pthread_mutex_t *mutexp, char const *caller)
 Guaranteed trylock. More...
 
void _otp_pthread_mutex_unlock (pthread_mutex_t *mutexp, char const *caller)
 Guaranteed unlock. More...
 
void otp_async_challenge (char challenge[OTP_MAX_CHALLENGE_LEN+1], size_t len)
 Generate a random challenge (ascii chars 0-9) More...
 
void otp_get_random (uint8_t *rnd_data, size_t len)
 Generate some random bytes. More...
 

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:

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:

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: