MAX32665 SDK Documentation  0.2
Software Development Kit Overview and API Documentation
hash.h
1 
6 /* ****************************************************************************
7  * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
8  *
9  * Permission is hereby granted, free of charge, to any person obtaining a
10  * copy of this software and associated documentation files (the "Software"),
11  * to deal in the Software without restriction, including without limitation
12  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13  * and/or sell copies of the Software, and to permit persons to whom the
14  * Software is furnished to do so, subject to the following conditions:
15  *
16  * The above copyright notice and this permission notice shall be included
17  * in all copies or substantial portions of the Software.
18  *
19  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22  * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
23  * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
24  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25  * OTHER DEALINGS IN THE SOFTWARE.
26  *
27  * Except as contained in this notice, the name of Maxim Integrated
28  * Products, Inc. shall not be used except as stated in the Maxim Integrated
29  * Products, Inc. Branding Policy.
30  *
31  * The mere transfer of this software does not imply any licenses
32  * of trade secrets, proprietary technology, copyrights, patents,
33  * trademarks, maskwork rights, or any other form of intellectual
34  * property whatsoever. Maxim Integrated Products, Inc. retains all
35  * ownership rights.
36  *
37  * $Date: 2018-09-10 16:20:17 -0500 (Mon, 10 Sep 2018) $
38  * $Revision: 37771 $
39  *
40  *************************************************************************** */
41 
42 #ifndef _CRYPTO_H_
43 #define _CRYPTO_H_
44 
45 #include <stdint.h>
46 #include "tpu_regs.h"
47 
48 #ifdef __cplusplus
49 extern "C" {
50 #endif
51 
57 /* ****** MACROS ****** */
58 
62 typedef enum {
63  TPU_HASH_DIS = MXC_V_TPU_HASH_CTRL_HASH_DIS, // Disable
64  TPU_HASH_SHA1 = MXC_V_TPU_HASH_CTRL_HASH_SHA1, // Select SHA1
65  TPU_HASH_SHA224 = MXC_V_TPU_HASH_CTRL_HASH_SHA224, // Select SHA224
66  TPU_HASH_SHA256 = MXC_V_TPU_HASH_CTRL_HASH_SHA256, // Select SHA256
67  TPU_HASH_SHA384 = MXC_V_TPU_HASH_CTRL_HASH_SHA384, // Select SHA384
68  TPU_HASH_SHA512 = MXC_V_TPU_HASH_CTRL_HASH_SHA512 // Select SHA384
70 
74 void TPU_Hash_Reset(void);
75 
79 void TPU_Hash_Shutdown(void);
80 
86 int TPU_Hash_Config(tpu_hashfunsel_t func);
87 
97 int TPU_SHA( const char *msg, tpu_hashfunsel_t fun, unsigned int byteLen, char *digest);
98 
99 #ifdef __cplusplus
100 }
101 #endif
102 
104 #endif /* _CRYPTO_H_ */
#define MXC_V_TPU_HASH_CTRL_HASH_SHA256
HASH_CTRL_HASH_SHA256 Value.
Definition: tpu_regs.h:286
tpu_hashfunsel_t
Enumeration type for Hash function Select.
Definition: hash.h:62
int TPU_SHA(const char *msg, tpu_hashfunsel_t fun, unsigned int byteLen, char *digest)
Test the SHA process.
void TPU_Hash_Reset(void)
Reset the crypto accelerator.
#define MXC_V_TPU_HASH_CTRL_HASH_DIS
HASH_CTRL_HASH_DIS Value.
Definition: tpu_regs.h:280
#define MXC_V_TPU_HASH_CTRL_HASH_SHA512
HASH_CTRL_HASH_SHA512 Value.
Definition: tpu_regs.h:290
int TPU_Hash_Config(tpu_hashfunsel_t func)
Configure crypto hash operation for different hash functions.
#define MXC_V_TPU_HASH_CTRL_HASH_SHA1
HASH_CTRL_HASH_SHA1 Value.
Definition: tpu_regs.h:282
#define MXC_V_TPU_HASH_CTRL_HASH_SHA384
HASH_CTRL_HASH_SHA384 Value.
Definition: tpu_regs.h:288
#define MXC_V_TPU_HASH_CTRL_HASH_SHA224
HASH_CTRL_HASH_SHA224 Value.
Definition: tpu_regs.h:284
void TPU_Hash_Shutdown(void)
Shutdown crypto controller.