sync with tizen_2.0
[platform/framework/native/appfw.git] / src / security / crypto / FSecCrypto_SkipJackCore.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 /**
19  * @file        FSecCrypto_SkipJackCore.h
20  * @brief       This header file contains declarations of SkipJack Core encryption and decryption algorithms.
21  */
22 #ifndef _FSEC_CRYPTO_INTERNAL_SKIPJACKCORE_H_
23 #define _FSEC_CRYPTO_INTERNAL_SKIPJACKCORE_H_
24
25 static const int _SKIPJACK_BLOCK_DATA_SIZE = 8;
26 static const int _SKIPJACK_KEY_LENGTH = 10; // Key length is 10 bytes
27
28
29 namespace Tizen { namespace Security { namespace Crypto
30 {
31
32 struct SkipJackKey
33 {
34         // Number of rounds
35         byte iv[_SKIPJACK_BLOCK_DATA_SIZE];
36         byte keyVal[_SKIPJACK_KEY_LENGTH];
37 };
38
39 class _SkipJackCore
40 {
41
42 public:
43         static void DoCipherCbc(const byte* pIn, byte* pOut, long length, SkipJackKey& ks, const byte* pIv, bool encFlag);
44         static void DoCipherEcb(const byte* pIn, byte* pOut, SkipJackKey& key, bool encFlag);
45         static void Encrypt(unsigned long* pData, SkipJackKey& key);
46         static void Decrypt(unsigned long* pData, SkipJackKey& key);
47
48 private:
49         _SkipJackCore(void);
50         _SkipJackCore(const _SkipJackCore& rhs);
51         _SkipJackCore& operator =(const _SkipJackCore& rhs);
52         ~_SkipJackCore(void);
53
54 }; //_SkipJackCore
55
56 } } } //Tizen::Security::Crypto
57
58 #endif //_FSEC_CRYPTO_INTERNAL_SKIPJACKCORE_H_