forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
crypto: arm64/sm4 - export reusable CE acceleration functions
In the accelerated implementation of the SM4 algorithm using the Crypto Extension instructions, there are some functions that can be reused in the upcoming accelerated implementation of the GCM/CCM mode, and the CBC/CFB encryption is reused in the optimized implementation of SVESM4. Signed-off-by: Tianjia Zhang <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
- Loading branch information
Showing
2 changed files
with
21 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* SPDX-License-Identifier: GPL-2.0-or-later */ | ||
/* | ||
* SM4 common functions for Crypto Extensions | ||
* Copyright (C) 2022 Tianjia Zhang <[email protected]> | ||
*/ | ||
|
||
void sm4_ce_expand_key(const u8 *key, u32 *rkey_enc, u32 *rkey_dec, | ||
const u32 *fk, const u32 *ck); | ||
|
||
void sm4_ce_crypt_block(const u32 *rkey, u8 *dst, const u8 *src); | ||
|
||
void sm4_ce_cbc_enc(const u32 *rkey_enc, u8 *dst, const u8 *src, | ||
u8 *iv, unsigned int nblocks); | ||
|
||
void sm4_ce_cfb_enc(const u32 *rkey_enc, u8 *dst, const u8 *src, | ||
u8 *iv, unsigned int nblocks); |