add? update
This commit is contained in:
12
server.cpp
12
server.cpp
@@ -45,13 +45,19 @@ int stream_decrypt(unsigned char *ciphertext, int ciphertext_len, unsigned char
|
||||
ctx = EVP_CIPHER_CTX_new();
|
||||
|
||||
/* Initialise the decryption operation. */
|
||||
EVP_DecryptInit_ex(ctx, EVP_aes_256_ctr(), NULL, key, iv);
|
||||
if (EVP_DecryptInit_ex(ctx, EVP_aes_256_ctr(), NULL, key, iv) != 1){
|
||||
ERR_print_errors_fp(stderr);
|
||||
}
|
||||
|
||||
/* Provide the message to be decrypted, and obtain the plaintext output. EVP_DecryptUpdate can be called multiple times if necessary */
|
||||
EVP_DecryptUpdate(ctx, plaintext, &len, ciphertext, ciphertext_len);
|
||||
if (EVP_DecryptUpdate(ctx, plaintext, &len, ciphertext, ciphertext_len) != 1) {
|
||||
ERR_print_errors_fp(stderr);
|
||||
}
|
||||
|
||||
/* Finalize the decryption. Further plaintext bytes may be written at this stage. */
|
||||
EVP_DecryptFinal_ex(ctx, plaintext + len, &plaintext_len);
|
||||
if (EVP_DecryptFinal_ex(ctx, plaintext + len, &plaintext_len) != 1) {
|
||||
ERR_print_errors_fp(stderr);
|
||||
}
|
||||
|
||||
/* Clean up */
|
||||
EVP_CIPHER_CTX_free(ctx);
|
||||
|
||||
Reference in New Issue
Block a user