summaryrefslogtreecommitdiff
path: root/cast.cpp
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2015-07-23 05:10:12 -0400
committerJeffrey Walton <noloader@gmail.com>2015-07-23 05:10:12 -0400
commit7b629dcfa6db55f10b58440b71d2e8912c9a4fce (patch)
tree28a43bc0376aab4cadbc9a0d8bb0a157ca96585d /cast.cpp
parentac0f94c23ac216bdefee446fb62b81c812eb2756 (diff)
downloadcryptopp-git-7b629dcfa6db55f10b58440b71d2e8912c9a4fce.tar.gz
Cleared UB in cast.cpp due to use of rotVariable. On PowerPC, the specialization that uses inline assembler will activate. The inline assembly uses __rlwnm which takes a mask and does not suffer C/C++ UB
Diffstat (limited to 'cast.cpp')
-rw-r--r--cast.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/cast.cpp b/cast.cpp
index ef0a5efd..539923da 100644
--- a/cast.cpp
+++ b/cast.cpp
@@ -15,15 +15,15 @@ NAMESPACE_BEGIN(CryptoPP)
/* CAST uses three different round functions */
#define f1(l, r, km, kr) \
- t = rotlVariable(km + r, kr); \
+ t = rotlMod(km + r, kr); \
l ^= ((S[0][U8a(t)] ^ S[1][U8b(t)]) - \
S[2][U8c(t)]) + S[3][U8d(t)];
#define f2(l, r, km, kr) \
- t = rotlVariable(km ^ r, kr); \
+ t = rotlMod(km ^ r, kr); \
l ^= ((S[0][U8a(t)] - S[1][U8b(t)]) + \
S[2][U8c(t)]) ^ S[3][U8d(t)];
#define f3(l, r, km, kr) \
- t = rotlVariable(km - r, kr); \
+ t = rotlMod(km - r, kr); \
l ^= ((S[0][U8a(t)] + S[1][U8b(t)]) ^ \
S[2][U8c(t)]) - S[3][U8d(t)];