Загрузка данных
Windows PowerShell 5.1
(C) Корпорация Майкрософт (Microsoft Corporation). Все права защищены.
PS C:\Users\str> $root = 'C:\Temp\pepper42-build'
PS C:\Users\str>
PS C:\Users\str> Write-Host "`n=== OPENSSL RAND SOURCE FILES ===" -ForegroundColor Cyan
=== OPENSSL RAND SOURCE FILES ===
PS C:\Users\str>
PS C:\Users\str> $randFiles = @(
>> "$root\openssl\crypto\rand\rand_unix.c",
>> "$root\openssl\crypto\rand\rand_lib.c",
>> "$root\openssl\crypto\rand\md_rand.c",
>> "$root\openssl\crypto\rand\randfile.c",
>> "$root\openssl\crypto\rand\rand_egd.c"
>> )
PS C:\Users\str>
PS C:\Users\str> foreach ($path in $randFiles) {
>> if (Test-Path $path) {
>> Write-Host "`n--- $path ---" -ForegroundColor Yellow
>> Select-String -Path $path -Pattern `
>> '/dev/urandom|/dev/random|RAND_poll|RAND_egd|RAND_add|RAND_bytes|open\(|read\(|getrandom|syscall|entropy' `
>> -Context 3,5
>> }
>> }
--- C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c ---
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:153: * data.
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:154: */
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:155:
> C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:156:int RAND_poll(void)
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:157:{
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:158: short int code;
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:159: gid_t curr_gid;
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:160: pid_t curr_pid;
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:161: uid_t curr_uid;
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:181: */
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:182:
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:183: curr_gid = getgid();
> C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:184: RAND_add(&curr_gid, sizeof curr_gid, 1);
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:185: curr_gid = 0;
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:186:
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:187: curr_pid = getpid();
> C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:188: RAND_add(&curr_pid, sizeof curr_pid, 1);
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:189: curr_pid = 0;
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:190:
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:191: curr_uid = getuid();
> C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:192: RAND_add(&curr_uid, sizeof curr_uid, 1);
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:193: curr_uid = 0;
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:194:
> C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:195: for (i = 0; i < (ENTROPY_NEEDED * 4); i++) {
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:196: /*
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:197: * burn some cpu; hope for interrupts, cache colli
sions, bus
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:198: * interference, etc.
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:199: */
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:200: for (k = 0; k < 99; k++)
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:217:
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:218: /* take 8 bits */
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:219: v = (unsigned char)(ts.tv_nsec % 256);
> C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:220: RAND_add(&v, sizeof v, 1);
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:221: v = 0;
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:222: }
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:223: return 1;
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:224:}
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:225:# elif defined __OpenBSD__
> C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:226:int RAND_poll(void)
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:227:{
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:228: u_int32_t rnd = 0, i;
> C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:229: unsigned char buf[ENTROPY_NEEDED];
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:230:
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:231: for (i = 0; i < sizeof(buf); i++) {
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:232: if (i % 4 == 0)
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:233: rnd = arc4random();
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:234: buf[i] = rnd;
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:235: rnd >>= 8;
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:236: }
> C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:237: RAND_add(buf, sizeof(buf), ENTROPY_NEEDED);
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:238: memset(buf, 0, sizeof(buf));
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:239:
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:240: return 1;
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:241:}
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:242:# else /* !defined(__OpenBSD__) *
/
> C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:243:int RAND_poll(void)
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:244:{
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:245: unsigned long l;
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:246: pid_t curr_pid = getpid();
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:247:# if defined(DEVRANDOM) || defined(DEVRANDOM_EGD)
> C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:248: unsigned char tmpbuf[ENTROPY_NEEDED];
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:249: int n = 0;
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:250:# endif
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:251:# ifdef DEVRANDOM
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:252: static const char *randomfiles[] = { DEVRANDOM };
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:253: struct stat randomstats[sizeof(randomfiles) / sizeof(r
andomfiles[0])];
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:262:# ifdef DEVRANDOM
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:263: memset(randomstats, 0, sizeof(randomstats));
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:264: /*
> C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:265: * Use a random entropy pool device. Linux, FreeBSD an
d OpenBSD have
> C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:266: * this. Use /dev/urandom if you can as /dev/random ma
y block if it runs
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:267: * out of random entries.
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:268: */
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:269:
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:270: for (i = 0; (i < sizeof(randomfiles) / sizeof(randomfi
les[0])) &&
> C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:271: (n < ENTROPY_NEEDED); i++) {
> C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:272: if ((fd = open(randomfiles[i], O_RDONLY
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:273:# ifdef O_NONBLOCK
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:274: | O_NONBLOCK
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:275:# endif
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:276:# ifdef O_BINARY
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:277: | O_BINARY
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:354:# endif
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:355:
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:356: if (try_read) {
> C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:357: r = read(fd, (unsigned char *)tmpbuf +
n,
> C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:358: ENTROPY_NEEDED - n);
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:359: if (r > 0)
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:360: n += r;
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:361:# if defined(OPENSSL_SYS_BEOS_R5)
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:362: if (r == 0)
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:363: snooze(t.tv_usec);
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:376: }
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:377: while ((r > 0 ||
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:378: (errno == EINTR || errno == EAGAIN)) &
& usec != 0
> C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:379: && n < ENTROPY_NEEDED);
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:380:
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:381: close(fd);
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:382: }
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:383: }
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:384:# endif /* defined(DEVRANDOM) */
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:385:
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:386:# ifdef DEVRANDOM_EGD
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:387: /*
> C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:388: * Use an EGD socket to read entropy from an EGD or PR
NGD entropy
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:389: * collecting daemon.
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:390: */
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:391:
> C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:392: for (egdsocket = egdsockets; *egdsocket && n < ENTROPY
_NEEDED;
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:393: egdsocket++) {
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:394: int r;
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:395:
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:396: r = RAND_query_egd_bytes(*egdsocket, (unsigned cha
r *)tmpbuf + n,
> C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:397: ENTROPY_NEEDED - n);
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:398: if (r > 0)
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:399: n += r;
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:400: }
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:401:# endif /* defined(DEVRANDOM_EGD)
*/
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:402:
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:403:# if defined(DEVRANDOM) || defined(DEVRANDOM_EGD)
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:404: if (n > 0) {
> C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:405: RAND_add(tmpbuf, sizeof tmpbuf, (double)n);
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:406: OPENSSL_cleanse(tmpbuf, n);
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:407: }
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:408:# endif
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:409:
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:410: /* put in some default random data, we need more than
just this */
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:411: l = curr_pid;
> C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:412: RAND_add(&l, sizeof(l), 0.0);
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:413: l = getuid();
> C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:414: RAND_add(&l, sizeof(l), 0.0);
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:415:
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:416: l = time(NULL);
> C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:417: RAND_add(&l, sizeof(l), 0.0);
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:418:
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:419:# if defined(OPENSSL_SYS_BEOS)
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:420: {
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:421: system_info sysInfo;
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:422: get_system_info(&sysInfo);
> C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:423: RAND_add(&sysInfo, sizeof(sysInfo), 0);
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:424: }
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:425:# endif
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:426:
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:427:# if defined(DEVRANDOM) || defined(DEVRANDOM_EGD)
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:428: return 1;
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:440: * defined(OPENSSL_SYS_NET
WARE)) */
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:441:
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:442:#if defined(OPENSSL_SYS_VXWORKS)
> C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:443:int RAND_poll(void)
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:444:{
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:445: return 0;
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:446:}
C:\Temp\pepper42-build\openssl\crypto\rand\rand_unix.c:447:#endif
--- C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c ---
C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:145: meth->seed(buf, num);
C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:146:}
C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:147:
> C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:148:void RAND_add(const void *buf, int num, double entropy)
C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:149:{
C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:150: const RAND_METHOD *meth = RAND_get_rand_method();
C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:151: if (meth && meth->add)
> C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:152: meth->add(buf, num, entropy);
C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:153:}
C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:154:
> C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:155:int RAND_bytes(unsigned char *buf, int num)
C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:156:{
C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:157: const RAND_METHOD *meth = RAND_get_rand_method();
C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:158: if (meth && meth->bytes)
C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:159: return meth->bytes(buf, num);
C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:160: return (-1);
C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:184: */
C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:185:
C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:186:/*
> C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:187: * Entropy gatherer: use standard OpenSSL PRNG to seed (thi
s will gather
> C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:188: * entropy internally through RAND_poll().
C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:189: */
C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:190:
> C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:191:static size_t drbg_get_entropy(DRBG_CTX *ctx, unsigned char
**pout,
> C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:192: int entropy, size_t min_len,
size_t max_len)
C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:193:{
C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:194: /* Round up request to multiple of block size */
C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:195: min_len = ((min_len + 19) / 20) * 20;
C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:196: *pout = OPENSSL_malloc(min_len);
C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:197: if (!*pout)
C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:198: return 0;
> C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:199: if (ssleay_rand_bytes(*pout, min_len, 0, 0) <= 0) {
C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:200: OPENSSL_free(*pout);
C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:201: *pout = NULL;
C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:202: return 0;
C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:203: }
C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:204: return min_len;
C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:205:}
C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:206:
> C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:207:static void drbg_free_entropy(DRBG_CTX *ctx, unsigned char
*out, size_t olen)
C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:208:{
C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:209: if (out) {
C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:210: OPENSSL_cleanse(out, olen);
C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:211: OPENSSL_free(out);
C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:212: }
C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:228:}
C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:229:
C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:230:/*
> C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:231: * RAND_add() and RAND_seed() pass through to OpenSSL PRNG
so it is
> C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:232: * correctly seeded by RAND_poll().
C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:233: */
C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:234:
> C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:235:static int drbg_rand_add(DRBG_CTX *ctx, const void *in, int
inlen,
> C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:236: double entropy)
C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:237:{
> C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:238: RAND_SSLeay()->add(in, inlen, entropy);
C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:239: return 1;
C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:240:}
C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:241:
C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:242:static int drbg_rand_seed(DRBG_CTX *ctx, const void *in, in
t inlen)
C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:243:{
C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:280: }
C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:281:
C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:282: FIPS_drbg_set_callbacks(dctx,
> C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:283: drbg_get_entropy, drbg_free_ent
ropy, 20,
> C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:284: drbg_get_entropy, drbg_free_ent
ropy);
C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:285: FIPS_drbg_set_rand_callbacks(dctx, drbg_get_adin, 0,
> C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:286: drbg_rand_seed, drbg_rand_
add);
C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:287: /* Personalisation string: a string followed by date ti
me vector */
C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:288: strcpy((char *)pers, "OpenSSL DRBG2.0");
C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:289: plen = drbg_get_adin(dctx, &p);
C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:290: memcpy(pers + 16, p, plen);
C:\Temp\pepper42-build\openssl\crypto\rand\rand_lib.c:291:
--- C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c ---
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:141:static unsigned char md[MD_DIGEST_LENGTH];
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:142:static long md_count[2] = { 0, 0 };
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:143:
> C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:144:static double entropy = 0;
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:145:static int initialized = 0;
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:146:
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:147:static unsigned int crypto_lock_rand = 0; /* may be set only
when a thread
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:148: * holds CRYPTO_LO
CK_RAND (to
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:149: * prevent double
locking) */
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:159:
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:160:static void ssleay_rand_cleanup(void);
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:161:static void ssleay_rand_seed(const void *buf, int num);
> C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:162:static void ssleay_rand_add(const void *buf, int num, double
add_entropy);
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:163:static int ssleay_rand_nopseudo_bytes(unsigned char *buf, in
t num);
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:164:static int ssleay_rand_pseudo_bytes(unsigned char *buf, int
num);
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:165:static int ssleay_rand_status(void);
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:166:
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:167:RAND_METHOD rand_ssleay_meth = {
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:168: ssleay_rand_seed,
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:169: ssleay_rand_nopseudo_bytes,
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:170: ssleay_rand_cleanup,
> C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:171: ssleay_rand_add,
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:172: ssleay_rand_pseudo_bytes,
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:173: ssleay_rand_status
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:174:};
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:175:
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:176:RAND_METHOD *RAND_SSLeay(void)
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:186: OPENSSL_cleanse(md, MD_DIGEST_LENGTH);
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:187: md_count[0] = 0;
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:188: md_count[1] = 0;
> C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:189: entropy = 0;
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:190: initialized = 0;
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:191:}
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:192:
> C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:193:static void ssleay_rand_add(const void *buf, int num, double
add)
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:194:{
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:195: int i, j, k, st_idx;
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:196: long md_c[2];
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:197: unsigned char local_md[MD_DIGEST_LENGTH];
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:198: EVP_MD_CTX m;
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:312: /*
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:313: * Don't just copy back local_md into md -- this could m
ean that other
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:314: * thread's seeding remains without effect (except for t
he incremented
> C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:315: * counter). By XORing it we keep at least as much entr
opy as fits into
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:316: * md.
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:317: */
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:318: for (k = 0; k < (int)sizeof(md); k++) {
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:319: md[k] ^= local_md[k];
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:320: }
> C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:321: if (entropy < ENTROPY_NEEDED) /* stop counting when we h
ave enough */
> C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:322: entropy += add;
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:323: if (!do_not_lock)
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:324: CRYPTO_w_unlock(CRYPTO_LOCK_RAND);
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:325:
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:326:#if !defined(OPENSSL_THREADS) && !defined(OPENSSL_SYS_WIN32)
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:327: assert(md_c[1] == md_count[1]);
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:330:
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:331:static void ssleay_rand_seed(const void *buf, int num)
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:332:{
> C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:333: ssleay_rand_add(buf, num, (double)num);
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:334:}
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:335:
> C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:336:int ssleay_rand_bytes(unsigned char *buf, int num, int pseud
o, int lock)
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:337:{
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:338: static volatile int stirred_pool = 0;
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:339: int i, j, k, st_num, st_idx;
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:340: int num_ceil;
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:341: int ok;
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:385: if (lock)
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:386: CRYPTO_w_lock(CRYPTO_LOCK_RAND);
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:387:
> C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:388: /* prevent ssleay_rand_bytes() from trying to obtain the
lock again */
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:389: CRYPTO_w_lock(CRYPTO_LOCK_RAND2);
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:390: CRYPTO_THREADID_current(&locking_threadid);
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:391: CRYPTO_w_unlock(CRYPTO_LOCK_RAND2);
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:392: crypto_lock_rand = 1;
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:393:
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:394: if (!initialized) {
> C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:395: RAND_poll();
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:396: initialized = 1;
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:397: }
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:398:
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:399: if (!stirred_pool)
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:400: do_stir_pool = 1;
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:401:
> C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:402: ok = (entropy >= ENTROPY_NEEDED);
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:403: if (!ok) {
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:404: /*
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:405: * If the PRNG state is not yet unpredictable, then
seeing the PRNG
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:406: * output may help attackers to determine the new st
ate; thus we have
> C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:407: * to decrease the entropy estimate. Once we've had
enough initial
> C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:408: * seeding we don't bother to adjust the entropy cou
nt, though,
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:409: * because we're not ambitious to provide *informati
on-theoretic*
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:410: * randomness. NOTE: This approach fails if the prog
ram forks before
> C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:411: * we have enough entropy. Entropy should be collect
ed in a separate
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:412: * input pool and be transferred to the output pool
only when the
> C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:413: * entropy limit has been reached.
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:414: */
> C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:415: entropy -= num;
> C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:416: if (entropy < 0)
> C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:417: entropy = 0;
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:418: }
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:419:
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:420: if (do_stir_pool) {
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:421: /*
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:422: * In the output function only half of 'md' remains
secret, so we
> C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:423: * better make sure that the required entropy gets '
evenly
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:424: * distributed' through 'state', our randomness pool
. The input
> C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:425: * function (ssleay_rand_add) chains all of 'md', wh
ich makes it more
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:426: * suitable for this purpose.
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:427: */
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:428:
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:429: int n = STATE_SIZE; /* so that the complete pool
gets accessed */
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:430: while (n > 0) {
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:434:#define DUMMY_SEED "...................." /* at least MD_DIG
EST_LENGTH */
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:435: /*
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:436: * Note that the seed does not matter, it's just
that
> C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:437: * ssleay_rand_add expects to have something to
hash.
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:438: */
> C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:439: ssleay_rand_add(DUMMY_SEED, MD_DIGEST_LENGTH, 0.
0);
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:440: n -= MD_DIGEST_LENGTH;
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:441: }
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:442: if (ok)
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:443: stirred_pool = 1;
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:444: }
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:482:#ifndef PURIFY /* purify complains */
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:483: /*
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:484: * The following line uses the supplied buffer as a
small source of
> C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:485: * entropy: since this buffer is often uninitialised
it may cause
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:486: * programs such as purify or valgrind to complain.
So for those
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:487: * builds it is not used: the removal of such a smal
l source of
> C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:488: * entropy has negligible impact on security.
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:489: */
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:490: MD_Update(&m, buf, j);
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:491:#endif
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:492:
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:493: k = (st_idx + MD_DIGEST_LENGTH / 2) - st_num;
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:524: else if (pseudo)
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:525: return 0;
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:526: else {
> C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:527: RANDerr(RAND_F_SSLEAY_RAND_BYTES, RAND_R_PRNG_NOT_SE
EDED);
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:528: ERR_add_error_data(1, "You need to read the OpenSSL
FAQ, "
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:529: "http://www.openssl.org/support/f
aq.html");
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:530: return (0);
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:531: }
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:532:}
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:533:
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:534:static int ssleay_rand_nopseudo_bytes(unsigned char *buf, in
t num)
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:535:{
> C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:536: return ssleay_rand_bytes(buf, num, 0, 1);
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:537:}
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:538:
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:539:/*
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:540: * pseudo-random bytes that are guaranteed to be unique but
not unpredictable
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:541: */
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:542:static int ssleay_rand_pseudo_bytes(unsigned char *buf, int
num)
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:543:{
> C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:544: return ssleay_rand_bytes(buf, num, 1, 1);
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:545:}
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:546:
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:547:static int ssleay_rand_status(void)
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:548:{
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:549: CRYPTO_THREADID cur;
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:552:
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:553: CRYPTO_THREADID_current(&cur);
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:554: /*
> C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:555: * check if we already have the lock (could happen if a
RAND_poll()
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:556: * implementation calls RAND_status())
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:557: */
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:558: if (crypto_lock_rand) {
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:559: CRYPTO_r_lock(CRYPTO_LOCK_RAND2);
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:560: do_not_lock = !CRYPTO_THREADID_cmp(&locking_threadid
, &cur);
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:566: CRYPTO_w_lock(CRYPTO_LOCK_RAND);
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:567:
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:568: /*
> C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:569: * prevent ssleay_rand_bytes() from trying to obtain
the lock again
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:570: */
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:571: CRYPTO_w_lock(CRYPTO_LOCK_RAND2);
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:572: CRYPTO_THREADID_cpy(&locking_threadid, &cur);
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:573: CRYPTO_w_unlock(CRYPTO_LOCK_RAND2);
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:574: crypto_lock_rand = 1;
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:575: }
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:576:
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:577: if (!initialized) {
> C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:578: RAND_poll();
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:579: initialized = 1;
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:580: }
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:581:
> C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:582: ret = entropy >= ENTROPY_NEEDED;
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:583:
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:584: if (!do_not_lock) {
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:585: /* before unlocking, we must clear 'crypto_lock_rand
' */
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:586: crypto_lock_rand = 0;
C:\Temp\pepper42-build\openssl\crypto\rand\md_rand.c:587:
--- C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c ---
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:106:/* #define RFILE ".rnd" - defined in ../../e_os.h */
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:107:
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:108:/*
> C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:109: * Note that these functions are intended for seed files on
ly. Entropy
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:110: * devices and EGD sockets are handled in rand_unix.c
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:111: */
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:112:
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:113:int RAND_load_file(const char *file, long bytes)
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:114:{
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:132: /*
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:133: * struct stat can have padding and unused fields that
may not be
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:134: * initialized in the call to stat(). We need to clear
the entire
> C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:135: * structure before calling RAND_add() to avoid complai
nts from
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:136: * applications such as Valgrind.
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:137: */
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:138: memset(&sb, 0, sizeof(sb));
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:139:# endif
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:140: if (stat(file, &sb) < 0)
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:141: return (0);
> C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:142: RAND_add(&sb, sizeof(sb), 0.0);
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:143:#endif
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:144: if (bytes == 0)
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:145: return (ret);
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:146:
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:147:#ifdef OPENSSL_SYS_VMS
> C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:148: in = vms_fopen(file, "rb", VMS_OPEN_ATTRS);
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:149:#else
> C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:150: in = fopen(file, "rb");
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:151:#endif
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:152: if (in == NULL)
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:153: goto err;
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:154:#if defined(S_IFBLK) && defined(S_IFCHR) && !defined(OPENSS
L_NO_POSIX_IO)
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:155: if (sb.st_mode & (S_IFBLK | S_IFCHR)) {
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:156: /*
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:157: * this file is a device. we don't want read an inf
inite number of
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:158: * bytes from a random device, nor do we want to us
e buffered I/O
> C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:159: * because we will waste system entropy.
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:160: */
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:161: bytes = (bytes == -1) ? 2048 : bytes; /* ok, is 204
8 enough? */
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:162:# ifndef OPENSSL_NO_SETVBUF_IONBF
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:163: setvbuf(in, NULL, _IONBF, 0); /* don't do buffered
reads */
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:164:# endif /* ndef OPENSSL_NO_SETVBUF_
IONBF */
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:169: n = (bytes < BUFSIZE) ? (int)bytes : BUFSIZE;
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:170: else
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:171: n = BUFSIZE;
> C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:172: i = fread(buf, 1, n, in);
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:173: if (i <= 0)
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:174: break;
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:175:#ifdef PURIFY
> C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:176: RAND_add(buf, i, (double)i);
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:177:#else
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:178: /* even if n != i, use the full array */
> C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:179: RAND_add(buf, n, (double)i);
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:180:#endif
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:181: ret += i;
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:182: if (bytes > 0) {
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:183: bytes -= n;
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:184: if (bytes <= 0)
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:225: * chmod(..., 0600) is too late to protect the file
, permissions
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:226: * should be restrictive from the start
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:227: */
> C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:228: int fd = open(file, O_WRONLY | O_CREAT | O_BINARY,
0600);
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:229: if (fd != -1)
> C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:230: out = fdopen(fd, "wb");
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:231: }
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:232:#endif
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:233:
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:234:#ifdef OPENSSL_SYS_VMS
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:235: /*
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:238: * existing versions named ;-1, and finally renamed the
current version
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:239: * as ';1'. Under concurrent usage, this resulted in an
RMS race
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:240: * condition in rename() which could orphan files (see
vms message help
> C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:241: * for RMS$_REENT). With the fopen() calls below, opens
sl/VMS now shares
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:242: * the top-level version of the rand file. Note that th
ere may still be
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:243: * conditions where the top-level rand file is locked.
If so, this code
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:244: * will then create a new version of the rand file. Wit
hout the delete
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:245: * and rename code, this can result in ascending file v
ersions that stop
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:246: * at version 32767, and this routine will then return
an error. The
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:250: * rand file in a concurrent use situation.
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:251: */
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:252:
> C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:253: out = vms_fopen(file, "rb+", VMS_OPEN_ATTRS);
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:254: if (out == NULL)
> C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:255: out = vms_fopen(file, "wb", VMS_OPEN_ATTRS);
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:256:#else
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:257: if (out == NULL)
> C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:258: out = fopen(file, "wb");
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:259:#endif
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:260: if (out == NULL)
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:261: goto err;
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:262:
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:263:#ifndef NO_CHMOD
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:267: for (;;) {
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:268: i = (n > BUFSIZE) ? BUFSIZE : n;
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:269: n -= BUFSIZE;
> C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:270: if (RAND_bytes(buf, i) <= 0)
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:271: rand_err = 1;
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:272: i = fwrite(buf, 1, i, out);
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:273: if (i <= 0) {
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:274: ret = 0;
C:\Temp\pepper42-build\openssl\crypto\rand\randfile.c:275: break;
--- C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c ---
> C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:1:/* crypto/rand/rand_egd.c */
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:2:/* Written by Ulf Moeller and Lutz Jaenicke for the OpenSSL p
roject. */
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:3:/* ==========================================================
==========
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:4: * Copyright (c) 1998-2000 The OpenSSL Project. All rights r
eserved.
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:5: *
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:6: * Redistribution and use in source and binary forms, with or
without
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:64: * This module supplies three routines:
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:65: *
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:66: * RAND_query_egd_bytes(path, buf, bytes)
> C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:67: * will actually query "bytes" bytes of entropy form the e
gd-socket located
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:68: * at path and will write them to buf (if supplied) or wil
l directly feed
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:69: * it to RAND_seed() if buf==NULL.
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:70: * The number of bytes is not limited by the maximum chunk
size of EGD,
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:71: * which is 255 bytes. If more than 255 bytes are wanted,
several chunks
> C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:72: * of entropy bytes are requested. The connection is left
open until the
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:73: * query is competed.
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:74: * RAND_query_egd_bytes() returns with
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:75: * -1 if an error occured during connection or communic
ation.
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:76: * num the number of bytes read from the EGD socket. Thi
s number is either
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:77: * the number of bytes requested or smaller, if the
EGD pool is
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:79: * This routine does not touch any RAND_status(). This is
necessary, since
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:80: * PRNG functions may call it during initialization.
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:81: *
> C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:82: * RAND_egd_bytes(path, bytes) will query "bytes" bytes and
have them
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:83: * used to seed the PRNG.
> C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:84: * RAND_egd_bytes() is a wrapper for RAND_query_egd_bytes(
) with buf=NULL.
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:85: * Unlike RAND_query_egd_bytes(), RAND_status() is used to
test the
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:86: * seed status so that the return value can reflect the se
ed state:
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:87: * -1 if an error occured during connection or communic
ation _or_
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:88: * if the PRNG has still not received the required s
eeding.
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:89: * num the number of bytes read from the EGD socket. Thi
s number is either
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:90: * the number of bytes requested or smaller, if the
EGD pool is
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:91: * drained and the daemon signals that the pool is e
mpty.
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:92: *
> C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:93: * RAND_egd(path) will query 255 bytes and use the bytes ret
reived to seed
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:94: * the PRNG.
> C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:95: * RAND_egd() is a wrapper for RAND_egd_bytes() with numby
tes=255.
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:96: */
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:97:
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:98:#if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_VMS) |
| defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_VXWORKS) || defined(OPENSSL_SYS_NETWARE) || defined(OPENSSL_SYS_VOS
) || defined(OPENSSL_SYS_BEOS)
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:99:int RAND_query_egd_bytes(const char *path, unsigned char *bu
f, int bytes)
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:100:{
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:101: return (-1);
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:102:}
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:103:
> C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:104:int RAND_egd(const char *path)
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:105:{
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:106: return (-1);
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:107:}
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:108:
> C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:109:int RAND_egd_bytes(const char *path, int bytes)
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:110:{
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:111: return (-1);
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:112:}
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:113:#else
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:114:# include <openssl/opensslconf.h>
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:210: }
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:211: numbytes = 0;
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:212: while (numbytes != 1) {
> C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:213: num = read(fd, egdbuf, 1);
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:214: if (num == 0)
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:215: goto err; /* descriptor closed */
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:216: else if (num > 0)
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:217: numbytes += num;
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:218: else {
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:239: retrievebuf = tempbuf;
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:240: numbytes = 0;
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:241: while (numbytes != egdbuf[0]) {
> C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:242: num = read(fd, retrievebuf + numbytes, egdbuf[0
] - numbytes);
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:243: if (num == 0)
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:244: goto err; /* descriptor closed */
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:245: else if (num > 0)
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:246: numbytes += num;
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:247: else {
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:271: return (ret);
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:272:}
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:273:
> C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:274:int RAND_egd_bytes(const char *path, int bytes)
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:275:{
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:276: int num, ret = 0;
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:277:
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:278: num = RAND_query_egd_bytes(path, NULL, bytes);
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:279: if (num < 1)
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:284: return (ret);
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:285:}
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:286:
> C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:287:int RAND_egd(const char *path)
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:288:{
> C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:289: return (RAND_egd_bytes(path, 255));
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:290:}
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:291:
C:\Temp\pepper42-build\openssl\crypto\rand\rand_egd.c:292:#endif
PS C:\Users\str>
PS C:\Users\str> Write-Host "`n=== NACL RANDOM API IN SDK HEADERS ===" -ForegroundColor Cyan
=== NACL RANDOM API IN SDK HEADERS ===
PS C:\Users\str>
PS C:\Users\str> $sdk = 'C:\Temp\pepper42-build'
PS C:\Users\str>
PS C:\Users\str> Get-ChildItem $sdk -Recurse -File -Include '*.h' |
>> Where-Object {
>> $_.FullName -match 'nacl|ppapi'
>> } |
>> Select-String -Pattern `
>> 'secure_random|GetRandomBytes|PPB_Crypto|random_bytes' |
>> Select-Object -First 100 Path, LineNumber, Line
PS C:\Users\str>