Test proper GCM IV length handling
[platform/core/security/key-manager.git] / src / manager / crypto / generic-backend / crypto-params.h
1 /*
2  *  Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  *  Licensed under the Apache License, Version 2.0 (the "License");
5  *  you may not use this file except in compliance with the License.
6  *  You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  *  Unless required by applicable law or agreed to in writing, software
11  *  distributed under the License is distributed on an "AS IS" BASIS,
12  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  *  See the License for the specific language governing permissions and
14  *  limitations under the License
15  */
16 /*
17  * @file       crypto-params.h
18  * @author     Lukasz Kostyra (l.kostyra@samsung.com)
19  * @version    1.0
20  */
21  #pragma once
22
23 namespace CKM {
24 namespace Crypto {
25
26 class Params
27 {
28 public:
29         static const size_t DEFAULT_AES_IV_LEN = 16; // max acceptable size of IV
30         static const size_t DEFAULT_AES_GCM_IV_LEN = 12; // default size of IV in GCM mode
31         static const int DEFAULT_AES_GCM_TAG_LEN_BYTES = 16; // length of AES GCM tag
32         static const int DEFAULT_AES_GCM_TAG_LEN_BITS = DEFAULT_AES_GCM_TAG_LEN_BYTES * 8;
33         static const int DERIVED_KEY_LENGTH = 16; // length of AES key derived from password in bytes
34         static const int DERIVED_KEY_LENGTH_BITS = DERIVED_KEY_LENGTH * 8; // as above, in bits
35         static const int DERIVED_KEY_ITERATIONS = 1024; // iteration count used to derive key
36 };
37
38 } // namespace Crypto
39 } // namespace CKM