Skip to content
Permalink
Browse files
Move CryptoDigest to WebCore/platform
https://bugs.webkit.org/show_bug.cgi?id=155008
<rdar://problem/24969787>

Reviewed by Brent Fulgham.

CryptoDigest provides a platform-independent interface for interacting with platform-
specific cryptographic hashing services. We currently make use of this code as part
of the implementation of Web Crypto. This code will also be beneficial as part of
implementing support for Content Security Policy inline script and inline stylesheet
hashes. We should move CryptoDigest to WebCore/platform to convey that it a general
purpose platform abstraction.

* CMakeLists.txt: Add include directory WebCore/platform/crypto.
* PlatformEfl.cmake: Add file platform/crypto/gnutls/CryptoDigestGnuTLS.cpp and
remove file crypto/gnutls/CryptoDigestGnuTLS.cpp.
* PlatformGTK.cmake: Ditto.
* PlatformMac.cmake: Add file platform/crypto/mac/CryptoDigestMac.cpp and
remove file crypto/mac/CryptoDigestMac.cpp.
* WebCore.xcodeproj/project.pbxproj:
* crypto/algorithms/CryptoAlgorithmSHA1.cpp:
(WebCore::CryptoAlgorithmSHA1::digest): Substitute "CryptoDigest::Algorithm" for "CryptoAlgorithmIdentifier".
* crypto/algorithms/CryptoAlgorithmSHA224.cpp:
(WebCore::CryptoAlgorithmSHA224::digest): Ditto.
* crypto/algorithms/CryptoAlgorithmSHA256.cpp:
(WebCore::CryptoAlgorithmSHA256::digest): Ditto.
* crypto/algorithms/CryptoAlgorithmSHA384.cpp:
(WebCore::CryptoAlgorithmSHA384::digest): Ditto.
* crypto/algorithms/CryptoAlgorithmSHA512.cpp:
(WebCore::CryptoAlgorithmSHA512::digest): Ditto.
* crypto/mac/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp:
(WebCore::getCryptoDigestAlgorithm): Converts a CryptoAlgorithmIdentifier enumerator to a
CryptoDigest::Algorithm enumerator, if applicable.
(WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformSign): Write in terms of WebCore::getCryptoDigestAlgorithm().
(WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformVerify): Ditto.
* platform/crypto/CryptoDigest.h: Renamed from Source/WebCore/crypto/CryptoDigest.h. Also added enum CryptoDigest::Algorithm
and changed constructor to take this enum.
* platform/crypto/gnutls/CryptoDigestGnuTLS.cpp: Renamed from Source/WebCore/crypto/gnutls/CryptoDigestGnuTLS.cpp.
(WebCore::CryptoDigest::CryptoDigest): Substitute "CryptoDigest::Algorithm" for "CryptoAlgorithmIdentifier".
(WebCore::CryptoDigest::~CryptoDigest): Ditto.
(WebCore::CryptoDigest::create): Ditto.
(WebCore::CryptoDigest::addBytes): Ditto.
(WebCore::CryptoDigest::computeHash): Ditto.
* platform/crypto/mac/CryptoDigestMac.cpp: Renamed from Source/WebCore/crypto/mac/CryptoDigestMac.cpp.
(WebCore::toSHA1Context): Ditto.
(WebCore::toSHA224Context): Ditto.
(WebCore::toSHA256Context): Ditto.
(WebCore::toSHA384Context): Ditto.
(WebCore::toSHA512Context): Ditto.
(WebCore::CryptoDigest::CryptoDigest): Ditto.
(WebCore::CryptoDigest::~CryptoDigest): Ditto.
(WebCore::CryptoDigest::create): Ditto.
(WebCore::CryptoDigest::addBytes): Ditto.
(WebCore::CryptoDigest::computeHash): Ditto.

