mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2026-08-11 09:21:21 +02:00
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).
57 lines
2.4 KiB
C
57 lines
2.4 KiB
C
/* test_dh.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_DH_H
|
|
#define WOLFCRYPT_TEST_DH_H
|
|
|
|
#include <tests/api/api_decl.h>
|
|
|
|
int test_wc_DhPublicKeyDecode(void);
|
|
int test_wc_DhAgree_subgroup_check(void);
|
|
int test_wc_DhSetKey(void);
|
|
int test_wc_DhSetNamedKey_and_helpers(void);
|
|
int test_wc_DhGenerateKeyPair_bad_args(void);
|
|
int test_wc_DhGenerateKeyPair_and_Agree(void);
|
|
int test_wc_DhAgree_nonblock(void);
|
|
int test_wc_DhImportExportKeyPair(void);
|
|
int test_wc_DhCheckPubKey(void);
|
|
int test_wc_DhCheckPrivKey(void);
|
|
int test_wc_DhCheckKeyPair(void);
|
|
int test_wc_DhGenerateParams_and_ExportRaw(void);
|
|
int test_wc_DhGenerateKeyPair_CheckDhLN(void);
|
|
|
|
#define TEST_DH_DECLS \
|
|
TEST_DECL_GROUP("dh", test_wc_DhPublicKeyDecode), \
|
|
TEST_DECL_GROUP("dh", test_wc_DhAgree_subgroup_check), \
|
|
TEST_DECL_GROUP("dh", test_wc_DhSetKey), \
|
|
TEST_DECL_GROUP("dh", test_wc_DhSetNamedKey_and_helpers), \
|
|
TEST_DECL_GROUP("dh", test_wc_DhGenerateKeyPair_bad_args), \
|
|
TEST_DECL_GROUP("dh", test_wc_DhGenerateKeyPair_and_Agree), \
|
|
TEST_DECL_GROUP("dh", test_wc_DhAgree_nonblock), \
|
|
TEST_DECL_GROUP("dh", test_wc_DhImportExportKeyPair), \
|
|
TEST_DECL_GROUP("dh", test_wc_DhCheckPubKey), \
|
|
TEST_DECL_GROUP("dh", test_wc_DhCheckPrivKey), \
|
|
TEST_DECL_GROUP("dh", test_wc_DhCheckKeyPair), \
|
|
TEST_DECL_GROUP("dh", test_wc_DhGenerateParams_and_ExportRaw), \
|
|
TEST_DECL_GROUP("dh", test_wc_DhGenerateKeyPair_CheckDhLN)
|
|
|
|
#endif /* WOLFCRYPT_TEST_DH_H */
|