mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 11:10:54 +03:00
wpa_supplicant: Make internally used crypto headers private
A lot of internally used crypto headers are publicly includeable in user projects. This leads to bug reports when these headers are incorrectly used or the API's are not used as intended. Move all crypto headers into private crypto src folder, also move crypto_ops into Supplicant to remove dependecy on crypto headers. Closes IDF-476
This commit is contained in:
@@ -12,6 +12,7 @@ set(srcs "port/os_xtensa.c"
|
||||
"src/crypto/aes-wrap.c"
|
||||
"src/crypto/bignum.c"
|
||||
"src/crypto/crypto_mbedtls.c"
|
||||
"src/crypto/crypto_ops.c"
|
||||
"src/crypto/crypto_internal-cipher.c"
|
||||
"src/crypto/crypto_internal-modexp.c"
|
||||
"src/crypto/crypto_internal-rsa.c"
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
#ifndef WEPKEY_H
|
||||
#define WEPKEY_H
|
||||
|
||||
#define WEPKEY_64_BYTES 5
|
||||
#define WePKEY_128_BYTES 13
|
||||
|
||||
unsigned int wepkey_64(uint8_t *out, unsigned int size, const char *in, int n);
|
||||
unsigned int wepkey_128(uint8_t *out, unsigned int size, const char *in, int n);
|
||||
|
||||
#endif /* WEPKEY_H */
|
||||
@@ -40,7 +40,10 @@ extern "C" {
|
||||
/** @addtogroup WPA_APIs
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Crypto callback functions */
|
||||
const wpa_crypto_funcs_t g_wifi_default_wpa_crypto_funcs;
|
||||
/* Mesh crypto callback functions */
|
||||
const mesh_crypto_funcs_t g_wifi_default_mesh_crypto_funcs;
|
||||
|
||||
/**
|
||||
* @brief Supplicant initialization
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
#include "utils/common.h"
|
||||
#include "crypto/crypto.h"
|
||||
#include "crypto/random.h"
|
||||
#include "common/ieee802_11_defs.h"
|
||||
#include "hostapd.h"
|
||||
#include "ap/sta_info.h"
|
||||
|
||||
@@ -31,8 +31,8 @@
|
||||
#include "utils/includes.h"
|
||||
|
||||
#include "utils/common.h"
|
||||
#include "crypto/aes.h"
|
||||
#include "crypto/aes_wrap.h"
|
||||
#include "aes.h"
|
||||
#include "aes_wrap.h"
|
||||
|
||||
#ifdef USE_MBEDTLS_CRYPTO
|
||||
#include "mbedtls/aes.h"
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
#include "utils/includes.h"
|
||||
|
||||
#include "utils/common.h"
|
||||
#include "crypto/crypto.h"
|
||||
#include "crypto/aes_i.h"
|
||||
#include "crypto.h"
|
||||
#include "aes_i.h"
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
|
||||
#include "utils/includes.h"
|
||||
#include "utils/common.h"
|
||||
#include "crypto/crypto.h"
|
||||
#include "crypto/aes_i.h"
|
||||
#include "crypto.h"
|
||||
#include "aes_i.h"
|
||||
|
||||
#include "os.h"
|
||||
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
#include "utils/includes.h"
|
||||
|
||||
#include "utils/common.h"
|
||||
#include "crypto/crypto.h"
|
||||
#include "crypto/aes_i.h"
|
||||
#include "crypto.h"
|
||||
#include "aes_i.h"
|
||||
|
||||
/*
|
||||
* rijndael-alg-fst.c
|
||||
|
||||
@@ -34,8 +34,8 @@
|
||||
#ifdef USE_MBEDTLS_CRYPTO
|
||||
#include "mbedtls/aes.h"
|
||||
#else /* USE_MBEDTLS_CRYPTO */
|
||||
#include "crypto/aes.h"
|
||||
#include "crypto/aes_wrap.h"
|
||||
#include "aes.h"
|
||||
#include "aes_wrap.h"
|
||||
#endif /* USE_MBEDTLS_CRYPTO */
|
||||
|
||||
/**
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
#include "utils/includes.h"
|
||||
|
||||
#include "utils/common.h"
|
||||
#include "crypto/aes.h"
|
||||
#include "crypto/aes_wrap.h"
|
||||
#include "aes.h"
|
||||
#include "aes_wrap.h"
|
||||
#ifdef USE_MBEDTLS_CRYPTO
|
||||
#include "mbedtls/aes.h"
|
||||
#endif /* USE_MBEDTLS_CRYPTO */
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#ifndef AES_I_H
|
||||
#define AES_I_H
|
||||
|
||||
#include "crypto/aes.h"
|
||||
#include "aes.h"
|
||||
|
||||
/* #define FULL_UNROLL */
|
||||
#define AES_SMALL_TABLES
|
||||
|
||||
@@ -23,10 +23,10 @@
|
||||
|
||||
#include "utils/common.h"
|
||||
#include "utils/includes.h"
|
||||
#include "crypto/crypto.h"
|
||||
#include "crypto/aes.h"
|
||||
#include "crypto.h"
|
||||
#include "aes.h"
|
||||
#if defined(CONFIG_DES) || defined(CONFIG_DES3)
|
||||
#include "crypto/des_i.h"
|
||||
#include "des_i.h"
|
||||
#endif
|
||||
#ifdef USE_MBEDTLS_CRYPTO
|
||||
#include "mbedtls/aes.h"
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#else /* USE_MBEDTLS_CRYPTO */
|
||||
#include "bignum.h"
|
||||
#endif /* USE_MBEDTLS_CRYPTO */
|
||||
#include "crypto/crypto.h"
|
||||
#include "crypto.h"
|
||||
|
||||
#ifdef USE_MBEDTLS_CRYPTO
|
||||
int
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
#include "utils/common.h"
|
||||
#include "crypto/crypto.h"
|
||||
#include "crypto.h"
|
||||
|
||||
#include "utils/includes.h"
|
||||
#include "utils/common.h"
|
||||
|
||||
@@ -23,9 +23,9 @@
|
||||
|
||||
#include "utils/includes.h"
|
||||
#include "utils/common.h"
|
||||
#include "crypto/crypto.h"
|
||||
#include "crypto/sha1_i.h"
|
||||
#include "crypto/md5_i.h"
|
||||
#include "crypto.h"
|
||||
#include "sha1_i.h"
|
||||
#include "md5_i.h"
|
||||
#ifdef USE_MBEDTLS_CRYPTO
|
||||
#include "mbedtls/sha256.h"
|
||||
#endif
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
#include "utils/includes.h"
|
||||
#include "utils/common.h"
|
||||
#include "crypto/crypto.h"
|
||||
#include "crypto.h"
|
||||
|
||||
#include "mbedtls/ecp.h"
|
||||
#include "mbedtls/entropy.h"
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
// Copyright 2015-2017 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#include "utils/common.h"
|
||||
#include "aes_wrap.h"
|
||||
#include "sha256.h"
|
||||
#include "crypto.h"
|
||||
#include "md5.h"
|
||||
#include "sha1.h"
|
||||
#include "aes.h"
|
||||
#include "esp_wpa.h"
|
||||
|
||||
/*
|
||||
* This structure is used to set the cyrpto callback function for station to connect when in security mode.
|
||||
* These functions either call MbedTLS API's if USE_MBEDTLS_CRYPTO flag is set through Kconfig, or native
|
||||
* API's otherwise. We recommend setting the flag since MbedTLS API's utilize hardware acceleration while
|
||||
* native API's are use software implementations.
|
||||
*/
|
||||
const wpa_crypto_funcs_t g_wifi_default_wpa_crypto_funcs = {
|
||||
.size = sizeof(wpa_crypto_funcs_t),
|
||||
.version = ESP_WIFI_CRYPTO_VERSION,
|
||||
.aes_wrap = (esp_aes_wrap_t)aes_wrap,
|
||||
.aes_unwrap = (esp_aes_unwrap_t)aes_unwrap,
|
||||
.hmac_sha256_vector = (esp_hmac_sha256_vector_t)hmac_sha256_vector,
|
||||
.sha256_prf = (esp_sha256_prf_t)sha256_prf,
|
||||
.hmac_md5 = (esp_hmac_md5_t)hmac_md5,
|
||||
.hamc_md5_vector = (esp_hmac_md5_vector_t)hmac_md5_vector,
|
||||
.hmac_sha1 = (esp_hmac_sha1_t)hmac_sha1,
|
||||
.hmac_sha1_vector = (esp_hmac_sha1_vector_t)hmac_sha1_vector,
|
||||
.sha1_prf = (esp_sha1_prf_t)sha1_prf,
|
||||
.sha1_vector = (esp_sha1_vector_t)sha1_vector,
|
||||
.pbkdf2_sha1 = (esp_pbkdf2_sha1_t)pbkdf2_sha1,
|
||||
.rc4_skip = (esp_rc4_skip_t)rc4_skip,
|
||||
.md5_vector = (esp_md5_vector_t)md5_vector,
|
||||
.aes_encrypt = (esp_aes_encrypt_t)aes_encrypt,
|
||||
.aes_encrypt_init = (esp_aes_encrypt_init_t)aes_encrypt_init,
|
||||
.aes_encrypt_deinit = (esp_aes_encrypt_deinit_t)aes_encrypt_deinit,
|
||||
.aes_decrypt = (esp_aes_decrypt_t)aes_decrypt,
|
||||
.aes_decrypt_init = (esp_aes_decrypt_init_t)aes_decrypt_init,
|
||||
.aes_decrypt_deinit = (esp_aes_decrypt_deinit_t)aes_decrypt_deinit
|
||||
};
|
||||
|
||||
const mesh_crypto_funcs_t g_wifi_default_mesh_crypto_funcs = {
|
||||
.aes_128_encrypt = (esp_aes_128_encrypt_t)aes_128_cbc_encrypt,
|
||||
.aes_128_decrypt = (esp_aes_128_decrypt_t)aes_128_cbc_decrypt,
|
||||
};
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "utils/includes.h"
|
||||
|
||||
#include "utils/common.h"
|
||||
#include "crypto/crypto.h"
|
||||
#include "crypto.h"
|
||||
//#include "des_i.h"
|
||||
|
||||
/*
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
#include "utils/includes.h"
|
||||
|
||||
#include "utils/common.h"
|
||||
#include "crypto/dh_groups.h"
|
||||
#include "crypto/dh_group5.h"
|
||||
#include "dh_groups.h"
|
||||
#include "dh_group5.h"
|
||||
|
||||
|
||||
void *
|
||||
|
||||
@@ -15,9 +15,9 @@
|
||||
#include "utils/includes.h"
|
||||
|
||||
#include "utils/common.h"
|
||||
#include "crypto/crypto.h"
|
||||
#include "crypto/random.h"
|
||||
#include "crypto/dh_groups.h"
|
||||
#include "crypto.h"
|
||||
#include "random.h"
|
||||
#include "dh_groups.h"
|
||||
#include "utils/wpabuf.h"
|
||||
#include "utils/wpa_debug.h"
|
||||
#include "esp_wifi_crypto_types.h"
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include "utils/includes.h"
|
||||
#include "utils/common.h"
|
||||
#include "crypto/crypto.h"
|
||||
#include "crypto.h"
|
||||
|
||||
#define MD4_BLOCK_LENGTH 64
|
||||
#define MD4_DIGEST_LENGTH 16
|
||||
|
||||
@@ -15,9 +15,9 @@
|
||||
#include "utils/includes.h"
|
||||
|
||||
#include "utils/common.h"
|
||||
#include "crypto/md5.h"
|
||||
#include "crypto/md5_i.h"
|
||||
#include "crypto/crypto.h"
|
||||
#include "md5.h"
|
||||
#include "md5_i.h"
|
||||
#include "crypto.h"
|
||||
|
||||
|
||||
static void MD5Transform(u32 buf[4], u32 const in[16]);
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
#include "utils/includes.h"
|
||||
|
||||
#include "utils/common.h"
|
||||
#include "crypto/md5.h"
|
||||
#include "crypto/crypto.h"
|
||||
#include "md5.h"
|
||||
#include "crypto.h"
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -10,9 +10,9 @@
|
||||
#include "utils/includes.h"
|
||||
|
||||
#include "utils/common.h"
|
||||
#include "crypto/sha1.h"
|
||||
#include "crypto/ms_funcs.h"
|
||||
#include "crypto/crypto.h"
|
||||
#include "sha1.h"
|
||||
#include "ms_funcs.h"
|
||||
#include "crypto.h"
|
||||
|
||||
/**
|
||||
* utf8_to_ucs2 - Convert UTF-8 string to UCS-2 encoding
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "utils/includes.h"
|
||||
|
||||
#include "utils/common.h"
|
||||
#include "crypto/crypto.h"
|
||||
#include "crypto.h"
|
||||
|
||||
#define S_SWAP(a,b) do { u8 t = S[a]; S[a] = S[b]; S[b] = t; } while(0)
|
||||
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
#include "utils/includes.h"
|
||||
|
||||
#include "utils/common.h"
|
||||
#include "crypto/sha1.h"
|
||||
#include "crypto/sha1_i.h"
|
||||
#include "crypto/md5.h"
|
||||
#include "crypto/crypto.h"
|
||||
#include "sha1.h"
|
||||
#include "sha1_i.h"
|
||||
#include "md5.h"
|
||||
#include "crypto.h"
|
||||
|
||||
#ifdef USE_MBEDTLS_CRYPTO
|
||||
#include "mbedtls/sha1.h"
|
||||
|
||||
@@ -14,9 +14,9 @@
|
||||
|
||||
#include "utils/includes.h"
|
||||
#include "utils/common.h"
|
||||
#include "crypto/sha1.h"
|
||||
#include "crypto/md5.h"
|
||||
#include "crypto/crypto.h"
|
||||
#include "sha1.h"
|
||||
#include "md5.h"
|
||||
#include "crypto.h"
|
||||
|
||||
#ifdef USE_MBEDTLS_CRYPTO
|
||||
#include "mbedtls/pkcs5.h"
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
#include "utils/includes.h"
|
||||
|
||||
#include "utils/common.h"
|
||||
#include "crypto/sha1.h"
|
||||
#include "crypto/crypto.h"
|
||||
#include "sha1.h"
|
||||
#include "crypto.h"
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -33,8 +33,8 @@
|
||||
#ifdef USE_MBEDTLS_CRYPTO
|
||||
#include "mbedtls/sha256.h"
|
||||
#else /* USE_MBEDTLS_CRYPTO */
|
||||
#include "crypto/sha256.h"
|
||||
#include "crypto/crypto.h"
|
||||
#include "sha256.h"
|
||||
#include "crypto.h"
|
||||
#endif /* USE_MBEDTLS_CRYPTO */
|
||||
|
||||
#ifdef USE_MBEDTLS_CRYPTO
|
||||
|
||||
@@ -30,8 +30,8 @@
|
||||
#include "utils/includes.h"
|
||||
|
||||
#include "utils/common.h"
|
||||
#include "crypto/sha256.h"
|
||||
#include "crypto/crypto.h"
|
||||
#include "sha256.h"
|
||||
#include "crypto.h"
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
#ifdef EAP_TTLS
|
||||
#include "utils/common.h"
|
||||
#include "crypto/ms_funcs.h"
|
||||
#include "crypto/sha1.h"
|
||||
#include "tls/tls.h"
|
||||
#include "eap_peer/eap.h"
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
#include "crypto/crypto.h"
|
||||
#include "crypto/sha1.h"
|
||||
#include "crypto/aes_wrap.h"
|
||||
#include "crypto/wepkey.h"
|
||||
|
||||
#include "esp_wifi_driver.h"
|
||||
#include "esp_private/wifi.h"
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
#include "crypto/crypto.h"
|
||||
#include "crypto/sha1.h"
|
||||
#include "crypto/aes_wrap.h"
|
||||
#include "crypto/wepkey.h"
|
||||
|
||||
/**
|
||||
* eapol_sm_notify_eap_success - Notification of external EAP success trigger
|
||||
|
||||
@@ -14,8 +14,6 @@
|
||||
#include "utils/wpa_debug.h"
|
||||
#include "common/ieee802_11_defs.h"
|
||||
|
||||
#include "crypto/dh_group5.h"
|
||||
|
||||
#include "wps/wps_i.h"
|
||||
#include "wps/wps_dev_attr.h"
|
||||
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
|
||||
#include "crypto/aes_wrap.h"
|
||||
#include "crypto/crypto.h"
|
||||
#include "crypto/dh_group5.h"
|
||||
#include "crypto/sha256.h"
|
||||
#include "crypto/random.h"
|
||||
#include "crypto/dh_group5.h"
|
||||
|
||||
#include "common/ieee802_11_defs.h"
|
||||
#include "wps/wps_i.h"
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
|
||||
#include "crypto/aes_wrap.h"
|
||||
#include "crypto/crypto.h"
|
||||
#include "crypto/dh_group5.h"
|
||||
#include "crypto/sha1.h"
|
||||
#include "crypto/sha256.h"
|
||||
#include "crypto/dh_group5.h"
|
||||
#include "crypto/random.h"
|
||||
|
||||
#include "wps/wps_i.h"
|
||||
|
||||
Reference in New Issue
Block a user