Pol  Revision:cb584c9
cryptbase.cpp
Go to the documentation of this file.
1 //
3 // crypt/cryptbase.cpp
4 //
5 // Author: Beosil <beosil@swileys.com>
6 // Date: 18. Apr. 2000
7 //
8 // Converted: Myrathi <tjh@myrathi.co.uk>
9 // Date: 03. Jan. 2003
10 //
11 // Copyright (C) 1999-2000 Bruno 'Beosil' Heidelberger
12 //
13 // This program is free software; you can redistribute it and/or modify
14 // it under the terms of the GNU General Public License as published by
15 // the Free Software Foundation; either version 2 of the License, or
16 // (at your option) any later version.
17 //
18 // This program is distributed in the hope that it will be useful,
19 // but WITHOUT ANY WARRANTY; without even the implied warranty of
20 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 // GNU General Public License for more details.
22 //
23 // You should have received a copy of the GNU General Public License
24 // along with this program; if not, write to the Free Software
25 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 //
27 //
28 // History:
29 // - 03. Jan. 2003 : Updated for use alongside POL's multi-encryption code.
30 // - 18. Apr. 2000 : Keys updated for client 2.0.0
31 // - 27. Jan. 2000 : Keys updated for client 1.26.4
32 // - 18. Jan. 2000 : Keys updated for client 1.26.3
33 // - 23. Nov. 1999 : Keys updated for client 1.26.2 and some compatibility fixes
34 // - 21. Sep. 1999 : Full redesign to fix the "21036 bytes"-bug
35 // - 9. Sep. 1999 : Keys updated for client 1.26.1
36 // - 2. Sep. 1999 : Keys and boxes updated for client 1.26.0b and minor bugfixes
37 // - 13. Aug. 1999 : First release, working with client 1.26.0(a)
38 //
40 
41 #include <string.h>
42 
43 #include "cryptbase.h"
44 
45 namespace Pol
46 {
47 namespace Crypt
48 {
49 // The following tables must be implimented by the relevant derived classes:
50 //
51 // Crypt Boxes
52 // Crypt Tables
53 // Key Table
54 // Seed Table
55 // Compression Table
56 
57 // Macro Definitions ( to avoid big-/little-endian problems )
58 #define N2L( C, LL ) \
59  LL = ( (unsigned int)( *( ( C )++ ) ) ) << 24, LL |= ( (unsigned int)( *( ( C )++ ) ) ) << 16, \
60  LL |= ( (unsigned int)( *( ( C )++ ) ) ) << 8, LL |= ( (unsigned int)( *( ( C )++ ) ) )
61 #define L2N( LL, C ) \
62  *( ( C )++ ) = (unsigned char)( ( ( LL ) >> 24 ) & 0xff ), \
63  *( ( C )++ ) = (unsigned char)( ( ( LL ) >> 16 ) & 0xff ), \
64  *( ( C )++ ) = (unsigned char)( ( ( LL ) >> 8 ) & 0xff ), \
65  *( ( C )++ ) = (unsigned char)( ( ( LL ) ) & 0xff )
66 #define ROUND( LL, R, S, P ) \
67  LL ^= P; \
68  LL ^= ( ( S[( R >> 24 )] + S[0x0100 + ( ( R >> 16 ) & 0xff )] ) ^ \
69  S[0x0200 + ( ( R >> 8 ) & 0xff )] ) + \
70  S[0x0300 + ( (R)&0xff )]
71 
72 
73 // Constructor / Destructor
76 
77 // Constructor / Destructor
78 CCryptBaseCrypt::CCryptBaseCrypt() : CCryptBase(), lcrypt(), m_type( 0 )
79 {
80  memset( &m_masterKey, 0, sizeof( m_masterKey ) );
81  memset( &encrypted_data, 0, sizeof( encrypted_data ) );
82 }
84 }
85 }
unsigned int m_masterKey[2]
Definition: cryptbase.h:123
unsigned char encrypted_data[MAXBUFFER]
Definition: cryptbase.h:124
Definition: berror.cpp:12