diff options
author | lloyd <[email protected]> | 2013-07-31 13:27:12 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2013-07-31 13:27:12 +0000 |
commit | e672994f7072e4082da880a6200e0ec93afb7c0b (patch) | |
tree | b1690d7cab72cdf3f721317db8d3d6164b61060f | |
parent | 7818291494c0dbc159c9dc8bd301ba9c6139156a (diff) |
Avoid undefined operation in rotation operations
-rw-r--r-- | doc/relnotes/1_11_5.rst | 11 | ||||
-rw-r--r-- | src/utils/rotate.h | 4 |
2 files changed, 15 insertions, 0 deletions
diff --git a/doc/relnotes/1_11_5.rst b/doc/relnotes/1_11_5.rst new file mode 100644 index 000000000..f554283ca --- /dev/null +++ b/doc/relnotes/1_11_5.rst @@ -0,0 +1,11 @@ +Version 1.11.5, Not Yet Released +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +* TLS channels now support sending a ``std::vector`` + +* Add a generic 64-bit multiply instruction for producing a 128 bit result + in mul128.h + +* Avoid potentially undefined operations in the bit rotation operations. Not + known to have caused problems under existing compilers but might break in the + future. Found by Clang sanitizer, reported by Jeffrey Walton. diff --git a/src/utils/rotate.h b/src/utils/rotate.h index 465746e0b..2593010b4 100644 --- a/src/utils/rotate.h +++ b/src/utils/rotate.h @@ -20,6 +20,8 @@ namespace Botan { */ template<typename T> inline T rotate_left(T input, size_t rot) { + if(rot == 0) + return input; return static_cast<T>((input << rot) | (input >> (8*sizeof(T)-rot)));; } @@ -31,6 +33,8 @@ template<typename T> inline T rotate_left(T input, size_t rot) */ template<typename T> inline T rotate_right(T input, size_t rot) { + if(rot == 0) + return input; return static_cast<T>((input >> rot) | (input << (8*sizeof(T)-rot))); } |