[Openvpn-devel] [M] Change in openvpn[master]: Reduce number of future epoch keys from 16 to 4
"plaisthos \(Code Review\) via Openvpn-devel" <[email protected]>
| Newsgroups | net.sourceforge.lists.openvpn-devel |
|---|---|
| Message-ID | <[email protected]> |
plaisthos has uploaded this change for review. ( http://gerrit.openvpn.net/c/openvpn/+/1844?usp=email ) Change subject: Reduce number of future epoch keys from 16 to 4 ...................................................................... Reduce number of future epoch keys from 16 to 4 The calculation in the RFC was wrong and probably influenced by an older worst case assumption. With the fixed calculation four future epoch keys should be more than enough even for 100 Gbit/s. So change the number to 4 in OpenVPN as well. This also reduces the spam about the epoch keys a bit. Thanks to Ralf Lici for noticing the wrong calculation. Change-Id: Id3c6681b29026c2920a62a0ea570fd098649e197 Signed-off-by: Arne Schwabe <[email protected]> --- M src/openvpn/ssl.c 1 file changed, 42 insertions(+), 21 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/44/1844/1 diff --git a/src/openvpn/ssl.c b/src/openvpn/ssl.c index fd96b85..617ac2f 100644 --- a/src/openvpn/ssl.c +++ b/src/openvpn/ssl.c @@ -1343,10 +1343,14 @@ 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 channel + /* For now we hardcode this to be 4 for the software based data channel * DCO based implementations/HW implementation might adjust this number - * based on their expected speed */ - const uint8_t future_key_count = 16; + * based on their expected speed. + * + * One epoch lasts 910 GB with 128 byte packets or 78s at 100 GBit/s. + * (respectively 1011 GB and 86s with 1280 byte packets). + */ + const uint8_t future_key_count = 4; int key_direction = server ? KEY_DIRECTION_INVERSE : KEY_DIRECTION_NORMAL; struct key_direction_state kds; @@ -1874,7 +1878,8 @@ /* In server mode we only add this when the client has announced its * support for the feature */ - if (session->opt->mode != MODE_SERVER || multi->use_asymmetric_peer_id) + if (session->opt->mode != MODE_SERVER || multi->use_asymmetric_peer_id + || !session->opt->server) { return buf_printf(out, "ID=%x\n", multi->rx_peer_id); } @@ -1945,21 +1950,21 @@ /* support for P_DATA_V2 */ int iv_proto = IV_PROTO_DATA_V2; - /* support for the latest --dns option */ - iv_proto |= IV_PROTO_DNS_OPTION_V2; - /* support for exit notify via control channel */ iv_proto |= IV_PROTO_CC_EXIT_NOTIFY; - /* currently push-update is not supported when DCO is enabled */ - if (!session->opt->dco_enabled) - { - /* support push-updates */ - iv_proto |= IV_PROTO_PUSH_UPDATE; - } - if (session->opt->pull) { + /* support for the latest --dns option */ + iv_proto |= IV_PROTO_DNS_OPTION_V2; + + /* currently push-update is not supported when DCO is enabled */ + if (!session->opt->dco_enabled) + { + /* support push-updates */ + iv_proto |= IV_PROTO_PUSH_UPDATE; + } + /* support for receiving push_reply before sending * push request, also signal that the client wants * to get push-reply messages without requiring a round @@ -1974,21 +1979,26 @@ /* support for tun-mtu as part of the push message */ buf_printf(&out, "IV_MTU=%d\n", session->opt->frame.tun_max_mtu); - } - /* support for Negotiable Crypto Parameters */ - if (session->opt->mode == MODE_SERVER || session->opt->pull) - { + /* legacy support for Negotiable Crypto Parameters (deprecated in + * favour of IV_CIPHERS) */ if (tls_item_in_cipher_list("AES-128-GCM", session->opt->config_ncp_ciphers) && tls_item_in_cipher_list("AES-256-GCM", session->opt->config_ncp_ciphers)) { buf_printf(&out, "IV_NCP=2\n"); } } - else + else if (session->opt->mode != MODE_SERVER) { - /* We are not using pull or p2mp server, instead do P2P NCP */ + /* If we are not using pull we announce P2P NCP support */ iv_proto |= IV_PROTO_NCP_P2P; + + /* We are sending our ping receive timeout to allow detecting + * mismatched ping */ + if (session->opt->ping_rec_timeout) + { + buf_printf(&out, "P=%d\n", session->opt->ping_rec_timeout); + } } if (session->opt->data_epoch_supported) @@ -2317,6 +2327,17 @@ * can only handle symmetric peer IDs */ multi->tx_peer_id = multi->rx_peer_id; } + + unsigned int iv_proto = extract_iv_proto(multi->peer_info); + + if (iv_proto & IV_PROTO_NCP_P2P && multi->session->opt->push_peer_info_detail < 1) + { + /* If are currently not sending any peerinfo to the peer but the + * (most likely mode == MODE_SERVER) but the peer is using NCP P2P + * we also enable sending minimal peerinfo that carries p2p NCP to + * allow peers in p2p mode to connect */ + multi->session->opt->push_peer_info_detail = 1; + } } free(multi->remote_ciphername); @@ -2413,7 +2434,7 @@ setenv_del(session->opt->es, "exported_keying_material"); } - if (!session->opt->server && !session->opt->pull && ks->key_id == 0) + if (!session->opt->server && !session->opt->pull && ks->key_id == 0 && session->opt->mode != MODE_SERVER) { /* We are a p2p tls-client without pull, enable common * protocol options */ -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1844?usp=email To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: Id3c6681b29026c2920a62a0ea570fd098649e197 Gerrit-Change-Number: 1844 Gerrit-PatchSet: 1 Gerrit-Owner: plaisthos <[email protected]> Gerrit-CC: openvpn-devel <[email protected]> _______________________________________________ Openvpn-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openvpn-devel