-/* crypto/evp/evp_lib.c */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
return ctx->cipher_data;
}
-/* FIXME: temporary until EVP_CIPHER goes opaque */
-void EVP_CIPHER_CTX_new_cipher_data(EVP_CIPHER_CTX *ctx, size_t size)
+void *EVP_CIPHER_CTX_set_cipher_data(EVP_CIPHER_CTX *ctx, void *cipher_data)
{
- if (ctx->cipher_data == NULL && ctx->cipher->ctx_size == 0)
- ctx->cipher_data = OPENSSL_zalloc(size);
+ void *old_cipher_data;
+
+ old_cipher_data = ctx->cipher_data;
+ ctx->cipher_data = cipher_data;
+
+ return old_cipher_data;
}
int EVP_CIPHER_iv_length(const EVP_CIPHER *cipher)
EVP_MD *EVP_MD_meth_new(int md_type, int pkey_type)
{
- EVP_MD *md = (EVP_MD *)OPENSSL_zalloc(sizeof(EVP_MD));
+ EVP_MD *md = OPENSSL_zalloc(sizeof(*md));
+
if (md != NULL) {
md->type = md_type;
md->pkey_type = pkey_type;
EVP_MD *EVP_MD_meth_dup(const EVP_MD *md)
{
EVP_MD *to = EVP_MD_meth_new(md->type, md->pkey_type);
- if (md != NULL)
+
+ if (to != NULL)
memcpy(to, md, sizeof(*to));
return to;
}