From: "plaisthos (Code Review)" Date: Fri, 7 Feb 2025 13:00:06 +0000 In-Reply-To: References: Reply-To: arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641..., max@...2606..., gert@...1296... Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="D3i0rA3Me20="; charset=UTF-8 Subject: [Openvpn-devel] [L] Change in openvpn[master]: Implement epoch key data format List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: cron2 , flichtenheld Cc: openvpn-devel , MaxF --D3i0rA3Me20= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: MaxF, cron2, flichtenheld. Hello cron2, flichtenheld, I'd like you to reexamine a change. Please visit http://gerrit.openvpn.net/c/openvpn/+/806?usp=3Demail to look at the new patch set (#19). The following approvals got outdated and were removed: Code-Review+1 by cron2 Change subject: Implement epoch key data format ...................................................................... Implement epoch key data format With DCO and possible future hardware assisted OpenVPN acceleration we are approaching the point where 32 bit IVs are not cutting it any more, especially if we are limiting the IVs to the safe limits of AES-GCM where the limit is more 2^29. To illustrate the problem, some back of the envelope math here: If we want to keep the current 3600s renegotiation interval and have a safety margin of 25% (when we trigger renegotiation) we have about 3.2 million packets (2*32 * 0.7) to work with. That translates to about 835k packets per second. Currently, implementation trigger the renegotiation at 0xff00000000 or at 7/8 of the AEAD usage limit. With 1300 Byte packets that translates into 8-9 Gbit/s. That is far from unrealistic any more. Current DCO implementations are already in spitting distance to that or might even reach (for a single client connection) that if you have extremely fast single core performance CPU. With the AEAD usage limit, these limits are almost a factor of 8 lower so with the limit becomes 1-2 GBit/s. This is already reached without DCO on some platforms. This introduces the epoch data format for AEAD data channel ciphers in TLS mode ciphers. No effort has been made to support larger packet counters in any other scenario since those are all legacy. This uses the same approach of epoch keys as (D)TLS 1.3 does and switches the data channel regularly for affected AEAD ciphers when reaching the usage limit. For Chacha20-Poly1305, which does not suffer the same problems as AES-GCM, the full 48 bit of packet counter are used only after that the same logic to switch to a new key as with AES-GCM is done. Change-Id: I00751c42cb04e30205ba8e6584530831e0d143c5 Signed-off-by: Arne Schwabe --- M CMakeLists.txt M Changes.rst M src/openvpn/crypto.c M src/openvpn/crypto.h M src/openvpn/crypto_backend.h M src/openvpn/dco.h M src/openvpn/init.c M src/openvpn/multi.c M src/openvpn/ssl.c M src/openvpn/ssl_common.h M src/openvpn/ssl_ncp.c M src/openvpn/tls_crypt.c M tests/Makefile.am M tests/unit_tests/openvpn/Makefile.am M tests/unit_tests/openvpn/test_crypto.c M tests/unit_tests/openvpn/test_ssl.c 16 files changed, 515 insertions(+), 74 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/06/806/19 diff --git a/CMakeLists.txt b/CMakeLists.txt index ea8d006..5081e81 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -706,6 +706,7 @@ target_sources(test_auth_token PRIVATE src/openvpn/base64.c + src/openvpn/crypto_epoch.c src/openvpn/crypto_mbedtls.c src/openvpn/crypto_openssl.c src/openvpn/crypto.c @@ -734,9 +735,10 @@ tests/unit_tests/openvpn/mock_win32_execve.c src/openvpn/argv.c src/openvpn/base64.c - src/openvpn/crypto.c + src/openvpn/crypto_epoch.c src/openvpn/crypto_mbedtls.c src/openvpn/crypto_openssl.c + src/openvpn/crypto.c src/openvpn/cryptoapi.c src/openvpn/env_set.c src/openvpn/mss.c @@ -762,6 +764,7 @@ ) target_sources(test_ncp PRIVATE + src/openvpn/crypto_epoch.c src/openvpn/crypto_mbedtls.c src/openvpn/crypto_openssl.c src/openvpn/crypto.c @@ -783,6 +786,7 @@ tests/unit_tests/openvpn/mock_win32_execve.c src/openvpn/argv.c src/openvpn/base64.c + src/openvpn/crypto_epoch.c src/openvpn/crypto_mbedtls.c src/openvpn/crypto_openssl.c src/openvpn/crypto.c @@ -836,9 +840,11 @@ target_compile_options(test_networking PRIVATE -UNDEBUG) target_sources(test_networking PRIVATE src/openvpn/networking_sitnl.c + src/openvpn/crypto_epoch.c src/openvpn/crypto_mbedtls.c src/openvpn/crypto_openssl.c src/openvpn/crypto.c + src/openvpn/crypto_epoch.c src/openvpn/otime.c src/openvpn/packet_id.c ) @@ -854,6 +860,7 @@ tests/unit_tests/openvpn/mock_win32_execve.c src/openvpn/argv.c src/openvpn/base64.c + src/openvpn/crypto_epoch.c src/openvpn/crypto_mbedtls.c src/openvpn/crypto_openssl.c src/openvpn/crypto.c diff --git a/Changes.rst b/Changes.rst index d01816b..e011811 100644 --- a/Changes.rst +++ b/Changes.rst @@ -35,6 +35,19 @@ replaced by the default ciphers used by OpenVPN, making it easier to add an allowed cipher without having to spell out the default ciphers. +Epoch data keys and packet format + This introduces the epoch data format for AEAD data channel + ciphers in TLS mode ciphers. This new data format has a number of + improvements over the standard "DATA_V2" format. + + - AEAD tag at the end of packet which is more hardware implementation + friendly + - Automatic key switchover when cipher usage limits are hit, similar to + the epoch data keys in (D)TLS 1.3 + - 64 bit instead of 32 bit packet ids to allow the data channel to be + ready for 10 GBit/s without having frequent renegotiation + - IV constructed with XOR instead of concatenation to not have (parts)= of + the real IV on the wire Deprecated features ------------------- diff --git a/src/openvpn/crypto.c b/src/openvpn/crypto.c index dbd95a8..ed70f51 100644 --- a/src/openvpn/crypto.c +++ b/src/openvpn/crypto.c @@ -32,6 +32,8 @@ #include #include "crypto.h" +#include "crypto_epoch.h" +#include "packet_id.h" #include "error.h" #include "integer.h" #include "platform.h" @@ -67,6 +69,13 @@ { struct gc_arena gc; int outlen =3D 0; + const bool use_epoch_data_format =3D opt->flags & CO_EPOCH_DATA_KEY_FO= RMAT; + + if (use_epoch_data_format) + { + epoch_check_send_iterate(opt); + } + const struct key_ctx *ctx =3D &opt->key_ctx_bi.encrypt; uint8_t *mac_out =3D NULL; const int mac_len =3D OPENVPN_AEAD_TAG_LENGTH; @@ -88,14 +97,24 @@ buf_set_write(&iv_buffer, iv, iv_len); /* IV starts with packet id to make the IV unique for packet */ - if (!packet_id_write(&opt->packet_id.send, &iv_buffer, false, fals= e)) + if (use_epoch_data_format) { - msg(D_CRYPT_ERRORS, "ENCRYPT ERROR: packet ID roll over"); - goto err; + if (!packet_id_write_epoch(&opt->packet_id.send, ctx->epoch, &= iv_buffer)) + { + msg(D_CRYPT_ERRORS, "ENCRYPT ERROR: packet ID roll over"); + goto err; + } } - + else + { + if (!packet_id_write(&opt->packet_id.send, &iv_buffer, false, = false)) + { + msg(D_CRYPT_ERRORS, "ENCRYPT ERROR: packet ID roll over"); + goto err; + } + } /* Write packet id part of IV to work buffer */ - ASSERT(buf_write(&work, iv, packet_id_size(false))); + ASSERT(buf_write(&work, iv, buf_len(&iv_buffer))); /* This generates the IV by XORing the implicit part of the IV * with the packet id already written to the iv buffer */ @@ -127,7 +146,7 @@ dmsg(D_PACKET_CONTENT, "ENCRYPT AD: %s", format_hex(BPTR(&work), BLEN(&work), 0, &gc)); - if (!(opt->flags & CO_EPOCH_DATA_KEY_FORMAT)) + if (!use_epoch_data_format) { /* Reserve space for authentication tag */ mac_out =3D buf_write_alloc(&work, mac_len); @@ -148,7 +167,7 @@ ASSERT(buf_inc_len(&work, outlen)); /* if the tag is at end the end, allocate it now */ - if (opt->flags & CO_EPOCH_DATA_KEY_FORMAT) + if (use_epoch_data_format) { /* Reserve space for authentication tag */ mac_out =3D buf_write_alloc(&work, mac_len); @@ -363,14 +382,35 @@ bool crypto_check_replay(struct crypto_options *opt, - const struct packet_id_net *pin, const char *error_pre= fix, + const struct packet_id_net *pin, uint16_t epoch, + const char *error_prefix, struct gc_arena *gc) { bool ret =3D false; - packet_id_reap_test(&opt->packet_id.rec); - if (packet_id_test(&opt->packet_id.rec, pin)) + struct packet_id_rec *recv; + + if (epoch =3D=3D 0 || opt->key_ctx_bi.decrypt.epoch =3D=3D epoch) { - packet_id_add(&opt->packet_id.rec, pin); + recv =3D &opt->packet_id.rec; + } + else if (epoch =3D=3D opt->epoch_retiring_data_receive_key.epoch) + { + recv =3D &opt->epoch_retiring_key_pid_recv; + } + else + { + /* We have an epoch that is neither current or old recv key but + * is authenticated, ie we need to move to a new current recv key = */ + msg(D_GENKEY, "Received data packet with new epoch %d. Updating " + "receive key", epoch); + epoch_replace_update_recv_key(opt, epoch); + recv =3D &opt->packet_id.rec; + } + + packet_id_reap_test(recv); + if (packet_id_test(recv, pin)) + { + packet_id_add(recv, pin); if (opt->pid_persist && (opt->flags & CO_PACKET_ID_LONG_FORM)) { packet_id_persist_save_obj(opt->pid_persist, &opt->packet_id); @@ -405,16 +445,19 @@ { static const char error_prefix[] =3D "AEAD Decrypt error"; struct packet_id_net pin =3D { 0 }; - struct key_ctx *ctx =3D &opt->key_ctx_bi.decrypt; struct gc_arena gc; - gc_init(&gc); - if (cipher_decrypt_verify_fail_exceeded(ctx)) + struct key_ctx *ctx =3D &opt->key_ctx_bi.decrypt; + const bool use_epoch_data_format =3D opt->flags & CO_EPOCH_DATA_KEY_FO= RMAT; + if (!use_epoch_data_format && cipher_decrypt_verify_fail_exceeded(ctx)) { CRYPT_DROP("Decryption failed verification limit reached."); } + const int tag_size =3D OPENVPN_AEAD_TAG_LENGTH; + + ASSERT(opt); ASSERT(frame); ASSERT(buf->len > 0); @@ -430,18 +473,60 @@ /* IV and Packet ID required for this mode */ ASSERT(packet_id_initialized(&opt->packet_id)); + /* Ensure that the packet size is long enough */ + int min_packet_len =3D packet_id_size(false) + tag_size + 1; + + if (use_epoch_data_format) + { + min_packet_len +=3D sizeof(uint32_t); + } + + if (buf->len < min_packet_len) + { + CRYPT_ERROR("missing IV info, missing tag or no payload"); + } + + uint16_t epoch =3D 0; /* Combine IV from explicit part from packet and implicit part from co= ntext */ { uint8_t iv[OPENVPN_MAX_IV_LENGTH] =3D { 0 }; const int iv_len =3D cipher_ctx_iv_length(ctx->cipher); - const size_t packet_iv_len =3D packet_id_size(false); - if (buf->len < packet_iv_len) + /* Read packet id. For epoch data format also lookup the epoch key + * to be able to use the implicit IV of the correct decryption key= */ + if (use_epoch_data_format) { - CRYPT_ERROR("missing IV info"); - } + /* packet ID format is 16 bit epoch + 48 per epoch packet-coun= ter */ + const size_t packet_iv_len =3D sizeof(uint64_t); - memcpy(iv, BPTR(buf), packet_iv_len); + /* copy the epoch-counter part into the IV */ + memcpy(iv, BPTR(buf), packet_iv_len); + + epoch =3D packet_id_read_epoch(&pin, buf); + if (epoch =3D=3D 0) + { + CRYPT_ERROR("error reading packet-id"); + } + ctx =3D epoch_lookup_decrypt_key(opt, epoch); + if (!ctx) + { + CRYPT_ERROR("data packet with unknown epoch"); + } + else if (cipher_decrypt_verify_fail_exceeded(ctx)) + { + CRYPT_DROP("Decryption failed verification limit reached"); + } + } + else + { + const size_t packet_iv_len =3D packet_id_size(false); + /* Packet ID form is a 32 bit packet counter */ + memcpy(iv, BPTR(buf), packet_iv_len); + if (!packet_id_read(&pin, buf, false)) + { + CRYPT_ERROR("error reading packet-id"); + } + } /* This generates the IV by XORing the implicit part of the IV * with the packet id already written to the iv buffer */ @@ -459,25 +544,12 @@ } } - /* Read packet ID from packet */ - if (!packet_id_read(&pin, buf, false)) - { - CRYPT_ERROR("error reading packet-id"); - } - - /* keep the tag value to feed in later */ - const int tag_size =3D OPENVPN_AEAD_TAG_LENGTH; - if (buf->len < tag_size + 1) - { - CRYPT_ERROR("missing tag or no payload"); - } - const int ad_size =3D BPTR(buf) - ad_start; uint8_t *tag_ptr =3D NULL; int data_len =3D 0; - if (opt->flags & CO_EPOCH_DATA_KEY_FORMAT) + if (use_epoch_data_format) { data_len =3D BLEN(buf) - tag_size; tag_ptr =3D BPTR(buf) + data_len; @@ -498,15 +570,13 @@ CRYPT_ERROR("potential buffer overflow"); } =20 - /* feed in tag and the authenticated data */ ASSERT(cipher_ctx_update_ad(ctx->cipher, ad_start, ad_size)); dmsg(D_PACKET_CONTENT, "DECRYPT AD: %s", format_hex(ad_start, ad_size, 0, &gc)); - int outlen; - /* Decrypt and authenticate packet */ + int outlen; if (!cipher_ctx_update(ctx->cipher, BPTR(&work), &outlen, BPTR(buf), data_len)) { @@ -525,7 +595,7 @@ dmsg(D_PACKET_CONTENT, "DECRYPT TO: %s", format_hex(BPTR(&work), BLEN(&work), 80, &gc)); - if (!crypto_check_replay(opt, &pin, error_prefix, &gc)) + if (!crypto_check_replay(opt, &pin, epoch, error_prefix, &gc)) { goto error_exit; } @@ -702,7 +772,7 @@ } } - if (have_pin && !crypto_check_replay(opt, &pin, error_prefix, &gc)) + if (have_pin && !crypto_check_replay(opt, &pin, 0, error_prefix, &= gc)) { goto error_exit; } diff --git a/src/openvpn/crypto.h b/src/openvpn/crypto.h index 5ceb523..94f1f7f 100644 --- a/src/openvpn/crypto.h +++ b/src/openvpn/crypto.h @@ -525,6 +525,7 @@ * * @param opt Crypto options for this packet, contains replay state. * @param pin Packet ID read from packet. + * @param epoch Epoch read from packet or 0 when epoch is not used. * @param error_prefix Prefix to use when printing error messages. * @param gc Garbage collector to use. * @@ -532,6 +533,7 @@ */ bool crypto_check_replay(struct crypto_options *opt, const struct packet_id_net *pin, + uint16_t epoch, const char *error_prefix, struct gc_arena *gc); diff --git a/src/openvpn/crypto_backend.h b/src/openvpn/crypto_backend.h index 6371013..71e8228 100644 --- a/src/openvpn/crypto_backend.h +++ b/src/openvpn/crypto_backend.h @@ -39,7 +39,7 @@ #include "basic.h" #include "buffer.h" -/* TLS uses a tag of 128 bytes, let's do the same for OpenVPN */ +/* TLS uses a tag of 128 bits, let's do the same for OpenVPN */ #define OPENVPN_AEAD_TAG_LENGTH 16 /* Maximum cipher block size (bytes) */ diff --git a/src/openvpn/dco.h b/src/openvpn/dco.h index 035474f..c3e05a8 100644 --- a/src/openvpn/dco.h +++ b/src/openvpn/dco.h @@ -249,6 +249,15 @@ */ const char *dco_get_supported_ciphers(void); +/** + * Return whether the dco implementation supports the new protocol feature= s of + * a 64 bit packet counter and AEAD tag at the end. + */ +static inline bool +dco_supports_epoch_data(struct context *c) +{ + return false; +} #else /* if defined(ENABLE_DCO) */ typedef void *dco_context_t; @@ -380,5 +389,10 @@ return ""; } +static inline bool +dco_supports_epoch_data(struct context *c) +{ + return false; +} #endif /* defined(ENABLE_DCO) */ #endif /* ifndef DCO_H */ diff --git a/src/openvpn/init.c b/src/openvpn/init.c index 4014517..a01dbdc 100644 --- a/src/openvpn/init.c +++ b/src/openvpn/init.c @@ -2788,6 +2788,19 @@ } } + /* Ensure that for epoch data format is only enabled if also data v2 + * is enabled */ + bool epoch_data =3D (c->options.imported_protocol_flags & CO_EPOCH_DAT= A_KEY_FORMAT); + bool datav2_enabled =3D (c->options.peer_id >=3D 0 && c->options.peer_= id < MAX_PEER_ID); + + if (epoch_data && !datav2_enabled) + { + msg(D_PUSH_ERRORS, "OPTIONS ERROR: Epoch key data format tag requi= res " + "data v2 (peer-id) to be enabled."); + return false; + } + + if (found & OPT_P_PUSH_MTU) { /* MTU has changed, check that the pushed MTU is small enough to @@ -3384,6 +3397,15 @@ to.push_peer_info_detail =3D 1; } + /* Check if the DCO drivers support the epoch data format */ + if (dco_enabled(options)) + { + to.data_epoch_supported =3D dco_supports_epoch_data(c); + } + else + { + to.data_epoch_supported =3D true; + } /* should we not xmit any packets until we get an initial * response from client? */ diff --git a/src/openvpn/multi.c b/src/openvpn/multi.c index 96fa6cd..f76dad8 100644 --- a/src/openvpn/multi.c +++ b/src/openvpn/multi.c @@ -1878,9 +1878,15 @@ char *push_cipher =3D ncp_get_best_cipher(o->ncp_ciphers, peer_info, tls_multi->remote_ciphername, &o->gc); - if (push_cipher) { + /* Enable epoch data key format if supported and AEAD cipher in us= e */ + if (tls_multi->session[TM_ACTIVE].opt->data_epoch_supported + && (proto & IV_PROTO_DATA_EPOCH) && cipher_kt_mode_aead(push_c= ipher)) + { + o->imported_protocol_flags |=3D CO_EPOCH_DATA_KEY_FORMAT; + } + o->ciphername =3D push_cipher; return true; } diff --git a/src/openvpn/ssl.c b/src/openvpn/ssl.c index 6f78a76..439ce79 100644 --- a/src/openvpn/ssl.c +++ b/src/openvpn/ssl.c @@ -55,6 +55,7 @@ #include "route.h" #include "tls_crypt.h" +#include "crypto_epoch.h" #include "ssl.h" #include "ssl_verify.h" #include "ssl_backend.h" @@ -915,6 +916,7 @@ key_state_ssl_free(&ks->ks_ssl); free_key_ctx_bi(&ks->crypto_options.key_ctx_bi); + free_epoch_key_ctx(&ks->crypto_options); free_buf(&ks->plaintext_read_buf); free_buf(&ks->plaintext_write_buf); free_buf(&ks->ack_write_buf); @@ -1362,6 +1364,48 @@ } static void +init_epoch_keys(struct key_state *ks, + struct tls_multi *multi, + const struct key_type *key_type, + bool server, + struct key2 *key2) +{ + /* For now we hardcode this to be 16 for the software based data chann= el + * DCO based implementations/HW implementation might adjust this number + * based on their expected speed */ + const int future_key_count =3D 16; + + int key_direction =3D server ? KEY_DIRECTION_INVERSE : KEY_DIRECTION_N= ORMAL; + struct key_direction_state kds; + key_direction_state_init(&kds, key_direction); + + struct crypto_options *co =3D &ks->crypto_options; + + /* For the epoch key we use the first 32 bytes of key2 cipher keys + * for the initial secret */ + struct epoch_key e1_send =3D { 0 }; + e1_send.epoch =3D 1; + memcpy(&e1_send.epoch_key, key2->keys[kds.out_key].cipher, sizeof(e1_s= end.epoch_key)); + + struct epoch_key e1_recv =3D { 0 }; + e1_recv.epoch =3D 1; + memcpy(&e1_recv.epoch_key, key2->keys[kds.in_key].cipher, sizeof(e1_re= cv.epoch_key)); + + /* DCO implementations have two choices at this point. + * + * a) (more likely) they probably to pass E1 directly to kernel + * space at this point and do all the other key derivation in kernel + * + * b) They let userspace do the key derivation and pass all the indivi= dual + * keys to the DCO layer. + * */ + epoch_init_key_ctx(co, key_type, &e1_send, &e1_recv, future_key_count= ); + + secure_memzero(&e1_send, sizeof(e1_send)); + secure_memzero(&e1_recv, sizeof(e1_recv)); +} + +static void init_key_contexts(struct key_state *ks, struct tls_multi *multi, const struct key_type *key_type, @@ -1394,6 +1438,16 @@ CLEAR(key->decrypt); key->initialized =3D true; } + else if (multi->opt.crypto_flags & CO_EPOCH_DATA_KEY_FORMAT) + { + if (!cipher_kt_mode_aead(key_type->cipher)) + { + msg(M_FATAL, "AEAD cipher (currently %s) " + "required for epoch data format.", + cipher_kt_name(key_type->cipher)); + } + init_epoch_keys(ks, multi, key_type, server, key2); + } else { init_key_ctx_bi(key, key2, key_direction, key_type, "Data Channel"= ); @@ -1969,6 +2023,11 @@ iv_proto |=3D IV_PROTO_NCP_P2P; } + if (session->opt->data_epoch_supported) + { + iv_proto |=3D IV_PROTO_DATA_EPOCH; + } + buf_printf(&out, "IV_CIPHERS=3D%s\n", session->opt->config_ncp_cip= hers); #ifdef HAVE_EXPORT_KEYING_MATERIAL @@ -2978,6 +3037,22 @@ return true; } + /* epoch key id approaching the 16 bit limit */ + if (ks->crypto_options.flags & CO_EPOCH_DATA_KEY_FORMAT) + { + /* We only need to check the send key as we always keep send + * key epoch >=3D recv key epoch in \c epoch_replace_update_recv_k= ey */ + if (ks->crypto_options.epoch_key_send.epoch >=3D 0xF000) + { + return true; + } + else + { + return false; + } + } + + /* Packet id approach the limit of the packet id */ if (packet_id_close_to_wrapping(&ks->crypto_options.packet_id.send)) { @@ -2993,7 +3068,9 @@ * Since if both sides were aware, then both sides will probably also * switch to use epoch data channel instead, so this code is not * in effect then. - */ + * + * When epoch are in use the crypto layer will handle this internally + * with new epochs instead of triggering a renegotiation */ const struct key_ctx_bi *key_ctx_bi =3D &ks->crypto_options.key_ctx_bi; const uint64_t usage_limit =3D session->opt->aead_usage_limit; diff --git a/src/openvpn/ssl_common.h b/src/openvpn/ssl_common.h index e092472..9625a99 100644 --- a/src/openvpn/ssl_common.h +++ b/src/openvpn/ssl_common.h @@ -315,7 +315,6 @@ /* from command line */ bool single_session; - bool disable_occ; int mode; bool pull; /** @@ -368,6 +367,12 @@ const char *config_ciphername; const char *config_ncp_ciphers; + /** whether our underlying data channel supports new data channel + * features (epoch keys with AEAD tag at the end). This is always true + * for the internal implementation but can be false for DCO + * implementations */ + bool data_epoch_supported; + bool tls_crypt_v2; const char *tls_crypt_v2_verify_script; @@ -497,8 +502,6 @@ */ int key_id; - int limit_next; /* used for traffic shaping on the control= channel */ - int verify_maxlevel; char *common_name; diff --git a/src/openvpn/ssl_ncp.c b/src/openvpn/ssl_ncp.c index b238fc0..ead91da 100644 --- a/src/openvpn/ssl_ncp.c +++ b/src/openvpn/ssl_ncp.c @@ -411,7 +411,8 @@ } static void -p2p_ncp_set_options(struct tls_multi *multi, struct tls_session *session) +p2p_ncp_set_options(struct tls_multi *multi, struct tls_session *session, + const char *common_cipher) { /* will return 0 if peer_info is null */ const unsigned int iv_proto_peer =3D extract_iv_proto(multi->peer_info= ); @@ -433,6 +434,18 @@ session->opt->crypto_flags |=3D CO_USE_CC_EXIT_NOTIFY; } + if (session->opt->data_epoch_supported && (iv_proto_peer & IV_PROTO_DA= TA_EPOCH) + && common_cipher && cipher_kt_mode_aead(common_cipher)) + { + session->opt->crypto_flags |=3D CO_EPOCH_DATA_KEY_FORMAT; + } + else + { + /* The peer might have changed its ciphers options during reconnec= t, + * ensure we clear the flag if we previously had it enabled */ + session->opt->crypto_flags &=3D ~CO_EPOCH_DATA_KEY_FORMAT; + } + #if defined(HAVE_EXPORT_KEYING_MATERIAL) if (iv_proto_peer & IV_PROTO_TLS_KEY_EXPORT) { @@ -472,15 +485,15 @@ void p2p_mode_ncp(struct tls_multi *multi, struct tls_session *session) { - /* Set the common options */ - p2p_ncp_set_options(multi, session); - struct gc_arena gc =3D gc_new(); /* Query the common cipher here to log it as part of our message. * We postpone switching the cipher to do_up */ const char *common_cipher =3D get_p2p_ncp_cipher(session, multi->peer_= info, &gc); + /* Set the common options */ + p2p_ncp_set_options(multi, session, common_cipher); + if (!common_cipher) { struct buffer out =3D alloc_buf_gc(128, &gc); @@ -502,9 +515,12 @@ } msg(D_TLS_DEBUG_LOW, "P2P mode NCP negotiation result: " - "TLS_export=3D%d, DATA_v2=3D%d, peer-id %d, cipher=3D%s", + "TLS_export=3D%d, DATA_v2=3D%d, peer-id %d, epoch=3D%d, cipher=3D%= s", (bool)(session->opt->crypto_flags & CO_USE_TLS_KEY_MATERIAL_EXPORT= ), - multi->use_peer_id, multi->peer_id, common_cipher); + multi->use_peer_id, + multi->peer_id, + (bool)(session->opt->crypto_flags & CO_EPOCH_DATA_KEY_FORMAT), + common_cipher); gc_free(&gc); } diff --git a/src/openvpn/tls_crypt.c b/src/openvpn/tls_crypt.c index 0e5dfee..2e51c1d 100644 --- a/src/openvpn/tls_crypt.c +++ b/src/openvpn/tls_crypt.c @@ -301,7 +301,7 @@ struct buffer tmp =3D *src; ASSERT(buf_advance(&tmp, TLS_CRYPT_OFF_PID)); ASSERT(packet_id_read(&pin, &tmp, true)); - if (!crypto_check_replay(opt, &pin, error_prefix, &gc)) + if (!crypto_check_replay(opt, &pin, 0, error_prefix, &gc)) { CRYPT_ERROR("packet replay"); } diff --git a/tests/Makefile.am b/tests/Makefile.am index f26b3b8..3246e34 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -52,6 +52,7 @@ unit_tests/openvpn/mock_msg.c unit_tests/openvpn/mock_msg.h \ $(top_srcdir)/src/openvpn/buffer.c \ $(top_srcdir)/src/openvpn/crypto.c \ + $(top_srcdir)/src/openvpn/crypto_epoch.c \ $(top_srcdir)/src/openvpn/crypto_openssl.c \ $(top_srcdir)/src/openvpn/crypto_mbedtls.c \ $(top_srcdir)/src/openvpn/otime.c \ diff --git a/tests/unit_tests/openvpn/Makefile.am b/tests/unit_tests/openvp= n/Makefile.am index 307f9ed..471389b 100644 --- a/tests/unit_tests/openvpn/Makefile.am +++ b/tests/unit_tests/openvpn/Makefile.am @@ -86,6 +86,7 @@ $(top_srcdir)/src/compat/compat-strsep.c \ $(top_srcdir)/src/openvpn/crypto.c \ $(top_srcdir)/src/openvpn/cryptoapi.c \ + $(top_srcdir)/src/openvpn/crypto_epoch.c \ $(top_srcdir)/src/openvpn/crypto_mbedtls.c \ $(top_srcdir)/src/openvpn/crypto_openssl.c \ $(top_srcdir)/src/openvpn/env_set.c \ @@ -132,6 +133,7 @@ $(top_srcdir)/src/openvpn/base64.c \ $(top_srcdir)/src/openvpn/buffer.c \ $(top_srcdir)/src/openvpn/crypto.c \ + $(top_srcdir)/src/openvpn/crypto_epoch.c \ $(top_srcdir)/src/openvpn/crypto_mbedtls.c \ $(top_srcdir)/src/openvpn/crypto_openssl.c \ $(top_srcdir)/src/openvpn/env_set.c \ @@ -160,6 +162,7 @@ $(top_srcdir)/src/openvpn/base64.c \ $(top_srcdir)/src/openvpn/buffer.c \ $(top_srcdir)/src/openvpn/crypto.c \ + $(top_srcdir)/src/openvpn/crypto_epoch.c \ $(top_srcdir)/src/openvpn/crypto_mbedtls.c \ $(top_srcdir)/src/openvpn/crypto_openssl.c \ $(top_srcdir)/src/openvpn/env_set.c \ @@ -179,6 +182,7 @@ $(top_srcdir)/src/openvpn/networking_sitnl.c \ $(top_srcdir)/src/openvpn/buffer.c \ $(top_srcdir)/src/openvpn/crypto.c \ + $(top_srcdir)/src/openvpn/crypto_epoch.c \ $(top_srcdir)/src/openvpn/crypto_mbedtls.c \ $(top_srcdir)/src/openvpn/crypto_openssl.c \ $(top_srcdir)/src/openvpn/otime.c \ @@ -250,6 +254,7 @@ auth_token_testdriver_SOURCES =3D test_auth_token.c mock_msg.c \ $(top_srcdir)/src/openvpn/buffer.c \ $(top_srcdir)/src/openvpn/crypto.c \ + $(top_srcdir)/src/openvpn/crypto_epoch.c \ $(top_srcdir)/src/openvpn/crypto_mbedtls.c \ $(top_srcdir)/src/openvpn/crypto_openssl.c \ $(top_srcdir)/src/openvpn/otime.c \ @@ -285,6 +290,7 @@ ncp_testdriver_SOURCES =3D test_ncp.c mock_msg.c \ $(top_srcdir)/src/openvpn/buffer.c \ $(top_srcdir)/src/openvpn/crypto.c \ + $(top_srcdir)/src/openvpn/crypto_epoch.c \ $(top_srcdir)/src/openvpn/crypto_mbedtls.c \ $(top_srcdir)/src/openvpn/crypto_openssl.c \ $(top_srcdir)/src/openvpn/otime.c \ diff --git a/tests/unit_tests/openvpn/test_crypto.c b/tests/unit_tests/open= vpn/test_crypto.c index 3d9c99c..5b583c7 100644 --- a/tests/unit_tests/openvpn/test_crypto.c +++ b/tests/unit_tests/openvpn/test_crypto.c @@ -874,17 +874,17 @@ struct crypto_options *co =3D &data->co; /* Modify the receive epoch and keys to have a very high epoch to test - * the end of array. Iterating through all 16k keys takes a 2-3s, so we + * the end of array. Iterating through all 65k keys takes a 2-3s, so we * avoid this for the unit test */ - co->key_ctx_bi.decrypt.epoch =3D 16000; - co->key_ctx_bi.encrypt.epoch =3D 16000; + co->key_ctx_bi.decrypt.epoch =3D 65500; + co->key_ctx_bi.encrypt.epoch =3D 65500; - co->epoch_key_send.epoch =3D 16000; - co->epoch_key_recv.epoch =3D 16000 + co->epoch_data_keys_future_count; + co->epoch_key_send.epoch =3D 65500; + co->epoch_key_recv.epoch =3D 65500 + co->epoch_data_keys_future_count; for (uint16_t i =3D 0; i < co->epoch_data_keys_future_count; i++) { - co->epoch_data_keys_future[i].epoch =3D 16001 + i; + co->epoch_data_keys_future[i].epoch =3D 65501 + i; } /* Move the last few keys until we are close to the limit */ diff --git a/tests/unit_tests/openvpn/test_ssl.c b/tests/unit_tests/openvpn= /test_ssl.c index 845ca56..486e298 100644 --- a/tests/unit_tests/openvpn/test_ssl.c +++ b/tests/unit_tests/openvpn/test_ssl.c @@ -35,6 +35,7 @@ #include #include "crypto.h" +#include "crypto_epoch.h" #include "options.h" #include "ssl_backend.h" #include "options_util.h" @@ -370,22 +371,46 @@ struct crypto_options -init_crypto_options(const char *cipher, const char *auth) +init_crypto_options(const char *cipher, const char *auth, bool epoch, + struct key2 *statickey) { struct key2 key2 =3D { .n =3D 2}; - ASSERT(rand_bytes(key2.keys[0].cipher, sizeof(key2.keys[0].cipher))); - ASSERT(rand_bytes(key2.keys[0].hmac, sizeof(key2.keys[0].hmac))); - ASSERT(rand_bytes(key2.keys[1].cipher, sizeof(key2.keys[1].cipher))); - ASSERT(rand_bytes(key2.keys[1].hmac, sizeof(key2.keys)[1].hmac)); + if (statickey) + { + /* Use chosen static key instead of random key when defined */ + key2 =3D *statickey; + } + else + { + ASSERT(rand_bytes(key2.keys[0].cipher, sizeof(key2.keys[0].cipher)= )); + ASSERT(rand_bytes(key2.keys[0].hmac, sizeof(key2.keys[0].hmac))); + ASSERT(rand_bytes(key2.keys[1].cipher, sizeof(key2.keys[1].cipher)= )); + ASSERT(rand_bytes(key2.keys[1].hmac, sizeof(key2.keys)[1].hmac)); + } struct crypto_options co =3D { 0 }; struct key_type kt =3D create_kt(cipher, auth, "ssl-test"); - init_key_ctx_bi(&co.key_ctx_bi, &key2, 0, &kt, "unit-test-ssl"); - packet_id_init(&co.packet_id, 5, 5, "UNITTEST", 0); + if (epoch) + { + struct epoch_key e1 =3D { .epoch =3D 1, .epoch_key =3D { 0 }}; + memcpy(e1.epoch_key, key2.keys[0].cipher, sizeof(e1.epoch_key)); + co.flags |=3D CO_EPOCH_DATA_KEY_FORMAT; + epoch_init_key_ctx(&co, &kt, &e1, &e1, 5); + /* Do a little of dancing for the epoch_send_key_iterate to test + * that this works too */ + epoch_iterate_send_key(&co); + epoch_iterate_send_key(&co); + epoch_iterate_send_key(&co); + } + else + { + init_key_ctx_bi(&co.key_ctx_bi, &key2, KEY_DIRECTION_BIDIRECTIONAL= , &kt, "unit-test-ssl"); + } + packet_id_init(&co.packet_id, 5, 5, "UNITTEST", 0); return co; } @@ -394,17 +419,16 @@ { packet_id_free(&co->packet_id); free_key_ctx_bi(&co->key_ctx_bi); - + free_epoch_key_ctx(co); } /* This adds a few more methods than strictly necessary but this allows * us to see which exact test was run from the backtrace of the test * when it fails */ static void -run_data_channel_with_cipher_end(const char *cipher) +run_data_channel_with_cipher_epoch(const char *cipher) { - struct crypto_options co =3D init_crypto_options(cipher, "none"); - co.flags |=3D CO_EPOCH_DATA_KEY_FORMAT; + struct crypto_options co =3D init_crypto_options(cipher, "none", true,= NULL); do_data_channel_round_trip(&co); uninit_crypto_options(&co); } @@ -412,7 +436,7 @@ static void run_data_channel_with_cipher(const char *cipher, const char *auth) { - struct crypto_options co =3D init_crypto_options(cipher, auth); + struct crypto_options co =3D init_crypto_options(cipher, auth, false, = NULL); do_data_channel_round_trip(&co); uninit_crypto_options(&co); } @@ -421,25 +445,40 @@ static void test_data_channel_roundtrip_aes_128_gcm(void **state) { - run_data_channel_with_cipher_end("AES-128-GCM"); run_data_channel_with_cipher("AES-128-GCM", "none"); } static void +test_data_channel_roundtrip_aes_128_gcm_epoch(void **state) +{ + run_data_channel_with_cipher_epoch("AES-128-GCM"); +} + +static void test_data_channel_roundtrip_aes_192_gcm(void **state) { - run_data_channel_with_cipher_end("AES-192-GCM"); run_data_channel_with_cipher("AES-192-GCM", "none"); } static void +test_data_channel_roundtrip_aes_192_gcm_epoch(void **state) +{ + run_data_channel_with_cipher_epoch("AES-192-GCM"); +} + +static void test_data_channel_roundtrip_aes_256_gcm(void **state) { - run_data_channel_with_cipher_end("AES-256-GCM"); run_data_channel_with_cipher("AES-256-GCM", "none"); } static void +test_data_channel_roundtrip_aes_256_gcm_epoch(void **state) +{ + run_data_channel_with_cipher_epoch("AES-256-GCM"); +} + +static void test_data_channel_roundtrip_aes_128_cbc(void **state) { run_data_channel_with_cipher("AES-128-CBC", "SHA256"); @@ -466,11 +505,22 @@ return; } - run_data_channel_with_cipher_end("ChaCha20-Poly1305"); run_data_channel_with_cipher("ChaCha20-Poly1305", "none"); } static void +test_data_channel_roundtrip_chacha20_poly1305_epoch(void **state) +{ + if (!cipher_valid("ChaCha20-Poly1305")) + { + skip(); + return; + } + + run_data_channel_with_cipher_epoch("ChaCha20-Poly1305"); +} + +static void test_data_channel_roundtrip_bf_cbc(void **state) { if (!cipher_valid("BF-CBC")) @@ -482,6 +532,154 @@ } +static struct key2 +create_key(void) +{ + struct key2 key2 =3D {.n =3D 2}; + + const uint8_t key[] =3D + {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', '0', '1', '2', '3', '4', '5',= '6', '7', 'A', 'B', 'C', 'D', 'E', 'F', + 'G', 'H', 'j', 'k', 'u', 'c', 'h', 'e', 'n', 'l'}; + + static_assert(sizeof(key) =3D=3D 32, "Size of key should be 32 bytes"); + + /* copy the key a few times to ensure to have the size we need for + * Statickey but XOR it to not repeat it */ + uint8_t keydata[sizeof(key2.keys)]; + + for (int i =3D 0; i < sizeof(key2.keys); i++) + { + keydata[i] =3D (uint8_t) (key[i % sizeof(key)] ^ i); + } + + ASSERT(memcpy(key2.keys[0].cipher, keydata, sizeof(key2.keys[0].cipher= ))); + ASSERT(memcpy(key2.keys[0].hmac, keydata + 64, sizeof(key2.keys[0].hma= c))); + ASSERT(memcpy(key2.keys[1].cipher, keydata + 128, sizeof(key2.keys[1].= cipher))); + ASSERT(memcpy(key2.keys[1].hmac, keydata + 192, sizeof(key2.keys)[1].h= mac)); + + return key2; +} + +static void +test_data_channel_known_vectors_run(bool epoch) +{ + struct key2 key2 =3D create_key(); + + struct crypto_options co =3D init_crypto_options("AES-256-GCM", "none"= , epoch, + &key2); + + struct gc_arena gc =3D gc_new(); + + /* initialise frame for the test */ + struct frame frame; + init_frame_parameters(&frame); + + struct buffer src =3D alloc_buf_gc(frame.buf.payload_size, &gc); + struct buffer work =3D alloc_buf_gc(BUF_SIZE(&frame), &gc); + struct buffer encrypt_workspace =3D alloc_buf_gc(BUF_SIZE(&frame), &gc= ); + struct buffer decrypt_workspace =3D alloc_buf_gc(BUF_SIZE(&frame), &gc= ); + struct buffer buf =3D clear_buf(); + void *buf_p; + + /* init work */ + ASSERT(buf_init(&work, frame.buf.headroom)); + + now =3D 0; + + /* + * Load src with known data. + */ + ASSERT(buf_init(&src, 0)); + const char *plaintext =3D "The quick little fox jumps over the bureauc= ratic hurdles"; + + ASSERT(buf_write(&src, plaintext, strlen(plaintext))); + + /* copy source to input buf */ + buf =3D work; + buf_p =3D buf_write_alloc(&buf, BLEN(&src)); + ASSERT(buf_p); + memcpy(buf_p, BPTR(&src), BLEN(&src)); + + /* initialize work buffer with buf.headroom bytes of prepend capacity = */ + ASSERT(buf_init(&encrypt_workspace, frame.buf.headroom)); + + /* add packet opcode and peer id */ + buf_write_u8(&encrypt_workspace, 7); + buf_write_u8(&encrypt_workspace, 0); + buf_write_u8(&encrypt_workspace, 0); + buf_write_u8(&encrypt_workspace, 23); + + /* encrypt */ + openvpn_encrypt(&buf, encrypt_workspace, &co); + + /* separate buffer in authenticated data and encrypted data */ + uint8_t *ad_start =3D BPTR(&buf); + buf_advance(&buf, 4); + + if (epoch) + { + uint8_t packetid1[8] =3D {0, 0x04, 0, 0, 0, 0, 0, 1}; + assert_memory_equal(BPTR(&buf), packetid1, 8); + } + else + { + uint8_t packetid1[4] =3D {0, 0, 0, 1}; + assert_memory_equal(BPTR(&buf), packetid1, 4); + } + + if (epoch) + { + uint8_t *tag_location =3D BEND(&buf) - OPENVPN_AEAD_TAG_LENGTH; + const uint8_t exp_tag_epoch[16] =3D + {0x0f, 0xff, 0xf5, 0x91, 0x3d, 0x39, 0xd7, 0x5b, + 0x18, 0x57, 0x3b, 0x57, 0x48, 0x58, 0x9a, 0x7d}; + + assert_memory_equal(tag_location, exp_tag_epoch, OPENVPN_AEAD_TAG_= LENGTH); + } + else + { + uint8_t *tag_location =3D BPTR(&buf) + 4; + const uint8_t exp_tag_noepoch[16] =3D + {0x1f, 0xdd, 0x90, 0x8f, 0x0e, 0x9d, 0xc2, 0x5e, 0x79, 0xd8, 0x32,= 0x02, 0x0d, 0x58, 0xe7, 0x3f}; + assert_memory_equal(tag_location, exp_tag_noepoch, OPENVPN_AEAD_TA= G_LENGTH); + } + + /* Check some bytes at the beginning of the encrypted part */ + if (epoch) + { + const uint8_t bytesat14[6] =3D {0x36, 0xaa, 0xb4, 0xd4, 0x9c, 0xe6= }; + assert_memory_equal(BPTR(&buf) + 14, bytesat14, sizeof(bytesat14)); + } + else + { + const uint8_t bytesat30[6] =3D {0xa8, 0x2e, 0x6b, 0x17, 0x06, 0xd9= }; + assert_memory_equal(BPTR(&buf) + 30, bytesat30, sizeof(bytesat30)); + } + + /* decrypt */ + openvpn_decrypt(&buf, decrypt_workspace, &co, &frame, ad_start); + + /* compare */ + assert_int_equal(buf.len, strlen(plaintext)); + assert_memory_equal(BPTR(&buf), plaintext, strlen(plaintext)); + + uninit_crypto_options(&co); + gc_free(&gc); +} + +static void +test_data_channel_known_vectors_epoch(void **state) +{ + test_data_channel_known_vectors_run(true); +} + +static void +test_data_channel_known_vectors_shortpktid(void **state) +{ + test_data_channel_known_vectors_run(false); +} + + int main(void) { @@ -492,13 +690,19 @@ cmocka_unit_test(test_load_certificate_and_key), cmocka_unit_test(test_load_certificate_and_key_uri), cmocka_unit_test(test_data_channel_roundtrip_aes_128_gcm), + cmocka_unit_test(test_data_channel_roundtrip_aes_128_gcm_epoch), cmocka_unit_test(test_data_channel_roundtrip_aes_192_gcm), + cmocka_unit_test(test_data_channel_roundtrip_aes_192_gcm_epoch), cmocka_unit_test(test_data_channel_roundtrip_aes_256_gcm), + cmocka_unit_test(test_data_channel_roundtrip_aes_256_gcm_epoch), cmocka_unit_test(test_data_channel_roundtrip_chacha20_poly1305), + cmocka_unit_test(test_data_channel_roundtrip_chacha20_poly1305_epo= ch), cmocka_unit_test(test_data_channel_roundtrip_aes_128_cbc), cmocka_unit_test(test_data_channel_roundtrip_aes_192_cbc), cmocka_unit_test(test_data_channel_roundtrip_aes_256_cbc), cmocka_unit_test(test_data_channel_roundtrip_bf_cbc), + cmocka_unit_test(test_data_channel_known_vectors_epoch), + cmocka_unit_test(test_data_channel_known_vectors_shortpktid) }; #if defined(ENABLE_CRYPTO_OPENSSL) -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/806?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I00751c42cb04e30205ba8e6584530831e0d143c5 Gerrit-Change-Number: 806 Gerrit-PatchSet: 19 Gerrit-Owner: plaisthos Gerrit-Reviewer: cron2 Gerrit-Reviewer: flichtenheld Gerrit-CC: MaxF Gerrit-CC: openvpn-devel Gerrit-Attention: cron2 Gerrit-Attention: flichtenheld Gerrit-Attention: MaxF Gerrit-MessageType: newpatchset --D3i0rA3Me20= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is currently required from: MaxF, cron2, flichtenheld.

