Mixe for Privacy and Anonymity in the Internet
CASymChannelCipher.hpp
Go to the documentation of this file.
1 /*
2 Copyright (c) 2000, The JAP-Team
3 All rights reserved.
4 Redistribution and use in source and binary forms, with or without modification,
5 are permitted provided that the following conditions are met:
6 
7  - Redistributions of source code must retain the above copyright notice,
8  this list of conditions and the following disclaimer.
9 
10  - Redistributions in binary form must reproduce the above copyright
11 notice,
12  this list of conditions and the following disclaimer in the
13 documentation and/or
14  other materials provided with the distribution.
15 
16  - Neither the name of the University of Technology Dresden, Germany nor
17 the names of its contributors
18  may be used to endorse or promote products derived from this software
19 without specific
20  prior written permission.
21 
22 
23 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
24 AND ANY EXPRESS
25 OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
26 MERCHANTABILITY
27 AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
28 REGENTS OR CONTRIBUTORS
29 BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 CONSEQUENTIAL DAMAGES
31 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
32 LOSS OF USE, DATA,
33 OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34 LIABILITY, WHETHER
35 IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
36 ARISING IN ANY WAY
37 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
38 DAMAGE
39 */
40 #ifndef __CAASYMCHANNELCIPHER__
41 #define __CAASYMCHANNELCIPHER__
42 #include "CALockAble.hpp"
43 /*
44 #ifdef SYM_CHANNEL_CIPHER_CTR
45 #define CASymChannelCipher CASymCipherCTR
46 #include "CASymCipherCTR.hpp"
47 
48 
49 #else
50 #define CASymChannelCipher CASymCipherOFB
51 #endif
52 
53 #define CASymCipherMuxSocket CASymCipherOFB
54 #include "CASymCipherOFB.hpp"
55 */
56 
57 const UINT8* const SYMCHANNELCIPHER_ALG_NAME_OFB = (const UINT8* const) "AES/OFB/ANON";
58 const UINT8* const SYMCHANNELCIPHER_ALG_NAME_CTR = (const UINT8* const) "AES/CTR";
59 const UINT8* const SYMCHANNELCIPHER_ALG_NAME_NULL = (const UINT8* const) "NULL";
60 
62 
64  #if !defined ONLY_LOCAL_PROXY || defined INCLUDE_MIDDLE_MIX
65  :public CALockAble
66 #endif
67  {
68  public:
69 
70 
72  {
73  switch (alg)
74  {
75  case OFB:
77  case CTR:
79  case NULL_CIPHER:
81  case UNDEFINED_CIPHER:
82  return NULL;
83  }
84  return NULL;
85  }
86 
87  virtual SINT32 crypt1(const UINT8* in,UINT8* out,UINT32 len)=0;
88  virtual SINT32 crypt2(const UINT8* in,UINT8* out,UINT32 len)=0;
90  virtual SINT32 setKey(const UINT8* key)=0;
93  virtual SINT32 setKeys(const UINT8* key,UINT32 keysize)=0;
94 
99  virtual SINT32 setIVs(const UINT8* p_iv) = 0;
100 
105  virtual SINT32 setIV2(const UINT8* p_iv) = 0;
106 
107  virtual bool isKeyValid()=0;
108 
109  };
110 
111 
112 #define CASymCipherMuxSocket CASymChannelCipher
113 
114 
115 
116 #endif //__CAASYMCHANNELCIPHER__
SYMCHANNELCIPHER_ALGORITHM
@ NULL_CIPHER
@ UNDEFINED_CIPHER
const UINT8 *const SYMCHANNELCIPHER_ALG_NAME_OFB
const UINT8 *const SYMCHANNELCIPHER_ALG_NAME_NULL
const UINT8 *const SYMCHANNELCIPHER_ALG_NAME_CTR
#define INCLUDE_MIDDLE_MIX
Definition: StdAfx.h:276
signed int SINT32
Definition: basetypedefs.h:132
unsigned char UINT8
Definition: basetypedefs.h:135
unsigned int UINT32
Definition: basetypedefs.h:131
From this class other classes could be derived, which need some kind from "locking" in memory.
Definition: CALockAble.hpp:41
virtual bool isKeyValid()=0
virtual SINT32 setKeys(const UINT8 *key, UINT32 keysize)=0
Sets the keys for crypt1() and crypt2() either to the same key (if keysize==KEY_SIZE) or to different...
static const UINT8 *const getAlgorithmName(SYMCHANNELCIPHER_ALGORITHM alg)
virtual SINT32 setIV2(const UINT8 *p_iv)=0
Sets iv2 to p_iv.
virtual SINT32 crypt2(const UINT8 *in, UINT8 *out, UINT32 len)=0
virtual SINT32 setKey(const UINT8 *key)=0
Sets the keys for crypt1() and crypt2() to the same key.
virtual SINT32 setIVs(const UINT8 *p_iv)=0
Sets iv1 and iv2 to p_iv.
virtual SINT32 crypt1(const UINT8 *in, UINT8 *out, UINT32 len)=0
UINT16 len
Definition: typedefs.hpp:0