LCOV - code coverage report
Current view: top level - ballet/bn254 - fd_bn254.h (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 0 1 0.0 %
Date: 2025-03-20 12:08:36 Functions: 0 0 -

          Line data    Source code
       1             : #ifndef HEADER_fd_src_ballet_bn254_fd_bn254_h
       2             : #define HEADER_fd_src_ballet_bn254_fd_bn254_h
       3             : 
       4             : /* fd_bn254 implements utility functions for the bn254 (alt_bn128) curve. */
       5             : 
       6             : #include "../fd_ballet_base.h"
       7             : #include "../bigint/fd_uint256.h"
       8             : #include "./fd_bn254_scalar.h"
       9             : 
      10           0 : #define FD_BN254_PAIRING_BATCH_MAX 16UL
      11             : 
      12             : FD_PROTOTYPES_BEGIN
      13             : 
      14             : int
      15             : fd_bn254_g1_add_syscall( uchar       out[64],
      16             :                          uchar const in[],
      17             :                          ulong       in_sz );
      18             : 
      19             : int
      20             : fd_bn254_g1_scalar_mul_syscall( uchar       out[64],
      21             :                                 uchar const in[],
      22             :                                 ulong       in_sz,
      23             :                                 int         check_correct_sz );
      24             : 
      25             : int
      26             : fd_bn254_pairing_is_one_syscall( uchar       out[32],
      27             :                                  uchar const in[],
      28             :                                  ulong       in_sz );
      29             : 
      30             : /* fd_bn254_g1_compress compresses a point in G1.
      31             :    Input in is a 64-byte big endian buffer representing the point (x, y),
      32             :    with additional flags.
      33             :    Output out will contain x, serialized as 32-byte big endian buffer,
      34             :    with proper flags set.
      35             :    Returns out on success, NULL on failure.
      36             :    Note: this function does NOT check that (x, y) is in G1. */
      37             : uchar *
      38             : fd_bn254_g1_compress( uchar       out[32],
      39             :                       uchar const in [64] );
      40             : 
      41             : /* fd_bn254_g1_decompress decompresses a point in G1.
      42             :    Input in is a 32-byte big endian buffer representing the x coord of a point,
      43             :    with additional flags.
      44             :    Output out will contain (x, y), serialized as 64-byte big endian buffer,
      45             :    with no flags set.
      46             :    Returns out on success, NULL on failure.
      47             :    (Success implies that (x, y) is in G1.) */
      48             : uchar *
      49             : fd_bn254_g1_decompress( uchar       out[64],
      50             :                         uchar const in [32] );
      51             : 
      52             : /* fd_bn254_g2_compress compresses a point in G2.
      53             :    Same as fd_bn254_g1_compress, but x, y are in Fp2, so twice as long.
      54             :    Input in is a 128-byte big endian buffer representing the point (x, y),
      55             :    with additional flags.
      56             :    Output out will contain x, serialized as 64-byte big endian buffer,
      57             :    with proper flags set.
      58             :    Returns out on success, NULL on failure.
      59             :    Note: this function does NOT check that (x, y) is in G2. */
      60             : uchar *
      61             : fd_bn254_g2_compress( uchar       out[64],
      62             :                       uchar const in[128] );
      63             : 
      64             : /* fd_bn254_g2_decompress decompresses a point in G2.
      65             :    Same as fd_bn254_g1_decompress, but x, y are in Fp2, so twice as long.
      66             :    Input in is a 64-byte big endian buffer representing the x coord of a point,
      67             :    with additional flags.
      68             :    Output out will contain (x, y), serialized as 128-byte big endian buffer,
      69             :    with no flags set.
      70             :    Returns out on success, NULL on failure.
      71             :    Note: this function does NOT check that (x, y) is in G2 (success does NOT
      72             :    imply that). */
      73             : uchar *
      74             : fd_bn254_g2_decompress( uchar       out[128],
      75             :                         uchar const in  [64] );
      76             : 
      77             : FD_PROTOTYPES_END
      78             : 
      79             : #endif /* HEADER_fd_src_ballet_bn254_fd_bn254_h */

Generated by: LCOV version 1.14