Skip to content
This repository has been archived by the owner on Nov 9, 2022. It is now read-only.

feat: add syscalls using Barreto-Naehrig (BN) curve construction #134

Merged
merged 2 commits into from
Oct 12, 2022

Conversation

Flouse
Copy link
Collaborator

@Flouse Flouse commented Sep 30, 2022

Add BN syscalls

/**
 * @param input  two curve points (x, y)
 * @param output curve point x + y, where + is point addition on the elliptic
 * curve
 *
 * Fails on invalid input
 */
typedef int (*gw_bn_add)(const uint8_t *input, const size_t input_size,
                         uint8_t *output);

/**
 * @param Input  two curve points (x, y)
 * @param output curve point s * x, where * is the scalar multiplication on the
 * elliptic curve
 *
 * Fails on invalid input
 */
typedef int (*gw_bn_mul)(const uint8_t *input, const size_t input_size,
                         uint8_t *output);

/**
 * @param input  Input: (a1, b1, a2, b2, ..., ak, bk) from (G_1 x G_2)^k
 *               Note that k is the input_size divided by 192
 * @param output curve point s * x, where * is the scalar multiplication on the
 * elliptic curve
 *
 * @return Empty input is valid and results in returning one.
 *
 * Fails on:
 *   1. the input_size is not a multiple of 192
 *   2. any of the inputs are not elements of the respective group are not
 * encoded correctly
 */
typedef int (*gw_bn_pairing)(const uint8_t *input, const size_t input_size,
                             uint8_t *output);

@Flouse Flouse marked this pull request as ready for review October 1, 2022 01:20
@Flouse Flouse requested review from jjyr and zeroqn as code owners October 1, 2022 01:20
@Flouse Flouse merged commit d6d395b into master Oct 12, 2022
@Flouse Flouse deleted the bn-syscalls branch October 12, 2022 09:18
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants