Commit 9d43a57
committed
State the peer-keyed nonce reuse precisely and document the lock order, relates to github #1468.
The scoped re-review of the previous commit found that its corrected comment
was still false in one reachable state, and that state is the one the new
test creates. deriveNextWriteEpoch advances the local traffic secret when a
KeyUpdate is sent, while installPendingWriteEpoch swaps the epoch in only
when the acknowledgement arrives. So a peer read epoch derived while our own
KeyUpdate is outstanding carries an encrypt side keyed like the PENDING
write epoch, not the current one.
The conclusion is unchanged, since the key is live either way and both
sequence counters start at zero, but the sentence a maintainer would reason
from was wrong, and checking it against the outstanding-KeyUpdate case would
have suggested the guard was over-cautious.
The lock order between DTLS13PostHandshake's monitor and the record layer's
write lock was held by construction and documented nowhere. It is now stated
at both ends: the monitor is taken first, and a call into that class from
inside a write-lock block would invert the order.
Two test comments named mutations that no longer do what they claim. The
epoch ordering moved out of the test-facing view into getLiveReadEpoch, so
reversing the view proves nothing; and relaxing only the first of the two
guards on a second KeyUpdate fails on the exception raised by the second,
not on the datagram count.
The acknowledgement probe's settle period had been trimmed along with the
key update deadlines it does not share. Its claim is a count of records that
did not arrive, so the margin is restored under its own name.1 parent 3cc8c3f commit 9d43a57
6 files changed
Lines changed: 64 additions & 25 deletions
File tree
- tls/src
- main/java/org/bouncycastle/tls
- test/java/org/bouncycastle/tls
- test
Lines changed: 15 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
25 | 33 | | |
26 | 34 | | |
27 | 35 | | |
| |||
584 | 592 | | |
585 | 593 | | |
586 | 594 | | |
587 | | - | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
588 | 602 | | |
589 | 603 | | |
590 | 604 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
26 | 31 | | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
31 | 36 | | |
32 | 37 | | |
33 | 38 | | |
| |||
Lines changed: 15 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
130 | 139 | | |
131 | 140 | | |
132 | 141 | | |
| |||
2269 | 2278 | | |
2270 | 2279 | | |
2271 | 2280 | | |
2272 | | - | |
2273 | | - | |
2274 | | - | |
2275 | | - | |
2276 | | - | |
| 2281 | + | |
| 2282 | + | |
| 2283 | + | |
| 2284 | + | |
| 2285 | + | |
| 2286 | + | |
2277 | 2287 | | |
2278 | 2288 | | |
2279 | 2289 | | |
| |||
Lines changed: 6 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
816 | 816 | | |
817 | 817 | | |
818 | 818 | | |
819 | | - | |
820 | | - | |
821 | | - | |
822 | | - | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
823 | 825 | | |
824 | 826 | | |
825 | 827 | | |
| |||
Lines changed: 7 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
14 | | - | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
119 | 120 | | |
120 | 121 | | |
121 | 122 | | |
122 | | - | |
123 | | - | |
124 | | - | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
125 | 127 | | |
126 | 128 | | |
127 | 129 | | |
| |||
Lines changed: 11 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
145 | | - | |
146 | | - | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
147 | 153 | | |
148 | 154 | | |
149 | 155 | | |
| |||
2663 | 2669 | | |
2664 | 2670 | | |
2665 | 2671 | | |
2666 | | - | |
2667 | | - | |
| 2672 | + | |
| 2673 | + | |
2668 | 2674 | | |
2669 | 2675 | | |
2670 | 2676 | | |
| |||
2817 | 2823 | | |
2818 | 2824 | | |
2819 | 2825 | | |
2820 | | - | |
| 2826 | + | |
2821 | 2827 | | |
2822 | 2828 | | |
2823 | 2829 | | |
| |||
0 commit comments