]> granicus.if.org Git - esp-idf/commitdiff
wpa_supplicant: Make internally used crypto headers private
authorNachiket Kukade <nachiket.kukade@espressif.com>
Tue, 6 Aug 2019 11:40:16 +0000 (17:10 +0530)
committerbot <bot@espressif.com>
Sat, 17 Aug 2019 11:48:37 +0000 (11:48 +0000)
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

48 files changed:
components/esp32/esp_adapter.c
components/esp_wifi/CMakeLists.txt
components/wpa_supplicant/CMakeLists.txt
components/wpa_supplicant/include/crypto/wepkey.h [deleted file]
components/wpa_supplicant/include/esp_supplicant/esp_wpa.h
components/wpa_supplicant/src/ap/ieee802_1x.c
components/wpa_supplicant/src/crypto/aes-cbc.c
components/wpa_supplicant/src/crypto/aes-internal-dec.c
components/wpa_supplicant/src/crypto/aes-internal-enc.c
components/wpa_supplicant/src/crypto/aes-internal.c
components/wpa_supplicant/src/crypto/aes-unwrap.c
components/wpa_supplicant/src/crypto/aes-wrap.c
components/wpa_supplicant/src/crypto/aes.h [moved from components/wpa_supplicant/include/crypto/aes.h with 100% similarity]
components/wpa_supplicant/src/crypto/aes_i.h
components/wpa_supplicant/src/crypto/aes_wrap.h [moved from components/wpa_supplicant/include/crypto/aes_wrap.h with 100% similarity]
components/wpa_supplicant/src/crypto/crypto.h [moved from components/wpa_supplicant/include/crypto/crypto.h with 100% similarity]
components/wpa_supplicant/src/crypto/crypto_internal-cipher.c
components/wpa_supplicant/src/crypto/crypto_internal-modexp.c
components/wpa_supplicant/src/crypto/crypto_internal-rsa.c
components/wpa_supplicant/src/crypto/crypto_internal.c
components/wpa_supplicant/src/crypto/crypto_mbedtls.c
components/wpa_supplicant/src/crypto/crypto_ops.c [moved from components/esp_wifi/src/crypto_ops.c with 91% similarity]
components/wpa_supplicant/src/crypto/des-internal.c
components/wpa_supplicant/src/crypto/dh_group5.c
components/wpa_supplicant/src/crypto/dh_group5.h [moved from components/wpa_supplicant/include/crypto/dh_group5.h with 100% similarity]
components/wpa_supplicant/src/crypto/dh_groups.c
components/wpa_supplicant/src/crypto/dh_groups.h [moved from components/wpa_supplicant/include/crypto/dh_groups.h with 100% similarity]
components/wpa_supplicant/src/crypto/md4-internal.c
components/wpa_supplicant/src/crypto/md5-internal.c
components/wpa_supplicant/src/crypto/md5.c
components/wpa_supplicant/src/crypto/md5.h [moved from components/wpa_supplicant/include/crypto/md5.h with 100% similarity]
components/wpa_supplicant/src/crypto/ms_funcs.c
components/wpa_supplicant/src/crypto/ms_funcs.h [moved from components/wpa_supplicant/include/crypto/ms_funcs.h with 100% similarity]
components/wpa_supplicant/src/crypto/random.h [moved from components/wpa_supplicant/include/crypto/random.h with 100% similarity]
components/wpa_supplicant/src/crypto/rc4.c
components/wpa_supplicant/src/crypto/sha1-internal.c
components/wpa_supplicant/src/crypto/sha1-pbkdf2.c
components/wpa_supplicant/src/crypto/sha1.c
components/wpa_supplicant/src/crypto/sha1.h [moved from components/wpa_supplicant/include/crypto/sha1.h with 100% similarity]
components/wpa_supplicant/src/crypto/sha256-internal.c
components/wpa_supplicant/src/crypto/sha256.c
components/wpa_supplicant/src/crypto/sha256.h [moved from components/wpa_supplicant/include/crypto/sha256.h with 100% similarity]
components/wpa_supplicant/src/eap_peer/eap_ttls.c
components/wpa_supplicant/src/esp_supplicant/esp_wpa_main.c
components/wpa_supplicant/src/rsn_supp/wpa.c
components/wpa_supplicant/src/wps/wps.c
components/wpa_supplicant/src/wps/wps_attr_build.c
components/wpa_supplicant/src/wps/wps_common.c