plaisthos uploaded patch set #19 to this change.

= View Chan= ge

The following approvals got outdated and were removed: Code-Review+1 by cron2

Implement epoch key data format

With DCO and = possible future hardware assisted OpenVPN acceleration we
are approachin= g the point where 32 bit IVs are not cutting it any more,
especially if = we are limiting the IVs to the safe limits of AES-GCM where
the limit is= more 2^29.

To illustrate the problem, some back of the envelope mat= h here:

If we want to keep the current 3600s renegotiation interval = and have
a safety margin of 25% (when we trigger renegotiation) we have = about
3.2 million packets (2*32 * 0.7) to work with. That translates to<= br>about 835k packets per second. Currently, implementation trigger the
= renegotiation at 0xff00000000 or at 7/8 of the AEAD usage limit.

Wit= h 1300 Byte packets that translates into 8-9 Gbit/s. That is far
from un= realistic any more. Current DCO implementations are already in
spitting = distance to that or might even reach (for a single client
connection) th= at if you have extremely fast
single core performance CPU.

With t= he AEAD usage limit, these limits are almost a factor of 8 lower
so with= the limit becomes 1-2 GBit/s. This is already reached without
DCO on so= me platforms.

This introduces the epoch data format for AEAD data ch= annel
ciphers in TLS mode ciphers. No effort has been made to supportlarger packet counters in any other scenario since those are all legacy.This uses the same approach of epoch keys as (D)TLS 1.3 does and switches=
the data channel regularly for affected AEAD ciphers when reaching the<= br>usage limit.

