Lines Matching refs:cbAlloc
44 static void doMemSaferScramble(RTTEST hTest, void *pvBuf, size_t cbAlloc)
49 RTRandBytes(pvBuf, cbAlloc);
51 void *pvRef = RTMemDup(pvBuf, cbAlloc);
57 int rc = RTMemSaferScramble(pvBuf, cbAlloc);
60 if (!memcmp(pvRef, pvBuf, cbAlloc))
62 cbAlloc, pvRef, pvBuf);
68 rc = RTMemSaferUnscramble(pvBuf, cbAlloc);
71 if (memcmp(pvRef, pvBuf, cbAlloc))
73 cbAlloc, pvRef, pvBuf);
76 RTTestIFailed("Unscrambling %z bytes failed with %Rrc!\n", cbAlloc, rc);
80 RTTestIFailed("Scrambling %z bytes failed with %Rrc!\n", cbAlloc, rc);
88 size_t cbAlloc = RTRandS32Ex(1, _1M) * sizeof(uint8_t);
91 int rc = RTMemSaferAllocZEx(&pvBuf, cbAlloc, 0);
95 RTRandBytes(pvBuf, cbAlloc);
98 doMemSaferScramble(hTest, pvBuf, cbAlloc);
100 RTMemSaferFree(pvBuf, cbAlloc);
103 RTTestIFailed("Allocating %z bytes of secure memory failed with %Rrc\n", cbAlloc, rc);
110 size_t cbAlloc = RTRandS32Ex(1, _16K);
112 RTTESTI_CHECK_RC_OK_RETV(RTMemSaferAllocZEx(&pvBuf, cbAlloc, 0));
115 cbAlloc += 1;
116 RTTESTI_CHECK_RC_OK_RETV(RTMemSaferReallocZEx(cbAlloc - 1, pvBuf, cbAlloc, &pvBuf, 0));
117 memset(pvBuf, i & 0x7f, cbAlloc);
119 RTMemSaferFree(pvBuf, cbAlloc);
124 cbAlloc = 0;
129 RTTESTI_CHECK_RC_OK_RETV(RTMemSaferReallocZEx(cbAlloc, pvBuf, cbNew, &pvBuf, 0));
131 RTTESTI_CHECK(ASMMemIsAll8(pvBuf, RT_MIN(cbAlloc, cbNew), chFiller) == NULL);
135 cbAlloc = cbNew;
137 RTTESTI_CHECK_RC_OK_RETV(RTMemSaferReallocZEx(cbAlloc, pvBuf, 0, &pvBuf, 0));