~ubuntu-branches/debian/jessie/armory/jessie

« back to all changes in this revision

Viewing changes to cppForSwig/cryptopp/gost.h

  • Committer: Package Import Robot
  • Author(s): Joseph Bisch
  • Date: 2014-10-07 10:22:45 UTC
  • Revision ID: package-import@ubuntu.com-20141007102245-2s3x3rhjxg689hek
Tags: upstream-0.92.3
ImportĀ upstreamĀ versionĀ 0.92.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef CRYPTOPP_GOST_H
 
2
#define CRYPTOPP_GOST_H
 
3
 
 
4
/** \file
 
5
*/
 
6
 
 
7
#include "seckey.h"
 
8
#include "secblock.h"
 
9
 
 
10
NAMESPACE_BEGIN(CryptoPP)
 
11
 
 
12
//! _
 
13
struct GOST_Info : public FixedBlockSize<8>, public FixedKeyLength<32>
 
14
{
 
15
        static const char *StaticAlgorithmName() {return "GOST";}
 
16
};
 
17
 
 
18
/// <a href="http://www.weidai.com/scan-mirror/cs.html#GOST">GOST</a>
 
19
class GOST : public GOST_Info, public BlockCipherDocumentation
 
20
{
 
21
        class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<GOST_Info>
 
22
        {
 
23
        public:
 
24
                void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs &params);
 
25
 
 
26
        protected:
 
27
                static void PrecalculateSTable();
 
28
 
 
29
                static const byte sBox[8][16];
 
30
                static volatile bool sTableCalculated;
 
31
                static word32 sTable[4][256];
 
32
 
 
33
                FixedSizeSecBlock<word32, 8> key;
 
34
        };
 
35
 
 
36
        class CRYPTOPP_NO_VTABLE Enc : public Base
 
37
        {
 
38
        public:
 
39
                void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
 
40
        };
 
41
 
 
42
        class CRYPTOPP_NO_VTABLE Dec : public Base
 
43
        {
 
44
        public:
 
45
                void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
 
46
        };
 
47
 
 
48
public:
 
49
        typedef BlockCipherFinal<ENCRYPTION, Enc> Encryption;
 
50
        typedef BlockCipherFinal<DECRYPTION, Dec> Decryption;
 
51
};
 
52
 
 
53
typedef GOST::Encryption GOSTEncryption;
 
54
typedef GOST::Decryption GOSTDecryption;
 
55
 
 
56
NAMESPACE_END
 
57
 
 
58
#endif