1 //*****************************************************************************
2 //
3 // shamd5.h - Defines and Macros for the SHA/MD5.
4 //
5 // Copyright (c) 2012-2020 Texas Instruments Incorporated.  All rights reserved.
6 // Software License Agreement
7 //
8 //   Redistribution and use in source and binary forms, with or without
9 //   modification, are permitted provided that the following conditions
10 //   are met:
11 //
12 //   Redistributions of source code must retain the above copyright
13 //   notice, this list of conditions and the following disclaimer.
14 //
15 //   Redistributions in binary form must reproduce the above copyright
16 //   notice, this list of conditions and the following disclaimer in the
17 //   documentation and/or other materials provided with the
18 //   distribution.
19 //
20 //   Neither the name of Texas Instruments Incorporated nor the names of
21 //   its contributors may be used to endorse or promote products derived
22 //   from this software without specific prior written permission.
23 //
24 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
27 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
28 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
29 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
30 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
31 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
32 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
34 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 //
36 // This is part of revision 2.2.0.295 of the Tiva Peripheral Driver Library.
37 //
38 //*****************************************************************************
39 
40 #ifndef __DRIVERLIB_SHAMD5_H__
41 #define __DRIVERLIB_SHAMD5_H__
42 
43 //*****************************************************************************
44 //
45 // If building with a C++ compiler, make all of the definitions in this header
46 // have a C binding.
47 //
48 //*****************************************************************************
49 #ifdef __cplusplus
50 extern "C"
51 {
52 #endif
53 
54 //*****************************************************************************
55 //
56 // The following defines are used to specify the algorithm in use in the
57 // SHA/MD5 module.
58 //
59 //*****************************************************************************
60 #define SHAMD5_ALGO_MD5         0x00000018
61 #define SHAMD5_ALGO_SHA1        0x0000001a
62 #define SHAMD5_ALGO_SHA224      0x0000001c
63 #define SHAMD5_ALGO_SHA256      0x0000001e
64 #define SHAMD5_ALGO_HMAC_MD5    0x00000000
65 #define SHAMD5_ALGO_HMAC_SHA1   0x00000002
66 #define SHAMD5_ALGO_HMAC_SHA224 0x00000004
67 #define SHAMD5_ALGO_HMAC_SHA256 0x00000006
68 
69 //*****************************************************************************
70 //
71 // The following defines are used to represent the different interrupt sources
72 // in SHAMD5IntEnable(), SHAMD5IntDisable(), SHAMD5GetIntStatus(), and
73 // SHAMD5BlockOnIntStatus() functions.
74 //
75 //*****************************************************************************
76 #define SHAMD5_INT_CONTEXT_READY \
77                                 0x00000008
78 #define SHAMD5_INT_PARTHASH_READY \
79                                 0x00000004
80 #define SHAMD5_INT_INPUT_READY  0x00000002
81 #define SHAMD5_INT_OUTPUT_READY 0x00000001
82 #define SHAMD5_INT_DMA_CONTEXT_IN \
83                                 0x00080000
84 #define SHAMD5_INT_DMA_DATA_IN  0x00020000
85 #define SHAMD5_INT_DMA_CONTEXT_OUT \
86                                 0x00010000
87 
88 //*****************************************************************************
89 //
90 // Function prototypes
91 //
92 //*****************************************************************************
93 extern void SHAMD5ConfigSet(uint32_t ui32Base, uint32_t ui32Mode);
94 extern void SHAMD5DataProcess(uint32_t ui32Base, uint32_t *pui32DataSrc,
95                               uint32_t ui32DataLength,
96                               uint32_t *pui32HashResult);
97 extern void SHAMD5DataWrite(uint32_t ui32Base, uint32_t *pui32Src);
98 extern bool SHAMD5DataWriteNonBlocking(uint32_t ui32Base, uint32_t *pui32Src);
99 extern void SHAMD5DMADisable(uint32_t ui32Base);
100 extern void SHAMD5DMAEnable(uint32_t ui32Base);
101 extern void SHAMD5HashLengthSet(uint32_t ui32Base, uint32_t ui32Length);
102 extern void SHAMD5HMACKeySet(uint32_t ui32Base, uint32_t *pui32Src);
103 extern void SHAMD5HMACPPKeyGenerate(uint32_t ui32Base, uint32_t *pui32Key,
104                                     uint32_t *pui32PPKey);
105 extern void SHAMD5HMACPPKeySet(uint32_t ui32Base, uint32_t *pui32Src);
106 extern void SHAMD5HMACProcess(uint32_t ui32Base, uint32_t *pui32DataSrc,
107                               uint32_t ui32DataLength,
108                               uint32_t *pui32HashResult);
109 extern void SHAMD5IntClear(uint32_t ui32Base, uint32_t ui32IntFlags);
110 extern void SHAMD5IntDisable(uint32_t ui32Base, uint32_t ui32IntFlags);
111 extern void SHAMD5IntEnable(uint32_t ui32Base, uint32_t ui32IntFlags);
112 extern void SHAMD5IntRegister(uint32_t ui32Base, void (*pfnHandler)(void));
113 extern uint32_t SHAMD5IntStatus(uint32_t ui32Base, bool bMasked);
114 extern void SHAMD5IntUnregister(uint32_t ui32Base);
115 extern void SHAMD5Reset(uint32_t ui32Base);
116 extern void SHAMD5ResultRead(uint32_t ui32Base, uint32_t *pui32Dest);
117 
118 //*****************************************************************************
119 //
120 // Mark the end of the C bindings section for C++ compilers.
121 //
122 //*****************************************************************************
123 #ifdef __cplusplus
124 }
125 #endif
126 
127 #endif // __DRIVERLIB_SHAMD5_H__
128