X-Git-Url: https://git.cryptolib.org/?p=arm-crypto-lib.git;a=blobdiff_plain;f=host%2Fbigint_test.rb;h=7a756a123c5f873a6e78b3e2d71a4402219c6212;hp=2ef961677db1793e42d5f7f266dbaf7da2db6bb2;hb=450dc954c85cb4fcb90f052222f9ab0c26194cb2;hpb=8fa939d627fb6230610a38e6468cbc55d006216d diff --git a/host/bigint_test.rb b/host/bigint_test.rb index 2ef9616..7a756a1 100644 --- a/host/bigint_test.rb +++ b/host/bigint_test.rb @@ -482,16 +482,14 @@ def gcdext_test(a,b) $sp.print(b.to_s(16)+" ") line='' begin - line_tmp = $sp.gets() - line_tmp = '' if line_tmp==nil - line = '' if line.end_with?('\n') - line += line_tmp + line = $sp.gets() + line = '' if line==nil puts("DBG got: "+line) if $debug if /^Error:.*/.match(line) puts line return false end - end while not m=/gcdext\([\s]*([+-]?[0-9a-fA-F]*)[\s]*,[\s]*([+-]?[0-9a-fA-F]*)[\s]*\)[\s]*=> a = ([+-]?[0-9a-fA-F]+); b = ([+-]?[0-9a-fA-F]+); gcd = ([+-]?[0-9a-fA-F]+)/.match(line) + end while not m=/gcdext\([\s]*([+-]?[0-9a-fA-F]*)[\s]*,[\s]*([+-]?[0-9a-fA-F]*)[\s]*\)[\s]*=>[\s]*a[\s]*=[\s]*([+-]?[0-9a-fA-F]+);[\s]*b[\s]*=[\s]*([+-]?[0-9a-fA-F]+);[\s]*gcd[\s]*=[\s]*([+-]?[0-9a-fA-F]+)/.match(line) a_ = m[1].to_i(16) b_ = m[2].to_i(16) c_ = m[3].to_i(16) @@ -669,7 +667,7 @@ def run_test_gcdext(skip=0) begin $size = length_a_B (0..16).each do |i| - a = rand(256**length_a_B) + a = rand(256**length_a_B)+1 b = rand(256**length_a_B)+1 v = gcdext_test(a, b) $logfile.flush() @@ -677,7 +675,7 @@ def run_test_gcdext(skip=0) end (0..16).each do |i| b_size = rand(length_b_B+1) - a = rand(256**length_a_B) + a = rand(256**length_a_B)+1 b = rand(256**b_size)+1 v = gcdext_test(a, b) $logfile.flush()