Coverage Report

Created: 2025-09-17 07:05

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/nss/fuzz/targets/lib/tls/client_config.h
Line
Count
Source
1
/* This Source Code Form is subject to the terms of the Mozilla Public
2
 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
3
 * You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5
#ifndef TLS_CLIENT_CONFIG_H_
6
#define TLS_CLIENT_CONFIG_H_
7
8
#include <cstddef>
9
#include <cstdint>
10
#include <ostream>
11
12
#include "prio.h"
13
#include "sslt.h"
14
15
#ifdef IS_DTLS_FUZZ
16
66.3k
#define SSL_VERSION_RANGE_MIN_VALID 0x0302
17
#else
18
#define SSL_VERSION_RANGE_MIN_VALID 0x0301
19
#endif
20
66.3k
#define SSL_VERSION_RANGE_MAX_VALID 0x0304
21
22
namespace TlsClient {
23
24
class Config {
25
 public:
26
  Config(const uint8_t* data, size_t len);
27
28
  void SetCallbacks(PRFileDesc* fd);
29
  void SetSocketOptions(PRFileDesc* fd);
30
31
17.0k
  SSLHashType PskHashType() {
32
17.0k
    if (config_ % 2) return ssl_hash_sha256;
33
34
13.0k
    return ssl_hash_sha384;
35
17.0k
  };
36
0
  SSLVersionRange SslVersionRange() { return ssl_version_range_; };
37
38
  // NOTE: When adding more config options here, don't forget to print
39
  // them in the "<<"-overloaded operator.
40
55.6k
  bool FailCertificateAuthentication() { return config_ & (1 << 0); };
41
33.1k
  bool EnableExtendedMasterSecret() { return config_ & (1 << 1); };
42
33.1k
  bool RequireDhNamedGroups() { return config_ & (1 << 2); };
43
33.1k
  bool EnableFalseStart() { return config_ & (1 << 3); };
44
33.1k
  bool EnableDeflate() { return config_ & (1 << 4); };
45
33.1k
  bool CbcRandomIv() { return config_ & (1 << 5); };
46
33.1k
  bool RequireSafeNegotiation() { return config_ & (1 << 6); };
47
33.1k
  bool NoCache() { return config_ & (1 << 7); };
48
33.1k
  bool EnableGrease() { return config_ & (1 << 8); };
49
33.1k
  bool EnableCHExtensionPermutation() { return config_ & (1 << 9); };
50
33.1k
  bool SetCertificateCompressionAlgorithm() { return config_ & (1 << 10); };
51
18.2k
  bool SetClientEchConfigs() { return config_ & (1 << 11); };
52
33.1k
  bool SetVersionRange() { return config_ & (1 << 12); };
53
33.1k
  bool AddExternalPsk() { return config_ & (1 << 13); };
54
33.1k
  bool EnablePostHandshakeAuth() { return config_ & (1 << 14); };
55
33.1k
  bool EnableZeroRtt() { return config_ & (1 << 15); };
56
33.1k
  bool EnableAlpn() { return config_ & (1 << 16); };
57
33.1k
  bool EnableFallbackScsv() { return config_ & (1 << 17); };
58
33.1k
  bool EnableOcspStapling() { return config_ & (1 << 18); };
59
33.1k
  bool EnableSessionTickets() { return config_ & (1 << 19); };
60
33.1k
  bool EnableTls13CompatMode() { return config_ & (1 << 20); };
61
33.1k
  bool NoLocks() { return config_ & (1 << 21); };
62
33.1k
  bool EnableTls13GreaseEch() { return config_ & (1 << 22); };
63
33.1k
  bool SetDtls13VersionWorkaround() { return config_ & (1 << 23); };
64
33.1k
  bool EnableDelegatedCredentials() { return config_ & (1 << 24); };
65
33.1k
  bool EnableDtlsShortHeader() { return config_ & (1 << 25); };
66
67
 private:
68
  uint32_t config_;
69
  SSLVersionRange ssl_version_range_;
70
};
71
72
std::ostream& operator<<(std::ostream& out, Config& config);
73
74
}  // namespace TlsClient
75
76
#endif  // TLS_CLIENT_CONFIG_H_