index 0699bf70ca0925c65d9efa419936706c21df67e0..4fdd5ce65eb9cdcfdb666f5df2f2e93d69586c95 100644 (file)
 #include "esp_private/wifi_os_adapter.h"
 #include "esp_private/wifi.h"
 #include "esp_phy_init.h"
-#include "crypto/md5.h"
-#include "crypto/sha1.h"
-#include "crypto/crypto.h"
-#include "crypto/aes.h"
-#include "crypto/dh_group5.h"
 #include "driver/periph_ctrl.h"
 #include "nvs.h"
 #include "os.h"
index 4994e19dc3b408318187f2b358f887577a85f9a8..925704f933498d5a0af74ae0d932646323cfc32c 100644 (file)
@@ -5,7 +5,6 @@ if(NOT CONFIG_ESP32_NO_BLOBS)
 endif()
 
 idf_component_register(SRCS "src/coexist.c"
-                            "src/crypto_ops.c"
                             "src/lib_printf.c"
                             "src/mesh_event.c"
                             "src/phy_init.c"
index 2b7e14924f2ce17f56efcd888cacbbe717500b34..330b94d6c296185ebaa3649f3b6220fc529cb49c 100644 (file)
@@ -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"
diff --git a/components/wpa_supplicant/include/crypto/wepkey.h b/components/wpa_supplicant/include/crypto/wepkey.h
deleted file mode 100644 (file)
index 32a8cf9..0000000
+++ /dev/null
@@ -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 */
\ No newline at end of file
index 33f0fe57a4d1fe381abce75a06f3addfa13cb198..c7fbcfacbe4d7dc510b64ee2bbb2836f9f0d97e1 100644 (file)
@@ -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
index 5b459a78659a6e7f8c83254fc6f036545b90c267..62de7f5940db7dfd3c5b4c5beb531346f9431add 100644 (file)
@@ -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"
index 24c5670090fb1387b757d13c05d6005451659196..03d7a68ba6f3e84bee92680bd416a62741bee394 100644 (file)
@@ -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"
index 5cea5f745f93dacccc4240b79fbfcb6807fd0938..8c91b5c00e6bcc710affab224794e62d77ba183e 100644 (file)
@@ -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"
 
 
 
index 5b714fedbabc4f98e6348c9896acb55b5438c111..56084e44899bc5e039d5970914809d02e4054108 100644 (file)
@@ -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"
 
index 537d4034a71b6b853362309637871b860f8adc29..93592f1dc8aa0ef56018b5c0006682f755ac9f05 100644 (file)
@@ -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
index 9f513b0ac5d8ddf2171533759360498caa80f15d..090c2a909513373c5901b3a000faa7e7a7505fac 100644 (file)
@@ -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 */
 
 /**
index 9d180f5222cc2b42e324d3a327d444e94b5506a5..42e60660b69a2a22e74f4d17d5b5fa007f73ea18 100644 (file)
@@ -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 */
index 290ac423bdb241c9883b7750a3234b54e72a4353..1063422a8100348bd59f457686be878a4a595d1b 100644 (file)
@@ -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
index 3fe2412e1004bc095b3aee99fff52659f786ec64..9ca428cfe34a0956951fb276e69ddb4a835ae72e 100644 (file)
 
 #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"
index f37139ba19a81ec768617240ad92da692356fb6e..8d9d7fe83dda15ff80d0ed5b09d5f791187d5c0f 100644 (file)
@@ -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
index de7c8091e987b2e47328b2e1ec3f8492afc8ff47..1d63137fa5933fb7f389672d3dc149f48bb23e03 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #include "utils/common.h"
-#include "crypto/crypto.h"
+#include "crypto.h"
 
 #include "utils/includes.h"
 #include "utils/common.h"
index 4622cfcb899a9d3d8713d74cf90acb10063dd946..ca82d0d52b65b1dcc34cf40fa37624743d35a74f 100644 (file)
@@ -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
index 315a6834ffef5a8893ced9de865ccd70f521cea8..d6a91b5329fee0a34872c3aeef732e86da85bb7d 100644 (file)
@@ -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"
similarity index 91%
rename from components/esp_wifi/src/crypto_ops.c
rename to components/wpa_supplicant/src/crypto/crypto_ops.c
index fdef5ca57e919646eead1236ac3d1270ca597c73..f46d823dfe55329cf6e5e95b08a85d1bdb03334d 100644 (file)
 // limitations under the License.
 
 #include "utils/common.h"
-#include "crypto/aes_wrap.h"
-#include "crypto/sha256.h"
-#include "crypto/crypto.h"
-#include "crypto/md5.h"
-#include "crypto/sha1.h"
-#include "crypto/aes.h"
-#include "crypto/dh_group5.h"
-#include "esp_wifi_crypto_types.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
index 7c66412286fd48ce26aba8dbbe3fd20ced75fa62..077b7d013c7078a9298162115ae4bc0fcd98baaa 100644 (file)
@@ -12,7 +12,7 @@
 #include "utils/includes.h"
 
 #include "utils/common.h"
-#include "crypto/crypto.h"
+#include "crypto.h"
 //#include "des_i.h"
 
 /*
index 5ae75da2e1979ad99949a9fe8a81be955723bec7..d5adaf24fde2dd568ed74130d8a790f2965d0e5c 100644 (file)
@@ -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 * 
index e3c7519ece6ced38ee9d78bb083cae7cf25f66ee..6f699d9be6ee1ca95edca078e7764c8af6b8bb47 100644 (file)
@@ -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"
index cc988492d3f1458437afd8bf25764f46811828f8..9c99b7cbe1736b9e8d6e0f8f35eb65616d2a2d79 100644 (file)
@@ -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
index 3a98b36d49186a237c7773daa64d37162458986f..a6b394006b0ead27d9ad7ca1ca6c977fba0d703a 100644 (file)
@@ -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]);
index 3a0574296184b7098657b8e5a4f50f8de2953291..57ec4ea983bd11542e76697debd70ac199b3848e 100644 (file)
@@ -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"
 
 
 /**
index 191aa2bcf2d6d27e43be9ae92907629020d29fd4..750a4083bd81a6216e31256e6343e8030d5111e6 100644 (file)
@@ -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
index aa914dcc727285e9aa2ea92edd5bdff533cf7aa3..a014afe6e35b5ae6457b2dd60c9c253c4ec92612 100644 (file)
@@ -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)
 
index 3bcd88116c76fca2f749cb90a64a86d8221d19ff..9210af03fe80d552ab9dc21784d4bdecf8d8ed67 100644 (file)
 #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"
index b842a57d4e78eb9c09392a777540d26ff852b391..79e1bc382c96a341c7846f83ed0e9446514bc8dc 100644 (file)
@@ -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"
index 5b228292b289fcef288bc9893ec94d58a9b75b01..27cf58b68527ba9263c4399940848d05da1f219f 100644 (file)
@@ -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"
 
 
 /**
index df0706b5c1d6eff59e847656dfc54e16b3b082cd..d6af5b5e9a289a4dacbcef2b9ec2d8d37a67d772 100644 (file)
@@ -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
index 6380897e42650687b8cdb6253c418eba5962f6fd..3e955b4d4789a443dca76643ca64f6ca7ccc6226 100644 (file)
@@ -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"
 
 
 /**
index fb5515913e394f247320582873a061607f03d473..b014dbd395d60d58735a86cf0a667355a9723aa3 100644 (file)
@@ -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"
index 6f37b18500e7af7e315ecef984f82e5d078891c1..51f9e40f46cbde15d6e05399a4720c69d6c055a5 100644 (file)
@@ -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"
index 2ce7bbebe53a57cc635c29f028194982f8b2532e..2f014712647c65235e799266b98d1840a83e8263 100644 (file)
@@ -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
index 1700f0f4b1f7dee3511bc26b2410d3597afc362a..b19e187a46d6fddfa462d784a83a8b020010c310 100644 (file)
@@ -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"
 
index bd2aa5e947f2f49b84cca57936fb4338e26fb846..437c92b69a3c81ecd67d18d51ae3ebb0bb855909 100644 (file)
@@ -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"
index e37a35b273319553c5b3c937fa9e19e6e606ead1..ead31af3e0a49e50fb7fe97b3f7ddc5c0cbde25e 100644 (file)
@@ -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"