@@ -180,9 +180,9 @@
Loading
180 180
/*
181 181
* Initialize the SSL/TLS Handshake State
182 182
*/
183 -
Handshake_State::Handshake_State(Handshake_IO* io, Callbacks& cb) :
183 +
Handshake_State::Handshake_State(std::unique_ptr<Handshake_IO> io, Callbacks& cb) :
184 184
   m_callbacks(cb),
185 -
   m_handshake_io(io),
185 +
   m_handshake_io(std::move(io)),
186 186
   m_version(m_handshake_io->initial_record_version())
187 187
   {
188 188
   }

@@ -19,8 +19,8 @@
Loading
19 19
class Server_Handshake_State final : public Handshake_State
20 20
   {
21 21
   public:
22 -
      Server_Handshake_State(Handshake_IO* io, Callbacks& cb)
23 -
         : Handshake_State(io, cb) {}
22 +
      Server_Handshake_State(std::unique_ptr<Handshake_IO> io, Callbacks& cb)
23 +
         : Handshake_State(std::move(io), cb) {}
24 24
25 25
      Private_Key* server_rsa_kex_key() { return m_server_rsa_kex_key; }
26 26
      void set_server_rsa_kex_key(Private_Key* key)
@@ -277,12 +277,11 @@
Loading
277 277
   {
278 278
   }
279 279
280 -
Handshake_State* Server::new_handshake_state(Handshake_IO* io)
280 +
std::unique_ptr<Handshake_State> Server::new_handshake_state(std::unique_ptr<Handshake_IO> io)
281 281
   {
282 -
   std::unique_ptr<Handshake_State> state(new Server_Handshake_State(io, callbacks()));
283 -
282 +
   std::unique_ptr<Handshake_State> state(new Server_Handshake_State(std::move(io), callbacks()));
284 283
   state->set_expected_next(CLIENT_HELLO);
285 -
   return state.release();
284 +
   return state;
286 285
   }
287 286
288 287
std::vector<X509_Certificate>

@@ -17,49 +17,49 @@
Loading
17 17
18 18
namespace {
19 19
20 -
Extension* make_extension(TLS_Data_Reader& reader, uint16_t code, uint16_t size, Connection_Side from)
20 +
std::unique_ptr<Extension> make_extension(TLS_Data_Reader& reader, uint16_t code, uint16_t size, Connection_Side from)
21 21
   {
22 22
   switch(code)
23 23
      {
24 24
      case TLSEXT_SERVER_NAME_INDICATION:
25 -
         return new Server_Name_Indicator(reader, size);
25 +
         return std::make_unique<Server_Name_Indicator>(reader, size);
26 26
27 27
      case TLSEXT_SUPPORTED_GROUPS:
28 -
         return new Supported_Groups(reader, size);
28 +
         return std::make_unique<Supported_Groups>(reader, size);
29 29
30 30
      case TLSEXT_CERT_STATUS_REQUEST:
31 -
         return new Certificate_Status_Request(reader, size, from);
31 +
         return std::make_unique<Certificate_Status_Request>(reader, size, from);
32 32
33 33
      case TLSEXT_EC_POINT_FORMATS:
34 -
         return new Supported_Point_Formats(reader, size);
34 +
         return std::make_unique<Supported_Point_Formats>(reader, size);
35 35
36 36
      case TLSEXT_SAFE_RENEGOTIATION:
37 -
         return new Renegotiation_Extension(reader, size);
37 +
         return std::make_unique<Renegotiation_Extension>(reader, size);
38 38
39 39
      case TLSEXT_SIGNATURE_ALGORITHMS:
40 -
         return new Signature_Algorithms(reader, size);
40 +
         return std::make_unique<Signature_Algorithms>(reader, size);
41 41
42 42
      case TLSEXT_USE_SRTP:
43 -
          return new SRTP_Protection_Profiles(reader, size);
43 +
         return std::make_unique<SRTP_Protection_Profiles>(reader, size);
44 44
45 45
      case TLSEXT_ALPN:
46 -
         return new Application_Layer_Protocol_Notification(reader, size);
46 +
         return std::make_unique<Application_Layer_Protocol_Notification>(reader, size);
47 47
48 48
      case TLSEXT_EXTENDED_MASTER_SECRET:
49 -
         return new Extended_Master_Secret(reader, size);
49 +
         return std::make_unique<Extended_Master_Secret>(reader, size);
50 50
51 51
      case TLSEXT_ENCRYPT_THEN_MAC:
52 -
         return new Encrypt_then_MAC(reader, size);
52 +
         return std::make_unique<Encrypt_then_MAC>(reader, size);
53 53
54 54
      case TLSEXT_SESSION_TICKET:
55 -
         return new Session_Ticket(reader, size);
55 +
         return std::make_unique<Session_Ticket>(reader, size);
56 56
57 57
      case TLSEXT_SUPPORTED_VERSIONS:
58 -
         return new Supported_Versions(reader, size, from);
58 +
         return std::make_unique<Supported_Versions>(reader, size, from);
59 59
      }
60 60
61 -
   return new Unknown_Extension(static_cast<Handshake_Extension_Type>(code),
62 -
                                reader, size);
61 +
   return std::make_unique<Unknown_Extension>(static_cast<Handshake_Extension_Type>(code),
62 +
                                              reader, size);;
63 63
   }
64 64
65 65
}
@@ -84,10 +84,7 @@
Loading
84 84
            throw TLS_Exception(TLS::Alert::DECODE_ERROR,
85 85
                                "Peer sent duplicated extensions");
86 86
87 -
         Extension* extn = make_extension(
88 -
            reader, extension_code, extension_size, from);
89 -
90 -
         this->add(extn);
87 +
         this->add(make_extension(reader, extension_code, extension_size, from));
91 88
         }
92 89
      }
93 90
   }

@@ -23,8 +23,8 @@
Loading
23 23
class Client_Handshake_State final : public Handshake_State
24 24
   {
25 25
   public:
26 -
      Client_Handshake_State(Handshake_IO* io, Callbacks& cb) :
27 -
         Handshake_State(io, cb),
26 +
      Client_Handshake_State(std::unique_ptr<Handshake_IO> io, Callbacks& cb) :
27 +
         Handshake_State(std::move(io), cb),
28 28
         m_is_reneg(false)
29 29
         {}
30 30
@@ -79,9 +79,9 @@
Loading
79 79
   send_client_hello(state, false, offer_version, next_protocols);
80 80
   }
81 81
82 -
Handshake_State* Client::new_handshake_state(Handshake_IO* io)
82 +
std::unique_ptr<Handshake_State> Client::new_handshake_state(std::unique_ptr<Handshake_IO> io)
83 83
   {
84 -
   return new Client_Handshake_State(io, callbacks());
84 +
   return std::make_unique<Client_Handshake_State>(std::move(io), callbacks());
85 85
   }
86 86
87 87
std::vector<X509_Certificate>

@@ -150,7 +150,7 @@
Loading
150 150
      io.reset(new Stream_Handshake_IO(std::bind(&Channel::send_record, this, _1, _2)));
151 151
      }
152 152
153 -
   m_pending_state.reset(new_handshake_state(io.release()));
153 +
   m_pending_state = new_handshake_state(std::move(io));
154 154
155 155
   if(auto active = active_state())
156 156
      m_pending_state->set_version(active->version());
Files Coverage
src 92.36%
Project Totals (565 files) 92.36%
1
---
2

3
# Documentation
4
# https://github.com/codecov/support/wiki/Codecov-Yaml#full-yaml
5
#
6
# Validate this file
7
# curl --data-binary @codecov.yml https://codecov.io/validate
8

9
coverage:
10
  status:
11
    project:
12
      default:
13
        # Random seeds in tests lead to a +/-0.05% coverage span even for PRs
14
        # that do not change source code
15
        threshold: 0.05
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading