30 lines
680 B
Python
30 lines
680 B
Python
from pathlib import Path
|
|
|
|
Import("env")
|
|
|
|
|
|
PROJECT_DIR = Path(env.subst("$PROJECT_DIR"))
|
|
MARKER = "/* CrossPoint wolfSSL compatibility overrides */"
|
|
OVERRIDES = f"""
|
|
|
|
{MARKER}
|
|
#undef NO_DH
|
|
#ifndef HAVE_FFDHE_2048
|
|
#define HAVE_FFDHE_2048
|
|
#endif
|
|
#undef FP_MAX_BITS
|
|
#define FP_MAX_BITS 16384
|
|
"""
|
|
|
|
|
|
def patch_user_settings(path: Path) -> None:
|
|
text = path.read_text()
|
|
if MARKER in text:
|
|
text = text.split(MARKER, 1)[0].rstrip()
|
|
path.write_text(text + OVERRIDES + "\n")
|
|
print(f"Patched wolfSSL settings: {path.relative_to(PROJECT_DIR)}")
|
|
|
|
|
|
for settings in PROJECT_DIR.glob(".pio/libdeps/*/Arduino-wolfSSL/src/user_settings.h"):
|
|
patch_user_settings(settings)
|