Canonical link: https://commits.webkit.org/173110@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@197575 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
dydz committed Mar 4, 2016
1 parent e821d8e commit 3437d0815f0aec848796b19382db61360ac0e9c0
@@ -69,6 +69,7 @@ set(WebCore_INCLUDE_DIRECTORIES
"${WEBCORE_DIR}/platform"
"${WEBCORE_DIR}/platform/animation"
"${WEBCORE_DIR}/platform/audio"
"${WEBCORE_DIR}/platform/crypto"
"${WEBCORE_DIR}/platform/graphics"
"${WEBCORE_DIR}/platform/graphics/cpu/arm"
"${WEBCORE_DIR}/platform/graphics/cpu/arm/filters"
@@ -1,3 +1,60 @@
2016-03-04 Daniel Bates <dabates@apple.com>

Move CryptoDigest to WebCore/platform
https://bugs.webkit.org/show_bug.cgi?id=155008
<rdar://problem/24969787>

Reviewed by Brent Fulgham.

CryptoDigest provides a platform-independent interface for interacting with platform-
specific cryptographic hashing services. We currently make use of this code as part
of the implementation of Web Crypto. This code will also be beneficial as part of
implementing support for Content Security Policy inline script and inline stylesheet
hashes. We should move CryptoDigest to WebCore/platform to convey that it a general
purpose platform abstraction.

* CMakeLists.txt: Add include directory WebCore/platform/crypto.
* PlatformEfl.cmake: Add file platform/crypto/gnutls/CryptoDigestGnuTLS.cpp and
remove file crypto/gnutls/CryptoDigestGnuTLS.cpp.
* PlatformGTK.cmake: Ditto.
* PlatformMac.cmake: Add file platform/crypto/mac/CryptoDigestMac.cpp and
remove file crypto/mac/CryptoDigestMac.cpp.
* WebCore.xcodeproj/project.pbxproj:
* crypto/algorithms/CryptoAlgorithmSHA1.cpp:
(WebCore::CryptoAlgorithmSHA1::digest): Substitute "CryptoDigest::Algorithm" for "CryptoAlgorithmIdentifier".
* crypto/algorithms/CryptoAlgorithmSHA224.cpp:
(WebCore::CryptoAlgorithmSHA224::digest): Ditto.
* crypto/algorithms/CryptoAlgorithmSHA256.cpp:
(WebCore::CryptoAlgorithmSHA256::digest): Ditto.
* crypto/algorithms/CryptoAlgorithmSHA384.cpp:
(WebCore::CryptoAlgorithmSHA384::digest): Ditto.
* crypto/algorithms/CryptoAlgorithmSHA512.cpp:
(WebCore::CryptoAlgorithmSHA512::digest): Ditto.
* crypto/mac/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp:
(WebCore::getCryptoDigestAlgorithm): Converts a CryptoAlgorithmIdentifier enumerator to a
CryptoDigest::Algorithm enumerator, if applicable.
(WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformSign): Write in terms of WebCore::getCryptoDigestAlgorithm().
(WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformVerify): Ditto.
* platform/crypto/CryptoDigest.h: Renamed from Source/WebCore/crypto/CryptoDigest.h. Also added enum CryptoDigest::Algorithm
and changed constructor to take this enum.
* platform/crypto/gnutls/CryptoDigestGnuTLS.cpp: Renamed from Source/WebCore/crypto/gnutls/CryptoDigestGnuTLS.cpp.
(WebCore::CryptoDigest::CryptoDigest): Substitute "CryptoDigest::Algorithm" for "CryptoAlgorithmIdentifier".
(WebCore::CryptoDigest::~CryptoDigest): Ditto.
(WebCore::CryptoDigest::create): Ditto.
(WebCore::CryptoDigest::addBytes): Ditto.
(WebCore::CryptoDigest::computeHash): Ditto.
* platform/crypto/mac/CryptoDigestMac.cpp: Renamed from Source/WebCore/crypto/mac/CryptoDigestMac.cpp.
(WebCore::toSHA1Context): Ditto.
(WebCore::toSHA224Context): Ditto.
(WebCore::toSHA256Context): Ditto.
(WebCore::toSHA384Context): Ditto.
(WebCore::toSHA512Context): Ditto.
(WebCore::CryptoDigest::CryptoDigest): Ditto.
(WebCore::CryptoDigest::~CryptoDigest): Ditto.
(WebCore::CryptoDigest::create): Ditto.
(WebCore::CryptoDigest::addBytes): Ditto.
(WebCore::CryptoDigest::computeHash): Ditto.

2016-03-04 Myles C. Maxfield <mmaxfield@apple.com>

Whitespace causes font-variant: all-small-caps to synthesize
@@ -88,6 +88,8 @@ list(APPEND WebCore_SOURCES

platform/audio/efl/AudioBusEfl.cpp

platform/crypto/gnutls/CryptoDigestGnuTLS.cpp

platform/efl/BatteryProviderEfl.cpp
platform/efl/CursorEfl.cpp
platform/efl/DragDataEfl.cpp
@@ -432,7 +434,6 @@ if (ENABLE_SUBTLE_CRYPTO)
crypto/gnutls/CryptoAlgorithmRSASSA_PKCS1_v1_5GnuTLS.cpp
crypto/gnutls/CryptoAlgorithmRSA_OAEPGnuTLS.cpp
crypto/gnutls/CryptoAlgorithmRegistryGnuTLS.cpp
crypto/gnutls/CryptoDigestGnuTLS.cpp
crypto/gnutls/CryptoKeyRSAGnuTLS.cpp
crypto/gnutls/SerializedCryptoKeyWrapGnuTLS.cpp

@@ -82,6 +82,8 @@ list(APPEND WebCore_SOURCES

platform/audio/glib/AudioBusGLib.cpp

platform/crypto/gnutls/CryptoDigestGnuTLS.cpp

platform/geoclue/GeolocationProviderGeoclue1.cpp
platform/geoclue/GeolocationProviderGeoclue2.cpp

@@ -807,7 +809,6 @@ if (ENABLE_SUBTLE_CRYPTO)
crypto/gnutls/CryptoAlgorithmRSASSA_PKCS1_v1_5GnuTLS.cpp
crypto/gnutls/CryptoAlgorithmRSA_OAEPGnuTLS.cpp
crypto/gnutls/CryptoAlgorithmRegistryGnuTLS.cpp
crypto/gnutls/CryptoDigestGnuTLS.cpp
crypto/gnutls/CryptoKeyRSAGnuTLS.cpp
crypto/gnutls/SerializedCryptoKeyWrapGnuTLS.cpp

@@ -218,7 +218,6 @@ list(APPEND WebCore_SOURCES
crypto/mac/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp
crypto/mac/CryptoAlgorithmRSA_OAEPMac.cpp
crypto/mac/CryptoAlgorithmRegistryMac.cpp
crypto/mac/CryptoDigestMac.cpp
crypto/mac/CryptoKeyMac.cpp
crypto/mac/CryptoKeyRSAMac.cpp
crypto/mac/SerializedCryptoKeyWrapMac.mm
@@ -340,6 +339,8 @@ list(APPEND WebCore_SOURCES
platform/cocoa/VNodeTrackerCocoa.cpp
platform/cocoa/WebCoreNSErrorExtras.mm

platform/crypto/mac/CryptoDigestMac.cpp

platform/graphics/DisplayRefreshMonitor.cpp
platform/graphics/DisplayRefreshMonitorManager.cpp
platform/graphics/FontPlatformData.cpp
@@ -14550,8 +14550,8 @@
E1F80B89183172A2007885C3 /* JSCryptoKeyPairCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCryptoKeyPairCustom.cpp; sourceTree = "<group>"; };
E1F80B8B183172B5007885C3 /* JSCryptoKeyPair.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCryptoKeyPair.cpp; sourceTree = "<group>"; };
E1F80B8C183172B5007885C3 /* JSCryptoKeyPair.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCryptoKeyPair.h; sourceTree = "<group>"; };
E1FE13621834351100892F13 /* CryptoDigestMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CryptoDigestMac.cpp; sourceTree = "<group>"; };
E1FE136618343A1000892F13 /* CryptoDigest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CryptoDigest.h; sourceTree = "<group>"; };
E1FE13621834351100892F13 /* CryptoDigestMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CryptoDigestMac.cpp; path = crypto/mac/CryptoDigestMac.cpp; sourceTree = "<group>"; };
E1FE136618343A1000892F13 /* CryptoDigest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CryptoDigest.h; path = crypto/CryptoDigest.h; sourceTree = "<group>"; };
E1FE1368183FE1AB00892F13 /* CryptoAlgorithmRSA_OAEP.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CryptoAlgorithmRSA_OAEP.cpp; sourceTree = "<group>"; };
E1FE1369183FE1AB00892F13 /* CryptoAlgorithmRSA_OAEP.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CryptoAlgorithmRSA_OAEP.h; sourceTree = "<group>"; };
E1FE136E183FECF000892F13 /* CryptoAlgorithmRSA_OAEPMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CryptoAlgorithmRSA_OAEPMac.cpp; sourceTree = "<group>"; };
@@ -22791,6 +22791,7 @@
FD31604012B026A300C1A359 /* audio */,
1AE42F670AA4B8CB00C8612D /* cf */,
A5C974CE11485FDA0066F2AB /* cocoa */,
CE50D8CE1C8932ED0072EA5A /* crypto */,
B2A015910AF6CD53006BCE0E /* graphics */,
A59E3C1B11580F340072928E /* ios */,
6582A14809999D6C00BEEB6D /* mac */,
@@ -23176,6 +23177,23 @@
path = ios;
sourceTree = "<group>";
};
CE50D8CE1C8932ED0072EA5A /* crypto */ = {
isa = PBXGroup;
children = (
CE50D8CF1C8932FB0072EA5A /* mac */,
E1FE136618343A1000892F13 /* CryptoDigest.h */,
);
name = crypto;
sourceTree = "<group>";
};
CE50D8CF1C8932FB0072EA5A /* mac */ = {
isa = PBXGroup;
children = (
E1FE13621834351100892F13 /* CryptoDigestMac.cpp */,
);
name = mac;
sourceTree = "<group>";
};
DF9AFD6F13FC31B00015FEB7 /* objc */ = {
isa = PBXGroup;
children = (
@@ -23230,7 +23248,6 @@
E1FE136E183FECF000892F13 /* CryptoAlgorithmRSA_OAEPMac.cpp */,
E1233F0E185A4130008DFAF5 /* CryptoAlgorithmRSAES_PKCS1_v1_5Mac.cpp */,
E1C266D618317AB4003F8B33 /* CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp */,
E1FE13621834351100892F13 /* CryptoDigestMac.cpp */,
E19AC3F8182566F700349426 /* CryptoKeyMac.cpp */,
E164FAA418315E1A00DB4E61 /* CryptoKeyRSAMac.cpp */,
E18DF33618AAF14D00773E59 /* SerializedCryptoKeyWrapMac.mm */,
@@ -23421,7 +23438,6 @@
E1C657261816F9FE00256CDD /* CryptoAlgorithmParameters.h */,
E1FF8F6A180DB5BE00132674 /* CryptoAlgorithmRegistry.cpp */,
E1FF8F6B180DB5BE00132674 /* CryptoAlgorithmRegistry.h */,
E1FE136618343A1000892F13 /* CryptoDigest.h */,
E157A8E218173A3A009F821D /* CryptoKey.cpp */,
E157A8E318173A3A009F821D /* CryptoKey.h */,
E157A8DC18172C2C009F821D /* CryptoKey.idl */,
@@ -54,7 +54,7 @@ CryptoAlgorithmIdentifier CryptoAlgorithmSHA1::identifier() const

void CryptoAlgorithmSHA1::digest(const CryptoAlgorithmParameters&, const CryptoOperationData& data, VectorCallback&& callback, VoidCallback&& failureCallback, ExceptionCode&)
{
std::unique_ptr<CryptoDigest> digest = CryptoDigest::create(CryptoAlgorithmIdentifier::SHA_1);
std::unique_ptr<CryptoDigest> digest = CryptoDigest::create(CryptoDigest::Algorithm::SHA_1);
if (!digest) {
failureCallback();
return;
@@ -54,7 +54,7 @@ CryptoAlgorithmIdentifier CryptoAlgorithmSHA224::identifier() const

void CryptoAlgorithmSHA224::digest(const CryptoAlgorithmParameters&, const CryptoOperationData& data, VectorCallback&& callback, VoidCallback&& failureCallback, ExceptionCode&)
{
std::unique_ptr<CryptoDigest> digest = CryptoDigest::create(CryptoAlgorithmIdentifier::SHA_224);
std::unique_ptr<CryptoDigest> digest = CryptoDigest::create(CryptoDigest::Algorithm::SHA_224);
if (!digest) {
failureCallback();
return;
@@ -54,7 +54,7 @@ CryptoAlgorithmIdentifier CryptoAlgorithmSHA256::identifier() const

void CryptoAlgorithmSHA256::digest(const CryptoAlgorithmParameters&, const CryptoOperationData& data, VectorCallback&& callback, VoidCallback&& failureCallback, ExceptionCode&)
{
std::unique_ptr<CryptoDigest> digest = CryptoDigest::create(CryptoAlgorithmIdentifier::SHA_256);
std::unique_ptr<CryptoDigest> digest = CryptoDigest::create(CryptoDigest::Algorithm::SHA_256);
if (!digest) {
failureCallback();
return;
@@ -54,7 +54,7 @@ CryptoAlgorithmIdentifier CryptoAlgorithmSHA384::identifier() const

void CryptoAlgorithmSHA384::digest(const CryptoAlgorithmParameters&, const CryptoOperationData& data, VectorCallback&& callback, VoidCallback&& failureCallback, ExceptionCode&)
{
std::unique_ptr<CryptoDigest> digest = CryptoDigest::create(CryptoAlgorithmIdentifier::SHA_384);
std::unique_ptr<CryptoDigest> digest = CryptoDigest::create(CryptoDigest::Algorithm::SHA_384);
if (!digest) {
failureCallback();
return;
@@ -54,7 +54,7 @@ CryptoAlgorithmIdentifier CryptoAlgorithmSHA512::identifier() const

void CryptoAlgorithmSHA512::digest(const CryptoAlgorithmParameters&, const CryptoOperationData& data, VectorCallback&& callback, VoidCallback&& failureCallback, ExceptionCode&)
{
std::unique_ptr<CryptoDigest> digest = CryptoDigest::create(CryptoAlgorithmIdentifier::SHA_512);
std::unique_ptr<CryptoDigest> digest = CryptoDigest::create(CryptoDigest::Algorithm::SHA_512);
if (!digest) {
failureCallback();
return;
@@ -36,6 +36,29 @@

namespace WebCore {

inline bool getCryptoDigestAlgorithm(CryptoAlgorithmIdentifier hashFunction, CryptoDigest::Algorithm& algorithm)
{
switch (hashFunction) {
case CryptoAlgorithmIdentifier::SHA_1:
algorithm = CryptoDigest::Algorithm::SHA_1;
return true;
case CryptoAlgorithmIdentifier::SHA_224:
algorithm = CryptoDigest::Algorithm::SHA_224;
return true;
case CryptoAlgorithmIdentifier::SHA_256:
algorithm = CryptoDigest::Algorithm::SHA_256;
return true;
case CryptoAlgorithmIdentifier::SHA_384:
algorithm = CryptoDigest::Algorithm::SHA_384;
return true;
case CryptoAlgorithmIdentifier::SHA_512:
algorithm = CryptoDigest::Algorithm::SHA_512;
return true;
default:
return false;
}
}

void CryptoAlgorithmRSASSA_PKCS1_v1_5::platformSign(const CryptoAlgorithmRsaSsaParams& parameters, const CryptoKeyRSA& key, const CryptoOperationData& data, VectorCallback&& callback, VoidCallback&& failureCallback, ExceptionCode& ec)
{
CCDigestAlgorithm digestAlgorithm;
@@ -44,7 +67,13 @@ void CryptoAlgorithmRSASSA_PKCS1_v1_5::platformSign(const CryptoAlgorithmRsaSsaP
return;
}

std::unique_ptr<CryptoDigest> digest = CryptoDigest::create(parameters.hash);
CryptoDigest::Algorithm cryptoDigestAlgorithm;
if (!getCryptoDigestAlgorithm(parameters.hash, cryptoDigestAlgorithm)) {
ec = NOT_SUPPORTED_ERR;
return;
}

std::unique_ptr<CryptoDigest> digest = CryptoDigest::create(cryptoDigestAlgorithm);
if (!digest) {
ec = NOT_SUPPORTED_ERR;
return;
@@ -75,7 +104,13 @@ void CryptoAlgorithmRSASSA_PKCS1_v1_5::platformVerify(const CryptoAlgorithmRsaSs
return;
}

std::unique_ptr<CryptoDigest> digest = CryptoDigest::create(parameters.hash);
CryptoDigest::Algorithm cryptoDigestAlgorithm;
if (!getCryptoDigestAlgorithm(parameters.hash, cryptoDigestAlgorithm)) {
ec = NOT_SUPPORTED_ERR;
return;
}

std::unique_ptr<CryptoDigest> digest = CryptoDigest::create(cryptoDigestAlgorithm);
if (!digest) {
ec = NOT_SUPPORTED_ERR;
return;
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2013 Apple Inc. All rights reserved.
* 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
@@ -26,20 +26,24 @@
#ifndef CryptoDigest_h
#define CryptoDigest_h

#include "CryptoAlgorithmIdentifier.h"
#include <wtf/Noncopyable.h>
#include <wtf/Vector.h>

#if ENABLE(SUBTLE_CRYPTO)

namespace WebCore {

struct CryptoDigestContext;

class CryptoDigest {
WTF_MAKE_NONCOPYABLE(CryptoDigest);
public:
static std::unique_ptr<CryptoDigest> create(CryptoAlgorithmIdentifier);
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);
@@ -53,5 +57,4 @@ class CryptoDigest {

} // namespace WebCore

#endif // ENABLE(SUBTLE_CRYPTO)
#endif // CryptoDigest_h
@@ -26,8 +26,6 @@
#include "config.h"
#include "CryptoDigest.h"

#if ENABLE(SUBTLE_CRYPTO)

#include <gnutls/gnutls.h>
#include <gnutls/crypto.h>

@@ -48,33 +46,31 @@ CryptoDigest::~CryptoDigest()
gnutls_hash_deinit(m_context->hash, 0);
}

std::unique_ptr<CryptoDigest> CryptoDigest::create(CryptoAlgorithmIdentifier algorithm)
std::unique_ptr<CryptoDigest> CryptoDigest::create(CryptoDigest::Algorithm algorithm)
{
gnutls_digest_algorithm_t gnutlsAlgorithm;

switch (algorithm) {
case CryptoAlgorithmIdentifier::SHA_1: {
case CryptoDigest::Algorithm::SHA_1: {
gnutlsAlgorithm = GNUTLS_DIG_SHA1;
break;
}
case CryptoAlgorithmIdentifier::SHA_224: {
case CryptoDigest::Algorithm::SHA_224: {
gnutlsAlgorithm = GNUTLS_DIG_SHA224;
break;
}
case CryptoAlgorithmIdentifier::SHA_256: {
case CryptoDigest::Algorithm::SHA_256: {
gnutlsAlgorithm = GNUTLS_DIG_SHA256;
break;
}
case CryptoAlgorithmIdentifier::SHA_384: {
case CryptoDigest::Algorithm::SHA_384: {
gnutlsAlgorithm = GNUTLS_DIG_SHA384;
break;
}
case CryptoAlgorithmIdentifier::SHA_512: {
case CryptoDigest::Algorithm::SHA_512: {
gnutlsAlgorithm = GNUTLS_DIG_SHA512;
break;
}
default:
return nullptr;
}

std::unique_ptr<CryptoDigest> digest(new CryptoDigest);
@@ -104,5 +100,3 @@ Vector<uint8_t> CryptoDigest::computeHash()
}

} // namespace WebCore

#endif // ENABLE(SUBTLE_CRYPTO)

0 comments on commit 3437d08

Please sign in to comment.