updates.
authorPekka Riikonen <priikone@silcnet.org>
Wed, 13 Feb 2002 21:15:19 +0000 (21:15 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Wed, 13 Feb 2002 21:15:19 +0000 (21:15 +0000)
CHANGES
apps/silcd/protocol.c

diff --git a/CHANGES b/CHANGES
index 595b90688487af4725df488b9e527263b47fffe3..b42eb8840ee4bfdebc7c4ea208e764df75d50490 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,10 @@
-Wed Feb 13 20:51:13 EET 2002  Johnny Mnemonic <johnny@themnemonic.org>
+Wed Feb 13 23:16:41 EET 2002  Pekka Riikonen <priikone@silcnet.org>
+
+       * Fixed the public key authentication to allocate always the
+         destination signature buffer instead of using static buffer.
+         Affected file silcd/protocol.c.
+
+Wed Feb 13 20:51:13 EET 2002  Pekka Riikonen <priikone@silcnet.org>
 
        * Unified the serverconfig.[ch]'s helper function interface.
          Affected file silcd/serverconfig.[ch].
index 449a6886daaa3b9190982cc6d85c1ff2f5f49632..afa0ad43ff69b43465a569a1f5070c9fe16aac87 100644 (file)
@@ -783,7 +783,7 @@ silc_server_public_key_authentication(SilcServer server,
 
 static int
 silc_server_get_public_key_auth(SilcServer server,
-                               unsigned char *auth_data,
+                               unsigned char **auth_data,
                                uint32 *auth_data_len,
                                SilcSKE ske)
 {
@@ -804,12 +804,14 @@ silc_server_get_public_key_auth(SilcServer server,
                                          ske->start_payload_copy->len),
                     SILC_STR_END);
 
+  *auth_data = silc_calloc(silc_pkcs_get_key_len(pkcs), sizeof(**auth_data));
   if (silc_pkcs_sign_with_hash(pkcs, ske->prop->hash, auth->data, 
-                              auth->len, auth_data, auth_data_len)) {
+                              auth->len, *auth_data, auth_data_len)) {
     silc_buffer_free(auth);
     return TRUE;
   }
 
+  silc_free(*auth_data);
   silc_buffer_free(auth);
   return FALSE;
 }
@@ -1073,13 +1075,9 @@ SILC_TASK_CALLBACK(silc_server_protocol_connection_auth)
          
        case SILC_AUTH_PUBLIC_KEY:
          {
-           unsigned char sign[1024];
-
            /* Public key authentication */
-           silc_server_get_public_key_auth(server, sign, &auth_data_len,
+           silc_server_get_public_key_auth(server, &auth_data, &auth_data_len,
                                            ctx->ske);
-           auth_data = silc_calloc(auth_data_len, sizeof(*auth_data));
-           memcpy(auth_data, sign, auth_data_len);
            break;
          }
        }