1 /*
2 * Copyright (c) 2020 - 2024 Renesas Electronics Corporation and/or its affiliates
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6 
7 /////////////////////////////////////////////////////////////////////////
8 // <SC32#4 AES-256 Encryption ECB Mode>                                //
9 // Procedure number: 20                                                //
10 // File name      : SC324_p20.prc                                      //
11 // State Diagram  : main(FSM1)                                         //
12 // Start State    : main03                                             //
13 // End State      : main03                                             //
14 // Input Data     : InData_Key[8]                                      //
15 // : InData_Text[MAX_CNT]                               //
16 // Output Data    : OutData_Text[MAX_CNT]                              //
17 // : (MAX_CNT is Multiples of four.)                    //
18 // Return Value   : Pass, Fail or Resource_Conflict                    //
19 // ---------------------------------------------------------------------//
20 // total cycle    : polling + write access + read access               //
21 // polling        :                                                    //
22 // polling access :                                                    //
23 // write access   :                                                    //
24 // read  access   :                                                    //
25 /////////////////////////////////////////////////////////////////////////
26 
27 #include "sc324_aes_private.h"
28 
29 #include "hw_sce_aes_private.h"
30 
31 /*******************************************************************************************************************//**
32  * AES-256 Encryption ECB Mode
33  *
34  * @param[in]  InData_Key      In data key
35  * @param[in]  num_words       The number words
36  * @param[in]  InData_Text     In data text
37  * @param      OutData_Text    The out data text
38  *
39  * @retval FSP_SUCCESS          The operation completed successfully.
40  * @retval FSP_ERR_CRYPTO_INVALID_SIZE          The size of the data must be multiples of 4 WORDS / 16 bytes.
41  **********************************************************************************************************************/
HW_SCE_AES_256EcbEncrypt(const uint32_t * InData_Key,const uint32_t num_words,const uint32_t * InData_Text,uint32_t * OutData_Text)42 fsp_err_t HW_SCE_AES_256EcbEncrypt (const uint32_t * InData_Key,
43                                     const uint32_t   num_words,
44                                     const uint32_t * InData_Text,
45                                     uint32_t       * OutData_Text)
46 {
47     hw_sc324_aes_ctrl_t aesCtrl;
48 
49     aesCtrl.encrypt_flag = SC324_AES_ENCRYPT;
50     aesCtrl.keysize      = SC324_AES_KEYSIZE_256;
51     aesCtrl.mode         = SC324_AES_ECB;
52 
53     return hw_sc324_aes_kernel_process_data(&aesCtrl, InData_Key, NULL, num_words, InData_Text, OutData_Text, NULL);
54 }
55