Skip to content

Instantly share code, notes, and snippets.

@matbee-eth
Created October 9, 2014 07:53
Show Gist options
  • Save matbee-eth/35eba233ec2283cdb261 to your computer and use it in GitHub Desktop.
Save matbee-eth/35eba233ec2283cdb261 to your computer and use it in GitHub Desktop.
diff --git a/.gitignore b/.gitignore
index 1055458..7358050 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,3 +8,4 @@ Coverage
*.gcda
library/polarssl.info
/build-nacl-*
+/build-nacl-*
diff --git a/configs/config-ccm-psk-tls1_2.h b/configs/config-ccm-psk-tls1_2.h
index 1da9f6a..2ee48c8 100644
--- a/configs/config-ccm-psk-tls1_2.h
+++ b/configs/config-ccm-psk-tls1_2.h
@@ -21,7 +21,6 @@
#define POLARSSL_SSL_PROTO_TLS1_2
/* PolarSSL modules */
-#define POLARSSL_AES_C
#define POLARSSL_CCM_C
#define POLARSSL_CIPHER_C
#define POLARSSL_CTR_DRBG_C
diff --git a/configs/config-mini-tls1_1.h b/configs/config-mini-tls1_1.h
index 338fecf..501f46c 100644
--- a/configs/config-mini-tls1_1.h
+++ b/configs/config-mini-tls1_1.h
@@ -9,7 +9,6 @@
#define POLARSSL_CONFIG_H
/* System support */
-#define POLARSSL_HAVE_ASM
#define POLARSSL_HAVE_TIME
#define POLARSSL_HAVE_IPV6
@@ -20,7 +19,6 @@
#define POLARSSL_SSL_PROTO_TLS1_1
/* PolarSSL modules */
-#define POLARSSL_AES_C
#define POLARSSL_ASN1_PARSE_C
#define POLARSSL_ASN1_WRITE_C
#define POLARSSL_BIGNUM_C
diff --git a/configs/config-picocoin.h b/configs/config-picocoin.h
index eeac5d0..752ed99 100644
--- a/configs/config-picocoin.h
+++ b/configs/config-picocoin.h
@@ -14,7 +14,6 @@
/* System support */
#define POLARSSL_HAVE_LONGLONG
-#define POLARSSL_HAVE_ASM
#define POLARSSL_HAVE_TIME
#define POLARSSL_HAVE_IPV6
@@ -28,8 +27,6 @@
#define POLARSSL_FS_IO
/* PolarSSL modules */
-#define POLARSSL_AESNI_C
-#define POLARSSL_AES_C
#define POLARSSL_ASN1_PARSE_C
#define POLARSSL_ASN1_WRITE_C
#define POLARSSL_BASE64_C
diff --git a/configs/config-psk-rc4-tls1_0.h b/configs/config-psk-rc4-tls1_0.h
index c967b4c..bd84161 100644
--- a/configs/config-psk-rc4-tls1_0.h
+++ b/configs/config-psk-rc4-tls1_0.h
@@ -21,7 +21,6 @@
#define POLARSSL_SSL_PROTO_TLS1
/* PolarSSL modules */
-#define POLARSSL_AES_C
#define POLARSSL_ARC4_C
#define POLARSSL_CIPHER_C
#define POLARSSL_CTR_DRBG_C
diff --git a/configs/config-suite-b.h b/configs/config-suite-b.h
index cd38f33..6eb3d6b 100644
--- a/configs/config-suite-b.h
+++ b/configs/config-suite-b.h
@@ -16,7 +16,6 @@
#define POLARSSL_CONFIG_H
/* System support */
-#define POLARSSL_HAVE_ASM
#define POLARSSL_HAVE_TIME
#define POLARSSL_HAVE_IPV6
@@ -27,7 +26,6 @@
#define POLARSSL_SSL_PROTO_TLS1_2
/* PolarSSL modules */
-#define POLARSSL_AES_C
#define POLARSSL_ASN1_PARSE_C
#define POLARSSL_ASN1_WRITE_C
#define POLARSSL_BIGNUM_C
diff --git a/include/polarssl/config.h b/include/polarssl/config.h
index d43365f..380fd06 100644
--- a/include/polarssl/config.h
+++ b/include/polarssl/config.h
@@ -1085,7 +1085,6 @@
*
* This modules adds support for the AES-NI instructions on x86-64
*/
-#define POLARSSL_AESNI_C
/**
* \def POLARSSL_AES_C
diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt
index bc986ee..0c6825f 100644
--- a/library/CMakeLists.txt
+++ b/library/CMakeLists.txt
@@ -4,7 +4,6 @@ option(LINK_WITH_PTHREAD "Explicitly link PolarSSL library to pthread." OFF)
set(src
aes.c
- aesni.c
arc4.c
asn1parse.c
asn1write.c
diff --git a/library/aes.c b/library/aes.c
index f295747..33f48ff 100644
--- a/library/aes.c
+++ b/library/aes.c
@@ -512,11 +512,6 @@ int aes_setkey_enc( aes_context *ctx, const unsigned char *key,
#endif
ctx->rk = RK = ctx->buf;
-#if defined(POLARSSL_AESNI_C) && defined(POLARSSL_HAVE_X86_64)
- if( aesni_supports( POLARSSL_AESNI_AES ) )
- return( aesni_setkey_enc( (unsigned char *) ctx->rk, key, keysize ) );
-#endif
-
for( i = 0; i < ( keysize >> 5 ); i++ )
{
GET_UINT32_LE( RK[i], key, i << 2 );
@@ -617,14 +612,6 @@ int aes_setkey_dec( aes_context *ctx, const unsigned char *key,
ctx->nr = cty.nr;
-#if defined(POLARSSL_AESNI_C) && defined(POLARSSL_HAVE_X86_64)
- if( aesni_supports( POLARSSL_AESNI_AES ) )
- {
- aesni_inverse_key( (unsigned char *) ctx->rk,
- (const unsigned char *) cty.rk, ctx->nr );
- goto exit;
- }
-#endif
SK = cty.rk + cty.nr * 4;
@@ -712,11 +699,6 @@ int aes_crypt_ecb( aes_context *ctx,
int i;
uint32_t *RK, X0, X1, X2, X3, Y0, Y1, Y2, Y3;
-#if defined(POLARSSL_AESNI_C) && defined(POLARSSL_HAVE_X86_64)
- if( aesni_supports( POLARSSL_AESNI_AES ) )
- return( aesni_crypt_ecb( ctx, mode, input, output ) );
-#endif
-
#if defined(POLARSSL_PADLOCK_C) && defined(POLARSSL_HAVE_X86)
if( aes_padlock_ace )
{
diff --git a/library/gcm.c b/library/gcm.c
index 77b1e0f..dfd68ec 100644
--- a/library/gcm.c
+++ b/library/gcm.c
@@ -114,12 +114,6 @@ static int gcm_gen_table( gcm_context *ctx )
ctx->HL[8] = vl;
ctx->HH[8] = vh;
-#if defined(POLARSSL_AESNI_C) && defined(POLARSSL_HAVE_X86_64)
- /* With CLMUL support, we need only h, not the rest of the table */
- if( aesni_supports( POLARSSL_AESNI_CLMUL ) )
- return( 0 );
-#endif
-
/* 0 corresponds to 0 in GF(2^128) */
ctx->HH[0] = 0;
ctx->HL[0] = 0;
@@ -205,20 +199,6 @@ static void gcm_mult( gcm_context *ctx, const unsigned char x[16],
unsigned char lo, hi, rem;
uint64_t zh, zl;
-#if defined(POLARSSL_AESNI_C) && defined(POLARSSL_HAVE_X86_64)
- if( aesni_supports( POLARSSL_AESNI_CLMUL ) ) {
- unsigned char h[16];
-
- PUT_UINT32_BE( ctx->HH[8] >> 32, h, 0 );
- PUT_UINT32_BE( ctx->HH[8], h, 4 );
- PUT_UINT32_BE( ctx->HL[8] >> 32, h, 8 );
- PUT_UINT32_BE( ctx->HL[8], h, 12 );
-
- aesni_gcm_mult( output, x, h );
- return;
- }
-#endif /* POLARSSL_AESNI_C && POLARSSL_HAVE_X86_64 */
-
lo = x[15] & 0xf;
hi = x[15] >> 4;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment