blob: 4cfab60d430053b10c5457d41f314ff237532425 [file] [log] [blame]
Avi Drissman64595482022-09-14 20:52:291// Copyright 2012 The Chromium Authors
[email protected]b70a4a22011-11-15 03:12:332// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef NET_SOCKET_SSL_SOCKET_H_
6#define NET_SOCKET_SSL_SOCKET_H_
7
Md Hasibul Hasan7495cd72024-03-26 01:02:328#include <string_view>
9
Elly7c63cc12024-11-27 21:01:4810#include "base/containers/span.h"
bnc81c46c1f2016-10-04 16:25:5911#include "net/base/net_export.h"
[email protected]b70a4a22011-11-15 03:12:3312#include "net/socket/stream_socket.h"
13
[email protected]b70a4a22011-11-15 03:12:3314namespace net {
15
16// SSLSocket interface defines method that are common between client
17// and server SSL sockets.
18class NET_EXPORT SSLSocket : public StreamSocket {
Elly7c63cc12024-11-27 21:01:4819 public:
20 ~SSLSocket() override = default;
[email protected]b70a4a22011-11-15 03:12:3321
Elly7c63cc12024-11-27 21:01:4822 // Exports data derived from the SSL master-secret (see RFC 5705). The call
23 // will fail with an error if the socket is not connected or the SSL
24 // implementation does not support the operation. Note that |label| is
25 // required (per RFC 5705 section 4) to be ASCII and subclasses enforce this
26 // requirement.
27 //
28 // Note that in TLS < 1.3, passing std::nullopt for context produces a
29 // different result from passing a populated option containing an empty span.
30 // TLS 1.3 did away with this distinction and passing std::nullopt has the
31 // same behavior as passing base::span(). See RFC 5705 section 4 for TLS <
32 // 1.3 and RFC 8446 section 7.5 for TLS 1.3.
33 //
34 // Once we drop support for TLS < 1.3 (some day...) the context argument here
35 // can cease being optional.
36 virtual int ExportKeyingMaterial(
37 std::string_view label,
38 std::optional<base::span<const uint8_t>> context,
39 base::span<uint8_t> out) = 0;
[email protected]b70a4a22011-11-15 03:12:3340};
41
42} // namespace net
43
44#endif // NET_SOCKET_SSL_SOCKET_H_