You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
1.3 KiB

  1. From 9126ec99ca9e136666cbba5b48a8a02cb11350e0 Mon Sep 17 00:00:00 2001
  2. From: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
  3. Date: Mon, 15 Oct 2018 11:16:54 -0400
  4. Subject: [PATCH] Automatically detect whether Curve25519 is available in NSS
  5. for USE_DH31
  6. currently, USE_DH31 defaults to true.
  7. On some platforms, where older versions of NSS are in use, this should
  8. default to false.
  9. This patch automatically detects such systems and disables USE_DH31 on
  10. those platforms.
  11. It produces some amount of noise on stderr about CURVE_25519 during
  12. the build on those older platforms, but that seems ok to me, since
  13. those platforms should know that they're missing a modern feature.
  14. If you prefer less noise, i'd be happy with any modification that does
  15. a similar sort of autodetection.
  16. diff --git a/mk/userland-cflags.mk b/mk/userland-cflags.mk
  17. index d0a88b1aa1..7d88874b1c 100644
  18. --- a/mk/userland-cflags.mk
  19. +++ b/mk/userland-cflags.mk
  20. @@ -240,7 +240,7 @@ ifeq ($(USE_DH24),true)
  21. USERLAND_CFLAGS += -DUSE_DH24
  22. endif
  23. -USE_DH31 ?= true
  24. +USE_DH31 ?= $(shell if printf '\#include <secoidt.h>\nint main() { return SEC_OID_CURVE25519; }\n'| $(CC) -x c $$(pkg-config --cflags nss) -o /dev/null -; then echo true; else echo false; fi )
  25. ifeq ($(USE_DH31),true)
  26. USERLAND_CFLAGS += -DUSE_DH31
  27. endif