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
key4=king
key5=queen
key6=p256
# key6=p256
$client gen keys $key1
$client gen keys $key2 --sig secp256k1
$client gen keys $key3 --sig ed25519
$client gen keys $key6 --sig p256
# $client gen keys $key6 --sig p256
$client list known identities
$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 2,000 from bootstrap1 to $key2
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 $key2 | assert "2,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
$client get balance for $key1 | assert "2,000 ꜩ"

View File

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

View File

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