Merge "Update deprecated libprivilege-control API functions." into tizen
[platform/framework/native/appfw.git] / src / security / crypto / FSecCrypto_SkipJackCore.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_SkipJackCore.h
19  * @brief       This header file contains declarations of SkipJack Core encryption and decryption algorithms.
20  */
21 #ifndef _FSEC_CRYPTO_INTERNAL_SKIPJACKCORE_H_
22 #define _FSEC_CRYPTO_INTERNAL_SKIPJACKCORE_H_
23
24 static const int _SKIPJACK_BLOCK_DATA_SIZE = 8;
25 static const int _SKIPJACK_KEY_LENGTH = 10; // Key length is 10 bytes
26
27
28 namespace Tizen { namespace Security { namespace Crypto
29 {
30
31 struct SkipJackKey
32 {
33         // Number of rounds
34         byte iv[_SKIPJACK_BLOCK_DATA_SIZE];
35         byte keyVal[_SKIPJACK_KEY_LENGTH];
36 };
37
38 class _SkipJackCore
39 {
40
41 public:
42         static void DoCipherCbc(const byte* pIn, byte* pOut, long length, SkipJackKey& ks, const byte* pIv, bool encFlag);
43         static void DoCipherEcb(const byte* pIn, byte* pOut, SkipJackKey& key, bool encFlag);
44         static void Encrypt(unsigned long* pData, SkipJackKey& key);
45         static void Decrypt(unsigned long* pData, SkipJackKey& key);
46
47 private:
48         _SkipJackCore(void);
49         _SkipJackCore(const _SkipJackCore& rhs);
50         _SkipJackCore& operator =(const _SkipJackCore& rhs);
51         ~_SkipJackCore(void);
52
53 }; //_SkipJackCore
54
55 } } } //Tizen::Security::Crypto
56
57 #endif //_FSEC_CRYPTO_INTERNAL_SKIPJACKCORE_H_