For Chacha20-Poly1305, which does not suffer the sam= e problems as AES-GCM,
the full 48 bit of packet counter are used only a= fter that the same logic
to switch to a new key as with AES-GCM is done.=

Change-Id: I00751c42cb04e30205ba8e6584530831e0d143c5
Signed-off-= by: Arne Schwabe <arne@...1227...>
---
M CMakeLists.txt
M Ch= anges.rst
M src/openvpn/crypto.c
M src/openvpn/crypto.h
M src/open= vpn/crypto_backend.h
M src/openvpn/dco.h
M src/openvpn/init.c
M sr= c/openvpn/multi.c
M src/openvpn/ssl.c
M src/openvpn/ssl_common.h
M= src/openvpn/ssl_ncp.c
M src/openvpn/tls_crypt.c
M tests/Makefile.am<= br>M tests/unit_tests/openvpn/Makefile.am
M tests/unit_tests/openvpn/tes= t_crypto.c
M tests/unit_tests/openvpn/test_ssl.c
16 files changed, 51= 5 insertions(+), 74 deletions(-)

git pull ssh://gerrit.openvpn.ne=
t:29418/openvpn refs/changes/06/806/19
diff --git a/CMakeLists.txt =
b/CMakeLists.txt
index ea8d006..5081e81 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -706,6 +706,7 @@

