Skip to content

Commit

Permalink
Generate secret_key at compilation
Browse files Browse the repository at this point in the history
Requires Python >=3.6, which is already EOL, so not noteworthy
RIOT-OS#20370 (comment)
  • Loading branch information
xnumad committed Feb 22, 2024
1 parent 62d2ae7 commit 658056a
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions sys/net/gnrc/Makefile.dep
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,21 @@ ifneq (,$(filter gnrc_ipv6_nib,$(USEMODULE)))
USEMODULE += random
endif

#This checks if the option is being set via Kconfig or CFLAGS
ifneq (,$(or $(CONFIG_GNRC_IPV6_STABLE_PRIVACY),$(filter -DCONFIG_GNRC_IPV6_STABLE_PRIVACY=1,$(CFLAGS))))
# Set another macro that is needed for this option.

##prepare value
stable_privacy_secret_key != python3 -c "import secrets; print(','.join([f'0x{byte:02x}' for byte in secrets.token_bytes(16)]))"

##set macro
CFLAGS += -DSTABLE_PRIVACY_SECRET_KEY=$(stable_privacy_secret_key)

# dependencies
USEMODULE += hashes ##include "hashes/sha256.h"
USEMODULE += ztimer_msec
endif

ifneq (,$(filter gnrc_udp,$(USEMODULE)))
DEFAULT_MODULE += auto_init_gnrc_udp
USEMODULE += gnrc_nettype_udp
Expand Down

0 comments on commit 658056a

Please sign in to comment.