Skip to content

Commit 825f4a6

Browse files
Merge pull request #1194 from cryspen/jonas/hacl-rs-docs
Fix doc warnings in `libcrux-hacl-rs`
2 parents 8975f5d + b52dc03 commit 825f4a6

File tree

6 files changed

+174
-174
lines changed

6 files changed

+174
-174
lines changed

hacl-rs/src/bignum/bignum256.rs

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Write `a + b mod 2^256` in `res`.
1313
1414
This functions returns the carry.
1515
16-
The arguments a, b and res are meant to be 256-bit bignums, i.e. uint64_t[4]
16+
The arguments a, b and res are meant to be 256-bit bignums, i.e. `uint64_t\[4\]`
1717
*/
1818
pub fn add(a: &[u64], b: &[u64], res: &mut [u64]) -> u64 {
1919
let mut c: [u64; 1] = [0u64; 1usize];
@@ -45,7 +45,7 @@ Write `a - b mod 2^256` in `res`.
4545
4646
This functions returns the carry.
4747
48-
The arguments a, b and res are meant to be 256-bit bignums, i.e. uint64_t[4]
48+
The arguments a, b and res are meant to be 256-bit bignums, i.e. `uint64_t\[4\]`
4949
*/
5050
pub fn sub(a: &[u64], b: &[u64], res: &mut [u64]) -> u64 {
5151
let mut c: [u64; 1] = [0u64; 1usize];
@@ -76,7 +76,7 @@ pub fn sub(a: &[u64], b: &[u64], res: &mut [u64]) -> u64 {
7676
/**
7777
Write `(a + b) mod n` in `res`.
7878
79-
The arguments a, b, n and the outparam res are meant to be 256-bit bignums, i.e. uint64_t[4].
79+
The arguments a, b, n and the outparam res are meant to be 256-bit bignums, i.e. `uint64_t\[4\]`.
8080
8181
Before calling this function, the caller will need to ensure that the following
8282
preconditions are observed.
@@ -142,7 +142,7 @@ pub fn add_mod(n: &[u64], a: &[u64], b: &[u64], res: &mut [u64]) {
142142
/**
143143
Write `(a - b) mod n` in `res`.
144144
145-
The arguments a, b, n and the outparam res are meant to be 256-bit bignums, i.e. uint64_t[4].
145+
The arguments a, b, n and the outparam res are meant to be 256-bit bignums, i.e. `uint64_t\[4\]`.
146146
147147
Before calling this function, the caller will need to ensure that the following
148148
preconditions are observed.
@@ -209,8 +209,8 @@ pub fn sub_mod(n: &[u64], a: &[u64], b: &[u64], res: &mut [u64]) {
209209
/**
210210
Write `a * b` in `res`.
211211
212-
The arguments a and b are meant to be 256-bit bignums, i.e. uint64_t[4].
213-
The outparam res is meant to be a 512-bit bignum, i.e. uint64_t[8].
212+
The arguments a and b are meant to be 256-bit bignums, i.e. `uint64_t\[4\]`.
213+
The outparam res is meant to be a 512-bit bignum, i.e. `uint64_t\[8\]`.
214214
*/
215215
pub fn mul(a: &[u64], b: &[u64], res: &mut [u64]) {
216216
(res[0usize..8usize]).copy_from_slice(&[0u64; 8usize]);
@@ -245,8 +245,8 @@ pub fn mul(a: &[u64], b: &[u64], res: &mut [u64]) {
245245
/**
246246
Write `a * a` in `res`.
247247
248-
The argument a is meant to be a 256-bit bignum, i.e. uint64_t[4].
249-
The outparam res is meant to be a 512-bit bignum, i.e. uint64_t[8].
248+
The argument a is meant to be a 256-bit bignum, i.e. `uint64_t\[4\]`.
249+
The outparam res is meant to be a 512-bit bignum, i.e. `uint64_t\[8\]`.
250250
*/
251251
pub fn sqr(a: &[u64], res: &mut [u64]) {
252252
(res[0usize..8usize]).copy_from_slice(&[0u64; 8usize]);
@@ -476,8 +476,8 @@ fn bn_slow_precomp(n: &[u64], mu: u64, r2: &[u64], a: &[u64], res: &mut [u64]) {
476476
/**
477477
Write `a mod n` in `res`.
478478
479-
The argument a is meant to be a 512-bit bignum, i.e. uint64_t[8].
480-
The argument n and the outparam res are meant to be 256-bit bignums, i.e. uint64_t[4].
479+
The argument a is meant to be a 512-bit bignum, i.e. `uint64_t\[8\]`.
480+
The argument n and the outparam res are meant to be 256-bit bignums, i.e. `uint64_t\[4\]`.
481481
482482
The function returns false if any of the following preconditions are violated,
483483
true otherwise.
@@ -863,7 +863,7 @@ fn exp_consttime(nBits: u32, n: &[u64], a: &[u64], bBits: u32, b: &[u64], res: &
863863
/**
864864
Write `a ^ b mod n` in `res`.
865865
866-
The arguments a, n and the outparam res are meant to be 256-bit bignums, i.e. uint64_t[4].
866+
The arguments a, n and the outparam res are meant to be 256-bit bignums, i.e. `uint64_t\[4\]`.
867867
868868
The argument b is a bignum of any size, and bBits is an upper bound on the
869869
number of significant bits of b. A tighter bound results in faster execution
@@ -894,7 +894,7 @@ pub fn mod_exp_vartime(n: &[u64], a: &[u64], bBits: u32, b: &[u64], res: &mut [u
894894
/**
895895
Write `a ^ b mod n` in `res`.
896896
897-
The arguments a, n and the outparam res are meant to be 256-bit bignums, i.e. uint64_t[4].
897+
The arguments a, n and the outparam res are meant to be 256-bit bignums, i.e. `uint64_t\[4\]`.
898898
899899
The argument b is a bignum of any size, and bBits is an upper bound on the
900900
number of significant bits of b. A tighter bound results in faster execution
@@ -925,7 +925,7 @@ pub fn mod_exp_consttime(n: &[u64], a: &[u64], bBits: u32, b: &[u64], res: &mut
925925
/**
926926
Write `a ^ (-1) mod n` in `res`.
927927
928-
The arguments a, n and the outparam res are meant to be 256-bit bignums, i.e. uint64_t[4].
928+
The arguments a, n and the outparam res are meant to be 256-bit bignums, i.e. `uint64_t\[4\]`.
929929
930930
Before calling this function, the caller will need to ensure that the following
931931
preconditions are observed.
@@ -999,7 +999,7 @@ pub fn mod_inv_prime_vartime(n: &[u64], a: &[u64], res: &mut [u64]) -> bool {
999999
/**
10001000
Heap-allocate and initialize a montgomery context.
10011001
1002-
The argument n is meant to be a 256-bit bignum, i.e. uint64_t[4].
1002+
The argument n is meant to be a 256-bit bignum, i.e. `uint64_t\[4\]`.
10031003
10041004
Before calling this function, the caller will need to ensure that the following
10051005
preconditions are observed.
@@ -1031,8 +1031,8 @@ pub fn mont_ctx_init(n: &[u64]) -> Box<[super::base::bn_mont_ctx_u64]> {
10311031
/**
10321032
Write `a mod n` in `res`.
10331033
1034-
The argument a is meant to be a 512-bit bignum, i.e. uint64_t[8].
1035-
The outparam res is meant to be a 256-bit bignum, i.e. uint64_t[4].
1034+
The argument a is meant to be a 512-bit bignum, i.e. `uint64_t\[8\]`.
1035+
The outparam res is meant to be a 256-bit bignum, i.e. `uint64_t\[4\]`.
10361036
The argument k is a montgomery context obtained through Hacl_Bignum256_mont_ctx_init.
10371037
*/
10381038
pub fn mod_precomp(k: &[super::base::bn_mont_ctx_u64], a: &[u64], res: &mut [u64]) {
@@ -1045,7 +1045,7 @@ pub fn mod_precomp(k: &[super::base::bn_mont_ctx_u64], a: &[u64], res: &mut [u64
10451045
/**
10461046
Write `a ^ b mod n` in `res`.
10471047
1048-
The arguments a and the outparam res are meant to be 256-bit bignums, i.e. uint64_t[4].
1048+
The arguments a and the outparam res are meant to be 256-bit bignums, i.e. `uint64_t\[4\]`.
10491049
The argument k is a montgomery context obtained through Hacl_Bignum256_mont_ctx_init.
10501050
10511051
The argument b is a bignum of any size, and bBits is an upper bound on the
@@ -1077,7 +1077,7 @@ pub fn mod_exp_vartime_precomp(
10771077
/**
10781078
Write `a ^ b mod n` in `res`.
10791079
1080-
The arguments a and the outparam res are meant to be 256-bit bignums, i.e. uint64_t[4].
1080+
The arguments a and the outparam res are meant to be 256-bit bignums, i.e. `uint64_t\[4\]`.
10811081
The argument k is a montgomery context obtained through Hacl_Bignum256_mont_ctx_init.
10821082
10831083
The argument b is a bignum of any size, and bBits is an upper bound on the
@@ -1109,7 +1109,7 @@ pub fn mod_exp_consttime_precomp(
11091109
/**
11101110
Write `a ^ (-1) mod n` in `res`.
11111111
1112-
The argument a and the outparam res are meant to be 256-bit bignums, i.e. uint64_t[4].
1112+
The argument a and the outparam res are meant to be 256-bit bignums, i.e. `uint64_t\[4\]`.
11131113
The argument k is a montgomery context obtained through Hacl_Bignum256_mont_ctx_init.
11141114
11151115
Before calling this function, the caller will need to ensure that the following
@@ -1267,7 +1267,7 @@ pub fn bn_to_bytes_le(b: &[u64], res: &mut [u8]) {
12671267
/**
12681268
Returns 2^64 - 1 if a < b, otherwise returns 0.
12691269
1270-
The arguments a and b are meant to be 256-bit bignums, i.e. uint64_t[4].
1270+
The arguments a and b are meant to be 256-bit bignums, i.e. `uint64_t\[4\]`.
12711271
*/
12721272
pub fn lt_mask(a: &[u64], b: &[u64]) -> u64 {
12731273
let mut acc: [u64; 1] = [0u64; 1usize];
@@ -1282,7 +1282,7 @@ pub fn lt_mask(a: &[u64], b: &[u64]) -> u64 {
12821282
/**
12831283
Returns 2^64 - 1 if a = b, otherwise returns 0.
12841284
1285-
The arguments a and b are meant to be 256-bit bignums, i.e. uint64_t[4].
1285+
The arguments a and b are meant to be 256-bit bignums, i.e. `uint64_t\[4\]`.
12861286
*/
12871287
pub fn eq_mask(a: &[u64], b: &[u64]) -> u64 {
12881288
let mut mask: [u64; 1] = [0xFFFFFFFFFFFFFFFFu64; 1usize];

hacl-rs/src/bignum/bignum256_32.rs

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Write `a + b mod 2^256` in `res`.
1313
1414
This functions returns the carry.
1515
16-
The arguments a, b and res are meant to be 256-bit bignums, i.e. uint32_t[8]
16+
The arguments a, b and res are meant to be 256-bit bignums, i.e. `uint32_t\[8\]`
1717
*/
1818
pub fn add(a: &[u32], b: &[u32], res: &mut [u32]) -> u32 {
1919
let mut c: [u32; 1] = [0u32; 1usize];
@@ -45,7 +45,7 @@ Write `a - b mod 2^256` in `res`.
4545
4646
This functions returns the carry.
4747
48-
The arguments a, b and res are meant to be 256-bit bignums, i.e. uint32_t[8]
48+
The arguments a, b and res are meant to be 256-bit bignums, i.e. `uint32_t\[8\]`
4949
*/
5050
pub fn sub(a: &[u32], b: &[u32], res: &mut [u32]) -> u32 {
5151
let mut c: [u32; 1] = [0u32; 1usize];
@@ -76,7 +76,7 @@ pub fn sub(a: &[u32], b: &[u32], res: &mut [u32]) -> u32 {
7676
/**
7777
Write `(a + b) mod n` in `res`.
7878
79-
The arguments a, b, n and the outparam res are meant to be 256-bit bignums, i.e. uint32_t[8].
79+
The arguments a, b, n and the outparam res are meant to be 256-bit bignums, i.e. `uint32_t\[8\]`.
8080
8181
Before calling this function, the caller will need to ensure that the following
8282
preconditions are observed.
@@ -142,7 +142,7 @@ pub fn add_mod(n: &[u32], a: &[u32], b: &[u32], res: &mut [u32]) {
142142
/**
143143
Write `(a - b) mod n` in `res`.
144144
145-
The arguments a, b, n and the outparam res are meant to be 256-bit bignums, i.e. uint32_t[8].
145+
The arguments a, b, n and the outparam res are meant to be 256-bit bignums, i.e. `uint32_t\[8\]`.
146146
147147
Before calling this function, the caller will need to ensure that the following
148148
preconditions are observed.
@@ -209,8 +209,8 @@ pub fn sub_mod(n: &[u32], a: &[u32], b: &[u32], res: &mut [u32]) {
209209
/**
210210
Write `a * b` in `res`.
211211
212-
The arguments a and b are meant to be 256-bit bignums, i.e. uint32_t[8].
213-
The outparam res is meant to be a 512-bit bignum, i.e. uint32_t[16].
212+
The arguments a and b are meant to be 256-bit bignums, i.e. `uint32_t\[8\]`.
213+
The outparam res is meant to be a 512-bit bignum, i.e. `uint32_t\[16\]`.
214214
*/
215215
pub fn mul(a: &[u32], b: &[u32], res: &mut [u32]) {
216216
(res[0usize..16usize]).copy_from_slice(&[0u32; 16usize]);
@@ -245,8 +245,8 @@ pub fn mul(a: &[u32], b: &[u32], res: &mut [u32]) {
245245
/**
246246
Write `a * a` in `res`.
247247
248-
The argument a is meant to be a 256-bit bignum, i.e. uint32_t[8].
249-
The outparam res is meant to be a 512-bit bignum, i.e. uint32_t[16].
248+
The argument a is meant to be a 256-bit bignum, i.e. `uint32_t\[8\]`.
249+
The outparam res is meant to be a 512-bit bignum, i.e. `uint32_t\[16\]`.
250250
*/
251251
pub fn sqr(a: &[u32], res: &mut [u32]) {
252252
(res[0usize..16usize]).copy_from_slice(&[0u32; 16usize]);
@@ -476,8 +476,8 @@ fn bn_slow_precomp(n: &[u32], mu: u32, r2: &[u32], a: &[u32], res: &mut [u32]) {
476476
/**
477477
Write `a mod n` in `res`.
478478
479-
The argument a is meant to be a 512-bit bignum, i.e. uint32_t[16].
480-
The argument n and the outparam res are meant to be 256-bit bignums, i.e. uint32_t[8].
479+
The argument a is meant to be a 512-bit bignum, i.e. `uint32_t\[16\]`.
480+
The argument n and the outparam res are meant to be 256-bit bignums, i.e. `uint32_t\[8\]`.
481481
482482
The function returns false if any of the following preconditions are violated,
483483
true otherwise.
@@ -863,7 +863,7 @@ fn exp_consttime(nBits: u32, n: &[u32], a: &[u32], bBits: u32, b: &[u32], res: &
863863
/**
864864
Write `a ^ b mod n` in `res`.
865865
866-
The arguments a, n and the outparam res are meant to be 256-bit bignums, i.e. uint32_t[8].
866+
The arguments a, n and the outparam res are meant to be 256-bit bignums, i.e. `uint32_t\[8\]`.
867867
868868
The argument b is a bignum of any size, and bBits is an upper bound on the
869869
number of significant bits of b. A tighter bound results in faster execution
@@ -894,7 +894,7 @@ pub fn mod_exp_vartime(n: &[u32], a: &[u32], bBits: u32, b: &[u32], res: &mut [u
894894
/**
895895
Write `a ^ b mod n` in `res`.
896896
897-
The arguments a, n and the outparam res are meant to be 256-bit bignums, i.e. uint32_t[8].
897+
The arguments a, n and the outparam res are meant to be 256-bit bignums, i.e. `uint32_t\[8\]`.
898898
899899
The argument b is a bignum of any size, and bBits is an upper bound on the
900900
number of significant bits of b. A tighter bound results in faster execution
@@ -925,7 +925,7 @@ pub fn mod_exp_consttime(n: &[u32], a: &[u32], bBits: u32, b: &[u32], res: &mut
925925
/**
926926
Write `a ^ (-1) mod n` in `res`.
927927
928-
The arguments a, n and the outparam res are meant to be 256-bit bignums, i.e. uint32_t[8].
928+
The arguments a, n and the outparam res are meant to be 256-bit bignums, i.e. `uint32_t\[8\]`.
929929
930930
Before calling this function, the caller will need to ensure that the following
931931
preconditions are observed.
@@ -1018,7 +1018,7 @@ pub fn mod_inv_prime_vartime(n: &[u32], a: &[u32], res: &mut [u32]) -> bool {
10181018
/**
10191019
Heap-allocate and initialize a montgomery context.
10201020
1021-
The argument n is meant to be a 256-bit bignum, i.e. uint32_t[8].
1021+
The argument n is meant to be a 256-bit bignum, i.e. `uint32_t\[8\]`.
10221022
10231023
Before calling this function, the caller will need to ensure that the following
10241024
preconditions are observed.
@@ -1050,8 +1050,8 @@ pub fn mont_ctx_init(n: &[u32]) -> Box<[super::base::bn_mont_ctx_u32]> {
10501050
/**
10511051
Write `a mod n` in `res`.
10521052
1053-
The argument a is meant to be a 512-bit bignum, i.e. uint32_t[16].
1054-
The outparam res is meant to be a 256-bit bignum, i.e. uint32_t[8].
1053+
The argument a is meant to be a 512-bit bignum, i.e. `uint32_t\[16\]`.
1054+
The outparam res is meant to be a 256-bit bignum, i.e. `uint32_t\[8\]`.
10551055
The argument k is a montgomery context obtained through Hacl_Bignum256_mont_ctx_init.
10561056
*/
10571057
pub fn mod_precomp(k: &[super::base::bn_mont_ctx_u32], a: &[u32], res: &mut [u32]) {
@@ -1064,7 +1064,7 @@ pub fn mod_precomp(k: &[super::base::bn_mont_ctx_u32], a: &[u32], res: &mut [u32
10641064
/**
10651065
Write `a ^ b mod n` in `res`.
10661066
1067-
The arguments a and the outparam res are meant to be 256-bit bignums, i.e. uint32_t[8].
1067+
The arguments a and the outparam res are meant to be 256-bit bignums, i.e. `uint32_t\[8\]`.
10681068
The argument k is a montgomery context obtained through Hacl_Bignum256_mont_ctx_init.
10691069
10701070
The argument b is a bignum of any size, and bBits is an upper bound on the
@@ -1096,7 +1096,7 @@ pub fn mod_exp_vartime_precomp(
10961096
/**
10971097
Write `a ^ b mod n` in `res`.
10981098
1099-
The arguments a and the outparam res are meant to be 256-bit bignums, i.e. uint32_t[8].
1099+
The arguments a and the outparam res are meant to be 256-bit bignums, i.e. `uint32_t\[8\]`.
11001100
The argument k is a montgomery context obtained through Hacl_Bignum256_mont_ctx_init.
11011101
11021102
The argument b is a bignum of any size, and bBits is an upper bound on the
@@ -1128,7 +1128,7 @@ pub fn mod_exp_consttime_precomp(
11281128
/**
11291129
Write `a ^ (-1) mod n` in `res`.
11301130
1131-
The argument a and the outparam res are meant to be 256-bit bignums, i.e. uint32_t[8].
1131+
The argument a and the outparam res are meant to be 256-bit bignums, i.e. `uint32_t\[8\]`.
11321132
The argument k is a montgomery context obtained through Hacl_Bignum256_mont_ctx_init.
11331133
11341134
Before calling this function, the caller will need to ensure that the following
@@ -1304,7 +1304,7 @@ pub fn bn_to_bytes_le(b: &[u32], res: &mut [u8]) {
13041304
/**
13051305
Returns 2^32 - 1 if a < b, otherwise returns 0.
13061306
1307-
The arguments a and b are meant to be 256-bit bignums, i.e. uint32_t[8].
1307+
The arguments a and b are meant to be 256-bit bignums, i.e. `uint32_t\[8\]`.
13081308
*/
13091309
pub fn lt_mask(a: &[u32], b: &[u32]) -> u32 {
13101310
let mut acc: [u32; 1] = [0u32; 1usize];
@@ -1319,7 +1319,7 @@ pub fn lt_mask(a: &[u32], b: &[u32]) -> u32 {
13191319
/**
13201320
Returns 2^32 - 1 if a = b, otherwise returns 0.
13211321
1322-
The arguments a and b are meant to be 256-bit bignums, i.e. uint32_t[8].
1322+
The arguments a and b are meant to be 256-bit bignums, i.e. `uint32_t\[8\]`.
13231323
*/
13241324
pub fn eq_mask(a: &[u32], b: &[u32]) -> u32 {
13251325
let mut mask: [u32; 1] = [0xFFFFFFFFu32; 1usize];

0 commit comments

Comments
 (0)