aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlloyd <[email protected]>2013-07-31 13:27:12 +0000
committerlloyd <[email protected]>2013-07-31 13:27:12 +0000
commite672994f7072e4082da880a6200e0ec93afb7c0b (patch)
treeb1690d7cab72cdf3f721317db8d3d6164b61060f
parent7818291494c0dbc159c9dc8bd301ba9c6139156a (diff)
Avoid undefined operation in rotation operations
-rw-r--r--doc/relnotes/1_11_5.rst11
-rw-r--r--src/utils/rotate.h4
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)));
}