aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/QPDFCrypto_native.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2019-11-04 15:55:43 +0100
committerJay Berkenbilt <ejb@ql.org>2019-11-09 14:18:02 +0100
commitbb427bd11774f47f553257cdc0693f77b559654d (patch)
tree379100926074a82f81f24d0d6cbe41631b71cc50 /libqpdf/QPDFCrypto_native.cc
parenteadc222ff9087c8dd41a7afced717a65802e849c (diff)
downloadqpdf-bb427bd11774f47f553257cdc0693f77b559654d.tar.zst
SHA2: switch to pluggable crypto
Diffstat (limited to 'libqpdf/QPDFCrypto_native.cc')
-rw-r--r--libqpdf/QPDFCrypto_native.cc24
1 files changed, 24 insertions, 0 deletions
diff --git a/libqpdf/QPDFCrypto_native.cc b/libqpdf/QPDFCrypto_native.cc
index a6ccee9b..b56c5373 100644
--- a/libqpdf/QPDFCrypto_native.cc
+++ b/libqpdf/QPDFCrypto_native.cc
@@ -42,3 +42,27 @@ void
QPDFCrypto_native::RC4_finalize()
{
}
+
+void
+QPDFCrypto_native::SHA2_init(int bits)
+{
+ this->sha2 = std::make_shared<SHA2_native>(bits);
+}
+
+void
+QPDFCrypto_native::SHA2_update(unsigned char const* data, size_t len)
+{
+ this->sha2->update(data, len);
+}
+
+void
+QPDFCrypto_native::SHA2_finalize()
+{
+ this->sha2->finalize();
+}
+
+std::string
+QPDFCrypto_native::SHA2_digest()
+{
+ return this->sha2->getRawDigest();
+}