]> git.cryptolib.org Git - avr-crypto-lib.git/blobdiff - host/bigint_test.rb
[keccak-asm] chi in asm
[avr-crypto-lib.git] / host / bigint_test.rb
index d942b3748737cc6ca5bbdd8f76a6f67507a1487c..835cd4b57ae532e65bf4fe142671c5d725a9a667 100644 (file)
@@ -80,6 +80,7 @@ end
 ################################################################################
 
 def gcdext(x,y)
+  return  [0, 0, 0] if(x == 0 || y == 0)
   g=1
   while(x&1==0 && y&1==0) do
     x>>=1
@@ -412,6 +413,7 @@ end
 
 def expmod_test(a,b,c)
   begin
+    printf("[testing] expmod(%#x, %#x, %#x)\n",a,b,c) if $debug
     line = $sp.gets()
     line = "" if line==nil
     puts("DBG got: "+line) if $debug
@@ -473,6 +475,7 @@ end
 ################################################################################
 
 def gcdext_test(a,b)
+  $logfile.printf("[testing] gcdext(%s, %s)\n", a.to_s(16), b.to_s(16))
   begin
     line = $sp.gets()
     line = "" if line==nil
@@ -848,7 +851,7 @@ if File.exists?(logfilename)
 end
 $logfile = File.open(logfilename, 'w')
 printf("logfile: %s\n", logfilename)
-
+$logfile.sync = true
 $logfile.printf("bigint test from: %s\n", Time.now.to_s)
 $logfile.printf("skip = %s\n", opts['s']) if opts['s']
 $logfile.printf("seed = 0x%X\n", 0xdeadbeef)