X-Git-Url: http://ftp.safe.ca/?a=blobdiff_plain;f=crypto%2Fanubis.c;h=77530d571c961daf18abc05bbc1e8adc4ea195fd;hb=f3d56144c86beb25c7d206efa66d6efba908371c;hp=7e2e1a29800e372e618d3592802e6294a76dade5;hpb=6c2bb98bc33ae33c7a33a133a4cd5a06395fece5;p=safe%2Fjmp%2Flinux-2.6 diff --git a/crypto/anubis.c b/crypto/anubis.c index 7e2e1a2..77530d5 100644 --- a/crypto/anubis.c +++ b/crypto/anubis.c @@ -33,7 +33,6 @@ #include #include #include -#include #include #include @@ -461,22 +460,22 @@ static const u32 rc[] = { }; static int anubis_setkey(struct crypto_tfm *tfm, const u8 *in_key, - unsigned int key_len, u32 *flags) + unsigned int key_len) { struct anubis_ctx *ctx = crypto_tfm_ctx(tfm); const __be32 *key = (const __be32 *)in_key; + u32 *flags = &tfm->crt_flags; int N, R, i, r; u32 kappa[ANUBIS_MAX_N]; u32 inter[ANUBIS_MAX_N]; - switch (key_len) - { + switch (key_len) { case 16: case 20: case 24: case 28: case 32: case 36: case 40: break; default: *flags |= CRYPTO_TFM_RES_BAD_KEY_LEN; - return - EINVAL; + return -EINVAL; } ctx->key_len = key_len * 8; @@ -530,23 +529,24 @@ static int anubis_setkey(struct crypto_tfm *tfm, const u8 *in_key, /* * compute kappa^{r+1} from kappa^r: */ - if (r == R) { + if (r == R) break; - } for (i = 0; i < N; i++) { int j = i; inter[i] = T0[(kappa[j--] >> 24) ]; - if (j < 0) j = N - 1; + if (j < 0) + j = N - 1; inter[i] ^= T1[(kappa[j--] >> 16) & 0xff]; - if (j < 0) j = N - 1; + if (j < 0) + j = N - 1; inter[i] ^= T2[(kappa[j--] >> 8) & 0xff]; - if (j < 0) j = N - 1; + if (j < 0) + j = N - 1; inter[i] ^= T3[(kappa[j ] ) & 0xff]; } kappa[0] = inter[0] ^ rc[r]; - for (i = 1; i < N; i++) { + for (i = 1; i < N; i++) kappa[i] = inter[i]; - } } /* @@ -687,21 +687,21 @@ static struct crypto_alg anubis_alg = { .cia_decrypt = anubis_decrypt } } }; -static int __init init(void) +static int __init anubis_mod_init(void) { int ret = 0; - + ret = crypto_register_alg(&anubis_alg); return ret; } -static void __exit fini(void) +static void __exit anubis_mod_fini(void) { crypto_unregister_alg(&anubis_alg); } -module_init(init); -module_exit(fini); +module_init(anubis_mod_init); +module_exit(anubis_mod_fini); MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("Anubis Cryptographic Algorithm");