/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef GRND_RANDOM /* if you don't have get random, you'll need to add your platform specific
* support for FIPS 104-3 compliant random seed source here */
PR_STATIC_ASSERT("You'll need to add our platform specific solution for FIPS 140-3 RNG" == NULL); #endif
/* syscall getentropy() is limited to retrieving 256 bytes */ #define GETENTROPY_MAX_BYTES 256
void
RNG_SystemInfoForRNG(void)
{
PRUint8 bytes[SYSTEM_RNG_SEED_COUNT];
size_t numBytes = RNG_SystemRNG(bytes, SYSTEM_RNG_SEED_COUNT); if (!numBytes) { /* error is set */ return;
}
RNG_RandomUpdate(bytes, numBytes);
PORT_SaveZero(bytes, sizeof(bytes));
}
while (fileBytes < maxLen) {
size_t getBytes = maxLen - fileBytes; if (getBytes > GETENTROPY_MAX_BYTES) {
getBytes = GETENTROPY_MAX_BYTES;
} /* FIP 140-3 requires full kernel reseeding for chained entropy sources * so we need to use getrandom with GRND_RANDOM. * getrandom returns -1 on failure, otherwise returns
* the number of bytes, which can be less than getBytes */
result = getrandom(buffer, getBytes, rng_grndFlags); if (result < 0) { break;
}
fileBytes += result;
buffer += result;
} if (fileBytes == maxLen) { /* success */ return maxLen;
} /* in FIPS 104-3 we don't fallback, just fail */
PORT_SetError(SEC_ERROR_NEED_RANDOM); return 0;
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.20 Sekunden
(vorverarbeitet am 2026-04-26)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.