Browse code

Remove key-method 1

Key-method 1 is only needed to talk to pre OpenVPN 2.0 clients.

Patch V2: Fix style. Make V1 op codes illegal, remove all code handling
v1 op codes and give a good warning message if we encounter
them in the legal op codes pre-check.

Patch V3: Add a bit more comments in the existing methods.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: David Sommerseth <davids@openvpn.net>
Message-Id: <20200721100128.9850-1-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg20516.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>

Arne Schwabe authored on 2020/07/21 19:01:28
Showing 11 changed files
... ...
@@ -175,11 +175,7 @@
175 175
  *    appropriate messages to be sent.
176 176
  *
177 177
  * @par Functions which control data channel key generation
178
- *  - Key method 1 key exchange functions:
179
- *     - \c key_method_1_write(), generates and processes key material to
180
- *       be sent to the remote OpenVPN peer.
181
- *     - \c key_method_1_read(), processes key material received from the
182
- *       remote OpenVPN peer.
178
+ *  - Key method 1 key exchange functions were removed from OpenVPN 2.5
183 179
  *  - Key method 2 key exchange functions:
184 180
  *     - \c key_method_2_write(), generates and processes key material to
185 181
  *       be sent to the remote OpenVPN peer.
... ...
@@ -131,11 +131,7 @@ S_ACTIVE                                                            S_ACTIVE
131 131
  * control_processor Control Channel Processor module's\endlink \c
132 132
  * tls_process() function and control the %key generation and exchange
133 133
  * process as follows:
134
- * - %Key method 1:
135
- *   - \c key_method_1_write(): generate random material locally, and load
136
- *     as "sending" keys.
137
- *   - \c key_method_1_read(): read random material received from remote
138
- *     peer, and load as "receiving" keys.
134
+ * - %Key method 1 has been removed in OpenVPN 2.5
139 135
  * - %Key method 2:
140 136
  *   - \c key_method_2_write(): generate random material locally, and if
141 137
  *     in server mode generate %key expansion.
... ...
@@ -150,7 +150,7 @@
150 150
  *
151 151
  * @subsection network_protocol_control_plaintext Structure of plaintext control channel messages
152 152
  *
153
- *  - %Key method 1:
153
+ *  - %Key method 1 (support removed in OpenVPN 2.5):
154 154
  *     - Cipher %key length in bytes (1 byte).
155 155
  *     - Cipher %key (n bytes).
156 156
  *     - HMAC %key length in bytes (1 byte).
... ...
@@ -1100,7 +1100,7 @@ process_incoming_link_part1(struct context *c, struct link_socket_info *lsi, boo
1100 1100
                                 floated, &ad_start))
