summaryrefslogtreecommitdiffstats
path: root/include/crypto
diff options
context:
space:
mode:
authorArd Biesheuvel <ard.biesheuvel@linaro.org>2019-06-12 18:19:53 +0200
committerHerbert Xu <herbert@gondor.apana.org.au>2019-06-20 14:18:33 +0800
commitdc51f25752bfcb5f1edbac1ca4ce16af7b3bd507 (patch)
tree063eb09177d3abc17deaaae732dd011592f5f573 /include/crypto
parent192125ed5ce62afba24312d8e7a0314577565b4a (diff)
downloadlinux-dc51f25752bfcb5f1edbac1ca4ce16af7b3bd507.tar.bz2
crypto: arc4 - refactor arc4 core code into separate library
Refactor the core rc4 handling so we can move most users to a library interface, permitting us to drop the cipher interface entirely in a future patch. This is part of an effort to simplify the crypto API and improve its robustness against incorrect use. Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'include/crypto')
-rw-r--r--include/crypto/arc4.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/crypto/arc4.h b/include/crypto/arc4.h
index 5b2c24ab0139..f3c22fe01704 100644
--- a/include/crypto/arc4.h
+++ b/include/crypto/arc4.h
@@ -6,8 +6,18 @@
#ifndef _CRYPTO_ARC4_H
#define _CRYPTO_ARC4_H
+#include <linux/types.h>
+
#define ARC4_MIN_KEY_SIZE 1
#define ARC4_MAX_KEY_SIZE 256
#define ARC4_BLOCK_SIZE 1
+struct arc4_ctx {
+ u32 S[256];
+ u32 x, y;
+};
+
+int arc4_setkey(struct arc4_ctx *ctx, const u8 *in_key, unsigned int key_len);
+void arc4_crypt(struct arc4_ctx *ctx, u8 *out, const u8 *in, unsigned int len);
+
#endif /* _CRYPTO_ARC4_H */