target_source= s(test_auth_token PRIVATE
src/openvpn/base64.c

+ src/openvpn/cry= pto_epoch.c
src/openvpn/crypto_mbedtls.c src/openvpn/crypto_openssl.c
src/o= penvpn/crypto.c
@@ -734,9 +735,10 @@
= tests/unit_tests/openvpn/mock_win32_execve.c
= src/openvpn/argv.c
src/openvpn/base64.c<= /span>
- src/openvp= n/crypto.c
+ = src/openvpn/crypto_epoch.c
src/openvpn/cryp= to_mbedtls.c
src/openvpn/crypto_openssl.c
+ src/openvpn/= crypto.c
src/openvpn/cryptoapi.c
src/openvpn/env_set.c

src/open= vpn/mss.c
@@ -762,6 +764,7 @@
)


target_sources(test_ncp PRIVATE=
+ src/openvpn/crypto= _epoch.c
src/openvpn/crypto_mbedtls.c
src/openvpn/crypto_openssl.c
src/open= vpn/crypto.c
@@ -783,6 +786,7 @@
t= ests/unit_tests/openvpn/mock_win32_execve.c
src/op= envpn/argv.c
src/openvpn/base64.c
+ src/openvpn/crypto_epoch.c
src/openvpn/crypto_mbedtls.c
= src/openvpn/crypto_openssl.c
src/openvpn/crypto= .c
@@ -836,9 +840,11 @@
target_com= pile_options(test_networking PRIVATE -UNDEBUG)
tar= get_sources(test_networking PRIVATE
src/openvp= n/networking_sitnl.c
= + src/openvpn/crypto_epoch.c
src/op= envpn/crypto_mbedtls.c
src/openvpn/crypto_open= ssl.c
src/openvpn/crypto.c
+ src/openvpn/crypto_epoch.c<= /span>
src/openvpn/otime.c
= src/openvpn/packet_id.c
)
@= @ -854,6 +860,7 @@
tests/unit_tests/openvpn/mo= ck_win32_execve.c
src/openvpn/argv.c src/openvpn/base64.c
+ src/openvpn/crypto_epoch.c
src/openvpn/crypto_mbedtls.c

src= /openvpn/crypto_openssl.c
src/openvpn/crypto.c=
diff --git a/Changes.rst b/Changes.rst
ind= ex d01816b..e011811 100644
--- a/Changes.rst
+++ b/Changes.rst

@@ -35,6 +35,19 @@
= replaced by the default ciphers used by OpenVPN, making it easier to
add an allowed cipher without having to spell out the defau= lt ciphers.

+Epoch data keys and packet format
+ This introduces the epoch data format for AEAD = data channel
+ cip= hers in TLS mode ciphers. This new data format has a number of
+ improvements over the standa= rd "DATA_V2" format.

+
+ - AE= AD tag at the end of packet which is more hardware implementation+ friendly
+ - Automatic key switchover whe= n cipher usage limits are hit, similar to
+ the epoch data keys in (D)TLS 1.3
+ - 64 bit instead of 32 bit pa= cket ids to allow the data channel to be
+ ready for 10 GBit/s without having frequent rene= gotiation
+ - IV c= onstructed with XOR instead of concatenation to not have (parts) of<= br>+ the real IV on the wi= re

Deprecated features
= -------------------
diff --git a/src/openvpn/crypto.c b/src= /openvpn/crypto.c
index dbd95a8..ed70f51 100644
<= span>--- a/src/openvpn/crypto.c
+++ b/src/openvpn/crypto.c<= /span>
@@ -32,6 +32,8 @@
#include <string.h>= ;

#include "crypto.h"+#include "crypto_epoch.= h"
+#include &qu= ot;packet_id.h"
#include "error.h" #include "integer.h"
#include "pla= tform.h"
@@ -67,6 +69,13 @@
{<= br> struct gc_arena gc;
int outlen =3D 0;

+ const bool use_epo= ch_data_format =3D opt->flags & CO_EPOCH_DATA_KEY_FORMAT;
= +
+ if (use_epoch_data_format)
+ {
+ epoch_check_send_iterate(opt);
+ }
+
const struct key_ctx *ctx= =3D &opt->key_ctx_bi.encrypt;
uint8_t *mac_out= =3D NULL;
const int mac_len =3D OPENVPN_AEAD_TAG_LENG= TH;
@@ -88,14 +97,24 @@
buf_set_wr= ite(&iv_buffer, iv, iv_len);

= /* IV starts with packet id to make the IV unique for packet */
= - if (!packet_id_write(&am= p;opt->packet_id.send, &iv_buffer, false, false))
+ if (use_epoch_data_format)

{
- msg(D_CRYPT_ERRORS, "ENCRYPT ERROR: packet ID roll over&= quot;);
- go= to err;
+ = if (!packet_id_write_epoch(&opt->packet_id.send, ctx->epoch, &= ;iv_buffer))
+ = {
+ = msg(D_CRYPT_ERRORS, "ENCRYPT ERROR: packet ID roll over");
+ goto er= r;
+ }
}
-
+ else
+ {
+ if (!packet_id_write(&= amp;opt->packet_id.send, &iv_buffer, false, false))

+ {
+ msg(D_CRYPT_ERRORS, "= ;ENCRYPT ERROR: packet ID roll over");
+ goto err;
+ }
+ }
/* Write packet = id part of IV to work buffer */
- ASSERT(buf_write(&work, iv, packet_id_size(false)));<= /span>
+ ASSERT(buf_w= rite(&work, iv, buf_len(&iv_buffer)));

= /* This generates the IV by XORing the implicit part of the = IV
* with the packet id already written to the iv= buffer */
@@ -127,7 +146,7 @@
dmsg(D_= PACKET_CONTENT, "ENCRYPT AD: %s",
forma= t_hex(BPTR(&work), BLEN(&work), 0, &gc));

- if (!(opt->flags &= amp; CO_EPOCH_DATA_KEY_FORMAT))
+ if (!use_epoch_data_format)
{ /* Reserve space for authentication tag */
mac_out =3D buf_write_alloc(&work, mac_len);

= @@ -148,7 +167,7 @@
ASSERT(buf_inc_len(&work, outl= en));

/* if the tag is at end the en= d, allocate it now */
-= if (opt->flags & CO_EPOCH_DATA_KEY_FORMAT)
+ if (use_epoch_data_format)
= {
/* Reserve space for authentication t= ag */
mac_out =3D buf_write_alloc(&work, mac_l= en);
@@ -363,14 +382,35 @@

bool

crypto_check_replay(struct crypto_options *opt,
- cons= t struct packet_id_net *pin, const char *error_prefix,
+ const struct packet_= id_net *pin, uint16_t epoch,
+ const char *error_prefix,
= struct gc_arena *gc)
{
= bool ret =3D false;
= - packet_id_reap_test(&opt->packet_id.rec);
- if (packet_id_test(&opt->packet_= id.rec, pin))
+ st= ruct packet_id_rec *recv;
+
+ if (epoch= =3D=3D 0 || opt->key_ctx_bi.decrypt.epoch =3D=3D epoch)
{

- packet= _id_add(&opt->packet_id.rec, pin);
+ recv =3D &opt->packet_id.rec;+ }
+ else if (epoch =3D=3D opt->epoch_r= etiring_data_receive_key.epoch)
+ {
+ = recv =3D &opt->epoch_retiring_key_pid_recv;
+ }
+ else
+ {
+ = /* We have an epoch that is neither current or old recv key but
+ * is authenticat= ed, ie we need to move to a new current recv key */
+ msg(D_GENKEY, "Received data= packet with new epoch %d. Updating "
+ "receive key", epoch);<= br>+ epoch_replace_updat= e_recv_key(opt, epoch);
+ recv =3D &opt->packet_id.rec;
+ }
+
+ = packet_id_reap_test(recv);
+ if (packet_id_test(recv, pin))
+ {
+ packet_id_add(recv, pin);
if (opt-= >pid_persist && (opt->flags & CO_PACKET_ID_LONG_FORM))
{
packet_id_persist_sav= e_obj(opt->pid_persist, &opt->packet_id);
@@ -405= ,16 +445,19 @@
{
static const char er= ror_prefix[] =3D "AEAD Decrypt error";
struc= t packet_id_net pin =3D { 0 };
- struct key_ctx *ctx =3D &opt->key_ctx_bi.decrypt;
struct gc_arena gc;
-
gc_init(&gc);

- if (cipher_decrypt_ve= rify_fail_exceeded(ctx))
+ struct key_ctx *ctx =3D &opt->key_ctx_bi.decrypt;+ const bool use_epoch_data= _format =3D opt->flags & CO_EPOCH_DATA_KEY_FORMAT;
+ if (!use_epoch_data_format &&= amp; cipher_decrypt_verify_fail_exceeded(ctx))
{
CRYPT_DROP("Decryption failed verification limit r= eached.");
}

+ const int tag_size =3D OPENVPN_AEA= D_TAG_LENGTH;
+
+
ASS= ERT(opt);
ASSERT(frame);
ASSERT(b= uf->len > 0);
@@ -430,18 +473,60 @@
= /* IV and Packet ID required for this mode */
ASSE= RT(packet_id_initialized(&opt->packet_id));
=
+ /* Ensure that the pac= ket size is long enough */
+ int min_packet_len =3D packet_id_size(false) + tag_size + 1;
+
+ if (use_epoch_data_format)
= + {
+ min_packet_len +=3D sizeof(uint32_t)= ;
+ }
+

+ if (buf->len < min_packet_len)
= + {
+ CRYPT_ERROR("missing IV info, m= issing tag or no payload");
+ }
+<= /span>
+ uint16_t epoch = =3D 0;
/* Combine IV from explicit part from packet an= d implicit part from context */
{
= uint8_t iv[OPENVPN_MAX_IV_LENGTH] =3D { 0 };
= const int iv_len =3D cipher_ctx_iv_length(ctx->cipher);
- const size_t packet_iv_len =3D= packet_id_size(false);

- if (buf->len < packet_iv_len)
<= span style=3D"color: hsl(120, 100%, 40%);">+ /* Read packet id. For = epoch data format also lookup the epoch key

+ * to be able to use the implicit IV of the= correct decryption key */
+ if (use_epoch_data_format)
{=
- CRYPT_ERROR(&quo= t;missing IV info");
- }
+ = /* packet ID format is 16 bit epoch + 48 per epoch packet-counter */<= /span>
+ const si= ze_t packet_iv_len =3D sizeof(uint64_t);

- memcpy(iv, BPTR(buf), packet_i= v_len);
+ = /* copy the epoch-counter part into the IV */
+ memcpy(iv, BPTR(buf), packet_iv_len);=
+
+ epoch =3D packet_id_read_e= poch(&pin, buf);
= + if (epoch =3D=3D 0)
+ {
+ CRYPT_ERROR("error reading packet-id");
+ }+ ctx =3D epoch_lo= okup_decrypt_key(opt, epoch);
+ if (!ctx)
+ {
+ CRYPT_ERROR("data packet with unknown epoch"= ;);
+ }
+ else if (c= ipher_decrypt_verify_fail_exceeded(ctx))
+ {
+ CRYPT_DROP("Decryption failed verificat= ion limit reached");
+ }
+= }
+ el= se
+ {<= br>+ const size_t pa= cket_iv_len =3D packet_id_size(false);
+ /* Packet ID form is a 32 bit packet counter= */
+ memc= py(iv, BPTR(buf), packet_iv_len);
+ if (!packet_id_read(&pin, buf, false))=
+ {
+ CRYPT_ERROR(&quo= t;error reading packet-id");

+ }
+ }

/* This genera= tes the IV by XORing the implicit part of the IV
= * with the packet id already written to the iv buffer */
@@= -459,25 +544,12 @@
}
}

- /* Re= ad packet ID from packet */
- if (!packet_id_read(&pin, buf, false))
- {
- CRYPT_ERROR("error reading packet-id");
- }
-
- /* keep the tag value to feed in later */
- const int tag_size =3D OPENVPN_A= EAD_TAG_LENGTH;

- if= (buf->len < tag_size + 1)
- {
- = CRYPT_ERROR("missing tag or no payload");
- }
-
const int ad_size =3D BPTR(buf) - ad= _start;

uint8_t *tag_ptr =3D NULL;
int data_len =3D 0;

- if (opt->flags & CO_EPOCH_DA= TA_KEY_FORMAT)
+ i= f (use_epoch_data_format)
{
d= ata_len =3D BLEN(buf) - tag_size;
tag_ptr =3D BPTR= (buf) + data_len;
@@ -498,15 +570,13 @@
= CRYPT_ERROR("potential buffer overflow");
= }

-
/* feed in tag and the authenticated data */=
ASSERT(cipher_ctx_update_ad(ctx->cipher, ad_start, ad_siz= e));
dmsg(D_PACKET_CONTENT, "DECRYPT AD: %s"= ,
format_hex(ad_start, ad_size, 0, &gc));

- int= outlen;
-
/* Decrypt and authenticate packet */

+ int outlen;
if (!cipher= _ctx_update(ctx->cipher, BPTR(&work), &outlen, BPTR(buf),=
data_len))
{
@@ -525,7 +595,7 @@
dmsg(D_PACKET_CONTENT= , "DECRYPT TO: %s",
format_hex(BPTR(&am= p;work), BLEN(&work), 80, &gc));

- if (!crypto_check_replay(opt, &= ;pin, error_prefix, &gc))
+ if (!crypto_check_replay(opt, &pin, epoch, error_prefix, = &gc))
{
goto error_exit;<= /span>
}
@@ -702,7 +772,7 @@
= }
}

- if (have_pin && !cryp= to_check_replay(opt, &pin, error_prefix, &gc))

+ if (have_pin && !crypto_= check_replay(opt, &pin, 0, error_prefix, &gc))
= {
goto error_exit;
= }
diff --git a/src/openvpn/crypto.h b/src/openvpn/crypto= .h
index 5ceb523..94f1f7f 100644
--- a/src/= openvpn/crypto.h
+++ b/src/openvpn/crypto.h
@@ -525,6 +525,7 @@

*
* @param opt C= rypto options for this packet, contains replay state.
* @= param pin Packet ID read from packet.
+ * @param epoch Epoch read from packet or 0 when epoch = is not used.
* @param error_prefix Prefix to use when pr= inting error messages.
* @param gc Garbage collector t= o use.
*
@@ -532,6 +533,7 @@
*/

bool crypto_check_replay(struct crypto_options *o= pt,
const struct packet_id_net *p= in,
+ = uint16_t epoch,
const ch= ar *error_prefix,
struct gc_arena= *gc);

diff --git a/src/openvpn/crypto_ba= ckend.h b/src/openvpn/crypto_backend.h
index 6371013..71e82= 28 100644
--- a/src/openvpn/crypto_backend.h
+++ b/src/openvpn/crypto_backend.h

@@ -39,7 +39,7 @@
#include "basic.h"
#include "b= uffer.h"

-/* TLS uses a tag of 128 bytes, let's do the same for OpenVPN= */
+/* TLS uses a ta= g of 128 bits, let's do the same for OpenVPN */
#defin= e OPENVPN_AEAD_TAG_LENGTH 16

/* Maximum = cipher block size (bytes) */
diff --git a/src/openvpn/dco.h= b/src/openvpn/dco.h
index 035474f..c3e05a8 100644--- a/src/openvpn/dco.h
+++ b/src/openvpn/dco.h
@@ -249,6 +249,15 @@
*/
con= st char *dco_get_supported_ciphers(void);

+/**

+ * Return whether the dco implementation supports t= he new protocol features of
+ * a 64 bit packet counter and AEAD tag at the end.
+ */

+static inline bool
+dco_supports_epoch_data(struct context *c)+{
+ return false;
+}
#else /* if defined(ENABLE_DCO= ) */

typedef void *dco_context_t;=
@@ -380,5 +389,10 @@
return "";
}

+static inline bool
+dco_supports_epoch_data(struct context *c)
+{
+ return false;
+}
#endif /* defined(ENABLE_DCO) */=
#endif /* ifndef DCO_H */
diff --git a/src/openv= pn/init.c b/src/openvpn/init.c
index 4014517..a01dbdc 10064= 4
--- a/src/openvpn/init.c
+++ b/src/openvp= n/init.c
@@ -2788,6 +2788,19 @@
}<= /span>
}

+ /* Ensure that for epoch data format is only enabl= ed if also data v2
+ = * is enabled */
+= bool epoch_data =3D (c->options.imported_protocol_flags & CO_EPO= CH_DATA_KEY_FORMAT);
= + bool datav2_enabled =3D (c->options.peer_id >=3D 0 && c-= >options.peer_id < MAX_PEER_ID);
+
+= if (epoch_data && !datav2_enabled)
+ {
+ msg(D_PUSH_ERRORS, "OPTIONS ERROR: Epoch key data= format tag requires "
+ "data v2 (peer-id) to be enabled.");+ return false;=
+ }
+
+
if (found & OPT_P_PUSH_MTU)
{
/* MTU has changed, check that t= he pushed MTU is small enough to
@@ -3384,6 +3397,15 @@
to.push_peer_info_detail =3D 1;
= }

+= /* Check if the DCO drivers support the epoch data format */
= + if (dco_enabled(options))<= /span>
+ {
+ to.data_epoch_supported = =3D dco_supports_epoch_data(c);

+ }
+ = else
+ {<= br>+ to.data_epoch_suppo= rted =3D true;
+ }=

/* should we not xmit any packets u= ntil we get an initial
* response from client? */
diff --git a/src/openvpn/multi.c b/src/openvpn/multi.c<= br>index 96fa6cd..f76dad8 100644
--- a/src/openvpn/mu= lti.c
+++ b/src/openvpn/multi.c
@@ -1878,9 = +1878,15 @@
char *push_cipher =3D ncp_get_best_cipher(= o->ncp_ciphers, peer_info,
= tls_multi->remote_ciphername,
= &o->gc);
-
if (push_cipher)<= br> {
+ = /* Enable epoch data key format if supported and AEAD cipher in use */<= /span>
+ if (tls_mult= i->session[TM_ACTIVE].opt->data_epoch_supported
+ && (proto & IV_PR= OTO_DATA_EPOCH) && cipher_kt_mode_aead(push_cipher))
+ {

+ o->imported_protocol_flags |= =3D CO_EPOCH_DATA_KEY_FORMAT;
+ }
+=
o->ciphername =3D push_cipher;
return true;

}
diff --git a/= src/openvpn/ssl.c b/src/openvpn/ssl.c
index 6f78a76..439ce7= 9 100644
--- a/src/openvpn/ssl.c
+++ b/src/= openvpn/ssl.c
@@ -55,6 +55,7 @@
#include &= quot;route.h"
#include "tls_crypt.h"=

+#include= "crypto_epoch.h"
#include "ssl.h"
#include "ssl_verify.h"
#include &= quot;ssl_backend.h"
@@ -915,6 +916,7 @@
key_state_ssl_free(&ks->ks_ssl);


= free_key_ctx_bi(&ks->crypto_options.key_ctx_bi);+ free_epoch_key_ctx(&= ks->crypto_options);
free_buf(&ks->plaintext= _read_buf);
free_buf(&ks->plaintext_write_buf);=
free_buf(&ks->ack_write_buf);
= @@ -1362,6 +1364,48 @@
}

static void

+init_e= poch_keys(struct key_state *ks,
+ struct tls_multi *multi,
+ const struct key_type *ke= y_type,
+ = bool server,
+ = struct key2 *key2)
+{
+ /*= For now we hardcode this to be 16 for the software based data channel
+ * DCO based impleme= ntations/HW implementation might adjust this number
+ * based on their expected speed */
+ const int future_= key_count =3D 16;
+
+ int key_direction= =3D server ? KEY_DIRECTION_INVERSE : KEY_DIRECTION_NORMAL;
+ struct key_direction_state kds;=

+ key_direction_s= tate_init(&kds, key_direction);
+
+ = struct crypto_options *co =3D &ks->crypto_options;
+
+ /* For the epoch key we use the first 32 bytes of k= ey2 cipher keys
+ = * for the initial secret */
+ struct epoch_key e1_send =3D { 0 };
+ e1_send.epoch =3D 1;
+ memcpy(&e1_send.epoch_key, key2-= >keys[kds.out_key].cipher, sizeof(e1_send.epoch_key));
+
+ struct epoch_key e1_recv =3D { 0 };
+ e1_recv.epoch =3D 1;
<= span style=3D"color: hsl(120, 100%, 40%);">+ memcpy(&e1_recv.epoch_k= ey, key2->keys[kds.in_key].cipher, sizeof(e1_recv.epoch_key));
+
+ /* DCO implementations have two choices at t= his point.
+ *
+ * a) (more likely= ) they probably to pass E1 directly to kernel
+ * space at this point and do all the other k= ey derivation in kernel
+ *
+ * b)= They let userspace do the key derivation and pass all the individual
+ * keys to the DCO la= yer.
+ * */
+ epoch_init_key_ctx(co= , key_type, &e1_send, &e1_recv, future_key_count);
+

+ secure_memzero(&e1_send, sizeof(e1_send));
+ secure_memzero(&= ;e1_recv, sizeof(e1_recv));
+}
++static void
= init_key_contexts(struct key_state *ks,
= struct tls_multi *multi,
const struct ke= y_type *key_type,
@@ -1394,6 +1438,16 @@
= CLEAR(key->decrypt);
key->initialized= =3D true;
}
+ else if (multi->opt.crypto_flags & CO_EPOCH_DATA_K= EY_FORMAT)
+ {
+ if (!cipher_kt_= mode_aead(key_type->cipher))
+ {
+ msg(M_FATAL, "AEAD cipher (currently %s) "+ "requir= ed for epoch data format.",
+ cipher_kt_name(key_type->cipher));+ }
+ init_epoch_keys(ks, multi, key= _type, server, key2);
+ }
else
{
= init_key_ctx_bi(key, key2, key_direction, key_type, "Data Chann= el");
@@ -1969,6 +2023,11 @@
= iv_proto |=3D IV_PROTO_NCP_P2P;
}

+ if (se= ssion->opt->data_epoch_supported)
+ {
+ iv_proto |=3D IV_PROTO_DATA_EPOCH;
+ }
+
buf_printf(&out, &= quot;IV_CIPHERS=3D%s\n", session->opt->config_ncp_ciphers);

#ifdef HAVE_EXPORT_KEYING_MATERIAL@@ -2978,6 +3037,22 @@
return true;<= br> }

+ /* epoch key id approaching the 16 bit limit */+ if (ks->crypto_options= .flags & CO_EPOCH_DATA_KEY_FORMAT)
+ {
+ /* We only need to check the send key as we always keep send
+ * key epoch = >=3D recv key epoch in \c epoch_replace_update_recv_key */
+ if (ks->crypto_options= .epoch_key_send.epoch >=3D 0xF000)

+ {
+ return true;
+ }
+ = {
+ re= turn false;
+ = }
+ }
+

+
/* Packet id approach the lim= it of the packet id */
if (packet_id_close_to_wrapping= (&ks->crypto_options.packet_id.send))
{<= br>@@ -2993,7 +3068,9 @@
* Since if both sides= were aware, then both sides will probably also
* sw= itch to use epoch data channel instead, so this code is not
* in effect then.

- */
+ *
+ * When epoch are= in use the crypto layer will handle this internally
+ * with new epochs instead of trigger= ing a renegotiation */
const struct key_ctx_bi *key_ct= x_bi =3D &ks->crypto_options.key_ctx_bi;
const = uint64_t usage_limit =3D session->opt->aead_usage_limit;

diff --git a/src/openvpn/ssl_common.h b/src/openvpn/s= sl_common.h
index e092472..9625a99 100644
-= -- a/src/openvpn/ssl_common.h
+++ b/src/openvpn/ssl_common.= h
@@ -315,7 +315,6 @@

= /* from command line */
bool single_session;<= br>- bool disable_occ;<= br> int mode;
bool pull;
= /**
@@ -368,6 +367,12 @@
const char = *config_ciphername;
const char *config_ncp_ciphers;

+ = /** whether our underlying data channel supports new data channel+ * features (epoch keys w= ith AEAD tag at the end). This is always true
+ * for the internal implementation but can be= false for DCO
+ = * implementations */
= + bool data_epoch_supported;
+
bool tls_crypt_v2;
c= onst char *tls_crypt_v2_verify_script;

@@= -497,8 +502,6 @@
*/
int key_id;=

- = int limit_next; /* used for traffic shaping on the control cha= nnel */
-
int verify_maxlevel;


char *c= ommon_name;
diff --git a/src/openvpn/ssl_ncp.c b/src/openvp= n/ssl_ncp.c
index b238fc0..ead91da 100644
-= -- a/src/openvpn/ssl_ncp.c
+++ b/src/openvpn/ssl_ncp.c
@@ -411,7 +411,8 @@
}
=
static void
= -p2p_ncp_set_options(struct tls_multi *multi, struct tls_session *session)<= /span>
+p2p_ncp_set_options(= struct tls_multi *multi, struct tls_session *session,
+ const char *common_ci= pher)
{
/* will return 0 if peer_info= is null */
const unsigned int iv_proto_peer =3D extra= ct_iv_proto(multi->peer_info);
@@ -433,6 +434,18 @@
session->opt->crypto_flags |=3D CO_USE_CC_EXIT_N= OTIFY;
}

+ if (session->opt->data_epoch_supporte= d && (iv_proto_peer & IV_PROTO_DATA_EPOCH)
+ && common_cipher &&a= mp; cipher_kt_mode_aead(common_cipher))
+ {
+ session->opt->crypto_flags |=3D CO_EPOCH_DATA_KEY_FORMA= T;
+ }
<= span style=3D"color: hsl(120, 100%, 40%);">+ else

+ {
+ /* The peer might have changed its ciphers opti= ons during reconnect,
+ * ensure we clear the flag if we previously had it enabled */
+ session->op= t->crypto_flags &=3D ~CO_EPOCH_DATA_KEY_FORMAT;
+ }
+
#if defined(HAVE_EXPORT_KEYING_MATER= IAL)
if (iv_proto_peer & IV_PROTO_TLS_KEY_EXPORT)<= /span>
{
@@ -472,15 +485,15 @@
void

p2p_mode_ncp(struct tls_multi *multi, struct tls_s= ession *session)
{
- /* Set the common options */
- p2p_ncp_set_options(multi, session);-
struct gc= _arena gc =3D gc_new();

/* Query the= common cipher here to log it as part of our message.
= * We postpone switching the cipher to do_up */
const = char *common_cipher =3D get_p2p_ncp_cipher(session, multi->peer_info, &a= mp;gc);

+ /* Set the common options */
+ p2p_ncp_set_options(multi, session, common_cipher);<= /span>
+
= if (!common_cipher)
{
struc= t buffer out =3D alloc_buf_gc(128, &gc);
@@ -502,9 +515= ,12 @@
}

msg(D_= TLS_DEBUG_LOW, "P2P mode NCP negotiation result: "
- "TLS_export=3D%d, DATA_= v2=3D%d, peer-id %d, cipher=3D%s",

+ "TLS_export=3D%d, DATA_v2=3D%d, peer-id %d= , epoch=3D%d, cipher=3D%s",
(bool)(session-&g= t;opt->crypto_flags & CO_USE_TLS_KEY_MATERIAL_EXPORT),
- multi->use_peer_id, mult= i->peer_id, common_cipher);

+ multi->use_peer_id,
+ multi->peer_id,
+ (bool)(session->opt->crypto_flag= s & CO_EPOCH_DATA_KEY_FORMAT),
+ common_cipher);

= gc_free(&gc);
}
diff --git a/src/op= envpn/tls_crypt.c b/src/openvpn/tls_crypt.c
index 0e5dfee..= 2e51c1d 100644
--- a/src/openvpn/tls_crypt.c
+++ b/src/openvpn/tls_crypt.c

@@ -301,7 +301,7 @@<= br> struct buffer tmp =3D *src;
ASSE= RT(buf_advance(&tmp, TLS_CRYPT_OFF_PID));
ASSE= RT(packet_id_read(&pin, &tmp, true));
- if (!crypto_check_replay(opt, &pin, err= or_prefix, &gc))
= + if (!crypto_check_replay(opt, &pin, 0, error_prefix, &gc))=
{
CRYPT_ERROR("= packet replay");
}
diff --git= a/tests/Makefile.am b/tests/Makefile.am
index f26b3b8..324= 6e34 100644
--- a/tests/Makefile.am
+++ b/t= ests/Makefile.am
@@ -52,6 +52,7 @@
unit_t= ests/openvpn/mock_msg.c unit_tests/openvpn/mock_msg.h \
$= (top_srcdir)/src/openvpn/buffer.c \
$(top_srcdir)/src/ope= nvpn/crypto.c \
+ $(t= op_srcdir)/src/openvpn/crypto_epoch.c \
$(top_srcdir)/src= /openvpn/crypto_openssl.c \
$(top_srcdir)/src/openvpn/cry= pto_mbedtls.c \
$(top_srcdir)/src/openvpn/otime.c \
diff --git a/tests/unit_tests/openvpn/Makefile.am b/tests/unit_t= ests/openvpn/Makefile.am
index 307f9ed..471389b 100644
--- a/tests/unit_tests/openvpn/Makefile.am
+++ = b/tests/unit_tests/openvpn/Makefile.am
@@ -86,6 +86,7 @@
$(top_srcdir)/src/compat/compat-strsep.c \
= $(top_srcdir)/src/openvpn/crypto.c \
$(top_srcdir)/src/= openvpn/cryptoapi.c \
+ $(top_srcdir)/src/openvpn/crypto_epoch.c \
$(top_srcdi= r)/src/openvpn/crypto_mbedtls.c \
$(top_srcdir)/src/openv= pn/crypto_openssl.c \
$(top_srcdir)/src/openvpn/env_set.c= \
@@ -132,6 +133,7 @@
$(top_srcdir)/src/= openvpn/base64.c \
$(top_srcdir)/src/openvpn/buffer.c \
$(top_srcdir)/src/openvpn/crypto.c \
+ $(top_srcdir)/src/openvpn/crypto_epoch.c= \
$(top_srcdir)/src/openvpn/crypto_mbedtls.c \ $(top_srcdir)/src/openvpn/crypto_openssl.c \
$(t= op_srcdir)/src/openvpn/env_set.c \
@@ -160,6 +162,7 @@
$(top_srcdir)/src/openvpn/base64.c \
$(top_= srcdir)/src/openvpn/buffer.c \
$(top_srcdir)/src/openvpn/= crypto.c \
+ $(top_sr= cdir)/src/openvpn/crypto_epoch.c \
$(top_srcdir)/src/open= vpn/crypto_mbedtls.c \
$(top_srcdir)/src/openvpn/crypto_o= penssl.c \
$(top_srcdir)/src/openvpn/env_set.c \@@ -179,6 +182,7 @@
$(top_srcdir)/src/openvpn/net= working_sitnl.c \
$(top_srcdir)/src/openvpn/buffer.c \
$(top_srcdir)/src/openvpn/crypto.c \
+ $(top_srcdir)/src/openvpn/crypto_epoch.c= \
$(top_srcdir)/src/openvpn/crypto_mbedtls.c \ $(top_srcdir)/src/openvpn/crypto_openssl.c \
$(t= op_srcdir)/src/openvpn/otime.c \
@@ -250,6 +254,7 @@=
auth_token_testdriver_SOURCES =3D test_auth_token.c mock_msg.c \=
$(top_srcdir)/src/openvpn/buffer.c \
$= (top_srcdir)/src/openvpn/crypto.c \
+ $(top_srcdir)/src/openvpn/crypto_epoch.c \
$(top_srcdir)/src/openvpn/crypto_mbedtls.c \

$(top_src= dir)/src/openvpn/crypto_openssl.c \
$(top_srcdir)/src/ope= nvpn/otime.c \
@@ -285,6 +290,7 @@
ncp_tes= tdriver_SOURCES =3D test_ncp.c mock_msg.c \
$(top_srcdir)= /src/openvpn/buffer.c \
$(top_srcdir)/src/openvpn/crypto.= c \
+ $(top_srcdir)/s= rc/openvpn/crypto_epoch.c \
$(top_srcdir)/src/openvpn/cry= pto_mbedtls.c \
$(top_srcdir)/src/openvpn/crypto_openssl.= c \
$(top_srcdir)/src/openvpn/otime.c \
d= iff --git a/tests/unit_tests/openvpn/test_crypto.c b/tests/unit_tests/openv= pn/test_crypto.c
index 3d9c99c..5b583c7 100644
--- a/tests/unit_tests/openvpn/test_crypto.c

+++ b/test= s/unit_tests/openvpn/test_crypto.c
@@ -874,17 +874,17 @@
struct crypto_options *co =3D &data->co;
/* Modify the receive epoch and keys to have= a very high epoch to test
- * the end of array. Iterating through all 16k keys takes a 2-3s, = so we
+ * the end= of array. Iterating through all 65k keys takes a 2-3s, so we
* avoid this for the unit test */

- co->key_ctx_bi.decrypt.epoch =3D 16000;<= br>- co->key_ctx_bi.encrypt= .epoch =3D 16000;
+ = co->key_ctx_bi.decrypt.epoch =3D 65500;
+ co->key_ctx_bi.encrypt.epoch =3D 65500;

- co-= >epoch_key_send.epoch =3D 16000;
- co->epoch_key_recv.epoch =3D 16000 + co->epoch_data= _keys_future_count;
+= co->epoch_key_send.epoch =3D 65500;
+ co->epoch_key_recv.epoch =3D 65500 + co->e= poch_data_keys_future_count;

for (ui= nt16_t i =3D 0; i < co->epoch_data_keys_future_count; i++)
= {
- c= o->epoch_data_keys_future[i].epoch =3D 16001 + i;
+ co->epoch_data_keys_future[i].= epoch =3D 65501 + i;
}

/* Move the last few keys until we are close to the limit */
=
diff --git a/tests/unit_tests/openvpn/test_ssl.c b/tests/unit_tes= ts/openvpn/test_ssl.c
index 845ca56..486e298 100644<= br>--- a/tests/unit_tests/openvpn/test_ssl.c
+++ b/te= sts/unit_tests/openvpn/test_ssl.c
@@ -35,6 +35,7 @@<= br> #include <cmocka.h>

#inc= lude "crypto.h"
+#include "crypto_epoch.h"
#include "o= ptions.h"
#include "ssl_backend.h" #include "options_util.h"
@@ -370,22 +37= 1,46 @@


struct crypto_= options
-init_crypto_op= tions(const char *cipher, const char *auth)
+init_crypto_options(const char *cipher, const char = *auth, bool epoch,
+ = struct key2 *statickey)
{
struct key2 key2 =3D { .n =3D 2};


- ASSERT(rand_bytes(key2.keys[0].ci= pher, sizeof(key2.keys[0].cipher)));

- ASSERT(rand_bytes(key2.keys[0].hmac, sizeof(key2.keys[0]= .hmac)));
- ASSERT(r= and_bytes(key2.keys[1].cipher, sizeof(key2.keys[1].cipher)));
- ASSERT(rand_bytes(key2.keys[1].= hmac, sizeof(key2.keys)[1].hmac));

+ if (statickey)
+ {
+= /* Use chosen static key instead of random key when defined */
+ key2 =3D *static= key;
+ }+ else
+ {
+ ASSERT(rand_bytes(key2.keys[0].cipher, sizeof(= key2.keys[0].cipher)));
+ ASSERT(rand_bytes(key2.keys[0].hmac, sizeof(key2.keys[0].hmac))= );
+ ASSERT(ra= nd_bytes(key2.keys[1].cipher, sizeof(key2.keys[1].cipher)));
+ ASSERT(rand_bytes(key2.key= s[1].hmac, sizeof(key2.keys)[1].hmac));

+ }

struct cry= pto_options co =3D { 0 };

struct key= _type kt =3D create_kt(cipher, auth, "ssl-test");

- init_key_ctx_bi= (&co.key_ctx_bi, &key2, 0, &kt, "unit-test-ssl");
- packet_id_init(&c= o.packet_id, 5, 5, "UNITTEST", 0);
+ if (epoch)
+ {
+ struct epoch_key e1 =3D { .epoch =3D 1, .epoch_key =3D { 0 }= };
+ memcpy(e1= .epoch_key, key2.keys[0].cipher, sizeof(e1.epoch_key));
+ co.flags |=3D CO_EPOCH_DATA_KEY= _FORMAT;
+ epo= ch_init_key_ctx(&co, &kt, &e1, &e1, 5);

+ /* Do a littl= e of dancing for the epoch_send_key_iterate to test
+ * that this works too */<= br>+ epoch_iterate_send_= key(&co);
+ = epoch_iterate_send_key(&co);
+ epoch_iterate_send_key(&co);
+ }
+ else
+ {
+ = init_key_ctx_bi(&co.key_ctx_bi, &key2, KEY_DIRECTION_BIDIRECTI= ONAL, &kt, "unit-test-ssl");
+ }
+ packet_id_init(&co.packet_id, 5, 5, "UNITTEST", = 0);
return co;
}

@@ -394,17 +419,16 @@
{
= packet_id_free(&co->packet_id);
free_key_ctx_b= i(&co->key_ctx_bi);
-
+ free_epoch= _key_ctx(co);
}

/* This= adds a few more methods than strictly necessary but this allows
= * us to see which exact test was run from the backtrace of the test=
* when it fails */
static void-run_data_channel_with_cipher_e= nd(const char *cipher)
- struct crypto_op= tions co =3D init_crypto_options(cipher, "none");
- co.flags |=3D CO_EPOCH_DATA_KEY_F= ORMAT;

+ struct cr= ypto_options co =3D init_crypto_options(cipher, "none", true, NUL= L);
do_data_channel_round_trip(&co);
uninit_crypto_options(&co);

}
= @@ -412,7 +436,7 @@
static void
run_data_= channel_with_cipher(const char *cipher, const char *auth)
= {
- struct crypto_op= tions co =3D init_crypto_options(cipher, auth);
+ struct crypto_options co =3D init_crypto_op= tions(cipher, auth, false, NULL);
do_data_channel_roun= d_trip(&co);
uninit_crypto_options(&co);
}
@@ -421,25 +445,40 @@
static= void
test_data_channel_roundtrip_aes_128_gcm(void **state= )
{
- = run_data_channel_with_cipher_end("AES-128-GCM");
run_data_channel_with_cipher("AES-128-GCM", "none&qu= ot;);

}

static void
+test_data_channel_round= trip_aes_128_gcm_epoch(void **state)
+{
+ = run_data_channel_with_cipher_epoch("AES-128-GCM");
<= span style=3D"color: hsl(120, 100%, 40%);">+}

+
+static void
test_data_channel_roundtrip_aes_192_gcm= (void **state)
{
- run_data_channel_with_cipher_end("AES-192-GCM");<= /span>
run_data_channel_with_cipher("AES-192-GCM", = "none");
}

st= atic void
+test_data_= channel_roundtrip_aes_192_gcm_epoch(void **state)
+{
+ run_data_channel_with_cipher_epoch("AES-192-GCM")= ;
+}
+
+static void
test_data_channel_roundtri= p_aes_256_gcm(void **state)
{
- run_data_channel_with_cipher_end("AES-256= -GCM");
run_data_channel_with_cipher("AES-25= 6-GCM", "none");
}
=
static void
+{
+ run_data_channel_with_cipher_epoch("AES-2= 56-GCM");
+}
+
+static void
test_data_ch= annel_roundtrip_aes_128_cbc(void **state)
{
run_data_channel_with_cipher("AES-128-CBC", "SHA256&q= uot;);

@@ -466,11 +505,22 @@
retur= n;
}

- run_data_channel_with_cipher_end("ChaCha20-P= oly1305");
run_data_channel_with_cipher("Cha= Cha20-Poly1305", "none");
}

static void
+test_data_channel_roundtrip_chacha20_poly1305_epoch(void **stat= e)
+{
+ if (!cipher_valid("ChaCha2= 0-Poly1305"))

+ = {
+ skip();=
+ return;
+ }
+
+ run_data_channel_with_cipher_epoch("ChaCha20-Po= ly1305");
+}
+
+static void
test_data_ch= annel_roundtrip_bf_cbc(void **state)
{
= if (!cipher_valid("BF-CBC"))
@@ -482,6 +532,154= @@
}


+static struct key2
+create_key(void)
+{
+ struct key2 key2 =3D {.n =3D 2};
+
+ const uint8_t key[] =3D
+ {'a', 'b', 'c', 'd&#= 39;, 'e', 'f', 'g', 'h', '0', '= 1', '2', '3', '4', '5', '6', &#= 39;7', 'A', 'B', 'C', 'D', 'E',= 'F',
+ &= #39;G', 'H', 'j', 'k', 'u', 'c'= , 'h', 'e', 'n', 'l'};
+
+ static_assert(sizeof(key) =3D=3D 32, "Size of key = should be 32 bytes");
+
+ /* copy = the key a few times to ensure to have the size we need for
+ * Statickey but XOR it to not r= epeat it */
+ uint= 8_t keydata[sizeof(key2.keys)];
+
+ for= (int i =3D 0; i < sizeof(key2.keys); i++)
+ {
+ keydata[i] =3D (uint8_t) (key[i % sizeof(key)] ^ i);
+ }
+
+ ASSERT(memcpy(key2.keys[0].cipher, keydata, sizeof(= key2.keys[0].cipher)));
+ ASSERT(memcpy(key2.keys[0].hmac, keydata + 64, sizeof(key2.keys[0].= hmac)));
+ ASSERT(= memcpy(key2.keys[1].cipher, keydata + 128, sizeof(key2.keys[1].cipher)));
+ ASSERT(memcpy(key= 2.keys[1].hmac, keydata + 192, sizeof(key2.keys)[1].hmac));
+

+ return key2;
+}
+=
+static void<= br>+test_data_channel_known_vec= tors_run(bool epoch)
= +{
+ struct key2 k= ey2 =3D create_key();
+
+ struct crypto= _options co =3D init_crypto_options("AES-256-GCM", "none&quo= t;, epoch,
+ = &key2);
+
+ struct gc_arena gc =3D gc_new();
+
+ /* initialise frame for the test */
+ struct frame frame;
+ init_frame_parameters(&frame= );
+
+ struct buffer src =3D alloc_buf_= gc(frame.buf.payload_size, &gc);
+ struct buffer work =3D alloc_buf_gc(BUF_SIZE(&fram= e), &gc);
+ st= ruct buffer encrypt_workspace =3D alloc_buf_gc(BUF_SIZE(&frame), &g= c);
+ struct buffe= r decrypt_workspace =3D alloc_buf_gc(BUF_SIZE(&frame), &gc);=
+ struct buffer buf =3D = clear_buf();
+ voi= d *buf_p;
++ /* init work */+ ASSERT(buf_init(&work= , frame.buf.headroom));
+
+ now =3D 0;<= /span>
+
+ /*
+ * Load src with known data.
+ */
+ ASSERT(buf_init(&src, 0));
+ const char *plaintext =3D "= The quick little fox jumps over the bureaucratic hurdles";
<= span style=3D"color: hsl(120, 100%, 40%);">+

+ ASSERT(buf_write(&src, plaintext, strlen(p= laintext)));
+=
+ /* copy source to inpu= t buf */
+ buf =3D= work;
+ buf_p =3D= buf_write_alloc(&buf, BLEN(&src));
+ ASSERT(buf_p);
+ memcpy(buf_p, BPTR(&src), BLEN(&src));
+
+ /* initialize work buffer with buf.h= eadroom bytes of prepend capacity */
+ ASSERT(buf_init(&encrypt_workspace, frame.buf.head= room));
+
<= span style=3D"color: hsl(120, 100%, 40%);">+ /* add packet opcode and pe= er id */

+ buf_wri= te_u8(&encrypt_workspace, 7);
+ buf_write_u8(&encrypt_workspace, 0);
+ buf_write_u8(&encrypt_worksp= ace, 0);
+ buf_wri= te_u8(&encrypt_workspace, 23);
+
+ = /* encrypt */
+ op= envpn_encrypt(&buf, encrypt_workspace, &co);
+
+ /* separate buffer in authenticated data and encrypted d= ata */
+ uint8_t *= ad_start =3D BPTR(&buf);
+ buf_advance(&buf, 4);
+
+= if (epoch)
+ {=
+ uint8_t pac= ketid1[8] =3D {0, 0x04, 0, 0, 0, 0, 0, 1};
+ assert_memory_equal(BPTR(&buf), packetid= 1, 8);
+ }<= br>+ else
+ {
+ uint8_t packetid1[4] =3D {0, 0, 0, 1};
+ assert_memory_equ= al(BPTR(&buf), packetid1, 4);
+ }
+=
+ if (epoch)
+ {
+ uint8_t *tag_location =3D BEND= (&buf) - OPENVPN_AEAD_TAG_LENGTH;
+ const uint8_t exp_tag_epoch[16] =3D
+ {0x0f, 0xff, 0xf5, 0x91, = 0x3d, 0x39, 0xd7, 0x5b,

+ 0x18, 0x57, 0x3b, 0x57, 0x48, 0x58, 0x9a, 0x7d};
+

+ assert_memory_equal(tag_location, exp_tag_ep= och, OPENVPN_AEAD_TAG_LENGTH);
+ }
+ = else
+ {+ uint8_t *tag_locatio= n =3D BPTR(&buf) + 4;
+ const uint8_t exp_tag_noepoch[16] =3D
+ {0x1f, 0xdd, 0x90, 0x8f, 0x0e, 0x= 9d, 0xc2, 0x5e, 0x79, 0xd8, 0x32, 0x02, 0x0d, 0x58, 0xe7, 0x3f};
= + assert_memory_equal(ta= g_location, exp_tag_noepoch, OPENVPN_AEAD_TAG_LENGTH);
+ }
+
+ /* Check some bytes at the beginning of the encrypted part */<= br>+ if (epoch)
+ {

+ const uint8_t bytesat14[6] =3D {0x36, = 0xaa, 0xb4, 0xd4, 0x9c, 0xe6};
+ assert_memory_equal(BPTR(&buf) + 14, bytesat14, size= of(bytesat14));
+ = }
+ else+ {
+ const uint8_t bytesat30[6] =3D {0= xa8, 0x2e, 0x6b, 0x17, 0x06, 0xd9};
+ assert_memory_equal(BPTR(&buf) + 30, bytesat30,= sizeof(bytesat30));
= + }
+
+ /* decrypt */

+ openvpn_decrypt(&buf, decr= ypt_workspace, &co, &frame, ad_start);

+
+ /* compare */
+ assert_int_equal(buf.len, strlen(plaintext));
+ assert_memory_equal(BPTR(&buf),= plaintext, strlen(plaintext));
+
+ uni= nit_crypto_options(&co);
+ gc_free(&gc);
+}
+=
+static void
+test_data_channel_known_vectors_ep= och(void **state)

+{<= /span>
+ test_data_channe= l_known_vectors_run(true);
+}
+
= +static void
+test_data_channel_known_vectors_shortp= ktid(void **state)
+{=
+ test_data_chann= el_known_vectors_run(false);
+}
++
int=
main(void)
{
@@ -492,13 +690,19= @@
cmocka_unit_test(test_load_certificate_and_key= ),
cmocka_unit_test(test_load_certificate_and_key_= uri),
cmocka_unit_test(test_data_channel_roundtrip= _aes_128_gcm),
+ = cmocka_unit_test(test_data_channel_roundtrip_aes_128_gcm_epoch),<= br> cmocka_unit_test(test_data_channel_roundtrip_aes_192_gcm)= ,
+ cmocka_uni= t_test(test_data_channel_roundtrip_aes_192_gcm_epoch),
= cmocka_unit_test(test_data_channel_roundtrip_aes_256_gcm),
<= span style=3D"color: hsl(120, 100%, 40%);">+ cmocka_unit_test(test_d= ata_channel_roundtrip_aes_256_gcm_epoch),

cmocka_u= nit_test(test_data_channel_roundtrip_chacha20_poly1305),
+ cmocka_unit_test(test_data_cha= nnel_roundtrip_chacha20_poly1305_epoch),
cmocka_un= it_test(test_data_channel_roundtrip_aes_128_cbc),
= cmocka_unit_test(test_data_channel_roundtrip_aes_192_cbc),
= cmocka_unit_test(test_data_channel_roundtrip_aes_256_cbc),<= br> cmocka_unit_test(test_data_channel_roundtrip_bf_cbc),
+ cmocka_unit_tes= t(test_data_channel_known_vectors_epoch),
+ cmocka_unit_test(test_data_channel_known_vect= ors_shortpktid)
};

= #if defined(ENABLE_CRYPTO_OPENSSL)

To v= iew, visit change 806. To unsubscribe, or for help writing mail filters, visit <= a href=3D"http://gerrit.openvpn.net/settings">settings.

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I00751c42cb04e30205ba8e65845= 30831e0d143c5
Gerrit-Change-Number: 806
Gerrit-PatchSet: 19
Gerrit-Owner: plaisthos <arne-openvpn@...1711...= 27...>
Gerrit-Reviewer: cron2 <gert@...1296...>=
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
Gerrit-CC: MaxF <max@...2606...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-Attention: cron2 <gert@...1296...>= ;
Gerrit-Attention: flichtenheld <frank@...2375...= 41...>
Gerrit-Attention: MaxF <max@...2606...> =
Gerrit-MessageType: newpatchset
--D3i0rA3Me20=--