Library QedkConcrete.cryptointerfaces
The generated staking verification wrappers return the external library's
boolean unchanged. These equations do not assert that a signature is valid,
that parsing succeeds, or that a cryptographic primitive is secure.
From Stdlib Require Import String Ascii ZArith.
Require Import RocqOfOCaml.RocqOfOCaml MonadVM.Crypto.
Set Default Goal Selector "!".
Lemma secp_verification_result pk msg signature :
Crypto.Secp.verify pk msg signature =
Libsecp256k1.External.Sign.verify_exn Crypto.context pk
(Bigstring.of_string
(Byte_string.B32.(Byte_string.Fixed.Fixed_result.to_bytes)
(Crypto.blake3 msg))) signature.
Proof. reflexivity. Qed.
Lemma bls_verification_result pk msg signature :
Crypto.Bls.verify pk msg signature =
Bls12_381_signature.MinPk.Pop.verify pk
(Byte_string.Bytes.to_bytes msg) signature.
Proof. reflexivity. Qed.
Require Import RocqOfOCaml.RocqOfOCaml MonadVM.Crypto.
Set Default Goal Selector "!".
Lemma secp_verification_result pk msg signature :
Crypto.Secp.verify pk msg signature =
Libsecp256k1.External.Sign.verify_exn Crypto.context pk
(Bigstring.of_string
(Byte_string.B32.(Byte_string.Fixed.Fixed_result.to_bytes)
(Crypto.blake3 msg))) signature.
Proof. reflexivity. Qed.
Lemma bls_verification_result pk msg signature :
Crypto.Bls.verify pk msg signature =
Bls12_381_signature.MinPk.Pop.verify pk
(Byte_string.Bytes.to_bytes msg) signature.
Proof. reflexivity. Qed.
In particular, a library rejection cannot become success in the wrapper.
Lemma bls_rejection_preserved pk msg signature :
Bls12_381_signature.MinPk.Pop.verify pk
(Byte_string.Bytes.to_bytes msg) signature = false →
Crypto.Bls.verify pk msg signature = false.
Proof. exact (fun rejected ⇒ rejected). Qed.
Lemma secp_key_rejection_preserved encoded error :
Libsecp256k1.External.Key.read_pk Crypto.context
(Bigstring.of_string
(Byte_string.B33.(Byte_string.Fixed.Fixed_result.to_bytes) encoded)) =
inr error →
Crypto.Secp.pk_of_bytes encoded = None.
Proof. intro rejected. unfold Crypto.Secp.pk_of_bytes. rewrite rejected. reflexivity. Qed.
Bls12_381_signature.MinPk.Pop.verify pk
(Byte_string.Bytes.to_bytes msg) signature = false →
Crypto.Bls.verify pk msg signature = false.
Proof. exact (fun rejected ⇒ rejected). Qed.
Lemma secp_key_rejection_preserved encoded error :
Libsecp256k1.External.Key.read_pk Crypto.context
(Bigstring.of_string
(Byte_string.B33.(Byte_string.Fixed.Fixed_result.to_bytes) encoded)) =
inr error →
Crypto.Secp.pk_of_bytes encoded = None.
Proof. intro rejected. unfold Crypto.Secp.pk_of_bytes. rewrite rejected. reflexivity. Qed.
Reading an available byte has no abstract comparison or fallback premise.
Example bigstring_first (byte : ascii) tail :
Bigstring.get (String byte tail) 0%Z = byte.
Proof. reflexivity. Qed.
Print Assumptions secp_verification_result.
Print Assumptions bls_verification_result.
Print Assumptions bls_rejection_preserved.
Print Assumptions secp_key_rejection_preserved.
Print Assumptions bigstring_first.
Bigstring.get (String byte tail) 0%Z = byte.
Proof. reflexivity. Qed.
Print Assumptions secp_verification_result.
Print Assumptions bls_verification_result.
Print Assumptions bls_rejection_preserved.
Print Assumptions secp_key_rejection_preserved.
Print Assumptions bigstring_first.