/src/openssl/crypto/ml_dsa/ml_dsa_matrix.h
Line | Count | Source |
1 | | /* |
2 | | * Copyright 2024-2025 The OpenSSL Project Authors. All Rights Reserved. |
3 | | * |
4 | | * Licensed under the Apache License 2.0 (the "License"). You may not use |
5 | | * this file except in compliance with the License. You can obtain a copy |
6 | | * in the file LICENSE in the source distribution or at |
7 | | * https://www.openssl.org/source/license.html |
8 | | */ |
9 | | |
10 | | /* A 'k' by 'l' Matrix object ('k' rows and 'l' columns) containing polynomial scalars */ |
11 | | #if !defined(OSSL_LIBCRYPTO_ML_DSA_ML_DSA_MATRIX_H) |
12 | | #define OSSL_LIBCRYPTO_ML_DSA_ML_DSA_MATRIX_H |
13 | | |
14 | | #include "ml_dsa_local.h" |
15 | | |
16 | | struct matrix_st { |
17 | | POLY *m_poly; |
18 | | size_t k, l; |
19 | | }; |
20 | | |
21 | | /** |
22 | | * @brief Initialize a Matrix object. |
23 | | * |
24 | | * @param m The matrix object. |
25 | | * @param polys A preallocated array of k * l polynomial blocks. |m| does not |
26 | | * own/free this. |
27 | | * @param k The number of rows |
28 | | * @param l The number of columns |
29 | | */ |
30 | | static ossl_inline ossl_unused void |
31 | | matrix_init(MATRIX *m, POLY *polys, size_t k, size_t l) |
32 | 0 | { |
33 | 0 | m->k = k; |
34 | 0 | m->l = l; |
35 | 0 | m->m_poly = polys; |
36 | 0 | } Unexecuted instantiation: ml_dsa_key.c:matrix_init Unexecuted instantiation: ml_dsa_matrix.c:matrix_init Unexecuted instantiation: ml_dsa_sample.c:matrix_init Unexecuted instantiation: ml_dsa_sign.c:matrix_init |
37 | | |
38 | | static ossl_inline ossl_unused void |
39 | | matrix_mult_vector(const MATRIX *a, const VECTOR *s, VECTOR *t) |
40 | 0 | { |
41 | 0 | ossl_ml_dsa_matrix_mult_vector(a, s, t); |
42 | 0 | } Unexecuted instantiation: ml_dsa_key.c:matrix_mult_vector Unexecuted instantiation: ml_dsa_matrix.c:matrix_mult_vector Unexecuted instantiation: ml_dsa_sample.c:matrix_mult_vector Unexecuted instantiation: ml_dsa_sign.c:matrix_mult_vector |
43 | | |
44 | | static ossl_inline ossl_unused int |
45 | | matrix_expand_A(EVP_MD_CTX *g_ctx, const EVP_MD *md, const uint8_t *rho, |
46 | | MATRIX *out) |
47 | 0 | { |
48 | 0 | return ossl_ml_dsa_matrix_expand_A(g_ctx, md, rho, out); |
49 | 0 | } Unexecuted instantiation: ml_dsa_key.c:matrix_expand_A Unexecuted instantiation: ml_dsa_matrix.c:matrix_expand_A Unexecuted instantiation: ml_dsa_sample.c:matrix_expand_A Unexecuted instantiation: ml_dsa_sign.c:matrix_expand_A |
50 | | |
51 | | #endif /* !defined(OSSL_LIBCRYPTO_ML_DSA_ML_DSA_MATRIX_H) */ |