summaryrefslogtreecommitdiff
path: root/comphelper/source/misc
diff options
context:
space:
mode:
authorBalazs Varga <balazs.varga.extern@allotropia.de>2023-08-22 22:10:20 +0200
committerSamuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>2023-08-30 14:34:39 +0200
commit9254fbce6b9e20a75aa2a379bcf2fc9dc41a5b44 (patch)
tree9d4e6904934321ce76d1d4b6c6a85d8a396887c9 /comphelper/source/misc
parent53fed6a869d0fa983dd28a2f4c62b46d1e67a9f5 (diff)
tdf#156835 - FILEOPEN XLSX: add SHA-384 encryption support for ooxml import
Password protected file with SHA-384 encryption does not open before this patch. Change-Id: I482233f788b8e9da210ad6d2a6c4ece18d05d248 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156282 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>
Diffstat (limited to 'comphelper/source/misc')
-rw-r--r--comphelper/source/misc/docpasswordhelper.cxx2
-rw-r--r--comphelper/source/misc/hash.cxx6
2 files changed, 8 insertions, 0 deletions
diff --git a/comphelper/source/misc/docpasswordhelper.cxx b/comphelper/source/misc/docpasswordhelper.cxx
index 5489690fae6a..0adb6eff9a4a 100644
--- a/comphelper/source/misc/docpasswordhelper.cxx
+++ b/comphelper/source/misc/docpasswordhelper.cxx
@@ -373,6 +373,8 @@ std::vector<unsigned char> DocPasswordHelper::GetOoxHashAsVector(
eType = comphelper::HashType::SHA512;
else if (rAlgorithmName == u"SHA-256" || rAlgorithmName == u"SHA256")
eType = comphelper::HashType::SHA256;
+ else if (rAlgorithmName == u"SHA-384" || rAlgorithmName == u"SHA384")
+ eType = comphelper::HashType::SHA384;
else if (rAlgorithmName == u"SHA-1" || rAlgorithmName == u"SHA1") // "SHA1" might be in the wild
eType = comphelper::HashType::SHA1;
else if (rAlgorithmName == u"MD5")
diff --git a/comphelper/source/misc/hash.cxx b/comphelper/source/misc/hash.cxx
index d537b9eeff72..25b93ad87e54 100644
--- a/comphelper/source/misc/hash.cxx
+++ b/comphelper/source/misc/hash.cxx
@@ -43,6 +43,8 @@ struct HashImpl
return HASH_AlgSHA1;
case HashType::SHA256:
return HASH_AlgSHA256;
+ case HashType::SHA384:
+ return HASH_AlgSHA384;
case HashType::SHA512:
return HASH_AlgSHA512;
}
@@ -62,6 +64,8 @@ struct HashImpl
return EVP_sha1();
case HashType::SHA256:
return EVP_sha256();
+ case HashType::SHA384:
+ return EVP_sha384();
case HashType::SHA512:
return EVP_sha512();
}
@@ -151,6 +155,8 @@ size_t Hash::getLength() const
return SHA1_HASH_LENGTH;
case HashType::SHA256:
return SHA256_HASH_LENGTH;
+ case HashType::SHA384:
+ return SHA384_HASH_LENGTH;
case HashType::SHA512:
return SHA512_HASH_LENGTH;
}