33#[ doc( inline) ]
44pub use fvm_shared:: sys:: out:: crypto:: * ;
55
6+ // for documentation links
7+ #[ cfg( doc) ]
8+ use crate :: sys:: ErrorNumber :: * ;
9+
610super :: fvm_syscalls! {
711 module = "crypto" ;
812
913 /// Verifies that a signature is valid for an address and plaintext.
1014 ///
1115 /// Returns 0 on success, or -1 if the signature fails to validate.
1216 ///
17+ /// # Arguments
18+ ///
19+ /// - `sig_off` and `sig_len` specify location and length of the signature.
20+ /// - `addr_off` and `addr_len` specify location and length of expected signer's address.
21+ /// - `plaintext_off` and `plaintext_len` specify location and length of the signed data.
22+ ///
1323 /// # Errors
1424 ///
15- /// | Error | Reason |
16- /// |-------------------|------------------------------------------------------|
17- /// | `IllegalArgument` | signature, address, or plaintext buffers are invalid |
25+ /// | Error | Reason |
26+ /// |--------------------- |------------------------------------------------------|
27+ /// | [ `IllegalArgument`] | signature, address, or plaintext buffers are invalid |
1828 pub fn verify_signature(
1929 sig_off: * const u8 ,
2030 sig_len: u32 ,
@@ -26,13 +36,17 @@ super::fvm_syscalls! {
2636
2737 /// Hashes input data using blake2b with 256 bit output.
2838 ///
29- /// The output buffer must be sized to a minimum of 32 bytes.
39+ /// Returns a 32-byte hash digest.
40+ ///
41+ /// # Arguments
42+ ///
43+ /// - `data_off` and `data_len` specify location and length of the data to be hashed.
3044 ///
3145 /// # Errors
3246 ///
33- /// | Error | Reason |
34- /// |-------------------|-------------------------------------------------|
35- /// | `IllegalArgument` | the input buffer does not point to valid memory |
47+ /// | Error | Reason |
48+ /// |--------------------- |-------------------------------------------------|
49+ /// | [ `IllegalArgument`] | the input buffer does not point to valid memory |
3650 pub fn hash_blake2b(
3751 data_off: * const u8 ,
3852 data_len: u32 ,
@@ -44,11 +58,19 @@ super::fvm_syscalls! {
4458 /// Writes the CID in the provided output buffer, and returns the length of
4559 /// the written CID.
4660 ///
61+ /// # Arguments
62+ ///
63+ /// - `proof_type` is the type of seal proof.
64+ /// - `pieces_off` and `pieces_len` specify the location and length of a cbor-encoded list of
65+ /// [`PieceInfo`][fvm_shared::piece::PieceInfo] in tuple representation.
66+ /// - `cid_off` is the offset at which the computed CID will be written.
67+ /// - `cid_len` is the size of the buffer at `cid_off`. 100 bytes is guaranteed to be enough.
68+ ///
4769 /// # Errors
4870 ///
49- /// | Error | Reason |
50- /// |-------------------|--------------------------|
51- /// | `IllegalArgument` | an argument is malformed |
71+ /// | Error | Reason |
72+ /// |--------------------- |--------------------------|
73+ /// | [ `IllegalArgument`] | an argument is malformed |
5274 pub fn compute_unsealed_sector_cid(
5375 proof_type: i64 ,
5476 pieces_off: * const u8 ,
@@ -61,22 +83,32 @@ super::fvm_syscalls! {
6183 ///
6284 /// Returns 0 to indicate that the proof was valid, -1 otherwise.
6385 ///
86+ /// # Arguments
87+ ///
88+ /// `info_off` and `info_len` specify the location and length of a cbor-encoded
89+ /// [`SealVerifyInfo`][fvm_shared::sector::SealVerifyInfo] in tuple representation.
90+ ///
6491 /// # Errors
6592 ///
66- /// | Error | Reason |
67- /// |-------------------|--------------------------|
68- /// | `IllegalArgument` | an argument is malformed |
93+ /// | Error | Reason |
94+ /// |--------------------- |--------------------------|
95+ /// | [ `IllegalArgument`] | an argument is malformed |
6996 pub fn verify_seal( info_off: * const u8 , info_len: u32 ) -> Result <i32 >;
7097
7198 /// Verifies a window proof of spacetime.
7299 ///
73100 /// Returns 0 to indicate that the proof was valid, -1 otherwise.
74101 ///
102+ /// # Arguments
103+ ///
104+ /// `info_off` and `info_len` specify the location and length of a cbor-encoded
105+ /// [`WindowPoStVerifyInfo`][fvm_shared::sector::WindowPoStVerifyInfo] in tuple representation.
106+ ///
75107 /// # Errors
76108 ///
77- /// | Error | Reason |
78- /// |-------------------|--------------------------|
79- /// | `IllegalArgument` | an argument is malformed |
109+ /// | Error | Reason |
110+ /// |--------------------- |--------------------------|
111+ /// | [ `IllegalArgument`] | an argument is malformed |
80112 pub fn verify_post( info_off: * const u8 , info_len: u32 ) -> Result <i32 >;
81113
82114 /// Verifies that two block headers provide proof of a consensus fault.
@@ -85,12 +117,19 @@ super::fvm_syscalls! {
85117 /// BlockId containing the fault details. Otherwise, a -1 status is returned,
86118 /// and the second result parameter must be ignored.
87119 ///
120+ /// # Arguments
121+ ///
122+ /// - `h1_off`/`h1_len` and `h2_off`/`h2_len` specify the location and length of the block
123+ /// headers that allegedly represent a consensus fault.
124+ /// - `extra_off` and `extra_len` specifies the "extra data" passed in the
125+ /// `ReportConsensusFault` message.
126+ ///
88127 /// # Errors
89128 ///
90- /// | Error | Reason |
91- /// |-------------------|---------------------------------------|
92- /// | `LimitExceeded` | exceeded lookback limit finding block |
93- /// | `IllegalArgument` | an argument is malformed |
129+ /// | Error | Reason |
130+ /// |--------------------- |---------------------------------------|
131+ /// | [ `LimitExceeded`] | exceeded lookback limit finding block |
132+ /// | [ `IllegalArgument`] | an argument is malformed |
94133 pub fn verify_consensus_fault(
95134 h1_off: * const u8 ,
96135 h1_len: u32 ,
@@ -104,32 +143,52 @@ super::fvm_syscalls! {
104143 ///
105144 /// Returns 0 to indicate that the proof was valid, -1 otherwise.
106145 ///
146+ /// # Arguments
147+ ///
148+ /// `agg_off` and `agg_len` specify the location and length of a cbor-encoded
149+ /// [`AggregateSealVerifyProofAndInfos`][fvm_shared::sector::AggregateSealVerifyProofAndInfos]
150+ /// in tuple representation.
151+ ///
107152 /// # Errors
108153 ///
109- /// | Error | Reason |
110- /// |-------------------|--------------------------------|
111- /// | `LimitExceeded` | exceeds seal aggregation limit |
112- /// | `IllegalArgument` | an argument is malformed |
154+ /// | Error | Reason |
155+ /// |--------------------- |--------------------------------|
156+ /// | [ `LimitExceeded`] | exceeds seal aggregation limit |
157+ /// | [ `IllegalArgument`] | an argument is malformed |
113158 pub fn verify_aggregate_seals( agg_off: * const u8 , agg_len: u32 ) -> Result <i32 >;
114159
115160 /// Verifies a replica update proof.
116161 ///
117162 /// Returns 0 to indicate that the proof was valid, -1 otherwise.
118163 ///
164+ /// # Arguments
165+ ///
166+ /// `rep_off` and `rep_len` specify the location and length of a cbor-encoded
167+ /// [`ReplicaUpdateInfo`][fvm_shared::sector::ReplicaUpdateInfo] in tuple representation.
168+ ///
119169 /// # Errors
120170 ///
121- /// | Error | Reason |
122- /// |-------------------|-------------------------------|
123- /// | `LimitExceeded` | exceeds replica update limit |
124- /// | `IllegalArgument` | an argument is malformed |
171+ /// | Error | Reason |
172+ /// |--------------------- |-------------------------------|
173+ /// | [ `LimitExceeded`] | exceeds replica update limit |
174+ /// | [ `IllegalArgument`] | an argument is malformed |
125175 pub fn verify_replica_update( rep_off: * const u8 , rep_len: u32 ) -> Result <i32 >;
126176
127- /// Verifies an aggregated batch of sector seal proofs.
177+ /// Verifies a batch of sector seal proofs.
178+ ///
179+ /// # Arguments
180+ ///
181+ /// - `batch_off` and `batch_len` specify the location and length of a cbor-encoded list of
182+ /// [`SealVerifyInfo`][fvm_shared::sector::SealVerifyInfo] in tuple representation.
183+ /// - `results_off` specifies the location of a length `L` byte buffer where the results of the
184+ /// verification will be written, where `L` is the number of proofs in the batch. For each
185+ /// proof in the input list (in input order), a 1 or 0 byte will be written on success or
186+ /// failure, respectively.
128187 ///
129188 /// # Errors
130189 ///
131- /// | Error | Reason |
132- /// |-------------------|--------------------------|
133- /// | `IllegalArgument` | an argument is malformed |
190+ /// | Error | Reason |
191+ /// |--------------------- |--------------------------|
192+ /// | [ `IllegalArgument`] | an argument is malformed |
134193 pub fn batch_verify_seals( batch_off: * const u8 , batch_len: u32 , result_off: * const u8 ) -> Result <( ) >;
135194}
0 commit comments