2014-11-14 18:37:01 +01:00
|
|
|
/*
|
|
|
|
*
|
|
|
|
* Wireless daemon for Linux
|
|
|
|
*
|
|
|
|
* Copyright (C) 2013-2014 Intel Corporation. All rights reserved.
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stddef.h>
|
2014-12-26 18:46:27 +01:00
|
|
|
#include <stdbool.h>
|
2014-11-14 18:37:01 +01:00
|
|
|
|
2014-12-26 19:15:32 +01:00
|
|
|
enum crypto_cipher {
|
2015-03-26 04:33:07 +01:00
|
|
|
CRYPTO_CIPHER_WEP40 = 0x000fac01,
|
|
|
|
CRYPTO_CIPHER_WEP104 = 0x000fac05,
|
|
|
|
CRYPTO_CIPHER_TKIP = 0x000fac02,
|
|
|
|
CRYPTO_CIPHER_CCMP = 0x000fac04,
|
|
|
|
CRYPTO_CIPHER_BIP = 0x000fac06,
|
2014-12-26 19:15:32 +01:00
|
|
|
};
|
|
|
|
|
2014-12-26 21:14:02 +01:00
|
|
|
struct crypto_ptk {
|
|
|
|
uint8_t kck[16];
|
|
|
|
uint8_t kek[16];
|
|
|
|
uint8_t tk[0];
|
2014-12-28 06:50:51 +01:00
|
|
|
} __attribute__ ((packed));
|
2014-12-26 21:14:02 +01:00
|
|
|
|
2016-08-13 00:34:00 +02:00
|
|
|
extern const unsigned char crypto_dh5_prime[];
|
|
|
|
extern size_t crypto_dh5_prime_size;
|
|
|
|
extern const unsigned char crypto_dh5_generator[];
|
|
|
|
extern size_t crypto_dh5_generator_size;
|
|
|
|
|
2015-02-19 03:51:54 +01:00
|
|
|
bool hmac_md5(const void *key, size_t key_len,
|
|
|
|
const void *data, size_t data_len, void *output, size_t size);
|
2016-02-10 21:12:46 +01:00
|
|
|
bool hmac_sha1(const void *key, size_t key_len,
|
|
|
|
const void *data, size_t data_len, void *output, size_t size);
|
2015-02-19 03:45:52 +01:00
|
|
|
bool hmac_sha256(const void *key, size_t key_len,
|
|
|
|
const void *data, size_t data_len, void *output, size_t size);
|
2015-02-19 04:02:09 +01:00
|
|
|
bool cmac_aes(const void *key, size_t key_len,
|
|
|
|
const void *data, size_t data_len, void *output, size_t size);
|
|
|
|
|
|
|
|
bool aes_unwrap(const uint8_t *kek, const uint8_t *in, size_t len,
|
|
|
|
uint8_t *out);
|
2015-02-19 04:11:37 +01:00
|
|
|
bool arc4_skip(const uint8_t *key, size_t key_len, size_t skip,
|
|
|
|
const uint8_t *in, size_t len, uint8_t *out);
|
2015-02-19 03:45:52 +01:00
|
|
|
|
2014-12-26 19:15:32 +01:00
|
|
|
int crypto_cipher_key_len(enum crypto_cipher cipher);
|
2014-12-26 19:15:46 +01:00
|
|
|
int crypto_cipher_tk_bits(enum crypto_cipher cipher);
|
2014-12-26 19:15:32 +01:00
|
|
|
|
2016-02-10 21:32:27 +01:00
|
|
|
bool pbkdf2_sha1(const void *password, size_t password_len,
|
|
|
|
const void *salt, size_t salt_len,
|
|
|
|
unsigned int iterations, void *output, size_t size);
|
|
|
|
|
2014-11-14 18:37:01 +01:00
|
|
|
int crypto_psk_from_passphrase(const char *passphrase,
|
|
|
|
const unsigned char *ssid, size_t ssid_len,
|
|
|
|
unsigned char *out_psk);
|
2014-12-26 18:46:27 +01:00
|
|
|
|
2016-02-10 23:30:22 +01:00
|
|
|
bool kdf_sha256(const void *key, size_t key_len,
|
|
|
|
const void *prefix, size_t prefix_len,
|
|
|
|
const void *data, size_t data_len, void *output, size_t size);
|
2016-02-10 21:16:32 +01:00
|
|
|
bool prf_sha1(const void *key, size_t key_len,
|
|
|
|
const void *prefix, size_t prefix_len,
|
|
|
|
const void *data, size_t data_len, void *output, size_t size);
|
|
|
|
|
2014-12-26 21:14:02 +01:00
|
|
|
bool crypto_derive_pairwise_ptk(const uint8_t *pmk,
|
|
|
|
const uint8_t *addr1, const uint8_t *addr2,
|
|
|
|
const uint8_t *nonce1, const uint8_t *nonce2,
|
2016-02-10 23:54:55 +01:00
|
|
|
struct crypto_ptk *out_ptk, size_t ptk_len,
|
|
|
|
bool use_sha256);
|