CC23x0R5DriverLibrary
sha256sw.h
Go to the documentation of this file.
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 SHA256SW_H_
32 #define SHA256SW_H_
33 
206 #include <stddef.h>
207 #include <stdint.h>
208 
209 #include "sha2sw_common.h"
210 #include "sha2sw_config.h"
211 
217 typedef struct
218 {
219  uint32_t bitsProcessed; // Only 2^32 bits (512 MiBytes) are supported
220  int8_t offsetWb; // Byte offset into Ws, used to load message
221  uint8_t reserved1;
222  uint8_t reserved2;
223  uint8_t reserved3;
224  uint32_t digest32[8]; // Holds intermediate/final digest
225  uint32_t Ws32[16]; // Message schedule, indexed by (s & 0xF),
226  // where s = 63 - t, and t is NIST 180-4's
227  // message schedule index
229 
234 
235 /* Include this file after the type definitions above, to break cyclic dependency between hapi.h and sha256sw.h */
236 #include "hapi.h"
237 
272 extern int_fast16_t SHA256SWHashData(SHA256SW_Handle handle,
273  SHA2SW_HashType hashType,
274  const void *data,
275  size_t length,
276  uint32_t digest[8]);
277 
278 #define SHA256SWHashData HAPI_TABLE_POINTER->sha256SwHashData
279 
295 extern int_fast16_t SHA256SWStart(SHA256SW_Handle handle, SHA2SW_HashType hashType);
296 
297 #define SHA256SWStart HAPI_TABLE_POINTER->sha256SwStart
298 
330 extern int_fast16_t SHA256SWAddData(SHA256SW_Handle handle, const void *data, size_t length);
331 
332 #define SHA256SWAddData HAPI_TABLE_POINTER->sha256SwAddData
333 
355 extern int_fast16_t SHA256SWFinalize(SHA256SW_Handle handle, uint32_t digest[8]);
356 
357 #define SHA256SWFinalize HAPI_TABLE_POINTER->sha256SwFinalize
358 
362 #endif /* SHA256SW_H_ */
#define SHA256SWFinalize
Definition: sha256sw.h:357
Definitions common across all SHA2 SW modules.
SHA256SW_Object * SHA256SW_Handle
A handle to a SHA256SW_Object.
Definition: sha256sw.h:233
int8_t offsetWb
Definition: sha256sw.h:220
uint32_t bitsProcessed
Definition: sha256sw.h:219
SHA256SW Object.
Definition: sha256sw.h:217
#define SHA256SWStart
Definition: sha256sw.h:297
#define SHA256SWHashData
Definition: sha256sw.h:278
uint8_t reserved3
Definition: sha256sw.h:223
#define SHA256SWAddData
Definition: sha256sw.h:332
uint8_t reserved1
Definition: sha256sw.h:221
SHA2SW_HashType
Enum for the hash types supported by the library.
Definition: sha2sw_common.h:53
uint8_t reserved2
Definition: sha256sw.h:222