Embedded SDK
Embedded SDK
Loading...
Searching...
No Matches
cx_mldsa_util.h
Go to the documentation of this file.
1/*****************************************************************************
2 * (c) 2026 Ledger SAS.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *****************************************************************************/
16#ifndef CX_MLDSA_UTIL_H
17#define CX_MLDSA_UTIL_H
18
19#include <stdint.h>
20#include <stddef.h>
21#include "lcx_sha3.h"
22#include "cx_errors.h"
23
27void MLDSA_UTIL_shake256(uint8_t *out, size_t outlen, const uint8_t *in, size_t inlen);
28
32void MLDSA_UTIL_shake128(uint8_t *out, size_t outlen, const uint8_t *in, size_t inlen);
33
37cx_err_t MLDSA_UTIL_shake256_two(uint8_t *out,
38 size_t outlen,
39 const uint8_t *in1,
40 size_t in1len,
41 const uint8_t *in2,
42 size_t in2len);
43
47cx_err_t MLDSA_UTIL_shake256_three(uint8_t *out,
48 size_t outlen,
49 const uint8_t *in1,
50 size_t in1len,
51 const uint8_t *in2,
52 size_t in2len,
53 const uint8_t *in3,
54 size_t in3len);
55
59void MLDSA_UTIL_shake128_seed_nonce(uint8_t *out,
60 size_t outlen,
61 const uint8_t *seed,
62 size_t seedlen,
63 uint16_t nonce);
64
68void MLDSA_UTIL_shake256_seed_nonce(uint8_t *out,
69 size_t outlen,
70 const uint8_t *seed,
71 size_t seedlen,
72 uint16_t nonce);
73
74#endif /* CX_MLDSA_UTIL_H */
void MLDSA_UTIL_shake256(uint8_t *out, size_t outlen, const uint8_t *in, size_t inlen)
SHAKE256 hash wrapper.
cx_err_t MLDSA_UTIL_shake256_three(uint8_t *out, size_t outlen, const uint8_t *in1, size_t in1len, const uint8_t *in2, size_t in2len, const uint8_t *in3, size_t in3len)
SHAKE256 with three inputs concatenated.
void MLDSA_UTIL_shake128(uint8_t *out, size_t outlen, const uint8_t *in, size_t inlen)
SHAKE128 hash wrapper.
void MLDSA_UTIL_shake256_seed_nonce(uint8_t *out, size_t outlen, const uint8_t *seed, size_t seedlen, uint16_t nonce)
SHAKE256 with seed || uint16_t nonce.
void MLDSA_UTIL_shake128_seed_nonce(uint8_t *out, size_t outlen, const uint8_t *seed, size_t seedlen, uint16_t nonce)
SHAKE128 with seed || uint16_t nonce.
cx_err_t MLDSA_UTIL_shake256_two(uint8_t *out, size_t outlen, const uint8_t *in1, size_t in1len, const uint8_t *in2, size_t in2len)
SHAKE256 with two inputs concatenated.
SHA-3 (Secure Hash Algorithm 3)