11
11
#include "common.h"
12
12
#include "poly.h"
13
13
#include "polyvec.h"
14
+ #include "sys.h"
14
15
15
16
#define crypto_sign_keypair_internal MLD_NAMESPACE(keypair_internal)
16
17
/*************************************************
30
31
*
31
32
* Returns 0 (success) or -1 (PCT failure)
32
33
**************************************************/
34
+ MLD_MUST_CHECK_RETURN_VALUE
33
35
int crypto_sign_keypair_internal (uint8_t * pk , uint8_t * sk ,
34
36
const uint8_t seed [MLDSA_SEEDBYTES ])
35
37
__contract__ (
@@ -57,6 +59,7 @@ __contract__(
57
59
*
58
60
* Returns 0 (success) or -1 (PCT failure)
59
61
**************************************************/
62
+ MLD_MUST_CHECK_RETURN_VALUE
60
63
int crypto_sign_keypair (uint8_t * pk , uint8_t * sk )
61
64
__contract__ (
62
65
requires (memory_no_alias (pk , CRYPTO_PUBLICKEYBYTES ))
@@ -92,6 +95,7 @@ __contract__(
92
95
* in that it adds an explicit check for nonce exhaustion
93
96
* and can return -1 in that case.
94
97
**************************************************/
98
+ MLD_MUST_CHECK_RETURN_VALUE
95
99
int crypto_sign_signature_internal (uint8_t * sig , size_t * siglen ,
96
100
const uint8_t * m , size_t mlen ,
97
101
const uint8_t * pre , size_t prelen ,
@@ -130,6 +134,7 @@ __contract__(
130
134
*
131
135
* Returns 0 (success) or -1 (context string too long OR nonce exhaustion)
132
136
**************************************************/
137
+ MLD_MUST_CHECK_RETURN_VALUE
133
138
int crypto_sign_signature (uint8_t * sig , size_t * siglen , const uint8_t * m ,
134
139
size_t mlen , const uint8_t * ctx , size_t ctxlen ,
135
140
const uint8_t * sk )
@@ -160,6 +165,7 @@ __contract__(
160
165
*
161
166
* Returns 0 (success) or -1 (context string too long OR nonce exhaustion)
162
167
**************************************************/
168
+ MLD_MUST_CHECK_RETURN_VALUE
163
169
int crypto_sign_signature_extmu (uint8_t * sig , size_t * siglen ,
164
170
const uint8_t mu [MLDSA_CRHBYTES ],
165
171
const uint8_t * sk )
@@ -193,6 +199,7 @@ __contract__(
193
199
*
194
200
* Returns 0 (success) or -1 (context string too long OR nonce exhausted)
195
201
**************************************************/
202
+ MLD_MUST_CHECK_RETURN_VALUE
196
203
int crypto_sign (uint8_t * sm , size_t * smlen , const uint8_t * m , size_t mlen ,
197
204
const uint8_t * ctx , size_t ctxlen , const uint8_t * sk )
198
205
__contract__ (
@@ -225,6 +232,7 @@ __contract__(
225
232
*
226
233
* Returns 0 if signature could be verified correctly and -1 otherwise
227
234
**************************************************/
235
+ MLD_MUST_CHECK_RETURN_VALUE
228
236
int crypto_sign_verify_internal (const uint8_t * sig , size_t siglen ,
229
237
const uint8_t * m , size_t mlen ,
230
238
const uint8_t * pre , size_t prelen ,
@@ -256,6 +264,7 @@ __contract__(
256
264
*
257
265
* Returns 0 if signature could be verified correctly and -1 otherwise
258
266
**************************************************/
267
+ MLD_MUST_CHECK_RETURN_VALUE
259
268
int crypto_sign_verify (const uint8_t * sig , size_t siglen , const uint8_t * m ,
260
269
size_t mlen , const uint8_t * ctx , size_t ctxlen ,
261
270
const uint8_t * pk )
@@ -281,6 +290,7 @@ __contract__(
281
290
*
282
291
* Returns 0 if signature could be verified correctly and -1 otherwise
283
292
**************************************************/
293
+ MLD_MUST_CHECK_RETURN_VALUE
284
294
int crypto_sign_verify_extmu (const uint8_t * sig , size_t siglen ,
285
295
const uint8_t mu [MLDSA_CRHBYTES ],
286
296
const uint8_t * pk )
@@ -308,6 +318,7 @@ __contract__(
308
318
*
309
319
* Returns 0 if signed message could be verified correctly and -1 otherwise
310
320
**************************************************/
321
+ MLD_MUST_CHECK_RETURN_VALUE
311
322
int crypto_sign_open (uint8_t * m , size_t * mlen , const uint8_t * sm , size_t smlen ,
312
323
const uint8_t * ctx , size_t ctxlen , const uint8_t * pk )
313
324
__contract__ (
0 commit comments