nexmon – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 /*
2 * coWPAtty - Brute-force dictionary attack against WPA-PSK.
3 *
4 * Copyright (c) 2004-2005, Joshua Wright <jwright@hasborg.com>
5 *
6 * $Id: sha1.h,v 4.1 2008-03-20 16:49:38 jwright Exp $
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation. See COPYING for more
11 * details.
12 *
13 * coWPAtty is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 */
18  
19 /*
20 * Significant code is graciously taken from the following:
21 * wpa_supplicant by Jouni Malinen. This tool would have been MUCH more
22 * difficult for me if not for this code. Thanks Jouni.
23 */
24  
25 #ifndef SHA1_H
26 #define SHA1_H
27  
28 #ifdef OPENSSL
29  
30 #include <openssl/sha.h>
31  
32 #define SHA1_CTX SHA_CTX
33 #define SHA1Init SHA1_Init
34 #define SHA1Update SHA1_Update
35 #define SHA1Final SHA1_Final
36 #define SHA1_MAC_LEN SHA_DIGEST_LENGTH
37  
38 #else /* OPENSSL */
39 #error "OpenSSL is required for SHA1 support."
40 #endif /* OPENSSL */
41  
42 #define USECACHED 1
43 #define NOCACHED 0
44  
45 typedef struct {
46 SHA1_CTX k_ipad;
47 SHA1_CTX k_opad;
48 /*
49 unsigned char k_ipad[65];
50 unsigned char k_opad[65];
51 */
52 unsigned char k_ipad_set;
53 unsigned char k_opad_set;
54 } SHA1_CACHE;
55  
56 void sha1_mac(unsigned char *key, unsigned int key_len,
57 unsigned char *data, unsigned int data_len, unsigned char *mac);
58 void hmac_sha1_vector(unsigned char *key, unsigned int key_len,
59 size_t num_elem, unsigned char *addr[],
60 unsigned int *len, unsigned char *mac, int usecached);
61 void hmac_sha1(unsigned char *key, unsigned int key_len,
62 unsigned char *data, unsigned int data_len,
63 unsigned char *mac, int usecached);
64 void sha1_prf(unsigned char *key, unsigned int key_len,
65 char *label, unsigned char *data, unsigned int data_len,
66 unsigned char *buf, size_t buf_len);
67 void pbkdf2_sha1(char *passphrase, char *ssid, size_t ssid_len, int iterations,
68 unsigned char *buf, size_t buflen, int usecached);
69 void sha1_transform(u8 * state, u8 data[64]);
70  
71 #endif /* SHA1_H */