- // add the seed to the previous value of g_xkey
- add_blocks (g_xkey, xSeed, 0);
-
+ if (addOptional)
+ {
+ // create an xSeed to add.
+ Block xSeed;
+ prngOutput (gPrngRef, (BYTE*) &xSeed, sizeof (xSeed));
+
+ // add the seed to the previous value of g_xkey
+ add_blocks (g_xkey, xSeed, 0);
+ }
+
+ // initialize the value of H
+ FIPS_SHA1Init(&sha1_ctx);
+
+ // to stay compatible with the FIPS specification, we need to flip the bytes in
+ // g_xkey to little endian byte order. In our case, this makes exactly no difference
+ // (random is random), but we need to do it anyway to keep FIPS happy
+