1 /****************************************************************************** 2 * Copyright (c) 2022-2023 Texas Instruments Incorporated 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions are met: 6 * 7 * 1) Redistributions of source code must retain the above copyright notice, 8 * this list of conditions and the following disclaimer. 9 * 10 * 2) Redistributions in binary form must reproduce the above copyright notice, 11 * this list of conditions and the following disclaimer in the documentation 12 * and/or other materials provided with the distribution. 13 * 14 * 3) Neither the name of the copyright holder nor the names of its 15 * contributors may be used to endorse or promote products derived from this 16 * software without specific prior written permission. 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * POSSIBILITY OF SUCH DAMAGE. 29 * 30 ******************************************************************************/ 31 #ifndef SHA2SW_CONFIG_H_ 32 #define SHA2SW_CONFIG_H_ 33 34 /** ============================================================================ 35 * @file sha2sw_config.h 36 */ 37 /*! 38 * @addtogroup sw_libraries_group 39 * @{ 40 * @addtogroup sha2sw_config_options 41 * @{ 42 * @brief Build-time configuration options for the SHA2 SW module 43 */ 44 /*! 45 * @brief Include support for SHA2 224. 46 * 47 */ 48 #if !defined(SHA2SW_SUPPORT_SHA2_224) 49 // #define SHA2SW_SUPPORT_SHA2_224 (1) 50 #endif 51 52 /*! 53 * @brief Include support for SHA2 384. 54 * 55 */ 56 #if !defined(SHA2SW_SUPPORT_SHA2_384) 57 // #define SHA2SW_SUPPORT_SHA2_384 (1) 58 #endif 59 60 /*! 61 * @brief If defined, SHA2SW library will check inputs for invalid 62 * conditions. Otherwise, parameters will not be checked. 63 * 64 * If #SHA2SW_VALIDATE_INPUTS is not defined then: 65 * @li the caller is responsible for ensuring all inputs are valid, and 66 * @li the module's functions will only return #SHA2SW_STATUS_SUCCESS 67 * 68 * 69 * Not defining this value will reduce code size. 70 */ 71 #if !defined(SHA2SW_VALIDATE_INPUTS) 72 #define SHA2SW_VALIDATE_INPUTS (1) 73 #endif 74 75 /*! 76 * @brief Use a faster implementation of the message schedule which is 77 * slightly larger in code size. 78 * 79 * Expected time savings of 2,600 cycles or more per input block. Code 80 * size cost for enabling may be as little as 8 bytes. 81 */ 82 #if !defined(SHA2SW_FAST_MESSAGE_SCHEDULE) 83 #define SHA2SW_FAST_MESSAGE_SCHEDULE (1) 84 #endif 85 86 /*! 87 * @brief Use a faster implementation of the working variables a-h which is 88 * slightly larger in code size. 89 * 90 * Expected time savings of 750 cycles or more per input block. Code 91 * size cost for enabling may be as little as 24 bytes. 92 */ 93 #if !defined(SHA2SW_FAST_WORKING_VARS) 94 #define SHA2SW_FAST_WORKING_VARS (1) 95 #endif 96 97 /*! 98 * @brief Use portions of the constants of the 512 algorithm to 99 * support the 256 and 224 algorithms. 100 * 101 * The initial hash values as well as the round constants (K) of 102 * 512/384 are extensions of the values used for 256/224. Thus, 103 * const data space can be saved by using the 512/384 constants 104 * for the 256/224 algorithm. However, the 256/224 algorithm must 105 * spend extra cycles to skip over unneeded constants. 106 * 107 * Expected savings of at least 288 bytes of const data at the cost 108 * of a few bytes of code space and small change in performance. 109 */ 110 #if !defined(SHA2SW_USE_512_CONST_FOR_256) 111 // #define SHA2SW_USE_512_CONST_FOR_256 (1) 112 #endif 113 114 /*! 115 * @brief Use Arm(R) C Language Extensions 116 * 117 * Use ARM(R) CLE to directly access op codes which can improve 118 * code size and/or performance. 119 */ 120 #if !defined(SHA2SW_USE_ARMCLE) 121 #define SHA2SW_USE_ARMCLE (1) 122 #endif 123 124 /*! @}*/ 125 /*! @}*/ 126 127 #endif /* SHA2SW_CONFIG_H_ */ 128