/src/botan/src/lib/base/buf_comp.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * (C) 2019 Jack Lloyd |
3 | | * |
4 | | * Botan is released under the Simplified BSD License (see license.txt) |
5 | | */ |
6 | | |
7 | | #include <botan/buf_comp.h> |
8 | | |
9 | | #include <botan/internal/loadstor.h> |
10 | | |
11 | | namespace Botan { |
12 | | |
13 | 0 | void Buffered_Computation::update(std::string_view str) { |
14 | 0 | add_data({cast_char_ptr_to_uint8(str.data()), str.size()}); |
15 | 0 | } |
16 | | |
17 | 0 | void Buffered_Computation::update_be(uint16_t val) { |
18 | 0 | uint8_t inb[sizeof(val)]; |
19 | 0 | store_be(val, inb); |
20 | 0 | add_data({inb, sizeof(inb)}); |
21 | 0 | } |
22 | | |
23 | 0 | void Buffered_Computation::update_be(uint32_t val) { |
24 | 0 | uint8_t inb[sizeof(val)]; |
25 | 0 | store_be(val, inb); |
26 | 0 | add_data({inb, sizeof(inb)}); |
27 | 0 | } |
28 | | |
29 | 0 | void Buffered_Computation::update_be(uint64_t val) { |
30 | 0 | uint8_t inb[sizeof(val)]; |
31 | 0 | store_be(val, inb); |
32 | 0 | add_data({inb, sizeof(inb)}); |
33 | 0 | } |
34 | | |
35 | 0 | void Buffered_Computation::update_le(uint16_t val) { |
36 | 0 | uint8_t inb[sizeof(val)]; |
37 | 0 | store_le(val, inb); |
38 | 0 | add_data({inb, sizeof(inb)}); |
39 | 0 | } |
40 | | |
41 | 0 | void Buffered_Computation::update_le(uint32_t val) { |
42 | 0 | uint8_t inb[sizeof(val)]; |
43 | 0 | store_le(val, inb); |
44 | 0 | add_data({inb, sizeof(inb)}); |
45 | 0 | } |
46 | | |
47 | 0 | void Buffered_Computation::update_le(uint64_t val) { |
48 | 0 | uint8_t inb[sizeof(val)]; |
49 | 0 | store_le(val, inb); |
50 | 0 | add_data({inb, sizeof(inb)}); |
51 | 0 | } |
52 | | |
53 | 59.7k | void Buffered_Computation::final(std::span<uint8_t> out) { |
54 | 59.7k | BOTAN_ARG_CHECK(out.size() >= output_length(), "provided output buffer has insufficient capacity"); |
55 | 59.7k | final_result(out); |
56 | 59.7k | } |
57 | | |
58 | | } // namespace Botan |