Browse Source

fix #15

pull/16/merge
Max Lv 11 years ago
parent
commit
a2366da1a6
1 changed files with 1 additions and 1 deletions
  1. 2
      src/encrypt.c

2
src/encrypt.c

@ -262,6 +262,7 @@ char* ss_encrypt(int buf_size, char *plaintext, ssize_t *len, struct enc_ctx *ct
RAND_bytes(iv, iv_len); RAND_bytes(iv, iv_len);
EVP_CipherInit_ex(&ctx->evp, NULL, NULL, enc_key, iv, 1); EVP_CipherInit_ex(&ctx->evp, NULL, NULL, enc_key, iv, 1);
memcpy(ciphertext, iv, iv_len); memcpy(ciphertext, iv, iv_len);
ctx->init = 1;
#ifdef DEBUG #ifdef DEBUG
dump("IV", iv); dump("IV", iv);
#endif #endif
@ -301,7 +302,6 @@ char* ss_decrypt_all(int buf_size, char *ciphertext, ssize_t *len, int method)
{ {
if (method > TABLE) if (method > TABLE)
{ {
const EVP_CIPHER *cipher = EVP_get_cipherbyname(supported_ciphers[method]); const EVP_CIPHER *cipher = EVP_get_cipherbyname(supported_ciphers[method]);
if (cipher == NULL) if (cipher == NULL)
{ {

Loading…
Cancel
Save