diff options
author | Jack Lloyd <[email protected]> | 2016-11-27 14:54:30 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2016-11-27 14:54:30 -0500 |
commit | bd693b4746d5d8ccd65f07e67995ecf7cedacaa2 (patch) | |
tree | 94babf2a8306dd0bf78a0da48f28ceca8a10080e /src/lib/block/camellia/camellia.cpp | |
parent | 9f28af95363cffa33e1745cc94814f86e937edce (diff) | |
parent | a17e3bfa187adb5c6d7d80c78d5df8c1f146c647 (diff) |
Merge GH #590 Initial Cilk/OpenMP support
Diffstat (limited to 'src/lib/block/camellia/camellia.cpp')
-rw-r--r-- | src/lib/block/camellia/camellia.cpp | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/src/lib/block/camellia/camellia.cpp b/src/lib/block/camellia/camellia.cpp index ac5d57d4e..5ac13b9ab 100644 --- a/src/lib/block/camellia/camellia.cpp +++ b/src/lib/block/camellia/camellia.cpp @@ -645,10 +645,10 @@ inline u64bit FLINV(u64bit v, u64bit K) void encrypt(const byte in[], byte out[], size_t blocks, const secure_vector<u64bit>& SK, const size_t rounds) { - for(size_t i = 0; i != blocks; ++i) + BOTAN_PARALLEL_FOR(size_t i = 0; i < blocks; ++i) { - u64bit D1 = load_be<u64bit>(in, 0); - u64bit D2 = load_be<u64bit>(in, 1); + u64bit D1, D2; + load_be(in + 16*i, D1, D2); const u64bit* K = SK.data(); @@ -676,10 +676,7 @@ void encrypt(const byte in[], byte out[], size_t blocks, D2 ^= *K++; D1 ^= *K++; - store_be(out, D2, D1); - - in += 16; - out += 16; + store_be(out + 16*i, D2, D1); } } @@ -689,10 +686,10 @@ void encrypt(const byte in[], byte out[], size_t blocks, void decrypt(const byte in[], byte out[], size_t blocks, const secure_vector<u64bit>& SK, const size_t rounds) { - for(size_t i = 0; i != blocks; ++i) + BOTAN_PARALLEL_FOR(size_t i = 0; i < blocks; ++i) { - u64bit D1 = load_be<u64bit>(in, 0); - u64bit D2 = load_be<u64bit>(in, 1); + u64bit D1, D2; + load_be(in + 16*i, D1, D2); const u64bit* K = &SK[SK.size()-1]; @@ -720,10 +717,7 @@ void decrypt(const byte in[], byte out[], size_t blocks, D1 ^= *K--; D2 ^= *K; - store_be(out, D2, D1); - - in += 16; - out += 16; + store_be(out + 16*i, D2, D1); } } |