VirtualBox

Changeset 102490 in vbox for trunk/src/VBox/Runtime/common


Ignore:
Timestamp:
Dec 6, 2023 12:34:17 AM (12 months ago)
Author:
vboxsync
Message:

IRPT/shacrypt: Don't use RTMemDup on the passpharse in step 16 since it'll be overwritten at once, use RTMemTmpAllocZ instead. bugref:10551

Location:
trunk/src/VBox/Runtime/common/crypto
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/crypto/shacrypt-256.cpp.h

    r102488 r102490  
    110110     */
    111111    size_t const cbSeqP  = cchPhrase;
    112     uint8_t     *pabSeqP = (uint8_t *)RTMemDup(pszPhrase, cbSeqP + 1);          /* +1 because the password may be empty */
     112    uint8_t     *pabSeqP = (uint8_t *)RTMemTmpAllocZ(cbSeqP + 1);               /* +1 because the password may be empty */
    113113    uint8_t     *pb       = pabSeqP;
    114114    AssertPtrReturn(pabSeqP, VERR_NO_MEMORY);
     
    190190    RTMemWipeThoroughly(abDigestTemp, RTSHA256_HASH_SIZE, 3);
    191191    RTMemWipeThoroughly(pabSeqP, cbSeqP, 3);
    192     RTMemFree(pabSeqP);
     192    RTMemTmpFree(pabSeqP);
    193193#if 0
    194194    RTMemWipeThoroughly(pabSeqS, cbSeqS, 3);
  • trunk/src/VBox/Runtime/common/crypto/shacrypt-512.cpp.h

    r102488 r102490  
    111111     */
    112112    size_t const cbSeqP  = cchPhrase;
    113     uint8_t     *pabSeqP = (uint8_t *)RTMemDup(pszPhrase, cbSeqP + 1);          /* +1 because the password may be empty */
     113    uint8_t     *pabSeqP = (uint8_t *)RTMemTmpAllocZ(cbSeqP + 1);               /* +1 because the password may be empty */
    114114    uint8_t     *pb       = pabSeqP;
    115115    AssertPtrReturn(pabSeqP, VERR_NO_MEMORY);
     
    191191    RTMemWipeThoroughly(abDigestTemp, RTSHA512_HASH_SIZE, 3);
    192192    RTMemWipeThoroughly(pabSeqP, cbSeqP, 3);
    193     RTMemFree(pabSeqP);
     193    RTMemTmpFree(pabSeqP);
    194194#if 0
    195195    RTMemWipeThoroughly(pabSeqS, cbSeqS, 3);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette