1- # CMakeList .txt
1+ # CMakeLists .txt
22#
33# Copyright (C) 2006-2024 wolfSSL Inc.
44#
@@ -545,16 +545,89 @@ add_option(WOLFSSL_OQS
545545 "Enable integration with the OQS (Open Quantum Safe) liboqs library (default: disabled)"
546546 "no" "yes;no" )
547547
548- if (WOLFSSL_OQS)
549- find_package (OQS )
548+ # Kyber
549+ add_option (WOLFSSL_KYBER
550+ "Enable the wolfSSL PQ Kyber library (default: disabled)"
551+ "no" "yes;no" )
550552
551- if (OQS_FOUND)
552- list (APPEND WOLFSSL_LINK_LIBS ${OQS_LIBRARY} )
553- list (APPEND WOLFSSL_INCLUDE_DIRS ${OQS_INCLUDE_DIR} )
554- set (HAVE_LIBOQS 1)
555- list (APPEND WOLFSSL_DEFINITIONS
556- "-DHAVE_TLS_EXTENSIONS"
557- "-DHAVE_LIBOQS" )
553+ # Experimental features
554+ add_option (WOLFSSL_EXPERIMENTAL
555+ "Enable experimental features (default: disabled)"
556+ "no" "yes;no" )
557+
558+ message (STATUS "Looking for WOLFSSL_EXPERIMENTAL" )
559+ if (WOLFSSL_EXPERIMENTAL)
560+ message (STATUS "Looking for WOLFSSL_EXPERIMENTAL - found" )
561+
562+ # We've enabled the experimental environment, but let's
563+ # check if any experimental features are also enabled:
564+ set (WOLFSSL_FOUND_EXPERIMENTAL_FEATURE 0)
565+
566+ set_wolfssl_definitions ("WOLFSSL_EXPERIMENTAL_SETTINGS" RESUlT )
567+
568+ # Checking for experimental feature: OQS
569+ message (STATUS "Looking for WOLFSSL_OQS" )
570+ if (WOLFSSL_OQS)
571+ set (WOLFSSL_FOUND_EXPERIMENTAL_FEATURE 1)
572+ message (STATUS "Looking for WOLFSSL_OQS - found" )
573+
574+ message (STATUS "Checking OQS" )
575+ find_package (OQS )
576+ if (OQS_FOUND)
577+ message (STATUS "Checking OQS - found" )
578+ list (APPEND WOLFSSL_LINK_LIBS ${OQS_LIBRARY} )
579+ list (APPEND WOLFSSL_INCLUDE_DIRS ${OQS_INCLUDE_DIR} )
580+
581+ set_wolfssl_definitions ("HAVE_LIBOQS" RESUlT )
582+ set_wolfssl_definitions ("HAVE_TLS_EXTENSIONS" RESUlT )
583+ set_wolfssl_definitions ("OPENSSL_EXTRA" RESUlT )
584+
585+ else ()
586+ message (STATUS "Checking OQS - not found" )
587+ message (STATUS "WARNING: WOLFSSL_OQS enabled but not found: OQS_LIBRARY=${OQS_LIBRARY} , OQS_INCLUDE_DIR=${OQS_INCLUDE_DIR} " )
588+ endif ()
589+ else ()
590+ message (STATUS "Looking for WOLFSSL_OQS - not found" )
591+ endif ()
592+
593+ # Checking for experimental feature: Kyber
594+ message (STATUS "Looking for WOLFSSL_KYBER" )
595+ if (WOLFSSL_KYBER)
596+ set (WOLFSSL_FOUND_EXPERIMENTAL_FEATURE 1)
597+
598+ message (STATUS "Automatically set related requirements for Kyber:" )
599+ set_wolfssl_definitions ("WOLFSSL_HAVE_KYBER" RESUlT )
600+ set_wolfssl_definitions ("WOLFSSL_WC_KYBER" RESUlT )
601+ set_wolfssl_definitions ("WOLFSSL_SHA3" RESUlT )
602+ set_wolfssl_definitions ("WOLFSSL_SHAKE128" RESUlT )
603+ set_wolfssl_definitions ("WOLFSSL_SHAKE256" RESUlT )
604+ message (STATUS "Looking for WOLFSSL_KYBER - found" )
605+ else ()
606+ message (STATUS "Looking for WOLFSSL_KYBER - not found" )
607+ endif ()
608+
609+ # Other experimental feature detection can be added here...
610+
611+ # Were any experimental features found? Display a message.
612+ if (WOLFSSL_FOUND_EXPERIMENTAL_FEATURE)
613+ message (STATUS "WOLFSSL_EXPERIMENTAL enabled, experimental features enabled." )
614+ else ()
615+ message (STATUS "Warning: WOLFSSL_EXPERIMENTAL enabled, but no experimental features enabled." )
616+ endif ()
617+
618+ # Sanity checks
619+ if (WOLFSSL_OQS AND WOLFSSL_KYBER)
620+ message (FATAL_ERROR "Error: cannot enable both WOLFSSL_OQS and WOLFSSL_KYBER at the same time." )
621+ endif ()
622+
623+ else ()
624+ # Experimental mode not enabled, but were any experimental features enabled? Error out if so:
625+ message (STATUS "Looking for WOLFSSL_EXPERIMENTAL - not found" )
626+ if (WOLFSSL_OQS)
627+ message (FATAL_ERROR "Error: WOLFSSL_OQS requires WOLFSSL_EXPERIMENTAL at this time." )
628+ endif ()
629+ if (WOLFSSL_KYBER)
630+ message (FATAL_ERROR "Error: WOLFSSL_KYBER requires WOLFSSL_EXPERIMENTAL at this time." )
558631 endif ()
559632endif ()
560633
@@ -571,6 +644,9 @@ endif()
571644# - Atomic user record layer
572645# - Public key callbacks
573646# - Microchip/Atmel CryptoAuthLib
647+ # - XMSS
648+ # - LMS
649+ # - dual-certs
574650
575651# AES-CBC
576652add_option ("WOLFSSL_AESCBC"
0 commit comments