1 /* Microsoft Reference Implementation for TPM 2.0 2 * 3 * The copyright in this software is being made available under the BSD License, 4 * included below. This software may be subject to other third party and 5 * contributor rights, including patent rights, and no such rights are granted 6 * under this license. 7 * 8 * Copyright (c) Microsoft Corporation 9 * 10 * All rights reserved. 11 * 12 * BSD License 13 * 14 * Redistribution and use in source and binary forms, with or without modification, 15 * are permitted provided that the following conditions are met: 16 * 17 * Redistributions of source code must retain the above copyright notice, this list 18 * of conditions and the following disclaimer. 19 * 20 * Redistributions in binary form must reproduce the above copyright notice, this 21 * list of conditions and the following disclaimer in the documentation and/or 22 * other materials provided with the distribution. 23 * 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ""AS IS"" 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 28 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 29 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 30 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 31 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 33 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 */ 35 /*(Auto-generated) 36 * Created by TpmPrototypes; Version 3.0 July 18, 2017 37 * Date: Mar 4, 2020 Time: 02:36:44PM 38 */ 39 40 #ifndef _CRYPT_SELF_TEST_FP_H_ 41 #define _CRYPT_SELF_TEST_FP_H_ 42 43 //*** CryptSelfTest() 44 // This function is called to start/complete a full self-test. 45 // If 'fullTest' is NO, then only the untested algorithms will be run. If 46 // 'fullTest' is YES, then 'g_untestedDecryptionAlgorithms' is reinitialized and then 47 // all tests are run. 48 // This implementation of the reference design does not support processing outside 49 // the framework of a TPM command. As a consequence, this command does not 50 // complete until all tests are done. Since this can take a long time, the TPM 51 // will check after each test to see if the command is canceled. If so, then the 52 // TPM will returned TPM_RC_CANCELLED. To continue with the self-tests, call 53 // TPM2_SelfTest(fullTest == No) and the TPM will complete the testing. 54 // Return Type: TPM_RC 55 // TPM_RC_CANCELED if the command is canceled 56 LIB_EXPORT 57 TPM_RC 58 CryptSelfTest( 59 TPMI_YES_NO fullTest // IN: if full test is required 60 ); 61 62 //*** CryptIncrementalSelfTest() 63 // This function is used to perform an incremental self-test. This implementation 64 // will perform the toTest values before returning. That is, it assumes that the 65 // TPM cannot perform background tasks between commands. 66 // 67 // This command may be canceled. If it is, then there is no return result. 68 // However, this command can be run again and the incremental progress will not 69 // be lost. 70 // Return Type: TPM_RC 71 // TPM_RC_CANCELED processing of this command was canceled 72 // TPM_RC_TESTING if toTest list is not empty 73 // TPM_RC_VALUE an algorithm in the toTest list is not implemented 74 TPM_RC 75 CryptIncrementalSelfTest( 76 TPML_ALG *toTest, // IN: list of algorithms to be tested 77 TPML_ALG *toDoList // OUT: list of algorithms needing test 78 ); 79 80 //*** CryptInitializeToTest() 81 // This function will initialize the data structures for testing all the 82 // algorithms. This should not be called unless CryptAlgsSetImplemented() has 83 // been called 84 void 85 CryptInitializeToTest( 86 void 87 ); 88 89 //*** CryptTestAlgorithm() 90 // Only point of contact with the actual self tests. If a self-test fails, there 91 // is no return and the TPM goes into failure mode. 92 // The call to TestAlgorithm uses an algorithm selector and a bit vector. When the 93 // test is run, the corresponding bit in 'toTest' and in 'g_toTest' is CLEAR. If 94 // 'toTest' is NULL, then only the bit in 'g_toTest' is CLEAR. 95 // There is a special case for the call to TestAlgorithm(). When 'alg' is 96 // ALG_ERROR, TestAlgorithm() will CLEAR any bit in 'toTest' for which it has 97 // no test. This allows the knowledge about which algorithms have test to be 98 // accessed through the interface that provides the test. 99 // Return Type: TPM_RC 100 // TPM_RC_CANCELED test was canceled 101 LIB_EXPORT 102 TPM_RC 103 CryptTestAlgorithm( 104 TPM_ALG_ID alg, 105 ALGORITHM_VECTOR *toTest 106 ); 107 108 #endif // _CRYPT_SELF_TEST_FP_H_ 109