Files
wolfssl/tests/api/test_dsa.h
T
Daniele Lacamera 2e1d38d5a3 tests: MC/DC decision coverage for dh.c and dsa.c
Adds tests/api DecisionCoverage functions closing MC/DC gaps identified
by the per-module campaign (iso26262/mcdc-per-module):

dh.c:    BEFORE 51/173 (29.48%) -> AFTER 107/173 (61.85%), union across
         6 native variants (sp_default, sp_dh, sp_dh_nonblock,
         small_stack, no_dh186, validate_keygen). New coverage: wc_DhSetKey
         family bad-args and the FFDHE-table primality fast-path, named-key
         helpers (SetNamedKey/GetNamedKeyParamSize/CopyNamedKey/CmpNamedKey),
         wc_DhGenerateKeyPair/GeneratePublic bad-args plus a multi-group
         (2048/3072/4096) generate+agree(+ct) round trip, WC_DH_NONBLOCK's
         incremental state machine, wc_DhImportKeyPair/ExportKeyPair,
         wc_DhCheckPubKey(_ex)/wc_DhCheckPrivKey(_ex)/wc_DhCheckKeyPair
         (+ WOLFSSL_VALIDATE_DH_KEYGEN), wc_DhGenerateParams/
         wc_DhExportParamsRaw, and CheckDhLN's divLen==224/256 MC/DC pair.

dsa.c:   BEFORE 34/110 (30.91%) -> AFTER 51/110 (46.36%), union across
         4 native variants (default, invmod_ct, fastmath, small_stack).
         New coverage: wc_DsaSign_ex/wc_DsaVerify_ex digestSz bad-argument
         checks and the q==1 qMinus1-iszero guard, individual single-operand
         NULL-argument combinations for ImportParamsRaw/ExportParamsRaw/
         ExportKeyRaw, and CheckDsaLN's case-2048 divLen==224/256 MC/DC pair.

Both modules build and pass their tests/api group + KATs across every
native variant with zero failures (10/10 variant runs).
2026-07-13 11:19:23 +02:00

61 lines
2.5 KiB
C

/* test_dsa.h
*
* Copyright (C) 2006-2026 wolfSSL Inc.
*
* This file is part of wolfSSL.
*
* wolfSSL is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* wolfSSL is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
*/
#ifndef WOLFCRYPT_TEST_DSA_H
#define WOLFCRYPT_TEST_DSA_H
#include <tests/api/api_decl.h>
int test_wc_InitDsaKey(void);
int test_wc_DsaSignVerify(void);
int test_wc_DsaPublicPrivateKeyDecode(void);
int test_wc_MakeDsaKey(void);
int test_wc_DsaKeyToDer(void);
int test_wc_DsaKeyToPublicDer(void);
int test_wc_DsaImportParamsRaw(void);
int test_wc_DsaImportParamsRawCheck(void);
int test_wc_DsaExportParamsRaw(void);
int test_wc_DsaExportKeyRaw(void);
int test_wc_DsaCheckPubKey(void);
int test_wc_DsaSign_bad_digestSz(void);
int test_wc_DsaImportParamsRaw_individual_args(void);
int test_wc_DsaExportParamsRaw_individual_args(void);
int test_wc_DsaExportKeyRaw_individual_args(void);
#define TEST_DSA_DECLS \
TEST_DECL_GROUP("dsa", test_wc_InitDsaKey), \
TEST_DECL_GROUP("dsa", test_wc_DsaSignVerify), \
TEST_DECL_GROUP("dsa", test_wc_DsaPublicPrivateKeyDecode), \
TEST_DECL_GROUP("dsa", test_wc_MakeDsaKey), \
TEST_DECL_GROUP("dsa", test_wc_DsaKeyToDer), \
TEST_DECL_GROUP("dsa", test_wc_DsaKeyToPublicDer), \
TEST_DECL_GROUP("dsa", test_wc_DsaImportParamsRaw), \
TEST_DECL_GROUP("dsa", test_wc_DsaImportParamsRawCheck), \
TEST_DECL_GROUP("dsa", test_wc_DsaExportParamsRaw), \
TEST_DECL_GROUP("dsa", test_wc_DsaExportKeyRaw), \
TEST_DECL_GROUP("dsa", test_wc_DsaCheckPubKey), \
TEST_DECL_GROUP("dsa", test_wc_DsaSign_bad_digestSz), \
TEST_DECL_GROUP("dsa", test_wc_DsaImportParamsRaw_individual_args), \
TEST_DECL_GROUP("dsa", test_wc_DsaExportParamsRaw_individual_args), \
TEST_DECL_GROUP("dsa", test_wc_DsaExportKeyRaw_individual_args)
#endif /* WOLFCRYPT_TEST_DSA_H */