1101 1101
             {
1102 1102
                 /* Restore pre-NCP frame parameters */
1103
-                if (is_hard_reset(opcode, c->options.key_method))
1103
+                if (is_hard_reset_method2(opcode))
1104 1104
                 {
1105 1105
                     c->c2.frame = c->c2.frame_initial;
1106 1106
 #ifdef ENABLE_FRAGMENT
... ...
@@ -490,11 +490,6 @@ helper_client_server(struct options *o)
490 490
      */
491 491
     if (o->client)
492 492
     {
493
-        if (o->key_method != 2)
494
-        {
495
-            msg(M_USAGE, "--client requires --key-method 2");
496
-        }
497
-
498 493
         o->pull = true;
499 494
         o->tls_client = true;
500 495
     }
... ...
@@ -2852,7 +2852,6 @@ do_init_crypto_tls(struct context *c, const unsigned int flags)
2852 2852
     to.ssl_ctx = c->c1.ks.ssl_ctx;
2853 2853
     to.key_type = c->c1.ks.key_type;
2854 2854
     to.server = options->tls_server;
2855
-    to.key_method = options->key_method;
2856 2855
     to.replay = options->replay;
2857 2856
     to.replay_window = options->replay_window;
2858 2857
     to.replay_time = options->replay_time;
... ...
@@ -876,7 +876,6 @@ init_options(struct options *o, const bool init_gc)
876 876
 #ifdef ENABLE_PREDICTION_RESISTANCE
877 877
     o->use_prediction_resistance = false;
878 878
 #endif
879
-    o->key_method = 2;
880 879
     o->tls_timeout = 2;
881 880
     o->renegotiate_bytes = -1;
882 881
     o->renegotiate_seconds = 3600;
... ...
@@ -1714,7 +1713,6 @@ show_settings(const struct options *o)
1714 1714
 
1715 1715
     SHOW_BOOL(tls_server);
1716 1716
     SHOW_BOOL(tls_client);
1717
-    SHOW_INT(key_method);
1718 1717
     SHOW_STR_INLINE(ca_file);
1719 1718
     SHOW_STR(ca_path);
1720 1719
     SHOW_STR(dh_file);
... ...
@@ -2375,10 +2373,6 @@ options_postprocess_verify_ce(const struct options *options, const struct connec
2375 2375
         {
2376 2376
             msg(M_USAGE, "--ccd-exclusive must be used with --client-config-dir");
2377 2377
         }
2378
-        if (options->key_method != 2)
2379
-        {
2380
-            msg(M_USAGE, "--mode server requires --key-method 2");
2381
-        }
2382 2378
         if (options->auth_token_generate && !options->renegotiate_seconds)
2383 2379
         {
2384 2380
             msg(M_USAGE, "--auth-gen-token needs a non-infinite "
... ...
@@ -2545,13 +2539,6 @@ options_postprocess_verify_ce(const struct options *options, const struct connec
2545 2545
             "may accept clients which do not present a certificate");
2546 2546
     }
2547 2547
 
2548
-    if (options->key_method == 1)
2549
-    {
2550
-        msg(M_WARN, "WARNING: --key-method 1 is deprecated and will be removed "
2551
-            "in OpenVPN 2.5.  By default --key-method 2 will be used if not set "
2552
-            "in the configuration file, which is the recommended approach.");
2553
-    }
2554
-
2555 2548
     const int tls_version_max =
2556 2549
         (options->ssl_flags >> SSLF_TLS_VERSION_MAX_SHIFT)
2557 2550
         & SSLF_TLS_VERSION_MAX_MASK;
... ...
@@ -2793,7 +2780,6 @@ options_postprocess_verify_ce(const struct options *options, const struct connec
2793 2793
         MUST_BE_UNDEF(push_peer_info);
2794 2794
         MUST_BE_UNDEF(tls_exit);
2795 2795
         MUST_BE_UNDEF(crl_file);
2796
-        MUST_BE_UNDEF(key_method);
2797 2796
         MUST_BE_UNDEF(ns_cert_type);
2798 2797
         MUST_BE_UNDEF(remote_cert_ku[0]);
2799 2798
         MUST_BE_UNDEF(remote_cert_eku);
... ...
@@ -3822,10 +3808,7 @@ options_string(const struct options *o,
3822 3822
              * tls-auth/tls-crypt does not match.  Removing tls-auth here would
3823 3823
              * break stuff, so leaving that in place. */
3824 3824
 
3825
-            if (o->key_method > 1)
3826
-            {
3827
-                buf_printf(&out, ",key-method %d", o->key_method);
3828
-            }
3825
+            buf_printf(&out, ",key-method %d", KEY_METHOD_2);
3829 3826
         }
3830 3827
 
3831 3828
         if (remote)
... ...
@@ -8456,22 +8439,6 @@ add_option(struct options *options,
8456 8456
         VERIFY_PERMISSION(OPT_P_GENERAL);
8457 8457
         options->tls_crypt_v2_verify_script = p[1];
8458 8458
     }
8459
-    else if (streq(p[0], "key-method") && p[1] && !p[2])
8460
-    {
8461
-        int key_method;
8462
-
8463
-        VERIFY_PERMISSION(OPT_P_GENERAL);
8464
-        key_method = atoi(p[1]);
8465
-        if (key_method < KEY_METHOD_MIN || key_method > KEY_METHOD_MAX)
8466
-        {
8467
-            msg(msglevel, "key_method parameter (%d) must be >= %d and <= %d",
8468
-                key_method,
8469
-                KEY_METHOD_MIN,
8470
-                KEY_METHOD_MAX);
8471
-            goto err;
8472
-        }
8473
-        options->key_method = key_method;
8474
-    }
8475 8459
     else if (streq(p[0], "x509-track") && p[1] && !p[2])
8476 8460
     {
8477 8461
         VERIFY_PERMISSION(OPT_P_GENERAL);
... ...
@@ -571,10 +571,6 @@ struct options
571 571
 #ifdef ENABLE_CRYPTOAPI
572 572
     const char *cryptoapi_cert;
573 573
 #endif
574
-
575
-    /* data channel key exchange method */
576
-    int key_method;
577
-
578 574
     /* Per-packet timeout on control channel */
579 575
     int tls_timeout;
580 576
 
... ...
@@ -855,23 +855,12 @@ print_key_id(struct tls_multi *multi, struct gc_arena *gc)
855 855
 }
856 856
 
857 857
 bool
858
-is_hard_reset(int op, int key_method)
858
+is_hard_reset_method2(int op)
859 859
 {
860
-    if (!key_method || key_method == 1)
860
+    if (op == P_CONTROL_HARD_RESET_CLIENT_V2 || op == P_CONTROL_HARD_RESET_SERVER_V2
861
+        || op == P_CONTROL_HARD_RESET_CLIENT_V3)
861 862
     {
862
-        if (op == P_CONTROL_HARD_RESET_CLIENT_V1 || op == P_CONTROL_HARD_RESET_SERVER_V1)
863
-        {
864
-            return true;
865
-        }
866
-    }
867
-
868
-    if (!key_method || key_method >= 2)
869
-    {
870
-        if (op == P_CONTROL_HARD_RESET_CLIENT_V2 || op == P_CONTROL_HARD_RESET_SERVER_V2
871
-            || op == P_CONTROL_HARD_RESET_CLIENT_V3)
872
-        {
873
-            return true;
874
-        }
863
+        return true;
875 864
     }
876 865
 
877 866
     return false;
... ...
@@ -1091,23 +1080,14 @@ tls_session_init(struct tls_multi *multi, struct tls_session *session)
1091 1091
     }
1092 1092
 
1093 1093
     /* Are we a TLS server or client? */
1094
-    ASSERT(session->opt->key_method >= 1);
1095
-    if (session->opt->key_method == 1)
1094
+    if (session->opt->server)
1096 1095
     {
1097
-        session->initial_opcode = session->opt->server ?
1098
-                                  P_CONTROL_HARD_RESET_SERVER_V1 : P_CONTROL_HARD_RESET_CLIENT_V1;
1096
+        session->initial_opcode = P_CONTROL_HARD_RESET_SERVER_V2;
1099 1097
     }
1100
-    else /* session->opt->key_method >= 2 */
1098
+    else
1101 1099
     {
1102
-        if (session->opt->server)
1103
-        {
1104
-            session->initial_opcode = P_CONTROL_HARD_RESET_SERVER_V2;
1105
-        }
1106
-        else
1107
-        {
1108
-            session->initial_opcode = session->opt->tls_crypt_v2 ?
1109
-                                      P_CONTROL_HARD_RESET_CLIENT_V3 : P_CONTROL_HARD_RESET_CLIENT_V2;
1110
-        }
1100
+        session->initial_opcode = session->opt->tls_crypt_v2 ?
1101
+                                  P_CONTROL_HARD_RESET_CLIENT_V3 : P_CONTROL_HARD_RESET_CLIENT_V2;
1111 1102
     }
1112 1103
 
1113 1104
     /* Initialize control channel authentication parameters */
... ...
@@ -2219,52 +2199,6 @@ read_string_alloc(struct buffer *buf)
2219 2219
     return str;
2220 2220
 }
2221 2221
 
2222
-/*
2223
- * Handle the reading and writing of key data to and from
2224
- * the TLS control channel (cleartext).
2225
- */
2226
-
2227
-static bool
2228
-key_method_1_write(struct buffer *buf, struct tls_session *session)
2229
-{
2230
-    struct key key;
2231
-    struct key_state *ks = &session->key[KS_PRIMARY];      /* primary key */
2232
-
2233
-    ASSERT(session->opt->key_method == 1);
2234
-    ASSERT(buf_init(buf, 0));
2235
-
2236
-    generate_key_random(&key, &session->opt->key_type);
2237
-    if (!check_key(&key, &session->opt->key_type))
2238
-    {
2239
-        msg(D_TLS_ERRORS, "TLS Error: Bad encrypting key generated");
2240
-        return false;
2241
-    }
2242
-
2243
-    if (!write_key(&key, &session->opt->key_type, buf))
2244
-    {
2245
-        msg(D_TLS_ERRORS, "TLS Error: write_key failed");
2246
-        return false;
2247
-    }
2248
-
2249
-    init_key_ctx(&ks->crypto_options.key_ctx_bi.encrypt, &key,
2250
-                 &session->opt->key_type, OPENVPN_OP_ENCRYPT,
2251
-                 "Data Channel Encrypt");
2252
-    secure_memzero(&key, sizeof(key));
2253
-
2254
-    /* send local options string */
2255
-    {
2256
-        const char *local_options = local_options_string(session);
2257
-        const int optlen = strlen(local_options) + 1;
2258
-        if (!buf_write(buf, local_options, optlen))
2259
-        {
2260
-            msg(D_TLS_ERRORS, "TLS Error: KM1 write options failed");
2261
-            return false;
2262
-        }
2263
-    }
2264
-
2265
-    return true;
2266
-}
2267
-
2268 2222
 static bool
2269 2223
 push_peer_info(struct buffer *buf, struct tls_session *session)
2270 2224
 {
... ...
@@ -2372,12 +2306,15 @@ error:
2372 2372
     return ret;
2373 2373
 }
2374 2374
 
2375
+/**
2376
+ * Handle the writing of key data, peer-info, username/password, OCC
2377
+ * to the TLS control channel (cleartext).
2378
+ */
2375 2379
 static bool
2376 2380
 key_method_2_write(struct buffer *buf, struct tls_session *session)
2377 2381
 {
2378 2382
     struct key_state *ks = &session->key[KS_PRIMARY];      /* primary key */
2379 2383
 
2380
-    ASSERT(session->opt->key_method == 2);
2381 2384
     ASSERT(buf_init(buf, 0));
2382 2385
 
2383 2386
     /* write a uint32 0 */
... ...
@@ -2387,7 +2324,7 @@ key_method_2_write(struct buffer *buf, struct tls_session *session)
2387 2387
     }
2388 2388
 
2389 2389
     /* write key_method + flags */
2390
-    if (!buf_write_u8(buf, (session->opt->key_method & KEY_METHOD_MASK)))
2390
+    if (!buf_write_u8(buf, KEY_METHOD_2))
2391 2391
     {
2392 2392
         goto error;
2393 2393
     }
... ...
@@ -2489,73 +2426,15 @@ error:
2489 2489
     return false;
2490 2490
 }
2491 2491
 
2492
-static bool
2493
-key_method_1_read(struct buffer *buf, struct tls_session *session)
2494
-{
2495
-    int status;
2496
-    struct key key;
2497
-    struct key_state *ks = &session->key[KS_PRIMARY];      /* primary key */
2498
-
2499
-    ASSERT(session->opt->key_method == 1);
2500
-
2501
-    if (!session->verified)
2502
-    {
2503
-        msg(D_TLS_ERRORS,
2504
-            "TLS Error: Certificate verification failed (key-method 1)");
2505
-        goto error;
2506
-    }
2507
-
2508
-    status = read_key(&key, &session->opt->key_type, buf);
2509
-    if (status != 1)
2510
-    {
2511
-        msg(D_TLS_ERRORS,
2512
-            "TLS Error: Error reading data channel key from plaintext buffer");
2513
-        goto error;
2514
-    }
2515
-
2516
-    if (!check_key(&key, &session->opt->key_type))
2517
-    {
2518
-        msg(D_TLS_ERRORS, "TLS Error: Bad decrypting key received from peer");
2519
-        goto error;
2520
-    }
2521
-
2522
-    if (buf->len < 1)
2523
-    {
2524
-        msg(D_TLS_ERRORS, "TLS Error: Missing options string");
2525
-        goto error;
2526
-    }
2527
-
2528
-#ifdef ENABLE_OCC
2529
-    /* compare received remote options string
2530
-     * with our locally computed options string */
2531
-    if (!session->opt->disable_occ
2532
-        && !options_cmp_equal_safe((char *) BPTR(buf), session->opt->remote_options, buf->len))
2533
-    {
2534
-        options_warning_safe((char *) BPTR(buf), session->opt->remote_options, buf->len);
2535
-    }
2536
-#endif
2537
-
2538
-    buf_clear(buf);
2539
-
2540
-    init_key_ctx(&ks->crypto_options.key_ctx_bi.decrypt, &key,
2541
-                 &session->opt->key_type, OPENVPN_OP_DECRYPT,
2542
-                 "Data Channel Decrypt");
2543
-    secure_memzero(&key, sizeof(key));
2544
-    ks->authenticated = KS_AUTH_TRUE;
2545
-    return true;
2546
-
2547
-error:
2548
-    buf_clear(buf);
2549
-    secure_memzero(&key, sizeof(key));
2550
-    return false;
2551
-}
2552
-
2492
+/**
2493
+ * Handle reading key data, peer-info, username/password, OCC
2494
+ * from the TLS control channel (cleartext).
2495
+ */
2553 2496
 static bool
2554 2497
 key_method_2_read(struct buffer *buf, struct tls_multi *multi, struct tls_session *session)
2555 2498
 {
2556 2499
     struct key_state *ks = &session->key[KS_PRIMARY];      /* primary key */
2557 2500
 
2558
-    int key_method_flags;
2559 2501
     bool username_status, password_status;
2560 2502
 
2561 2503
     struct gc_arena gc = gc_new();
... ...
@@ -2565,8 +2444,6 @@ key_method_2_read(struct buffer *buf, struct tls_multi *multi, struct tls_sessio
2565 2565
     /* allocate temporary objects */
2566 2566
     ALLOC_ARRAY_CLEAR_GC(options, char, TLS_OPTIONS_LEN, &gc);
2567 2567
 
2568
-    ASSERT(session->opt->key_method == 2);
2569
-
2570 2568
     /* discard leading uint32 */
2571 2569
     if (!buf_advance(buf, 4))
2572 2570
     {
... ...
@@ -2576,7 +2453,7 @@ key_method_2_read(struct buffer *buf, struct tls_multi *multi, struct tls_sessio
2576 2576
     }
2577 2577
 
2578 2578
     /* get key method */
2579
-    key_method_flags = buf_read_u8(buf);
2579
+    int key_method_flags = buf_read_u8(buf);
2580 2580
     if ((key_method_flags & KEY_METHOD_MASK) != 2)
2581 2581
     {
2582 2582
         msg(D_TLS_ERRORS,
... ...
@@ -2986,23 +2863,9 @@ tls_process(struct tls_multi *multi,
2986 2986
         if (!buf->len && ((ks->state == S_START && !session->opt->server)
2987 2987
                           || (ks->state == S_GOT_KEY && session->opt->server)))
2988 2988
         {
2989
-            if (session->opt->key_method == 1)
2990
-            {
2991
-                if (!key_method_1_write(buf, session))
2992
-                {
2993
-                    goto error;
2994
-                }
2995
-            }
2996
-            else if (session->opt->key_method == 2)
2997
-            {
2998
-                if (!key_method_2_write(buf, session))
2999
-                {
3000
-                    goto error;
3001
-                }
3002
-            }
3003
-            else
2989
+            if (!key_method_2_write(buf, session))
3004 2990
             {
3005
-                ASSERT(0);
2991
+                goto error;
3006 2992
             }
3007 2993
 
3008 2994
             state_change = true;
... ...
@@ -3016,23 +2879,9 @@ tls_process(struct tls_multi *multi,
3016 3016
             && ((ks->state == S_SENT_KEY && !session->opt->server)
3017 3017
                 || (ks->state == S_START && session->opt->server)))
3018 3018
         {
3019
-            if (session->opt->key_method == 1)
3020
-            {
3021
-                if (!key_method_1_read(buf, session))
3022
-                {
3023
-                    goto error;
3024
-                }
3025
-            }
3026
-            else if (session->opt->key_method == 2)
3027
-            {
3028
-                if (!key_method_2_read(buf, multi, session))
3029
-                {
3030
-                    goto error;
3031
-                }
3032
-            }
3033
-            else
3019
+            if (!key_method_2_read(buf, multi, session))
3034 3020
             {
3035
-                ASSERT(0);
3021
+                goto error;
3036 3022
             }
3037 3023
 
3038 3024
             state_change = true;
... ...
@@ -3446,6 +3295,11 @@ tls_pre_decrypt(struct tls_multi *multi,
3446 3446
             /* verify legal opcode */
3447 3447
             if (op < P_FIRST_OPCODE || op > P_LAST_OPCODE)
3448 3448
             {
3449
+                if (op == P_CONTROL_HARD_RESET_CLIENT_V1
3450
+                    || op == P_CONTROL_HARD_RESET_SERVER_V1)
3451
+                {
3452
+                    msg(D_TLS_ERRORS, "Peer tried unsupported key-method 1");
3453
+                }
3449 3454
                 msg(D_TLS_ERRORS,
3450 3455
                     "TLS Error: unknown opcode received from %s op=%d",
3451 3456
                     print_link_socket_actual(from, &gc), op);
... ...
@@ -3453,14 +3307,12 @@ tls_pre_decrypt(struct tls_multi *multi,
3453 3453
             }
3454 3454
 
3455 3455
             /* hard reset ? */
3456
-            if (is_hard_reset(op, 0))
3456
+            if (is_hard_reset_method2(op))
3457 3457
             {
3458 3458
                 /* verify client -> server or server -> client connection */
3459
-                if (((op == P_CONTROL_HARD_RESET_CLIENT_V1
3460
-                      || op == P_CONTROL_HARD_RESET_CLIENT_V2
3459
+                if (((op == P_CONTROL_HARD_RESET_CLIENT_V2
3461 3460
                       || op == P_CONTROL_HARD_RESET_CLIENT_V3) && !multi->opt.server)
3462
-                    || ((op == P_CONTROL_HARD_RESET_SERVER_V1
3463
-                         || op == P_CONTROL_HARD_RESET_SERVER_V2) && multi->opt.server))
3461
+                    || ((op == P_CONTROL_HARD_RESET_SERVER_V2) && multi->opt.server))
3464 3462
                 {
3465 3463
                     msg(D_TLS_ERRORS,
3466 3464
                         "TLS Error: client->client or server->server connection attempted from %s",
... ...
@@ -3522,22 +3374,14 @@ tls_pre_decrypt(struct tls_multi *multi,
3522 3522
             }
3523 3523
 
3524 3524
             /*
3525
-             * Initial packet received.
3525
+             * Hard reset and session id does not match any session in
3526
+             * multi->session: Possible initial packet
3526 3527
              */
3527
-
3528
-            if (i == TM_SIZE && is_hard_reset(op, 0))
3528
+            if (i == TM_SIZE && is_hard_reset_method2(op))
3529 3529
             {
3530 3530
                 struct tls_session *session = &multi->session[TM_ACTIVE];
3531 3531
                 struct key_state *ks = &session->key[KS_PRIMARY];
3532 3532
 
3533
-                if (!is_hard_reset(op, multi->opt.key_method))
3534
-                {
3535
-                    msg(D_TLS_ERRORS, "TLS ERROR: initial packet local/remote key_method mismatch, local key_method=%d, op=%s",
3536
-                        multi->opt.key_method,
3537
-                        packet_opcode_name(op));
3538
-                    goto error;
3539
-                }
3540
-
3541 3533
                 /*
3542 3534
                  * If we have no session currently in progress, the initial packet will
3543 3535
                  * open a new session in TM_ACTIVE rather than TM_UNTRUSTED.
... ...
@@ -3577,7 +3421,11 @@ tls_pre_decrypt(struct tls_multi *multi,
3577 3577
                 }
3578 3578
             }
3579 3579
 
3580
-            if (i == TM_SIZE && is_hard_reset(op, 0))
3580
+            /*
3581
+             * If we detected new session in the last if block, i has
3582
+             * changed to TM_ACTIVE, so check the condition again.
3583
+             */
3584
+            if (i == TM_SIZE && is_hard_reset_method2(op))
3581 3585
             {
3582 3586
                 /*
3583 3587
                  * No match with existing sessions,
... ...
@@ -3597,14 +3445,6 @@ tls_pre_decrypt(struct tls_multi *multi,
3597 3597
                     goto error;
3598 3598
                 }
3599 3599
 
3600
-                if (!is_hard_reset(op, multi->opt.key_method))
3601
-                {
3602
-                    msg(D_TLS_ERRORS, "TLS ERROR: new session local/remote key_method mismatch, local key_method=%d, op=%s",
3603
-                        multi->opt.key_method,
3604
-                        packet_opcode_name(op));
3605
-                    goto error;
3606
-                }
3607
-
3608 3600
                 if (!read_control_auth(buf, &session->tls_wrap, from,
3609 3601
                                        session->opt))
3610 3602
                 {
... ...
@@ -66,8 +66,10 @@
66 66
 /* indicates key_method >= 2 and client-specific tls-crypt key */
67 67
 #define P_CONTROL_HARD_RESET_CLIENT_V3 10    /* initial key from client, forget previous state */
68 68
 
69
-/* define the range of legal opcodes */
70
-#define P_FIRST_OPCODE                 1
69
+/* define the range of legal opcodes
70
+ * Since we do no longer support key-method 1 we consider
71
+ * the v1 op codes invalid */
72
+#define P_FIRST_OPCODE                 3
71 73
 #define P_LAST_OPCODE                  10
72 74
 
73 75
 /*
... ...
@@ -102,11 +104,7 @@
102 102
 /* Default field in X509 to be username */
103 103
 #define X509_USERNAME_FIELD_DEFAULT "CN"
104 104
 
105
-/*
106
- * Range of key exchange methods
107
- */
108
-#define KEY_METHOD_MIN 1
109
-#define KEY_METHOD_MAX 2
105
+#define KEY_METHOD_2  2
110 106
 
111 107
 /* key method taken from lower 4 bits */
112 108
 #define KEY_METHOD_MASK 0x0F
... ...
@@ -578,12 +576,11 @@ void show_tls_performance_stats(void);
578 578
 void extract_x509_field_test(void);
579 579
 
580 580
 /**
581
- * Given a key_method, return true if opcode represents the required form of
582
- * hard_reset.
581
+ * Given a key_method, return true if opcode represents the one of the
582
+ * hard_reset op codes for key-method 2
583 583
  *
584
- * If key_method == 0, return true if any form of hard reset is used.
585 584
  */
586
-bool is_hard_reset(int op, int key_method);
585
+bool is_hard_reset_method2(int op);
587 586
 
588 587
 void delayed_auth_pass_purge(void);
589 588
 
... ...
@@ -262,7 +262,6 @@ struct tls_options
262 262
 #endif
263 263
 
264 264
     /* from command line */
265
-    int key_method;
266 265
     bool replay;
267 266
     bool single_session;
268 267
 #ifdef ENABLE_OCC