mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-22 21:23:07 +03:00
## WPA2 Enterprise connections
References - merged PRs:
* https://github.com/esp8266/Arduino/pull/8529
* https://github.com/esp8266/Arduino/pull/8566 - these occurred with connect/disconnect with WPA-Enterprise
* https://github.com/esp8266/Arduino/pull/8736#issue-1470774550
The NON-OS SDK 3.0.x has breaking changes to the [`pvPortMalloc`](bf890b22e5/include/mem.h (L42)
) function. They added a new `bool` argument for selecting a heap.
```cpp
void *pvPortMalloc (size_t sz, const char *, unsigned, bool);
```
To avoid breaking the build, I added a new thin wrapper function `sdk3_pvPortMalloc` to `heap.cpp`.
Edited new SDK LIBs to call `pvPortMalloc`'s replacement `sdk3_pvPortMalloc`.
They also added `pvPortZallocIram` and `pvPortCallocIram`, which are not a problem to support. Support added to `heap.cpp`.
Issues with WPA2 Enterprise in new SDKs:
* v3.0.0 and v3.0.1 - have the same memory leak and duplicate free bugs from before
* v3.0.2 through v3.0.5 - have the same memory leak; however, _no_ duplicate free crash.
* memory leak can be seen by cycling through setup, connect, disconnect, and clear setup - repeatedly.
Updated `wpa2_eap_patch.cpp` and binary patch scripts to handle v3.0.0 through v3.0.5.
Patched SDKs v3.0.0 through v3.0.5
## Duplicate Non-32-bit exception handler
Issue: At v3.0.0 and above `libmain.a` supplies a built-in exception handler (`load_non_32_wide_handler`) for non-32-bit access. Our non-32-bit access handler (`non32xfer_exception_handler`) overrides it.
Solution: Add "weak" attribute to symbol `load_non_32_wide_handler`. Adjust the build to default to the SDK's built-in non-32-bit handler. If there is a need to use our non-32-bit handler, make the selection from the Arduino IDE Tools menu `Non-32-Bit Access: "Byte/Word access to IRAM/PROGMEM (very slow)"`.
With SDKs v3.0.0 and above a "non-32-bit exception handler" is always present.
135 lines
2.2 KiB
Bash
Executable File
135 lines
2.2 KiB
Bash
Executable File
#!/bin/bash
|
|
# set -e
|
|
|
|
single_sdk="${2}"
|
|
if [[ -n "$single_sdk" ]]; then
|
|
if [[ "NONOSDK" != "${single_sdk:0:7}" ]]; then
|
|
single_sdk=""
|
|
fi
|
|
fi
|
|
|
|
add_path_ifexist() {
|
|
if [[ -d $1 ]]; then
|
|
export PATH=$( realpath $1 ):$PATH
|
|
return 0
|
|
fi
|
|
return 1
|
|
}
|
|
|
|
if ! which xtensa-lx106-elf-ar | grep "tools/xtensa-lx106-elf/bin" >>/dev/null; then
|
|
add_path_ifexist "../../../xtensa-lx106-elf/bin" || add_path_ifexist "../../xtensa-lx106-elf/bin"
|
|
fi
|
|
|
|
help_msg() {
|
|
cat <<EOF
|
|
Try:
|
|
eval_fix_sdks.sh --analyze
|
|
or
|
|
eval_fix_sdks.sh --patch
|
|
|
|
EOF
|
|
}
|
|
|
|
list_sdks() {
|
|
if [[ -n "$single_sdk" ]]; then
|
|
echo -e "$single_sdk"
|
|
return
|
|
fi
|
|
cat <<EOF
|
|
NONOSDK22x_190313
|
|
NONOSDK22x_190703
|
|
NONOSDK22x_191024
|
|
NONOSDK22x_191105
|
|
NONOSDK22x_191122
|
|
NONOSDK221
|
|
NONOSDK3V0
|
|
NONOSDK300
|
|
NONOSDK301
|
|
NONOSDK302
|
|
NONOSDK303
|
|
NONOSDK304
|
|
NONOSDK305
|
|
EOF
|
|
}
|
|
|
|
remove_ifexist() {
|
|
[[ -f $1 ]] && rm $1
|
|
}
|
|
|
|
cleanup() {
|
|
remove_ifexist old.txt
|
|
remove_ifexist old2.txt
|
|
remove_ifexist new.txt
|
|
for sdk in `list_sdks`; do
|
|
remove_ifexist $sdk/eap.o
|
|
done
|
|
}
|
|
|
|
unasm() {
|
|
xtensa-lx106-elf-objdump -d $*
|
|
}
|
|
|
|
analyze() {
|
|
cleanup
|
|
|
|
for sdk in `list_sdks`; do
|
|
pushd $sdk
|
|
xtensa-lx106-elf-ar x libwpa2.a eap.o
|
|
popd
|
|
done
|
|
echo ""
|
|
|
|
find . -name eap.o -exec md5sum {} \; | sort -k2
|
|
echo ""
|
|
|
|
unset prev_sdk
|
|
for sdk in `list_sdks`; do
|
|
unasm -j ".text.eap_peer_config_deinit" ${sdk}/eap.o >new.txt
|
|
if [[ -f old.txt ]]; then
|
|
echo "eap_peer_config_deinit: diff $prev_sdk $sdk"
|
|
diff old.txt new.txt
|
|
echo ""
|
|
fi
|
|
mv new.txt old.txt
|
|
prev_sdk=${sdk}
|
|
done
|
|
|
|
unset prev_sdk
|
|
for sdk in `list_sdks`; do
|
|
unasm -j ".text.wpa2_sm_rx_eapol" ${sdk}/eap.o >new.txt
|
|
if [[ -f old2.txt ]]; then
|
|
echo "wpa2_sm_rx_eapol: diff $prev_sdk $sdk"
|
|
diff old2.txt new.txt
|
|
echo ""
|
|
fi
|
|
mv new.txt old2.txt
|
|
prev_sdk=${sdk}
|
|
done
|
|
|
|
# Find offsets for patching vPortFree with z2EapFree
|
|
for sdk in `list_sdks`; do
|
|
echo -en "\n${sdk}/eap.o:\n "
|
|
grep --byte-offset --only-matching --text vPortFree ${sdk}/eap.o
|
|
done
|
|
|
|
cleanup
|
|
}
|
|
|
|
|
|
patch_all() {
|
|
for sdk in `list_sdks`; do
|
|
pushd $sdk
|
|
../fix_sdk_libs.sh
|
|
popd
|
|
done
|
|
}
|
|
|
|
if [[ "${1}" == "--analyze" ]]; then
|
|
analyze
|
|
elif [[ "${1}" == "--patch" ]]; then
|
|
patch_all
|
|
else
|
|
help_msg
|
|
fi
|
|
exit 0
|