The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Macros | Typedefs | Functions | Variables
md5.h File Reference

Structures and prototypes for our local MD5 implementation. More...

#include <freeradius-devel/build.h>
#include <freeradius-devel/missing.h>
#include <inttypes.h>
#include <sys/types.h>
#include <stdint.h>
#include <stdbool.h>
#include <string.h>
+ Include dependency graph for md5.h:

Go to the source code of this file.

Macros

#define MD5_DIGEST_LENGTH   16
 

Typedefs

typedef fr_md5_ctx_t *(* fr_md5_ctx_alloc_t) (void)
 Allocation function for MD5 digest context. More...
 
typedef void(* fr_md5_ctx_copy_t) (fr_md5_ctx_t *dst, fr_md5_ctx_t const *src)
 Copy the contents of a ctx. More...
 
typedef void(* fr_md5_ctx_free_t) (fr_md5_ctx_t **ctx)
 Free function for MD5 digest ctx. More...
 
typedef void(* fr_md5_ctx_reset_t) (fr_md5_ctx_t *ctx)
 Reset the ctx to allow reuse. More...
 
typedef void fr_md5_ctx_t
 
typedef void(* fr_md5_final_t) (uint8_t out[static MD5_DIGEST_LENGTH], fr_md5_ctx_t *ctx)
 Finalise the ctx, producing the digest. More...
 
typedef void(* fr_md5_update_t) (fr_md5_ctx_t *ctx, uint8_t const *in, size_t inlen)
 Ingest plaintext into the digest. More...
 

Functions

int fr_hmac_md5 (uint8_t digest[static MD5_DIGEST_LENGTH], uint8_t const *in, size_t inlen, uint8_t const *key, size_t key_len)
 
void fr_md5_calc (uint8_t out[static MD5_DIGEST_LENGTH], uint8_t const *in, size_t inlen)
 Perform a single digest operation on a single input buffer. More...
 
fr_md5_ctx_tfr_md5_ctx_alloc_from_list (void)
 Allocate an MD5 context from a free list. More...
 
void fr_md5_ctx_free_from_list (fr_md5_ctx_t **ctx)
 Release an MD5 context back to a free list. More...
 

Variables

fr_md5_ctx_alloc_t fr_md5_ctx_alloc
 
fr_md5_ctx_copy_t fr_md5_ctx_copy
 
fr_md5_ctx_free_t fr_md5_ctx_free
 
fr_md5_ctx_reset_t fr_md5_ctx_reset
 
fr_md5_final_t fr_md5_final
 
fr_md5_update_t fr_md5_update
 

Detailed Description

Structures and prototypes for our local MD5 implementation.

Note
license is LGPL, but largely derived from a public domain source.

Structures and declarations for md5.

Definition in file md5.h.

Macro Definition Documentation

◆ MD5_DIGEST_LENGTH

#define MD5_DIGEST_LENGTH   16

Definition at line 25 of file md5.h.

Typedef Documentation

◆ fr_md5_ctx_alloc_t

typedef fr_md5_ctx_t*(* fr_md5_ctx_alloc_t) (void)

Allocation function for MD5 digest context.

Returns
  • An MD5 ctx.
  • NULL if out of memory.

Definition at line 53 of file md5.h.

◆ fr_md5_ctx_copy_t

typedef void(* fr_md5_ctx_copy_t) (fr_md5_ctx_t *dst, fr_md5_ctx_t const *src)

Copy the contents of a ctx.

Parameters
[in]dstWhere to copy the context to.
[in]srcWhere to copy the context from.

Definition at line 44 of file md5.h.

◆ fr_md5_ctx_free_t

typedef void(* fr_md5_ctx_free_t) (fr_md5_ctx_t **ctx)

Free function for MD5 digest ctx.

Parameters
[in]ctxMD5 ctx to free. If the shared ctx is passed in then the ctx is reset but not freed.

Definition at line 61 of file md5.h.

◆ fr_md5_ctx_reset_t

typedef void(* fr_md5_ctx_reset_t) (fr_md5_ctx_t *ctx)

Reset the ctx to allow reuse.

Parameters
[in]ctxTo reuse.

Definition at line 36 of file md5.h.

◆ fr_md5_ctx_t

typedef void fr_md5_ctx_t

Definition at line 28 of file md5.h.

◆ fr_md5_final_t

typedef void(* fr_md5_final_t) (uint8_t out[static MD5_DIGEST_LENGTH], fr_md5_ctx_t *ctx)

Finalise the ctx, producing the digest.

Parameters
[out]outThe MD5 digest.
[in]ctxTo finalise.

Definition at line 78 of file md5.h.

◆ fr_md5_update_t

typedef void(* fr_md5_update_t) (fr_md5_ctx_t *ctx, uint8_t const *in, size_t inlen)

Ingest plaintext into the digest.

Parameters
[in]ctxTo ingest data into.
[in]inData to ingest.
[in]inlenLength of data to ingest.

Definition at line 70 of file md5.h.

Function Documentation

◆ fr_hmac_md5()

int fr_hmac_md5 ( uint8_t  digest[static MD5_DIGEST_LENGTH],
uint8_t const *  in,
size_t  inlen,
uint8_t const *  key,
size_t  key_len 
)

◆ fr_md5_calc()

void fr_md5_calc ( uint8_t  out[static MD5_DIGEST_LENGTH],
uint8_t const *  in,
size_t  inlen 
)

Perform a single digest operation on a single input buffer.

Perform a single digest operation on a single input buffer.

Parameters
[out]outWhere to write the MD5 digest. Must be a minimum of MD5_DIGEST_LENGTH.
[in]inData to hash.
[in]inlenLength of the data.

Definition at line 251 of file merged_model.c.

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

◆ fr_md5_ctx_alloc_from_list()

fr_md5_ctx_t* fr_md5_ctx_alloc_from_list ( void  )

Allocate an MD5 context from a free list.

Allocate an MD5 context from a free list.

Definition at line 477 of file md5.c.

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

◆ fr_md5_ctx_free_from_list()

void fr_md5_ctx_free_from_list ( fr_md5_ctx_t **  ctx)

Release an MD5 context back to a free list.

Release an MD5 context back to a free list.

Definition at line 522 of file md5.c.

+ Here is the caller graph for this function:

Variable Documentation

◆ fr_md5_ctx_alloc

fr_md5_ctx_alloc_t fr_md5_ctx_alloc
extern

Definition at line 440 of file md5.c.

◆ fr_md5_ctx_copy

fr_md5_ctx_copy_t fr_md5_ctx_copy
extern

Definition at line 439 of file md5.c.

◆ fr_md5_ctx_free

fr_md5_ctx_free_t fr_md5_ctx_free
extern

Definition at line 441 of file md5.c.

◆ fr_md5_ctx_reset

fr_md5_ctx_reset_t fr_md5_ctx_reset
extern

Definition at line 438 of file md5.c.

◆ fr_md5_final

fr_md5_final_t fr_md5_final
extern

Definition at line 443 of file md5.c.

◆ fr_md5_update

fr_md5_update_t fr_md5_update
extern

Definition at line 442 of file md5.c.