string(REPLACE "_avx" "" _var_base ${_var_base})
string(REPLACE "_x86_64" "" _var_base ${_var_base})
string(REPLACE "_aarch64" "" _var_base ${_var_base})
+ string(REPLACE "_icicle_cuda" "" _var_base ${_var_base})
+ string(REPLACE "_cuda" "" _var_base ${_var_base})
foreach (_alg ${ARGV0})
if(${_var}_AVAILABLE)
if(${_var_base}X STREQUAL ${_alg}X)
endif()
endif()
+if(CMAKE_SYSTEM_NAME MATCHES "Linux|Darwin")
+if(OQS_USE_ICICLE)
+ cmake_dependent_option(OQS_ENABLE_KEM_ml_kem_512_icicle_cuda "" ON "OQS_ENABLE_KEM_ml_kem_512" OFF)
+endif()
+endif()
+
if(CMAKE_SYSTEM_NAME MATCHES "Linux|Darwin")
if(OQS_DIST_X86_64_BUILD OR (OQS_USE_AVX2_INSTRUCTIONS AND OQS_USE_BMI2_INSTRUCTIONS AND OQS_USE_POPCNT_INSTRUCTIONS))
cmake_dependent_option(OQS_ENABLE_KEM_ml_kem_768_x86_64 "" ON "OQS_ENABLE_KEM_ml_kem_768" OFF)
endif()
endif()
+if(CMAKE_SYSTEM_NAME MATCHES "Linux|Darwin")
+if(OQS_USE_ICICLE)
+ cmake_dependent_option(OQS_ENABLE_KEM_ml_kem_768_icicle_cuda "" ON "OQS_ENABLE_KEM_ml_kem_768" OFF)
+endif()
+endif()
+
if(CMAKE_SYSTEM_NAME MATCHES "Linux|Darwin")
if(OQS_DIST_X86_64_BUILD OR (OQS_USE_AVX2_INSTRUCTIONS AND OQS_USE_BMI2_INSTRUCTIONS AND OQS_USE_POPCNT_INSTRUCTIONS))
cmake_dependent_option(OQS_ENABLE_KEM_ml_kem_1024_x86_64 "" ON "OQS_ENABLE_KEM_ml_kem_1024" OFF)
endif()
endif()
+if(CMAKE_SYSTEM_NAME MATCHES "Linux|Darwin")
+if(OQS_USE_ICICLE)
+ cmake_dependent_option(OQS_ENABLE_KEM_ml_kem_1024_icicle_cuda "" ON "OQS_ENABLE_KEM_ml_kem_1024" OFF)
+endif()
+endif()
+
if(CMAKE_SYSTEM_NAME MATCHES "Darwin|Linux")
if(OQS_DIST_X86_64_BUILD OR (OQS_USE_AVX2_INSTRUCTIONS AND OQS_USE_POPCNT_INSTRUCTIONS))
option(OQS_STRICT_WARNINGS "Enable all compiler warnings." OFF)
option(OQS_EMBEDDED_BUILD "Compile liboqs for an Embedded environment without a full standard library." OFF)
option(OQS_USE_CUPQC "Utilize cuPQC as the backend for supported PQC algorithms." OFF)
+option(OQS_USE_ICICLE "Utilize ICICLE as the backend for supported PQC algorithms." OFF)
# Libfuzzer isn't supported on gcc
if('${CMAKE_C_COMPILER_ID}' STREQUAL 'Clang')
find_package(cuPQC 0.2.0 REQUIRED)
endif()
+if(OQS_USE_ICICLE)
+ enable_language(CXX)
+ set(CMAKE_CXX_STANDARD 17)
+ set(CMAKE_CXX_STANDARD_REQUIRED ON)
+
+ find_package(icicle_pqc_package REQUIRED)
+endif()
+
+
if (NOT ((CMAKE_SYSTEM_NAME MATCHES "Linux|Darwin") AND (ARCH_X86_64 STREQUAL "ON")) AND (OQS_LIBJADE_BUILD STREQUAL "ON"))
message(FATAL_ERROR "Building liboqs with libjade implementations from libjade is only supported on Linux and Darwin on x86_64.")
endif()
- [OQS_USE_CPUFEATURE_INSTRUCTIONS](#OQS_USE_CPUFEATURE_INSTRUCTIONS)
- [OQS_USE_OPENSSL](#OQS_USE_OPENSSL)
- [OQS_USE_CUPQC](#OQS_USE_CUPQC)
+- [OQS_USE_ICICLE](#OQS_USE_ICICLE)
- [OQS_OPT_TARGET](#OQS_OPT_TARGET)
- [OQS_SPEED_USE_ARM_PMU](#OQS_SPEED_USE_ARM_PMU)
- [USE_COVERAGE](#USE_COVERAGE)
**Default**: `OFF`
+### OQS_USE_ICICLE
+
+This CMake option can be set to `ON` or `OFF`. When enabled (`ON`), it configures liboqs to use ICICLE as the backend for supported post-quantum cryptographic (PQC) algorithms — currently ML-KEM.
+ICICLE is a GPU-accelerated cryptographic library developed by Ingonyama. It provides CUDA-based implementations of PQC algorithms to boost the performance on systems with compatible NVIDIA GPUs.
+To use ICICLE, the user needs to build and install the `icicle_pqc_package`, which contains the necessary CUDA kernels and runtime support. This package must be compiled separately before configuring liboqs with `OQS_USE_ICICLE` enabled, and its installation path should be made available to CMake.
+
+Enabling this option also automatically enables C++ support in CMake, as required by ICICLE’s implementations.
+
+To build ICICLE with the required PQC package:
+
+```bash
+cmake -S icicle -B "$BUILD_DIR" \
+ -DCMAKE_INSTALL_PREFIX="$INSTALL_DIR" \
+ -DCPU_BACKEND=OFF \
+ -DDISABLE_ALL_FEATURES=ON \
+ -DPQC=ON \
+ -DCUDA_PQC_BACKEND=ON \
+ -DICICLE_STATIC_LINK=ON \
+ -DPQC_PACKAGE=ON
+cmake --build "$BUILD_DIR"
+cmake --install "$BUILD_DIR"
+```
+
+For full documentation, setup instructions, and backend support details, see the [Ingonyama documentation](https://dev.ingonyama.com/)
+
+**Default**: `OFF`.
## Stateful Hash Based Signatures
- **cupqc-cuda**:<a name="cupqc-cuda"></a>
- **Source**: https://github.com/open-quantum-safe/liboqs-cupqc-meta/commit/b026f4e5475cd9c20c2082c7d9bad80e5b0ba89e
- **Implementation license (SPDX-Identifier)**: Apache-2.0
+ - **icicle-icicle_cuda**:<a name="icicle-icicle_cuda"></a>
+ - **Source**: https://github.com/ingonyama-zk/icicle-liboqs/commit/8f215fd845928abfc2bb7d5ca15db76b839bee5c
+ - **Implementation license (SPDX-Identifier)**: MIT
## Parameter set summary
cupqc-cuda:
source: https://github.com/open-quantum-safe/liboqs-cupqc-meta/commit/b026f4e5475cd9c20c2082c7d9bad80e5b0ba89e
spdx-license-identifier: Apache-2.0
+ icicle-icicle_cuda:
+ source: https://github.com/ingonyama-zk/icicle-liboqs/commit/8f215fd845928abfc2bb7d5ca15db76b839bee5c
+ spdx-license-identifier: MIT
parameter-sets:
- name: ML-KEM-512
claimed-nist-level: 1
{%- for platform in impl['supported_platforms'] if platform['architecture'] == 'CUDA' %}
{% if platform['operating_systems'] %}if(CMAKE_SYSTEM_NAME MATCHES "{{ platform['operating_systems']|join('|') }}")
{% endif -%}
+{% if impl['name'] == 'cuda' -%}
if(OQS_USE_CUPQC)
- cmake_dependent_option(OQS_ENABLE_KEM_{{ family['name'] }}_{{ scheme['scheme'] }}_{{ impl['name'] }} "" ON "OQS_ENABLE_KEM_{{ family['name'] }}_{{ scheme['scheme'] }}" OFF)
+ cmake_dependent_option(OQS_ENABLE_KEM_{{ family['name'] }}_{{ scheme['scheme'] }}_{{ impl['name'] }} "" ON "OQS_ENABLE_KEM_{{ family['name'] }}_{{ scheme['scheme'] }}" OFF)
{%- if 'alias_scheme' in scheme %}
- cmake_dependent_option(OQS_ENABLE_KEM_{{ family['name'] }}_{{ scheme['alias_scheme'] }}_{{ impl['name'] }} "" ON "OQS_ENABLE_KEM_{{ family['name'] }}_{{ scheme['alias_scheme'] }}" OFF)
+ cmake_dependent_option(OQS_ENABLE_KEM_{{ family['name'] }}_{{ scheme['alias_scheme'] }}_{{ impl['name'] }} "" ON "OQS_ENABLE_KEM_{{ family['name'] }}_{{ scheme['alias_scheme'] }}" OFF)
{%- endif %}
endif()
+{% endif %}
+{%- if impl['name'] == 'icicle_cuda' -%}
+if(OQS_USE_ICICLE)
+ cmake_dependent_option(OQS_ENABLE_KEM_{{ family.name }}_{{ scheme.scheme }}_{{ impl.name }} "" ON "OQS_ENABLE_KEM_{{ family.name }}_{{ scheme.scheme }}" OFF)
+{%- if scheme.alias_scheme is defined -%}
+ cmake_dependent_option(OQS_ENABLE_KEM_{{ family.name }}_{{ scheme.alias_scheme }}_{{ impl.name }} "" ON "OQS_ENABLE_KEM_{{ family.name }}_{{ scheme.alias_scheme }}" OFF)
+{%- endif %}
+endif()
+{% endif -%}
{% if platform['operating_systems'] %}endif()
{% endif -%}
{%- endfor -%}
kem_meta_path: '{pretty_name_full}_META.yml'
kem_scheme_path: '.'
patches: []
+ -
+ name: icicle
+ git_url: https://github.com/ingonyama-zk/icicle-liboqs.git
+ git_branch: main
+ git_commit: 8f215fd845928abfc2bb7d5ca15db76b839bee5c
+ kem_meta_path: '{pretty_name_full}_META.yml'
+ kem_scheme_path: '.'
+ patches: []
-
name: pqcrystals-dilithium
git_url: https://github.com/pq-crystals/dilithium.git
default_implementation: ref
arch_specific_implementations:
cuda: cuda
+ icicle_cuda: icicle_cuda
arch_specific_upstream_locations:
cuda: cupqc
+ icicle_cuda: icicle
upstream_location: mlkem-native
derandomized_keypair: true
schemes:
target_link_libraries({{ family }}_{{ scheme['scheme'] }}_{{ impl['name'] }} cupqc)
set_property(TARGET {{ family }}_{{ scheme['scheme'] }}_{{ impl['name'] }} PROPERTY CUDA_ARCHITECTURES OFF)
target_compile_options({{ family }}_{{ scheme['scheme'] }}_{{ impl['name'] }} PRIVATE {{ impl['compile_opts'] }})
+
+ {%- elif impl['name'] == 'icicle_cuda' %}
+
+if(OQS_ENABLE_KEM_{{ family }}_{{ scheme['scheme_c'] }}_{{ impl['name'] }}{%- if 'alias_scheme' in scheme %} OR OQS_ENABLE_KEM_{{ family }}_{{ scheme['alias_scheme'] }}_{{ impl['name'] }}{%- endif %})
+ add_library({{ family }}_{{ scheme['scheme'] }}_{{ impl['name'] }} OBJECT icicle_{{ scheme['pqclean_scheme'] }}_{{ impl['name'] }}/icicle_ml-kem.cpp)
+ target_link_libraries({{ family }}_{{ scheme['scheme'] }}_{{ impl['name'] }} PRIVATE icicle::icicle_pqc_package)
{%- else %}
if(OQS_ENABLE_KEM_{{ family }}_{{ scheme['scheme_c'] }}_{{ impl['name'] }}{%- if 'alias_scheme' in scheme %} OR OQS_ENABLE_KEM_{{ family }}_{{ scheme['alias_scheme'] }}_{{ impl['name'] }}{%- endif %})
add_library({{ family }}_{{ scheme['scheme'] }}_{{ impl['name'] }} OBJECT {% for source_file in impl['sources']|sort -%}{{ impl['upstream']['name'] }}_{{ scheme['pqclean_scheme'] }}_{{ impl['name'] }}/{{ source_file }}{%- if not loop.last %} {% endif -%}{%- endfor -%})
{%- endif %}
- {%- if impl['name'] != 'cuda' %}
+ {%- if impl['name'] != 'cuda' and impl['name'] != 'icicle_cuda' %}
target_include_directories({{ family }}_{{ scheme['scheme'] }}_{{ impl['name'] }} PRIVATE ${CMAKE_CURRENT_LIST_DIR}/{{ impl['upstream']['name'] }}_{{ scheme['pqclean_scheme'] }}_{{ impl['name'] }})
target_include_directories({{ family }}_{{ scheme['scheme'] }}_{{ impl['name'] }} PRIVATE ${PROJECT_SOURCE_DIR}/src/common/pqclean_shims)
{%- if impl['name'] != scheme['default_implementation'] and impl['required_flags'] -%}
{% if impl['name'] == 'cuda'%}
#if defined(OQS_USE_CUPQC)
{%- endif %}
+{%- if impl['name'] == 'icicle_cuda'%}
+#if defined(OQS_USE_ICICLE)
+ {%- endif %}
#if defined(OQS_ENABLE_KEM_{{ family }}_{{ scheme['scheme'] }}_{{ impl['name'] }}) {%- if 'alias_scheme' in scheme %} || defined(OQS_ENABLE_KEM_{{ family }}_{{ scheme['alias_scheme'] }}_{{ impl['name'] }}){%- endif %}
{%- if impl['signature_keypair'] %}
extern int {{ impl['signature_keypair'] }}(uint8_t *pk, uint8_t *sk);
{%- if impl['name'] == 'cuda'%}
#endif /* OQS_USE_CUPQC */
{%- endif %}
+ {%- if impl['name'] == 'icicle_cuda'%}
+#endif /* OQS_USE_ICICLE */
+ {%- endif %}
{%- endfor %}
{%- if libjade_implementation is defined and scheme['libjade_implementation'] %}
return (OQS_STATUS) {{ impl['signature_keypair'] }}(public_key, secret_key);
#endif /* OQS_USE_CUPQC && OQS_ENABLE_KEM_{{ family }}_{{ scheme['scheme'] }}_{{ impl['name'] }} */
{%- endfor %}
- {%- for impl in scheme['metadata']['implementations'] if (impl['name'] != scheme['default_implementation'] and impl['name'] != 'cuda') %}
+ {%- for impl in scheme['metadata']['implementations'] if impl['name'] == 'icicle_cuda' %}
+#if defined(OQS_USE_ICICLE) && defined(OQS_ENABLE_KEM_{{ family }}_{{ scheme['scheme'] }}_{{ impl['name'] }})
+ return (OQS_STATUS) {{ impl['signature_keypair'] }}(public_key, secret_key);
+#endif /* OQS_USE_ICICLE && OQS_ENABLE_KEM_{{ family }}_{{ scheme['scheme'] }}_{{ impl['name'] }} */
+ {%- endfor %}
+ {%- for impl in scheme['metadata']['implementations'] if (impl['name'] != scheme['default_implementation'] and impl['name'] != 'cuda' and impl['name'] != 'icicle_cuda') %}
{%- if loop.first %}
#if defined(OQS_ENABLE_KEM_{{ family }}_{{ scheme['scheme'] }}_{{ impl['name'] }}) {%- if 'alias_scheme' in scheme %} || defined(OQS_ENABLE_KEM_{{ family }}_{{ scheme['alias_scheme'] }}_{{ impl['name'] }}){%- endif %}
{%- else %}
return (OQS_STATUS) {{ impl['signature_enc'] }}(ciphertext, shared_secret, public_key);
#endif /* OQS_USE_CUPQC && OQS_ENABLE_KEM_{{ family }}_{{ scheme['scheme'] }}_{{ impl['name'] }} */
{%- endfor %}
- {%- for impl in scheme['metadata']['implementations'] if (impl['name'] != scheme['default_implementation'] and impl['name'] != 'cuda') %}
+ {%- for impl in scheme['metadata']['implementations'] if impl['name'] == 'icicle_cuda' %}
+#if defined(OQS_USE_ICICLE) && defined(OQS_ENABLE_KEM_{{ family }}_{{ scheme['scheme'] }}_{{ impl['name'] }})
+ return (OQS_STATUS) {{ impl['signature_enc'] }}(ciphertext, shared_secret, public_key);
+#endif /* OQS_USE_ICICLE && OQS_ENABLE_KEM_{{ family }}_{{ scheme['scheme'] }}_{{ impl['name'] }} */
+ {%- endfor %}
+ {%- for impl in scheme['metadata']['implementations'] if (impl['name'] != scheme['default_implementation'] and impl['name'] != 'cuda' and impl['name'] != 'icicle_cuda') %}
{%- if loop.first %}
#if defined(OQS_ENABLE_KEM_{{ family }}_{{ scheme['scheme'] }}_{{ impl['name'] }}) {%- if 'alias_scheme' in scheme %} || defined(OQS_ENABLE_KEM_{{ family }}_{{ scheme['alias_scheme'] }}_{{ impl['name'] }}){%- endif %}
{%- else %}
return (OQS_STATUS) {{ impl['signature_dec'] }}(shared_secret, ciphertext, secret_key);
#endif /* OQS_USE_CUPQC && OQS_ENABLE_KEM_{{ family }}_{{ scheme['scheme'] }}_{{ impl['name'] }} */
{%- endfor %}
- {%- for impl in scheme['metadata']['implementations'] if (impl['name'] != scheme['default_implementation'] and impl['name'] != 'cuda') %}
+ {%- for impl in scheme['metadata']['implementations'] if impl['name'] == 'icicle_cuda' %}
+#if defined(OQS_USE_ICICLE) && defined(OQS_ENABLE_KEM_{{ family }}_{{ scheme['scheme'] }}_{{ impl['name'] }})
+ return (OQS_STATUS) {{ impl['signature_dec'] }}(shared_secret, ciphertext, secret_key);
+#endif /* OQS_USE_ICICLE && OQS_ENABLE_KEM_{{ family }}_{{ scheme['scheme'] }}_{{ impl['name'] }} */
+ {%- endfor %}
+ {%- for impl in scheme['metadata']['implementations'] if (impl['name'] != scheme['default_implementation'] and impl['name'] != 'cuda' and impl['name'] != 'icicle_cuda') %}
{%- if loop.first %}
#if defined(OQS_ENABLE_KEM_{{ family }}_{{ scheme['scheme'] }}_{{ impl['name'] }}) {%- if 'alias_scheme' in scheme %} || defined(OQS_ENABLE_KEM_{{ family }}_{{ scheme['alias_scheme'] }}_{{ impl['name'] }}){%- endif %}
{%- else %}
target_link_libraries(oqs PRIVATE cupqc)
target_link_options(oqs PRIVATE $<DEVICE_LINK: -dlto>)
endif()
+if(${OQS_USE_ICICLE})
+ target_link_libraries(oqs PRIVATE icicle::icicle_pqc_package)
+endif()
target_include_directories(oqs
PUBLIC
set(_ML_KEM_OBJS ${_ML_KEM_OBJS} $<TARGET_OBJECTS:ml_kem_512_cuda>)
endif()
+if(OQS_ENABLE_KEM_ml_kem_512_icicle_cuda)
+ add_library(ml_kem_512_icicle_cuda OBJECT icicle_ml-kem-512_icicle_cuda/icicle_ml-kem.cpp)
+ target_link_libraries(ml_kem_512_icicle_cuda PRIVATE icicle::icicle_pqc_package)
+ set(_ML_KEM_OBJS ${_ML_KEM_OBJS} $<TARGET_OBJECTS:ml_kem_512_icicle_cuda>)
+endif()
+
if(OQS_ENABLE_KEM_ml_kem_768)
add_library(ml_kem_768_ref OBJECT kem_ml_kem_768.c mlkem-native_ml-kem-768_ref/mlkem/src/compress.c mlkem-native_ml-kem-768_ref/mlkem/src/debug.c mlkem-native_ml-kem-768_ref/mlkem/src/indcpa.c mlkem-native_ml-kem-768_ref/mlkem/src/kem.c mlkem-native_ml-kem-768_ref/mlkem/src/poly.c mlkem-native_ml-kem-768_ref/mlkem/src/poly_k.c mlkem-native_ml-kem-768_ref/mlkem/src/sampling.c mlkem-native_ml-kem-768_ref/mlkem/src/verify.c)
target_compile_options(ml_kem_768_ref PUBLIC -DMLK_CONFIG_PARAMETER_SET=768 -DMLK_CONFIG_FILE="../../integration/liboqs/config_c.h")
set(_ML_KEM_OBJS ${_ML_KEM_OBJS} $<TARGET_OBJECTS:ml_kem_768_cuda>)
endif()
+if(OQS_ENABLE_KEM_ml_kem_768_icicle_cuda)
+ add_library(ml_kem_768_icicle_cuda OBJECT icicle_ml-kem-768_icicle_cuda/icicle_ml-kem.cpp)
+ target_link_libraries(ml_kem_768_icicle_cuda PRIVATE icicle::icicle_pqc_package)
+ set(_ML_KEM_OBJS ${_ML_KEM_OBJS} $<TARGET_OBJECTS:ml_kem_768_icicle_cuda>)
+endif()
+
if(OQS_ENABLE_KEM_ml_kem_1024)
add_library(ml_kem_1024_ref OBJECT kem_ml_kem_1024.c mlkem-native_ml-kem-1024_ref/mlkem/src/compress.c mlkem-native_ml-kem-1024_ref/mlkem/src/debug.c mlkem-native_ml-kem-1024_ref/mlkem/src/indcpa.c mlkem-native_ml-kem-1024_ref/mlkem/src/kem.c mlkem-native_ml-kem-1024_ref/mlkem/src/poly.c mlkem-native_ml-kem-1024_ref/mlkem/src/poly_k.c mlkem-native_ml-kem-1024_ref/mlkem/src/sampling.c mlkem-native_ml-kem-1024_ref/mlkem/src/verify.c)
target_compile_options(ml_kem_1024_ref PUBLIC -DMLK_CONFIG_PARAMETER_SET=1024 -DMLK_CONFIG_FILE="../../integration/liboqs/config_c.h")
set(_ML_KEM_OBJS ${_ML_KEM_OBJS} $<TARGET_OBJECTS:ml_kem_1024_cuda>)
endif()
+if(OQS_ENABLE_KEM_ml_kem_1024_icicle_cuda)
+ add_library(ml_kem_1024_icicle_cuda OBJECT icicle_ml-kem-1024_icicle_cuda/icicle_ml-kem.cpp)
+ target_link_libraries(ml_kem_1024_icicle_cuda PRIVATE icicle::icicle_pqc_package)
+ set(_ML_KEM_OBJS ${_ML_KEM_OBJS} $<TARGET_OBJECTS:ml_kem_1024_icicle_cuda>)
+endif()
+
set(ML_KEM_OBJS ${_ML_KEM_OBJS} PARENT_SCOPE)
--- /dev/null
+// SPDX-License-Identifier: MIT
+
+#include <stdint.h>
+#include <oqs/rand.h>
+#include "icicle/pqc/ml_kem.h"
+#include "icicle/runtime.h"
+#include "icicle/device.h"
+#include "icicle/errors.h"
+
+extern "C" {
+#if defined(OQS_ENABLE_KEM_ml_kem_1024_icicle_cuda)
+OQS_STATUS icicle_ml_kem_1024_keypair(uint8_t *pk, uint8_t *sk) {
+ uint8_t coins[icicle::pqc::ml_kem::ENTROPY_BYTES];
+ OQS_randombytes(coins, icicle::pqc::ml_kem::ENTROPY_BYTES);
+
+ icicle::pqc::ml_kem::MlKemConfig config;
+ return icicle::pqc::ml_kem::keygen<icicle::pqc::ml_kem::Kyber1024Params>((std::byte*)coins, config, (std::byte*)pk, (std::byte*)sk) == icicle::eIcicleError::SUCCESS ? OQS_SUCCESS : OQS_ERROR;
+}
+
+OQS_STATUS icicle_ml_kem_1024_enc(uint8_t *ct, uint8_t *ss, const uint8_t *pk) {
+ uint8_t coins[icicle::pqc::ml_kem::MESSAGE_BYTES];
+ OQS_randombytes(coins, icicle::pqc::ml_kem::MESSAGE_BYTES);
+
+ icicle::pqc::ml_kem::MlKemConfig config;
+ return icicle::pqc::ml_kem::encapsulate<icicle::pqc::ml_kem::Kyber1024Params>((std::byte*)coins, (std::byte*)pk, config, (std::byte*)ct, (std::byte*)ss) == icicle::eIcicleError::SUCCESS ? OQS_SUCCESS : OQS_ERROR;
+}
+
+OQS_STATUS icicle_ml_kem_1024_dec(uint8_t *ss, const uint8_t *ct, const uint8_t *sk) {
+ icicle::pqc::ml_kem::MlKemConfig config;
+ return icicle::pqc::ml_kem::decapsulate<icicle::pqc::ml_kem::Kyber1024Params>((std::byte*)sk, (std::byte*)ct, config, (std::byte*)ss) == icicle::eIcicleError::SUCCESS ? OQS_SUCCESS : OQS_ERROR;
+}
+#endif
+}
--- /dev/null
+// SPDX-License-Identifier: MIT
+
+#include <stdint.h>
+#include <oqs/rand.h>
+#include "icicle/pqc/ml_kem.h"
+#include "icicle/runtime.h"
+#include "icicle/device.h"
+#include "icicle/errors.h"
+
+extern "C" {
+#if defined(OQS_ENABLE_KEM_ml_kem_512_icicle_cuda)
+OQS_STATUS icicle_ml_kem_512_keypair(uint8_t *pk, uint8_t *sk) {
+ uint8_t coins[icicle::pqc::ml_kem::ENTROPY_BYTES];
+ OQS_randombytes(coins, icicle::pqc::ml_kem::ENTROPY_BYTES);
+
+ icicle::pqc::ml_kem::MlKemConfig config;
+ return icicle::pqc::ml_kem::keygen<icicle::pqc::ml_kem::Kyber512Params>((std::byte*)coins, config, (std::byte*)pk, (std::byte*)sk) == icicle::eIcicleError::SUCCESS ? OQS_SUCCESS : OQS_ERROR;
+}
+
+OQS_STATUS icicle_ml_kem_512_enc(uint8_t *ct, uint8_t *ss, const uint8_t *pk) {
+ uint8_t coins[icicle::pqc::ml_kem::MESSAGE_BYTES];
+ OQS_randombytes(coins, icicle::pqc::ml_kem::MESSAGE_BYTES);
+
+ icicle::pqc::ml_kem::MlKemConfig config;
+ return icicle::pqc::ml_kem::encapsulate<icicle::pqc::ml_kem::Kyber512Params>((std::byte*)coins, (std::byte*)pk, config, (std::byte*)ct, (std::byte*)ss) == icicle::eIcicleError::SUCCESS ? OQS_SUCCESS : OQS_ERROR;
+}
+
+OQS_STATUS icicle_ml_kem_512_dec(uint8_t *ss, const uint8_t *ct, const uint8_t *sk) {
+ icicle::pqc::ml_kem::MlKemConfig config;
+ return icicle::pqc::ml_kem::decapsulate<icicle::pqc::ml_kem::Kyber512Params>((std::byte*)sk, (std::byte*)ct, config, (std::byte*)ss) == icicle::eIcicleError::SUCCESS ? OQS_SUCCESS : OQS_ERROR;
+}
+#endif
+}
--- /dev/null
+// SPDX-License-Identifier: MIT
+
+#include <stdint.h>
+#include <oqs/rand.h>
+#include "icicle/pqc/ml_kem.h"
+#include "icicle/runtime.h"
+#include "icicle/device.h"
+#include "icicle/errors.h"
+
+extern "C" {
+#if defined(OQS_ENABLE_KEM_ml_kem_1024_icicle_cuda)
+OQS_STATUS icicle_ml_kem_1024_keypair(uint8_t *pk, uint8_t *sk) {
+ uint8_t coins[icicle::pqc::ml_kem::ENTROPY_BYTES];
+ OQS_randombytes(coins, icicle::pqc::ml_kem::ENTROPY_BYTES);
+
+ icicle::pqc::ml_kem::MlKemConfig config;
+ return icicle::pqc::ml_kem::keygen<icicle::pqc::ml_kem::Kyber1024Params>((std::byte*)coins, config, (std::byte*)pk, (std::byte*)sk) == icicle::eIcicleError::SUCCESS ? OQS_SUCCESS : OQS_ERROR;
+}
+
+OQS_STATUS icicle_ml_kem_1024_enc(uint8_t *ct, uint8_t *ss, const uint8_t *pk) {
+ uint8_t coins[icicle::pqc::ml_kem::MESSAGE_BYTES];
+ OQS_randombytes(coins, icicle::pqc::ml_kem::MESSAGE_BYTES);
+
+ icicle::pqc::ml_kem::MlKemConfig config;
+ return icicle::pqc::ml_kem::encapsulate<icicle::pqc::ml_kem::Kyber1024Params>((std::byte*)coins, (std::byte*)pk, config, (std::byte*)ct, (std::byte*)ss) == icicle::eIcicleError::SUCCESS ? OQS_SUCCESS : OQS_ERROR;
+}
+
+OQS_STATUS icicle_ml_kem_1024_dec(uint8_t *ss, const uint8_t *ct, const uint8_t *sk) {
+ icicle::pqc::ml_kem::MlKemConfig config;
+ return icicle::pqc::ml_kem::decapsulate<icicle::pqc::ml_kem::Kyber1024Params>((std::byte*)sk, (std::byte*)ct, config, (std::byte*)ss) == icicle::eIcicleError::SUCCESS ? OQS_SUCCESS : OQS_ERROR;
+}
+#endif
+}
#endif
#endif /* OQS_USE_CUPQC */
+#if defined(OQS_USE_ICICLE)
+#if defined(OQS_ENABLE_KEM_ml_kem_1024_icicle_cuda)
+extern int icicle_ml_kem_1024_keypair(uint8_t *pk, uint8_t *sk);
+extern int icicle_ml_kem_1024_enc(uint8_t *ct, uint8_t *ss, const uint8_t *pk);
+extern int icicle_ml_kem_1024_dec(uint8_t *ss, const uint8_t *ct, const uint8_t *sk);
+#endif
+#endif /* OQS_USE_ICICLE */
+
OQS_API OQS_STATUS OQS_KEM_ml_kem_1024_keypair_derand(uint8_t *public_key, uint8_t *secret_key, const uint8_t *seed) {
#if defined(OQS_ENABLE_KEM_ml_kem_1024_x86_64)
#if defined(OQS_DIST_BUILD)
#endif /* OQS_DIST_BUILD */
#elif defined(OQS_ENABLE_KEM_ml_kem_1024_cuda)
return (OQS_STATUS) PQCLEAN_MLKEM1024_CUDA_crypto_kem_keypair_derand(public_key, secret_key, seed);
+#elif defined(OQS_ENABLE_KEM_ml_kem_1024_icicle_cuda)
+ return (OQS_STATUS) PQCLEAN_MLKEM1024_ICICLE_CUDA_crypto_kem_keypair_derand(public_key, secret_key, seed);
#else
return (OQS_STATUS) PQCP_MLKEM_NATIVE_MLKEM1024_C_keypair_derand(public_key, secret_key, seed);
#endif
#if defined(OQS_USE_CUPQC) && defined(OQS_ENABLE_KEM_ml_kem_1024_cuda)
return (OQS_STATUS) cupqc_ml_kem_1024_keypair(public_key, secret_key);
#endif /* OQS_USE_CUPQC && OQS_ENABLE_KEM_ml_kem_1024_cuda */
+#if defined(OQS_USE_ICICLE) && defined(OQS_ENABLE_KEM_ml_kem_1024_icicle_cuda)
+ return (OQS_STATUS) icicle_ml_kem_1024_keypair(public_key, secret_key);
+#endif /* OQS_USE_ICICLE && OQS_ENABLE_KEM_ml_kem_1024_icicle_cuda */
#if defined(OQS_ENABLE_KEM_ml_kem_1024_x86_64)
#if defined(OQS_DIST_BUILD)
if (OQS_CPU_has_extension(OQS_CPU_EXT_AVX2) && OQS_CPU_has_extension(OQS_CPU_EXT_BMI2) && OQS_CPU_has_extension(OQS_CPU_EXT_POPCNT)) {
#if defined(OQS_USE_CUPQC) && defined(OQS_ENABLE_KEM_ml_kem_1024_cuda)
return (OQS_STATUS) cupqc_ml_kem_1024_enc(ciphertext, shared_secret, public_key);
#endif /* OQS_USE_CUPQC && OQS_ENABLE_KEM_ml_kem_1024_cuda */
+#if defined(OQS_USE_ICICLE) && defined(OQS_ENABLE_KEM_ml_kem_1024_icicle_cuda)
+ return (OQS_STATUS) icicle_ml_kem_1024_enc(ciphertext, shared_secret, public_key);
+#endif /* OQS_USE_ICICLE && OQS_ENABLE_KEM_ml_kem_1024_icicle_cuda */
#if defined(OQS_ENABLE_KEM_ml_kem_1024_x86_64)
#if defined(OQS_DIST_BUILD)
if (OQS_CPU_has_extension(OQS_CPU_EXT_AVX2) && OQS_CPU_has_extension(OQS_CPU_EXT_BMI2) && OQS_CPU_has_extension(OQS_CPU_EXT_POPCNT)) {
#if defined(OQS_USE_CUPQC) && defined(OQS_ENABLE_KEM_ml_kem_1024_cuda)
return (OQS_STATUS) cupqc_ml_kem_1024_dec(shared_secret, ciphertext, secret_key);
#endif /* OQS_USE_CUPQC && OQS_ENABLE_KEM_ml_kem_1024_cuda */
+#if defined(OQS_USE_ICICLE) && defined(OQS_ENABLE_KEM_ml_kem_1024_icicle_cuda)
+ return (OQS_STATUS) icicle_ml_kem_1024_dec(shared_secret, ciphertext, secret_key);
+#endif /* OQS_USE_ICICLE && OQS_ENABLE_KEM_ml_kem_1024_icicle_cuda */
#if defined(OQS_ENABLE_KEM_ml_kem_1024_x86_64)
#if defined(OQS_DIST_BUILD)
if (OQS_CPU_has_extension(OQS_CPU_EXT_AVX2) && OQS_CPU_has_extension(OQS_CPU_EXT_BMI2) && OQS_CPU_has_extension(OQS_CPU_EXT_POPCNT)) {
#endif
#endif /* OQS_USE_CUPQC */
+#if defined(OQS_USE_ICICLE)
+#if defined(OQS_ENABLE_KEM_ml_kem_512_icicle_cuda)
+extern int icicle_ml_kem_512_keypair(uint8_t *pk, uint8_t *sk);
+extern int icicle_ml_kem_512_enc(uint8_t *ct, uint8_t *ss, const uint8_t *pk);
+extern int icicle_ml_kem_512_dec(uint8_t *ss, const uint8_t *ct, const uint8_t *sk);
+#endif
+#endif /* OQS_USE_ICICLE */
+
OQS_API OQS_STATUS OQS_KEM_ml_kem_512_keypair_derand(uint8_t *public_key, uint8_t *secret_key, const uint8_t *seed) {
#if defined(OQS_ENABLE_KEM_ml_kem_512_x86_64)
#if defined(OQS_DIST_BUILD)
#endif /* OQS_DIST_BUILD */
#elif defined(OQS_ENABLE_KEM_ml_kem_512_cuda)
return (OQS_STATUS) PQCLEAN_MLKEM512_CUDA_crypto_kem_keypair_derand(public_key, secret_key, seed);
+#elif defined(OQS_ENABLE_KEM_ml_kem_512_icicle_cuda)
+ return (OQS_STATUS) PQCLEAN_MLKEM512_ICICLE_CUDA_crypto_kem_keypair_derand(public_key, secret_key, seed);
#else
return (OQS_STATUS) PQCP_MLKEM_NATIVE_MLKEM512_C_keypair_derand(public_key, secret_key, seed);
#endif
#if defined(OQS_USE_CUPQC) && defined(OQS_ENABLE_KEM_ml_kem_512_cuda)
return (OQS_STATUS) cupqc_ml_kem_512_keypair(public_key, secret_key);
#endif /* OQS_USE_CUPQC && OQS_ENABLE_KEM_ml_kem_512_cuda */
+#if defined(OQS_USE_ICICLE) && defined(OQS_ENABLE_KEM_ml_kem_512_icicle_cuda)
+ return (OQS_STATUS) icicle_ml_kem_512_keypair(public_key, secret_key);
+#endif /* OQS_USE_ICICLE && OQS_ENABLE_KEM_ml_kem_512_icicle_cuda */
#if defined(OQS_ENABLE_KEM_ml_kem_512_x86_64)
#if defined(OQS_DIST_BUILD)
if (OQS_CPU_has_extension(OQS_CPU_EXT_AVX2) && OQS_CPU_has_extension(OQS_CPU_EXT_BMI2) && OQS_CPU_has_extension(OQS_CPU_EXT_POPCNT)) {
#if defined(OQS_USE_CUPQC) && defined(OQS_ENABLE_KEM_ml_kem_512_cuda)
return (OQS_STATUS) cupqc_ml_kem_512_enc(ciphertext, shared_secret, public_key);
#endif /* OQS_USE_CUPQC && OQS_ENABLE_KEM_ml_kem_512_cuda */
+#if defined(OQS_USE_ICICLE) && defined(OQS_ENABLE_KEM_ml_kem_512_icicle_cuda)
+ return (OQS_STATUS) icicle_ml_kem_512_enc(ciphertext, shared_secret, public_key);
+#endif /* OQS_USE_ICICLE && OQS_ENABLE_KEM_ml_kem_512_icicle_cuda */
#if defined(OQS_ENABLE_KEM_ml_kem_512_x86_64)
#if defined(OQS_DIST_BUILD)
if (OQS_CPU_has_extension(OQS_CPU_EXT_AVX2) && OQS_CPU_has_extension(OQS_CPU_EXT_BMI2) && OQS_CPU_has_extension(OQS_CPU_EXT_POPCNT)) {
#if defined(OQS_USE_CUPQC) && defined(OQS_ENABLE_KEM_ml_kem_512_cuda)
return (OQS_STATUS) cupqc_ml_kem_512_dec(shared_secret, ciphertext, secret_key);
#endif /* OQS_USE_CUPQC && OQS_ENABLE_KEM_ml_kem_512_cuda */
+#if defined(OQS_USE_ICICLE) && defined(OQS_ENABLE_KEM_ml_kem_512_icicle_cuda)
+ return (OQS_STATUS) icicle_ml_kem_512_dec(shared_secret, ciphertext, secret_key);
+#endif /* OQS_USE_ICICLE && OQS_ENABLE_KEM_ml_kem_512_icicle_cuda */
#if defined(OQS_ENABLE_KEM_ml_kem_512_x86_64)
#if defined(OQS_DIST_BUILD)
if (OQS_CPU_has_extension(OQS_CPU_EXT_AVX2) && OQS_CPU_has_extension(OQS_CPU_EXT_BMI2) && OQS_CPU_has_extension(OQS_CPU_EXT_POPCNT)) {
#endif
#endif /* OQS_USE_CUPQC */
+#if defined(OQS_USE_ICICLE)
+#if defined(OQS_ENABLE_KEM_ml_kem_768_icicle_cuda)
+extern int icicle_ml_kem_768_keypair(uint8_t *pk, uint8_t *sk);
+extern int icicle_ml_kem_768_enc(uint8_t *ct, uint8_t *ss, const uint8_t *pk);
+extern int icicle_ml_kem_768_dec(uint8_t *ss, const uint8_t *ct, const uint8_t *sk);
+#endif
+#endif /* OQS_USE_ICICLE */
+
OQS_API OQS_STATUS OQS_KEM_ml_kem_768_keypair_derand(uint8_t *public_key, uint8_t *secret_key, const uint8_t *seed) {
#if defined(OQS_ENABLE_KEM_ml_kem_768_x86_64)
#if defined(OQS_DIST_BUILD)
#endif /* OQS_DIST_BUILD */
#elif defined(OQS_ENABLE_KEM_ml_kem_768_cuda)
return (OQS_STATUS) PQCLEAN_MLKEM768_CUDA_crypto_kem_keypair_derand(public_key, secret_key, seed);
+#elif defined(OQS_ENABLE_KEM_ml_kem_768_icicle_cuda)
+ return (OQS_STATUS) PQCLEAN_MLKEM768_ICICLE_CUDA_crypto_kem_keypair_derand(public_key, secret_key, seed);
#else
return (OQS_STATUS) PQCP_MLKEM_NATIVE_MLKEM768_C_keypair_derand(public_key, secret_key, seed);
#endif
#if defined(OQS_USE_CUPQC) && defined(OQS_ENABLE_KEM_ml_kem_768_cuda)
return (OQS_STATUS) cupqc_ml_kem_768_keypair(public_key, secret_key);
#endif /* OQS_USE_CUPQC && OQS_ENABLE_KEM_ml_kem_768_cuda */
+#if defined(OQS_USE_ICICLE) && defined(OQS_ENABLE_KEM_ml_kem_768_icicle_cuda)
+ return (OQS_STATUS) icicle_ml_kem_768_keypair(public_key, secret_key);
+#endif /* OQS_USE_ICICLE && OQS_ENABLE_KEM_ml_kem_768_icicle_cuda */
#if defined(OQS_ENABLE_KEM_ml_kem_768_x86_64)
#if defined(OQS_DIST_BUILD)
if (OQS_CPU_has_extension(OQS_CPU_EXT_AVX2) && OQS_CPU_has_extension(OQS_CPU_EXT_BMI2) && OQS_CPU_has_extension(OQS_CPU_EXT_POPCNT)) {
#if defined(OQS_USE_CUPQC) && defined(OQS_ENABLE_KEM_ml_kem_768_cuda)
return (OQS_STATUS) cupqc_ml_kem_768_enc(ciphertext, shared_secret, public_key);
#endif /* OQS_USE_CUPQC && OQS_ENABLE_KEM_ml_kem_768_cuda */
+#if defined(OQS_USE_ICICLE) && defined(OQS_ENABLE_KEM_ml_kem_768_icicle_cuda)
+ return (OQS_STATUS) icicle_ml_kem_768_enc(ciphertext, shared_secret, public_key);
+#endif /* OQS_USE_ICICLE && OQS_ENABLE_KEM_ml_kem_768_icicle_cuda */
#if defined(OQS_ENABLE_KEM_ml_kem_768_x86_64)
#if defined(OQS_DIST_BUILD)
if (OQS_CPU_has_extension(OQS_CPU_EXT_AVX2) && OQS_CPU_has_extension(OQS_CPU_EXT_BMI2) && OQS_CPU_has_extension(OQS_CPU_EXT_POPCNT)) {
#if defined(OQS_USE_CUPQC) && defined(OQS_ENABLE_KEM_ml_kem_768_cuda)
return (OQS_STATUS) cupqc_ml_kem_768_dec(shared_secret, ciphertext, secret_key);
#endif /* OQS_USE_CUPQC && OQS_ENABLE_KEM_ml_kem_768_cuda */
+#if defined(OQS_USE_ICICLE) && defined(OQS_ENABLE_KEM_ml_kem_768_icicle_cuda)
+ return (OQS_STATUS) icicle_ml_kem_768_dec(shared_secret, ciphertext, secret_key);
+#endif /* OQS_USE_ICICLE && OQS_ENABLE_KEM_ml_kem_768_icicle_cuda */
#if defined(OQS_ENABLE_KEM_ml_kem_768_x86_64)
#if defined(OQS_DIST_BUILD)
if (OQS_CPU_has_extension(OQS_CPU_EXT_AVX2) && OQS_CPU_has_extension(OQS_CPU_EXT_BMI2) && OQS_CPU_has_extension(OQS_CPU_EXT_POPCNT)) {
#cmakedefine OQS_USE_SHA3_AVX512VL 1
#cmakedefine01 OQS_USE_CUPQC
+#cmakedefine01 OQS_USE_ICICLE
#cmakedefine OQS_ENABLE_KEM_BIKE 1
#cmakedefine OQS_ENABLE_KEM_bike_l1 1
#cmakedefine OQS_ENABLE_KEM_ml_kem_512_x86_64 1
#cmakedefine OQS_ENABLE_KEM_ml_kem_512_aarch64 1
#cmakedefine OQS_ENABLE_KEM_ml_kem_512_cuda 1
+#cmakedefine OQS_ENABLE_KEM_ml_kem_512_icicle_cuda 1
#cmakedefine OQS_ENABLE_KEM_ml_kem_768 1
#cmakedefine OQS_ENABLE_KEM_ml_kem_768_x86_64 1
#cmakedefine OQS_ENABLE_KEM_ml_kem_768_aarch64 1
#cmakedefine OQS_ENABLE_KEM_ml_kem_768_cuda 1
+#cmakedefine OQS_ENABLE_KEM_ml_kem_768_icicle_cuda 1
#cmakedefine OQS_ENABLE_KEM_ml_kem_1024 1
#cmakedefine OQS_ENABLE_KEM_ml_kem_1024_x86_64 1
#cmakedefine OQS_ENABLE_KEM_ml_kem_1024_aarch64 1
#cmakedefine OQS_ENABLE_KEM_ml_kem_1024_cuda 1
+#cmakedefine OQS_ENABLE_KEM_ml_kem_1024_icicle_cuda 1
#cmakedefine OQS_ENABLE_SIG_DILITHIUM 1
#cmakedefine OQS_ENABLE_SIG_dilithium_2 1