Crypto: disable P256 signing

This commit is contained in:
Vincent Bernardoff 2018-06-13 09:28:40 +02:00 committed by Benjamin Canou
parent 21823483a5
commit 9d18f7846d
3 changed files with 21 additions and 19 deletions

View File

@ -28,12 +28,12 @@ key2=bar
key3=boo key3=boo
key4=king key4=king
key5=queen key5=queen
key6=p256 # key6=p256
$client gen keys $key1 $client gen keys $key1
$client gen keys $key2 --sig secp256k1 $client gen keys $key2 --sig secp256k1
$client gen keys $key3 --sig ed25519 $client gen keys $key3 --sig ed25519
$client gen keys $key6 --sig p256 # $client gen keys $key6 --sig p256
$client list known identities $client list known identities
$client get balance for bootstrap1 $client get balance for bootstrap1
@ -41,12 +41,12 @@ $client get balance for bootstrap1
bake_after $client transfer 1,000 from bootstrap1 to $key1 bake_after $client transfer 1,000 from bootstrap1 to $key1
bake_after $client transfer 2,000 from bootstrap1 to $key2 bake_after $client transfer 2,000 from bootstrap1 to $key2
bake_after $client transfer 3,000 from bootstrap1 to $key3 bake_after $client transfer 3,000 from bootstrap1 to $key3
bake_after $client transfer 4,000 from bootstrap1 to $key6 # bake_after $client transfer 4,000 from bootstrap1 to $key6
$client get balance for $key1 | assert "1,000 ꜩ" $client get balance for $key1 | assert "1,000 ꜩ"
$client get balance for $key2 | assert "2,000 ꜩ" $client get balance for $key2 | assert "2,000 ꜩ"
$client get balance for $key3 | assert "3,000 ꜩ" $client get balance for $key3 | assert "3,000 ꜩ"
$client get balance for $key6 | assert "4,000 ꜩ" # $client get balance for $key6 | assert "4,000 ꜩ"
bake_after $client transfer 1,000 from $key2 to $key1 -fee 0 bake_after $client transfer 1,000 from $key2 to $key1 -fee 0
$client get balance for $key1 | assert "2,000 ꜩ" $client get balance for $key1 | assert "2,000 ꜩ"

View File

@ -206,26 +206,28 @@ let dh (Sk (sk, c)) (Pk (pk, _)) =
| true -> Some secret | true -> Some secret
| false -> None | false -> None
external sign : (* external sign :
Bigstring.t -> Bigstring.t -> Bigstring.t -> curve -> bool = * Bigstring.t -> Bigstring.t -> Bigstring.t -> curve -> bool =
"uECC_sign_stub" [@@noalloc] * "uECC_sign_stub" [@@noalloc] *)
external verify : external verify :
Bigstring.t -> Bigstring.t -> Bigstring.t -> curve -> bool = Bigstring.t -> Bigstring.t -> Bigstring.t -> curve -> bool =
"uECC_verify_stub" [@@noalloc] "uECC_verify_stub" [@@noalloc]
let write_sign (Sk (sk, c)) buf ~msg = let write_sign (Sk (_sk, _c)) _buf ~msg:_ =
if Bigstring.length buf < pk_size c then 0 failwith "Not implemented"
else (* if Bigstring.length buf < pk_size c then 0
match sign sk msg buf (to_curve c) with * else
| true -> pk_size c * match sign sk msg buf (to_curve c) with
| false -> 0 * | true -> pk_size c
* | false -> 0 *)
let sign (Sk (sk, c)) msg = let sign (Sk (_sk, _c)) _msg =
let signature = Bigstring.create (pk_size c) in failwith "Not implemented"
match sign sk msg signature (to_curve c) with (* let signature = Bigstring.create (pk_size c) in
| true -> Some signature * match sign sk msg signature (to_curve c) with
| false -> None * | true -> Some signature
* | false -> None *)
let verify (Pk (pk, c)) ~msg ~signature = let verify (Pk (pk, c)) ~msg ~signature =
if Bigstring.length signature <> pk_size c then false if Bigstring.length signature <> pk_size c then false

View File

@ -164,7 +164,7 @@ let basic = [
"export_compressed", `Quick, test_export_compressed ; "export_compressed", `Quick, test_export_compressed ;
"keypair", `Quick, test_keypair ; "keypair", `Quick, test_keypair ;
"dh", `Quick, test_dh ; "dh", `Quick, test_dh ;
"sign", `Quick, test_sign ; (* "sign", `Quick, test_sign ; *)
] ]
let () = let () =