The Samba-Bugzilla – Attachment 14078 Details for
Bug 13302
smbd does not support AESNI on AMD platforms
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Proposed patch for all processors
0001-Allow-AESNI-to-be-used-on-all-processor-supporting-A.patch (text/plain), 3.57 KB, created by
eric.vannier
on 2018-03-23 04:36:58 UTC
(
hide
)
Description:
Proposed patch for all processors
Filename:
MIME Type:
Creator:
eric.vannier
Created:
2018-03-23 04:36:58 UTC
Size:
3.57 KB
patch
obsolete
>From 41125f9453ae8ac75f6314dbd6f77e3284e7912b Mon Sep 17 00:00:00 2001 >From: Eric Vannier <evannier@google.com> >Date: Thu, 22 Mar 2018 21:32:56 -0700 >Subject: [PATCH] Allow AESNI to be used on all processor supporting AESNI, not > just Intel's This improves performance/reduced CPU usage. Tests performed: - > Ran on Ivy Bridge and Ryzen and verified that AESNI is detected (crypto > tests) - Ran on Ryzen, and observed 50% increased speed. > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=13302 > >Signed-off-by: Eric Vannier <evannier@google.com> >--- > lib/crypto/aes.c | 32 ++++++++------------------------ > 1 file changed, 8 insertions(+), 24 deletions(-) > >diff --git a/lib/crypto/aes.c b/lib/crypto/aes.c >index c226ac1b3df..f521a4d11bf 100644 >--- a/lib/crypto/aes.c >+++ b/lib/crypto/aes.c >@@ -54,10 +54,10 @@ static inline void __cpuid(unsigned int where[4], unsigned int leaf) > } > > /* >- * has_intel_aes_instructions() >+ * has_aes_instructions() > * return true if supports AES-NI and false if doesn't > */ >-static bool has_intel_aes_instructions(void) >+static bool has_aes_instructions(void) > { > static int has_aes_instructions = -1; > unsigned int cpuid_results[4]; >@@ -66,22 +66,6 @@ static bool has_intel_aes_instructions(void) > return (bool)has_aes_instructions; > } > >- __cpuid(cpuid_results, 0); >- /* >- * MSB LSB >- * EBX = 'u' 'n' 'e' 'G' >- * EDX = 'I' 'e' 'n' 'i' >- * ECX = 'l' 'e' 't' 'n' >- */ >- if (memcmp((unsigned char *)&cpuid_results[1], "Genu", 4) != 0 || >- memcmp((unsigned char *)&cpuid_results[3], >- "ineI", 4) != 0 || >- memcmp((unsigned char *)&cpuid_results[2], >- "ntel", 4) != 0) { >- has_aes_instructions = 0; >- return (bool)has_aes_instructions; >- } >- > __cpuid(cpuid_results, 1); > has_aes_instructions = !!(cpuid_results[2] & (1 << 25)); > return (bool)has_aes_instructions; >@@ -140,10 +124,10 @@ static void AES_decrypt_aesni(const unsigned char *in, > > /* > * Dummy implementations if no Intel AES instructions present. >- * Only has_intel_aes_instructions() will ever be called. >+ * Only has_aes_instructions() will ever be called. > */ > >-static bool has_intel_aes_instructions(void) >+static bool has_aes_instructions(void) > { > return false; > } >@@ -233,7 +217,7 @@ AES_decrypt_rj(const unsigned char *in, unsigned char *out, const AES_KEY *key) > int > AES_set_encrypt_key(const unsigned char *userkey, const int bits, AES_KEY *key) > { >- if (has_intel_aes_instructions()) { >+ if (has_aes_instructions()) { > return AES_set_encrypt_key_aesni(userkey, bits, key); > } > return AES_set_encrypt_key_rj(userkey, bits, key); >@@ -242,7 +226,7 @@ AES_set_encrypt_key(const unsigned char *userkey, const int bits, AES_KEY *key) > int > AES_set_decrypt_key(const unsigned char *userkey, const int bits, AES_KEY *key) > { >- if (has_intel_aes_instructions()) { >+ if (has_aes_instructions()) { > return AES_set_decrypt_key_aesni(userkey, bits, key); > } > return AES_set_decrypt_key_rj(userkey, bits, key); >@@ -251,7 +235,7 @@ AES_set_decrypt_key(const unsigned char *userkey, const int bits, AES_KEY *key) > void > AES_encrypt(const unsigned char *in, unsigned char *out, const AES_KEY *key) > { >- if (has_intel_aes_instructions()) { >+ if (has_aes_instructions()) { > return AES_encrypt_aesni(in, out, key); > } > return AES_encrypt_rj(in, out, key); >@@ -260,7 +244,7 @@ AES_encrypt(const unsigned char *in, unsigned char *out, const AES_KEY *key) > void > AES_decrypt(const unsigned char *in, unsigned char *out, const AES_KEY *key) > { >- if (has_intel_aes_instructions()) { >+ if (has_aes_instructions()) { > return AES_decrypt_aesni(in, out, key); > } > return AES_decrypt_rj(in, out, key); >-- >2.14.3 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Flags:
bjacke
:
review+
Actions:
View
Attachments on
bug 13302
:
14067
|
14076
|
14077
|
14078
|
14087