Skip to content

Commit c282b62

Browse files
schwabecron2
authored andcommitted
Clarify some code in epoch with better comments
Change-Id: I34e6b680618a52003d8408852d415c8aeac01feb Signed-off-by: Arne Schwabe <[email protected]> Acked-by: Frank Lichtenheld <[email protected]> Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1190 Message-Id: <[email protected]> URL: https://www.mail-archive.com/[email protected]/msg34829.html Signed-off-by: Gert Doering <[email protected]>
1 parent da51cc4 commit c282b62

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/openvpn/crypto.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,13 @@ openvpn_encrypt_aead(struct buffer *buf, struct buffer work, struct crypto_optio
9797
/* IV starts with packet id to make the IV unique for packet */
9898
if (use_epoch_data_format)
9999
{
100+
/* Note this does not check aead_usage_limit but can overstep it by
101+
* a few extra blocks in one extra write. This is not affecting the
102+
* security margin as these extra blocks are on a completely
103+
* different order of magnitude than the security margin.
104+
* The next iteration/call to epoch_check_send_iterate will
105+
* iterate the epoch
106+
*/
100107
if (!packet_id_write_epoch(&opt->packet_id.send, ctx->epoch, &iv_buffer))
101108
{
102109
msg(D_CRYPT_ERRORS, "ENCRYPT ERROR: packet ID roll over");

src/openvpn/crypto.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,8 @@ struct crypto_options
298298

299299
/** last epoch_key used for generation of the current send data keys.
300300
* As invariant, the epoch of epoch_key_send is always kept >= the epoch of
301-
* epoch_key_recv */
301+
* key_ctx_bi.decrypt.epoch
302+
*/
302303
struct epoch_key epoch_key_send;
303304

304305
/** epoch_key used for the highest receive epoch keys */
@@ -309,7 +310,8 @@ struct crypto_options
309310

310311
/** The limit for AEAD cipher, this is the sum of packets + blocks
311312
* that are allowed to be used. Will switch to a new epoch if this
312-
* limit is reached*/
313+
* limit is reached.
314+
*/
313315
uint64_t aead_usage_limit;
314316

315317
/** Keeps the future epoch data keys for decryption. The current one

0 commit comments

Comments
 (0)