diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
commit | 2aa4a82499d4becd2284cdb482213d541b8804dd (patch) | |
tree | b80bf8bf13c3766139fbacc530efd0dd9d54394c /third_party/libwebrtc/webrtc/rtc_base/openssldigest.h | |
parent | Initial commit. (diff) | |
download | firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.tar.xz firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.zip |
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/libwebrtc/webrtc/rtc_base/openssldigest.h')
-rw-r--r-- | third_party/libwebrtc/webrtc/rtc_base/openssldigest.h | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/third_party/libwebrtc/webrtc/rtc_base/openssldigest.h b/third_party/libwebrtc/webrtc/rtc_base/openssldigest.h new file mode 100644 index 0000000000..d796665675 --- /dev/null +++ b/third_party/libwebrtc/webrtc/rtc_base/openssldigest.h @@ -0,0 +1,50 @@ +/* + * Copyright 2004 The WebRTC Project Authors. All rights reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#ifndef RTC_BASE_OPENSSLDIGEST_H_ +#define RTC_BASE_OPENSSLDIGEST_H_ + +#include <openssl/evp.h> + +#include "rtc_base/messagedigest.h" + +namespace rtc { + +// An implementation of the digest class that uses OpenSSL. +class OpenSSLDigest : public MessageDigest { + public: + // Creates an OpenSSLDigest with |algorithm| as the hash algorithm. + explicit OpenSSLDigest(const std::string& algorithm); + ~OpenSSLDigest() override; + // Returns the digest output size (e.g. 16 bytes for MD5). + size_t Size() const override; + // Updates the digest with |len| bytes from |buf|. + void Update(const void* buf, size_t len) override; + // Outputs the digest value to |buf| with length |len|. + size_t Finish(void* buf, size_t len) override; + + // Helper function to look up a digest's EVP by name. + static bool GetDigestEVP(const std::string &algorithm, + const EVP_MD** md); + // Helper function to look up a digest's name by EVP. + static bool GetDigestName(const EVP_MD* md, + std::string* algorithm); + // Helper function to get the length of a digest. + static bool GetDigestSize(const std::string &algorithm, + size_t* len); + + private: + EVP_MD_CTX ctx_; + const EVP_MD* md_; +}; + +} // namespace rtc + +#endif // RTC_BASE_OPENSSLDIGEST_H_ |