Browse Source

fix fake cipher

pull/196/merge
Max Lv 10 years ago
parent
commit
561c28b573
1 changed files with 3 additions and 6 deletions
  1. 9
      src/encrypt.c

9
src/encrypt.c

@ -990,20 +990,17 @@ void enc_key_init(int method, const char *pass)
OpenSSL_add_all_algorithms(); OpenSSL_add_all_algorithms();
#endif #endif
#if defined(USE_CRYPTO_POLARSSL) && defined(USE_CRYPTO_APPLECC)
cipher_kt_t cipher_info;
#endif
uint8_t iv[MAX_IV_LENGTH]; uint8_t iv[MAX_IV_LENGTH];
cipher_kt_t *cipher; cipher_kt_t *cipher;
cipher_kt_t cipher_info;
if (method == SALSA20 || method == CHACHA20) { if (method == SALSA20 || method == CHACHA20) {
if (sodium_init() == -1) { if (sodium_init() == -1) {
FATAL("Failed to initialize sodium"); FATAL("Failed to initialize sodium");
} }
// Fake cipher // Fake cipher
cipher = (cipher_kt_t *) get_cipher_type(RC4);
cipher = (cipher_kt_t *)&cipher_info;
#if defined(USE_CRYPTO_OPENSSL) #if defined(USE_CRYPTO_OPENSSL)
cipher->key_len = supported_ciphers_key_size[method]; cipher->key_len = supported_ciphers_key_size[method];
cipher->iv_len = supported_ciphers_iv_size[method]; cipher->iv_len = supported_ciphers_iv_size[method];
@ -1024,7 +1021,7 @@ void enc_key_init(int method, const char *pass)
cipher_info.base = NULL; cipher_info.base = NULL;
cipher_info.key_length = supported_ciphers_key_size[method] * 8; cipher_info.key_length = supported_ciphers_key_size[method] * 8;
cipher_info.iv_size = supported_ciphers_iv_size[method]; cipher_info.iv_size = supported_ciphers_iv_size[method];
cipher = (const cipher_kt_t *)&cipher_info;
cipher = (cipher_kt_t *)&cipher_info;
break; break;
} }
#endif #endif

Loading…
Cancel
Save