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

randombit / botan / 21861369155

10 Feb 2026 01:47AM UTC coverage: 90.068% (-0.001%) from 90.069%
21861369155

push

github

web-flow
Merge pull request #5296 from randombit/jack/tls-header-patrol

Various changes to reduce header dependencies in TLS

102224 of 113497 relevant lines covered (90.07%)

11437996.84 hits per line

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

0.0
/src/lib/tls/asio/asio_context.cpp
1
/*
2
 * TLS Context
3
 * (C) 2024 Jack Lloyd
4
 *     2024 René Meusel, Rohde & Schwarz Cybersecurity
5
 *
6
 * Botan is released under the Simplified BSD License (see license.txt)
7
 */
8

9
#include <botan/asio_context.h>
10

11
#if defined(BOTAN_HAS_HAS_DEFAULT_TLS_CONTEXT)
12
   #include <botan/auto_rng.h>
13
   #include <botan/certstor_system.h>
14
   #include <botan/tls_session.h>
15
   #include <botan/tls_session_manager_memory.h>
16
#endif
17

18
namespace Botan::TLS {
19

20
#if defined(BOTAN_HAS_HAS_DEFAULT_TLS_CONTEXT)
21

22
namespace {
23

24
/**
25
 * A Credentials_Manager that provides the system's certificate store as trust
26
 * store, if available. Otherwise it defaults to "no trusted certificates".
27
 */
28
class Default_Credentials_Manager : public Credentials_Manager {
×
29
   public:
30
      Default_Credentials_Manager() {
×
31
         try {
×
32
            m_cert_store = std::make_unique<System_Certificate_Store>();
×
33
         } catch(const Not_Implemented&) {
×
34
            // This platform does not provide an adapter for the system's trust store.
35
         }
×
36
      }
×
37

38
      std::vector<Certificate_Store*> trusted_certificate_authorities(const std::string& /*type*/,
×
39
                                                                      const std::string& /*context*/) override {
40
         if(m_cert_store) {
×
41
            return {m_cert_store.get()};
×
42
         } else {
43
            return {};
×
44
         }
45
      }
46

47
   private:
48
      std::unique_ptr<Certificate_Store> m_cert_store;
49
};
50

51
}  // namespace
52

53
Context::Context(Server_Information server_info) :
×
54
      m_credentials_manager(std::make_shared<Default_Credentials_Manager>()),
×
55
      m_rng(std::make_shared<AutoSeeded_RNG>()),
×
56
      m_session_manager(std::make_shared<Session_Manager_In_Memory>(m_rng)),
×
57
      m_policy(std::make_shared<Default_Policy>()),
×
58
      m_server_info(std::move(server_info)) {}
×
59

60
#endif
61

62
}  // namespace Botan::TLS
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

© 2026 Coveralls, Inc