diff --git a/constantine-rust/constantine-sys/src/bindings32.rs b/constantine-rust/constantine-sys/src/bindings32.rs index b8f9ced2..ab1f4eef 100644 --- a/constantine-rust/constantine-sys/src/bindings32.rs +++ b/constantine-rust/constantine-sys/src/bindings32.rs @@ -1,4 +1,4 @@ -/* automatically generated by rust-bindgen 0.69.1 */ +/* automatically generated by rust-bindgen 0.69.4 */ pub type secret_word = usize; pub type secret_bool = usize; @@ -99,7 +99,7 @@ extern "C" { pub fn ctt_sha256_update( ctx: *mut ctt_sha256_context, message: *const byte, - message_len: isize, + message_len: usize, ); } extern "C" { @@ -115,7 +115,7 @@ extern "C" { pub fn ctt_sha256_hash( digest: *mut byte, message: *const byte, - message_len: isize, + message_len: usize, clear_memory: bool, ); } @@ -214,27 +214,27 @@ fn bindgen_test_layout_big254() { } extern "C" { #[must_use] - pub fn ctt_big254_unmarshalBE(dst: *mut big254, src: *const byte, src_len: isize) -> bool; + pub fn ctt_big254_unmarshalBE(dst: *mut big254, src: *const byte, src_len: usize) -> bool; } extern "C" { #[must_use] - pub fn ctt_big254_marshalBE(dst: *mut byte, dst_len: isize, src: *const big254) -> bool; + pub fn ctt_big254_marshalBE(dst: *mut byte, dst_len: usize, src: *const big254) -> bool; } extern "C" { #[must_use] - pub fn ctt_big255_unmarshalBE(dst: *mut big255, src: *const byte, src_len: isize) -> bool; + pub fn ctt_big255_unmarshalBE(dst: *mut big255, src: *const byte, src_len: usize) -> bool; } extern "C" { #[must_use] - pub fn ctt_big255_marshalBE(dst: *mut byte, dst_len: isize, src: *const big255) -> bool; + pub fn ctt_big255_marshalBE(dst: *mut byte, dst_len: usize, src: *const big255) -> bool; } extern "C" { #[must_use] - pub fn ctt_big381_unmarshalBE(dst: *mut big381, src: *const byte, src_len: isize) -> bool; + pub fn ctt_big381_unmarshalBE(dst: *mut big381, src: *const byte, src_len: usize) -> bool; } extern "C" { #[must_use] - pub fn ctt_big381_marshalBE(dst: *mut byte, dst_len: isize, src: *const big381) -> bool; + pub fn ctt_big381_marshalBE(dst: *mut byte, dst_len: usize, src: *const big381) -> bool; } #[repr(C)] #[derive(Copy, Clone)] @@ -627,14 +627,14 @@ extern "C" { pub fn ctt_bls12_381_fr_unmarshalBE( dst: *mut bls12_381_fr, src: *const byte, - src_len: isize, + src_len: usize, ) -> bool; } extern "C" { #[must_use] pub fn ctt_bls12_381_fr_marshalBE( dst: *mut byte, - dst_len: isize, + dst_len: usize, src: *const bls12_381_fr, ) -> bool; } @@ -756,14 +756,14 @@ extern "C" { pub fn ctt_bls12_381_fp_unmarshalBE( dst: *mut bls12_381_fp, src: *const byte, - src_len: isize, + src_len: usize, ) -> bool; } extern "C" { #[must_use] pub fn ctt_bls12_381_fp_marshalBE( dst: *mut byte, - dst_len: isize, + dst_len: usize, src: *const bls12_381_fp, ) -> bool; } @@ -1927,14 +1927,14 @@ extern "C" { pub fn ctt_bn254_snarks_fr_unmarshalBE( dst: *mut bn254_snarks_fr, src: *const byte, - src_len: isize, + src_len: usize, ) -> bool; } extern "C" { #[must_use] pub fn ctt_bn254_snarks_fr_marshalBE( dst: *mut byte, - dst_len: isize, + dst_len: usize, src: *const bn254_snarks_fr, ) -> bool; } @@ -2067,14 +2067,14 @@ extern "C" { pub fn ctt_bn254_snarks_fp_unmarshalBE( dst: *mut bn254_snarks_fp, src: *const byte, - src_len: isize, + src_len: usize, ) -> bool; } extern "C" { #[must_use] pub fn ctt_bn254_snarks_fp_marshalBE( dst: *mut byte, - dst_len: isize, + dst_len: usize, src: *const bn254_snarks_fp, ) -> bool; } @@ -3103,12 +3103,12 @@ extern "C" { } extern "C" { #[must_use] - pub fn ctt_pallas_fr_unmarshalBE(dst: *mut pallas_fr, src: *const byte, src_len: isize) + pub fn ctt_pallas_fr_unmarshalBE(dst: *mut pallas_fr, src: *const byte, src_len: usize) -> bool; } extern "C" { #[must_use] - pub fn ctt_pallas_fr_marshalBE(dst: *mut byte, dst_len: isize, src: *const pallas_fr) -> bool; + pub fn ctt_pallas_fr_marshalBE(dst: *mut byte, dst_len: usize, src: *const pallas_fr) -> bool; } extern "C" { pub fn ctt_pallas_fr_is_eq(a: *const pallas_fr, b: *const pallas_fr) -> secret_bool; @@ -3205,12 +3205,12 @@ extern "C" { } extern "C" { #[must_use] - pub fn ctt_pallas_fp_unmarshalBE(dst: *mut pallas_fp, src: *const byte, src_len: isize) + pub fn ctt_pallas_fp_unmarshalBE(dst: *mut pallas_fp, src: *const byte, src_len: usize) -> bool; } extern "C" { #[must_use] - pub fn ctt_pallas_fp_marshalBE(dst: *mut byte, dst_len: isize, src: *const pallas_fp) -> bool; + pub fn ctt_pallas_fp_marshalBE(dst: *mut byte, dst_len: usize, src: *const pallas_fp) -> bool; } extern "C" { pub fn ctt_pallas_fp_is_eq(a: *const pallas_fp, b: *const pallas_fp) -> secret_bool; @@ -3766,11 +3766,11 @@ extern "C" { } extern "C" { #[must_use] - pub fn ctt_vesta_fr_unmarshalBE(dst: *mut vesta_fr, src: *const byte, src_len: isize) -> bool; + pub fn ctt_vesta_fr_unmarshalBE(dst: *mut vesta_fr, src: *const byte, src_len: usize) -> bool; } extern "C" { #[must_use] - pub fn ctt_vesta_fr_marshalBE(dst: *mut byte, dst_len: isize, src: *const vesta_fr) -> bool; + pub fn ctt_vesta_fr_marshalBE(dst: *mut byte, dst_len: usize, src: *const vesta_fr) -> bool; } extern "C" { pub fn ctt_vesta_fr_is_eq(a: *const vesta_fr, b: *const vesta_fr) -> secret_bool; @@ -3867,11 +3867,11 @@ extern "C" { } extern "C" { #[must_use] - pub fn ctt_vesta_fp_unmarshalBE(dst: *mut vesta_fp, src: *const byte, src_len: isize) -> bool; + pub fn ctt_vesta_fp_unmarshalBE(dst: *mut vesta_fp, src: *const byte, src_len: usize) -> bool; } extern "C" { #[must_use] - pub fn ctt_vesta_fp_marshalBE(dst: *mut byte, dst_len: isize, src: *const vesta_fp) -> bool; + pub fn ctt_vesta_fp_marshalBE(dst: *mut byte, dst_len: usize, src: *const vesta_fp) -> bool; } extern "C" { pub fn ctt_vesta_fp_is_eq(a: *const vesta_fp, b: *const vesta_fp) -> secret_bool; @@ -4768,7 +4768,7 @@ extern "C" { sig: *mut ctt_eth_bls_signature, seckey: *const ctt_eth_bls_seckey, message: *const byte, - message_len: isize, + message_len: usize, ); } extern "C" { @@ -4777,7 +4777,7 @@ extern "C" { pub fn ctt_eth_bls_verify( pubkey: *const ctt_eth_bls_pubkey, message: *const byte, - message_len: isize, + message_len: usize, sig: *const ctt_eth_bls_signature, ) -> ctt_eth_bls_status; } @@ -4786,9 +4786,9 @@ extern "C" { #[doc = " Check that a signature is valid for a message\n under the aggregate of provided public keys.\n returns `true` if the signature is valid, `false` otherwise.\n\n For message domain separation purpose, the tag is `BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_POP_`\n\n Input:\n - Public keys initialized by one of the key derivation or deserialization procedure.\n Or validated via validate_pubkey\n - A message\n - A signature initialized by one of the key derivation or deserialization procedure.\n Or validated via validate_signature\n\n In particular, the public keys and signature are assumed to be on curve subgroup checked."] pub fn ctt_eth_bls_fast_aggregate_verify( pubkeys: *const ctt_eth_bls_pubkey, - pubkeys_len: isize, + pubkeys_len: usize, message: *const byte, - message_len: isize, + message_len: usize, aggregate_sig: *const ctt_eth_bls_signature, ) -> ctt_eth_bls_status; } @@ -4798,7 +4798,7 @@ extern "C" { pub fn ctt_eth_bls_aggregate_verify( pubkeys: *const ctt_eth_bls_pubkey, messages: *const ctt_span, - len: isize, + len: usize, aggregate_sig: *const ctt_eth_bls_signature, ) -> ctt_eth_bls_status; } @@ -4809,7 +4809,7 @@ extern "C" { pubkeys: *const ctt_eth_bls_pubkey, messages: *const ctt_span, signatures: *const ctt_eth_bls_signature, - len: isize, + len: usize, secure_random_bytes: *const byte, ) -> ctt_eth_bls_status; } @@ -4827,7 +4827,7 @@ extern "C" { ctx: *mut ctt_eth_bls_batch_sig_accumulator, secure_random_bytes: *const byte, accum_sep_tag: *const byte, - accum_sep_tag_len: isize, + accum_sep_tag_len: usize, ); } extern "C" { @@ -4837,7 +4837,7 @@ extern "C" { ctx: *mut ctt_eth_bls_batch_sig_accumulator, pubkey: *const ctt_eth_bls_pubkey, message: *const byte, - message_len: isize, + message_len: usize, signature: *const ctt_eth_bls_signature, ) -> bool; } @@ -4856,7 +4856,7 @@ extern "C" { pubkey: *const ctt_eth_bls_pubkey, messages: *const ctt_span, sig: *const ctt_eth_bls_signature, - len: isize, + len: usize, secure_random_bytes: *const byte, ) -> ctt_eth_bls_status; } @@ -5192,9 +5192,18 @@ extern "C" { #[doc = " SHA256\n\n Inputs:\n - r: array with 32 bytes of storage for the result\n - r_len: length of `r`. Must be 32\n - inputs: Message to hash\n - inputs_len: length of the inputs array\n\n Output:\n - 32-byte digest\n - status code:\n cttEVM_Success\n cttEVM_InvalidOutputSize"] pub fn ctt_eth_evm_sha256( r: *mut byte, - r_len: isize, + r_len: usize, + inputs: *const byte, + inputs_len: usize, + ) -> ctt_evm_status; +} +extern "C" { + #[must_use] + #[doc = " Helper for `eth_evm_modexp`. Returns the size required to be allocated based on the\n given input. Call this function first, then allocate space for the result buffer\n in the call to `eth_evm_modexp` based on this function's result.\n\n The size depends on the `modulusLen`, which is the third 32 bytes,\n `inputs == [baseLen { 32 bytes }, exponentLen { 32 bytes }, modulusLen { 32 bytes }, ... ]`\n in `inputs`.\n\n The associated modulus length in bytes is the size required by the\n result to `eth_evm_modexp`."] + pub fn ctt_modexp_result_size( + size: *mut u64, inputs: *const byte, - inputs_len: isize, + inputs_len: usize, ) -> ctt_evm_status; } extern "C" { @@ -5202,9 +5211,9 @@ extern "C" { #[doc = " Modular exponentiation\n\n Name: MODEXP\n\n Inputs:\n - `baseLen`: 32 bytes base integer length (in bytes)\n - `exponentLen`: 32 bytes exponent length (in bytes)\n - `modulusLen`: 32 bytes modulus length (in bytes)\n - `base`: base integer (`baseLen` bytes)\n - `exponent`: exponent (`exponentLen` bytes)\n - `modulus`: modulus (`modulusLen` bytes)\n\n Output:\n - baseᵉˣᵖᵒⁿᵉⁿᵗ (mod modulus)\n The result buffer size `r` MUST match the modulusLen\n - status code:\n cttEVM_Success\n cttEVM_InvalidInputSize if the lengths require more than 32-bit or 64-bit addressing (depending on hardware)\n cttEVM_InvalidOutputSize\n\n Spec\n Yellow Paper Appendix E\n EIP-198 - https://github.com/ethereum/EIPs/blob/master/EIPS/eip-198.md\n\n Hardware considerations:\n This procedure stack allocates a table of (16+1)*modulusLen and many stack temporaries.\n Make sure to validate gas costs and reject large inputs to bound stack usage."] pub fn ctt_eth_evm_modexp( r: *mut byte, - r_len: isize, + r_len: usize, inputs: *const byte, - inputs_len: isize, + inputs_len: usize, ) -> ctt_evm_status; } extern "C" { @@ -5212,9 +5221,9 @@ extern "C" { #[doc = " Elliptic Curve addition on BN254_Snarks\n (also called alt_bn128 in Ethereum specs\n and bn256 in Ethereum tests)\n\n Name: ECADD\n\n Inputs:\n - A G1 point P with coordinates (Px, Py)\n - A G1 point Q with coordinates (Qx, Qy)\n\n Each coordinate is a 32-byte bigEndian integer\n They are serialized concatenated in a byte array [Px, Py, Qx, Qy]\n If the length is less than 128 bytes, input is virtually padded with zeros.\n If the length is greater than 128 bytes, input is truncated to 128 bytes.\n\n Output\n - Output buffer MUST be of length 64 bytes\n - A G1 point R = P+Q with coordinates (Rx, Ry)\n - Status code:\n cttEVM_Success\n cttEVM_InvalidOutputSize\n cttEVM_IntLargerThanModulus\n cttEVM_PointNotOnCurve\n\n Spec https://eips.ethereum.org/EIPS/eip-196"] pub fn ctt_eth_evm_bn254_g1add( r: *mut byte, - r_len: isize, + r_len: usize, inputs: *const byte, - inputs_len: isize, + inputs_len: usize, ) -> ctt_evm_status; } extern "C" { @@ -5222,9 +5231,9 @@ extern "C" { #[doc = " Elliptic Curve multiplication on BN254_Snarks\n (also called alt_bn128 in Ethereum specs\n and bn256 in Ethereum tests)\n\n Name: ECMUL\n\n Inputs:\n - A G1 point P with coordinates (Px, Py)\n - A scalar s in 0 ..< 2²⁵⁶\n\n Each coordinate is a 32-byte bigEndian integer\n r is a 32-byte bigEndian integer\n They are serialized concatenated in a byte array [Px, Py, r]\n If the length is less than 96 bytes, input is virtually padded with zeros.\n If the length is greater than 96 bytes, input is truncated to 96 bytes.\n\n Output\n - Output buffer MUST be of length 64 bytes\n - A G1 point R = [s]P\n - Status codes:\n cttEVM_Success\n cttEVM_IntLargerThanModulus\n cttEVM_PointNotOnCurve\n\n Spec https://eips.ethereum.org/EIPS/eip-196"] pub fn ctt_eth_evm_bn254_g1mul( r: *mut byte, - r_len: isize, + r_len: usize, inputs: *const byte, - inputs_len: isize, + inputs_len: usize, ) -> ctt_evm_status; } extern "C" { @@ -5232,9 +5241,9 @@ extern "C" { #[doc = " Elliptic Curve pairing check on BN254_Snarks\n (also called alt_bn128 in Ethereum specs\n and bn256 in Ethereum tests)\n\n Name: ECPAIRING / Pairing check\n\n Inputs:\n - An array of [(P0, Q0), (P1, Q1), ... (Pk, Qk)] points in (G1, G2)\n\n Output\n - Output buffer MUST be of length 32 bytes\n - 0 or 1 in uint256 BigEndian representation\n - Status codes:\n cttEVM_Success\n cttEVM_InvalidInputSize\n cttEVM_InvalidOutputSize\n cttEVM_IntLargerThanModulus\n cttEVM_PointNotOnCurve\n cttEVM_PointNotInSubgroup\n\n Specs https://eips.ethereum.org/EIPS/eip-197\n https://eips.ethereum.org/EIPS/eip-1108"] pub fn ctt_eth_evm_bn254_ecpairingcheck( r: *mut byte, - r_len: isize, + r_len: usize, inputs: *const byte, - inputs_len: isize, + inputs_len: usize, ) -> ctt_evm_status; } extern "C" { @@ -5242,9 +5251,9 @@ extern "C" { #[doc = " Elliptic Curve addition on BLS12-381 G1\n\n Name: BLS12_G1ADD\n\n Inputs:\n - A G1 point P with coordinates (Px, Py)\n - A G1 point Q with coordinates (Qx, Qy)\n - Input buffer MUST be 256 bytes\n\n Each coordinate is a 64-byte bigEndian integer\n They are serialized concatenated in a byte array [Px, Py, Qx, Qy]\n\n Inputs are NOT subgroup-checked.\n\n Output\n - Output buffer MUST be of length 128 bytes\n - A G1 point R=P+Q with coordinates (Rx, Ry)\n - Status codes:\n cttEVM_Success\n cttEVM_InvalidInputSize\n cttEVM_InvalidOutputSize\n cttEVM_IntLargerThanModulus\n cttEVM_PointNotOnCurve\n\n Spec https://eips.ethereum.org/EIPS/eip-2537"] pub fn ctt_eth_evm_bls12381_g1add( r: *mut byte, - r_len: isize, + r_len: usize, inputs: *const byte, - inputs_len: isize, + inputs_len: usize, ) -> ctt_evm_status; } extern "C" { @@ -5252,9 +5261,9 @@ extern "C" { #[doc = " Elliptic Curve addition on BLS12-381 G2\n\n Name: BLS12_G2ADD\n\n Inputs:\n - A G2 point P with coordinates (Px, Py)\n - A G2 point Q with coordinates (Qx, Qy)\n - Input buffer MUST be 512 bytes\n\n Each coordinate is a 128-byte bigEndian integer pair (a+𝑖b) with 𝑖 = √-1\n They are serialized concatenated in a byte array [Px, Py, Qx, Qy]\n\n Inputs are NOT subgroup-checked.\n\n Output\n - Output buffer MUST be of length 256 bytes\n - A G2 point R=P+Q with coordinates (Rx, Ry)\n - Status codes:\n cttEVM_Success\n cttEVM_InvalidInputSize\n cttEVM_InvalidOutputSize\n cttEVM_IntLargerThanModulus\n cttEVM_PointNotOnCurve\n\n Spec https://eips.ethereum.org/EIPS/eip-2537"] pub fn ctt_eth_evm_bls12381_g2add( r: *mut byte, - r_len: isize, + r_len: usize, inputs: *const byte, - inputs_len: isize, + inputs_len: usize, ) -> ctt_evm_status; } extern "C" { @@ -5262,9 +5271,9 @@ extern "C" { #[doc = " Elliptic Curve scalar multiplication on BLS12-381 G1\n\n Name: BLS12_G1MUL\n\n Inputs:\n - A G1 point P with coordinates (Px, Py)\n - A scalar s in 0 ..< 2²⁵⁶\n - Input buffer MUST be 160 bytes\n\n Each coordinate is a 64-byte bigEndian integer\n s is a 32-byte bigEndian integer\n They are serialized concatenated in a byte array [Px, Py, s]\n\n Output\n - Output buffer MUST be of length 128 bytes\n - A G1 point R=P+Q with coordinates (Rx, Ry)\n - Status code:\n cttEVM_Success\n cttEVM_InvalidInputSize\n cttEVM_InvalidOutputSize\n cttEVM_IntLargerThanModulus\n cttEVM_PointNotOnCurve\n\n Spec https://eips.ethereum.org/EIPS/eip-2537"] pub fn ctt_eth_evm_bls12381_g1mul( r: *mut byte, - r_len: isize, + r_len: usize, inputs: *const byte, - inputs_len: isize, + inputs_len: usize, ) -> ctt_evm_status; } extern "C" { @@ -5272,9 +5281,9 @@ extern "C" { #[doc = " Elliptic Curve scalar multiplication on BLS12-381 G2\n\n Name: BLS12_G2MUL\n\n Inputs:\n - A G2 point P with coordinates (Px, Py)\n - A scalar s in 0 ..< 2²⁵⁶\n - Input buffer MUST be 288 bytes\n\n Each coordinate is a 128-byte bigEndian integer pair (a+𝑖b) with 𝑖 = √-1\n s is a 32-byte bigEndian integer\n They are serialized concatenated in a byte array [Px, Py, s]\n\n Output\n - Output buffer MUST be of length 256 bytes\n - A G2 point R=P+Q with coordinates (Rx, Ry)\n - Status code:\n cttEVM_Success\n cttEVM_InvalidInputSize\n cttEVM_InvalidOutputSize\n cttEVM_IntLargerThanModulus\n cttEVM_PointNotOnCurve\n\n Spec https://eips.ethereum.org/EIPS/eip-2537"] pub fn ctt_eth_evm_bls12381_g2mul( r: *mut byte, - r_len: isize, + r_len: usize, inputs: *const byte, - inputs_len: isize, + inputs_len: usize, ) -> ctt_evm_status; } extern "C" { @@ -5282,9 +5291,9 @@ extern "C" { #[doc = " Elliptic Curve addition on BLS12-381 G1\n\n Name: BLS12_G1MSM\n\n Inputs:\n - A sequence of pairs of points\n - G1 points Pᵢ with coordinates (Pᵢx, Pᵢy)\n - scalar sᵢ in 0 ..< 2²⁵⁶\n - Each pair MUST be 160 bytes\n - The total length MUST be a multiple of 160 bytes\n\n Each coordinate is a 64-byte bigEndian integer\n s is a 32-byte bigEndian integer\n They are serialized concatenated in a byte array [(P₀x, P₀y, r₀), (P₁x, P₁y, r₁) ..., (Pₙx, Pₙy, rₙ)]\n\n Output\n - Output buffer MUST be of length 128 bytes\n - A G1 point R=P+Q with coordinates (Rx, Ry)\n - Status code:\n cttEVM_Success\n cttEVM_InvalidInputSize\n cttEVM_InvalidOutputSize\n cttEVM_IntLargerThanModulus\n cttEVM_PointNotOnCurve\n\n Spec https://eips.ethereum.org/EIPS/eip-2537"] pub fn ctt_eth_evm_bls12381_g1msm( r: *mut byte, - r_len: isize, + r_len: usize, inputs: *const byte, - inputs_len: isize, + inputs_len: usize, ) -> ctt_evm_status; } extern "C" { @@ -5292,9 +5301,9 @@ extern "C" { #[doc = " Elliptic Curve addition on BLS12-381 G2\n\n Name: BLS12_G2MSM\n\n Inputs:\n - A sequence of pairs of points\n - G2 points Pᵢ with coordinates (Pᵢx, Pᵢy)\n - scalar sᵢ in 0 ..< 2²⁵⁶\n - Each pair MUST be 288 bytes\n - The total length MUST be a multiple of 288 bytes\n\n Each coordinate is a 128-byte bigEndian integer pair (a+𝑖b) with 𝑖 = √-1\n s is a 32-byte bigEndian integer\n They are serialized concatenated in a byte array [(P₀x, P₀y, r₀), (P₁x, P₁y, r₁) ..., (Pₙx, Pₙy, rₙ)]\n\n Output\n - Output buffer MUST be of length 512 bytes\n - A G2 point R=P+Q with coordinates (Rx, Ry)\n - Status code:\n cttEVM_Success\n cttEVM_InvalidInputSize\n cttEVM_InvalidOutputSize\n cttEVM_IntLargerThanModulus\n cttEVM_PointNotOnCurve\n\n Spec https://eips.ethereum.org/EIPS/eip-2537"] pub fn ctt_eth_evm_bls12381_g2msm( r: *mut byte, - r_len: isize, + r_len: usize, inputs: *const byte, - inputs_len: isize, + inputs_len: usize, ) -> ctt_evm_status; } extern "C" { @@ -5302,9 +5311,9 @@ extern "C" { #[doc = " Elliptic curve pairing check on BLS12-381\n\n Name: BLS12_PAIRINGCHECK\n\n Inputs:\n - An array of [(P0, Q0), (P1, Q1), ... (Pk, Qk)] points in (G1, G2)\n\n Output\n - Output buffer MUST be of length 32 bytes\n - 0 or 1 in uint256 BigEndian representation\n - Status codes:\n cttEVM_Success\n cttEVM_InvalidInputSize\n cttEVM_InvalidOutputSize\n cttEVM_IntLargerThanModulus\n cttEVM_PointNotOnCurve\n cttEVM_PointNotInSubgroup\n\n specs https://eips.ethereum.org/EIPS/eip-2537"] pub fn ctt_eth_evm_bls12381_pairingcheck( r: *mut byte, - r_len: isize, + r_len: usize, inputs: *const byte, - inputs_len: isize, + inputs_len: usize, ) -> ctt_evm_status; } extern "C" { @@ -5312,9 +5321,9 @@ extern "C" { #[doc = " Map a field element to G1\n\n Name: BLS12_MAP_FP_TO_G1\n\n Input:\n - A field element in 0 ..< p, p the prime field of BLS12-381\n - The length MUST be a 48-byte (381-bit) number serialized in 64-byte big-endian number\n\n Output\n - Output buffer MUST be of length 64 bytes\n - A G1 point R with coordinates (Rx, Ry)\n - Status code:\n cttEVM_Success\n cttEVM_InvalidInputSize\n cttEVM_InvalidOutputSize\n cttEVM_IntLargerThanModulus\n\n Spec https://eips.ethereum.org/EIPS/eip-2537"] pub fn ctt_eth_evm_bls12381_map_fp_to_g1( r: *mut byte, - r_len: isize, + r_len: usize, inputs: *const byte, - inputs_len: isize, + inputs_len: usize, ) -> ctt_evm_status; } extern "C" { @@ -5322,8 +5331,8 @@ extern "C" { #[doc = " Map an Fp2 extension field element to G2\n\n Name: BLS12_MAP_FP2_TO_G2\n\n Input:\n - An extension field element in (0, 0) ..< (p, p), p the prime field of BLS12-381\n - The length MUST be a tuple of 48-byte (381-bit) number serialized in tuple of 64-byte big-endian numbers\n\n Output\n - Output buffer MUST be of length 128 bytes\n - A G2 point R with coordinates (Rx, Ry)\n - Status code:\n cttEVM_Success\n cttEVM_InvalidInputSize\n cttEVM_InvalidOutputSize\n cttEVM_IntLargerThanModulus\n\n Spec https://eips.ethereum.org/EIPS/eip-2537"] pub fn ctt_eth_evm_bls12381_map_fp2_to_g2( r: *mut byte, - r_len: isize, + r_len: usize, inputs: *const byte, - inputs_len: isize, + inputs_len: usize, ) -> ctt_evm_status; } diff --git a/constantine-rust/constantine-sys/src/bindings64.rs b/constantine-rust/constantine-sys/src/bindings64.rs index d6ff36e7..91d501cb 100644 --- a/constantine-rust/constantine-sys/src/bindings64.rs +++ b/constantine-rust/constantine-sys/src/bindings64.rs @@ -1,4 +1,4 @@ -/* automatically generated by rust-bindgen 0.69.1 */ +/* automatically generated by rust-bindgen 0.69.4 */ pub type secret_word = usize; pub type secret_bool = usize; @@ -99,7 +99,7 @@ extern "C" { pub fn ctt_sha256_update( ctx: *mut ctt_sha256_context, message: *const byte, - message_len: isize, + message_len: usize, ); } extern "C" { @@ -115,7 +115,7 @@ extern "C" { pub fn ctt_sha256_hash( digest: *mut byte, message: *const byte, - message_len: isize, + message_len: usize, clear_memory: bool, ); } @@ -214,27 +214,27 @@ fn bindgen_test_layout_big254() { } extern "C" { #[must_use] - pub fn ctt_big254_unmarshalBE(dst: *mut big254, src: *const byte, src_len: isize) -> bool; + pub fn ctt_big254_unmarshalBE(dst: *mut big254, src: *const byte, src_len: usize) -> bool; } extern "C" { #[must_use] - pub fn ctt_big254_marshalBE(dst: *mut byte, dst_len: isize, src: *const big254) -> bool; + pub fn ctt_big254_marshalBE(dst: *mut byte, dst_len: usize, src: *const big254) -> bool; } extern "C" { #[must_use] - pub fn ctt_big255_unmarshalBE(dst: *mut big255, src: *const byte, src_len: isize) -> bool; + pub fn ctt_big255_unmarshalBE(dst: *mut big255, src: *const byte, src_len: usize) -> bool; } extern "C" { #[must_use] - pub fn ctt_big255_marshalBE(dst: *mut byte, dst_len: isize, src: *const big255) -> bool; + pub fn ctt_big255_marshalBE(dst: *mut byte, dst_len: usize, src: *const big255) -> bool; } extern "C" { #[must_use] - pub fn ctt_big381_unmarshalBE(dst: *mut big381, src: *const byte, src_len: isize) -> bool; + pub fn ctt_big381_unmarshalBE(dst: *mut big381, src: *const byte, src_len: usize) -> bool; } extern "C" { #[must_use] - pub fn ctt_big381_marshalBE(dst: *mut byte, dst_len: isize, src: *const big381) -> bool; + pub fn ctt_big381_marshalBE(dst: *mut byte, dst_len: usize, src: *const big381) -> bool; } #[repr(C)] #[derive(Copy, Clone)] @@ -627,14 +627,14 @@ extern "C" { pub fn ctt_bls12_381_fr_unmarshalBE( dst: *mut bls12_381_fr, src: *const byte, - src_len: isize, + src_len: usize, ) -> bool; } extern "C" { #[must_use] pub fn ctt_bls12_381_fr_marshalBE( dst: *mut byte, - dst_len: isize, + dst_len: usize, src: *const bls12_381_fr, ) -> bool; } @@ -756,14 +756,14 @@ extern "C" { pub fn ctt_bls12_381_fp_unmarshalBE( dst: *mut bls12_381_fp, src: *const byte, - src_len: isize, + src_len: usize, ) -> bool; } extern "C" { #[must_use] pub fn ctt_bls12_381_fp_marshalBE( dst: *mut byte, - dst_len: isize, + dst_len: usize, src: *const bls12_381_fp, ) -> bool; } @@ -1927,14 +1927,14 @@ extern "C" { pub fn ctt_bn254_snarks_fr_unmarshalBE( dst: *mut bn254_snarks_fr, src: *const byte, - src_len: isize, + src_len: usize, ) -> bool; } extern "C" { #[must_use] pub fn ctt_bn254_snarks_fr_marshalBE( dst: *mut byte, - dst_len: isize, + dst_len: usize, src: *const bn254_snarks_fr, ) -> bool; } @@ -2067,14 +2067,14 @@ extern "C" { pub fn ctt_bn254_snarks_fp_unmarshalBE( dst: *mut bn254_snarks_fp, src: *const byte, - src_len: isize, + src_len: usize, ) -> bool; } extern "C" { #[must_use] pub fn ctt_bn254_snarks_fp_marshalBE( dst: *mut byte, - dst_len: isize, + dst_len: usize, src: *const bn254_snarks_fp, ) -> bool; } @@ -3103,12 +3103,12 @@ extern "C" { } extern "C" { #[must_use] - pub fn ctt_pallas_fr_unmarshalBE(dst: *mut pallas_fr, src: *const byte, src_len: isize) + pub fn ctt_pallas_fr_unmarshalBE(dst: *mut pallas_fr, src: *const byte, src_len: usize) -> bool; } extern "C" { #[must_use] - pub fn ctt_pallas_fr_marshalBE(dst: *mut byte, dst_len: isize, src: *const pallas_fr) -> bool; + pub fn ctt_pallas_fr_marshalBE(dst: *mut byte, dst_len: usize, src: *const pallas_fr) -> bool; } extern "C" { pub fn ctt_pallas_fr_is_eq(a: *const pallas_fr, b: *const pallas_fr) -> secret_bool; @@ -3205,12 +3205,12 @@ extern "C" { } extern "C" { #[must_use] - pub fn ctt_pallas_fp_unmarshalBE(dst: *mut pallas_fp, src: *const byte, src_len: isize) + pub fn ctt_pallas_fp_unmarshalBE(dst: *mut pallas_fp, src: *const byte, src_len: usize) -> bool; } extern "C" { #[must_use] - pub fn ctt_pallas_fp_marshalBE(dst: *mut byte, dst_len: isize, src: *const pallas_fp) -> bool; + pub fn ctt_pallas_fp_marshalBE(dst: *mut byte, dst_len: usize, src: *const pallas_fp) -> bool; } extern "C" { pub fn ctt_pallas_fp_is_eq(a: *const pallas_fp, b: *const pallas_fp) -> secret_bool; @@ -3766,11 +3766,11 @@ extern "C" { } extern "C" { #[must_use] - pub fn ctt_vesta_fr_unmarshalBE(dst: *mut vesta_fr, src: *const byte, src_len: isize) -> bool; + pub fn ctt_vesta_fr_unmarshalBE(dst: *mut vesta_fr, src: *const byte, src_len: usize) -> bool; } extern "C" { #[must_use] - pub fn ctt_vesta_fr_marshalBE(dst: *mut byte, dst_len: isize, src: *const vesta_fr) -> bool; + pub fn ctt_vesta_fr_marshalBE(dst: *mut byte, dst_len: usize, src: *const vesta_fr) -> bool; } extern "C" { pub fn ctt_vesta_fr_is_eq(a: *const vesta_fr, b: *const vesta_fr) -> secret_bool; @@ -3867,11 +3867,11 @@ extern "C" { } extern "C" { #[must_use] - pub fn ctt_vesta_fp_unmarshalBE(dst: *mut vesta_fp, src: *const byte, src_len: isize) -> bool; + pub fn ctt_vesta_fp_unmarshalBE(dst: *mut vesta_fp, src: *const byte, src_len: usize) -> bool; } extern "C" { #[must_use] - pub fn ctt_vesta_fp_marshalBE(dst: *mut byte, dst_len: isize, src: *const vesta_fp) -> bool; + pub fn ctt_vesta_fp_marshalBE(dst: *mut byte, dst_len: usize, src: *const vesta_fp) -> bool; } extern "C" { pub fn ctt_vesta_fp_is_eq(a: *const vesta_fp, b: *const vesta_fp) -> secret_bool; @@ -4768,7 +4768,7 @@ extern "C" { sig: *mut ctt_eth_bls_signature, seckey: *const ctt_eth_bls_seckey, message: *const byte, - message_len: isize, + message_len: usize, ); } extern "C" { @@ -4777,7 +4777,7 @@ extern "C" { pub fn ctt_eth_bls_verify( pubkey: *const ctt_eth_bls_pubkey, message: *const byte, - message_len: isize, + message_len: usize, sig: *const ctt_eth_bls_signature, ) -> ctt_eth_bls_status; } @@ -4786,9 +4786,9 @@ extern "C" { #[doc = " Check that a signature is valid for a message\n under the aggregate of provided public keys.\n returns `true` if the signature is valid, `false` otherwise.\n\n For message domain separation purpose, the tag is `BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_POP_`\n\n Input:\n - Public keys initialized by one of the key derivation or deserialization procedure.\n Or validated via validate_pubkey\n - A message\n - A signature initialized by one of the key derivation or deserialization procedure.\n Or validated via validate_signature\n\n In particular, the public keys and signature are assumed to be on curve subgroup checked."] pub fn ctt_eth_bls_fast_aggregate_verify( pubkeys: *const ctt_eth_bls_pubkey, - pubkeys_len: isize, + pubkeys_len: usize, message: *const byte, - message_len: isize, + message_len: usize, aggregate_sig: *const ctt_eth_bls_signature, ) -> ctt_eth_bls_status; } @@ -4798,7 +4798,7 @@ extern "C" { pub fn ctt_eth_bls_aggregate_verify( pubkeys: *const ctt_eth_bls_pubkey, messages: *const ctt_span, - len: isize, + len: usize, aggregate_sig: *const ctt_eth_bls_signature, ) -> ctt_eth_bls_status; } @@ -4809,7 +4809,7 @@ extern "C" { pubkeys: *const ctt_eth_bls_pubkey, messages: *const ctt_span, signatures: *const ctt_eth_bls_signature, - len: isize, + len: usize, secure_random_bytes: *const byte, ) -> ctt_eth_bls_status; } @@ -4827,7 +4827,7 @@ extern "C" { ctx: *mut ctt_eth_bls_batch_sig_accumulator, secure_random_bytes: *const byte, accum_sep_tag: *const byte, - accum_sep_tag_len: isize, + accum_sep_tag_len: usize, ); } extern "C" { @@ -4837,7 +4837,7 @@ extern "C" { ctx: *mut ctt_eth_bls_batch_sig_accumulator, pubkey: *const ctt_eth_bls_pubkey, message: *const byte, - message_len: isize, + message_len: usize, signature: *const ctt_eth_bls_signature, ) -> bool; } @@ -4856,7 +4856,7 @@ extern "C" { pubkey: *const ctt_eth_bls_pubkey, messages: *const ctt_span, sig: *const ctt_eth_bls_signature, - len: isize, + len: usize, secure_random_bytes: *const byte, ) -> ctt_eth_bls_status; } @@ -5192,9 +5192,18 @@ extern "C" { #[doc = " SHA256\n\n Inputs:\n - r: array with 32 bytes of storage for the result\n - r_len: length of `r`. Must be 32\n - inputs: Message to hash\n - inputs_len: length of the inputs array\n\n Output:\n - 32-byte digest\n - status code:\n cttEVM_Success\n cttEVM_InvalidOutputSize"] pub fn ctt_eth_evm_sha256( r: *mut byte, - r_len: isize, + r_len: usize, + inputs: *const byte, + inputs_len: usize, + ) -> ctt_evm_status; +} +extern "C" { + #[must_use] + #[doc = " Helper for `eth_evm_modexp`. Returns the size required to be allocated based on the\n given input. Call this function first, then allocate space for the result buffer\n in the call to `eth_evm_modexp` based on this function's result.\n\n The size depends on the `modulusLen`, which is the third 32 bytes,\n `inputs == [baseLen { 32 bytes }, exponentLen { 32 bytes }, modulusLen { 32 bytes }, ... ]`\n in `inputs`.\n\n The associated modulus length in bytes is the size required by the\n result to `eth_evm_modexp`."] + pub fn ctt_modexp_result_size( + size: *mut u64, inputs: *const byte, - inputs_len: isize, + inputs_len: usize, ) -> ctt_evm_status; } extern "C" { @@ -5202,9 +5211,9 @@ extern "C" { #[doc = " Modular exponentiation\n\n Name: MODEXP\n\n Inputs:\n - `baseLen`: 32 bytes base integer length (in bytes)\n - `exponentLen`: 32 bytes exponent length (in bytes)\n - `modulusLen`: 32 bytes modulus length (in bytes)\n - `base`: base integer (`baseLen` bytes)\n - `exponent`: exponent (`exponentLen` bytes)\n - `modulus`: modulus (`modulusLen` bytes)\n\n Output:\n - baseᵉˣᵖᵒⁿᵉⁿᵗ (mod modulus)\n The result buffer size `r` MUST match the modulusLen\n - status code:\n cttEVM_Success\n cttEVM_InvalidInputSize if the lengths require more than 32-bit or 64-bit addressing (depending on hardware)\n cttEVM_InvalidOutputSize\n\n Spec\n Yellow Paper Appendix E\n EIP-198 - https://github.com/ethereum/EIPs/blob/master/EIPS/eip-198.md\n\n Hardware considerations:\n This procedure stack allocates a table of (16+1)*modulusLen and many stack temporaries.\n Make sure to validate gas costs and reject large inputs to bound stack usage."] pub fn ctt_eth_evm_modexp( r: *mut byte, - r_len: isize, + r_len: usize, inputs: *const byte, - inputs_len: isize, + inputs_len: usize, ) -> ctt_evm_status; } extern "C" { @@ -5212,9 +5221,9 @@ extern "C" { #[doc = " Elliptic Curve addition on BN254_Snarks\n (also called alt_bn128 in Ethereum specs\n and bn256 in Ethereum tests)\n\n Name: ECADD\n\n Inputs:\n - A G1 point P with coordinates (Px, Py)\n - A G1 point Q with coordinates (Qx, Qy)\n\n Each coordinate is a 32-byte bigEndian integer\n They are serialized concatenated in a byte array [Px, Py, Qx, Qy]\n If the length is less than 128 bytes, input is virtually padded with zeros.\n If the length is greater than 128 bytes, input is truncated to 128 bytes.\n\n Output\n - Output buffer MUST be of length 64 bytes\n - A G1 point R = P+Q with coordinates (Rx, Ry)\n - Status code:\n cttEVM_Success\n cttEVM_InvalidOutputSize\n cttEVM_IntLargerThanModulus\n cttEVM_PointNotOnCurve\n\n Spec https://eips.ethereum.org/EIPS/eip-196"] pub fn ctt_eth_evm_bn254_g1add( r: *mut byte, - r_len: isize, + r_len: usize, inputs: *const byte, - inputs_len: isize, + inputs_len: usize, ) -> ctt_evm_status; } extern "C" { @@ -5222,9 +5231,9 @@ extern "C" { #[doc = " Elliptic Curve multiplication on BN254_Snarks\n (also called alt_bn128 in Ethereum specs\n and bn256 in Ethereum tests)\n\n Name: ECMUL\n\n Inputs:\n - A G1 point P with coordinates (Px, Py)\n - A scalar s in 0 ..< 2²⁵⁶\n\n Each coordinate is a 32-byte bigEndian integer\n r is a 32-byte bigEndian integer\n They are serialized concatenated in a byte array [Px, Py, r]\n If the length is less than 96 bytes, input is virtually padded with zeros.\n If the length is greater than 96 bytes, input is truncated to 96 bytes.\n\n Output\n - Output buffer MUST be of length 64 bytes\n - A G1 point R = [s]P\n - Status codes:\n cttEVM_Success\n cttEVM_IntLargerThanModulus\n cttEVM_PointNotOnCurve\n\n Spec https://eips.ethereum.org/EIPS/eip-196"] pub fn ctt_eth_evm_bn254_g1mul( r: *mut byte, - r_len: isize, + r_len: usize, inputs: *const byte, - inputs_len: isize, + inputs_len: usize, ) -> ctt_evm_status; } extern "C" { @@ -5232,9 +5241,9 @@ extern "C" { #[doc = " Elliptic Curve pairing check on BN254_Snarks\n (also called alt_bn128 in Ethereum specs\n and bn256 in Ethereum tests)\n\n Name: ECPAIRING / Pairing check\n\n Inputs:\n - An array of [(P0, Q0), (P1, Q1), ... (Pk, Qk)] points in (G1, G2)\n\n Output\n - Output buffer MUST be of length 32 bytes\n - 0 or 1 in uint256 BigEndian representation\n - Status codes:\n cttEVM_Success\n cttEVM_InvalidInputSize\n cttEVM_InvalidOutputSize\n cttEVM_IntLargerThanModulus\n cttEVM_PointNotOnCurve\n cttEVM_PointNotInSubgroup\n\n Specs https://eips.ethereum.org/EIPS/eip-197\n https://eips.ethereum.org/EIPS/eip-1108"] pub fn ctt_eth_evm_bn254_ecpairingcheck( r: *mut byte, - r_len: isize, + r_len: usize, inputs: *const byte, - inputs_len: isize, + inputs_len: usize, ) -> ctt_evm_status; } extern "C" { @@ -5242,9 +5251,9 @@ extern "C" { #[doc = " Elliptic Curve addition on BLS12-381 G1\n\n Name: BLS12_G1ADD\n\n Inputs:\n - A G1 point P with coordinates (Px, Py)\n - A G1 point Q with coordinates (Qx, Qy)\n - Input buffer MUST be 256 bytes\n\n Each coordinate is a 64-byte bigEndian integer\n They are serialized concatenated in a byte array [Px, Py, Qx, Qy]\n\n Inputs are NOT subgroup-checked.\n\n Output\n - Output buffer MUST be of length 128 bytes\n - A G1 point R=P+Q with coordinates (Rx, Ry)\n - Status codes:\n cttEVM_Success\n cttEVM_InvalidInputSize\n cttEVM_InvalidOutputSize\n cttEVM_IntLargerThanModulus\n cttEVM_PointNotOnCurve\n\n Spec https://eips.ethereum.org/EIPS/eip-2537"] pub fn ctt_eth_evm_bls12381_g1add( r: *mut byte, - r_len: isize, + r_len: usize, inputs: *const byte, - inputs_len: isize, + inputs_len: usize, ) -> ctt_evm_status; } extern "C" { @@ -5252,9 +5261,9 @@ extern "C" { #[doc = " Elliptic Curve addition on BLS12-381 G2\n\n Name: BLS12_G2ADD\n\n Inputs:\n - A G2 point P with coordinates (Px, Py)\n - A G2 point Q with coordinates (Qx, Qy)\n - Input buffer MUST be 512 bytes\n\n Each coordinate is a 128-byte bigEndian integer pair (a+𝑖b) with 𝑖 = √-1\n They are serialized concatenated in a byte array [Px, Py, Qx, Qy]\n\n Inputs are NOT subgroup-checked.\n\n Output\n - Output buffer MUST be of length 256 bytes\n - A G2 point R=P+Q with coordinates (Rx, Ry)\n - Status codes:\n cttEVM_Success\n cttEVM_InvalidInputSize\n cttEVM_InvalidOutputSize\n cttEVM_IntLargerThanModulus\n cttEVM_PointNotOnCurve\n\n Spec https://eips.ethereum.org/EIPS/eip-2537"] pub fn ctt_eth_evm_bls12381_g2add( r: *mut byte, - r_len: isize, + r_len: usize, inputs: *const byte, - inputs_len: isize, + inputs_len: usize, ) -> ctt_evm_status; } extern "C" { @@ -5262,9 +5271,9 @@ extern "C" { #[doc = " Elliptic Curve scalar multiplication on BLS12-381 G1\n\n Name: BLS12_G1MUL\n\n Inputs:\n - A G1 point P with coordinates (Px, Py)\n - A scalar s in 0 ..< 2²⁵⁶\n - Input buffer MUST be 160 bytes\n\n Each coordinate is a 64-byte bigEndian integer\n s is a 32-byte bigEndian integer\n They are serialized concatenated in a byte array [Px, Py, s]\n\n Output\n - Output buffer MUST be of length 128 bytes\n - A G1 point R=P+Q with coordinates (Rx, Ry)\n - Status code:\n cttEVM_Success\n cttEVM_InvalidInputSize\n cttEVM_InvalidOutputSize\n cttEVM_IntLargerThanModulus\n cttEVM_PointNotOnCurve\n\n Spec https://eips.ethereum.org/EIPS/eip-2537"] pub fn ctt_eth_evm_bls12381_g1mul( r: *mut byte, - r_len: isize, + r_len: usize, inputs: *const byte, - inputs_len: isize, + inputs_len: usize, ) -> ctt_evm_status; } extern "C" { @@ -5272,9 +5281,9 @@ extern "C" { #[doc = " Elliptic Curve scalar multiplication on BLS12-381 G2\n\n Name: BLS12_G2MUL\n\n Inputs:\n - A G2 point P with coordinates (Px, Py)\n - A scalar s in 0 ..< 2²⁵⁶\n - Input buffer MUST be 288 bytes\n\n Each coordinate is a 128-byte bigEndian integer pair (a+𝑖b) with 𝑖 = √-1\n s is a 32-byte bigEndian integer\n They are serialized concatenated in a byte array [Px, Py, s]\n\n Output\n - Output buffer MUST be of length 256 bytes\n - A G2 point R=P+Q with coordinates (Rx, Ry)\n - Status code:\n cttEVM_Success\n cttEVM_InvalidInputSize\n cttEVM_InvalidOutputSize\n cttEVM_IntLargerThanModulus\n cttEVM_PointNotOnCurve\n\n Spec https://eips.ethereum.org/EIPS/eip-2537"] pub fn ctt_eth_evm_bls12381_g2mul( r: *mut byte, - r_len: isize, + r_len: usize, inputs: *const byte, - inputs_len: isize, + inputs_len: usize, ) -> ctt_evm_status; } extern "C" { @@ -5282,9 +5291,9 @@ extern "C" { #[doc = " Elliptic Curve addition on BLS12-381 G1\n\n Name: BLS12_G1MSM\n\n Inputs:\n - A sequence of pairs of points\n - G1 points Pᵢ with coordinates (Pᵢx, Pᵢy)\n - scalar sᵢ in 0 ..< 2²⁵⁶\n - Each pair MUST be 160 bytes\n - The total length MUST be a multiple of 160 bytes\n\n Each coordinate is a 64-byte bigEndian integer\n s is a 32-byte bigEndian integer\n They are serialized concatenated in a byte array [(P₀x, P₀y, r₀), (P₁x, P₁y, r₁) ..., (Pₙx, Pₙy, rₙ)]\n\n Output\n - Output buffer MUST be of length 128 bytes\n - A G1 point R=P+Q with coordinates (Rx, Ry)\n - Status code:\n cttEVM_Success\n cttEVM_InvalidInputSize\n cttEVM_InvalidOutputSize\n cttEVM_IntLargerThanModulus\n cttEVM_PointNotOnCurve\n\n Spec https://eips.ethereum.org/EIPS/eip-2537"] pub fn ctt_eth_evm_bls12381_g1msm( r: *mut byte, - r_len: isize, + r_len: usize, inputs: *const byte, - inputs_len: isize, + inputs_len: usize, ) -> ctt_evm_status; } extern "C" { @@ -5292,9 +5301,9 @@ extern "C" { #[doc = " Elliptic Curve addition on BLS12-381 G2\n\n Name: BLS12_G2MSM\n\n Inputs:\n - A sequence of pairs of points\n - G2 points Pᵢ with coordinates (Pᵢx, Pᵢy)\n - scalar sᵢ in 0 ..< 2²⁵⁶\n - Each pair MUST be 288 bytes\n - The total length MUST be a multiple of 288 bytes\n\n Each coordinate is a 128-byte bigEndian integer pair (a+𝑖b) with 𝑖 = √-1\n s is a 32-byte bigEndian integer\n They are serialized concatenated in a byte array [(P₀x, P₀y, r₀), (P₁x, P₁y, r₁) ..., (Pₙx, Pₙy, rₙ)]\n\n Output\n - Output buffer MUST be of length 512 bytes\n - A G2 point R=P+Q with coordinates (Rx, Ry)\n - Status code:\n cttEVM_Success\n cttEVM_InvalidInputSize\n cttEVM_InvalidOutputSize\n cttEVM_IntLargerThanModulus\n cttEVM_PointNotOnCurve\n\n Spec https://eips.ethereum.org/EIPS/eip-2537"] pub fn ctt_eth_evm_bls12381_g2msm( r: *mut byte, - r_len: isize, + r_len: usize, inputs: *const byte, - inputs_len: isize, + inputs_len: usize, ) -> ctt_evm_status; } extern "C" { @@ -5302,9 +5311,9 @@ extern "C" { #[doc = " Elliptic curve pairing check on BLS12-381\n\n Name: BLS12_PAIRINGCHECK\n\n Inputs:\n - An array of [(P0, Q0), (P1, Q1), ... (Pk, Qk)] points in (G1, G2)\n\n Output\n - Output buffer MUST be of length 32 bytes\n - 0 or 1 in uint256 BigEndian representation\n - Status codes:\n cttEVM_Success\n cttEVM_InvalidInputSize\n cttEVM_InvalidOutputSize\n cttEVM_IntLargerThanModulus\n cttEVM_PointNotOnCurve\n cttEVM_PointNotInSubgroup\n\n specs https://eips.ethereum.org/EIPS/eip-2537"] pub fn ctt_eth_evm_bls12381_pairingcheck( r: *mut byte, - r_len: isize, + r_len: usize, inputs: *const byte, - inputs_len: isize, + inputs_len: usize, ) -> ctt_evm_status; } extern "C" { @@ -5312,9 +5321,9 @@ extern "C" { #[doc = " Map a field element to G1\n\n Name: BLS12_MAP_FP_TO_G1\n\n Input:\n - A field element in 0 ..< p, p the prime field of BLS12-381\n - The length MUST be a 48-byte (381-bit) number serialized in 64-byte big-endian number\n\n Output\n - Output buffer MUST be of length 64 bytes\n - A G1 point R with coordinates (Rx, Ry)\n - Status code:\n cttEVM_Success\n cttEVM_InvalidInputSize\n cttEVM_InvalidOutputSize\n cttEVM_IntLargerThanModulus\n\n Spec https://eips.ethereum.org/EIPS/eip-2537"] pub fn ctt_eth_evm_bls12381_map_fp_to_g1( r: *mut byte, - r_len: isize, + r_len: usize, inputs: *const byte, - inputs_len: isize, + inputs_len: usize, ) -> ctt_evm_status; } extern "C" { @@ -5322,8 +5331,8 @@ extern "C" { #[doc = " Map an Fp2 extension field element to G2\n\n Name: BLS12_MAP_FP2_TO_G2\n\n Input:\n - An extension field element in (0, 0) ..< (p, p), p the prime field of BLS12-381\n - The length MUST be a tuple of 48-byte (381-bit) number serialized in tuple of 64-byte big-endian numbers\n\n Output\n - Output buffer MUST be of length 128 bytes\n - A G2 point R with coordinates (Rx, Ry)\n - Status code:\n cttEVM_Success\n cttEVM_InvalidInputSize\n cttEVM_InvalidOutputSize\n cttEVM_IntLargerThanModulus\n\n Spec https://eips.ethereum.org/EIPS/eip-2537"] pub fn ctt_eth_evm_bls12381_map_fp2_to_g2( r: *mut byte, - r_len: isize, + r_len: usize, inputs: *const byte, - inputs_len: isize, + inputs_len: usize, ) -> ctt_evm_status; }