[Libreoffice-commits] online.git: Branch 'distro/collabora/co-4-2' - wsd/ProofKey.cpp wsd/ProofKey.hpp

Michael Meeks (via logerrit) logerrit at kemper.freedesktop.org
Thu Aug 20 21:03:48 UTC 2020


 wsd/ProofKey.cpp |    3 ++-
 wsd/ProofKey.hpp |    5 +++++
 2 files changed, 7 insertions(+), 1 deletion(-)

New commits:
commit 417dfd7df14a83358ca0523443d2adcfa81b5d60
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Thu Aug 20 16:46:05 2020 +0100
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Thu Aug 20 23:03:28 2020 +0200

    Avoid contention on RSA Digest engine.
    
    Change-Id: If9068371c7ab18083d432f8bc582d85c2f85e80e
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/101081
    Tested-by: Jenkins
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
    (cherry picked from commit cd98388653d9038e8918f1a1431a4c836b1adcb9)
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/101062
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/wsd/ProofKey.cpp b/wsd/ProofKey.cpp
index c7df1afe1..1fdfc5eca 100644
--- a/wsd/ProofKey.cpp
+++ b/wsd/ProofKey.cpp
@@ -252,7 +252,8 @@ std::vector<unsigned char> Proof::GetProof(const std::string& access_token, cons
 std::string Proof::SignProof(const std::vector<unsigned char>& proof) const
 {
     assert(m_pKey);
-    static Poco::Crypto::RSADigestEngine digestEngine(*m_pKey, "SHA256");
+    // One per DocumentBroker that uses this via WopiStorage
+    static thread_local Poco::Crypto::RSADigestEngine digestEngine(*m_pKey, "SHA256");
     digestEngine.reset();
     digestEngine.update(proof.data(), proof.size());
     return BytesToBase64(digestEngine.signature());
diff --git a/wsd/ProofKey.hpp b/wsd/ProofKey.hpp
index 34dd98e12..5efc79aeb 100644
--- a/wsd/ProofKey.hpp
+++ b/wsd/ProofKey.hpp
@@ -27,6 +27,11 @@ namespace Poco {
 
 class WopiProofTests;
 
+/**
+ * Global singleton - with one-time loaded key data
+ * loaded at startup, and then un-modified & shared
+ * across threads.
+ */
 class Proof {
     friend class WopiProofTests;
     void initialize();


More information about the Libreoffice-commits mailing list