[GCrypt] ECDSA signing and verification support
authorzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 2 May 2017 06:49:06 +0000 (06:49 +0000)
committerzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 2 May 2017 06:49:06 +0000 (06:49 +0000)
commitbcb3486eae508a090815eb366ca66b829976f4a7
tree6a01735b9141cd7496479a5c9e573baaab10f6e0
parent30fff31a9218ef6a414db60ee427b326e8c977c6
[GCrypt] ECDSA signing and verification support
https://bugs.webkit.org/show_bug.cgi?id=171103

Reviewed by Carlos Garcia Campos.

Source/WebCore:

Implement WebCrypto ECDSA support for configurations that
are using libgcrypt.

For signing, the provided data is first hashed with the specified
digest algorithm and embedded into a data s-expression. It's then
passed to gcry_pk_sign() along with the private key, returning a
sig-val s-expression. The r and s parameters are then retrieved from
that sig-val and their data extracted and concatenated in the output
Vector<>.

For verification, the data is again hashed and embedded into a data
s-expression. The r and s parameters are extracted from the passed-in
signature Vector<> and embedded into a sig-val s-expression. The data
and sig-val s-expressions are then passed to gcry_pk_verify() along
with the public key. The verification succeeds if no error is returned
and fails if the returned error code is GPG_ERR_BAD_SIGNATURE.

* crypto/gcrypt/CryptoAlgorithmECDSAGCrypt.cpp:
(WebCore::hashCryptoDigestAlgorithm):
(WebCore::hashAlgorithmName):
(WebCore::mpiData):
(WebCore::gcryptSign):
(WebCore::gcryptVerify):
(WebCore::CryptoAlgorithmECDSA::platformSign):
(WebCore::CryptoAlgorithmECDSA::platformVerify):

LayoutTests:

* platform/gtk/TestExpectations: Enable the passing ECDSA tests under
crypto/subtle/. The ECDSA tests that utilize PKCS #8 and SPKI remain
skipped since support for that hasn't landed yet.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216062 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/platform/gtk/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/crypto/gcrypt/CryptoAlgorithmECDSAGCrypt.cpp