hmacmd5.c File Reference

#include "config.h"
#include <isc/assertions.h>
#include <isc/hmacmd5.h>
#include <isc/md5.h>
#include <isc/platform.h>
#include <isc/safe.h>
#include <isc/string.h>
#include <isc/types.h>
#include <isc/util.h>

Go to the source code of this file.

Defines

#define PADLEN   64
#define IPAD   0x36
#define OPAD   0x5C

Functions

void isc_hmacmd5_init (isc_hmacmd5_t *ctx, const unsigned char *key, unsigned int len)
void isc_hmacmd5_invalidate (isc_hmacmd5_t *ctx)
void isc_hmacmd5_update (isc_hmacmd5_t *ctx, const unsigned char *buf, unsigned int len)
void isc_hmacmd5_sign (isc_hmacmd5_t *ctx, unsigned char *digest)
isc_boolean_t isc_hmacmd5_verify (isc_hmacmd5_t *ctx, unsigned char *digest)
isc_boolean_t isc_hmacmd5_verify2 (isc_hmacmd5_t *ctx, unsigned char *digest, size_t len)


Detailed Description

This code implements the HMAC-MD5 keyed hash algorithm described in RFC2104.

Definition in file hmacmd5.c.


Define Documentation

#define PADLEN   64

Definition at line 244 of file hmacmd5.c.

#define IPAD   0x36

Definition at line 245 of file hmacmd5.c.

Referenced by isc_hmacmd5_init(), isc_hmacsha1_init(), isc_hmacsha224_init(), isc_hmacsha256_init(), isc_hmacsha384_init(), and isc_hmacsha512_init().

#define OPAD   0x5C

Definition at line 246 of file hmacmd5.c.

Referenced by isc_hmacmd5_sign(), isc_hmacsha1_sign(), isc_hmacsha224_sign(), isc_hmacsha256_sign(), isc_hmacsha384_sign(), and isc_hmacsha512_sign().


Function Documentation

void isc_hmacmd5_init ( isc_hmacmd5_t ctx,
const unsigned char *  key,
unsigned int  len 
)

Start HMAC-MD5 process. Initialize an md5 context and digest the key.

Definition at line 252 of file hmacmd5.c.

References IPAD, isc_md5_final(), isc_md5_init(), isc_md5_update(), isc_hmacmd5_t::key, and isc_hmacmd5_t::md5ctx.

Referenced by ATF_TC_BODY(), hmacmd5_createctx(), sign(), and verify().

void isc_hmacmd5_invalidate ( isc_hmacmd5_t ctx  ) 

Definition at line 275 of file hmacmd5.c.

References isc_md5_invalidate(), isc_hmacmd5_t::key, and isc_hmacmd5_t::md5ctx.

Referenced by hmacmd5_destroyctx(), and isc_hmacmd5_sign().

void isc_hmacmd5_update ( isc_hmacmd5_t ctx,
const unsigned char *  buf,
unsigned int  len 
)

Update context to reflect the concatenation of another buffer full of bytes.

Definition at line 285 of file hmacmd5.c.

References isc_md5_update(), and isc_hmacmd5_t::md5ctx.

Referenced by ATF_TC_BODY(), hmacmd5_adddata(), sign(), and verify().

void isc_hmacmd5_sign ( isc_hmacmd5_t ctx,
unsigned char *  digest 
)

Compute signature - finalize MD5 operation and reapply MD5.

Definition at line 295 of file hmacmd5.c.

References isc_hmacmd5_invalidate(), ISC_MD5_DIGESTLENGTH, isc_md5_final(), isc_md5_init(), isc_md5_update(), isc_hmacmd5_t::key, isc_hmacmd5_t::md5ctx, and OPAD.

Referenced by ATF_TC_BODY(), hmacmd5_sign(), isc_hmacmd5_verify2(), sign(), and verify().

isc_boolean_t isc_hmacmd5_verify ( isc_hmacmd5_t ctx,
unsigned char *  digest 
)

Verify signature - finalize MD5 operation and reapply MD5, then compare to the supplied digest.

Definition at line 319 of file hmacmd5.c.

References isc_hmacmd5_verify2(), and ISC_MD5_DIGESTLENGTH.

isc_boolean_t isc_hmacmd5_verify2 ( isc_hmacmd5_t ctx,
unsigned char *  digest,
size_t  len 
)

Definition at line 324 of file hmacmd5.c.

References isc_hmacmd5_sign(), ISC_MD5_DIGESTLENGTH, isc_safe_memcmp(), and REQUIRE.

Referenced by hmacmd5_verify(), and isc_hmacmd5_verify().


Generated on Tue Apr 28 17:41:14 2015 by Doxygen 1.5.4 for BIND9 Internals 9.11.0pre-alpha