summaryrefslogtreecommitdiff
path: root/svl
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2018-02-13 15:46:20 +0100
committerEike Rathke <erack@redhat.com>2018-02-15 11:18:05 +0100
commit6561fcc13334b93e886ad392af1515df45a2ae9b (patch)
treee6bab17f5ffbb14f0048ef6cb183b722be13651e /svl
parentd28ceb7511a8df9345b1c9818baaad5532853a12 (diff)
svl: clear temporary copies of passwords in SvlPasswordHelper
This is an obvious place to start, but there might be more copies elsewhere. Change-Id: I3c3ea6cb54f40fe5c21c3128b55aeaad1ff74b42 Reviewed-on: https://gerrit.libreoffice.org/49669 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com> (cherry picked from commit 306cd912b5b84c02ae9b786f72963506369df649) Reviewed-on: https://gerrit.libreoffice.org/49720 Reviewed-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'svl')
-rw-r--r--svl/source/misc/PasswordHelper.cxx4
1 files changed, 4 insertions, 0 deletions
diff --git a/svl/source/misc/PasswordHelper.cxx b/svl/source/misc/PasswordHelper.cxx
index 48aa165507ee..4f8cbb655b08 100644
--- a/svl/source/misc/PasswordHelper.cxx
+++ b/svl/source/misc/PasswordHelper.cxx
@@ -33,6 +33,7 @@ void SvPasswordHelper::GetHashPasswordSHA256(uno::Sequence<sal_Int8>& rPassHash,
::comphelper::HashType::SHA256));
rPassHash.realloc(hash.size());
::std::copy(hash.begin(), hash.end(), rPassHash.begin());
+ rtl_secureZeroMemory(const_cast<sal_Char *>(tmp.getStr()), tmp.getLength());
}
void SvPasswordHelper::GetHashPasswordSHA1UTF8(uno::Sequence<sal_Int8>& rPassHash, OUString const& rPassword)
@@ -43,6 +44,7 @@ void SvPasswordHelper::GetHashPasswordSHA1UTF8(uno::Sequence<sal_Int8>& rPassHas
::comphelper::HashType::SHA1));
rPassHash.realloc(hash.size());
::std::copy(hash.begin(), hash.end(), rPassHash.begin());
+ rtl_secureZeroMemory(const_cast<sal_Char *>(tmp.getStr()), tmp.getLength());
}
void SvPasswordHelper::GetHashPassword(uno::Sequence<sal_Int8>& rPassHash, const sal_Char* pPass, sal_uInt32 nLen)
@@ -69,6 +71,7 @@ void SvPasswordHelper::GetHashPasswordLittleEndian(uno::Sequence<sal_Int8>& rPas
}
GetHashPassword(rPassHash, pCharBuffer.get(), nSize * sizeof(sal_Unicode));
+ rtl_secureZeroMemory(pCharBuffer.get(), nSize * sizeof(sal_Unicode));
}
void SvPasswordHelper::GetHashPasswordBigEndian(uno::Sequence<sal_Int8>& rPassHash, const OUString& sPass)
@@ -84,6 +87,7 @@ void SvPasswordHelper::GetHashPasswordBigEndian(uno::Sequence<sal_Int8>& rPassHa
}
GetHashPassword(rPassHash, pCharBuffer.get(), nSize * sizeof(sal_Unicode));
+ rtl_secureZeroMemory(pCharBuffer.get(), nSize * sizeof(sal_Unicode));
}
void SvPasswordHelper::GetHashPassword(uno::Sequence<sal_Int8>& rPassHash, const OUString& sPass)