Add functions to allow setting and adding external EVP_PKEY_METHOD.
[openssl.git] / crypto / evp / e_null.c
index 0d31a66..5205259 100644 (file)
 #include <openssl/evp.h>
 #include <openssl/objects.h>
 
-static void null_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key,
-       unsigned char *iv,int enc);
-static void null_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
-       unsigned char *in, unsigned int inl);
-static EVP_CIPHER n_cipher=
+static int null_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
+       const unsigned char *iv,int enc);
+static int null_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
+       const unsigned char *in, unsigned int inl);
+static const EVP_CIPHER n_cipher=
        {
        NID_undef,
        1,0,0,
@@ -76,24 +76,27 @@ static EVP_CIPHER n_cipher=
        0,
        NULL,
        NULL,
+       NULL,
        NULL
        };
 
-EVP_CIPHER *EVP_enc_null(void)
+const EVP_CIPHER *EVP_enc_null(void)
        {
        return(&n_cipher);
        }
 
-static void null_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key,
-            unsigned char *iv, int enc)
+static int null_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
+            const unsigned char *iv, int enc)
        {
-       memset(&(ctx->c),0,sizeof(ctx->c));
+       /*      memset(&(ctx->c),0,sizeof(ctx->c));*/
+       return 1;
        }
 
-static void null_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
-            unsigned char *in, unsigned int inl)
+static int null_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
+            const unsigned char *in, unsigned int inl)
        {
        if (in != out)
-               memcpy((char *)out,(char *)in,(int)inl);
+               memcpy((char *)out,(const char *)in,(size_t)inl);
+       return 1;
        }