Author: wmb Date: Wed Nov 21 00:10:28 2012 New Revision: 3446 URL: http://tracker.coreboot.org/trac/openfirmware/changeset/3446
Log: oatstime utility - simplified the fix in svn 3445 by observing that running one step of a linear congruence adds no entropy to the seed value, thus you might as well just use the seed.
Modified: cpu/x86/pc/olpc/oatstime.fth
Modified: cpu/x86/pc/olpc/oatstime.fth ============================================================================== --- cpu/x86/pc/olpc/oatstime.fth Tue Nov 20 23:54:29 2012 (r3445) +++ cpu/x86/pc/olpc/oatstime.fth Wed Nov 21 00:10:28 2012 (r3446) @@ -316,14 +316,16 @@ http-write " flush-writes" $call-http ; -[ifndef] random-long -variable rn -: random-long rn @ d# 1103515245 * d# 12345 + h# 7FFFFFFF and dup rn ! ; -time&date >unix-seconds get-msecs xor rn ! + +[ifdef] random +alias nonce-int random-long +[else] +: nonce-int ( -- n ) time&date >unix-seconds get-msecs xor ; [then] + 0 value the-nonce : oats-msg$ ( -- msg$ ) - random-long abs dup to the-nonce ( nonce ) + nonce-int abs dup to the-nonce ( nonce ) " SN" find-tag 0= abort" Machine has no serial number" ?-null ( nonce sn$ ) " serialnum=%s&version=1&nonce=%d" sprintf ;