shamd5.h
Go to the documentation of this file.
1 //*****************************************************************************
2 //
3 // shamd5.h - Defines and Macros for the SHA/MD5.
4 //
5 // Copyright (c) 2012-2017 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 //*****************************************************************************
37 
38 #ifndef __DRIVERLIB_SHAMD5_H__
39 #define __DRIVERLIB_SHAMD5_H__
40 
41 #include <stdint.h>
42 #include <stdbool.h>
43 
44 //*****************************************************************************
45 //
46 // If building with a C++ compiler, make all of the definitions in this header
47 // have a C binding.
48 //
49 //*****************************************************************************
50 #ifdef __cplusplus
51 extern "C"
52 {
53 #endif
54 
55 //*****************************************************************************
56 //
57 // The following defines are used to specify the algorithm in use in the
58 // SHA/MD5 module.
59 //
60 //*****************************************************************************
61 #define SHAMD5_ALGO_MD5 0x00000018
62 #define SHAMD5_ALGO_SHA1 0x0000001a
63 #define SHAMD5_ALGO_SHA224 0x0000001c
64 #define SHAMD5_ALGO_SHA256 0x0000001e
65 #define SHAMD5_ALGO_HMAC_MD5 0x00000000
66 #define SHAMD5_ALGO_HMAC_SHA1 0x00000002
67 #define SHAMD5_ALGO_HMAC_SHA224 0x00000004
68 #define SHAMD5_ALGO_HMAC_SHA256 0x00000006
69 
70 //*****************************************************************************
71 //
72 // The following defines are used to represent the different interrupt sources
73 // in SHAMD5IntEnable(), SHAMD5IntDisable(), SHAMD5GetIntStatus(), and
74 // SHAMD5BlockOnIntStatus() functions.
75 //
76 //*****************************************************************************
77 #define SHAMD5_INT_CONTEXT_READY \
78  0x00000008
79 #define SHAMD5_INT_PARTHASH_READY \
80  0x00000004
81 #define SHAMD5_INT_INPUT_READY 0x00000002
82 #define SHAMD5_INT_OUTPUT_READY 0x00000001
83 #define SHAMD5_INT_DMA_CONTEXT_IN \
84  0x00080000
85 #define SHAMD5_INT_DMA_DATA_IN 0x00020000
86 #define SHAMD5_INT_DMA_CONTEXT_OUT \
87  0x00010000
88 
89 //*****************************************************************************
90 //
91 // Function prototypes
92 //
93 //*****************************************************************************
94 extern void SHAMD5ConfigSet(uint32_t ui32Base, uint32_t ui32Mode);
95 extern void SHAMD5DataProcess(uint32_t ui32Base, uint32_t *pui32DataSrc,
96  uint32_t ui32DataLength,
97  uint32_t *pui32HashResult);
98 extern void SHAMD5DataWrite(uint32_t ui32Base, uint32_t *pui32Src);
99 extern bool SHAMD5DataWriteNonBlocking(uint32_t ui32Base, uint32_t *pui32Src);
100 extern void SHAMD5DMADisable(uint32_t ui32Base);
101 extern void SHAMD5DMAEnable(uint32_t ui32Base);
102 extern void SHAMD5HashLengthSet(uint32_t ui32Base, uint32_t ui32Length);
103 extern void SHAMD5HMACKeySet(uint32_t ui32Base, uint32_t *pui32Src);
104 extern void SHAMD5HMACPPKeyGenerate(uint32_t ui32Base, uint32_t *pui32Key,
105  uint32_t *pui32PPKey);
106 extern void SHAMD5HMACPPKeySet(uint32_t ui32Base, uint32_t *pui32Src);
107 extern void SHAMD5HMACProcess(uint32_t ui32Base, uint32_t *pui32DataSrc,
108  uint32_t ui32DataLength,
109  uint32_t *pui32HashResult);
110 extern void SHAMD5IntClear(uint32_t ui32Base, uint32_t ui32IntFlags);
111 extern void SHAMD5IntDisable(uint32_t ui32Base, uint32_t ui32IntFlags);
112 extern void SHAMD5IntEnable(uint32_t ui32Base, uint32_t ui32IntFlags);
113 extern void SHAMD5IntRegister(uint32_t ui32Base, void (*pfnHandler)(void));
114 extern uint32_t SHAMD5IntStatus(uint32_t ui32Base, bool bMasked);
115 extern void SHAMD5IntUnregister(uint32_t ui32Base);
116 extern void SHAMD5Reset(uint32_t ui32Base);
117 extern void SHAMD5ResultRead(uint32_t ui32Base, uint32_t *pui32Dest);
118 
119 //*****************************************************************************
120 //
121 // Mark the end of the C bindings section for C++ compilers.
122 //
123 //*****************************************************************************
124 #ifdef __cplusplus
125 }
126 #endif
127 
128 #endif // __DRIVERLIB_SHAMD5_H__
void SHAMD5IntDisable(uint32_t ui32Base, uint32_t ui32IntFlags)
Definition: shamd5.c:267
void SHAMD5IntEnable(uint32_t ui32Base, uint32_t ui32IntFlags)
Definition: shamd5.c:222
void SHAMD5ResultRead(uint32_t ui32Base, uint32_t *pui32Dest)
Definition: shamd5.c:589
void SHAMD5HMACPPKeyGenerate(uint32_t ui32Base, uint32_t *pui32Key, uint32_t *pui32PPKey)
Definition: shamd5.c:940
bool SHAMD5DataWriteNonBlocking(uint32_t ui32Base, uint32_t *pui32Src)
Definition: shamd5.c:503
void SHAMD5HMACKeySet(uint32_t ui32Base, uint32_t *pui32Src)
Definition: shamd5.c:1011
void SHAMD5DMADisable(uint32_t ui32Base)
Definition: shamd5.c:134
void SHAMD5IntRegister(uint32_t ui32Base, void(*pfnHandler)(void))
Definition: shamd5.c:360
void SHAMD5HMACPPKeySet(uint32_t ui32Base, uint32_t *pui32Src)
Definition: shamd5.c:1055
void SHAMD5HashLengthSet(uint32_t ui32Base, uint32_t ui32Length)
Definition: shamd5.c:429
uint32_t SHAMD5IntStatus(uint32_t ui32Base, bool bMasked)
Definition: shamd5.c:169
void SHAMD5DataProcess(uint32_t ui32Base, uint32_t *pui32DataSrc, uint32_t ui32DataLength, uint32_t *pui32HashResult)
Definition: shamd5.c:805
void SHAMD5ConfigSet(uint32_t ui32Base, uint32_t ui32Mode)
Definition: shamd5.c:466
void SHAMD5IntClear(uint32_t ui32Base, uint32_t ui32IntFlags)
Definition: shamd5.c:315
void SHAMD5DMAEnable(uint32_t ui32Base)
Definition: shamd5.c:108
void SHAMD5HMACProcess(uint32_t ui32Base, uint32_t *pui32DataSrc, uint32_t ui32DataLength, uint32_t *pui32HashResult)
Definition: shamd5.c:878
void SHAMD5Reset(uint32_t ui32Base)
Definition: shamd5.c:68
void SHAMD5DataWrite(uint32_t ui32Base, uint32_t *pui32Src)
Definition: shamd5.c:549
void SHAMD5IntUnregister(uint32_t ui32Base)
Definition: shamd5.c:394
Copyright 2017, Texas Instruments Incorporated