Merge "Fix accessing freed memory in X509CertificateStore::Update()" into tizen
[platform/framework/native/appfw.git] / src / security / crypto / FSecCrypto_KeaCore.h
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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 /**
18  * @file        FSecCrypto_KeaCore.h
19  * @brief       This header file contains declarations of KEA Key Exchange algorithms and Shared Secret Generation.
20  */
21 #ifndef _FSEC_CRYPTO_INTERNAL_KEA_CORE_H_
22 #define _FSEC_CRYPTO_INTERNAL_KEA_CORE_H_
23
24 struct bignum_st;
25
26 namespace Tizen { namespace Security { namespace Crypto
27 {
28
29 struct Kea
30 {
31         int version;
32         int length;
33         bignum_st* pP;
34         bignum_st* pG;
35         bignum_st* pPubKey1; // y
36         bignum_st* pPrivKey1; // x
37         bignum_st* pPubKey2; // r
38         bignum_st* pPrivKey2; // t
39 };
40
41 class _KeaCore
42 {
43
44 public:
45         static Kea* CreateKeaN(void);
46         static void DeleteKea(Kea* pKea);
47         static result ComputeKeaKey(byte** ppKey, bignum_st* pPublicKey1, bignum_st* pPublicKey2, Kea& keaVar);
48         static byte* ComputeKeaSecret(byte* pKey, int len);
49
50 private:
51         _KeaCore(void);
52         _KeaCore(const _KeaCore& rhs);
53         _KeaCore& operator =(const _KeaCore& rhs);
54         ~_KeaCore(void);
55
56 }; //_KeaCore
57
58 } } } // Tizen::Security::Crypto
59
60 #endif //_FSEC_CRYPTO_INTERNAL_KEA_CORE_H_