Update the dasync engine to add a pipeline cipher
[openssl.git] / crypto / evp / evp_lib.c
index cc91d44d31eb50fbf35a7a6ed5d96676bf7b9f1f..7135381a21a0898c35f740f62d0b906d16ca208e 100644 (file)
@@ -1,4 +1,3 @@
-/* crypto/evp/evp_lib.c */
 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
  * All rights reserved.
  *
@@ -221,6 +220,11 @@ int EVP_CIPHER_CTX_block_size(const EVP_CIPHER_CTX *ctx)
     return ctx->cipher->block_size;
 }
 
+int EVP_CIPHER_impl_ctx_size(const EVP_CIPHER *e)
+{
+    return e->ctx_size;
+}
+
 int EVP_Cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
                const unsigned char *in, unsigned int inl)
 {
@@ -242,11 +246,6 @@ unsigned long EVP_CIPHER_flags(const EVP_CIPHER *cipher)
     return cipher->flags;
 }
 
-unsigned long EVP_CIPHER_CTX_flags(const EVP_CIPHER_CTX *ctx)
-{
-    return ctx->cipher->flags;
-}
-
 void *EVP_CIPHER_CTX_get_app_data(const EVP_CIPHER_CTX *ctx)
 {
     return ctx->app_data;
@@ -262,11 +261,14 @@ void *EVP_CIPHER_CTX_cipher_data(const EVP_CIPHER_CTX *ctx)
     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)
@@ -360,7 +362,8 @@ unsigned long EVP_MD_flags(const EVP_MD *md)
 
 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;
@@ -370,7 +373,8 @@ EVP_MD *EVP_MD_meth_new(int md_type, int 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;
 }