summaryrefslogtreecommitdiff
path: root/Source/WebCore/PAL
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/PAL')
-rw-r--r--Source/WebCore/PAL/config.h58
-rw-r--r--Source/WebCore/PAL/pal/CMakeLists.txt17
-rw-r--r--Source/WebCore/PAL/pal/PlatformGTK.cmake3
-rw-r--r--Source/WebCore/PAL/pal/crypto/CryptoDigest.h57
-rw-r--r--Source/WebCore/PAL/pal/crypto/commoncrypto/CryptoDigestCommonCrypto.cpp179
-rw-r--r--Source/WebCore/PAL/pal/crypto/gcrypt/CryptoDigestGCrypt.cpp97
-rw-r--r--Source/WebCore/PAL/pal/crypto/gnutls/CryptoDigestGnuTLS.cpp102
7 files changed, 513 insertions, 0 deletions
diff --git a/Source/WebCore/PAL/config.h b/Source/WebCore/PAL/config.h
new file mode 100644
index 000000000..5488c80ad
--- /dev/null
+++ b/Source/WebCore/PAL/config.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2004, 2005, 2006, 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H && defined(BUILDING_WITH_CMAKE)
+#include "cmakeconfig.h"
+#endif
+
+#include <wtf/Platform.h>
+
+#include <wtf/ExportMacros.h>
+
+#ifdef __APPLE__
+#define HAVE_FUNC_USLEEP 1
+#endif /* __APPLE__ */
+
+#if OS(WINDOWS)
+
+#ifndef _WIN32_WINNT
+#define _WIN32_WINNT 0x601
+#endif
+
+#ifndef WINVER
+#define WINVER 0x0601
+#endif
+
+#endif /* OS(WINDOWS) */
+
+#ifdef __cplusplus
+
+// These undefs match up with defines in WebCorePrefix.h for Mac OS X.
+// Helps us catch if anyone uses new or delete by accident in code and doesn't include "config.h".
+#undef new
+#undef delete
+#include <wtf/FastMalloc.h>
+
+#include <ciso646>
+
+#endif
+
+#include <wtf/DisallowCType.h>
diff --git a/Source/WebCore/PAL/pal/CMakeLists.txt b/Source/WebCore/PAL/pal/CMakeLists.txt
new file mode 100644
index 000000000..3b5f1ea51
--- /dev/null
+++ b/Source/WebCore/PAL/pal/CMakeLists.txt
@@ -0,0 +1,17 @@
+set(PAL_SOURCES
+)
+
+set(PAL_INCLUDE_DIRECTORIES
+ "${PAL_DIR}"
+ "${PAL_DIR}/pal"
+ "${PAL_DIR}/pal/crypto"
+)
+
+set(PAL_LIBRARIES
+ WTF
+)
+
+WEBKIT_INCLUDE_CONFIG_FILES_IF_EXISTS()
+
+WEBKIT_WRAP_SOURCELIST(${PAL_SOURCES})
+WEBKIT_FRAMEWORK(PAL)
diff --git a/Source/WebCore/PAL/pal/PlatformGTK.cmake b/Source/WebCore/PAL/pal/PlatformGTK.cmake
new file mode 100644
index 000000000..775c18984
--- /dev/null
+++ b/Source/WebCore/PAL/pal/PlatformGTK.cmake
@@ -0,0 +1,3 @@
+list(APPEND PAL_SOURCES
+ crypto/gcrypt/CryptoDigestGCrypt.cpp
+)
diff --git a/Source/WebCore/PAL/pal/crypto/CryptoDigest.h b/Source/WebCore/PAL/pal/crypto/CryptoDigest.h
new file mode 100644
index 000000000..588e1277c
--- /dev/null
+++ b/Source/WebCore/PAL/pal/crypto/CryptoDigest.h
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2013, 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <wtf/Noncopyable.h>
+#include <wtf/Vector.h>
+
+namespace PAL {
+
+struct CryptoDigestContext;
+
+class CryptoDigest {
+ WTF_MAKE_NONCOPYABLE(CryptoDigest);
+public:
+ enum class Algorithm {
+ SHA_1,
+ SHA_224,
+ SHA_256,
+ SHA_384,
+ SHA_512,
+ };
+ static std::unique_ptr<CryptoDigest> create(Algorithm);
+ ~CryptoDigest();
+
+ void addBytes(const void* input, size_t length);
+ Vector<uint8_t> computeHash();
+
+private:
+ CryptoDigest();
+
+ std::unique_ptr<CryptoDigestContext> m_context;
+};
+
+} // namespace PAL
diff --git a/Source/WebCore/PAL/pal/crypto/commoncrypto/CryptoDigestCommonCrypto.cpp b/Source/WebCore/PAL/pal/crypto/commoncrypto/CryptoDigestCommonCrypto.cpp
new file mode 100644
index 000000000..86a241a4e
--- /dev/null
+++ b/Source/WebCore/PAL/pal/crypto/commoncrypto/CryptoDigestCommonCrypto.cpp
@@ -0,0 +1,179 @@
+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "CryptoDigest.h"
+
+#include <CommonCrypto/CommonCrypto.h>
+
+namespace PAL {
+
+struct CryptoDigestContext {
+ CryptoDigest::Algorithm algorithm;
+ void* ccContext;
+};
+
+inline CC_SHA1_CTX* toSHA1Context(CryptoDigestContext* context)
+{
+ ASSERT(context->algorithm == CryptoDigest::Algorithm::SHA_1);
+ return static_cast<CC_SHA1_CTX*>(context->ccContext);
+}
+inline CC_SHA256_CTX* toSHA224Context(CryptoDigestContext* context)
+{
+ ASSERT(context->algorithm == CryptoDigest::Algorithm::SHA_224);
+ return static_cast<CC_SHA256_CTX*>(context->ccContext);
+}
+inline CC_SHA256_CTX* toSHA256Context(CryptoDigestContext* context)
+{
+ ASSERT(context->algorithm == CryptoDigest::Algorithm::SHA_256);
+ return static_cast<CC_SHA256_CTX*>(context->ccContext);
+}
+inline CC_SHA512_CTX* toSHA384Context(CryptoDigestContext* context)
+{
+ ASSERT(context->algorithm == CryptoDigest::Algorithm::SHA_384);
+ return static_cast<CC_SHA512_CTX*>(context->ccContext);
+}
+inline CC_SHA512_CTX* toSHA512Context(CryptoDigestContext* context)
+{
+ ASSERT(context->algorithm == CryptoDigest::Algorithm::SHA_512);
+ return static_cast<CC_SHA512_CTX*>(context->ccContext);
+}
+
+CryptoDigest::CryptoDigest()
+ : m_context(new CryptoDigestContext)
+{
+}
+
+CryptoDigest::~CryptoDigest()
+{
+ switch (m_context->algorithm) {
+ case CryptoDigest::Algorithm::SHA_1:
+ delete toSHA1Context(m_context.get());
+ return;
+ case CryptoDigest::Algorithm::SHA_224:
+ delete toSHA224Context(m_context.get());
+ return;
+ case CryptoDigest::Algorithm::SHA_256:
+ delete toSHA256Context(m_context.get());
+ return;
+ case CryptoDigest::Algorithm::SHA_384:
+ delete toSHA384Context(m_context.get());
+ return;
+ case CryptoDigest::Algorithm::SHA_512:
+ delete toSHA512Context(m_context.get());
+ return;
+ }
+}
+
+
+std::unique_ptr<CryptoDigest> CryptoDigest::create(CryptoDigest::Algorithm algorithm)
+{
+ std::unique_ptr<CryptoDigest> digest(new CryptoDigest);
+ digest->m_context->algorithm = algorithm;
+
+ switch (algorithm) {
+ case CryptoDigest::Algorithm::SHA_1: {
+ CC_SHA1_CTX* context = new CC_SHA1_CTX;
+ digest->m_context->ccContext = context;
+ CC_SHA1_Init(context);
+ return digest;
+ }
+ case CryptoDigest::Algorithm::SHA_224: {
+ CC_SHA256_CTX* context = new CC_SHA256_CTX;
+ digest->m_context->ccContext = context;
+ CC_SHA224_Init(context);
+ return digest;
+ }
+ case CryptoDigest::Algorithm::SHA_256: {
+ CC_SHA256_CTX* context = new CC_SHA256_CTX;
+ digest->m_context->ccContext = context;
+ CC_SHA256_Init(context);
+ return digest;
+ }
+ case CryptoDigest::Algorithm::SHA_384: {
+ CC_SHA512_CTX* context = new CC_SHA512_CTX;
+ digest->m_context->ccContext = context;
+ CC_SHA384_Init(context);
+ return digest;
+ }
+ case CryptoDigest::Algorithm::SHA_512: {
+ CC_SHA512_CTX* context = new CC_SHA512_CTX;
+ digest->m_context->ccContext = context;
+ CC_SHA512_Init(context);
+ return digest;
+ }
+ }
+}
+
+void CryptoDigest::addBytes(const void* input, size_t length)
+{
+ switch (m_context->algorithm) {
+ case CryptoDigest::Algorithm::SHA_1:
+ CC_SHA1_Update(toSHA1Context(m_context.get()), input, length);
+ return;
+ case CryptoDigest::Algorithm::SHA_224:
+ CC_SHA224_Update(toSHA224Context(m_context.get()), input, length);
+ return;
+ case CryptoDigest::Algorithm::SHA_256:
+ CC_SHA256_Update(toSHA256Context(m_context.get()), input, length);
+ return;
+ case CryptoDigest::Algorithm::SHA_384:
+ CC_SHA384_Update(toSHA384Context(m_context.get()), input, length);
+ return;
+ case CryptoDigest::Algorithm::SHA_512:
+ CC_SHA512_Update(toSHA512Context(m_context.get()), input, length);
+ return;
+ }
+}
+
+Vector<uint8_t> CryptoDigest::computeHash()
+{
+ Vector<uint8_t> result;
+ switch (m_context->algorithm) {
+ case CryptoDigest::Algorithm::SHA_1:
+ result.resize(CC_SHA1_DIGEST_LENGTH);
+ CC_SHA1_Final(result.data(), toSHA1Context(m_context.get()));
+ break;
+ case CryptoDigest::Algorithm::SHA_224:
+ result.resize(CC_SHA224_DIGEST_LENGTH);
+ CC_SHA224_Final(result.data(), toSHA224Context(m_context.get()));
+ break;
+ case CryptoDigest::Algorithm::SHA_256:
+ result.resize(CC_SHA256_DIGEST_LENGTH);
+ CC_SHA256_Final(result.data(), toSHA256Context(m_context.get()));
+ break;
+ case CryptoDigest::Algorithm::SHA_384:
+ result.resize(CC_SHA384_DIGEST_LENGTH);
+ CC_SHA384_Final(result.data(), toSHA384Context(m_context.get()));
+ break;
+ case CryptoDigest::Algorithm::SHA_512:
+ result.resize(CC_SHA512_DIGEST_LENGTH);
+ CC_SHA512_Final(result.data(), toSHA512Context(m_context.get()));
+ break;
+ }
+ return result;
+}
+
+} // namespace PAL
diff --git a/Source/WebCore/PAL/pal/crypto/gcrypt/CryptoDigestGCrypt.cpp b/Source/WebCore/PAL/pal/crypto/gcrypt/CryptoDigestGCrypt.cpp
new file mode 100644
index 000000000..0a78ae0c3
--- /dev/null
+++ b/Source/WebCore/PAL/pal/crypto/gcrypt/CryptoDigestGCrypt.cpp
@@ -0,0 +1,97 @@
+/*
+ * Copyright (C) 2014 Igalia S.L.
+ * Copyright (C) 2016 SoftAtHome
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "CryptoDigest.h"
+
+#include <gcrypt.h>
+
+namespace PAL {
+
+struct CryptoDigestContext {
+ int algorithm;
+ gcry_md_hd_t md;
+};
+
+CryptoDigest::CryptoDigest()
+ : m_context(new CryptoDigestContext)
+{
+}
+
+CryptoDigest::~CryptoDigest()
+{
+}
+
+std::unique_ptr<CryptoDigest> CryptoDigest::create(CryptoDigest::Algorithm algorithm)
+{
+ int gcryptAlgorithm;
+
+ switch (algorithm) {
+ case CryptoDigest::Algorithm::SHA_1:
+ gcryptAlgorithm = GCRY_MD_SHA1;
+ break;
+ case CryptoDigest::Algorithm::SHA_224:
+ gcryptAlgorithm = GCRY_MD_SHA224;
+ break;
+ case CryptoDigest::Algorithm::SHA_256:
+ gcryptAlgorithm = GCRY_MD_SHA256;
+ break;
+ case CryptoDigest::Algorithm::SHA_384:
+ gcryptAlgorithm = GCRY_MD_SHA384;
+ break;
+ case CryptoDigest::Algorithm::SHA_512:
+ gcryptAlgorithm = GCRY_MD_SHA512;
+ break;
+ }
+
+ std::unique_ptr<CryptoDigest> digest(new CryptoDigest);
+ digest->m_context->algorithm = gcryptAlgorithm;
+
+ gcry_md_open(&digest->m_context->md, gcryptAlgorithm, 0);
+ if (!digest->m_context->md)
+ return nullptr;
+
+ return digest;
+}
+
+void CryptoDigest::addBytes(const void* input, size_t length)
+{
+ gcry_md_write(m_context->md, input, length);
+}
+
+Vector<uint8_t> CryptoDigest::computeHash()
+{
+ int digestLen = gcry_md_get_algo_dlen(m_context->algorithm);
+ Vector<uint8_t> result(digestLen);
+
+ gcry_md_final(m_context->md);
+ memcpy(result.data(), gcry_md_read(m_context->md, 0), digestLen);
+ gcry_md_close(m_context->md);
+
+ return result;
+}
+
+} // namespace PAL
diff --git a/Source/WebCore/PAL/pal/crypto/gnutls/CryptoDigestGnuTLS.cpp b/Source/WebCore/PAL/pal/crypto/gnutls/CryptoDigestGnuTLS.cpp
new file mode 100644
index 000000000..556b8fbbd
--- /dev/null
+++ b/Source/WebCore/PAL/pal/crypto/gnutls/CryptoDigestGnuTLS.cpp
@@ -0,0 +1,102 @@
+/*
+ * Copyright (C) 2014 Igalia S.L. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "CryptoDigest.h"
+
+#include <gnutls/gnutls.h>
+#include <gnutls/crypto.h>
+
+namespace PAL {
+
+struct CryptoDigestContext {
+ gnutls_digest_algorithm_t algorithm;
+ gnutls_hash_hd_t hash;
+};
+
+CryptoDigest::CryptoDigest()
+ : m_context(new CryptoDigestContext)
+{
+}
+
+CryptoDigest::~CryptoDigest()
+{
+ gnutls_hash_deinit(m_context->hash, 0);
+}
+
+std::unique_ptr<CryptoDigest> CryptoDigest::create(CryptoDigest::Algorithm algorithm)
+{
+ gnutls_digest_algorithm_t gnutlsAlgorithm;
+
+ switch (algorithm) {
+ case CryptoDigest::Algorithm::SHA_1: {
+ gnutlsAlgorithm = GNUTLS_DIG_SHA1;
+ break;
+ }
+ case CryptoDigest::Algorithm::SHA_224: {
+ gnutlsAlgorithm = GNUTLS_DIG_SHA224;
+ break;
+ }
+ case CryptoDigest::Algorithm::SHA_256: {
+ gnutlsAlgorithm = GNUTLS_DIG_SHA256;
+ break;
+ }
+ case CryptoDigest::Algorithm::SHA_384: {
+ gnutlsAlgorithm = GNUTLS_DIG_SHA384;
+ break;
+ }
+ case CryptoDigest::Algorithm::SHA_512: {
+ gnutlsAlgorithm = GNUTLS_DIG_SHA512;
+ break;
+ }
+ }
+
+ std::unique_ptr<CryptoDigest> digest(new CryptoDigest);
+ digest->m_context->algorithm = gnutlsAlgorithm;
+
+ int ret = gnutls_hash_init(&digest->m_context->hash, gnutlsAlgorithm);
+ if (ret != GNUTLS_E_SUCCESS)
+ return nullptr;
+
+ return digest;
+}
+
+void CryptoDigest::addBytes(const void* input, size_t length)
+{
+ gnutls_hash(m_context->hash, input, length);
+}
+
+Vector<uint8_t> CryptoDigest::computeHash()
+{
+ Vector<uint8_t> result;
+ int digestLen = gnutls_hash_get_len(m_context->algorithm);
+ result.resize(digestLen);
+
+ gnutls_hash_output(m_context->hash, result.data());
+
+ return result;
+}
+
+} // namespace PAL