-hashkit_string_st *aes_encrypt(encryption_context_t *crypto_context, const unsigned char *source,
- size_t source_length) {
-EVP_CIPHER_CTX *encryption_context = crypto_context->encryption_context;
-int cipher_length = source_length + EVP_CIPHER_CTX_block_size(encryption_context);
-int final_length = 0;
-unsigned char *cipher_text = (unsigned char *) malloc(cipher_length);
-if (cipher_text == NULL) {
- return NULL;
-}
-if (EVP_EncryptInit_ex(encryption_context, NULL, NULL, NULL, NULL) != 1
- || EVP_EncryptUpdate(encryption_context, cipher_text, &cipher_length, source, source_length)
- != 1
- || EVP_EncryptFinal_ex(encryption_context, cipher_text + cipher_length, &final_length) != 1)
-{
- free(cipher_text);
- return NULL;