# Generation of random data for EME-OAEP

I'm using my own code to communicate with another party that's specified PKCS#1 V2.1 EME-OAEP encoding, with SHA-1 as the hash function.

There are two places where random data is used in encoding a message:

1. A 20-byte seed which is passed to Mask Generation Function.
2. A variable amount of random data which left-pads the message, when the message is shorter than the block.

For these uses, is it OK to use an operating system rand function, which is probably a weak LCG; or should I use a CSPRNG such as ISAAC (which will have been seeded from the weak LCG)?

• You probably shouldn't do any of those things. Certainly, seeding a CSPRNG with a weak source of randomness, is not much better than just using a weak randomness source. I.e., if the seed is predictable then so are the outputs of the CSPRNG. – Guut Boy Oct 28 '16 at 7:45
• What are the environment constraints that prevent the use of a strongly-seeded OS-level CSPRNG such as /dev/urandom? – rmalayter Oct 28 '16 at 8:49
• @rmalayter embedded device ... no strong OS-level RNG – M.M Oct 28 '16 at 10:03