SignedCertificateTimestamp.cpp 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. #include "SignedCertificateTimestamp.h"
  6. namespace mozilla { namespace ct {
  7. void
  8. LogEntry::Reset()
  9. {
  10. type = LogEntry::Type::X509;
  11. leafCertificate.clear();
  12. issuerKeyHash.clear();
  13. tbsCertificate.clear();
  14. }
  15. bool
  16. DigitallySigned::SignatureParametersMatch(HashAlgorithm aHashAlgorithm,
  17. SignatureAlgorithm aSignatureAlgorithm) const
  18. {
  19. return (hashAlgorithm == aHashAlgorithm) &&
  20. (signatureAlgorithm == aSignatureAlgorithm);
  21. }
  22. } } // namespace mozilla::ct
  23. namespace mozilla {
  24. bool
  25. operator==(const ct::Buffer& a, const ct::Buffer& b)
  26. {
  27. return (a.empty() && b.empty()) ||
  28. (a.length() == b.length() && memcmp(a.begin(), b.begin(), a.length()) == 0);
  29. }
  30. bool
  31. operator!=(const ct::Buffer& a, const ct::Buffer& b) {
  32. return !(a == b);
  33. }
  34. } // namespace mozilla