Changeset 479
- Timestamp:
- 07/23/07 09:28:03
- Files:
-
- openpgpsdk/trunk/include/openpgpsdk/crypto.h (modified) (2 diffs)
- openpgpsdk/trunk/src/advanced/adv_symmetric.c (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
openpgpsdk/trunk/include/openpgpsdk/crypto.h
r473 r479 36 36 typedef void ops_crypt_block_encrypt_t(ops_crypt_t *crypt,void *out, 37 37 const void *in); 38 typedef void ops_crypt_block_decrypt_t(ops_crypt_t *crypt,void *out, 39 const void *in); 38 40 typedef void ops_crypt_finish_t(ops_crypt_t *crypt); 39 41 … … 49 51 ops_crypt_resync_t *decrypt_resync; 50 52 ops_crypt_block_encrypt_t *block_encrypt; 53 ops_crypt_block_decrypt_t *block_decrypt; 51 54 ops_crypt_finish_t *decrypt_finish; 52 55 unsigned char iv[OPS_MAX_BLOCK_SIZE]; openpgpsdk/trunk/src/advanced/adv_symmetric.c
r473 r479 174 174 175 175 static void cast5_encrypt(ops_crypt_t *crypt,void *out,const void *in) 176 { CAST_ecb_encrypt(in,out,crypt->data,1); } 176 { CAST_ecb_encrypt(in,out,crypt->data,CAST_ENCRYPT); } 177 178 static void cast5_decrypt(ops_crypt_t *crypt,void *out,const void *in) 179 { CAST_ecb_encrypt(in,out,crypt->data,CAST_DECRYPT); } 177 180 178 181 #define TRAILER "","","","",0,NULL … … 188 191 std_resync, 189 192 cast5_encrypt, 193 cast5_decrypt, 190 194 std_finish, 191 195 TRAILER … … 206 210 static void idea_block_encrypt(ops_crypt_t *crypt,void *out,const void *in) 207 211 { idea_ecb_encrypt(in,out,crypt->data); } 212 213 static void idea_block_decrypt(ops_crypt_t *crypt,void *out,const void *in) 214 { idea_block_encrypt(crypt,out,in); } 208 215 209 216 static const ops_crypt_t idea= … … 217 224 std_resync, 218 225 idea_block_encrypt, 226 idea_block_decrypt, 219 227 std_finish, 220 228 TRAILER … … 229 237 } 230 238 239 /* 231 240 static void aes_block_encrypt(ops_crypt_t *crypt,void *out,const void *in) 232 241 { AES_encrypt(in,out,crypt->data); } 242 */ 243 244 static void aes_block_encrypt(ops_crypt_t *crypt,void *out,const void *in) 245 { AES_ecb_encrypt(in,out,crypt->data, AES_ENCRYPT); } 246 247 static void aes_block_decrypt(ops_crypt_t *crypt,void *out,const void *in) 248 { AES_ecb_encrypt(in,out,crypt->data, AES_DECRYPT); } 233 249 234 250 static const ops_crypt_t aes256= … … 242 258 std_resync, 243 259 aes_block_encrypt, 260 aes_block_decrypt, 244 261 std_finish, 245 262 TRAILER … … 263 280 DES_key_schedule *keys=crypt->data; 264 281 265 DES_ecb3_encrypt((void *)in,out,&keys[0],&keys[1],&keys[2],1); 282 DES_ecb3_encrypt((void *)in,out,&keys[0],&keys[1],&keys[2],DES_ENCRYPT); 283 } 284 285 static void tripledes_block_decrypt(ops_crypt_t *crypt,void *out, 286 const void *in) 287 { 288 DES_key_schedule *keys=crypt->data; 289 290 DES_ecb3_encrypt((void *)in,out,&keys[0],&keys[1],&keys[2],DES_DECRYPT); 266 291 } 267 292 … … 276 301 std_resync, 277 302 tripledes_block_encrypt, 303 tripledes_block_decrypt, 278 304 std_finish, 279 305 TRAILER … … 332 358 void ops_encrypt_init(ops_crypt_t * encrypt) 333 359 { 360 return ops_decrypt_init(encrypt); 334 361 // \todo does there need to be both a ops_encrypt_init and a ops_decrypt_init? 335 362 encrypt->base_init(encrypt);
