diff options
Diffstat (limited to 'src/lib/stream')
-rw-r--r-- | src/lib/stream/chacha/chacha.h | 2 | ||||
-rw-r--r-- | src/lib/stream/ctr/ctr.cpp | 23 | ||||
-rw-r--r-- | src/lib/stream/ctr/ctr.h | 2 | ||||
-rw-r--r-- | src/lib/stream/ofb/ofb.h | 2 | ||||
-rw-r--r-- | src/lib/stream/rc4/rc4.h | 2 | ||||
-rw-r--r-- | src/lib/stream/salsa20/salsa20.h | 2 | ||||
-rw-r--r-- | src/lib/stream/shake_cipher/shake_cipher.h | 2 |
7 files changed, 21 insertions, 14 deletions
diff --git a/src/lib/stream/chacha/chacha.h b/src/lib/stream/chacha/chacha.h index 261d950bd..1749127f2 100644 --- a/src/lib/stream/chacha/chacha.h +++ b/src/lib/stream/chacha/chacha.h @@ -10,6 +10,8 @@ #include <botan/stream_cipher.h> +BOTAN_FUTURE_INTERNAL_HEADER(chacha.h) + namespace Botan { /** diff --git a/src/lib/stream/ctr/ctr.cpp b/src/lib/stream/ctr/ctr.cpp index f1d8d97b8..ca187ea47 100644 --- a/src/lib/stream/ctr/ctr.cpp +++ b/src/lib/stream/ctr/ctr.cpp @@ -141,31 +141,27 @@ void CTR_BE::add_counter(const uint64_t counter) if(ctr_size == 4) { - size_t off = (BS - 4); - uint32_t low32 = static_cast<uint32_t>(counter + load_be<uint32_t>(&m_counter[off], 0)); + const size_t off = (BS - 4); + const uint32_t low32 = static_cast<uint32_t>(counter + load_be<uint32_t>(&m_counter[off], 0)); for(size_t i = 0; i != ctr_blocks; ++i) { - store_be(low32, &m_counter[off]); - off += BS; - low32 += 1; + store_be(uint32_t(low32 + i), &m_counter[i*BS+off]); } } else if(ctr_size == 8) { - size_t off = (BS - 8); - uint64_t low64 = counter + load_be<uint64_t>(&m_counter[off], 0); + const size_t off = (BS - 8); + const uint64_t low64 = counter + load_be<uint64_t>(&m_counter[off], 0); for(size_t i = 0; i != ctr_blocks; ++i) { - store_be(low64, &m_counter[off]); - off += BS; - low64 += 1; + store_be(uint64_t(low64 + i), &m_counter[i*BS+off]); } } else if(ctr_size == 16) { - size_t off = (BS - 16); + const size_t off = (BS - 16); uint64_t b0 = load_be<uint64_t>(&m_counter[off], 0); uint64_t b1 = load_be<uint64_t>(&m_counter[off], 1); b1 += counter; @@ -173,9 +169,8 @@ void CTR_BE::add_counter(const uint64_t counter) for(size_t i = 0; i != ctr_blocks; ++i) { - store_be(b0, &m_counter[off]); - store_be(b1, &m_counter[off+8]); - off += BS; + store_be(b0, &m_counter[i*BS+off]); + store_be(b1, &m_counter[i*BS+off+8]); b1 += 1; b0 += (b1 == 0); // carry } diff --git a/src/lib/stream/ctr/ctr.h b/src/lib/stream/ctr/ctr.h index 79911b2fe..0687c606e 100644 --- a/src/lib/stream/ctr/ctr.h +++ b/src/lib/stream/ctr/ctr.h @@ -11,6 +11,8 @@ #include <botan/block_cipher.h> #include <botan/stream_cipher.h> +BOTAN_FUTURE_INTERNAL_HEADER(ctr.h) + namespace Botan { /** diff --git a/src/lib/stream/ofb/ofb.h b/src/lib/stream/ofb/ofb.h index 1e9866c64..994d3d198 100644 --- a/src/lib/stream/ofb/ofb.h +++ b/src/lib/stream/ofb/ofb.h @@ -11,6 +11,8 @@ #include <botan/stream_cipher.h> #include <botan/block_cipher.h> +BOTAN_FUTURE_INTERNAL_HEADER(ofb.h) + namespace Botan { /** diff --git a/src/lib/stream/rc4/rc4.h b/src/lib/stream/rc4/rc4.h index d59ce01f0..eff3c568d 100644 --- a/src/lib/stream/rc4/rc4.h +++ b/src/lib/stream/rc4/rc4.h @@ -11,6 +11,8 @@ #include <botan/stream_cipher.h> #include <botan/types.h> +BOTAN_FUTURE_INTERNAL_HEADER(rc4.h) + namespace Botan { /** diff --git a/src/lib/stream/salsa20/salsa20.h b/src/lib/stream/salsa20/salsa20.h index 0870c9fd2..6ad0da770 100644 --- a/src/lib/stream/salsa20/salsa20.h +++ b/src/lib/stream/salsa20/salsa20.h @@ -10,6 +10,8 @@ #include <botan/stream_cipher.h> +BOTAN_FUTURE_INTERNAL_HEADER(salsa20.h) + namespace Botan { /** diff --git a/src/lib/stream/shake_cipher/shake_cipher.h b/src/lib/stream/shake_cipher/shake_cipher.h index 492341a7c..85eaec2a8 100644 --- a/src/lib/stream/shake_cipher/shake_cipher.h +++ b/src/lib/stream/shake_cipher/shake_cipher.h @@ -11,6 +11,8 @@ #include <botan/stream_cipher.h> #include <botan/secmem.h> +BOTAN_FUTURE_INTERNAL_HEADER(shake_cipher.h) + namespace Botan { /** |