• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

randombit / botan / 4834822395

28 Apr 2023 09:55PM CUT coverage: 92.132% (-0.01%) from 92.146%
4834822395

push

github

77584 of 84210 relevant lines covered (92.13%)

12129586.55 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/lib/stream/ctr/ctr.h
1
/*
2
* CTR-BE Mode
3
* (C) 1999-2007 Jack Lloyd
4
*
5
* Botan is released under the Simplified BSD License (see license.txt)
6
*/
7

8
#ifndef BOTAN_CTR_BE_H_
9
#define BOTAN_CTR_BE_H_
10

11
#include <botan/block_cipher.h>
12
#include <botan/stream_cipher.h>
13

14
namespace Botan {
15

16
/**
17
* CTR-BE (Counter mode, big-endian)
18
*/
19
class CTR_BE final : public StreamCipher
×
20
   {
21
   public:
22
      size_t default_iv_length() const override;
23

24
      bool valid_iv_length(size_t iv_len) const override;
25

26
      Key_Length_Specification key_spec() const override;
27

28
      std::string name() const override;
29

30
      std::unique_ptr<StreamCipher> new_object() const override;
31

32
      void clear() override;
33

34
      bool has_keying_material() const override;
35

36
      size_t buffer_size() const override;
37

38
      /**
39
      * @param cipher the block cipher to use
40
      */
41
      explicit CTR_BE(std::unique_ptr<BlockCipher> cipher);
42

43
      CTR_BE(std::unique_ptr<BlockCipher> cipher, size_t ctr_size);
44

45
      void seek(uint64_t offset) override;
46
   private:
47
      void key_schedule(const uint8_t key[], size_t key_len) override;
48
      void cipher_bytes(const uint8_t in[], uint8_t out[], size_t length) override;
49
      void generate_keystream(uint8_t out[], size_t length) override;
50
      void set_iv_bytes(const uint8_t iv[], size_t iv_len) override;
51
      void add_counter(const uint64_t counter);
52

53
      std::unique_ptr<BlockCipher> m_cipher;
54

55
      const size_t m_block_size;
56
      const size_t m_ctr_size;
57
      const size_t m_ctr_blocks;
58

59
      secure_vector<uint8_t> m_counter, m_pad;
60
      std::vector<uint8_t> m_iv;
61
      size_t m_pad_pos;
62
   };
63

64
}
65

66
#endif
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc