diff options
Diffstat (limited to 'arch/s390/crypto')
-rw-r--r-- | arch/s390/crypto/aes_s390.c | 14 | ||||
-rw-r--r-- | arch/s390/crypto/des_s390.c | 42 | ||||
-rw-r--r-- | arch/s390/crypto/sha1_s390.c | 15 | ||||
-rw-r--r-- | arch/s390/crypto/sha256_s390.c | 13 |
4 files changed, 42 insertions, 42 deletions
diff --git a/arch/s390/crypto/aes_s390.c b/arch/s390/crypto/aes_s390.c index c5ca2dc5d428..5713c7e5bd16 100644 --- a/arch/s390/crypto/aes_s390.c +++ b/arch/s390/crypto/aes_s390.c | |||
@@ -37,10 +37,10 @@ struct s390_aes_ctx { | |||
37 | int key_len; | 37 | int key_len; |
38 | }; | 38 | }; |
39 | 39 | ||
40 | static int aes_set_key(void *ctx, const u8 *in_key, unsigned int key_len, | 40 | static int aes_set_key(struct crypto_tfm *tfm, const u8 *in_key, |
41 | u32 *flags) | 41 | unsigned int key_len, u32 *flags) |
42 | { | 42 | { |
43 | struct s390_aes_ctx *sctx = ctx; | 43 | struct s390_aes_ctx *sctx = crypto_tfm_ctx(tfm); |
44 | 44 | ||
45 | switch (key_len) { | 45 | switch (key_len) { |
46 | case 16: | 46 | case 16: |
@@ -70,9 +70,9 @@ fail: | |||
70 | return -EINVAL; | 70 | return -EINVAL; |
71 | } | 71 | } |
72 | 72 | ||
73 | static void aes_encrypt(void *ctx, u8 *out, const u8 *in) | 73 | static void aes_encrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in) |
74 | { | 74 | { |
75 | const struct s390_aes_ctx *sctx = ctx; | 75 | const struct s390_aes_ctx *sctx = crypto_tfm_ctx(tfm); |
76 | 76 | ||
77 | switch (sctx->key_len) { | 77 | switch (sctx->key_len) { |
78 | case 16: | 78 | case 16: |
@@ -90,9 +90,9 @@ static void aes_encrypt(void *ctx, u8 *out, const u8 *in) | |||
90 | } | 90 | } |
91 | } | 91 | } |
92 | 92 | ||
93 | static void aes_decrypt(void *ctx, u8 *out, const u8 *in) | 93 | static void aes_decrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in) |
94 | { | 94 | { |
95 | const struct s390_aes_ctx *sctx = ctx; | 95 | const struct s390_aes_ctx *sctx = crypto_tfm_ctx(tfm); |
96 | 96 | ||
97 | switch (sctx->key_len) { | 97 | switch (sctx->key_len) { |
98 | case 16: | 98 | case 16: |
diff --git a/arch/s390/crypto/des_s390.c b/arch/s390/crypto/des_s390.c index e3c37aa0a199..b3f7496a79b4 100644 --- a/arch/s390/crypto/des_s390.c +++ b/arch/s390/crypto/des_s390.c | |||
@@ -44,10 +44,10 @@ struct crypt_s390_des3_192_ctx { | |||
44 | u8 key[DES3_192_KEY_SIZE]; | 44 | u8 key[DES3_192_KEY_SIZE]; |
45 | }; | 45 | }; |
46 | 46 | ||
47 | static int des_setkey(void *ctx, const u8 *key, unsigned int keylen, | 47 | static int des_setkey(struct crypto_tfm *tfm, const u8 *key, |
48 | u32 *flags) | 48 | unsigned int keylen, u32 *flags) |
49 | { | 49 | { |
50 | struct crypt_s390_des_ctx *dctx = ctx; | 50 | struct crypt_s390_des_ctx *dctx = crypto_tfm_ctx(tfm); |
51 | int ret; | 51 | int ret; |
52 | 52 | ||
53 | /* test if key is valid (not a weak key) */ | 53 | /* test if key is valid (not a weak key) */ |
@@ -57,16 +57,16 @@ static int des_setkey(void *ctx, const u8 *key, unsigned int keylen, | |||
57 | return ret; | 57 | return ret; |
58 | } | 58 | } |
59 | 59 | ||
60 | static void des_encrypt(void *ctx, u8 *out, const u8 *in) | 60 | static void des_encrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in) |
61 | { | 61 | { |
62 | struct crypt_s390_des_ctx *dctx = ctx; | 62 | struct crypt_s390_des_ctx *dctx = crypto_tfm_ctx(tfm); |
63 | 63 | ||
64 | crypt_s390_km(KM_DEA_ENCRYPT, dctx->key, out, in, DES_BLOCK_SIZE); | 64 | crypt_s390_km(KM_DEA_ENCRYPT, dctx->key, out, in, DES_BLOCK_SIZE); |
65 | } | 65 | } |
66 | 66 | ||
67 | static void des_decrypt(void *ctx, u8 *out, const u8 *in) | 67 | static void des_decrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in) |
68 | { | 68 | { |
69 | struct crypt_s390_des_ctx *dctx = ctx; | 69 | struct crypt_s390_des_ctx *dctx = crypto_tfm_ctx(tfm); |
70 | 70 | ||
71 | crypt_s390_km(KM_DEA_DECRYPT, dctx->key, out, in, DES_BLOCK_SIZE); | 71 | crypt_s390_km(KM_DEA_DECRYPT, dctx->key, out, in, DES_BLOCK_SIZE); |
72 | } | 72 | } |
@@ -166,11 +166,11 @@ static struct crypto_alg des_alg = { | |||
166 | * Implementers MUST reject keys that exhibit this property. | 166 | * Implementers MUST reject keys that exhibit this property. |
167 | * | 167 | * |
168 | */ | 168 | */ |
169 | static int des3_128_setkey(void *ctx, const u8 *key, unsigned int keylen, | 169 | static int des3_128_setkey(struct crypto_tfm *tfm, const u8 *key, |
170 | u32 *flags) | 170 | unsigned int keylen, u32 *flags) |
171 | { | 171 | { |
172 | int i, ret; | 172 | int i, ret; |
173 | struct crypt_s390_des3_128_ctx *dctx = ctx; | 173 | struct crypt_s390_des3_128_ctx *dctx = crypto_tfm_ctx(tfm); |
174 | const u8* temp_key = key; | 174 | const u8* temp_key = key; |
175 | 175 | ||
176 | if (!(memcmp(key, &key[DES_KEY_SIZE], DES_KEY_SIZE))) { | 176 | if (!(memcmp(key, &key[DES_KEY_SIZE], DES_KEY_SIZE))) { |
@@ -186,17 +186,17 @@ static int des3_128_setkey(void *ctx, const u8 *key, unsigned int keylen, | |||
186 | return 0; | 186 | return 0; |
187 | } | 187 | } |
188 | 188 | ||
189 | static void des3_128_encrypt(void *ctx, u8 *dst, const u8 *src) | 189 | static void des3_128_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) |
190 | { | 190 | { |
191 | struct crypt_s390_des3_128_ctx *dctx = ctx; | 191 | struct crypt_s390_des3_128_ctx *dctx = crypto_tfm_ctx(tfm); |
192 | 192 | ||
193 | crypt_s390_km(KM_TDEA_128_ENCRYPT, dctx->key, dst, (void*)src, | 193 | crypt_s390_km(KM_TDEA_128_ENCRYPT, dctx->key, dst, (void*)src, |
194 | DES3_128_BLOCK_SIZE); | 194 | DES3_128_BLOCK_SIZE); |
195 | } | 195 | } |
196 | 196 | ||
197 | static void des3_128_decrypt(void *ctx, u8 *dst, const u8 *src) | 197 | static void des3_128_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) |
198 | { | 198 | { |
199 | struct crypt_s390_des3_128_ctx *dctx = ctx; | 199 | struct crypt_s390_des3_128_ctx *dctx = crypto_tfm_ctx(tfm); |
200 | 200 | ||
201 | crypt_s390_km(KM_TDEA_128_DECRYPT, dctx->key, dst, (void*)src, | 201 | crypt_s390_km(KM_TDEA_128_DECRYPT, dctx->key, dst, (void*)src, |
202 | DES3_128_BLOCK_SIZE); | 202 | DES3_128_BLOCK_SIZE); |
@@ -302,11 +302,11 @@ static struct crypto_alg des3_128_alg = { | |||
302 | * property. | 302 | * property. |
303 | * | 303 | * |
304 | */ | 304 | */ |
305 | static int des3_192_setkey(void *ctx, const u8 *key, unsigned int keylen, | 305 | static int des3_192_setkey(struct crypto_tfm *tfm, const u8 *key, |
306 | u32 *flags) | 306 | unsigned int keylen, u32 *flags) |
307 | { | 307 | { |
308 | int i, ret; | 308 | int i, ret; |
309 | struct crypt_s390_des3_192_ctx *dctx = ctx; | 309 | struct crypt_s390_des3_192_ctx *dctx = crypto_tfm_ctx(tfm); |
310 | const u8* temp_key = key; | 310 | const u8* temp_key = key; |
311 | 311 | ||
312 | if (!(memcmp(key, &key[DES_KEY_SIZE], DES_KEY_SIZE) && | 312 | if (!(memcmp(key, &key[DES_KEY_SIZE], DES_KEY_SIZE) && |
@@ -325,17 +325,17 @@ static int des3_192_setkey(void *ctx, const u8 *key, unsigned int keylen, | |||
325 | return 0; | 325 | return 0; |
326 | } | 326 | } |
327 | 327 | ||
328 | static void des3_192_encrypt(void *ctx, u8 *dst, const u8 *src) | 328 | static void des3_192_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) |
329 | { | 329 | { |
330 | struct crypt_s390_des3_192_ctx *dctx = ctx; | 330 | struct crypt_s390_des3_192_ctx *dctx = crypto_tfm_ctx(tfm); |
331 | 331 | ||
332 | crypt_s390_km(KM_TDEA_192_ENCRYPT, dctx->key, dst, (void*)src, | 332 | crypt_s390_km(KM_TDEA_192_ENCRYPT, dctx->key, dst, (void*)src, |
333 | DES3_192_BLOCK_SIZE); | 333 | DES3_192_BLOCK_SIZE); |
334 | } | 334 | } |
335 | 335 | ||
336 | static void des3_192_decrypt(void *ctx, u8 *dst, const u8 *src) | 336 | static void des3_192_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) |
337 | { | 337 | { |
338 | struct crypt_s390_des3_192_ctx *dctx = ctx; | 338 | struct crypt_s390_des3_192_ctx *dctx = crypto_tfm_ctx(tfm); |
339 | 339 | ||
340 | crypt_s390_km(KM_TDEA_192_DECRYPT, dctx->key, dst, (void*)src, | 340 | crypt_s390_km(KM_TDEA_192_DECRYPT, dctx->key, dst, (void*)src, |
341 | DES3_192_BLOCK_SIZE); | 341 | DES3_192_BLOCK_SIZE); |
diff --git a/arch/s390/crypto/sha1_s390.c b/arch/s390/crypto/sha1_s390.c index 36bb5346a8c4..9d34a35b1aa5 100644 --- a/arch/s390/crypto/sha1_s390.c +++ b/arch/s390/crypto/sha1_s390.c | |||
@@ -40,9 +40,9 @@ struct crypt_s390_sha1_ctx { | |||
40 | u8 buffer[2 * SHA1_BLOCK_SIZE]; | 40 | u8 buffer[2 * SHA1_BLOCK_SIZE]; |
41 | }; | 41 | }; |
42 | 42 | ||
43 | static void sha1_init(void *ctx_arg) | 43 | static void sha1_init(struct crypto_tfm *tfm) |
44 | { | 44 | { |
45 | struct crypt_s390_sha1_ctx *ctx = ctx_arg; | 45 | struct crypt_s390_sha1_ctx *ctx = crypto_tfm_ctx(tfm); |
46 | static const u32 initstate[5] = { | 46 | static const u32 initstate[5] = { |
47 | 0x67452301, | 47 | 0x67452301, |
48 | 0xEFCDAB89, | 48 | 0xEFCDAB89, |
@@ -56,13 +56,13 @@ static void sha1_init(void *ctx_arg) | |||
56 | ctx->buf_len = 0; | 56 | ctx->buf_len = 0; |
57 | } | 57 | } |
58 | 58 | ||
59 | static void | 59 | static void sha1_update(struct crypto_tfm *tfm, const u8 *data, |
60 | sha1_update(void *ctx, const u8 *data, unsigned int len) | 60 | unsigned int len) |
61 | { | 61 | { |
62 | struct crypt_s390_sha1_ctx *sctx; | 62 | struct crypt_s390_sha1_ctx *sctx; |
63 | long imd_len; | 63 | long imd_len; |
64 | 64 | ||
65 | sctx = ctx; | 65 | sctx = crypto_tfm_ctx(tfm); |
66 | sctx->count += len * 8; //message bit length | 66 | sctx->count += len * 8; //message bit length |
67 | 67 | ||
68 | //anything in buffer yet? -> must be completed | 68 | //anything in buffer yet? -> must be completed |
@@ -111,10 +111,9 @@ pad_message(struct crypt_s390_sha1_ctx* sctx) | |||
111 | } | 111 | } |
112 | 112 | ||
113 | /* Add padding and return the message digest. */ | 113 | /* Add padding and return the message digest. */ |
114 | static void | 114 | static void sha1_final(struct crypto_tfm *tfm, u8 *out) |
115 | sha1_final(void* ctx, u8 *out) | ||
116 | { | 115 | { |
117 | struct crypt_s390_sha1_ctx *sctx = ctx; | 116 | struct crypt_s390_sha1_ctx *sctx = crypto_tfm_ctx(tfm); |
118 | 117 | ||
119 | //must perform manual padding | 118 | //must perform manual padding |
120 | pad_message(sctx); | 119 | pad_message(sctx); |
diff --git a/arch/s390/crypto/sha256_s390.c b/arch/s390/crypto/sha256_s390.c index 2c76e7bee41c..f573df30f31d 100644 --- a/arch/s390/crypto/sha256_s390.c +++ b/arch/s390/crypto/sha256_s390.c | |||
@@ -31,9 +31,9 @@ struct s390_sha256_ctx { | |||
31 | u8 buf[2 * SHA256_BLOCK_SIZE]; | 31 | u8 buf[2 * SHA256_BLOCK_SIZE]; |
32 | }; | 32 | }; |
33 | 33 | ||
34 | static void sha256_init(void *ctx) | 34 | static void sha256_init(struct crypto_tfm *tfm) |
35 | { | 35 | { |
36 | struct s390_sha256_ctx *sctx = ctx; | 36 | struct s390_sha256_ctx *sctx = crypto_tfm_ctx(tfm); |
37 | 37 | ||
38 | sctx->state[0] = 0x6a09e667; | 38 | sctx->state[0] = 0x6a09e667; |
39 | sctx->state[1] = 0xbb67ae85; | 39 | sctx->state[1] = 0xbb67ae85; |
@@ -46,9 +46,10 @@ static void sha256_init(void *ctx) | |||
46 | sctx->count = 0; | 46 | sctx->count = 0; |
47 | } | 47 | } |
48 | 48 | ||
49 | static void sha256_update(void *ctx, const u8 *data, unsigned int len) | 49 | static void sha256_update(struct crypto_tfm *tfm, const u8 *data, |
50 | unsigned int len) | ||
50 | { | 51 | { |
51 | struct s390_sha256_ctx *sctx = ctx; | 52 | struct s390_sha256_ctx *sctx = crypto_tfm_ctx(tfm); |
52 | unsigned int index; | 53 | unsigned int index; |
53 | int ret; | 54 | int ret; |
54 | 55 | ||
@@ -107,9 +108,9 @@ static void pad_message(struct s390_sha256_ctx* sctx) | |||
107 | } | 108 | } |
108 | 109 | ||
109 | /* Add padding and return the message digest */ | 110 | /* Add padding and return the message digest */ |
110 | static void sha256_final(void* ctx, u8 *out) | 111 | static void sha256_final(struct crypto_tfm *tfm, u8 *out) |
111 | { | 112 | { |
112 | struct s390_sha256_ctx *sctx = ctx; | 113 | struct s390_sha256_ctx *sctx = crypto_tfm_ctx(tfm); |
113 | 114 | ||
114 | /* must perform manual padding */ | 115 | /* must perform manual padding */ |
115 | pad_message(sctx); | 116 | pad_message(sctx); |