Skip to content

Update curve25519.c to allow for compiling on GCC

Amy requested to merge amyipdev/ring:redox-unix-0.13.5 into redox-unix-0.13.5

On GCC, a compiler error occurs due to a mismatch between curve25519.c and internal.h. The function prototypes use a[32] and *s, respectively, whereas the functions themselves reverse this (*a, s[32]). This patch updates the function signatures to match their prototypes.

Error from compilation:

--- stderr
  third_party/fiat/curve25519.c:1877:61: error: argument 2 of type const uint8_t * {aka const unsigned char *} declared as a pointer [-Werror=array-parameter=]
   1877 | void GFp_x25519_ge_scalarmult_base(ge_p3 *h, const uint8_t *a) {
        |                                              ~~~~~~~~~~~~~~~^
  In file included from third_party/fiat/curve25519.c:43:
  third_party/fiat/internal.h:129:60: note: previously declared as an array const uint8_t[32] {aka const unsigned char[32]}
    129 | void GFp_x25519_ge_scalarmult_base(ge_p3 *h, const uint8_t a[32]);
        |                                              ~~~~~~~~~~~~~~^~~~~
  third_party/fiat/curve25519.c:3013:36: error: argument 1 of type uint8_t[32] {aka unsigned char[32]} with mismatched bound [-Werror=array-parameter=]
   3013 | void GFp_x25519_fe_tobytes(uint8_t s[32], const fe *h) {
        |                            ~~~~~~~~^~~~~
  In file included from third_party/fiat/curve25519.c:43:
  third_party/fiat/internal.h:124:37: note: previously declared as uint8_t * {aka unsigned char *}
    124 | void GFp_x25519_fe_tobytes(uint8_t *s, const fe *h);
        |                            ~~~~~~~~~^
  cc1: all warnings being treated as errors
  thread 'main' panicked at 'execution failed', /home/amy/.cargo/git/checkouts/ring-673443d3342e1630/e10e9b8/build.rs:644:9
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Merge request reports