32 #ifndef yaSSL_CRYPTO_WRAPPER_HPP
33 #define yaSSL_CRYPTO_WRAPPER_HPP
35 #include "yassl_types.hpp"
45 virtual void get_digest(byte*) = 0;
46 virtual void get_digest(byte*,
const byte*,
unsigned int) = 0;
47 virtual void update(
const byte*,
unsigned int) = 0;
48 virtual uint get_digestSize()
const = 0;
49 virtual uint get_padSize()
const = 0;
56 void get_digest(byte*);
57 void get_digest(byte*,
const byte*,
unsigned int);
58 void update(
const byte*,
unsigned int);
59 uint get_digestSize()
const;
60 uint get_padSize()
const;
67 void get_digest(byte*);
68 void get_digest(byte*,
const byte*,
unsigned int);
69 void update(
const byte*,
unsigned int);
70 uint get_digestSize()
const;
71 uint get_padSize()
const;
75 MD5& operator=(
const MD5&);
85 void get_digest(byte*);
86 void get_digest(byte*,
const byte*,
unsigned int);
87 void update(
const byte*,
unsigned int);
88 uint get_digestSize()
const;
89 uint get_padSize()
const;
93 SHA& operator=(
const SHA&);
104 void get_digest(byte*);
105 void get_digest(byte*,
const byte*,
unsigned int);
106 void update(
const byte*,
unsigned int);
107 uint get_digestSize()
const;
108 uint get_padSize()
const;
112 RMD& operator=(
const RMD&);
123 void get_digest(byte*);
124 void get_digest(byte*,
const byte*,
unsigned int);
125 void update(
const byte*,
unsigned int);
126 uint get_digestSize()
const;
127 uint get_padSize()
const;
128 HMAC_MD5(
const byte*,
unsigned int);
142 void get_digest(byte*);
143 void get_digest(byte*,
const byte*,
unsigned int);
144 void update(
const byte*,
unsigned int);
145 uint get_digestSize()
const;
146 uint get_padSize()
const;
147 HMAC_SHA(
const byte*,
unsigned int);
161 void get_digest(byte*);
162 void get_digest(byte*,
const byte*,
unsigned int);
163 void update(
const byte*,
unsigned int);
164 uint get_digestSize()
const;
165 uint get_padSize()
const;
166 HMAC_RMD(
const byte*,
unsigned int);
180 virtual void encrypt(byte*,
const byte*,
unsigned int) = 0;
181 virtual void decrypt(byte*,
const byte*,
unsigned int) = 0;
182 virtual void set_encryptKey(
const byte*,
const byte* = 0) = 0;
183 virtual void set_decryptKey(
const byte*,
const byte* = 0) = 0;
184 virtual uint get_blockSize()
const = 0;
185 virtual int get_keySize()
const = 0;
186 virtual int get_ivSize()
const = 0;
193 void encrypt(byte*,
const byte*,
unsigned int) {}
194 void decrypt(byte*,
const byte*,
unsigned int) {}
195 void set_encryptKey(
const byte*,
const byte*) {}
196 void set_decryptKey(
const byte*,
const byte*) {}
197 uint get_blockSize()
const {
return 0; }
198 int get_keySize()
const {
return 0; }
199 int get_ivSize()
const {
return 0; }
206 void encrypt(byte*,
const byte*,
unsigned int);
207 void decrypt(byte*,
const byte*,
unsigned int);
208 void set_encryptKey(
const byte*,
const byte*);
209 void set_decryptKey(
const byte*,
const byte*);
210 uint get_blockSize()
const {
return DES_BLOCK; }
211 int get_keySize()
const {
return DES_KEY_SZ; }
212 int get_ivSize()
const {
return DES_IV_SZ; }
220 DES& operator=(
const DES&);
227 void encrypt(byte*,
const byte*,
unsigned int);
228 void decrypt(byte*,
const byte*,
unsigned int);
229 void set_encryptKey(
const byte*,
const byte*);
230 void set_decryptKey(
const byte*,
const byte*);
231 uint get_blockSize()
const {
return DES_BLOCK; }
232 int get_keySize()
const {
return DES_EDE_KEY_SZ; }
233 int get_ivSize()
const {
return DES_IV_SZ; }
248 void encrypt(byte*,
const byte*,
unsigned int);
249 void decrypt(byte*,
const byte*,
unsigned int);
250 void set_encryptKey(
const byte*,
const byte*);
251 void set_decryptKey(
const byte*,
const byte*);
252 uint get_blockSize()
const {
return 0; }
253 int get_keySize()
const {
return RC4_KEY_SZ; }
254 int get_ivSize()
const {
return 0; }
262 RC4& operator=(
const RC4&);
269 void encrypt(byte*,
const byte*,
unsigned int);
270 void decrypt(byte*,
const byte*,
unsigned int);
271 void set_encryptKey(
const byte*,
const byte*);
272 void set_decryptKey(
const byte*,
const byte*);
273 uint get_blockSize()
const {
return AES_BLOCK_SZ; }
274 int get_keySize()
const;
275 int get_ivSize()
const {
return AES_IV_SZ; }
276 explicit AES(
unsigned int = AES_128_KEY_SZ);
283 AES& operator=(
const AES&);
290 void Fill(opaque* dst, uint sz)
const;
294 int GetError()
const;
310 virtual void sign(byte*,
const byte*,
unsigned int,
const RandomPool&) = 0;
311 virtual bool verify(
const byte*,
unsigned int,
const byte*,
313 virtual uint get_signatureLength()
const = 0;
320 void sign(byte*,
const byte*,
unsigned int,
const RandomPool&) {}
321 bool verify(
const byte*,
unsigned int,
const byte*,
unsigned int)
329 void sign(byte*,
const byte*,
unsigned int,
const RandomPool&);
330 bool verify(
const byte*,
unsigned int,
const byte*,
unsigned int);
331 uint get_signatureLength()
const;
332 DSS(
const byte*,
unsigned int,
bool publicKey =
true);
339 DSS& operator=(
const DSS&);
346 void sign(byte*,
const byte*,
unsigned int,
const RandomPool&);
347 bool verify(
const byte*,
unsigned int,
const byte*,
unsigned int);
348 void encrypt(byte*,
const byte*,
unsigned int,
const RandomPool&);
349 void decrypt(byte*,
const byte*,
unsigned int,
const RandomPool&);
350 uint get_signatureLength()
const;
351 uint get_cipherLength()
const;
352 RSA(
const byte*,
unsigned int,
bool publicKey =
true);
359 RSA& operator=(
const RSA&);
369 DiffieHellman(
const byte*,
unsigned int,
const byte*,
unsigned int,
370 const byte*,
unsigned int,
const RandomPool& random);
378 uint get_agreedKeyLength()
const;
379 const byte* get_agreedKey()
const;
380 const byte* get_publicKey()
const;
381 void makeAgreement(
const byte*,
unsigned int);
383 void set_sizes(
int&,
int&,
int&)
const;
384 void get_parms(byte*, byte*, byte*)
const;
400 void assign(
const byte*,
unsigned int);
413 enum { IV_SZ = 32, NAME_SZ = 80 };
427 #endif // yaSSL_CRYPTO_WRAPPER_HPP