summaryrefslogtreecommitdiff
path: root/providers/implementations/ciphers/cipher_aes_gcm_hw_ppc.inc
diff options
context:
space:
mode:
authorDanny Tsen <dtsen@us.ibm.com>2021-10-18 10:51:42 -0400
committerPauli <pauli@openssl.org>2022-01-24 11:25:53 +1100
commit44a563dde1584cd9284e80b6e45ee5019be8d36c (patch)
treec909c5c37731b561770dbfa9df0802767cec79ae /providers/implementations/ciphers/cipher_aes_gcm_hw_ppc.inc
parentd94c2f1b98318cea4416c4dcd5e5f878de8d458f (diff)
downloadopenssl-new-44a563dde1584cd9284e80b6e45ee5019be8d36c.tar.gz
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)
Diffstat (limited to 'providers/implementations/ciphers/cipher_aes_gcm_hw_ppc.inc')
-rw-r--r--providers/implementations/ciphers/cipher_aes_gcm_hw_ppc.inc39
1 files changed, 39 insertions, 0 deletions
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;
+}
+