mirror of
https://github.com/0xFEEDC0DE64/arduino-esp32.git
synced 2025-07-02 13:30:59 +02:00
Update IDF to aaf1239 (#1539)
* fix sdmmc config * Fix warnings in EEPROM from @Curclamas * remove leftover TAG in EEPROM * Initial add of @stickbreaker i2c * Add log_n * fix warnings when log is off * i2c code clean up and reorganization * add flags to interrupt allocator * fix sdmmc config * Fix warnings in EEPROM from @Curclamas * remove leftover TAG in EEPROM * fix errors with latest IDF * fix debug optimization (#1365) incorrect optimization for debugging tick markers. * Fix some missing BT header * Change BTSerial log calls * Update BLE lib * Arduino-ESP32 release management scripted (#1515) * Calculate an absolute path for a custom partitions table (#1452) * * Arduino-ESP32 release management scripted (ready-to-merge) * * secure env for espressif/arduino-esp32 * * build tests enabled * gitter webhook enabled * * gitter room link fixed * better comment * * filepaths fixed * BT Serial adjustments * * don't run sketch builds & tests for tagged builds * Return false from WiFi.hostByName() if hostname is not resolved * Free BT Memory when BT is not used * WIFI_MODE_NULL is not supported anymore * Select some key examples to build with PlatformIO to save some time * Update BLE lib * Fixed BLE lib * Major WiFi overhaul - auto reconnect on connection loss now works - moved to event groups - some code clean up and procedure optimizations - new methods to get a more elaborate system ststus * Add cmake tests to travis * Add initial AsyncUDP * Add NetBIOS lib and fix CMake includes * Add Initial WebServer * Fix WebServer and examples * travis not quiting on build fail * Try different travis build * Update IDF to aaf1239 * Fix WPS Example * fix script permission and add some fail tests to sketch builder * Add missing space in WiFiClient::write(Stream &stream)
This commit is contained in:
@ -10,15 +10,45 @@
|
||||
#define EAP_H
|
||||
|
||||
#include "wpa/defs.h"
|
||||
#include "eap/eap_defs.h"
|
||||
#include "wpa2/eap_peer/eap_defs.h"
|
||||
|
||||
struct eap_sm;
|
||||
|
||||
struct eap_method_type {
|
||||
int vendor;
|
||||
u32 method;
|
||||
EapType method;
|
||||
};
|
||||
|
||||
u8 *g_wpa_anonymous_identity;
|
||||
int g_wpa_anonymous_identity_len;
|
||||
u8 *g_wpa_username;
|
||||
int g_wpa_username_len;
|
||||
const u8 *g_wpa_client_cert;
|
||||
int g_wpa_client_cert_len;
|
||||
const u8 *g_wpa_private_key;
|
||||
int g_wpa_private_key_len;
|
||||
const u8 *g_wpa_private_key_passwd;
|
||||
int g_wpa_private_key_passwd_len;
|
||||
|
||||
const u8 *g_wpa_ca_cert;
|
||||
int g_wpa_ca_cert_len;
|
||||
|
||||
u8 *g_wpa_password;
|
||||
int g_wpa_password_len;
|
||||
|
||||
u8 *g_wpa_new_password;
|
||||
int g_wpa_new_password_len;
|
||||
|
||||
const u8 * eap_get_eapKeyData(struct eap_sm *sm, size_t *len);
|
||||
void eap_deinit_prev_method(struct eap_sm *sm, const char *txt);
|
||||
struct wpabuf * eap_sm_build_nak(struct eap_sm *sm, EapType type, u8 id);
|
||||
int eap_peer_blob_init(struct eap_sm *sm);
|
||||
void eap_peer_blob_deinit(struct eap_sm *sm);
|
||||
int eap_peer_config_init(
|
||||
struct eap_sm *sm, u8 *private_key_passwd,
|
||||
int private_key_passwd_len);
|
||||
void eap_peer_config_deinit(struct eap_sm *sm);
|
||||
void eap_sm_abort(struct eap_sm *sm);
|
||||
int eap_peer_register_methods(void);
|
||||
|
||||
#endif /* EAP_H */
|
||||
|
@ -26,6 +26,10 @@ struct eap_peer_config {
|
||||
*/
|
||||
size_t identity_len;
|
||||
|
||||
u8 *anonymous_identity;
|
||||
|
||||
size_t anonymous_identity_len;
|
||||
|
||||
/**
|
||||
* password - Password string for EAP
|
||||
*
|
||||
@ -139,8 +143,29 @@ struct eap_peer_config {
|
||||
*/
|
||||
u8 *private_key_passwd;
|
||||
|
||||
/**
|
||||
* Phase 2
|
||||
*/
|
||||
u8 *ca_cert2;
|
||||
|
||||
u8 *ca_path2;
|
||||
|
||||
u8 *client_cert2;
|
||||
|
||||
u8 *private_key2;
|
||||
|
||||
u8 *private_key2_password;
|
||||
|
||||
/**
|
||||
* eap_methods - Allowed EAP methods
|
||||
*/
|
||||
struct eap_method_type *eap_methods;
|
||||
|
||||
|
||||
char *phase1;
|
||||
|
||||
char *phase2;
|
||||
|
||||
/**
|
||||
* pin - PIN for USIM, GSM SIM, and smartcards
|
||||
*
|
||||
@ -152,6 +177,10 @@ struct eap_peer_config {
|
||||
*/
|
||||
char *pin;
|
||||
|
||||
int mschapv2_retry;
|
||||
u8 *new_password;
|
||||
size_t new_password_len;
|
||||
|
||||
/**
|
||||
* fragment_size - Maximum EAP fragment size in bytes (default 1398)
|
||||
*
|
||||
@ -204,7 +233,7 @@ struct wpa_config_blob {
|
||||
/**
|
||||
* data - Pointer to binary data
|
||||
*/
|
||||
u8 *data;
|
||||
const u8 *data;
|
||||
|
||||
/**
|
||||
* len - Length of binary data
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "eap.h"
|
||||
#include "eap_common.h"
|
||||
#include "eap_config.h"
|
||||
#include "esp_wpa2.h"
|
||||
|
||||
/* RFC 4137 - EAP Peer state machine */
|
||||
|
||||
@ -54,11 +55,48 @@ struct eap_method_ret {
|
||||
Boolean allowNotifications;
|
||||
};
|
||||
|
||||
struct eap_sm;
|
||||
|
||||
struct eap_method {
|
||||
/**
|
||||
* vendor -EAP Vendor-ID
|
||||
*/
|
||||
int vendor;
|
||||
|
||||
/**
|
||||
* method - EAP type number
|
||||
*/
|
||||
EapType method;
|
||||
|
||||
/**
|
||||
* name - Name of the method (e.g., "TLS")
|
||||
*/
|
||||
const char *name;
|
||||
|
||||
struct eap_method *next;
|
||||
|
||||
void * (*init)(struct eap_sm *sm);
|
||||
void (*deinit)(struct eap_sm *sm, void *priv);
|
||||
struct wpabuf * (*process)(struct eap_sm *sm, void *priv,
|
||||
struct eap_method_ret *ret,
|
||||
const struct wpabuf *reqData);
|
||||
bool (*isKeyAvailable)(struct eap_sm *sm, void *priv);
|
||||
u8 * (*getKey)(struct eap_sm *sm, void *priv, size_t *len);
|
||||
int (*get_status)(struct eap_sm *sm, void *priv, char *buf,
|
||||
size_t buflen, int verbose);
|
||||
const u8 * (*get_identity)(struct eap_sm *sm, void *priv, size_t *len);
|
||||
void (*free)(struct eap_method *method);
|
||||
bool (*has_reauth_data)(struct eap_sm *sm, void *priv);
|
||||
void (*deinit_for_reauth)(struct eap_sm *sm, void *priv);
|
||||
void * (*init_for_reauth)(struct eap_sm *sm, void *priv);
|
||||
u8 * (*getSessionId)(struct eap_sm *sm, void *priv, size_t *len);
|
||||
};
|
||||
|
||||
#define CLIENT_CERT_NAME "CLC"
|
||||
#define CA_CERT_NAME "CAC"
|
||||
#define PRIVATE_KEY_NAME "PVK"
|
||||
#define BLOB_NAME_LEN 3
|
||||
#define BLOB_NUM 2
|
||||
#define BLOB_NUM 3
|
||||
|
||||
/**
|
||||
* struct eap_sm - EAP state machine data
|
||||
@ -80,9 +118,26 @@ struct eap_sm {
|
||||
u8 wpa2_sig_cnt[SIG_WPA2_NUM];
|
||||
#endif
|
||||
u8 finish_state;
|
||||
|
||||
int init_phase2;
|
||||
bool peap_done;
|
||||
|
||||
u8 *eapKeyData;
|
||||
size_t eapKeyDataLen;
|
||||
struct wpabuf *lastRespData;
|
||||
const struct eap_method *m;
|
||||
};
|
||||
|
||||
wpa2_crypto_funcs_t wpa2_crypto_funcs;
|
||||
|
||||
const u8 * eap_get_config_identity(struct eap_sm *sm, size_t *len);
|
||||
const u8 * eap_get_config_password(struct eap_sm *sm, size_t *len);
|
||||
const u8 * eap_get_config_password2(struct eap_sm *sm, size_t *len, int *hash);
|
||||
const u8 * eap_get_config_new_password(struct eap_sm *sm, size_t *len);
|
||||
struct eap_peer_config * eap_get_config(struct eap_sm *sm);
|
||||
const struct wpa_config_blob * eap_get_config_blob(struct eap_sm *sm, const char *name);
|
||||
bool wifi_sta_get_enterprise_disable_time_check(void);
|
||||
|
||||
struct wpabuf * eap_sm_build_identity_resp(struct eap_sm *sm, u8 id, int encrypted);
|
||||
|
||||
#endif /* EAP_I_H */
|
||||
|
39
tools/sdk/include/wpa_supplicant/wpa2/eap_peer/eap_methods.h
Normal file
39
tools/sdk/include/wpa_supplicant/wpa2/eap_peer/eap_methods.h
Normal file
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* EAP peer: Method registration
|
||||
* Copyright (c) 2004-2007, Jouni Malinen <j@w1.fi>
|
||||
*
|
||||
* This software may be distributed under the terms of the BSD license.
|
||||
* See README for more details.
|
||||
*/
|
||||
|
||||
#ifndef EAP_METHODS_H
|
||||
#define EAP_METHODS_H
|
||||
|
||||
#include "eap_defs.h"
|
||||
#include "eap_config.h"
|
||||
|
||||
const struct eap_method * eap_peer_get_eap_method(int vendor, EapType method);
|
||||
const struct eap_method * eap_peer_get_methods(size_t *count);
|
||||
|
||||
u32 eap_get_phase2_type(const char *name, int *vendor);
|
||||
struct eap_method_type * eap_get_phase2_types(struct eap_peer_config *config,
|
||||
size_t *count);
|
||||
|
||||
struct eap_method * eap_peer_method_alloc(int verdor, EapType method,
|
||||
const char *name);
|
||||
|
||||
void eap_peer_method_free(struct eap_method *method);
|
||||
int eap_peer_method_register(struct eap_method *method);
|
||||
|
||||
void eap_peer_unregister_methods(void);
|
||||
|
||||
//int eap_peer_md5_register(void);
|
||||
int eap_peer_tls_register(void);
|
||||
int eap_peer_peap_register(void);
|
||||
int eap_peer_ttls_register(void);
|
||||
int eap_peer_mschapv2_register(void);
|
||||
|
||||
void eap_peer_unregister_methods(void);
|
||||
int eap_peer_register_methods(void);
|
||||
|
||||
#endif /* EAP_METHODS_H */
|
@ -0,0 +1,16 @@
|
||||
/*
|
||||
* EAP-PEAP common routines
|
||||
* Copyright (c) 2008-2011, Jouni Malinen <j@w1.fi>
|
||||
*
|
||||
* This software may be distributed under the terms of the BSD license.
|
||||
* See README for more details.
|
||||
*/
|
||||
|
||||
#ifndef EAP_PEAP_COMMON_H
|
||||
#define EAP_PEAP_COMMON_H
|
||||
|
||||
int peap_prfplus(int version, const u8 *key, size_t key_len,
|
||||
const char *label, const u8 *seed, size_t seed_len,
|
||||
u8 *buf, size_t buf_len);
|
||||
|
||||
#endif /* EAP_PEAP_COMMON_H */
|
112
tools/sdk/include/wpa_supplicant/wpa2/eap_peer/eap_tlv_common.h
Normal file
112
tools/sdk/include/wpa_supplicant/wpa2/eap_peer/eap_tlv_common.h
Normal file
@ -0,0 +1,112 @@
|
||||
/*
|
||||
* EAP-TLV definitions (draft-josefsson-pppext-eap-tls-eap-10.txt)
|
||||
* Copyright (c) 2004-2008, Jouni Malinen <j@w1.fi>
|
||||
*
|
||||
* This software may be distributed under the terms of the BSD license.
|
||||
* See README for more details.
|
||||
*/
|
||||
|
||||
#ifndef EAP_TLV_COMMON_H
|
||||
#define EAP_TLV_COMMON_H
|
||||
|
||||
/* EAP-TLV TLVs (draft-josefsson-ppext-eap-tls-eap-10.txt) */
|
||||
#define EAP_TLV_RESULT_TLV 3 /* Acknowledged Result */
|
||||
#define EAP_TLV_NAK_TLV 4
|
||||
#define EAP_TLV_ERROR_CODE_TLV 5
|
||||
#define EAP_TLV_CONNECTION_BINDING_TLV 6
|
||||
#define EAP_TLV_VENDOR_SPECIFIC_TLV 7
|
||||
#define EAP_TLV_URI_TLV 8
|
||||
#define EAP_TLV_EAP_PAYLOAD_TLV 9
|
||||
#define EAP_TLV_INTERMEDIATE_RESULT_TLV 10
|
||||
#define EAP_TLV_PAC_TLV 11 /* RFC 5422, Section 4.2 */
|
||||
#define EAP_TLV_CRYPTO_BINDING_TLV 12
|
||||
#define EAP_TLV_CALLING_STATION_ID_TLV 13
|
||||
#define EAP_TLV_CALLED_STATION_ID_TLV 14
|
||||
#define EAP_TLV_NAS_PORT_TYPE_TLV 15
|
||||
#define EAP_TLV_SERVER_IDENTIFIER_TLV 16
|
||||
#define EAP_TLV_IDENTITY_TYPE_TLV 17
|
||||
#define EAP_TLV_SERVER_TRUSTED_ROOT_TLV 18
|
||||
#define EAP_TLV_REQUEST_ACTION_TLV 19
|
||||
#define EAP_TLV_PKCS7_TLV 20
|
||||
|
||||
#define EAP_TLV_RESULT_SUCCESS 1
|
||||
#define EAP_TLV_RESULT_FAILURE 2
|
||||
|
||||
#define EAP_TLV_TYPE_MANDATORY 0x8000
|
||||
#define EAP_TLV_TYPE_MASK 0x3fff
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma pack(push, 1)
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
struct eap_tlv_hdr {
|
||||
be16 tlv_type;
|
||||
be16 length;
|
||||
} STRUCT_PACKED;
|
||||
|
||||
struct eap_tlv_nak_tlv {
|
||||
be16 tlv_type;
|
||||
be16 length;
|
||||
be32 vendor_id;
|
||||
be16 nak_type;
|
||||
} STRUCT_PACKED;
|
||||
|
||||
struct eap_tlv_result_tlv {
|
||||
be16 tlv_type;
|
||||
be16 length;
|
||||
be16 status;
|
||||
} STRUCT_PACKED;
|
||||
|
||||
/* RFC 4851, Section 4.2.7 - Intermediate-Result TLV */
|
||||
struct eap_tlv_intermediate_result_tlv {
|
||||
be16 tlv_type;
|
||||
be16 length;
|
||||
be16 status;
|
||||
/* Followed by optional TLVs */
|
||||
} STRUCT_PACKED;
|
||||
|
||||
/* RFC 4851, Section 4.2.8 - Crypto-Binding TLV */
|
||||
struct eap_tlv_crypto_binding_tlv {
|
||||
be16 tlv_type;
|
||||
be16 length;
|
||||
u8 reserved;
|
||||
u8 version;
|
||||
u8 received_version;
|
||||
u8 subtype;
|
||||
u8 nonce[32];
|
||||
u8 compound_mac[20];
|
||||
} STRUCT_PACKED;
|
||||
|
||||
struct eap_tlv_pac_ack_tlv {
|
||||
be16 tlv_type;
|
||||
be16 length;
|
||||
be16 pac_type;
|
||||
be16 pac_len;
|
||||
be16 result;
|
||||
} STRUCT_PACKED;
|
||||
|
||||
/* RFC 4851, Section 4.2.9 - Request-Action TLV */
|
||||
struct eap_tlv_request_action_tlv {
|
||||
be16 tlv_type;
|
||||
be16 length;
|
||||
be16 action;
|
||||
} STRUCT_PACKED;
|
||||
|
||||
/* RFC 5422, Section 4.2.6 - PAC-Type TLV */
|
||||
struct eap_tlv_pac_type_tlv {
|
||||
be16 tlv_type; /* PAC_TYPE_PAC_TYPE */
|
||||
be16 length;
|
||||
be16 pac_type;
|
||||
} STRUCT_PACKED;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma pack(pop)
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
#define EAP_TLV_CRYPTO_BINDING_SUBTYPE_REQUEST 0
|
||||
#define EAP_TLV_CRYPTO_BINDING_SUBTYPE_RESPONSE 1
|
||||
|
||||
#define EAP_TLV_ACTION_PROCESS_TLV 1
|
||||
#define EAP_TLV_ACTION_NEGOTIATE_EAP 2
|
||||
|
||||
#endif /* EAP_TLV_COMMON_H */
|
65
tools/sdk/include/wpa_supplicant/wpa2/eap_peer/eap_ttls.h
Normal file
65
tools/sdk/include/wpa_supplicant/wpa2/eap_peer/eap_ttls.h
Normal file
@ -0,0 +1,65 @@
|
||||
/*
|
||||
* EAP server/peer: EAP-TTLS (RFC 5281)
|
||||
* Copyright (c) 2004-2007, Jouni Malinen <j@w1.fi>
|
||||
*
|
||||
* This software may be distributed under the terms of the BSD license.
|
||||
* See README for more details.
|
||||
*/
|
||||
|
||||
#ifndef EAP_TTLS_H
|
||||
#define EAP_TTLS_H
|
||||
|
||||
struct ttls_avp {
|
||||
be32 avp_code;
|
||||
be32 avp_length; /* 8-bit flags, 24-bit length;
|
||||
* length includes AVP header */
|
||||
/* optional 32-bit Vendor-ID */
|
||||
/* Data */
|
||||
};
|
||||
|
||||
struct ttls_avp_vendor {
|
||||
be32 avp_code;
|
||||
be32 avp_length; /* 8-bit flags, 24-bit length;
|
||||
* length includes AVP header */
|
||||
be32 vendor_id;
|
||||
/* Data */
|
||||
};
|
||||
|
||||
#define AVP_FLAGS_VENDOR 0x80
|
||||
#define AVP_FLAGS_MANDATORY 0x40
|
||||
|
||||
#define AVP_PAD(start, pos) \
|
||||
do { \
|
||||
int __pad; \
|
||||
__pad = (4 - (((pos) - (start)) & 3)) & 3; \
|
||||
os_memset((pos), 0, __pad); \
|
||||
pos += __pad; \
|
||||
} while (0)
|
||||
|
||||
|
||||
/* RFC 2865 */
|
||||
#define RADIUS_ATTR_USER_NAME 1
|
||||
#define RADIUS_ATTR_USER_PASSWORD 2
|
||||
#define RADIUS_ATTR_CHAP_PASSWORD 3
|
||||
#define RADIUS_ATTR_REPLY_MESSAGE 18
|
||||
#define RADIUS_ATTR_CHAP_CHALLENGE 60
|
||||
#define RADIUS_ATTR_EAP_MESSAGE 79
|
||||
|
||||
/* RFC 2548 */
|
||||
#define RADIUS_VENDOR_ID_MICROSOFT 311
|
||||
#define RADIUS_ATTR_MS_CHAP_RESPONSE 1
|
||||
#define RADIUS_ATTR_MS_CHAP_ERROR 2
|
||||
#define RADIUS_ATTR_MS_CHAP_NT_ENC_PW 6
|
||||
#define RADIUS_ATTR_MS_CHAP_CHALLENGE 11
|
||||
#define RADIUS_ATTR_MS_CHAP2_RESPONSE 25
|
||||
#define RADIUS_ATTR_MS_CHAP2_SUCCESS 26
|
||||
#define RADIUS_ATTR_MS_CHAP2_CPW 27
|
||||
|
||||
#define EAP_TTLS_MSCHAPV2_CHALLENGE_LEN 16
|
||||
#define EAP_TTLS_MSCHAPV2_RESPONSE_LEN 50
|
||||
#define EAP_TTLS_MSCHAP_CHALLENGE_LEN 8
|
||||
#define EAP_TTLS_MSCHAP_RESPONSE_LEN 50
|
||||
#define EAP_TTLS_CHAP_CHALLENGE_LEN 16
|
||||
#define EAP_TTLS_CHAP_PASSWORD_LEN 16
|
||||
|
||||
#endif /* EAP_TTLS_H */
|
24
tools/sdk/include/wpa_supplicant/wpa2/eap_peer/mschapv2.h
Normal file
24
tools/sdk/include/wpa_supplicant/wpa2/eap_peer/mschapv2.h
Normal file
@ -0,0 +1,24 @@
|
||||
/*
|
||||
* MSCHAPV2
|
||||
*/
|
||||
|
||||
|
||||
#ifndef MSCHAPV2_H
|
||||
#define MSCHAPV2_H
|
||||
|
||||
#define MSCHAPV2_CHAL_LEN 16
|
||||
#define MSCHAPV2_NT_RESPONSE_LEN 24
|
||||
#define MSCHAPV2_AUTH_RESPONSE_LEN 20
|
||||
#define MSCHAPV2_MASTER_KEY_LEN 16
|
||||
|
||||
const u8 * mschapv2_remove_domain(const u8 *username, size_t *len);
|
||||
int mschapv2_derive_response(const u8 *username, size_t username_len,
|
||||
const u8 *password, size_t password_len,
|
||||
int pwhash,
|
||||
const u8 *auth_challenge,
|
||||
const u8 *peer_challenge,
|
||||
u8 *nt_response, u8 *auth_response,
|
||||
u8 *master_key);
|
||||
int mschapv2_verify_auth_response(const u8 *auth_response,
|
||||
const u8 *buf, size_t buf_len);
|
||||
#endif /* MSCHAPV2_H */
|
@ -13,7 +13,6 @@
|
||||
* If CONFIG_INTERNAL_LIBTOMMATH is defined, bignum.c includes this
|
||||
* libtommath.c file instead of using the external LibTomMath library.
|
||||
*/
|
||||
#include "c_types.h"
|
||||
#include "os.h"
|
||||
#include "stdarg.h"
|
||||
|
||||
@ -193,7 +192,7 @@ static int mp_mul_d (mp_int * a, mp_digit b, mp_int * c);
|
||||
|
||||
|
||||
/* reverse an array, used for radix code */
|
||||
static void ICACHE_FLASH_ATTR
|
||||
static void
|
||||
bn_reverse (unsigned char *s, int len)
|
||||
{
|
||||
int ix, iy;
|
||||
@ -212,7 +211,7 @@ bn_reverse (unsigned char *s, int len)
|
||||
|
||||
|
||||
/* low level addition, based on HAC pp.594, Algorithm 14.7 */
|
||||
static int ICACHE_FLASH_ATTR
|
||||
static int
|
||||
s_mp_add (mp_int * a, mp_int * b, mp_int * c)
|
||||
{
|
||||
mp_int *x;
|
||||
@ -301,7 +300,7 @@ s_mp_add (mp_int * a, mp_int * b, mp_int * c)
|
||||
|
||||
|
||||
/* low level subtraction (assumes |a| > |b|), HAC pp.595 Algorithm 14.9 */
|
||||
static int ICACHE_FLASH_ATTR
|
||||
static int
|
||||
s_mp_sub (mp_int * a, mp_int * b, mp_int * c)
|
||||
{
|
||||
int olduse, res, min, max;
|
||||
@ -369,7 +368,7 @@ s_mp_sub (mp_int * a, mp_int * b, mp_int * c)
|
||||
|
||||
|
||||
/* init a new mp_int */
|
||||
static int ICACHE_FLASH_ATTR
|
||||
static int
|
||||
mp_init (mp_int * a)
|
||||
{
|
||||
int i;
|
||||
@ -396,7 +395,7 @@ mp_init (mp_int * a)
|
||||
|
||||
|
||||
/* clear one (frees) */
|
||||
static void ICACHE_FLASH_ATTR
|
||||
static void
|
||||
mp_clear (mp_int * a)
|
||||
{
|
||||
int i;
|
||||
@ -420,7 +419,7 @@ mp_clear (mp_int * a)
|
||||
|
||||
|
||||
/* high level addition (handles signs) */
|
||||
static int ICACHE_FLASH_ATTR
|
||||
static int
|
||||
mp_add (mp_int * a, mp_int * b, mp_int * c)
|
||||
{
|
||||
int sa, sb, res;
|
||||
@ -453,7 +452,7 @@ mp_add (mp_int * a, mp_int * b, mp_int * c)
|
||||
|
||||
|
||||
/* high level subtraction (handles signs) */
|
||||
static int ICACHE_FLASH_ATTR
|
||||
static int
|
||||
mp_sub (mp_int * a, mp_int * b, mp_int * c)
|
||||
{
|
||||
int sa, sb, res;
|
||||
@ -491,7 +490,7 @@ mp_sub (mp_int * a, mp_int * b, mp_int * c)
|
||||
|
||||
|
||||
/* high level multiplication (handles sign) */
|
||||
static int ICACHE_FLASH_ATTR
|
||||
static int
|
||||
mp_mul (mp_int * a, mp_int * b, mp_int * c)
|
||||
{
|
||||
int res, neg;
|
||||
@ -539,7 +538,7 @@ mp_mul (mp_int * a, mp_int * b, mp_int * c)
|
||||
|
||||
|
||||
/* d = a * b (mod c) */
|
||||
static int ICACHE_FLASH_ATTR
|
||||
static int
|
||||
mp_mulmod (mp_int * a, mp_int * b, mp_int * c, mp_int * d)
|
||||
{
|
||||
int res;
|
||||
@ -560,7 +559,7 @@ mp_mulmod (mp_int * a, mp_int * b, mp_int * c, mp_int * d)
|
||||
|
||||
|
||||
/* c = a mod b, 0 <= c < b */
|
||||
static int ICACHE_FLASH_ATTR
|
||||
static int
|
||||
mp_mod (mp_int * a, mp_int * b, mp_int * c)
|
||||
{
|
||||
mp_int t;
|
||||
@ -592,10 +591,12 @@ mp_mod (mp_int * a, mp_int * b, mp_int * c)
|
||||
* embedded in the normal function but that wasted a lot of stack space
|
||||
* for nothing (since 99% of the time the Montgomery code would be called)
|
||||
*/
|
||||
static int ICACHE_FLASH_ATTR
|
||||
static int
|
||||
mp_exptmod (mp_int * G, mp_int * X, mp_int * P, mp_int * Y)
|
||||
{
|
||||
int dr;
|
||||
#if defined(BN_MP_DR_IS_MODULUS_C)||defined(BN_MP_REDUCE_IS_2K_C)||defined(BN_MP_EXPTMOD_FAST_C)
|
||||
int dr = 0;
|
||||
#endif
|
||||
|
||||
/* modulus P must be positive */
|
||||
if (P->sign == MP_NEG) {
|
||||
@ -652,9 +653,6 @@ mp_exptmod (mp_int * G, mp_int * X, mp_int * P, mp_int * Y)
|
||||
#ifdef BN_MP_DR_IS_MODULUS_C
|
||||
/* is it a DR modulus? */
|
||||
dr = mp_dr_is_modulus(P);
|
||||
#else
|
||||
/* default to no */
|
||||
dr = 0;
|
||||
#endif
|
||||
|
||||
#ifdef BN_MP_REDUCE_IS_2K_C
|
||||
@ -685,7 +683,7 @@ mp_exptmod (mp_int * G, mp_int * X, mp_int * P, mp_int * Y)
|
||||
|
||||
|
||||
/* compare two ints (signed)*/
|
||||
static int ICACHE_FLASH_ATTR
|
||||
static int
|
||||
mp_cmp (mp_int * a, mp_int * b)
|
||||
{
|
||||
/* compare based on sign */
|
||||
@ -708,7 +706,7 @@ mp_cmp (mp_int * a, mp_int * b)
|
||||
|
||||
|
||||
/* compare a digit */
|
||||
static int ICACHE_FLASH_ATTR
|
||||
static int
|
||||
mp_cmp_d(mp_int * a, mp_digit b)
|
||||
{
|
||||
/* compare based on sign */
|
||||
@ -734,7 +732,7 @@ mp_cmp_d(mp_int * a, mp_digit b)
|
||||
|
||||
#ifndef LTM_NO_NEG_EXP
|
||||
/* hac 14.61, pp608 */
|
||||
static int ICACHE_FLASH_ATTR
|
||||
static int
|
||||
mp_invmod (mp_int * a, mp_int * b, mp_int * c)
|
||||
{
|
||||
/* b cannot be negative */
|
||||
@ -764,7 +762,7 @@ mp_invmod (mp_int * a, mp_int * b, mp_int * c)
|
||||
|
||||
|
||||
/* get the size for an unsigned equivalent */
|
||||
static int ICACHE_FLASH_ATTR
|
||||
static int
|
||||
mp_unsigned_bin_size (mp_int * a)
|
||||
{
|
||||
int size = mp_count_bits (a);
|
||||
@ -774,7 +772,7 @@ mp_unsigned_bin_size (mp_int * a)
|
||||
|
||||
#ifndef LTM_NO_NEG_EXP
|
||||
/* hac 14.61, pp608 */
|
||||
static int ICACHE_FLASH_ATTR
|
||||
static int
|
||||
mp_invmod_slow (mp_int * a, mp_int * b, mp_int * c)
|
||||
{
|
||||
mp_int x, y, u, v, A, B, C, D;
|
||||
@ -931,7 +929,7 @@ LBL_ERR:mp_clear_multi (&x, &y, &u, &v, &A, &B, &C, &D, NULL);
|
||||
|
||||
|
||||
/* compare maginitude of two ints (unsigned) */
|
||||
static int ICACHE_FLASH_ATTR
|
||||
static int
|
||||
mp_cmp_mag (mp_int * a, mp_int * b)
|
||||
{
|
||||
int n;
|
||||
@ -967,7 +965,7 @@ mp_cmp_mag (mp_int * a, mp_int * b)
|
||||
|
||||
|
||||
/* reads a unsigned char array, assumes the msb is stored first [big endian] */
|
||||
static int ICACHE_FLASH_ATTR
|
||||
static int
|
||||
mp_read_unsigned_bin (mp_int * a, const unsigned char *b, int c)
|
||||
{
|
||||
int res;
|
||||
@ -1003,7 +1001,7 @@ mp_read_unsigned_bin (mp_int * a, const unsigned char *b, int c)
|
||||
|
||||
|
||||
/* store in unsigned [big endian] format */
|
||||
static int ICACHE_FLASH_ATTR
|
||||
static int
|
||||
mp_to_unsigned_bin (mp_int * a, unsigned char *b)
|
||||
{
|
||||
int x, res;
|
||||
@ -1032,7 +1030,7 @@ mp_to_unsigned_bin (mp_int * a, unsigned char *b)
|
||||
|
||||
|
||||
/* shift right by a certain bit count (store quotient in c, optional remainder in d) */
|
||||
static int ICACHE_FLASH_ATTR
|
||||
static int
|
||||
mp_div_2d (mp_int * a, int b, mp_int * c, mp_int * d)
|
||||
{
|
||||
mp_digit D, r, rr;
|
||||
@ -1109,7 +1107,7 @@ mp_div_2d (mp_int * a, int b, mp_int * c, mp_int * d)
|
||||
}
|
||||
|
||||
|
||||
static int ICACHE_FLASH_ATTR
|
||||
static int
|
||||
mp_init_copy (mp_int * a, mp_int * b)
|
||||
{
|
||||
int res;
|
||||
@ -1122,7 +1120,7 @@ mp_init_copy (mp_int * a, mp_int * b)
|
||||
|
||||
|
||||
/* set to zero */
|
||||
static void ICACHE_FLASH_ATTR
|
||||
static void
|
||||
mp_zero (mp_int * a)
|
||||
{
|
||||
int n;
|
||||
@ -1139,7 +1137,7 @@ mp_zero (mp_int * a)
|
||||
|
||||
|
||||
/* copy, b = a */
|
||||
static int ICACHE_FLASH_ATTR
|
||||
static int
|
||||
mp_copy (mp_int * a, mp_int * b)
|
||||
{
|
||||
int res, n;
|
||||
@ -1187,7 +1185,7 @@ mp_copy (mp_int * a, mp_int * b)
|
||||
|
||||
|
||||
/* shift right a certain amount of digits */
|
||||
static void ICACHE_FLASH_ATTR
|
||||
static void
|
||||
mp_rshd (mp_int * a, int b)
|
||||
{
|
||||
int x;
|
||||
@ -1242,7 +1240,7 @@ mp_rshd (mp_int * a, int b)
|
||||
/* swap the elements of two integers, for cases where you can't simply swap the
|
||||
* mp_int pointers around
|
||||
*/
|
||||
static void ICACHE_FLASH_ATTR
|
||||
static void
|
||||
mp_exch (mp_int * a, mp_int * b)
|
||||
{
|
||||
mp_int t;
|
||||
@ -1260,7 +1258,7 @@ mp_exch (mp_int * a, mp_int * b)
|
||||
* Typically very fast. Also fixes the sign if there
|
||||
* are no more leading digits
|
||||
*/
|
||||
static void ICACHE_FLASH_ATTR
|
||||
static void
|
||||
mp_clamp (mp_int * a)
|
||||
{
|
||||
/* decrease used while the most significant digit is
|
||||
@ -1278,7 +1276,7 @@ mp_clamp (mp_int * a)
|
||||
|
||||
|
||||
/* grow as required */
|
||||
static int ICACHE_FLASH_ATTR
|
||||
static int
|
||||
mp_grow (mp_int * a, int size)
|
||||
{
|
||||
int i;
|
||||
@ -1320,7 +1318,7 @@ mp_grow (mp_int * a, int size)
|
||||
*
|
||||
* Simple function copies the input and fixes the sign to positive
|
||||
*/
|
||||
static int ICACHE_FLASH_ATTR
|
||||
static int
|
||||
mp_abs (mp_int * a, mp_int * b)
|
||||
{
|
||||
int res;
|
||||
@ -1341,7 +1339,7 @@ mp_abs (mp_int * a, mp_int * b)
|
||||
|
||||
|
||||
/* set to a digit */
|
||||
static void ICACHE_FLASH_ATTR
|
||||
static void
|
||||
mp_set (mp_int * a, mp_digit b)
|
||||
{
|
||||
mp_zero (a);
|
||||
@ -1352,7 +1350,7 @@ mp_set (mp_int * a, mp_digit b)
|
||||
|
||||
#ifndef LTM_NO_NEG_EXP
|
||||
/* b = a/2 */
|
||||
static int ICACHE_FLASH_ATTR
|
||||
static int
|
||||
mp_div_2(mp_int * a, mp_int * b)
|
||||
{
|
||||
int x, res, oldused;
|
||||
@ -1402,7 +1400,7 @@ mp_div_2(mp_int * a, mp_int * b)
|
||||
|
||||
|
||||
/* shift left by a certain bit count */
|
||||
static int ICACHE_FLASH_ATTR
|
||||
static int
|
||||
mp_mul_2d (mp_int * a, int b, mp_int * c)
|
||||
{
|
||||
mp_digit d;
|
||||
@ -1468,7 +1466,7 @@ mp_mul_2d (mp_int * a, int b, mp_int * c)
|
||||
|
||||
|
||||
#ifdef BN_MP_INIT_MULTI_C
|
||||
static int ICACHE_FLASH_ATTR
|
||||
static int
|
||||
mp_init_multi(mp_int *mp, ...)
|
||||
{
|
||||
mp_err res = MP_OKAY; /* Assume ok until proven otherwise */
|
||||
@ -1508,7 +1506,7 @@ mp_init_multi(mp_int *mp, ...)
|
||||
|
||||
|
||||
#ifdef BN_MP_CLEAR_MULTI_C
|
||||
static void ICACHE_FLASH_ATTR
|
||||
static void
|
||||
mp_clear_multi(mp_int *mp, ...)
|
||||
{
|
||||
mp_int* next_mp = mp;
|
||||
@ -1524,7 +1522,7 @@ mp_clear_multi(mp_int *mp, ...)
|
||||
|
||||
|
||||
/* shift left a certain amount of digits */
|
||||
static int ICACHE_FLASH_ATTR
|
||||
static int
|
||||
mp_lshd (mp_int * a, int b)
|
||||
{
|
||||
int x, res;
|
||||
@ -1572,7 +1570,7 @@ mp_lshd (mp_int * a, int b)
|
||||
|
||||
|
||||
/* returns the number of bits in an int */
|
||||
static int ICACHE_FLASH_ATTR
|
||||
static int
|
||||
mp_count_bits (mp_int * a)
|
||||
{
|
||||
int r;
|
||||
@ -1597,7 +1595,7 @@ mp_count_bits (mp_int * a)
|
||||
|
||||
|
||||
/* calc a value mod 2**b */
|
||||
static int ICACHE_FLASH_ATTR
|
||||
static int
|
||||
mp_mod_2d (mp_int * a, int b, mp_int * c)
|
||||
{
|
||||
int x, res;
|
||||
@ -1634,7 +1632,7 @@ mp_mod_2d (mp_int * a, int b, mp_int * c)
|
||||
#ifdef BN_MP_DIV_SMALL
|
||||
|
||||
/* slower bit-bang division... also smaller */
|
||||
static int ICACHE_FLASH_ATTR
|
||||
static int
|
||||
mp_div(mp_int * a, mp_int * b, mp_int * c, mp_int * d)
|
||||
{
|
||||
mp_int ta, tb, tq, q;
|
||||
@ -1717,7 +1715,7 @@ LBL_ERR:
|
||||
* The overall algorithm is as described as
|
||||
* 14.20 from HAC but fixed to treat these cases.
|
||||
*/
|
||||
static int ICACHE_FLASH_ATTR
|
||||
static int
|
||||
mp_div (mp_int * a, mp_int * b, mp_int * c, mp_int * d)
|
||||
{
|
||||
mp_int q, x, y, t1, t2;
|
||||
@ -1910,7 +1908,7 @@ LBL_Q:mp_clear (&q);
|
||||
#define TAB_SIZE 256
|
||||
#endif
|
||||
|
||||
static int ICACHE_FLASH_ATTR
|
||||
static int
|
||||
s_mp_exptmod (mp_int * G, mp_int * X, mp_int * P, mp_int * Y, int redmode)
|
||||
{
|
||||
mp_int M[TAB_SIZE], res, mu;
|
||||
@ -2139,7 +2137,7 @@ LBL_M:
|
||||
|
||||
|
||||
/* computes b = a*a */
|
||||
static int ICACHE_FLASH_ATTR
|
||||
static int
|
||||
mp_sqr (mp_int * a, mp_int * b)
|
||||
{
|
||||
int res;
|
||||
@ -2181,7 +2179,7 @@ if (a->used >= KARATSUBA_SQR_CUTOFF) {
|
||||
This differs from reduce_2k since "d" can be larger
|
||||
than a single digit.
|
||||
*/
|
||||
static int ICACHE_FLASH_ATTR
|
||||
static int
|
||||
mp_reduce_2k_l(mp_int *a, mp_int *n, mp_int *d)
|
||||
{
|
||||
mp_int q;
|
||||
@ -2220,7 +2218,7 @@ ERR:
|
||||
|
||||
|
||||
/* determines the setup value */
|
||||
static int ICACHE_FLASH_ATTR
|
||||
static int
|
||||
mp_reduce_2k_setup_l(mp_int *a, mp_int *d)
|
||||
{
|
||||
int res;
|
||||
@ -2249,7 +2247,7 @@ ERR:
|
||||
* Simple algorithm which zeroes the int, grows it then just sets one bit
|
||||
* as required.
|
||||
*/
|
||||
static int ICACHE_FLASH_ATTR
|
||||
static int
|
||||
mp_2expt (mp_int * a, int b)
|
||||
{
|
||||
int res;
|
||||
@ -2275,7 +2273,7 @@ mp_2expt (mp_int * a, int b)
|
||||
/* pre-calculate the value required for Barrett reduction
|
||||
* For a given modulus "b" it calulates the value required in "a"
|
||||
*/
|
||||
static int ICACHE_FLASH_ATTR
|
||||
static int
|
||||
mp_reduce_setup (mp_int * a, mp_int * b)
|
||||
{
|
||||
int res;
|
||||
@ -2291,7 +2289,7 @@ mp_reduce_setup (mp_int * a, mp_int * b)
|
||||
* precomputed via mp_reduce_setup.
|
||||
* From HAC pp.604 Algorithm 14.42
|
||||
*/
|
||||
static int ICACHE_FLASH_ATTR
|
||||
static int
|
||||
mp_reduce (mp_int * x, mp_int * m, mp_int * mu)
|
||||
{
|
||||
mp_int q;
|
||||
@ -2375,7 +2373,7 @@ CLEANUP:
|
||||
* HAC pp. 595, Algorithm 14.12 Modified so you can control how
|
||||
* many digits of output are created.
|
||||
*/
|
||||
static int ICACHE_FLASH_ATTR
|
||||
static int
|
||||
s_mp_mul_digs (mp_int * a, mp_int * b, mp_int * c, int digs)
|
||||
{
|
||||
mp_int t;
|
||||
@ -2458,7 +2456,7 @@ s_mp_mul_digs (mp_int * a, mp_int * b, mp_int * c, int digs)
|
||||
* Based on Algorithm 14.12 on pp.595 of HAC.
|
||||
*
|
||||
*/
|
||||
static int ICACHE_FLASH_ATTR
|
||||
static int
|
||||
fast_s_mp_mul_digs (mp_int * a, mp_int * b, mp_int * c, int digs)
|
||||
{
|
||||
int olduse, res, pa, ix, iz;
|
||||
@ -2531,7 +2529,7 @@ fast_s_mp_mul_digs (mp_int * a, mp_int * b, mp_int * c, int digs)
|
||||
|
||||
|
||||
/* init an mp_init for a given size */
|
||||
static int ICACHE_FLASH_ATTR
|
||||
static int
|
||||
mp_init_size (mp_int * a, int size)
|
||||
{
|
||||
int x;
|
||||
@ -2560,7 +2558,7 @@ mp_init_size (mp_int * a, int size)
|
||||
|
||||
|
||||
/* low level squaring, b = a*a, HAC pp.596-597, Algorithm 14.16 */
|
||||
static int ICACHE_FLASH_ATTR
|
||||
static int
|
||||
s_mp_sqr (mp_int * a, mp_int * b)
|
||||
{
|
||||
mp_int t;
|
||||
@ -2627,7 +2625,7 @@ s_mp_sqr (mp_int * a, mp_int * b)
|
||||
/* multiplies |a| * |b| and does not compute the lower digs digits
|
||||
* [meant to get the higher part of the product]
|
||||
*/
|
||||
static int ICACHE_FLASH_ATTR
|
||||
static int
|
||||
s_mp_mul_high_digs (mp_int * a, mp_int * b, mp_int * c, int digs)
|
||||
{
|
||||
mp_int t;
|
||||
@ -2687,7 +2685,7 @@ s_mp_mul_high_digs (mp_int * a, mp_int * b, mp_int * c, int digs)
|
||||
|
||||
#ifdef BN_MP_MONTGOMERY_SETUP_C
|
||||
/* setups the montgomery reduction stuff */
|
||||
static int ICACHE_FLASH_ATTR
|
||||
static int
|
||||
mp_montgomery_setup (mp_int * n, mp_digit * rho)
|
||||
{
|
||||
mp_digit x, b;
|
||||
@ -2735,7 +2733,7 @@ mp_montgomery_setup (mp_int * n, mp_digit * rho)
|
||||
*
|
||||
* Based on Algorithm 14.32 on pp.601 of HAC.
|
||||
*/
|
||||
int ICACHE_FLASH_ATTR
|
||||
int
|
||||
fast_mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho)
|
||||
{
|
||||
int ix, res, olduse;
|
||||
@ -2883,7 +2881,7 @@ fast_mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho)
|
||||
|
||||
#ifdef BN_MP_MUL_2_C
|
||||
/* b = a*2 */
|
||||
static int ICACHE_FLASH_ATTR
|
||||
static int
|
||||
mp_mul_2(mp_int * a, mp_int * b)
|
||||
{
|
||||
int x, res, oldused;
|
||||
@ -2953,7 +2951,7 @@ mp_mul_2(mp_int * a, mp_int * b)
|
||||
* The method is slightly modified to shift B unconditionally up to just under
|
||||
* the leading bit of b. This saves a lot of multiple precision shifting.
|
||||
*/
|
||||
static int ICACHE_FLASH_ATTR
|
||||
static int
|
||||
mp_montgomery_calc_normalization (mp_int * a, mp_int * b)
|
||||
{
|
||||
int x, bits, res;
|
||||
@ -2997,7 +2995,7 @@ mp_montgomery_calc_normalization (mp_int * a, mp_int * b)
|
||||
* Uses Montgomery or Diminished Radix reduction [whichever appropriate]
|
||||
*/
|
||||
|
||||
static int ICACHE_FLASH_ATTR
|
||||
static int
|
||||
mp_exptmod_fast (mp_int * G, mp_int * X, mp_int * P, mp_int * Y, int redmode)
|
||||
{
|
||||
mp_int M[TAB_SIZE], res;
|
||||
@ -3296,7 +3294,7 @@ LBL_M:
|
||||
After that loop you do the squares and add them in.
|
||||
*/
|
||||
|
||||
static int ICACHE_FLASH_ATTR
|
||||
static int
|
||||
fast_s_mp_sqr (mp_int * a, mp_int * b)
|
||||
{
|
||||
int olduse, res, pa, ix, iz;
|
||||
@ -3384,7 +3382,7 @@ fast_s_mp_sqr (mp_int * a, mp_int * b)
|
||||
|
||||
#ifdef BN_MP_MUL_D_C
|
||||
/* multiply by a digit */
|
||||
static int ICACHE_FLASH_ATTR
|
||||
static int
|
||||
mp_mul_d (mp_int * a, mp_digit b, mp_int * c)
|
||||
{
|
||||
mp_digit u, *tmpa, *tmpc;
|
||||
|
@ -9,9 +9,9 @@
|
||||
#ifndef BASE64_H
|
||||
#define BASE64_H
|
||||
|
||||
unsigned char * _base64_encode(const unsigned char *src, size_t len,
|
||||
unsigned char * base64_encode(const unsigned char *src, size_t len,
|
||||
size_t *out_len);
|
||||
unsigned char * _base64_decode(const unsigned char *src, size_t len,
|
||||
unsigned char * base64_decode(const unsigned char *src, size_t len,
|
||||
size_t *out_len);
|
||||
|
||||
#endif /* BASE64_H */
|
||||
|
@ -23,10 +23,10 @@ void ext_password_free(struct wpabuf *pw);
|
||||
|
||||
#else /* CONFIG_EXT_PASSWORD */
|
||||
|
||||
#define ext_password_init(b, p) ((void *) 1)
|
||||
#define ext_password_deinit(d) do { } while (0)
|
||||
#define ext_password_get(d, n) (NULL)
|
||||
#define ext_password_free(p) do { } while (0)
|
||||
#define ext_password_init(b, p)
|
||||
#define ext_password_deinit(d)
|
||||
#define ext_password_get(d, n)
|
||||
#define ext_password_free(p)
|
||||
|
||||
#endif /* CONFIG_EXT_PASSWORD */
|
||||
|
||||
|
Reference in New Issue
Block a user