Browse code

Fixed bug with tls-auth and key-direction parameter which was introduced in r844.

git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@865 e7ae566f-a301-0410-adde-c780ea21d3b5

james authored on 2005/12/29 16:47:47
Showing 3 changed files
... ...
@@ -910,6 +910,7 @@ void
910 910
 get_tls_handshake_key (const struct key_type *key_type,
911 911
 		       struct key_ctx_bi *ctx,
912 912
 		       const char *passphrase_file,
913
+		       const int key_direction,
913 914
 		       const unsigned int flags)
914 915
 {
915 916
   if (passphrase_file && key_type->hmac_length)
... ...
@@ -970,7 +971,7 @@ get_tls_handshake_key (const struct key_type *key_type,
970 970
       }
971 971
       /* handle key direction */
972 972
 
973
-      key_direction_state_init (&kds, BOOL_CAST (flags & GHK_KEY_DIR));
973
+      key_direction_state_init (&kds, key_direction);
974 974
       must_have_n_keys (passphrase_file, "tls-auth", &key2, kds.need_keys);
975 975
 
976 976
       /* initialize hmac key in both directions */
... ...
@@ -369,11 +369,11 @@ void openssl_dmalloc_init (void);
369 369
 
370 370
 #ifdef USE_SSL
371 371
 
372
-#define GHK_KEY_DIR (1<<0)
373
-#define GHK_INLINE  (1<<1)
372
+#define GHK_INLINE  (1<<0)
374 373
 void get_tls_handshake_key (const struct key_type *key_type,
375 374
 			    struct key_ctx_bi *ctx,
376 375
 			    const char *passphrase_file,
376
+			    const int key_direction,
377 377
 			    const unsigned int flags);
378 378
 
379 379
 #else
... ...
@@ -1402,7 +1402,7 @@ do_init_crypto_tls_c1 (struct context *c)
1402 1402
       /* TLS handshake authentication (--tls-auth) */
1403 1403
       if (options->tls_auth_file)
1404 1404
 	{
1405
-	  unsigned int flags = options->key_direction ? GHK_KEY_DIR : 0;
1405
+	  unsigned int flags = 0;
1406 1406
 	  const char *file = options->tls_auth_file;
1407 1407
 
1408 1408
 #if ENABLE_INLINE_FILES
... ...
@@ -1415,6 +1415,7 @@ do_init_crypto_tls_c1 (struct context *c)
1415 1415
 	  get_tls_handshake_key (&c->c1.ks.key_type,
1416 1416
 				 &c->c1.ks.tls_auth_key,
1417 1417
 				 file,
1418
+				 options->key_direction,
1418 1419
 				 flags);
1419 1420
 	}
1420 1421