Coverage Report

Created: 2026-08-12 06:14

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