Kaydet (Commit) 306cd912 authored tarafından Michael Stahl's avatar Michael Stahl

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/49669Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMichael Stahl <mstahl@redhat.com>
üst 4f490b86
...@@ -33,6 +33,7 @@ void SvPasswordHelper::GetHashPasswordSHA256(uno::Sequence<sal_Int8>& rPassHash, ...@@ -33,6 +33,7 @@ void SvPasswordHelper::GetHashPasswordSHA256(uno::Sequence<sal_Int8>& rPassHash,
::comphelper::HashType::SHA256)); ::comphelper::HashType::SHA256));
rPassHash.realloc(hash.size()); rPassHash.realloc(hash.size());
::std::copy(hash.begin(), hash.end(), rPassHash.begin()); ::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) void SvPasswordHelper::GetHashPasswordSHA1UTF8(uno::Sequence<sal_Int8>& rPassHash, OUString const& rPassword)
...@@ -43,6 +44,7 @@ void SvPasswordHelper::GetHashPasswordSHA1UTF8(uno::Sequence<sal_Int8>& rPassHas ...@@ -43,6 +44,7 @@ void SvPasswordHelper::GetHashPasswordSHA1UTF8(uno::Sequence<sal_Int8>& rPassHas
::comphelper::HashType::SHA1)); ::comphelper::HashType::SHA1));
rPassHash.realloc(hash.size()); rPassHash.realloc(hash.size());
::std::copy(hash.begin(), hash.end(), rPassHash.begin()); ::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) 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 ...@@ -69,6 +71,7 @@ void SvPasswordHelper::GetHashPasswordLittleEndian(uno::Sequence<sal_Int8>& rPas
} }
GetHashPassword(rPassHash, pCharBuffer.get(), nSize * sizeof(sal_Unicode)); 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) void SvPasswordHelper::GetHashPasswordBigEndian(uno::Sequence<sal_Int8>& rPassHash, const OUString& sPass)
...@@ -84,6 +87,7 @@ void SvPasswordHelper::GetHashPasswordBigEndian(uno::Sequence<sal_Int8>& rPassHa ...@@ -84,6 +87,7 @@ void SvPasswordHelper::GetHashPasswordBigEndian(uno::Sequence<sal_Int8>& rPassHa
} }
GetHashPassword(rPassHash, pCharBuffer.get(), nSize * sizeof(sal_Unicode)); 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) void SvPasswordHelper::GetHashPassword(uno::Sequence<sal_Int8>& rPassHash, const OUString& sPass)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment