1 /***************************************************************************//**
2 * \file cy_crypto_core_rsa.h
3 * \version 2.120
4 *
5 * \brief
6 *  This file provides provides constant and parameters
7 *  for the API of the RSA in the Crypto block driver.
8 *
9 ********************************************************************************
10 * \copyright
11 * Copyright (c) (2020-2022), Cypress Semiconductor Corporation (an Infineon company) or
12 * an affiliate of Cypress Semiconductor Corporation.
13 * SPDX-License-Identifier: Apache-2.0
14 *
15 * Licensed under the Apache License, Version 2.0 (the "License");
16 * you may not use this file except in compliance with the License.
17 * You may obtain a copy of the License at
18 *
19 *    http://www.apache.org/licenses/LICENSE-2.0
20 *
21 * Unless required by applicable law or agreed to in writing, software
22 * distributed under the License is distributed on an "AS IS" BASIS,
23 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24 * See the License for the specific language governing permissions and
25 * limitations under the License.
26 *******************************************************************************/
27 
28 #if !defined (CY_CRYPTO_CORE_RSA_H)
29 #define CY_CRYPTO_CORE_RSA_H
30 
31 #include "cy_device.h"
32 
33 #if defined (CY_IP_MXCRYPTO)
34 
35 #include "cy_crypto_common.h"
36 
37 #if defined(__cplusplus)
38 extern "C" {
39 #endif
40 
41 #if (CPUSS_CRYPTO_VU == 1) && defined(CY_CRYPTO_CFG_RSA_C)
42 
43 typedef cy_en_crypto_status_t (*cy_crypto_rsa_proc_func_t)(CRYPTO_Type *base,
44                                               cy_stc_crypto_rsa_pub_key_t const *key,
45                                               uint8_t const *message,
46                                               uint32_t messageSize,
47                                               uint8_t *processedMessage);
48 
49 typedef cy_en_crypto_status_t (*cy_crypto_rsa_coef_func_t)(CRYPTO_Type *base,
50                                               cy_stc_crypto_rsa_pub_key_t const *key);
51 
52 
53 
54 cy_en_crypto_status_t Cy_Crypto_Core_Rsa_Proc(CRYPTO_Type *base,
55                                               cy_stc_crypto_rsa_pub_key_t const *key,
56                                               uint8_t const *message,
57                                               uint32_t messageSize,
58                                               uint8_t *processedMessage);
59 
60 cy_en_crypto_status_t Cy_Crypto_Core_Rsa_Coef(CRYPTO_Type *base,
61                                               cy_stc_crypto_rsa_pub_key_t const *key);
62 
63 #if defined(CY_CRYPTO_CFG_RSA_VERIFY_ENABLED)
64 typedef cy_en_crypto_status_t (*cy_crypto_rsa_ver_func_t)(CRYPTO_Type *base,
65                                               cy_en_crypto_rsa_ver_result_t *verResult,
66                                               cy_en_crypto_sha_mode_t digestType,
67                                               uint8_t const *digest,
68                                               uint8_t const *decryptedSignature,
69                                               uint32_t decryptedSignatureLength);
70 
71 cy_en_crypto_status_t Cy_Crypto_Core_Rsa_Verify(CRYPTO_Type *base,
72                             cy_en_crypto_rsa_ver_result_t *verResult,
73                             cy_en_crypto_sha_mode_t digestType,
74                             uint8_t const *digest,
75                             uint8_t const *decryptedSignature,
76                             uint32_t decryptedSignatureLength);
77 
78 cy_en_crypto_status_t Cy_Crypto_Core_Rsa_Verify_Ext(CRYPTO_Type *base,
79                             cy_en_crypto_rsa_ver_result_t *verResult,
80                             cy_en_crypto_sha_mode_t digestType,
81                             uint8_t const *digest,
82                             uint32_t digestLength,
83                             uint8_t const *decryptedSignature,
84                             uint32_t decryptedSignatureLength);
85 
86 #endif /* defined(CY_CRYPTO_CFG_RSA_VERIFY_ENABLED) */
87 
88 
89 #if defined(CY_CRYPTO_CFG_RSA_SIGN_ENABLED)
90 cy_en_crypto_status_t Cy_Crypto_Core_Rsa_Sign(CRYPTO_Type *base,
91                             cy_en_crypto_sha_mode_t digestType,
92                             uint8_t const *digest,
93                             uint32_t digestLength,
94                             uint8_t *signature,
95                             uint32_t signatureLength);
96 #endif /* defined(CY_CRYPTO_CFG_RSA_SIGN_ENABLED) */
97 
98 #endif /* (CPUSS_CRYPTO_VU == 1) && defined(CY_CRYPTO_CFG_RSA_C) */
99 
100 #if defined(__cplusplus)
101 }
102 #endif
103 
104 #endif /* CY_IP_MXCRYPTO */
105 
106 #endif /* #if !defined (CY_CRYPTO_CORE_RSA_H) */
107 
108 
109 /* [] END OF FILE */
110