2 * SHA1 hash implementation and interface functions
3 * Copyright (c) 2003-2005, Jouni Malinen <j@w1.fi>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
9 * Alternatively, this software may be distributed under the terms of BSD
12 * See README and COPYING for more details.
21 #define SHA1_MAC_LEN 20
26 unsigned char buffer
[64];
29 typedef struct SHA1Context SHA1_CTX
;
31 void SHA1Init(SHA1_CTX
*context
);
32 void SHA1Update(SHA1_CTX
*context
, const void *data
, uint32_t len
);
33 void SHA1Final(unsigned char digest
[20], SHA1_CTX
*context
);
40 typedef struct HMACContext HMAC_CTX
;
42 void HMACInit(HMAC_CTX
*context
, const uint8_t *key
, size_t key_len
);
43 void HMACUpdate(HMAC_CTX
*context
, const void *data
, uint32_t len
);
44 void HMACFinal(unsigned char digest
[20], HMAC_CTX
*context
);
46 void sha1_vector(size_t num_elem
, const uint8_t *addr
[], const size_t *len
,
48 void hmac_sha1_vector(const uint8_t *key
, size_t key_len
, size_t num_elem
,
49 const uint8_t *addr
[], const size_t *len
, uint8_t *mac
);
50 void hmac_sha1(const uint8_t *key
, size_t key_len
,
51 const uint8_t *data
, size_t data_len
, uint8_t *mac
);
52 void sha1_prf(const uint8_t *key
, size_t key_len
, const char *label
,
53 const uint8_t *data
, size_t data_len
, uint8_t *buf
, size_t buf_len
);