package tezos-bls12-381-polynomial

  1. Overview
  2. Docs
type fr = Fr.t
type fr_array
val allocate_fr_array : int -> fr_array

allocate_fr_array n allocates an OCaml custom block to hold a C array containing n zeros of blst_fr

  • requires: n > 0
  • ensures: size res = n and res is initialized with zeros of blst_fr
val erase_fr_array : fr_array -> int -> unit

erase_fr_array p n writes n zeros of blst_fr in a given array p

  • requires: n <= size p
  • ensures: a prefix of size n of an array p is filled with zeros
val of_fr_array : fr array -> fr_array -> int -> unit

of_fr_array res p n converts a given C array p of at least size n to an OCaml array res of size n

  • requires: n <= size p
  • ensures: size res = n and res is a prefix of p
val get : fr -> fr_array -> int -> unit

get res p i writes i-th element of a given array p in res

  • requires: 0 <= i < size p
  • ensures: res = p[i]
val copy : fr_array -> fr_array -> int -> int -> unit

copy a b offset len starting from position offset copies len elements from array b to array a

requires:

  • a and b be disjoint
  • len <= size a
  • offset + len <= size b

ensures: a[i] = b[offset + i] for i = 0..(len - 1)

val of_dense : fr_array -> fr array -> int -> unit

of_dense res p n converts an OCaml array p of size n to a C array res of size n

requires:

  • size res = n
  • size p = n
val eq : fr_array -> fr_array -> int -> int -> bool

eq a b size_a size_b checks whether a polynomial a is equal to a polynomial b

requires:

  • size a = size_a
  • size b = size_b
val is_zero : fr_array -> int -> bool

is_zero p n checks whether a prefix of size n of an array p is filled with zeros of blst_fr

  • requires: size p >= n
OCaml

Innovation. Community. Security.