CC3200 Peripheral Driver Library User's Guide  1.2.0
shamd5.h
1 //*****************************************************************************
2 //
3 // shamd5.h
4 //
5 // Defines and Macros for the SHA/MD5.
6 //
7 // Copyright (C) 2014 Texas Instruments Incorporated - https://www.ti.com/
8 //
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions
12 // are met:
13 //
14 // Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the
20 // distribution.
21 //
22 // Neither the name of Texas Instruments Incorporated nor the names of
23 // its contributors may be used to endorse or promote products derived
24 // from this software without specific prior written permission.
25 //
26 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
27 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
28 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
29 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
30 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
31 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
32 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
33 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
34 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
35 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
36 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
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 // MD5
61 #define SHAMD5_ALGO_SHA1 0x0000001a // SHA-1
62 #define SHAMD5_ALGO_SHA224 0x0000001c // SHA-224
63 #define SHAMD5_ALGO_SHA256 0x0000001e // SHA-256
64 #define SHAMD5_ALGO_HMAC_MD5 0x00000000 // HMAC-MD5
65 #define SHAMD5_ALGO_HMAC_SHA1 0x00000002 // HMAC-SHA-1
66 #define SHAMD5_ALGO_HMAC_SHA224 0x00000004 // HMAC-SHA-224
67 #define SHAMD5_ALGO_HMAC_SHA256 0x00000006 // HMAC-SHA-256
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 0x00000008
77 #define SHAMD5_INT_PARTHASH_READY 0x00000004
78 #define SHAMD5_INT_INPUT_READY 0x00000002
79 #define SHAMD5_INT_OUTPUT_READY 0x00000001
80 #define SHAMD5_INT_DMA_CONTEXT_IN 0x00010000
81 #define SHAMD5_INT_DMA_DATA_IN 0x00020000
82 #define SHAMD5_INT_DMA_CONTEXT_OUT 0x00040000
83 
84 //*****************************************************************************
85 //
86 // Function prototypes
87 //
88 //*****************************************************************************
89 extern void SHAMD5ConfigSet(uint32_t ui32Base, uint32_t ui32Mode);
90 extern bool SHAMD5DataProcess(uint32_t ui32Base, uint8_t *pui8DataSrc,
91  uint32_t ui32DataLength, uint8_t *pui8HashResult);
92 extern void SHAMD5DataWrite(uint32_t ui32Base, uint8_t *pui8Src);
93 extern bool SHAMD5DataWriteNonBlocking(uint32_t ui32Base, uint8_t *pui8Src);
94 extern void SHAMD5DMADisable(uint32_t ui32Base);
95 extern void SHAMD5DMAEnable(uint32_t ui32Base);
96 extern void SHAMD5DataLengthSet(uint32_t ui32Base, uint32_t ui32Length);
97 extern void SHAMD5HMACKeySet(uint32_t ui32Base, uint8_t *pui8Src);
98 extern void SHAMD5HMACPPKeyGenerate(uint32_t ui32Base, uint8_t *pui8Key,
99  uint8_t *pui8PPKey);
100 extern void SHAMD5HMACPPKeySet(uint32_t ui32Base, uint8_t *pui8Src);
101 extern bool SHAMD5HMACProcess(uint32_t ui32Base, uint8_t *pui8DataSrc,
102  uint32_t ui32DataLength, uint8_t *pui8HashResult);
103 extern void SHAMD5IntClear(uint32_t ui32Base, uint32_t ui32IntFlags);
104 extern void SHAMD5IntDisable(uint32_t ui32Base, uint32_t ui32IntFlags);
105 extern void SHAMD5IntEnable(uint32_t ui32Base, uint32_t ui32IntFlags);
106 extern void SHAMD5IntRegister(uint32_t ui32Base, void(*pfnHandler)(void));
107 extern uint32_t SHAMD5IntStatus(uint32_t ui32Base, bool bMasked);
108 extern void SHAMD5IntUnregister(uint32_t ui32Base);
109 extern void SHAMD5ResultRead(uint32_t ui32Base, uint8_t *pui8Dest);
110 
111 //*****************************************************************************
112 //
113 // Mark the end of the C bindings section for C++ compilers.
114 //
115 //*****************************************************************************
116 #ifdef __cplusplus
117 }
118 #endif
119 
120 #endif // __DRIVERLIB_SHAMD5_H__
void SHAMD5DMAEnable(uint32_t ui32Base)
Definition: shamd5.c:76
void SHAMD5DataWrite(uint32_t ui32Base, uint8_t *pui8Src)
Definition: shamd5.c:507
void SHAMD5ResultRead(uint32_t ui32Base, uint8_t *pui8Dest)
Definition: shamd5.c:557
void SHAMD5IntDisable(uint32_t ui32Base, uint32_t ui32IntFlags)
Definition: shamd5.c:230
void SHAMD5IntEnable(uint32_t ui32Base, uint32_t ui32IntFlags)
Definition: shamd5.c:187
void SHAMD5IntClear(uint32_t ui32Base, uint32_t ui32IntFlags)
Definition: shamd5.c:276
uint32_t SHAMD5IntStatus(uint32_t ui32Base, bool bMasked)
Definition: shamd5.c:137
void SHAMD5HMACKeySet(uint32_t ui32Base, uint8_t *pui8Src)
Definition: shamd5.c:1015
bool SHAMD5HMACProcess(uint32_t ui32Base, uint8_t *pui8DataSrc, uint32_t ui32DataLength, uint8_t *pui8HashResult)
Definition: shamd5.c:874
void SHAMD5HMACPPKeySet(uint32_t ui32Base, uint8_t *pui8Src)
Definition: shamd5.c:1060
void SHAMD5DMADisable(uint32_t ui32Base)
Definition: shamd5.c:102
void SHAMD5DataLengthSet(uint32_t ui32Base, uint32_t ui32Length)
Definition: shamd5.c:388
bool SHAMD5DataWriteNonBlocking(uint32_t ui32Base, uint8_t *pui8Src)
Definition: shamd5.c:461
void SHAMD5ConfigSet(uint32_t ui32Base, uint32_t ui32Mode)
Definition: shamd5.c:425
void SHAMD5IntUnregister(uint32_t ui32Base)
Definition: shamd5.c:353
bool SHAMD5DataProcess(uint32_t ui32Base, uint8_t *pui8DataSrc, uint32_t ui32DataLength, uint8_t *pui8HashResult)
Definition: shamd5.c:796
void SHAMD5IntRegister(uint32_t ui32Base, void(*pfnHandler)(void))
Definition: shamd5.c:319
void SHAMD5HMACPPKeyGenerate(uint32_t ui32Base, uint8_t *pui8Key, uint8_t *pui8PPKey)
Definition: shamd5.c:942