Moving files, first attempt at gcrypt compatibility, more interface
[tinc] / src / protocol_key.c
index 0fa37b9..1798ede 100644 (file)
@@ -17,7 +17,7 @@
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
-    $Id: protocol_key.c,v 1.2 2002/04/09 15:26:01 zarq Exp $
+    $Id: protocol_key.c,v 1.3 2002/04/28 12:46:26 zarq Exp $
 */
 
 #include "config.h"
@@ -179,8 +179,14 @@ cp
   bin2hex(from->key, key, from->keylength);
   key[from->keylength * 2] = '\0';
 cp
+#ifdef USE_OPENSSL
   return send_request(c, "%d %s %s %s %d %d %d %d", ANS_KEY,
                       from->name, to->name, key, from->cipher?from->cipher->nid:0, from->digest?from->digest->type:0, from->maclength, from->compression);
+#endif
+#ifdef USE_GCRYPT
+  return send_request(c, "%d %s %s %s %d %d %d %d", ANS_KEY,
+                      from->name, to->name, key, from->cipher?-1:0, from->digest?-1:0, from->maclength, from->compression);
+#endif
 }
 
 int ans_key_h(connection_t *c)
@@ -240,6 +246,7 @@ cp
 
   if(cipher)
     {
+#ifdef USE_OPENSSL
       from->cipher = EVP_get_cipherbynid(cipher);
       if(!from->cipher)
        {
@@ -251,6 +258,7 @@ cp
          syslog(LOG_ERR, _("Node %s (%s) uses wrong keylength!"), from->name, from->hostname);
          return -1;
         }
+#endif
     }
   else
     {
@@ -261,6 +269,7 @@ cp
 
   if(digest)
     {
+#ifdef USE_OPENSSL
       from->digest = EVP_get_digestbynid(digest);
       if(!from->digest)
        {
@@ -272,6 +281,7 @@ cp
          syslog(LOG_ERR, _("Node %s (%s) uses bogus MAC length!"), from->name, from->hostname);
          return -1;
        }
+#endif
     }
   else
     {