Title: [217586] trunk/Source/WebCore
Revision
217586
Author
wei...@apple.com
Date
2017-05-30 16:55:51 -0700 (Tue, 30 May 2017)

Log Message

Revert accidentally checked in change.

* crypto/mac/CryptoAlgorithmRSA_PSSMac.cpp:
* crypto/mac/CryptoDigestAlgorithm.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (217585 => 217586)


--- trunk/Source/WebCore/ChangeLog	2017-05-30 23:54:51 UTC (rev 217585)
+++ trunk/Source/WebCore/ChangeLog	2017-05-30 23:55:51 UTC (rev 217586)
@@ -1,5 +1,12 @@
 2017-05-30  Sam Weinig  <s...@webkit.org>
 
+        Revert accidentally checked in change.
+
+        * crypto/mac/CryptoAlgorithmRSA_PSSMac.cpp:
+        * crypto/mac/CryptoDigestAlgorithm.h:
+
+2017-05-30  Sam Weinig  <s...@webkit.org>
+
         [WebIDL] Generate named property deleters
         https://bugs.webkit.org/show_bug.cgi?id=172688
 

Modified: trunk/Source/WebCore/crypto/mac/CryptoAlgorithmRSA_PSSMac.cpp (217585 => 217586)


--- trunk/Source/WebCore/crypto/mac/CryptoAlgorithmRSA_PSSMac.cpp	2017-05-30 23:54:51 UTC (rev 217585)
+++ trunk/Source/WebCore/crypto/mac/CryptoAlgorithmRSA_PSSMac.cpp	2017-05-30 23:55:51 UTC (rev 217586)
@@ -37,49 +37,49 @@
 
 namespace WebCore {
 
-static ExceptionOr<Vector<uint8_t>> signRSA_PSS(CryptoAlgorithmIdentifier, const PlatformRSAKey, size_t, const Vector<uint8_t>&, size_t)
+static ExceptionOr<Vector<uint8_t>> signRSA_PSS(CryptoAlgorithmIdentifier hash, const PlatformRSAKey key, size_t keyLength, const Vector<uint8_t>& data, size_t saltLength)
 {
-    // CCDigestAlgorithm digestAlgorithm;
-    // if (!getCommonCryptoDigestAlgorithm(hash, digestAlgorithm))
-    //     return Exception { OperationError };
-    // 
-    // auto cryptoDigestAlgorithm = WebCore::cryptoDigestAlgorithm(hash);
-    // if (!cryptoDigestAlgorithm)
-    //     return Exception { OperationError };
-    // auto digest = PAL::CryptoDigest::create(*cryptoDigestAlgorithm);
-    // if (!digest)
-    //     return Exception { OperationError };
-    // digest->addBytes(data.data(), data.size());
-    // auto digestData = digest->computeHash();
-    // 
-    // Vector<uint8_t> signature(keyLength / 8); // Per https://tools.ietf.org/html/rfc3447#section-8.1.1
-    // size_t signatureSize = signature.size();
-    // 
-    // CCCryptorStatus status = CCRSACryptorSign(key, ccRSAPSSPadding, digestData.data(), digestData.size(), digestAlgorithm, saltLength, signature.data(), &signatureSize);
-    // if (status)
+    CCDigestAlgorithm digestAlgorithm;
+    if (!getCommonCryptoDigestAlgorithm(hash, digestAlgorithm))
         return Exception { OperationError };
 
-    // return WTFMove(signature);
+    auto cryptoDigestAlgorithm = WebCore::cryptoDigestAlgorithm(hash);
+    if (!cryptoDigestAlgorithm)
+        return Exception { OperationError };
+    auto digest = PAL::CryptoDigest::create(*cryptoDigestAlgorithm);
+    if (!digest)
+        return Exception { OperationError };
+    digest->addBytes(data.data(), data.size());
+    auto digestData = digest->computeHash();
+
+    Vector<uint8_t> signature(keyLength / 8); // Per https://tools.ietf.org/html/rfc3447#section-8.1.1
+    size_t signatureSize = signature.size();
+
+    CCCryptorStatus status = CCRSACryptorSign(key, ccRSAPSSPadding, digestData.data(), digestData.size(), digestAlgorithm, saltLength, signature.data(), &signatureSize);
+    if (status)
+        return Exception { OperationError };
+
+    return WTFMove(signature);
 }
 
-static ExceptionOr<bool> verifyRSA_PSS(CryptoAlgorithmIdentifier, const PlatformRSAKey, const Vector<uint8_t>&, const Vector<uint8_t>&, size_t)
+static ExceptionOr<bool> verifyRSA_PSS(CryptoAlgorithmIdentifier hash, const PlatformRSAKey key, const Vector<uint8_t>& signature, const Vector<uint8_t>& data, size_t saltLength)
 {
-    // CCDigestAlgorithm digestAlgorithm;
-    // if (!getCommonCryptoDigestAlgorithm(hash, digestAlgorithm))
-    //     return Exception { OperationError };
-    // 
-    // auto cryptoDigestAlgorithm = WebCore::cryptoDigestAlgorithm(hash);
-    // if (!cryptoDigestAlgorithm)
-    //     return Exception { OperationError };
-    // auto digest = PAL::CryptoDigest::create(*cryptoDigestAlgorithm);
-    // if (!digest)
-    //     return Exception { OperationError };
-    // digest->addBytes(data.data(), data.size());
-    // auto digestData = digest->computeHash();
-    // 
-    // auto status = CCRSACryptorVerify(key, ccRSAPSSPadding, digestData.data(), digestData.size(), digestAlgorithm, saltLength, signature.data(), signature.size());
-    // if (!status)
-    //     return true;
+    CCDigestAlgorithm digestAlgorithm;
+    if (!getCommonCryptoDigestAlgorithm(hash, digestAlgorithm))
+        return Exception { OperationError };
+
+    auto cryptoDigestAlgorithm = WebCore::cryptoDigestAlgorithm(hash);
+    if (!cryptoDigestAlgorithm)
+        return Exception { OperationError };
+    auto digest = PAL::CryptoDigest::create(*cryptoDigestAlgorithm);
+    if (!digest)
+        return Exception { OperationError };
+    digest->addBytes(data.data(), data.size());
+    auto digestData = digest->computeHash();
+
+    auto status = CCRSACryptorVerify(key, ccRSAPSSPadding, digestData.data(), digestData.size(), digestAlgorithm, saltLength, signature.data(), signature.size());
+    if (!status)
+        return true;
     return false;
 }
 

Modified: trunk/Source/WebCore/crypto/mac/CryptoDigestAlgorithm.h (217585 => 217586)


--- trunk/Source/WebCore/crypto/mac/CryptoDigestAlgorithm.h	2017-05-30 23:54:51 UTC (rev 217585)
+++ trunk/Source/WebCore/crypto/mac/CryptoDigestAlgorithm.h	2017-05-30 23:55:51 UTC (rev 217586)
@@ -33,7 +33,7 @@
 
 namespace WebCore {
 
-inline std::optional<PAL::CryptoDigest::Algorithm> cryptoDigestAlgorithm(CryptoAlgorithmIdentifier hashFunction)
+static std::optional<PAL::CryptoDigest::Algorithm> cryptoDigestAlgorithm(CryptoAlgorithmIdentifier hashFunction)
 {
     switch (hashFunction) {
     case CryptoAlgorithmIdentifier::SHA_1:
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to