From b2da74ca508745f00bb3d6b35cbe34d5031e27e7 Mon Sep 17 00:00:00 2001 From: Jack Lloyd Date: Sun, 25 Oct 2015 22:25:40 -0400 Subject: TLS improvements Use constant time operations when checking CBC padding in TLS decryption Fix a bug in decoding ClientHellos that prevented DTLS rehandshakes from working: on decode the session id and hello cookie would be swapped, causing confusion between client and server. Various changes in the service of finding the above DTLS bug that should have been done before now anyway - better control of handshake timeouts (via TLS::Policy), better reporting of handshake state in the case of an error, and finally expose the facility for per-message application callbacks. --- src/lib/rng/rng.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/lib/rng/rng.h') diff --git a/src/lib/rng/rng.h b/src/lib/rng/rng.h index 6ee67f66f..261880d5d 100644 --- a/src/lib/rng/rng.h +++ b/src/lib/rng/rng.h @@ -75,6 +75,14 @@ class BOTAN_DLL RandomNumberGenerator */ byte next_byte() { return get_random(); } + byte next_nonzero_byte() + { + byte b = next_byte(); + while(b == 0) + b = next_byte(); + return b; + } + /** * Check whether this RNG is seeded. * @return true if this RNG was already seeded, false otherwise. -- cgit v1.2.3