xref: /aosp_15_r20/external/cronet/net/cert/sct_status_flags.h (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2013 The Chromium Authors
2 // 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_CERT_SCT_STATUS_FLAGS_H_
6 #define NET_CERT_SCT_STATUS_FLAGS_H_
7 
8 #include <stdint.h>
9 
10 #include "net/base/net_export.h"
11 
12 namespace net::ct {
13 
14 // The possible verification statuses for a SignedCertificateTimestamp.
15 // Note: The numeric values are used within histograms and should not change
16 // or be re-assigned.
17 enum SCTVerifyStatus : uint32_t {
18   // Not a real status, this just prevents a default int value from being
19   // mis-interpreseted as a valid status.
20   // Also used to count SCTs that cannot be decoded in the histogram.
21   SCT_STATUS_NONE = 0,
22 
23   // The SCT is from an unknown log, so we cannot verify its signature.
24   SCT_STATUS_LOG_UNKNOWN = 1,
25 
26   // Obsolete. Kept here to avoid reuse.
27   // SCT_STATUS_INVALID = 2,
28 
29   // The SCT is from a known log, and the signature is valid.
30   SCT_STATUS_OK = 3,
31 
32   // The SCT is from a known log, but the signature is invalid.
33   SCT_STATUS_INVALID_SIGNATURE = 4,
34 
35   // The SCT is from a known log, but the timestamp is in the future.
36   SCT_STATUS_INVALID_TIMESTAMP = 5,
37 
38   // Used to bound the enum values. Since this enum is passed over IPC,
39   // the last value must be a valid one (rather than one past a valid one).
40   SCT_STATUS_MAX = SCT_STATUS_INVALID_TIMESTAMP,
41 };
42 
43 // Returns true if |status| denotes a valid value in SCTVerifyStatus, which
44 // is all current values in the enum except SCT_STATUS_NONE.
45 NET_EXPORT bool IsValidSCTStatus(uint32_t status);
46 
47 }  // namespace net::ct
48 
49 #endif  // NET_CERT_SCT_STATUS_FLAGS_H_
50