Skip to content

Commit 89c4f5b

Browse files
Merge pull request #145 from ossf/format_table_tt
Trivial formatting in a table
2 parents 7f12030 + a61aaf6 commit 89c4f5b

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

secure_software_development_fundamentals.md

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4459,32 +4459,31 @@ Here are some examples of how to call the predictable PRNG versus a cryptographi
44594459
</tr>
44604460
<tr>
44614461
<td>Java</td>
4462-
<td>Random()</td>
4463-
<td>SecureRandom()</td>
4462+
<td><tt>Random()</tt></td>
4463+
<td><tt>SecureRandom()</tt></td>
44644464
</tr>
44654465
<tr>
44664466
<td>C#</td>
4467-
<td>System.Random</td>
4468-
<td>System.Security.Cryptography. RandomNumberGenerator</td>
4467+
<td><tt>System.Random</tt></td>
4468+
<td><tt>System.Security.Cryptography. RandomNumberGenerator</tt></td>
44694469
</tr>
44704470
<tr>
44714471
<td>JavaScript</td>
4472-
<td>Math.random</td>
4473-
<td>window.crypto.getRandomValues<br>or crypto.randomBytes</td>
4472+
<td><tt>Math.random</tt></td>
4473+
<td><tt>window.crypto.getRandomValues</tt><br>or <tt>crypto.randomBytes</tt></td>
44744474
</tr>
44754475
<tr>
44764476
<td>Python</td>
4477-
<td>random</td>
4478-
<td>os.random</td>
4477+
<td><tt>random</tt></td>
4478+
<td><tt>os.random</tt></td>
44794479
</tr>
44804480
<tr>
44814481
<td>Ruby</td>
4482-
<td>rand (or Random.rand)</td>
4483-
<td>SecureRandom.rand</td>
4482+
<td><tt>rand</tt> (or <tt>Random.rand</tt>)</td>
4483+
<td><tt>SecureRandom.rand</tt></td>
44844484
</tr>
44854485
</table>
44864486

4487-
44884487
Another challenge is that software is fundamentally deterministic; given exactly the same inputs, a sequential algorithm should produce exactly the same output. You should not normally be directly seeding (initializing) any cryptographically secure algorithms, as many of these libraries implement secure seeding themselves. If you must seed it (and that is a bad sign), ensure that attackers cannot guess the seed value. Some people seed cryptographically secure PRNGs algorithms with date/time data, which is a vulnerability; in many cases, attackers can easily guess the likely date/times.
44894488

44904489
There is a simple solution: use a CSPRNG and use hardware to correctly provide data to it. Most operating system kernels today provide cryptographically secure random numbers by gathering environmental noise from multiple hardware devices and implementing a CSPRNG. If you’re running on bare metal (instead of an operating system kernel) there are usually reusable libraries you can use for this purpose. These cryptographically secure random numbers can be used directly, or can be used as a secure seed for a cryptographically secure PRNG.

0 commit comments

Comments
 (0)