summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xautogen.sh2
-rw-r--r--src/ChangeLog6
-rw-r--r--src/g10lib.h3
-rw-r--r--src/global.c1
-rw-r--r--src/hwfeatures.c33
5 files changed, 39 insertions, 6 deletions
diff --git a/autogen.sh b/autogen.sh
index 794c9073..b31f144e 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -128,7 +128,7 @@ if [ "$myhost" = "w32" ]; then
fi
fi
- ./configure --enable-maintainer-mode --prefix=${w32root} \
+ $tsdir/configure --enable-maintainer-mode --prefix=${w32root} \
--host=${host} --build=${build} \
--with-gpg-error-prefix=${w32root}
exit $?
diff --git a/src/ChangeLog b/src/ChangeLog
index a65acd13..fe267b03 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,9 @@
+2010-08-27 Werner Koch <wk@g10code.com>
+
+ * g10lib.h (HWF_INTEL_AES): New.
+ * global.c (print_config): Print new flag.
+ * hwfeatures.c (detect_ia32_gnuc): Detect this flag.
+
2010-08-16 Werner Koch <wk@g10code.com>
* gcrypt.h.in [!WIN32]: Add INSERT_SYS_SELECT_H autoconf substitute.
diff --git a/src/g10lib.h b/src/g10lib.h
index 57b84675..d8e967a6 100644
--- a/src/g10lib.h
+++ b/src/g10lib.h
@@ -148,6 +148,9 @@ int _gcry_log_verbosity( int level );
#define HWF_PADLOCK_SHA 4
#define HWF_PADLOCK_MMUL 8
+#define HWF_INTEL_AES 256
+
+
unsigned int _gcry_get_hw_features (void);
void _gcry_detect_hw_features (void);
diff --git a/src/global.c b/src/global.c
index d23e7370..c457b1e4 100644
--- a/src/global.c
+++ b/src/global.c
@@ -265,6 +265,7 @@ print_config ( int (*fnc)(FILE *fp, const char *format, ...), FILE *fp)
{ HWF_PADLOCK_RNG, "padlock-rng" },
{ HWF_PADLOCK_AES, "padlock-aes" },
{ HWF_PADLOCK_SHA, "padlock-sha" },
+ { HWF_INTEL_AES, "intel-aes" },
{ 0, NULL}
};
int i;
diff --git a/src/hwfeatures.c b/src/hwfeatures.c
index 97442dba..da5d303a 100644
--- a/src/hwfeatures.c
+++ b/src/hwfeatures.c
@@ -44,7 +44,6 @@ _gcry_get_hw_features (void)
static void
detect_ia32_gnuc (void)
{
-#ifdef ENABLE_PADLOCK_SUPPORT
/* The code here is only useful for the PadLock engine thus we don't
build it if that support has been disabled. */
int has_cpuid = 0;
@@ -89,10 +88,12 @@ detect_ia32_gnuc (void)
);
vendor_id[12] = 0;
- /* Check whether this is a VIA CPU and what PadLock features we
- have. */
- if (!strcmp (vendor_id, "CentaurHauls"))
+ if (0)
+ ; /* Just to make "else if" and ifdef macros look pretty. */
+#ifdef ENABLE_PADLOCK_SUPPORT
+ else if (!strcmp (vendor_id, "CentaurHauls"))
{
+ /* This is a VIA CPU. Check what PadLock features we have. */
asm volatile
("pushl %%ebx\n\t" /* Save GOT register. */
"movl $0xC0000000, %%eax\n\t" /* Check for extended centaur */
@@ -140,11 +141,33 @@ detect_ia32_gnuc (void)
);
}
#endif /*ENABLE_PADLOCK_SUPPORT*/
+ else if (!strcmp (vendor_id, "GenuineIntel"))
+ {
+ /* This is an Intel CPU. */
+ asm volatile
+ ("pushl %%ebx\n\t" /* Save GOT register. */
+ "movl $1, %%eax\n\t" /* Get CPU info and feature flags. */
+ "cpuid\n"
+ "popl %%ebx\n\t" /* Restore GOT register. */
+ "cmpl $0x02000000, %%ecx\n\t" /* Test bit 25. */
+ "jnz .Lno_aes%=\n\t" /* No AES support. */
+ "orl $256, %0\n" /* Set our HWF_INTEL_AES bit. */
+
+ ".Lno_aes%=:\n"
+ : "+r" (hw_features)
+ :
+ : "%eax", "%ecx", "%edx", "cc"
+ );
+ }
+ else if (!strcmp (vendor_id, "AuthenticAMD"))
+ {
+ /* This is an AMD CPU. */
+
+ }
}
#endif /* __i386__ && SIZEOF_UNSIGNED_LONG == 4 && __GNUC__ */
-
/* Detect the available hardware features. This function is called
once right at startup and we assume that no other threads are
running. */