diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-10-19 13:26:12 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-10-20 13:50:00 +0200 |
commit | b893e3a63f899e276ebb5c88c9458ebed2eb08a0 (patch) | |
tree | a16c868644174a3b8668ef23329c9a2432ff4e22 /sal/rtl/cipher.cxx | |
parent | 281e5f982008741bb6f7f03c578e47e342f4543e (diff) |
use rtl_secureZeroMemory when we're zeroing temporaries before returning
Change-Id: I0c3efa394511e479d925f5320977d071e8301f8d
Reviewed-on: https://gerrit.libreoffice.org/62002
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sal/rtl/cipher.cxx')
-rw-r--r-- | sal/rtl/cipher.cxx | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/sal/rtl/cipher.cxx b/sal/rtl/cipher.cxx index df0631b928d7..70a26cd3fe62 100644 --- a/sal/rtl/cipher.cxx +++ b/sal/rtl/cipher.cxx @@ -659,8 +659,8 @@ static rtlCipherError BF_init( key->m_P[i] ^= D; } - DL = 0; - DR = 0; + rtl_secureZeroMemory(&DL, sizeof(DL)); + rtl_secureZeroMemory(&DR, sizeof(DR)); for (i = 0; i < CIPHER_ROUNDS_BF + 2; i += 2) { @@ -808,7 +808,8 @@ static void BF_updateECB( RTL_CIPHER_HTONL64(DL, DR, pBuffer, nLength); } - DL = DR = 0; + rtl_secureZeroMemory(&DL, sizeof(DL)); + rtl_secureZeroMemory(&DR, sizeof(DR)); } static void BF_updateCBC( @@ -857,7 +858,8 @@ static void BF_updateCBC( RTL_CIPHER_HTONL64(DL, DR, pBuffer, nLength); } - DL = DR = 0; + rtl_secureZeroMemory(&DL, sizeof(DL)); + rtl_secureZeroMemory(&DR, sizeof(DR)); } static void BF_updateCFB( @@ -880,7 +882,8 @@ static void BF_updateCFB( BF_encode(&(ctx->m_key), &IVL, &IVR); RTL_CIPHER_HTONL64(IVL, IVR, iv, 8); - IVL = IVR = 0; + rtl_secureZeroMemory(&IVL, sizeof(IVL)); + rtl_secureZeroMemory(&IVR, sizeof(IVR)); } if (direction == rtl_Cipher_DirectionEncode) |