1 /*
2  * Copyright (C) 2021 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef SMP_AES_ENCRYPTION_H
17 #define SMP_AES_ENCRYPTION_H
18 
19 #include <stdbool.h>
20 #include <stdint.h>
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 #define AES_BLOCK_SIZE 16
27 
28 /**
29  * @brief aes 128 encrypt.
30  *
31  * @param key key data,must be 128bit.
32  * @param keyLen input keyLen, must be 128bit.
33  * @param in Plaintext,can be at most 16 bytes long.
34  * @param inLen Plaintext's length in bytes.
35  * @param out Encrypted data,must be 128bit.
36  * @return Returns <b>0</b> if the operation is success.
37  *         returns <b>-1</b> if the operation is failed.
38  */
39 int SMP_Aes128(
40     const uint8_t *key, const uint8_t keyLen, const uint8_t *in, const uint8_t inLen, uint8_t out[AES_BLOCK_SIZE]);
41 
42 #ifdef __cplusplus
43 }
44 #endif
45 
46 #endif