aes-glue.c (3eb66e91a25497065c5322b1268cbc3953642227) aes-glue.c (e52b7023cdad005756cd91d7c54fa90ef6b43d32)
1/*
2 * linux/arch/arm64/crypto/aes-glue.c - wrapper code for ARMv8 AES
3 *
4 * Copyright (C) 2013 - 2017 Linaro Ltd <ard.biesheuvel@linaro.org>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.

--- 391 unchanged lines hidden (view full) ---

400 return err;
401}
402
403static int ctr_encrypt_sync(struct skcipher_request *req)
404{
405 struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req);
406 struct crypto_aes_ctx *ctx = crypto_skcipher_ctx(tfm);
407
1/*
2 * linux/arch/arm64/crypto/aes-glue.c - wrapper code for ARMv8 AES
3 *
4 * Copyright (C) 2013 - 2017 Linaro Ltd <ard.biesheuvel@linaro.org>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.

--- 391 unchanged lines hidden (view full) ---

400 return err;
401}
402
403static int ctr_encrypt_sync(struct skcipher_request *req)
404{
405 struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req);
406 struct crypto_aes_ctx *ctx = crypto_skcipher_ctx(tfm);
407
408 if (!may_use_simd())
408 if (!crypto_simd_usable())
409 return aes_ctr_encrypt_fallback(ctx, req);
410
411 return ctr_encrypt(req);
412}
413
414static int xts_encrypt(struct skcipher_request *req)
415{
416 struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req);

--- 220 unchanged lines hidden (view full) ---

637 return 0;
638}
639
640static void mac_do_update(struct crypto_aes_ctx *ctx, u8 const in[], int blocks,
641 u8 dg[], int enc_before, int enc_after)
642{
643 int rounds = 6 + ctx->key_length / 4;
644
409 return aes_ctr_encrypt_fallback(ctx, req);
410
411 return ctr_encrypt(req);
412}
413
414static int xts_encrypt(struct skcipher_request *req)
415{
416 struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req);

--- 220 unchanged lines hidden (view full) ---

637 return 0;
638}
639
640static void mac_do_update(struct crypto_aes_ctx *ctx, u8 const in[], int blocks,
641 u8 dg[], int enc_before, int enc_after)
642{
643 int rounds = 6 + ctx->key_length / 4;
644
645 if (may_use_simd()) {
645 if (crypto_simd_usable()) {
646 kernel_neon_begin();
647 aes_mac_update(in, ctx->key_enc, rounds, blocks, dg, enc_before,
648 enc_after);
649 kernel_neon_end();
650 } else {
651 if (enc_before)
652 __aes_arm64_encrypt(ctx->key_enc, dg, dg, rounds);
653

--- 191 unchanged lines hidden ---
646 kernel_neon_begin();
647 aes_mac_update(in, ctx->key_enc, rounds, blocks, dg, enc_before,
648 enc_after);
649 kernel_neon_end();
650 } else {
651 if (enc_before)
652 __aes_arm64_encrypt(ctx->key_enc, dg, dg, rounds);
653

--- 191 unchanged lines hidden ---