alt_bn128_compression.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. #pragma once
  2. /**
  3. * @brief Solana bn128 elliptic curve compression and decompression
  4. **/
  5. #include <sol/types.h>
  6. #ifdef __cplusplus
  7. extern "C" {
  8. #endif
  9. /**
  10. * Output length for the g1 compress operation.
  11. */
  12. #define ALT_BN128_COMPRESSION_G1_COMPRESS_OUTPUT_LEN 32
  13. /**
  14. * Output length for the g1 decompress operation.
  15. */
  16. #define ALT_BN128_COMPRESSION_G1_DECOMPRESS_OUTPUT_LEN 64
  17. /**
  18. * Output length for the g1 compress operation.
  19. */
  20. #define ALT_BN128_COMPRESSION_G2_COMPRESS_OUTPUT_LEN 64
  21. /**
  22. * Output length for the g2 decompress operation.
  23. */
  24. #define ALT_BN128_COMPRESSION_G2_DECOMPRESS_OUTPUT_LEN 128
  25. /**
  26. * G1 compression operation.
  27. */
  28. #define ALT_BN128_G1_COMPRESS 0
  29. /**
  30. * G1 decompression operation.
  31. */
  32. #define ALT_BN128_G1_DECOMPRESS 1
  33. /**
  34. * G2 compression operation.
  35. */
  36. #define ALT_BN128_G2_COMPRESS 2
  37. /**
  38. * G2 decompression operation.
  39. */
  40. #define ALT_BN128_G2_DECOMPRESS 3
  41. /**
  42. * Compression of alt_bn128 g1 and g2 points
  43. *
  44. * @param op ...
  45. * @param input ...
  46. * @param input_size ...
  47. * @param result 64 byte array to hold the result. ...
  48. * @return 0 if executed successfully
  49. */
  50. /* DO NOT MODIFY THIS GENERATED FILE. INSTEAD CHANGE platform-tools-sdk/sbf/c/inc/sol/inc/alt_bn128_compression.inc AND RUN `cargo run --bin gen-headers` */
  51. #ifndef SOL_SBFV2
  52. uint64_t sol_alt_bn128_compression(
  53. const uint64_t op,
  54. const uint8_t *input,
  55. const uint64_t input_size,
  56. uint8_t *result
  57. );
  58. #else
  59. typedef uint64_t(*sol_alt_bn128_compression_pointer_type)(
  60. const uint64_t op,
  61. const uint8_t *input,
  62. const uint64_t input_size,
  63. uint8_t *result
  64. );
  65. static uint64_t sol_alt_bn128_compression(
  66. const uint64_t op arg1,
  67. const uint8_t *input arg2,
  68. const uint64_t input_size arg3,
  69. uint8_t *result
  70. arg4) {
  71. sol_alt_bn128_compression_pointer_type sol_alt_bn128_compression_pointer = (sol_alt_bn128_compression_pointer_type) 860870125;
  72. return sol_alt_bn128_compression_pointer(arg1, arg2, arg3, arg4);
  73. }
  74. #endif
  75. #ifdef __cplusplus
  76. }
  77. #endif
  78. /**@}*/