Coverage Report

Created: 2025-06-22 06:56

/src/openssl/crypto/ml_dsa/ml_dsa_matrix.c
Line
Count
Source (jump to first uncovered line)
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
#include "ml_dsa_local.h"
11
#include "ml_dsa_vector.h"
12
#include "ml_dsa_matrix.h"
13
14
/*
15
 * Matrix multiply of a k*l matrix of polynomials by a 1 * l vector of
16
 * polynomials to produce a 1 * k vector of polynomial results.
17
 * i.e. t = a * s
18
 *
19
 * @param a A k * l matrix of polynomials in NTT form
20
 * @param s A 1 * l vector of polynomials in NTT form
21
 * @param t 1 * k vector of polynomial results in NTT form
22
 */
23
void ossl_ml_dsa_matrix_mult_vector(const MATRIX *a, const VECTOR *s,
24
                                    VECTOR *t)
25
0
{
26
0
    size_t i, j;
27
0
    POLY *poly = a->m_poly;
28
29
0
    vector_zero(t);
30
31
0
    for (i = 0; i < a->k; i++) {
32
0
        for (j = 0; j < a->l; j++) {
33
0
            POLY product;
34
35
0
            ossl_ml_dsa_poly_ntt_mult(poly++, &s->poly[j], &product);
36
0
            poly_add(&product, &t->poly[i], &t->poly[i]);
37
0
        }
38
0
    }
39
0
}