]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/wpa_supplicant/sha1.h
This commit was generated by cvs2svn to compensate for changes in r147353,
[FreeBSD/FreeBSD.git] / contrib / wpa_supplicant / sha1.h
1 #ifndef SHA1_H
2 #define SHA1_H
3
4 #ifdef EAP_TLS_FUNCS
5
6 #include <openssl/sha.h>
7
8 #define SHA1_CTX SHA_CTX
9 #define SHA1Init SHA1_Init
10 #define SHA1Update SHA1_Update
11 #define SHA1Final SHA1_Final
12 #define SHA1Transform SHA1_Transform
13 #define SHA1_MAC_LEN SHA_DIGEST_LENGTH
14
15 #else /* EAP_TLS_FUNCS */
16
17 #define SHA1_MAC_LEN 20
18
19 typedef struct {
20         u32 state[5];
21         u32 count[2];
22         unsigned char buffer[64];
23 } SHA1_CTX;
24
25 void SHA1Init(SHA1_CTX *context);
26 void SHA1Update(SHA1_CTX *context, const void *data, u32 len);
27 void SHA1Final(unsigned char digest[20], SHA1_CTX* context);
28 void SHA1Transform(u32 state[5], const unsigned char buffer[64]);
29
30 #endif /* EAP_TLS_FUNCS */
31
32 void sha1_mac(const u8 *key, size_t key_len, const u8 *data, size_t data_len,
33               u8 *mac);
34 void hmac_sha1_vector(const u8 *key, size_t key_len, size_t num_elem,
35                       const u8 *addr[], const size_t *len, u8 *mac);
36 void hmac_sha1(const u8 *key, size_t key_len, const u8 *data, size_t data_len,
37                u8 *mac);
38 void sha1_prf(const u8 *key, size_t key_len, const char *label,
39               const u8 *data, size_t data_len, u8 *buf, size_t buf_len);
40 void sha1_t_prf(const u8 *key, size_t key_len, const char *label,
41                 const u8 *seed, size_t seed_len, u8 *buf, size_t buf_len);
42 int tls_prf(const u8 *secret, size_t secret_len, const char *label,
43             const u8 *seed, size_t seed_len, u8 *out, size_t outlen);
44 void pbkdf2_sha1(const char *passphrase, const char *ssid, size_t ssid_len,
45                  int iterations, u8 *buf, size_t buflen);
46 void sha1_transform(u8 *state, u8 data[64]);
47 void sha1_vector(size_t num_elem, const u8 *addr[], const size_t *len,
48                  u8 *mac);
49
50 #endif /* SHA1_H */