nrfxlib API 3.3.99
Loading...
Searching...
No Matches
ocrypto_ml_kem768.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2016 - 2025 Nordic Semiconductor ASA
3 * Copyright (c) since 2013 Oberon microsystems AG
4 *
5 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
6 */
7
8
27#ifndef OCRYPTO_ML_KEM768_H
28#define OCRYPTO_ML_KEM768_H
29
30#include <stddef.h>
31#include <stdint.h>
32
33#include "ocrypto_sha3.h"
34
35
36#ifdef __cplusplus
37extern "C" {
38#endif
39
43#define ocrypto_ml_kem768_SK_SIZE ((3 * 384) + (3 * 384 + 32) + 64)
44
48#define ocrypto_ml_kem768_PK_SIZE (3 * 384 + 32)
49
53#define ocrypto_ml_kem768_CT_SIZE ((3 * 10 + 4) * 32)
54
55
57typedef struct {
58 ocrypto_sha3_ctx sha3;
59 int16_t u[3][256];
60 int16_t t[256];
61 uint8_t kr[64];
62} ocrypto_ml_kem768_ctx;
76 ocrypto_ml_kem768_ctx *ctx,
77 uint8_t sk[ocrypto_ml_kem768_SK_SIZE],
78 uint8_t pk[ocrypto_ml_kem768_PK_SIZE],
79 const uint8_t d[32],
80 const uint8_t z[32]);
81
89 const uint8_t pk[ocrypto_ml_kem768_PK_SIZE]);
90
101 ocrypto_ml_kem768_ctx *ctx,
102 uint8_t key[32],
103 uint8_t ct[ocrypto_ml_kem768_CT_SIZE],
104 const uint8_t pk[ocrypto_ml_kem768_PK_SIZE],
105 const uint8_t m[32]);
106
116 ocrypto_ml_kem768_ctx *ctx,
117 uint8_t key[32],
118 const uint8_t sk[ocrypto_ml_kem768_SK_SIZE],
119 const uint8_t ct[ocrypto_ml_kem768_CT_SIZE]);
120
121
122#ifdef __cplusplus
123}
124#endif
125
126#endif
127
#define ocrypto_ml_kem768_CT_SIZE
Definition ocrypto_ml_kem768.h:53
int ocrypto_ml_kem768_check_key(const uint8_t pk[(3 *384+32)])
void ocrypto_ml_kem768_key_pair(ocrypto_ml_kem768_ctx *ctx, uint8_t sk[((3 *384)+(3 *384+32)+64)], uint8_t pk[(3 *384+32)], const uint8_t d[32], const uint8_t z[32])
#define ocrypto_ml_kem768_PK_SIZE
Definition ocrypto_ml_kem768.h:48
void ocrypto_ml_kem768_decaps(ocrypto_ml_kem768_ctx *ctx, uint8_t key[32], const uint8_t sk[((3 *384)+(3 *384+32)+64)], const uint8_t ct[((3 *10+4) *32)])
void ocrypto_ml_kem768_encaps(ocrypto_ml_kem768_ctx *ctx, uint8_t key[32], uint8_t ct[((3 *10+4) *32)], const uint8_t pk[(3 *384+32)], const uint8_t m[32])
#define ocrypto_ml_kem768_SK_SIZE
Definition ocrypto_ml_kem768.h:43
SHA3 algorithms, with 224, 256, 384 and 512 bit outputs.