From: Vsevolod Stakhov Date: Mon, 29 Feb 2016 11:11:39 +0000 (+0000) Subject: [Minor] Hide rdrand checks for non-x86 platforms X-Git-Tag: 1.2.0~149 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=3ed4cae07ea2adfea3fe5eb4070dcf59f9e11f5d;p=rspamd.git [Minor] Hide rdrand checks for non-x86 platforms --- diff --git a/src/libcryptobox/cryptobox.c b/src/libcryptobox/cryptobox.c index 1085906de..e5c311268 100644 --- a/src/libcryptobox/cryptobox.c +++ b/src/libcryptobox/cryptobox.c @@ -148,6 +148,14 @@ rspamd_cryptobox_test_instr (gint instr) case CPUID_SSE2: __asm__ volatile ("pmuludq %xmm0, %xmm0"); break; + case CPUID_RDRAND: + /* Use byte code here for compatibility */ + __asm__ volatile (".byte 0x0f,0xc7,0xf0; setc %1" + : "=a" (rd), "=qm" (ok) + : + : "edx" + ); + break; #endif #ifdef HAVE_SSE3 case CPUID_SSE3: @@ -174,15 +182,8 @@ rspamd_cryptobox_test_instr (gint instr) __asm__ volatile ("vpaddq %ymm0, %ymm0, %ymm0");\ break; #endif - case CPUID_RDRAND: - /* Use byte code here for compatibility */ - __asm__ volatile (".byte 0x0f,0xc7,0xf0; setc %1" - : "=a" (rd), "=qm" (ok) - : - : "edx" - ); - break; default: + return FALSE; break; }