aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/crypto/des_s390.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/s390/crypto/des_s390.c')
-rw-r--r--arch/s390/crypto/des_s390.c42
1 files changed, 21 insertions, 21 deletions
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
47static int des_setkey(void *ctx, const u8 *key, unsigned int keylen, 47static 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
60static void des_encrypt(void *ctx, u8 *out, const u8 *in) 60static 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
67static void des_decrypt(void *ctx, u8 *out, const u8 *in) 67static 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 */
169static int des3_128_setkey(void *ctx, const u8 *key, unsigned int keylen, 169static 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
189static void des3_128_encrypt(void *ctx, u8 *dst, const u8 *src) 189static 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
197static void des3_128_decrypt(void *ctx, u8 *dst, const u8 *src) 197static 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 */
305static int des3_192_setkey(void *ctx, const u8 *key, unsigned int keylen, 305static 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
328static void des3_192_encrypt(void *ctx, u8 *dst, const u8 *src) 328static 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
336static void des3_192_decrypt(void *ctx, u8 *dst, const u8 *src) 336static 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);