/src/botan/build/include/botan/internal/sha1.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * SHA-1 |
3 | | * (C) 1999-2007,2016 Jack Lloyd |
4 | | * |
5 | | * Botan is released under the Simplified BSD License (see license.txt) |
6 | | */ |
7 | | |
8 | | #ifndef BOTAN_SHA1_H_ |
9 | | #define BOTAN_SHA1_H_ |
10 | | |
11 | | #include <botan/internal/mdx_hash.h> |
12 | | |
13 | | namespace Botan { |
14 | | |
15 | | /** |
16 | | * NIST's SHA-1 |
17 | | */ |
18 | | class SHA_1 final : public MDx_HashFunction { |
19 | | public: |
20 | 0 | std::string name() const override { return "SHA-1"; } |
21 | | |
22 | 0 | size_t output_length() const override { return 20; } |
23 | | |
24 | 0 | std::unique_ptr<HashFunction> new_object() const override { return std::make_unique<SHA_1>(); } |
25 | | |
26 | | std::unique_ptr<HashFunction> copy_state() const override; |
27 | | |
28 | | std::string provider() const override; |
29 | | |
30 | | void clear() override; |
31 | | |
32 | 0 | SHA_1() : MDx_HashFunction(64, true, true), m_digest(5) { clear(); } |
33 | | |
34 | | private: |
35 | | void compress_n(const uint8_t[], size_t blocks) override; |
36 | | |
37 | | #if defined(BOTAN_HAS_SHA1_ARMV8) |
38 | | static void sha1_armv8_compress_n(secure_vector<uint32_t>& digest, const uint8_t blocks[], size_t block_count); |
39 | | #endif |
40 | | |
41 | | #if defined(BOTAN_HAS_SHA1_SSE2) |
42 | | static void sse2_compress_n(secure_vector<uint32_t>& digest, const uint8_t blocks[], size_t block_count); |
43 | | #endif |
44 | | |
45 | | #if defined(BOTAN_HAS_SHA1_X86_SHA_NI) |
46 | | // Using x86 SHA instructions in Intel Goldmont and Cannonlake |
47 | | static void sha1_compress_x86(secure_vector<uint32_t>& digest, const uint8_t blocks[], size_t block_count); |
48 | | #endif |
49 | | |
50 | | void copy_out(uint8_t[]) override; |
51 | | |
52 | | /** |
53 | | * The digest value |
54 | | */ |
55 | | secure_vector<uint32_t> m_digest; |
56 | | |
57 | | /** |
58 | | * The message buffer |
59 | | */ |
60 | | secure_vector<uint32_t> m_W; |
61 | | }; |
62 | | |
63 | | } // namespace Botan |
64 | | |
65 | | #endif |