Accepting request 1042984 from home:ohollmann:branches:security:tls
OBS-URL: https://build.opensuse.org/request/show/1042984 OBS-URL: https://build.opensuse.org/package/show/security:tls/openssl-1_1?expand=0&rev=124
This commit is contained in:
parent
0ce74d253b
commit
93c266235b
@ -12,8 +12,8 @@ Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
|
|||||||
Reviewed-by: Paul Dale <pauli@openssl.org>
|
Reviewed-by: Paul Dale <pauli@openssl.org>
|
||||||
(Merged from https://github.com/openssl/openssl/pull/19182)
|
(Merged from https://github.com/openssl/openssl/pull/19182)
|
||||||
---
|
---
|
||||||
crypto/evp/e_aes.c | 179 +++++++++++++++++++++++++++++++----------------------
|
crypto/evp/e_aes.c | 146 ++++++++++++++++++++++++++---------------------------
|
||||||
1 file changed, 107 insertions(+), 72 deletions(-)
|
1 file changed, 74 insertions(+), 72 deletions(-)
|
||||||
|
|
||||||
--- a/crypto/evp/e_aes.c
|
--- a/crypto/evp/e_aes.c
|
||||||
+++ b/crypto/evp/e_aes.c
|
+++ b/crypto/evp/e_aes.c
|
||||||
@ -113,10 +113,11 @@ Reviewed-by: Paul Dale <pauli@openssl.org>
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(OPENSSL_CPUID_OBJ) && ( \
|
#if defined(OPENSSL_CPUID_OBJ) && ( \
|
||||||
@@ -3294,9 +3224,114 @@ static int aes_gcm_tls_cipher(EVP_CIPHER
|
@@ -3294,6 +3224,51 @@ static int aes_gcm_tls_cipher(EVP_CIPHER
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
+#if defined(OPENSSL_CPUID_OBJ) && (defined(__powerpc__) || defined(__ppc__) || defined(_ARCH_PPC))
|
||||||
+static size_t ppc_aes_gcm_crypt(const unsigned char *in, unsigned char *out, size_t len,
|
+static size_t ppc_aes_gcm_crypt(const unsigned char *in, unsigned char *out, size_t len,
|
||||||
+ const void *key, unsigned char ivec[16], u64 *Xi, int encrypt)
|
+ const void *key, unsigned char ivec[16], u64 *Xi, int encrypt)
|
||||||
+{
|
+{
|
||||||
@ -159,72 +160,49 @@ Reviewed-by: Paul Dale <pauli@openssl.org>
|
|||||||
+
|
+
|
||||||
+ return ndone;
|
+ return ndone;
|
||||||
+}
|
+}
|
||||||
+
|
|
||||||
+#if defined(OPENSSL_CPUID_OBJ) && (defined(__powerpc__) || defined(__ppc__) || defined(_ARCH_PPC))
|
|
||||||
+static int ppc_aes_gcm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
|
||||||
+ const unsigned char *in, size_t len)
|
|
||||||
+{
|
|
||||||
+ EVP_AES_GCM_CTX *gctx = EVP_C_DATA(EVP_AES_GCM_CTX,ctx);
|
|
||||||
+ if (ctx->encrypt) {
|
|
||||||
+ if (gctx->ctr != NULL) {
|
|
||||||
+ size_t bulk = 0;
|
|
||||||
+
|
|
||||||
+ if (len >= AES_GCM_ENC_BYTES && AES_GCM_ASM_PPC(gctx)) {
|
|
||||||
+ size_t res = (16 - gctx->gcm.mres) % 16;
|
|
||||||
+
|
|
||||||
+ if (CRYPTO_gcm128_encrypt(&gctx->gcm, in, out, res))
|
|
||||||
+ return 0;
|
|
||||||
+
|
|
||||||
+ bulk = ppc_aes_gcm_crypt(in + res, out + res, len - res,
|
|
||||||
+ gctx->gcm.key,
|
|
||||||
+ gctx->gcm.Yi.c, gctx->gcm.Xi.u, 1);
|
|
||||||
+
|
|
||||||
+ gctx->gcm.len.u[1] += bulk;
|
|
||||||
+ bulk += res;
|
|
||||||
+ }
|
|
||||||
+ if (CRYPTO_gcm128_encrypt_ctr32(&gctx->gcm, in + bulk, out + bulk,
|
|
||||||
+ len - bulk, gctx->ctr))
|
|
||||||
+ return 0;
|
|
||||||
+ } else {
|
|
||||||
+ if (CRYPTO_gcm128_encrypt(&gctx->gcm, in, out, len))
|
|
||||||
+ return 0;
|
|
||||||
+ }
|
|
||||||
+ } else {
|
|
||||||
+ if (gctx->ctr != NULL) {
|
|
||||||
+ size_t bulk = 0;
|
|
||||||
+
|
|
||||||
+ if (len >= AES_GCM_DEC_BYTES && AES_GCM_ASM_PPC(gctx)) {
|
|
||||||
+ size_t res = (16 - gctx->gcm.mres) % 16;
|
|
||||||
+
|
|
||||||
+ if (CRYPTO_gcm128_decrypt(&gctx->gcm, in, out, res))
|
|
||||||
+ return -1;
|
|
||||||
+
|
|
||||||
+ bulk = ppc_aes_gcm_crypt(in + res, out + res, len - res,
|
|
||||||
+ gctx->gcm.key,
|
|
||||||
+ gctx->gcm.Yi.c, gctx->gcm.Xi.u, 0);
|
|
||||||
+
|
|
||||||
+ gctx->gcm.len.u[1] += bulk;
|
|
||||||
+ bulk += res;
|
|
||||||
+ }
|
|
||||||
+ if (CRYPTO_gcm128_decrypt_ctr32(&gctx->gcm, in + bulk, out + bulk,
|
|
||||||
+ len - bulk, gctx->ctr))
|
|
||||||
+ return 0;
|
|
||||||
+ } else {
|
|
||||||
+ if (CRYPTO_gcm128_decrypt(&gctx->gcm, in, out, len))
|
|
||||||
+ return 0;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ return 1;
|
|
||||||
+}
|
|
||||||
+#endif
|
+#endif
|
||||||
+
|
+
|
||||||
static int aes_gcm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
static int aes_gcm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||||
const unsigned char *in, size_t len)
|
const unsigned char *in, size_t len)
|
||||||
{
|
{
|
||||||
+#if defined(OPENSSL_CPUID_OBJ) && (defined(__powerpc__) || defined(__ppc__) || defined(_ARCH_PPC))
|
@@ -3325,6 +3300,20 @@ static int aes_gcm_cipher(EVP_CIPHER_CTX
|
||||||
+ if (PPC_AES_GCM_CAPABLE)
|
out + res, len - res,
|
||||||
+ return ppc_aes_gcm_cipher(ctx, out, in, len);
|
gctx->gcm.key, gctx->gcm.Yi.c,
|
||||||
+#endif
|
gctx->gcm.Xi.u);
|
||||||
EVP_AES_GCM_CTX *gctx = EVP_C_DATA(EVP_AES_GCM_CTX,ctx);
|
+
|
||||||
/* If not set up, return error */
|
+ gctx->gcm.len.u[1] += bulk;
|
||||||
if (!gctx->key_set)
|
+ bulk += res;
|
||||||
|
+ }
|
||||||
|
+#elif defined(AES_GCM_ASM_PPC) && defined(OPENSSL_CPUID_OBJ) && (defined(__powerpc__) || defined(__ppc__) || defined(_ARCH_PPC))
|
||||||
|
+ if (PPC_AES_GCM_CAPABLE && len >= AES_GCM_ENC_BYTES && AES_GCM_ASM_PPC(gctx)) {
|
||||||
|
+ size_t res = (16 - gctx->gcm.mres) % 16;
|
||||||
|
+
|
||||||
|
+ if (CRYPTO_gcm128_encrypt(&gctx->gcm, in, out, res))
|
||||||
|
+ return -1;
|
||||||
|
+
|
||||||
|
+ bulk = ppc_aes_gcm_crypt(in + res, out + res, len - res,
|
||||||
|
+ gctx->gcm.key,
|
||||||
|
+ gctx->gcm.Yi.c, gctx->gcm.Xi.u, 1);
|
||||||
|
gctx->gcm.len.u[1] += bulk;
|
||||||
|
bulk += res;
|
||||||
|
}
|
||||||
|
@@ -3372,6 +3361,19 @@ static int aes_gcm_cipher(EVP_CIPHER_CTX
|
||||||
|
gctx->gcm.len.u[1] += bulk;
|
||||||
|
bulk += res;
|
||||||
|
}
|
||||||
|
+#elif defined(AES_GCM_ASM_PPC) && defined(OPENSSL_CPUID_OBJ) && (defined(__powerpc__) || defined(__ppc__) || defined(_ARCH_PPC))
|
||||||
|
+ if (PPC_AES_GCM_CAPABLE && len >= AES_GCM_DEC_BYTES && AES_GCM_ASM_PPC(gctx)) {
|
||||||
|
+ size_t res = (16 - gctx->gcm.mres) % 16;
|
||||||
|
+
|
||||||
|
+ if (CRYPTO_gcm128_decrypt(&gctx->gcm, in, out, res))
|
||||||
|
+ return -1;
|
||||||
|
+
|
||||||
|
+ bulk = ppc_aes_gcm_crypt(in + res, out + res, len - res,
|
||||||
|
+ gctx->gcm.key,
|
||||||
|
+ gctx->gcm.Yi.c, gctx->gcm.Xi.u, 0);
|
||||||
|
+ gctx->gcm.len.u[1] += bulk;
|
||||||
|
+ bulk += res;
|
||||||
|
+ }
|
||||||
|
#endif
|
||||||
|
if (CRYPTO_gcm128_decrypt_ctr32(&gctx->gcm,
|
||||||
|
in + bulk,
|
||||||
|
Loading…
Reference in New Issue
Block a user