Change #include filenames from <foo.h> to <openssl.h>.
[openssl.git] / crypto / evp / bio_enc.c
index 6c30ddfc54bc6ca66420c6c291958102696ff64a..9aaba043c9263db6a8c50c30fb0dddc82f7dc893 100644 (file)
@@ -59,8 +59,8 @@
 #include <stdio.h>
 #include <errno.h>
 #include "cryptlib.h"
-#include "buffer.h"
-#include "evp.h"
+#include <openssl/buffer.h>
+#include <openssl/evp.h>
 
 #ifndef NOPROTO
 static int enc_write(BIO *h,char *buf,int num);
@@ -105,13 +105,12 @@ static BIO_METHOD methods_enc=
        enc_free,
        };
 
-BIO_METHOD *BIO_f_cipher()
+BIO_METHOD *BIO_f_cipher(void)
        {
        return(&methods_enc);
        }
 
-static int enc_new(bi)
-BIO *bi;
+static int enc_new(BIO *bi)
        {
        BIO_ENC_CTX *ctx;
 
@@ -131,8 +130,7 @@ BIO *bi;
        return(1);
        }
 
-static int enc_free(a)
-BIO *a;
+static int enc_free(BIO *a)
        {
        BIO_ENC_CTX *b;
 
@@ -147,10 +145,7 @@ BIO *a;
        return(1);
        }
        
-static int enc_read(b,out,outl)
-BIO *b;
-char *out;
-int outl;
+static int enc_read(BIO *b, char *out, int outl)
        {
        int ret=0,i;
        BIO_ENC_CTX *ctx;
@@ -230,10 +225,7 @@ int outl;
        return((ret == 0)?ctx->cont:ret);
        }
 
-static int enc_write(b,in,inl)
-BIO *b;
-char *in;
-int inl;
+static int enc_write(BIO *b, char *in, int inl)
        {
        int ret=0,n,i;
        BIO_ENC_CTX *ctx;
@@ -288,16 +280,13 @@ int inl;
        return(ret);
        }
 
-static long enc_ctrl(b,cmd,num,ptr)
-BIO *b;
-int cmd;
-long num;
-char *ptr;
+static long enc_ctrl(BIO *b, int cmd, long num, char *ptr)
        {
        BIO *dbio;
        BIO_ENC_CTX *ctx,*dctx;
        long ret=1;
        int i;
+       EVP_CIPHER_CTX **c_ctx;
 
        ctx=(BIO_ENC_CTX *)b->ptr;
 
@@ -364,7 +353,11 @@ again:
                ret=BIO_ctrl(b->next_bio,cmd,num,ptr);
                BIO_copy_next_retry(b);
                break;
-
+       case BIO_C_GET_CIPHER_CTX:
+               c_ctx=(EVP_CIPHER_CTX **)ptr;
+               (*c_ctx)= &(ctx->cipher);
+               b->init=1;
+               break;
        case BIO_CTRL_DUP:
                dbio=(BIO *)ptr;
                dctx=(BIO_ENC_CTX *)dbio->ptr;
@@ -398,19 +391,15 @@ EVP_CIPHER_ctx *c;
        }
 */
 
-void BIO_set_cipher(b,c,k,i,e)
-BIO *b;
-EVP_CIPHER *c;
-unsigned char *k;
-unsigned char *i;
-int e;
+void BIO_set_cipher(BIO *b, const EVP_CIPHER *c, unsigned char *k,
+            unsigned char *i, int e)
        {
        BIO_ENC_CTX *ctx;
 
        if (b == NULL) return;
 
        if ((b->callback != NULL) &&
-               (b->callback(b,BIO_CB_CTRL,(char *)c,BIO_CTRL_SET,e,0L) <= 0))
+               (b->callback(b,BIO_CB_CTRL,(const char *)c,BIO_CTRL_SET,e,0L) <= 0))
                return;
 
        b->init=1;
@@ -418,6 +407,6 @@ int e;
        EVP_CipherInit(&(ctx->cipher),c,k,i,e);
        
        if (b->callback != NULL)
-               b->callback(b,BIO_CB_CTRL,(char *)c,BIO_CTRL_SET,e,1L);
+               b->callback(b,BIO_CB_CTRL,(const char *)c,BIO_CTRL_SET,e,1L);
        }