So I wasn't sure whether to put this in here or the C forum since I work in C, but I figured this might be better off in here.
The cliffnotes is, as part of HASHLIB, I've been trying to write an alternative RNG (or seed for the toolchain's RNG) that is as close to crypto-safe as possible on the hardware. Of course, rtc_Time does not work for this. Another idea I had was to use a composite of 3 different randomness sources, 1 derived from rtc_Time in case the others are not entrophic enough, and the other 2 being pulled from elsewhere, for example, unmapped memory. After that, I would hash the resulting array of pseudorandom bytes, using either a CRC-32 or an SHA to generate either a random number, or a seed for rand()/random().
The existing code I have does this: https://github.com/acagliano/hashlib-ce/blob/rsa/src/main.c#L101
* I intend to optimize RandBytes once I get an RNG that works.
* Also feel free to yell at me if generating a random seed from a secure source and then using rand()/random() is not proper.
After a discussion with jacobly in SAX last night, I can assert that this method of generating randomness should be sufficient on Revision N, but not on models before that. As, I can get the intended behavior on L-1219N, but on L-0115, it's not random at all. For revision N, I used my CSPRNG to generate an array of 16-byte random strings long enough to fill up Cemu's console and printed them to the CEmu console and the output was entirely scrambled. I took that to mean success. On the other one (not sure which rev that was [L-0115]), there were pretty consistent patterns of the same bytes.
So I suppose I created this topic to share what I think works on RevN, as well as to poke for information on what may work on the other revisions.
The cliffnotes is, as part of HASHLIB, I've been trying to write an alternative RNG (or seed for the toolchain's RNG) that is as close to crypto-safe as possible on the hardware. Of course, rtc_Time does not work for this. Another idea I had was to use a composite of 3 different randomness sources, 1 derived from rtc_Time in case the others are not entrophic enough, and the other 2 being pulled from elsewhere, for example, unmapped memory. After that, I would hash the resulting array of pseudorandom bytes, using either a CRC-32 or an SHA to generate either a random number, or a seed for rand()/random().
The existing code I have does this: https://github.com/acagliano/hashlib-ce/blob/rsa/src/main.c#L101
* I intend to optimize RandBytes once I get an RNG that works.
* Also feel free to yell at me if generating a random seed from a secure source and then using rand()/random() is not proper.
After a discussion with jacobly in SAX last night, I can assert that this method of generating randomness should be sufficient on Revision N, but not on models before that. As, I can get the intended behavior on L-1219N, but on L-0115, it's not random at all. For revision N, I used my CSPRNG to generate an array of 16-byte random strings long enough to fill up Cemu's console and printed them to the CEmu console and the output was entirely scrambled. I took that to mean success. On the other one (not sure which rev that was [L-0115]), there were pretty consistent patterns of the same bytes.
So I suppose I created this topic to share what I think works on RevN, as well as to poke for information on what may work on the other revisions.