|
|
74096c |
From 85a5cce40dba0393e636c0eb5af9d8f8746f2315 Mon Sep 17 00:00:00 2001
|
|
|
74096c |
From: Mohit Agrawal <moagrawal@redhat.com>
|
|
|
74096c |
Date: Thu, 2 Jan 2020 10:23:52 +0530
|
|
|
74096c |
Subject: [PATCH 497/511] socket: Use AES128 cipher in SSL if AES is supported
|
|
|
74096c |
by CPU
|
|
|
74096c |
|
|
|
74096c |
SSL performance is improved after configuring AES128 cipher
|
|
|
74096c |
so use AES128 cipher as a default cipher on the CPU those
|
|
|
74096c |
enabled AES bits otherwise ssl use AES256 cipher
|
|
|
74096c |
|
|
|
74096c |
> Change-Id: I91c50fe987cbb22ed76f8012094730c592c63506
|
|
|
74096c |
> Fixes: #1050
|
|
|
74096c |
> Signed-off-by: Mohit Agrawal <moagrawal@redhat.com>
|
|
|
74096c |
> (Cherry pick from commit 177cc09d24515596eb51739ce0a276c26e3c52f1)
|
|
|
74096c |
> (Reviewed on upstream link https://review.gluster.org/#/c/glusterfs/+/23952/)
|
|
|
74096c |
|
|
|
74096c |
Change-Id: I91c50fe987cbb22ed76f8012094730c592c63506
|
|
|
74096c |
Bug: 1612973
|
|
|
74096c |
Signed-off-by: Mohit Agrawal <moagrawal@redhat.com>
|
|
|
74096c |
Reviewed-on: https://code.engineering.redhat.com/gerrit/220870
|
|
|
74096c |
Tested-by: Mohit Agrawal <moagrawa@redhat.com>
|
|
|
74096c |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
74096c |
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
|
|
|
74096c |
---
|
|
|
74096c |
rpc/rpc-transport/socket/src/socket.c | 32 ++++++++++++++++++++++++++++++++
|
|
|
74096c |
1 file changed, 32 insertions(+)
|
|
|
74096c |
|
|
|
74096c |
diff --git a/rpc/rpc-transport/socket/src/socket.c b/rpc/rpc-transport/socket/src/socket.c
|
|
|
74096c |
index 54cd5df..1ee7320 100644
|
|
|
74096c |
--- a/rpc/rpc-transport/socket/src/socket.c
|
|
|
74096c |
+++ b/rpc/rpc-transport/socket/src/socket.c
|
|
|
74096c |
@@ -4238,6 +4238,34 @@ static void __attribute__((destructor)) fini_openssl_mt(void)
|
|
|
74096c |
ERR_free_strings();
|
|
|
74096c |
}
|
|
|
74096c |
|
|
|
74096c |
+/* The function returns 0 if AES bit is enabled on the CPU */
|
|
|
74096c |
+static int
|
|
|
74096c |
+ssl_check_aes_bit(void)
|
|
|
74096c |
+{
|
|
|
74096c |
+ FILE *fp = fopen("/proc/cpuinfo", "r");
|
|
|
74096c |
+ int ret = 1;
|
|
|
74096c |
+ size_t len = 0;
|
|
|
74096c |
+ char *line = NULL;
|
|
|
74096c |
+ char *match = NULL;
|
|
|
74096c |
+
|
|
|
74096c |
+ GF_ASSERT(fp != NULL);
|
|
|
74096c |
+
|
|
|
74096c |
+ while (getline(&line, &len, fp) > 0) {
|
|
|
74096c |
+ if (!strncmp(line, "flags", 5)) {
|
|
|
74096c |
+ match = strstr(line, " aes");
|
|
|
74096c |
+ if ((match != NULL) && ((match[4] == ' ') || (match[4] == 0))) {
|
|
|
74096c |
+ ret = 0;
|
|
|
74096c |
+ break;
|
|
|
74096c |
+ }
|
|
|
74096c |
+ }
|
|
|
74096c |
+ }
|
|
|
74096c |
+
|
|
|
74096c |
+ free(line);
|
|
|
74096c |
+ fclose(fp);
|
|
|
74096c |
+
|
|
|
74096c |
+ return ret;
|
|
|
74096c |
+}
|
|
|
74096c |
+
|
|
|
74096c |
static int
|
|
|
74096c |
ssl_setup_connection_params(rpc_transport_t *this)
|
|
|
74096c |
{
|
|
|
74096c |
@@ -4261,6 +4289,10 @@ ssl_setup_connection_params(rpc_transport_t *this)
|
|
|
74096c |
return 0;
|
|
|
74096c |
}
|
|
|
74096c |
|
|
|
74096c |
+ if (!ssl_check_aes_bit()) {
|
|
|
74096c |
+ cipher_list = "AES128:" DEFAULT_CIPHER_LIST;
|
|
|
74096c |
+ }
|
|
|
74096c |
+
|
|
|
74096c |
priv->ssl_own_cert = DEFAULT_CERT_PATH;
|
|
|
74096c |
if (dict_get_str(this->options, SSL_OWN_CERT_OPT, &optstr) == 0) {
|
|
|
74096c |
if (!priv->ssl_enabled) {
|
|
|
74096c |
--
|
|
|
74096c |
1.8.3.1
|
|
|
74096c |
|