]> Repositorios git - scryer-prolog.git/commitdiff
add type check for scalar argument in crypto_curve_scalar_mult/4
authorMarkus Triska <[email protected]>
Sun, 7 Jun 2020 16:50:36 +0000 (18:50 +0200)
committerMarkus Triska <[email protected]>
Sun, 7 Jun 2020 16:51:13 +0000 (18:51 +0200)
Suggested by @notoria in #576. Many thanks!

src/prolog/lib/crypto.pl

index 7d099d2318918124cd52586269f3d2ca48755ab6..91ebc6ef48de11ba62f4449bc4aeecb97117e9bf 100644 (file)
@@ -718,6 +718,7 @@ crypto_curve_generator(curve(_,_,_,_,G,_,_,_), G).
 crypto_curve_order(curve(_,_,_,_,_,Order,_,_), Order).
 
 crypto_curve_scalar_mult(Curve, Scalar, point(X,Y), point(RX, RY)) :-
+        must_be(integer, Scalar),
         must_be_on_curve(Curve, point(X,Y)),
         curve_name(Curve, Name),
         curve_field_length(Curve, L0),