Mistake on this page?
Report an issue in GitHub or email us
crypto_common.h
Go to the documentation of this file.
1 /*
2  * mbed Microcontroller Library
3  * Copyright (c) 2019 Cypress Semiconductor Corporation
4  * SPDX-License-Identifier: Apache-2.0
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 
19 /**
20  * \file crypto_common.h
21  * \version 1.0
22  *
23  * \brief Header file for common mbedtls acceleration functions
24  *
25  */
26 
27 #if !defined(CRYPTO_COMMON_H)
28 #define CRYPTO_COMMON_H
29 
30 #if defined(MBEDTLS_CONFIG_FILE)
31 #include MBEDTLS_CONFIG_FILE
32 #else
33 #include "config.h"
34 #endif
35 
36 #include "mbedtls/ecp.h"
37 
38 #include "cy_crypto_core_sha.h"
39 
40 #include "cyhal_crypto_common.h"
41 
42 /** CRYPTO object */
43 typedef struct {
44 #if defined(CY_IP_MXCRYPTO_INSTANCES) || defined(CPUSS_CRYPTO_PRESENT)
45  CRYPTO_Type* base;
46  cyhal_resource_inst_t resource;
47  cyhal_crypto_feature_t feature;
48 #endif
50 
51 bool cy_hw_crypto_reserve(cy_hw_crypto_t *obj, cyhal_crypto_feature_t feature);
52 void cy_hw_crypto_release(cy_hw_crypto_t *obj);
53 void cy_hw_zeroize(void *data, uint32_t dataSize);
54 
55 void cy_hw_sha_init(void *ctx, uint32_t ctxSize);
56 void cy_hw_sha_free(void *ctx, uint32_t ctxSize);
57 
58 int cy_hw_sha_start (cy_hw_crypto_t *obj, cy_stc_crypto_sha_state_t *hashState,
59  cy_en_crypto_sha_mode_t shaMode, void *shaBuffers);
60 
61 int cy_hw_sha_update(cy_hw_crypto_t *obj, cy_stc_crypto_sha_state_t *hashState,
62  const uint8_t *in, uint32_t inlen);
63 
64 int cy_hw_sha_finish(cy_hw_crypto_t *obj, cy_stc_crypto_sha_state_t *hashState,
65  uint8_t *output);
66 
67 void cy_hw_sha_clone(void *ctxDst, const void *ctxSrc, uint32_t ctxSize,
68  cy_stc_crypto_sha_state_t *hashStateDst, void *shaBuffersDst);
69 
70 int cy_hw_sha_process(cy_hw_crypto_t *obj, cy_stc_crypto_sha_state_t *hashState,
71  const uint8_t *in);
72 
73 #endif /* (CRYPTO_COMMON_H) */
CRYPTO object.
Definition: crypto_common.h:43
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.