From 5fd4917d97e45d7524312ad2150facd2c1fdba36 Mon Sep 17 00:00:00 2001
From: Paul Bakker
Date: Mon, 19 Aug 2013 13:29:26 +0200
Subject: [PATCH] Add missing ifdefs in ssl modules
---
library/ssl_srv.c | 2 ++
library/ssl_tls.c | 12 ++++++++++++
2 files changed, 14 insertions(+)
diff --git a/library/ssl_srv.c b/library/ssl_srv.c
index 4bf68ae77..36c4f2f36 100644
--- a/library/ssl_srv.c
+++ b/library/ssl_srv.c
@@ -1289,9 +1289,11 @@ static int ssl_parse_client_hello( ssl_context *ssl )
ciphersuite_info->max_minor_ver < ssl->minor_ver )
continue;
+#if defined(POLARSSL_ECDH_C) || defined(POLARSSL_ECDSA_C)
if( ( ciphersuite_info->flags & POLARSSL_CIPHERSUITE_EC ) &&
ssl->handshake->ec_curve == 0 )
continue;
+#endif
goto have_ciphersuite;
}
diff --git a/library/ssl_tls.c b/library/ssl_tls.c
index 039b536d8..e2bc3da12 100644
--- a/library/ssl_tls.c
+++ b/library/ssl_tls.c
@@ -1011,6 +1011,7 @@ static int ssl_encrypt_buf( ssl_context *ssl )
switch( ssl->transform_out->ciphersuite_info->cipher )
{
+#if defined(POLARSSL_DES_C)
case POLARSSL_CIPHER_DES_CBC:
des_crypt_cbc( (des_context *) ssl->transform_out->ctx_enc,
DES_ENCRYPT, enc_msglen,
@@ -1022,20 +1023,25 @@ static int ssl_encrypt_buf( ssl_context *ssl )
DES_ENCRYPT, enc_msglen,
ssl->transform_out->iv_enc, enc_msg, enc_msg );
break;
+#endif
+#if defined(POLARSSL_AES_C)
case POLARSSL_CIPHER_AES_128_CBC:
case POLARSSL_CIPHER_AES_256_CBC:
aes_crypt_cbc( (aes_context *) ssl->transform_out->ctx_enc,
AES_ENCRYPT, enc_msglen,
ssl->transform_out->iv_enc, enc_msg, enc_msg );
break;
+#endif
+#if defined(POLARSSL_CAMELLIA_C)
case POLARSSL_CIPHER_CAMELLIA_128_CBC:
case POLARSSL_CIPHER_CAMELLIA_256_CBC:
camellia_crypt_cbc( (camellia_context *) ssl->transform_out->ctx_enc,
CAMELLIA_ENCRYPT, enc_msglen,
ssl->transform_out->iv_enc, enc_msg, enc_msg );
break;
+#endif
default:
return( POLARSSL_ERR_SSL_FEATURE_UNAVAILABLE );
@@ -1188,6 +1194,7 @@ static int ssl_decrypt_buf( ssl_context *ssl )
switch( ssl->transform_in->ciphersuite_info->cipher )
{
+#if defined(POLARSSL_DES_C)
case POLARSSL_CIPHER_DES_CBC:
des_crypt_cbc( (des_context *) ssl->transform_in->ctx_dec,
DES_DECRYPT, dec_msglen,
@@ -1199,20 +1206,25 @@ static int ssl_decrypt_buf( ssl_context *ssl )
DES_DECRYPT, dec_msglen,
ssl->transform_in->iv_dec, dec_msg, dec_msg_result );
break;
+#endif
+#if defined(POLARSSL_AES_C)
case POLARSSL_CIPHER_AES_128_CBC:
case POLARSSL_CIPHER_AES_256_CBC:
aes_crypt_cbc( (aes_context *) ssl->transform_in->ctx_dec,
AES_DECRYPT, dec_msglen,
ssl->transform_in->iv_dec, dec_msg, dec_msg_result );
break;
+#endif
+#if defined(POLARSSL_CAMELLIA_C)
case POLARSSL_CIPHER_CAMELLIA_128_CBC:
case POLARSSL_CIPHER_CAMELLIA_256_CBC:
camellia_crypt_cbc( (camellia_context *) ssl->transform_in->ctx_dec,
CAMELLIA_DECRYPT, dec_msglen,
ssl->transform_in->iv_dec, dec_msg, dec_msg_result );
break;
+#endif
default:
return( POLARSSL_ERR_SSL_FEATURE_UNAVAILABLE );