[hipl-dev] [Branch ~hipl-core/hipl/trunk] Rev 6438: OpenSSL ECC compilation fixes for Redhat-based distros

  • From: noreply@xxxxxxxxxxxxx
  • To: HIPL core team <hipl-dev@xxxxxxxxxxxxx>
  • Date: Tue, 22 Oct 2013 16:30:39 -0000

------------------------------------------------------------
revno: 6438
committer: Miika Komu <miika@xxxxxx>
branch nick: hipl
timestamp: Tue 2013-10-22 19:30:10 +0300
message:
  OpenSSL ECC compilation fixes for Redhat-based distros
  
  Merging of the hipv2-dh-ecdh branch broke compilation for Fedora 19 
  which does not support ECC. Added some minimal ifdef madness to get the 
  code to compile. Tested on FC19 and Ubuntu precise.
modified:
  libhipl/dh.c


--
lp:hipl
https://code.launchpad.net/~hipl-core/hipl/trunk

Your team HIPL core team is subscribed to branch lp:hipl.
To unsubscribe from this branch go to 
https://code.launchpad.net/~hipl-core/hipl/trunk/+edit-subscription
=== modified file 'libhipl/dh.c'
--- libhipl/dh.c        2012-10-31 17:00:21 +0000
+++ libhipl/dh.c        2013-10-22 16:30:10 +0000
@@ -47,7 +47,9 @@
  */
 static DH *dh_table[HIP_MAX_DH_GROUP_ID] = { 0 };
 
+#ifdef HAVE_EC_CRYPTO
 static EC_KEY *ecdh_table[HIP_MAX_DH_GROUP_ID] = { 0 };
+#endif /* HAVE_EC_CRYPTO */
 
 /**
  * insert the current DH-key into the buffer
@@ -96,6 +98,7 @@
     return res;
 }
 
+#ifdef HAVE_EC_CRYPTO
 /**
  * Store the bytes of the current ECDH public key in the given buffer.
  *
@@ -134,6 +137,7 @@
 
     return ret;
 }
+#endif /* HAVE_EC_CRYPTO */
 
 /**
  * HIPv2: Store the bytes of the current ECDH/DH public key to the given 
buffer.
@@ -152,11 +156,15 @@
         return -1;
     }
 
+#ifdef HAVE_EC_CRYPTO
     if (hip_is_ecdh_group(group_id)) {
         return hip_insert_ecdh(buffer, bufsize, group_id);
     } else {
         return hip_insert_dh(buffer, bufsize, group_id);
     }
+#else
+    return hip_insert_dh(buffer, bufsize, group_id);
+#endif /* HAVE_EC_CRYPTO */
 }
 
 /**
@@ -234,6 +242,7 @@
     return secret_len;
 }
 
+#ifdef HAVE_EC_CRYPTO
 /**
  * Calculate an Elliptic Curve Diffie-Hellman shared secret.
  *
@@ -287,6 +296,7 @@
 
     return out;
 }
+#endif /* HAVE_EC_CRYPTO */
 
 /**
  * Calculate a shared secret for Diffie-Hellman exchange.
@@ -314,6 +324,7 @@
         return -1;
     }
 
+#ifdef HAVE_EC_CRYPTO
     if (hip_is_ecdh_group(group_id)) {
         return hip_calculate_ecdh_shared_secret(group_id, public_value, len,
                                                 buffer, bufsize);
@@ -321,6 +332,10 @@
         return hip_calculate_dh_shared_secret(group_id, public_value, len,
                                               buffer, bufsize);
     }
+#else
+        return hip_calculate_dh_shared_secret(group_id, public_value, len,
+                                              buffer, bufsize);
+#endif /* HAVE_EC_CRYPTO */
 }
 
 /**
@@ -388,11 +403,15 @@
 
     for (i = 1; i < HIP_MAX_DH_GROUP_ID; i++) {
         if (bitmask & (1 << i)) {
+#ifdef HAVE_EC_CRYPTO
             if (hip_is_ecdh_group(i)) {
                 regen_ecdh_key(i);
             } else {
                 regen_dh_key(i);
             }
+#else
+            regen_dh_key(i);
+#endif /* HAVE_EC_CRYPTO */
 
             cnt++;
             HIP_DEBUG("DH key for group %d generated\n", i);

Other related posts:

  • » [hipl-dev] [Branch ~hipl-core/hipl/trunk] Rev 6438: OpenSSL ECC compilation fixes for Redhat-based distros - noreply