3
3
#[ doc( inline) ]
4
4
pub use fvm_shared:: sys:: out:: crypto:: * ;
5
5
6
+ // for documentation links
7
+ #[ cfg( doc) ]
8
+ use crate :: sys:: ErrorNumber :: * ;
9
+
6
10
super :: fvm_syscalls! {
7
11
module = "crypto" ;
8
12
9
13
/// Verifies that a signature is valid for an address and plaintext.
10
14
///
11
15
/// Returns 0 on success, or -1 if the signature fails to validate.
12
16
///
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
+ ///
13
23
/// # Errors
14
24
///
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 |
18
28
pub fn verify_signature(
19
29
sig_off: * const u8 ,
20
30
sig_len: u32 ,
@@ -26,13 +36,17 @@ super::fvm_syscalls! {
26
36
27
37
/// Hashes input data using blake2b with 256 bit output.
28
38
///
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.
30
44
///
31
45
/// # Errors
32
46
///
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 |
36
50
pub fn hash_blake2b(
37
51
data_off: * const u8 ,
38
52
data_len: u32 ,
@@ -44,11 +58,19 @@ super::fvm_syscalls! {
44
58
/// Writes the CID in the provided output buffer, and returns the length of
45
59
/// the written CID.
46
60
///
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
+ ///
47
69
/// # Errors
48
70
///
49
- /// | Error | Reason |
50
- /// |-------------------|--------------------------|
51
- /// | `IllegalArgument` | an argument is malformed |
71
+ /// | Error | Reason |
72
+ /// |--------------------- |--------------------------|
73
+ /// | [ `IllegalArgument`] | an argument is malformed |
52
74
pub fn compute_unsealed_sector_cid(
53
75
proof_type: i64 ,
54
76
pieces_off: * const u8 ,
@@ -61,22 +83,32 @@ super::fvm_syscalls! {
61
83
///
62
84
/// Returns 0 to indicate that the proof was valid, -1 otherwise.
63
85
///
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
+ ///
64
91
/// # Errors
65
92
///
66
- /// | Error | Reason |
67
- /// |-------------------|--------------------------|
68
- /// | `IllegalArgument` | an argument is malformed |
93
+ /// | Error | Reason |
94
+ /// |--------------------- |--------------------------|
95
+ /// | [ `IllegalArgument`] | an argument is malformed |
69
96
pub fn verify_seal( info_off: * const u8 , info_len: u32 ) -> Result <i32 >;
70
97
71
98
/// Verifies a window proof of spacetime.
72
99
///
73
100
/// Returns 0 to indicate that the proof was valid, -1 otherwise.
74
101
///
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
+ ///
75
107
/// # Errors
76
108
///
77
- /// | Error | Reason |
78
- /// |-------------------|--------------------------|
79
- /// | `IllegalArgument` | an argument is malformed |
109
+ /// | Error | Reason |
110
+ /// |--------------------- |--------------------------|
111
+ /// | [ `IllegalArgument`] | an argument is malformed |
80
112
pub fn verify_post( info_off: * const u8 , info_len: u32 ) -> Result <i32 >;
81
113
82
114
/// Verifies that two block headers provide proof of a consensus fault.
@@ -85,12 +117,19 @@ super::fvm_syscalls! {
85
117
/// BlockId containing the fault details. Otherwise, a -1 status is returned,
86
118
/// and the second result parameter must be ignored.
87
119
///
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
+ ///
88
127
/// # Errors
89
128
///
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 |
94
133
pub fn verify_consensus_fault(
95
134
h1_off: * const u8 ,
96
135
h1_len: u32 ,
@@ -104,32 +143,52 @@ super::fvm_syscalls! {
104
143
///
105
144
/// Returns 0 to indicate that the proof was valid, -1 otherwise.
106
145
///
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
+ ///
107
152
/// # Errors
108
153
///
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 |
113
158
pub fn verify_aggregate_seals( agg_off: * const u8 , agg_len: u32 ) -> Result <i32 >;
114
159
115
160
/// Verifies a replica update proof.
116
161
///
117
162
/// Returns 0 to indicate that the proof was valid, -1 otherwise.
118
163
///
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
+ ///
119
169
/// # Errors
120
170
///
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 |
125
175
pub fn verify_replica_update( rep_off: * const u8 , rep_len: u32 ) -> Result <i32 >;
126
176
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.
128
187
///
129
188
/// # Errors
130
189
///
131
- /// | Error | Reason |
132
- /// |-------------------|--------------------------|
133
- /// | `IllegalArgument` | an argument is malformed |
190
+ /// | Error | Reason |
191
+ /// |--------------------- |--------------------------|
192
+ /// | [ `IllegalArgument`] | an argument is malformed |
134
193
pub fn batch_verify_seals( batch_off: * const u8 , batch_len: u32 , result_off: * const u8 ) -> Result <( ) >;
135
194
}
0 commit comments