diff options
author | Danny Tsen <dtsen@us.ibm.com> | 2021-10-18 10:51:42 -0400 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2022-11-11 10:02:44 +0100 |
commit | a2bdca6fe666c3a0a13e7f0a51626715608f8597 (patch) | |
tree | c38f5f8eb0d4fde1ee4793eb6ba9788bc5712b12 /providers/implementations | |
parent | f01ebab0c0ef26677ab6d885922ca1a1b24494fc (diff) |
AES-GCM performance optimzation with stitched method for p9+ ppc64le
Assembly code reviewed by Shricharan Srivatsan <ssrivat@us.ibm.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/16854)
(cherry picked from commit 44a563dde1584cd9284e80b6e45ee5019be8d36c)
Diffstat (limited to 'providers/implementations')
-rw-r--r-- | providers/implementations/ciphers/cipher_aes_gcm_hw.c | 2 | ||||
-rw-r--r-- | providers/implementations/ciphers/cipher_aes_gcm_hw_ppc.inc | 39 |
2 files changed, 41 insertions, 0 deletions
diff --git a/providers/implementations/ciphers/cipher_aes_gcm_hw.c b/providers/implementations/ciphers/cipher_aes_gcm_hw.c index 44fa9d4d72..789ec12554 100644 --- a/providers/implementations/ciphers/cipher_aes_gcm_hw.c +++ b/providers/implementations/ciphers/cipher_aes_gcm_hw.c @@ -141,6 +141,8 @@ static const PROV_GCM_HW aes_gcm = { # include "cipher_aes_gcm_hw_t4.inc" #elif defined(AES_PMULL_CAPABLE) && defined(AES_GCM_ASM) # include "cipher_aes_gcm_hw_armv8.inc" +#elif defined(PPC_AES_GCM_CAPABLE) +# include "cipher_aes_gcm_hw_ppc.inc" #else const PROV_GCM_HW *ossl_prov_aes_hw_gcm(size_t keybits) { diff --git a/providers/implementations/ciphers/cipher_aes_gcm_hw_ppc.inc b/providers/implementations/ciphers/cipher_aes_gcm_hw_ppc.inc new file mode 100644 index 0000000000..dfc6bcbf58 --- /dev/null +++ b/providers/implementations/ciphers/cipher_aes_gcm_hw_ppc.inc @@ -0,0 +1,39 @@ +/* + * Copyright 2001-2021 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +/*- + * PPC support for AES GCM. + * This file is included by cipher_aes_gcm_hw.c + */ + +static int aes_ppc_gcm_initkey(PROV_GCM_CTX *ctx, const unsigned char *key, + size_t keylen) +{ + PROV_AES_GCM_CTX *actx = (PROV_AES_GCM_CTX *)ctx; + AES_KEY *ks = &actx->ks.ks; + + GCM_HW_SET_KEY_CTR_FN(ks, aes_p8_set_encrypt_key, aes_p8_encrypt, + aes_p8_ctr32_encrypt_blocks); + return 1; +} + +static const PROV_GCM_HW aes_ppc_gcm = { + aes_ppc_gcm_initkey, + ossl_gcm_setiv, + ossl_gcm_aad_update, + generic_aes_gcm_cipher_update, + ossl_gcm_cipher_final, + ossl_gcm_one_shot +}; + +const PROV_GCM_HW *ossl_prov_aes_hw_gcm(size_t keybits) +{ + return PPC_AES_GCM_CAPABLE ? &aes_ppc_gcm : &aes_gcm; +} + |