添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) static size_t hmac_ctxsize (struct digest_algorithm *digest)  Calculate HMAC context size. More...
static void hmac_update (struct digest_algorithm *digest, void * ctx , const void * data , size_t len )  Update HMAC. More...
void hmac_init (struct digest_algorithm *digest, void * ctx , const void * key , size_t key_len)  Initialise HMAC. More...
void hmac_final (struct digest_algorithm *digest, void * ctx , void *hmac)  Finalise HMAC. More...

Detailed Description

Keyed-Hashing for Message Authentication.

Definition in file hmac.h .

Macro Definition Documentation

hmac_context_t

Value:
struct { \
/** Digest context */ \
uint8_t ctx [ digest->ctxsize ]; \
/** HMAC input/output padding */ \
uint8_t pad [ digest->blocksize ]; \
} __attribute__ (( packed ))
#define __attribute__(x)
Definition: compiler.h:10
u32 pad[9]
Padding.
Definition: ar9003_mac.h:90
struct golan_eq_context ctx
Definition: CIB_PRM.h:28

HMAC context type.

Definition at line 14 of file hmac.h .

Function Documentation

FILE_LICENCE()

Definition at line 28 of file hmac.h .

28 {
29 hmac_context_t ( digest ) *hctx;
30
31 return sizeof ( *hctx );
32 }
#define hmac_context_t(digest)
HMAC context type.
Definition: hmac.h:14

References hmac_context_t .

Referenced by hmac_drbg_update_key() , hmac_drbg_update_value() , hmac_okx() , peerdist_info_passphrase_okx() , peerdist_info_segment_hash() , tls_hmac() , tls_hmac_list() , and tls_p_hash_va() .

Definition at line 42 of file hmac.h .

43 {
44 hmac_context_t ( digest ) *hctx = ctx ;
45
46 digest_update ( digest, hctx->ctx, data , len );
47 }
static void digest_update(struct digest_algorithm *digest, void *ctx, const void *data, size_t len)
Definition: crypto.h:206
#define hmac_context_t(digest)
HMAC context type.
Definition: hmac.h:14
struct golan_eq_context ctx
Definition: CIB_PRM.h:28
uint8_t data[48]
Additional event data.
Definition: ena.h:22
uint32_t len
Length.
Definition: ena.h:14

References ctx , data , digest_update() , hmac_context_t , and len .

Referenced by ccmp_kie_mic() , hmac_drbg_update_key() , hmac_drbg_update_value() , hmac_okx() , ntlm_key() , ntlm_response() , pbkdf2_sha1_f() , peerdist_info_passphrase_okx() , peerdist_info_segment_hash() , prf_sha1() , tkip_kie_mic() , tls_hmac_init() , tls_hmac_update() , tls_hmac_update_va() , and tls_p_hash_va() .

Definition at line 57 of file hmac.c .

58 {
59 hmac_context_t ( digest ) *hctx = ctx ;
60 unsigned int i;
61
62 /* Construct input pad */
63 memset ( hctx->pad, 0, sizeof ( hctx->pad ) );
64 if ( key_len <= sizeof ( hctx->pad ) ) {
65 memcpy ( hctx->pad, key , key_len );
66 } else {
67 digest_init ( digest, hctx->ctx );
68 digest_update ( digest, hctx->ctx, key , key_len );
69 digest_final ( digest, hctx->ctx, hctx->pad );
70 }
71 for ( i = 0 ; i < sizeof ( hctx->pad ) ; i++ ) {
72 hctx->pad[i] ^= 0x36;
73 }
74
75 /* Start inner hash */
76 digest_init ( digest, hctx->ctx );
77 digest_update ( digest, hctx->ctx, hctx->pad, sizeof ( hctx->pad ) );
78 }
static void digest_update(struct digest_algorithm *digest, void *ctx, const void *data, size_t len)
Definition: crypto.h:206
#define hmac_context_t(digest)
HMAC context type.
Definition: hmac.h:14
static void digest_final(struct digest_algorithm *digest, void *ctx, void *out)
Definition: crypto.h:212
struct golan_eq_context ctx
Definition: CIB_PRM.h:28
void * memcpy(void *dest, const void *src, size_t len) __nonnull
static void digest_init(struct digest_algorithm *digest, void *ctx)
Definition: crypto.h:201
union @383 key
Sense key.
Definition: scsi.h:18
void * memset(void *dest, int character, size_t len) __nonnull

References ctx , digest_final() , digest_init() , digest_update() , hmac_context_t , key , memcpy() , and memset() .

Referenced by ccmp_kie_mic() , hmac_drbg_update_key() , hmac_drbg_update_value() , hmac_okx() , ntlm_key() , ntlm_response() , pbkdf2_sha1_f() , peerdist_info_passphrase_okx() , peerdist_info_segment_hash() , prf_sha1() , tkip_kie_mic() , tls_hmac_init() , and tls_p_hash_va() .

Definition at line 87 of file hmac.c .

87 {
88 hmac_context_t ( digest ) *hctx = ctx ;
89 unsigned int i;
90
91 /* Construct output pad from input pad */
92 for ( i = 0 ; i < sizeof ( hctx->pad ) ; i++ ) {
93 hctx->pad[i] ^= 0x6a;
94 }
95
96 /* Finish inner hash */
97 digest_final ( digest, hctx->ctx, hmac );
98
99 /* Perform outer hash */
100 digest_init ( digest, hctx->ctx );
101 digest_update ( digest, hctx->ctx, hctx->pad, sizeof ( hctx->pad ) );
102 digest_update ( digest, hctx->ctx, hmac, digest-> digestsize );
103 digest_final ( digest, hctx->ctx, hmac );
104
105 /* Erase output pad (from which the key may be derivable) */
106 memset ( hctx->pad, 0, sizeof ( hctx->pad ) );
107 }
static void digest_update(struct digest_algorithm *digest, void *ctx, const void *data, size_t len)
Definition: crypto.h:206
#define hmac_context_t(digest)
HMAC context type.
Definition: hmac.h:14
static void digest_final(struct digest_algorithm *digest, void *ctx, void *out)
Definition: crypto.h:212
struct golan_eq_context ctx
Definition: CIB_PRM.h:28
static void digest_init(struct digest_algorithm *digest, void *ctx)
Definition: crypto.h:201
size_t digestsize
Digest size.
Definition: crypto.h:26
void * memset(void *dest, int character, size_t len) __nonnull

References ctx , digest_final() , digest_init() , digest_update() , digest_algorithm::digestsize , hmac_context_t , and memset() .

Referenced by ccmp_kie_mic() , hmac_drbg_update_key() , hmac_drbg_update_value() , hmac_okx() , ntlm_key() , ntlm_response() , pbkdf2_sha1_f() , peerdist_info_passphrase_okx() , peerdist_info_segment_hash() , prf_sha1() , tkip_kie_mic() , tls_hmac_final() , and tls_p_hash_va() .