X-Git-Url: https://git.cryptolib.org/?a=blobdiff_plain;f=host%2Fbigint_test.rb;h=7a756a123c5f873a6e78b3e2d71a4402219c6212;hb=498cf95d73faff93a848d2c0ffec3987769670bb;hp=2ef961677db1793e42d5f7f266dbaf7da2db6bb2;hpb=5e75eafde9b0269aa78395bbeb3e79ff36a1f082;p=arm-crypto-lib.git 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()