Skip to content

Commit

Permalink
crypto: export arc4 defines
Browse files Browse the repository at this point in the history
Some arc4 cipher algorithm defines show up in two places:
crypto/arc4.c and drivers/crypto/bcm/cipher.h.
Let's export them in a common header and update their users.

Signed-off-by: Iuliana Prodan <[email protected]>
Reviewed-by: Horia Geantă <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
iuliana-prodan authored and herbertx committed Feb 15, 2019
1 parent ba4cf71 commit bd30cf5
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
5 changes: 1 addition & 4 deletions crypto/arc4.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,11 @@
*/

#include <crypto/algapi.h>
#include <crypto/arc4.h>
#include <crypto/internal/skcipher.h>
#include <linux/init.h>
#include <linux/module.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;
Expand Down
4 changes: 1 addition & 3 deletions drivers/crypto/bcm/cipher.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <crypto/aes.h>
#include <crypto/internal/hash.h>
#include <crypto/aead.h>
#include <crypto/arc4.h>
#include <crypto/gcm.h>
#include <crypto/sha.h>
#include <crypto/sha3.h>
Expand All @@ -34,9 +35,6 @@
/* Driver supports up to MAX_SPUS SPU blocks */
#define MAX_SPUS 16

#define ARC4_MIN_KEY_SIZE 1
#define ARC4_MAX_KEY_SIZE 256
#define ARC4_BLOCK_SIZE 1
#define ARC4_STATE_SIZE 4

#define CCM_AES_IV_SIZE 16
Expand Down
13 changes: 13 additions & 0 deletions include/crypto/arc4.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/* SPDX-License-Identifier: GPL-2.0+ */
/*
* Common values for ARC4 Cipher Algorithm
*/

#ifndef _CRYPTO_ARC4_H
#define _CRYPTO_ARC4_H

#define ARC4_MIN_KEY_SIZE 1
#define ARC4_MAX_KEY_SIZE 256
#define ARC4_BLOCK_SIZE 1

#endif /* _CRYPTO_ARC4_H */

0 comments on commit bd30cf5

Please sign in to comment.