@@ -349,21 +349,28 @@ def test_ec_point_mul
349
349
# 3 * (6, 3) + 3 * (5, 1) = (7, 6)
350
350
result_a2 = point_a . mul ( 3 , 3 )
351
351
assert_equal B ( %w{ 04 07 06 } ) , result_a2 . to_octet_string ( :uncompressed )
352
- # 3 * point_a = 3 * (6, 3) = (16, 13)
353
- result_b1 = point_a . mul ( [ 3 ] , [ ] )
354
- assert_equal B ( %w{ 04 10 0D } ) , result_b1 . to_octet_string ( :uncompressed )
355
- # 3 * point_a + 2 * point_a = 3 * (6, 3) + 2 * (6, 3) = (7, 11)
356
- begin
352
+ EnvUtil . suppress_warning do # Point#mul(ary, ary [, bn]) is deprecated
353
+ begin
354
+ result_b1 = point_a . mul ( [ 3 ] , [ ] )
355
+ rescue NotImplementedError
356
+ # LibreSSL and OpenSSL 3.0 do no longer support this form of calling
357
+ next
358
+ end
359
+
360
+ # 3 * point_a = 3 * (6, 3) = (16, 13)
361
+ result_b1 = point_a . mul ( [ 3 ] , [ ] )
362
+ assert_equal B ( %w{ 04 10 0D } ) , result_b1 . to_octet_string ( :uncompressed )
363
+ # 3 * point_a + 2 * point_a = 3 * (6, 3) + 2 * (6, 3) = (7, 11)
357
364
result_b1 = point_a . mul ( [ 3 , 2 ] , [ point_a ] )
358
- rescue OpenSSL ::PKey ::EC ::Point ::Error
359
- # LibreSSL doesn't support multiple entries in first argument
360
- raise if $!. message !~ /called a function you should not call/
361
- else
362
365
assert_equal B ( %w{ 04 07 0B } ) , result_b1 . to_octet_string ( :uncompressed )
366
+ # 3 * point_a + 5 * point_a.group.generator = 3 * (6, 3) + 5 * (5, 1) = (13, 10)
367
+ result_b1 = point_a . mul ( [ 3 ] , [ ] , 5 )
368
+ assert_equal B ( %w{ 04 0D 0A } ) , result_b1 . to_octet_string ( :uncompressed )
369
+
370
+ assert_raise ( ArgumentError ) { point_a . mul ( [ 1 ] , [ point_a ] ) }
371
+ assert_raise ( TypeError ) { point_a . mul ( [ 1 ] , nil ) }
372
+ assert_raise ( TypeError ) { point_a . mul ( [ nil ] , [ ] ) }
363
373
end
364
- # 3 * point_a + 5 * point_a.group.generator = 3 * (6, 3) + 5 * (5, 1) = (13, 10)
365
- result_b1 = point_a . mul ( [ 3 ] , [ ] , 5 )
366
- assert_equal B ( %w{ 04 0D 0A } ) , result_b1 . to_octet_string ( :uncompressed )
367
374
rescue OpenSSL ::PKey ::EC ::Group ::Error
368
375
# CentOS patches OpenSSL to reject curves defined over Fp where p < 256 bits
369
376
raise if $!. message !~ /unsupported field/
@@ -376,9 +383,6 @@ def test_ec_point_mul
376
383
# invalid argument
377
384
point = p256_key . public_key
378
385
assert_raise ( TypeError ) { point . mul ( nil ) }
379
- assert_raise ( ArgumentError ) { point . mul ( [ 1 ] , [ point ] ) }
380
- assert_raise ( TypeError ) { point . mul ( [ 1 ] , nil ) }
381
- assert_raise ( TypeError ) { point . mul ( [ nil ] , [ ] ) }
382
386
end
383
387
384
388
# test Group: asn1_flag, point_conversion
0 commit comments