Skip to content

Commit

Permalink
Update comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
yarkinwho committed Nov 16, 2023
1 parent dfb05c5 commit e1f67e9
Showing 1 changed file with 39 additions and 39 deletions.
78 changes: 39 additions & 39 deletions libraries/chain/include/eosio/chain/webassembly/interface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1707,7 +1707,7 @@ namespace webassembly {
* @param op1 - a span containing the first operand G1 point.
* @param op2 - a span containing the second operand G1 point.
* @param[out] result - the result op1 + op2.
* @return -1 if there was an error 0 otherwise
* @return -1 if there was an error, 0 otherwise
*/
int32_t alt_bn128_add(span<const char> op1, span<const char> op2, span<char> result) const;

Expand All @@ -1718,7 +1718,7 @@ namespace webassembly {
* @param g1_point - a span containing G1 point.
* @param scalar - a span containing the scalar.
* @param[out] result - g1 * scalar.
* @return -1 if there was an error 0 otherwise
* @return -1 if there was an error, 0 otherwise
*/
int32_t alt_bn128_mul(span<const char> g1_point, span<const char> scalar, span<char> result) const;

Expand All @@ -1742,7 +1742,7 @@ namespace webassembly {
* @param exp - a span containing EXPONENT.
* @param modulus - a span containing MODULUS.
* @param[out] out - the result (BASE**EXPONENT) % MODULUS
* @return -1 if there was an error 0 otherwise
* @return -1 if there was an error, 0 otherwise
*/
int32_t mod_exp(span<const char> base, span<const char> exp, span<const char> modulus, span<char> out) const;

Expand All @@ -1759,7 +1759,7 @@ namespace webassembly {
* @param t1_offset - offset counters - unsigned 64-bit little-endian word
* @param final - the final block indicator flag - (1-true, all other values == false)
* @param[out] result - the result
* @return -1 if there was an error 0 otherwise
* @return -1 if there was an error, 0 otherwise
*/
int32_t blake2_f( uint32_t rounds, span<const char> state, span<const char> message, span<const char> t0_offset, span<const char> t1_offset, int32_t final, span<char> result) const;

Expand All @@ -1781,85 +1781,85 @@ namespace webassembly {
* @param digest - digest of the message that was signed.
* @param[out] pub - output buffer for the public key result.
*
* @return -1 if there was an error 0 otherwise.
* @return -1 if there was an error, 0 otherwise.
*/
int32_t k1_recover( span<const char> signature, span<const char> digest, span<char> pub) const;

/**
* Host function for G1 addition on the elliptic curve bls12-381
*
* @ingroup crypto
* @param op1 - a span containing the first operand G1 point.
* @param op2 - a span containing the second operand G1 point.
* @param[out] result - the result op1 + op2.
* @return -1 if there was an error 0 otherwise
* @param op1 - a span containing the affine coordingates of the first operand G1 point - 96 bytes little-endian.
* @param op2 - a span containing the affine coordingates of the second operand G1 point - 96 bytes little-endian.
* @param[out] result - the result op1 + op2 - 96 bytes little-endian.
* @return -1 if there was an error, 0 otherwise
*/
int32_t bls_g1_add(span<const char> op1, span<const char> op2, span<char> result) const;

/**
* Host function for G2 addition on the elliptic curve bls12-381
*
* @ingroup crypto
* @param op1 - a span containing the first operand G2 point.
* @param op2 - a span containing the second operand G2 point.
* @param[out] result - the result op1 + op2.
* @return -1 if there was an error 0 otherwise
* @param op1 - a span containing the affine coordingates of the first operand G2 point - 192 bytes little-endian.
* @param op2 - a span containing the affine coordingates of the second operand G2 point - 192 bytes little-endian.
* @param[out] result - the result op1 + op2 - 192 bytes little-endian.
* @return -1 if there was an error, 0 otherwise
*/
int32_t bls_g2_add(span<const char> op1, span<const char> op2, span<char> result) const;

/**
* Host function for G1 weighted sum (multi-exponentiation) on the elliptic curve bls12-381
*
* @ingroup crypto
* @param points - a span containing a list of G1 points (P0, P1, P2... Pn).
* @param scalars - a span containing a list of scalars (s0, s1, s2... sn).
* @param points - a span containing a list of G1 points (P0, P1, P2... Pn) - 96*n bytes little-endian.
* @param scalars - a span containing a list of 32 byte scalars (s0, s1, s2... sn) - 32*n bytes little-endian.
* @param n - the number of elements in the lists.
* @param[out] result - the result s0 * P0 + s1 * P1 + ... + sn * Pn.
* @return -1 if there was an error 0 otherwise
* @return -1 if there was an error, 0 otherwise
*/
int32_t bls_g1_weighted_sum(span<const char> points, span<const char> scalars, const uint32_t n, span<char> result) const;

/**
* Host function for G2 weighted sum (multi-exponentiation) on the elliptic curve bls12-381
*
* @ingroup crypto
* @param points - a span containing a list of G2 points (P0, P1, P2... Pn).
* @param scalars - a span containing a list of scalars (s0, s1, s2... sn).
* @param points - a span containing a list of G2 points (P0, P1, P2... Pn) - 192*n bytes little-endian.
* @param scalars - a span containing a list of 32 byte scalars (s0, s1, s2... sn) - 32*n bytes little-endian.
* @param n - the number of elements in the lists.
* @param[out] result - the result s0 * P0 + s1 * P1 + ... + sn * Pn.
* @return -1 if there was an error 0 otherwise
* @param[out] result - the result s0 * P0 + s1 * P1 + ... + sn * Pn - 192 bytes little-endian.
* @return -1 if there was an error, 0 otherwise
*/
int32_t bls_g2_weighted_sum(span<const char> points, span<const char> scalars, const uint32_t n, span<char> result) const;

/**
* Host function to calculate the pairing of (G1, G2) pairs on the elliptic curve bls12-381
*
* @ingroup crypto
* @param g1_points - a span containing a list of G1 points (P0, P1, P2... Pn).
* @param g2_points - a span containing a list of G2 points (P0, P1, P2... Pn).
* @param g1_points - a span containing a list of G1 points (P0, P1, P2... Pn) - 96*n bytes little-endian.
* @param g2_points - a span containing a list of G2 points (P0, P1, P2... Pn) - 192*n bytes little-endian..
* @param n - the number of elements in the lists.
* @param[out] result - the result e(g1_0, g2_0) * e(g1_1, g2_1) * ... * e(g1_n, g2_n)
* @return -1 if there was an error 0 otherwise
* @param[out] result - the result e(g1_0, g2_0) * e(g1_1, g2_1) * ... * e(g1_n, g2_n) - 576 bytes little-endian.
* @return -1 if there was an error, 0 otherwise
*/
int32_t bls_pairing(span<const char> g1_points, span<const char> g2_points, const uint32_t n, span<char> result) const;

/**
* Host function for mapping fp to G1 on the elliptic curve bls12-381
*
* @ingroup crypto
* @param e - a span containing the field element fp to be mapped.
* @param[out] result - the resulting element in G1.
* @return -1 if there was an error 0 otherwise
* @param e - a span containing the field element fp to be mapped - 48 bytes little-endian.
* @param[out] result - the resulting element in G1 - 96 bytes little-endian.
* @return -1 if there was an error, 0 otherwise
*/
int32_t bls_g1_map(span<const char> e, span<char> result) const;

/**
* Host function for mapping fp2 to G2 on the elliptic curve bls12-381
*
* @ingroup crypto
* @param e - a span containing the field element fp2 to be mapped.
* @param[out] result - the resulting element in G2.
* @return -1 if there was an error 0 otherwise
* @param e - a span containing the field element fp2 to be mapped - 96 bytes little-endian.
* @param[out] result - the resulting element in G2 - 192 bytes little-endian.
* @return -1 if there was an error, 0 otherwise
*/
int32_t bls_g2_map(span<const char> e, span<char> result) const;

Expand All @@ -1868,30 +1868,30 @@ namespace webassembly {
*
* @ingroup crypto
* @param s - a span containing the 64 bytes wide scalar to be reduced.
* @param[out] result - the resulting field element fp.
* @return -1 if there was an error 0 otherwise
* @param[out] result - the resulting field element fp - 48 bytes little-endian.
* @return -1 if there was an error, 0 otherwise
*/
int32_t bls_fp_mod(span<const char> s, span<char> result) const;

/**
* Host function for multiplication of field elements (fp, 48 bytes) of the elliptic curve bls12-381
*
* @ingroup crypto
* @param op1 - a span containing the first operand fp point.
* @param op2 - a span containing the second operand fp point.
* @param[out] result - the result op1 * op2.
* @return -1 if there was an error 0 otherwise
* @param op1 - a span containing the first operand fp point - 48 bytes little-endian.
* @param op2 - a span containing the second operand fp point - 48 bytes little-endian.
* @param[out] result - the result op1 * op2 - 48 bytes little-endian.
* @return -1 if there was an error, 0 otherwise
*/
int32_t bls_fp_mul(span<const char> op1, span<const char> op2, span<char> result) const;

/**
* Host function for exponentiation of field elements (fp, 48 bytes) of the elliptic curve bls12-381
*
* @ingroup crypto
* @param base - a span containing the base fp point.
* @param base - a span containing the base fp point - 48 bytes little-endian.
* @param exp - a span containing the 64 bytes wide scalar as exponent.
* @param[out] result - the result of base to the power of exp.
* @return -1 if there was an error 0 otherwise
* @param[out] result - the result of base to the power of exp - 48 bytes little-endian.
* @return -1 if there was an error, 0 otherwise
*/
int32_t bls_fp_exp(span<const char> base, span<const char> exp, span<char> result) const;

Expand Down

0 comments on commit e1f67e9

Please sign in to comment.