rev148: Rework SELF_TEST

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
This commit is contained in:
Stefan Berger 2018-07-11 11:57:25 -04:00 committed by Stefan Berger
parent 04cd7f108c
commit c12e8fd47a
6 changed files with 12 additions and 11 deletions

View File

@ -65,7 +65,7 @@
/* 10.2.1.2 Includes and Defines */
#include "Tpm.h"
#define SELF_TEST_DATA
#ifdef SELF_TEST
#if SELF_TEST
/* These includes pull in the data structures. They contain data definitions for the various
tests. */
#include "SelfTest.h"

View File

@ -1,9 +1,9 @@
/********************************************************************************/
/* */
/* */
/* Self-Test of Cryptographic Functions */
/* Written by Ken Goldman */
/* IBM Thomas J. Watson Research Center */
/* $Id: CryptSelfTest.c 1047 2017-07-20 18:27:34Z kgoldman $ */
/* $Id: CryptSelfTest.c 1259 2018-07-10 19:11:09Z kgoldman $ */
/* */
/* Licenses and Notices */
/* */
@ -55,7 +55,7 @@
/* arising in any way out of use or reliance upon this specification or any */
/* information herein. */
/* */
/* (c) Copyright IBM Corp. and others, 2016, 2017 */
/* (c) Copyright IBM Corp. and others, 2016 - 2018 */
/* */
/********************************************************************************/
@ -206,7 +206,7 @@ CryptTestAlgorithm(
)
{
TPM_RC result;
#if defined SELF_TEST
#if SELF_TEST
result = TestAlgorithm(alg, toTest);
#else
// If this is an attempt to determine the algorithms for which there is a

View File

@ -187,6 +187,6 @@ TPM2B_STRING(COMMIT_STRING, "ECDAA Commit");
TPM2B_STRING(DUPLICATE_STRING, "DUPLICATE");
TPM2B_STRING(IDENTITY_STRING, "IDENTITY");
TPM2B_STRING(OBFUSCATE_STRING, "OBFUSCATE");
#ifdef SELF_TEST
#if SELF_TEST
TPM2B_STRING(OAEP_TEST_STRING, "OAEP Test Value");
#endif // SELF_TEST

View File

@ -68,7 +68,6 @@
#ifndef GLOBAL_H
#define GLOBAL_H
//#define SELF_TEST
_REDUCE_WARNING_LEVEL_(2)
#include <string.h>
#include <stddef.h>
@ -984,7 +983,7 @@ extern const TPM2B *DUPLICATE_STRING;
extern const TPM2B *OBFUSCATE_STRING;
extern const TPM2B *IDENTITY_STRING;
extern const TPM2B *COMMIT_STRING;
#ifdef SELF_TEST
#if SELF_TEST
extern const TPM2B *OAEP_TEST_STRING;
#endif // SELF_TEST
/* From Manufacture.c */

View File

@ -71,7 +71,7 @@
#include "VendorString.h"
/* 5.11.2 For Self-test */
/* These macros are used in CryptUtil() to invoke the incremental self test. */
#ifdef SELF_TEST
#if SELF_TEST
# define TEST(alg) if(TEST_BIT(alg, g_toTest)) CryptTestAlgorithm(alg, NULL)
/* Use of TPM_ALG_NULL is reserved for RSAEP/RSADP testing. If someone is wanting to test a hash
with that value, don't do it. */

View File

@ -102,9 +102,11 @@
#endif
/* This switch is used to enable the self-test capability in AlgorithmTests.c */
#ifndef SELF_TEST
#define SELF_TEST
#if !(defined SELF_TEST) || ((SELF_TEST != NO) && (SELF_TEST != YES))
# undef SELF_TEST
# define SELF_TEST YES // Default: Either YES or NO
#endif
/* Enable the generation of RSA primes using a sieve. */
#ifndef RSA_KEY_SIEVE
# define RSA_KEY_SIEVE