Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
026b17b7
Kaydet (Commit)
026b17b7
authored
Mar 31, 2015
tarafından
Caolán McNamara
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
V597: introduce a rtl_secureZeroMemory
Change-Id: Id28046eb318cd3b2ed0b813fd266617547cf6ee2
üst
01b61568
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
50 additions
and
18 deletions
+50
-18
docpasswordhelper.cxx
comphelper/source/misc/docpasswordhelper.cxx
+1
-1
mscodec.cxx
filter/source/msfilter/mscodec.cxx
+5
-5
alloc.h
include/rtl/alloc.h
+16
-3
binarycodec.cxx
oox/source/core/binarycodec.cxx
+3
-3
alloc_cache.cxx
sal/rtl/alloc_cache.cxx
+15
-0
alloc_global.cxx
sal/rtl/alloc_global.cxx
+1
-1
digest.cxx
sal/rtl/digest.cxx
+2
-2
sal.map
sal/util/sal.map
+5
-0
pdfwriter_impl2.cxx
vcl/source/gdi/pdfwriter_impl2.cxx
+2
-3
No files found.
comphelper/source/misc/docpasswordhelper.cxx
Dosyayı görüntüle @
026b17b7
...
@@ -341,7 +341,7 @@ Sequence< sal_Int8 > DocPasswordHelper::GetXLHashAsSequence(
...
@@ -341,7 +341,7 @@ Sequence< sal_Int8 > DocPasswordHelper::GetXLHashAsSequence(
rtl_digest_rawMD5
(
hDigest
,
reinterpret_cast
<
sal_uInt8
*>
(
aResultKey
.
getArray
()),
aResultKey
.
getLength
()
);
rtl_digest_rawMD5
(
hDigest
,
reinterpret_cast
<
sal_uInt8
*>
(
aResultKey
.
getArray
()),
aResultKey
.
getLength
()
);
// Erase KeyData array and leave.
// Erase KeyData array and leave.
memset
(
pKeyData
,
0
,
sizeof
(
pKeyData
)
);
rtl_secureZeroMemory
(
pKeyData
,
sizeof
(
pKeyData
)
);
}
}
return
aResultKey
;
return
aResultKey
;
...
...
filter/source/msfilter/mscodec.cxx
Dosyayı görüntüle @
026b17b7
...
@@ -373,8 +373,8 @@ bool MSCodec_Std97::VerifyKey (
...
@@ -373,8 +373,8 @@ bool MSCodec_Std97::VerifyKey (
result
=
(
memcmp
(
pBuffer
,
pDigest
,
sizeof
(
pDigest
))
==
0
);
result
=
(
memcmp
(
pBuffer
,
pDigest
,
sizeof
(
pDigest
))
==
0
);
// Erase Buffer and Digest arrays.
// Erase Buffer and Digest arrays.
(
void
)
memset
(
pBuffer
,
0
,
sizeof
(
pBuffer
));
rtl_secureZeroMemory
(
pBuffer
,
sizeof
(
pBuffer
));
(
void
)
memset
(
pDigest
,
0
,
sizeof
(
pDigest
));
rtl_secureZeroMemory
(
pDigest
,
sizeof
(
pDigest
));
}
}
return
result
;
return
result
;
...
@@ -412,7 +412,7 @@ bool MSCodec_Std97::InitCipher (sal_uInt32 nCounter)
...
@@ -412,7 +412,7 @@ bool MSCodec_Std97::InitCipher (sal_uInt32 nCounter)
pKeyData
,
RTL_DIGEST_LENGTH_MD5
,
0
,
0
);
pKeyData
,
RTL_DIGEST_LENGTH_MD5
,
0
,
0
);
// Erase KeyData array and leave.
// Erase KeyData array and leave.
(
void
)
memset
(
pKeyData
,
0
,
sizeof
(
pKeyData
));
rtl_secureZeroMemory
(
pKeyData
,
sizeof
(
pKeyData
));
return
(
result
==
rtl_Cipher_E_None
);
return
(
result
==
rtl_Cipher_E_None
);
}
}
...
@@ -532,8 +532,8 @@ void MSCodec_Std97::GetEncryptKey (
...
@@ -532,8 +532,8 @@ void MSCodec_Std97::GetEncryptKey (
rtl_cipher_encode
(
rtl_cipher_encode
(
m_hCipher
,
pDigest
,
16
,
pSaltDigest
,
16
);
m_hCipher
,
pDigest
,
16
,
pSaltDigest
,
16
);
(
void
)
memset
(
pBuffer
,
0
,
sizeof
(
pBuffer
));
rtl_secureZeroMemory
(
pBuffer
,
sizeof
(
pBuffer
));
(
void
)
memset
(
pDigest
,
0
,
sizeof
(
pDigest
));
rtl_secureZeroMemory
(
pDigest
,
sizeof
(
pDigest
));
}
}
}
}
...
...
include/rtl/alloc.h
Dosyayı görüntüle @
026b17b7
...
@@ -71,7 +71,6 @@ SAL_DLLPUBLIC void SAL_CALL rtl_freeMemory (
...
@@ -71,7 +71,6 @@ SAL_DLLPUBLIC void SAL_CALL rtl_freeMemory (
void
*
Ptr
void
*
Ptr
)
SAL_THROW_EXTERN_C
();
)
SAL_THROW_EXTERN_C
();
/** Allocate and zero memory.
/** Allocate and zero memory.
A call to this function will return NULL upon the requested
A call to this function will return NULL upon the requested
...
@@ -84,18 +83,32 @@ SAL_DLLPUBLIC void * SAL_CALL rtl_allocateZeroMemory (
...
@@ -84,18 +83,32 @@ SAL_DLLPUBLIC void * SAL_CALL rtl_allocateZeroMemory (
sal_Size
Bytes
sal_Size
Bytes
)
SAL_THROW_EXTERN_C
();
)
SAL_THROW_EXTERN_C
();
/** Zero memory
Fills a block of memory with zeros in a way that is guaranteed to be secure
@param Ptr [in] pointer to previously allocated memory.
@param Bytes [in] memory size.
@since LibreOffice 4.5
*/
SAL_DLLPUBLIC
void
SAL_CALL
rtl_secureZeroMemory
(
void
*
Ptr
,
sal_Size
Bytes
)
SAL_THROW_EXTERN_C
();
/** Zero and free memory.
/** Zero and free memory.
@param Ptr [in] pointer to previously allocated memory.
@param Ptr [in] pointer to previously allocated memory.
@param Bytes [in] memory size.
@param Bytes [in] memory size.
@return none. Memory is zero'ed and released. Ptr is invalid.
@return none. Memory is zero'ed with rtl_secureZeroMemory and released. Ptr
is invalid.
*/
*/
SAL_DLLPUBLIC
void
SAL_CALL
rtl_freeZeroMemory
(
SAL_DLLPUBLIC
void
SAL_CALL
rtl_freeZeroMemory
(
void
*
Ptr
,
void
*
Ptr
,
sal_Size
Bytes
sal_Size
Bytes
)
SAL_THROW_EXTERN_C
();
)
SAL_THROW_EXTERN_C
();
/** Allocate aligned memory.
/** Allocate aligned memory.
A call to this function will return NULL upon the requested
A call to this function will return NULL upon the requested
...
...
oox/source/core/binarycodec.cxx
Dosyayı görüntüle @
026b17b7
...
@@ -347,8 +347,8 @@ bool BinaryCodec_RCF::verifyKey( const sal_uInt8 pnVerifier[ 16 ], const sal_uIn
...
@@ -347,8 +347,8 @@ bool BinaryCodec_RCF::verifyKey( const sal_uInt8 pnVerifier[ 16 ], const sal_uIn
bool
bResult
=
memcmp
(
pnBuffer
,
pnDigest
,
sizeof
(
pnDigest
)
)
==
0
;
bool
bResult
=
memcmp
(
pnBuffer
,
pnDigest
,
sizeof
(
pnDigest
)
)
==
0
;
// erase buffer and digest arrays and leave
// erase buffer and digest arrays and leave
(
void
)
memset
(
pnBuffer
,
0
,
sizeof
(
pnBuffer
)
);
rtl_secureZeroMemory
(
pnBuffer
,
sizeof
(
pnBuffer
)
);
(
void
)
memset
(
pnDigest
,
0
,
sizeof
(
pnDigest
)
);
rtl_secureZeroMemory
(
pnDigest
,
sizeof
(
pnDigest
)
);
return
bResult
;
return
bResult
;
}
}
...
@@ -379,7 +379,7 @@ bool BinaryCodec_RCF::startBlock( sal_Int32 nCounter )
...
@@ -379,7 +379,7 @@ bool BinaryCodec_RCF::startBlock( sal_Int32 nCounter )
rtl_cipher_init
(
mhCipher
,
rtl_Cipher_DirectionDecode
,
pnKeyData
,
RTL_DIGEST_LENGTH_MD5
,
0
,
0
);
rtl_cipher_init
(
mhCipher
,
rtl_Cipher_DirectionDecode
,
pnKeyData
,
RTL_DIGEST_LENGTH_MD5
,
0
,
0
);
// rrase key data array and leave
// rrase key data array and leave
(
void
)
memset
(
pnKeyData
,
0
,
sizeof
(
pnKeyData
)
);
rtl_secureZeroMemory
(
pnKeyData
,
sizeof
(
pnKeyData
)
);
return
eResult
==
rtl_Cipher_E_None
;
return
eResult
==
rtl_Cipher_E_None
;
}
}
...
...
sal/rtl/alloc_cache.cxx
Dosyayı görüntüle @
026b17b7
...
@@ -1314,6 +1314,15 @@ rtl_cache_wsupdate_fini();
...
@@ -1314,6 +1314,15 @@ rtl_cache_wsupdate_fini();
#if defined(SAL_UNX)
#if defined(SAL_UNX)
void
SAL_CALL
rtl_secureZeroMemory
(
void
*
Ptr
,
sal_Size
Bytes
)
SAL_THROW_EXTERN_C
()
{
//currently glibc doesn't implement memset_s
volatile
char
*
p
=
reinterpret_cast
<
volatile
char
*>
(
Ptr
);
while
(
Bytes
--
)
*
p
++
=
0
;
}
#include <sys/time.h>
#include <sys/time.h>
static
void
*
static
void
*
...
@@ -1369,6 +1378,12 @@ rtl_cache_wsupdate_fini()
...
@@ -1369,6 +1378,12 @@ rtl_cache_wsupdate_fini()
#elif defined(SAL_W32)
#elif defined(SAL_W32)
void
SAL_CALL
rtl_secureZeroMemory
(
void
*
Ptr
,
sal_Size
Bytes
)
SAL_THROW_EXTERN_C
()
{
RtlSecureZeroMemory
(
Ptr
,
Bytes
);
}
static
DWORD
WINAPI
static
DWORD
WINAPI
rtl_cache_wsupdate_all
(
void
*
arg
);
rtl_cache_wsupdate_all
(
void
*
arg
);
...
...
sal/rtl/alloc_global.cxx
Dosyayı görüntüle @
026b17b7
...
@@ -374,7 +374,7 @@ void SAL_CALL rtl_freeZeroMemory (void * p, sal_Size n) SAL_THROW_EXTERN_C()
...
@@ -374,7 +374,7 @@ void SAL_CALL rtl_freeZeroMemory (void * p, sal_Size n) SAL_THROW_EXTERN_C()
{
{
if
(
p
!=
0
)
if
(
p
!=
0
)
{
{
memset
(
p
,
0
,
n
);
rtl_secureZeroMemory
(
p
,
n
);
rtl_freeMemory
(
p
);
rtl_freeMemory
(
p
);
}
}
}
}
...
...
sal/rtl/digest.cxx
Dosyayı görüntüle @
026b17b7
...
@@ -2071,7 +2071,7 @@ static void __rtl_digest_updatePBKDF2 (
...
@@ -2071,7 +2071,7 @@ static void __rtl_digest_updatePBKDF2 (
for
(
k
=
0
;
k
<
DIGEST_CBLOCK_PBKDF2
;
k
++
)
T
[
k
]
^=
U
[
k
];
for
(
k
=
0
;
k
<
DIGEST_CBLOCK_PBKDF2
;
k
++
)
T
[
k
]
^=
U
[
k
];
}
}
memset
(
U
,
0
,
DIGEST_CBLOCK_PBKDF2
);
rtl_secureZeroMemory
(
U
,
DIGEST_CBLOCK_PBKDF2
);
}
}
/*========================================================================
/*========================================================================
...
@@ -2124,7 +2124,7 @@ rtlDigestError SAL_CALL rtl_digest_PBKDF2 (
...
@@ -2124,7 +2124,7 @@ rtlDigestError SAL_CALL rtl_digest_PBKDF2 (
/* DK ||= T_(i) */
/* DK ||= T_(i) */
memcpy
(
pKeyData
,
T
,
nKeyLen
);
memcpy
(
pKeyData
,
T
,
nKeyLen
);
memset
(
T
,
0
,
DIGEST_CBLOCK_PBKDF2
);
rtl_secureZeroMemory
(
T
,
DIGEST_CBLOCK_PBKDF2
);
}
}
memset
(
&
digest
,
0
,
sizeof
(
digest
));
memset
(
&
digest
,
0
,
sizeof
(
digest
));
...
...
sal/util/sal.map
Dosyayı görüntüle @
026b17b7
...
@@ -678,6 +678,11 @@ LIBO_UDK_4.3 { # symbols available in >= LibO 4.3
...
@@ -678,6 +678,11 @@ LIBO_UDK_4.3 { # symbols available in >= LibO 4.3
osl_areCommandArgsSet;
osl_areCommandArgsSet;
} LIBO_UDK_4.2;
} LIBO_UDK_4.2;
LIBO_UDK_4.5 { # symbols available in >= LibO 4.5
global:
rtl_secureZeroMemory;
} LIBO_UDK_4.3;
PRIVATE_1.0 {
PRIVATE_1.0 {
global:
global:
osl_detail_ObjectRegistry_storeAddresses;
osl_detail_ObjectRegistry_storeAddresses;
...
...
vcl/source/gdi/pdfwriter_impl2.cxx
Dosyayı görüntüle @
026b17b7
...
@@ -1220,9 +1220,8 @@ uno::Reference< beans::XMaterialHolder > PDFWriterImpl::initEncryption( const OU
...
@@ -1220,9 +1220,8 @@ uno::Reference< beans::XMaterialHolder > PDFWriterImpl::initEncryption( const OU
xResult
.
clear
();
xResult
.
clear
();
// trash temporary padded cleartext PWDs
// trash temporary padded cleartext PWDs
memset
(
aPadOPW
,
0
,
sizeof
(
aPadOPW
)
);
rtl_secureZeroMemory
(
aPadOPW
,
sizeof
(
aPadOPW
));
memset
(
aPadUPW
,
0
,
sizeof
(
aPadUPW
)
);
rtl_secureZeroMemory
(
aPadUPW
,
sizeof
(
aPadUPW
));
}
}
return
xResult
;
return
xResult
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment