aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390
diff options
context:
space:
mode:
authorJan Glauber <jang@de.ibm.com>2007-10-09 10:43:13 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:55:50 -0400
commit5265eeb2b036835021591173ac64e624baaff55c (patch)
tree0263f8e8db4ead27b6e02f3200e3a1305bbf2080 /arch/s390
parentad5d27899fdbe7a66e57fdf1af883dbd7ff88dac (diff)
[CRYPTO] sha: Add header file for SHA definitions
There are currently several SHA implementations that all define their own initialization vectors and size values. Since this values are idential move them to a header file under include/crypto. Signed-off-by: Jan Glauber <jang@de.ibm.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'arch/s390')
-rw-r--r--arch/s390/crypto/sha1_s390.c14
-rw-r--r--arch/s390/crypto/sha256_s390.c20
2 files changed, 15 insertions, 19 deletions
diff --git a/arch/s390/crypto/sha1_s390.c b/arch/s390/crypto/sha1_s390.c
index 8ebd3cd6bd1f..5a834f6578ab 100644
--- a/arch/s390/crypto/sha1_s390.c
+++ b/arch/s390/crypto/sha1_s390.c
@@ -26,12 +26,10 @@
26#include <linux/init.h> 26#include <linux/init.h>
27#include <linux/module.h> 27#include <linux/module.h>
28#include <linux/crypto.h> 28#include <linux/crypto.h>
29#include <crypto/sha.h>
29 30
30#include "crypt_s390.h" 31#include "crypt_s390.h"
31 32
32#define SHA1_DIGEST_SIZE 20
33#define SHA1_BLOCK_SIZE 64
34
35struct s390_sha1_ctx { 33struct s390_sha1_ctx {
36 u64 count; /* message length */ 34 u64 count; /* message length */
37 u32 state[5]; 35 u32 state[5];
@@ -42,11 +40,11 @@ static void sha1_init(struct crypto_tfm *tfm)
42{ 40{
43 struct s390_sha1_ctx *sctx = crypto_tfm_ctx(tfm); 41 struct s390_sha1_ctx *sctx = crypto_tfm_ctx(tfm);
44 42
45 sctx->state[0] = 0x67452301; 43 sctx->state[0] = SHA1_H0;
46 sctx->state[1] = 0xEFCDAB89; 44 sctx->state[1] = SHA1_H1;
47 sctx->state[2] = 0x98BADCFE; 45 sctx->state[2] = SHA1_H2;
48 sctx->state[3] = 0x10325476; 46 sctx->state[3] = SHA1_H3;
49 sctx->state[4] = 0xC3D2E1F0; 47 sctx->state[4] = SHA1_H4;
50 sctx->count = 0; 48 sctx->count = 0;
51} 49}
52 50
diff --git a/arch/s390/crypto/sha256_s390.c b/arch/s390/crypto/sha256_s390.c
index c728bd0ae1ed..ccf8633c4f65 100644
--- a/arch/s390/crypto/sha256_s390.c
+++ b/arch/s390/crypto/sha256_s390.c
@@ -19,12 +19,10 @@
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/module.h> 20#include <linux/module.h>
21#include <linux/crypto.h> 21#include <linux/crypto.h>
22#include <crypto/sha.h>
22 23
23#include "crypt_s390.h" 24#include "crypt_s390.h"
24 25
25#define SHA256_DIGEST_SIZE 32
26#define SHA256_BLOCK_SIZE 64
27
28struct s390_sha256_ctx { 26struct s390_sha256_ctx {
29 u64 count; /* message length */ 27 u64 count; /* message length */
30 u32 state[8]; 28 u32 state[8];
@@ -35,14 +33,14 @@ static void sha256_init(struct crypto_tfm *tfm)
35{ 33{
36 struct s390_sha256_ctx *sctx = crypto_tfm_ctx(tfm); 34 struct s390_sha256_ctx *sctx = crypto_tfm_ctx(tfm);
37 35
38 sctx->state[0] = 0x6a09e667; 36 sctx->state[0] = SHA256_H0;
39 sctx->state[1] = 0xbb67ae85; 37 sctx->state[1] = SHA256_H1;
40 sctx->state[2] = 0x3c6ef372; 38 sctx->state[2] = SHA256_H2;
41 sctx->state[3] = 0xa54ff53a; 39 sctx->state[3] = SHA256_H3;
42 sctx->state[4] = 0x510e527f; 40 sctx->state[4] = SHA256_H4;
43 sctx->state[5] = 0x9b05688c; 41 sctx->state[5] = SHA256_H5;
44 sctx->state[6] = 0x1f83d9ab; 42 sctx->state[6] = SHA256_H6;
45 sctx->state[7] = 0x5be0cd19; 43 sctx->state[7] = SHA256_H7;
46 sctx->count = 0; 44 sctx->count = 0;
47} 45}
48 46