intel-aes 0.1.2 → 0.1.2.1
raw patch · 4 files changed
+26/−14 lines, 4 files
Files
- LICENSE +1/−1
- cbits/Intel_AESNI_Sample_Library_v1.0/intel_aes_lib/Makefile +4/−1
- cbits/Intel_AESNI_Sample_Library_v1.0/intel_aes_lib/src/intel_aes.c +17/−5
- intel-aes.cabal +4/−7
LICENSE view
@@ -12,7 +12,7 @@ BSD3 Full Text: -------------------------------------------------------------------------------- -Copyright (c) <year>, <copyright holder>+Copyright (c) 2011, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without
cbits/Intel_AESNI_Sample_Library_v1.0/intel_aes_lib/Makefile view
@@ -3,8 +3,10 @@ # Must be 86 (for 32bit compiler) or 64 (for 64bit compiler) ARCH=64+#ARCH=86 # Must be 32 or 64: SZ=64+#SZ=32 STATIC=lib/x$(ARCH)/libintel_aes.a DYNAMIC=lib/x$(ARCH)/libintel_aes.so@@ -17,7 +19,8 @@ obj/x$(ARCH)/iaesx$(ARCH).o \ obj/x$(ARCH)/do_rdtsc.o -GCC=gcc+# GCC=gcc -m32+GCC=gcc YASM=yasm YASMFLAGS= -D__linux__ -g dwarf2 -f elf$(SZ)
cbits/Intel_AESNI_Sample_Library_v1.0/intel_aes_lib/src/intel_aes.c view
@@ -291,17 +291,29 @@ * ECX = 'l' 'e' 't' 'n' */ +// AuthenticAMD + + int intel = 1; + int amd = 1; 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) - return no; + intel = 0; - __cpuid(cpuid_results,1); + if (memcmp((unsigned char *)&cpuid_results[1], "Auth", 4) != 0 || + memcmp((unsigned char *)&cpuid_results[3], "enti", 4) != 0 || + memcmp((unsigned char *)&cpuid_results[2], "cAMD", 4) != 0) + amd = 0; - if (cpuid_results[2] & AES_INSTRCTIONS_CPUID_BIT) - return yes; + if (intel || amd) + { + __cpuid(cpuid_results,1); - return no; + if (cpuid_results[2] & AES_INSTRCTIONS_CPUID_BIT) + return yes; + } + else + return no; }
intel-aes.cabal view
@@ -1,21 +1,18 @@ Name: intel-aes-Version: 0.1.2+Version: 0.1.2.1 License: BSD3 License-file: LICENSE Stability: Beta Maintainer: Ryan Newton <rrnewton@gmail.com>-Author: Ryan Newton <rrnewton@gmail.com>, Svein Ove Aas <svein.ove@aas.no>, Thomas M. DuBuisson+Author: Ryan Newton <rrnewton@gmail.com>, + Svein Ove Aas <svein.ove@aas.no>, Thomas M. DuBuisson <thomas.dubuisson@gmail.com> Copyright: Copyright (c) 2011 Intel Corporation Synopsis: Hardware accelerated AES encryption and RNG. HomePage: https://github.com/rrnewton/intel-aes/wiki Description: AES encryption with optional hardware acceleration. Plus, statistically sound, splittable random number generation based on AES.---- This package is nothing more than a wrapper around the Intel-provided AESNI sample library which also includes a portable software implementation of AES by Brian Gladman. It contains C,@@ -88,7 +85,7 @@ ---------------------------------------------------------------------------------------------------- library build-depends: base >= 4 && < 5, random, DRBG, split, process, haskell98, time,- DRBG, crypto-api, bytestring, cereal, tagged+ crypto-api, bytestring, cereal, tagged exposed-modules: Codec.Encryption.BurtonRNGSlow , Codec.Crypto.IntelAES