diff options
author | lloyd <[email protected]> | 2011-12-28 22:39:18 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2011-12-28 22:39:18 +0000 |
commit | eb6b59f2aef6a4999be244c7d90ace3f6bbcac5d (patch) | |
tree | 7b15e8034769e1a9d57335e1fb0259167299fcc6 /src/utils | |
parent | b48a5b800a00e955cada6c418848c3bc460e44e7 (diff) |
Don't buffer in the record writer at all - we immediately process and
send out inputs as they are available. Thus, flushing is never
required, and we avoid some unnecessary copying.
If we are using a CBC mode cipher in SSLv3/TLSv1.0, send a 1-byte
fragment to start to prevent the adaptive plaintext attack.
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/rounding.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/utils/rounding.h b/src/utils/rounding.h index 78b9eeb5d..4ddd7a432 100644 --- a/src/utils/rounding.h +++ b/src/utils/rounding.h @@ -44,6 +44,18 @@ inline T round_down(T n, T align_to) return (n - (n % align_to)); } +/** +* Clamp +*/ +inline size_t clamp(size_t n, size_t lower_bound, size_t upper_bound) + { + if(n < lower_bound) + return lower_bound; + if(n > upper_bound) + return upper_bound; + return n; + } + } #endif |