summaryrefslogtreecommitdiff
path: root/security/certverifier/SignedCertificateTimestamp.cpp
blob: c556ee3e904bc7c664d2346606deaeb1f0d89ac0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "SignedCertificateTimestamp.h"

namespace mozilla { namespace ct {

void
LogEntry::Reset()
{
  type = LogEntry::Type::X509;
  leafCertificate.clear();
  issuerKeyHash.clear();
  tbsCertificate.clear();
}

bool
DigitallySigned::SignatureParametersMatch(HashAlgorithm aHashAlgorithm,
  SignatureAlgorithm aSignatureAlgorithm) const
{
  return (hashAlgorithm == aHashAlgorithm) &&
         (signatureAlgorithm == aSignatureAlgorithm);
}

} } // namespace mozilla::ct


namespace mozilla {

bool
operator==(const ct::Buffer& a, const ct::Buffer& b)
{
  return (a.empty() && b.empty()) ||
    (a.length() == b.length() && memcmp(a.begin(), b.begin(), a.length()) == 0);
}

bool
operator!=(const ct::Buffer& a, const ct::Buffer& b) {
  return !(a == b);
}

} // namespace mozilla