mlkem768.c File Reference

ML-KEM-768 key encapsulation mechanism. More...

#include "core/crypto.h"
#include "pqc/mlkem768.h"
#include <oqs/oqs.h>

Go to the source code of this file.

Macros

#define TRACE_LEVEL   CRYPTO_TRACE_LEVEL
 

Functions

error_t mlkem768GenerateKeyPair (const PrngAlgo *prngAlgo, void *prngContext, uint8_t *pk, uint8_t *sk)
 Key pair generation. More...
 
error_t mlkem768Encapsulate (const PrngAlgo *prngAlgo, void *prngContext, uint8_t *ct, uint8_t *ss, const uint8_t *pk)
 Encapsulation algorithm. More...
 
error_t mlkem768Decapsulate (uint8_t *ss, const uint8_t *ct, const uint8_t *sk)
 Decapsulation algorithm. More...
 

Variables

const KemAlgo mlkem768KemAlgo
 

Detailed Description

ML-KEM-768 key encapsulation mechanism.

License

SPDX-License-Identifier: GPL-2.0-or-later

Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.

This file is part of CycloneCRYPTO Open.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Author
Oryx Embedded SARL (www.oryx-embedded.com)
Version
2.4.4

Definition in file mlkem768.c.

Macro Definition Documentation

◆ TRACE_LEVEL

#define TRACE_LEVEL   CRYPTO_TRACE_LEVEL

Definition at line 32 of file mlkem768.c.

Function Documentation

◆ mlkem768Decapsulate()

error_t mlkem768Decapsulate ( uint8_t *  ss,
const uint8_t *  ct,
const uint8_t *  sk 
)

Decapsulation algorithm.

Parameters
[out]ssShared secret
[in]ctCiphertext
[in]skSecret key
Returns
Error code

Definition at line 111 of file mlkem768.c.

◆ mlkem768Encapsulate()

error_t mlkem768Encapsulate ( const PrngAlgo prngAlgo,
void *  prngContext,
uint8_t *  ct,
uint8_t *  ss,
const uint8_t *  pk 
)

Encapsulation algorithm.

Parameters
[in]prngAlgoPRNG algorithm
[in]prngContextPointer to the PRNG context
[out]ctCiphertext
[out]ssShared secret
[in]pkPublic key
Returns
Error code

Definition at line 90 of file mlkem768.c.

◆ mlkem768GenerateKeyPair()

error_t mlkem768GenerateKeyPair ( const PrngAlgo prngAlgo,
void *  prngContext,
uint8_t *  pk,
uint8_t *  sk 
)

Key pair generation.

Parameters
[in]prngAlgoPRNG algorithm
[in]prngContextPointer to the PRNG context
[out]pkPublic key
[out]skSecret key
Returns
Error code

Definition at line 67 of file mlkem768.c.

Variable Documentation

◆ mlkem768KemAlgo

error_t mlkem768Decapsulate(uint8_t *ss, const uint8_t *ct, const uint8_t *sk)
Decapsulation algorithm.
Definition: mlkem768.c:111
#define MLKEM768_CIPHERTEXT_LEN
Definition: mlkem768.h:42
error_t mlkem768Encapsulate(const PrngAlgo *prngAlgo, void *prngContext, uint8_t *ct, uint8_t *ss, const uint8_t *pk)
Encapsulation algorithm.
Definition: mlkem768.c:90
#define MLKEM768_PUBLIC_KEY_LEN
Definition: mlkem768.h:38
error_t(* KemAlgoGenerateKeyPair)(const PrngAlgo *prngAlgo, void *prngContext, uint8_t *pk, uint8_t *sk)
Definition: crypto.h:1018
#define MLKEM768_SECRET_KEY_LEN
Definition: mlkem768.h:40
error_t mlkem768GenerateKeyPair(const PrngAlgo *prngAlgo, void *prngContext, uint8_t *pk, uint8_t *sk)
Key pair generation.
Definition: mlkem768.c:67
error_t(* KemAlgoDecapsulate)(uint8_t *ss, const uint8_t *ct, const uint8_t *sk)
Definition: crypto.h:1024
error_t(* KemAlgoEncapsulate)(const PrngAlgo *prngAlgo, void *prngContext, uint8_t *ct, uint8_t *ss, const uint8_t *pk)
Definition: crypto.h:1021
#define MLKEM768_SHARED_SECRET_LEN
Definition: mlkem768.h:44