9 #include <botan/internal/xor_buf.h>    19    counter(256 * permutation->block_size()),
    20    buffer(counter.size()),
    47 void CTR_BE::key_schedule(
const byte key[], 
size_t key_len)
    49    permutation->
set_key(key, key_len);
    60    return (
"CTR-BE(" + permutation->
name() + 
")");
    68    while(length >= buffer.
size() - position)
    70       xor_buf(out, in, &buffer[position], buffer.
size() - position);
    71       length -= (buffer.
size() - position);
    72       in += (buffer.
size() - position);
    73       out += (buffer.
size() - position);
    76    xor_buf(out, in, &buffer[position], length);
    92    counter.
copy(0, iv, iv_len);
    97    for(
size_t i = 1; i != 256; ++i)
    99       counter.
copy(i*bs, &counter[(i-1)*bs], bs);
   101       for(
size_t j = 0; j != bs; ++j)
   102          if(++counter[i*bs + (bs - 1 - j)])
   106    permutation->
encrypt_n(&counter[0], &buffer[0], 256);
   113 void CTR_BE::increment_counter()
   122    for(
size_t i = 0; i != 256; ++i)
   124       for(
size_t j = 1; j != bs; ++j)
   125          if(++counter[i*bs + (bs - 1 - j)])
   129    permutation->
encrypt_n(&counter[0], &buffer[0], 256);
 
void cipher(const byte in[], byte out[], size_t length)
void copy(const T in[], size_t n)
void set_key(const SymmetricKey &key)
virtual std::string name() const =0
CTR_BE(BlockCipher *cipher)
virtual void encrypt_n(const byte in[], byte out[], size_t blocks) const =0
void xor_buf(byte out[], const byte in[], size_t length)
void zeroise(MemoryRegion< T > &vec)
virtual size_t block_size() const =0
bool valid_iv_length(size_t iv_len) const
void set_iv(const byte iv[], size_t iv_len)