From 1d2cf0c30e2d24c53505cd318ad303bade851e10 Mon Sep 17 00:00:00 2001 From: Patrick McHardy Date: Mon, 16 May 2005 21:53:41 -0700 Subject: [PATCH] --- yaml --- r: 1159 b: refs/heads/master c: d0856009dbaf8eca2269d4129bb83940c0d95054 h: refs/heads/master i: 1157: d2d68453a24888eb5629f2686bc4797da2334ef2 1155: a792b82ec63cc34615857a9af955085a9d6e23d3 1151: 26252ed52a24ecfe8a97602f82d5f0311bcd6987 v: v3 --- [refs] | 2 +- trunk/crypto/crypto_null.c | 28 +++++++++++++++------------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/[refs] b/[refs] index 6f855f672e66..61848c826eb0 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: ba32311eb73f624a85a5fc2e043cda8e076f86ef +refs/heads/master: d0856009dbaf8eca2269d4129bb83940c0d95054 diff --git a/trunk/crypto/crypto_null.c b/trunk/crypto/crypto_null.c index f691d31fa9ee..3fcf6e887e87 100644 --- a/trunk/crypto/crypto_null.c +++ b/trunk/crypto/crypto_null.c @@ -21,6 +21,7 @@ #include #include #include +#include #define NULL_KEY_SIZE 0 #define NULL_BLOCK_SIZE 1 @@ -28,11 +29,13 @@ static int null_compress(void *ctx, const u8 *src, unsigned int slen, u8 *dst, unsigned int *dlen) -{ return 0; } - -static int null_decompress(void *ctx, const u8 *src, unsigned int slen, - u8 *dst, unsigned int *dlen) -{ return 0; } +{ + if (slen > *dlen) + return -EINVAL; + memcpy(dst, src, slen); + *dlen = slen; + return 0; +} static void null_init(void *ctx) { } @@ -47,11 +50,10 @@ static int null_setkey(void *ctx, const u8 *key, unsigned int keylen, u32 *flags) { return 0; } -static void null_encrypt(void *ctx, u8 *dst, const u8 *src) -{ } - -static void null_decrypt(void *ctx, u8 *dst, const u8 *src) -{ } +static void null_crypt(void *ctx, u8 *dst, const u8 *src) +{ + memcpy(dst, src, NULL_BLOCK_SIZE); +} static struct crypto_alg compress_null = { .cra_name = "compress_null", @@ -62,7 +64,7 @@ static struct crypto_alg compress_null = { .cra_list = LIST_HEAD_INIT(compress_null.cra_list), .cra_u = { .compress = { .coa_compress = null_compress, - .coa_decompress = null_decompress } } + .coa_decompress = null_compress } } }; static struct crypto_alg digest_null = { @@ -90,8 +92,8 @@ static struct crypto_alg cipher_null = { .cia_min_keysize = NULL_KEY_SIZE, .cia_max_keysize = NULL_KEY_SIZE, .cia_setkey = null_setkey, - .cia_encrypt = null_encrypt, - .cia_decrypt = null_decrypt } } + .cia_encrypt = null_crypt, + .cia_decrypt = null_crypt } } }; MODULE_ALIAS("compress_null");