Loading...
Searching...
No Matches
decaf.c File Reference

Decaf high-level functions. More...

## Classes

struct | niels_s
struct | VECTOR_ALIGNED
struct | precomputed_s

## Macros

#define | _XOPEN_SOURCE 600 /* for posix_memalign */
#define | API_NS(_id) decaf_255_##_id
#define | SCALAR_BITS DECAF_255_SCALAR_BITS
#define | SCALAR_SER_BYTES DECAF_255_SCALAR_BYTES
#define | SCALAR_LIMBS DECAF_255_SCALAR_LIMBS
#define | scalar_t API_NS(scalar_t)
#define | point_t API_NS(point_t)
#define | precomputed_s API_NS(precomputed_s)
#define | IMAGINE_TWIST 1
#define | COFACTOR 8
#define | COMBS_N 3
#define | COMBS_T 5
#define | COMBS_S 17
#define | DECAF_WINDOW_BITS 4
#define | DECAF_WNAF_FIXED_TABLE_BITS 5
#define | DECAF_WNAF_VAR_TABLE_BITS 3
#define | EDDSA_USE_SIGMA_ISOGENY 1
#define | RISTRETTO_FACTOR DECAF_255_RISTRETTO_FACTOR
#define | TWISTED_D ((EDWARDS_D)-1)
#define | EFF_D TWISTED_D
#define | NEG_D 0
#define | WBITS DECAF_WORD_BITS /* NB this may be different from ARCH_WORD_BITS */

## Typedefs

typedef struct niels_s | niels_t[1]
typedef struct VECTOR_ALIGNED | pniels_t[1]

## Functions

const point_t | API_NS (point_base)
const gf | API_NS (precomputed_base_as_fe)[]
const precomputed_s * | API_NS (precomputed_base)
const size_t | API_NS (sizeof_precomputed_s)
const size_t | API_NS (alignof_precomputed_s)
const point_t | API_NS (point_identity)
| identity = (0,1)
void API_NS() | deisogenize (gf_s *__restrict__ s, gf_s *__restrict__ inv_el_sum, gf_s *__restrict__ inv_el_m1, const point_t p, mask_t toggle_s, mask_t toggle_altx, mask_t toggle_rotation)
void API_NS() | point_encode (unsigned char ser[SER_BYTES], const point_t p)
decaf_error_t API_NS() | point_decode (point_t p, const unsigned char ser[SER_BYTES], decaf_bool_t allow_identity)
void API_NS() | point_sub (point_t p, const point_t q, const point_t r)
void API_NS() | point_add (point_t p, const point_t q, const point_t r)
void API_NS() | point_double (point_t p, const point_t q)
void API_NS() | point_negate (point_t nega, const point_t a)
void API_NS() | point_scalarmul (point_t a, const point_t b, const scalar_t scalar)
void API_NS() | point_double_scalarmul (point_t a, const point_t b, const scalar_t scalarb, const point_t c, const scalar_t scalarc)
void API_NS() | point_dual_scalarmul (point_t a1, point_t a2, const point_t b, const scalar_t scalar1, const scalar_t scalar2)
decaf_bool_t API_NS() | point_eq (const point_t p, const point_t q)
decaf_bool_t API_NS() | point_valid (const point_t p)
void API_NS() | point_debugging_torque (point_t q, const point_t p)
void API_NS() | point_debugging_pscale (point_t q, const point_t p, const uint8_t factor[SER_BYTES])
void API_NS() | precompute (precomputed_s *table, const point_t base)
void API_NS() | precomputed_scalarmul (point_t out, const precomputed_s *table, const scalar_t scalar)
void API_NS() | point_cond_sel (point_t out, const point_t a, const point_t b, decaf_bool_t pick_b)
decaf_error_t API_NS() | direct_scalarmul (uint8_t scaled[SER_BYTES], const uint8_t base[SER_BYTES], const scalar_t scalar, decaf_bool_t allow_identity, decaf_bool_t short_circuit)
void API_NS() | point_mul_by_ratio_and_encode_like_eddsa (uint8_t enc[DECAF_EDDSA_25519_PUBLIC_BYTES], const point_t p)
decaf_error_t API_NS() | point_decode_like_eddsa_and_mul_by_ratio (point_t p, const uint8_t enc[DECAF_EDDSA_25519_PUBLIC_BYTES])
decaf_error_t | decaf_x25519 (uint8_t out[X_PUBLIC_BYTES], const uint8_t base[X_PUBLIC_BYTES], const uint8_t scalar[X_PRIVATE_BYTES])
void | decaf_ed25519_convert_public_key_to_x25519 (uint8_t x[DECAF_X25519_PUBLIC_BYTES], const uint8_t ed[DECAF_EDDSA_25519_PUBLIC_BYTES])
| EdDSA to ECDH public key conversion Deserialize the point to get y on Edwards curve, Convert it to u coordinate on Montgomery curve.
void | decaf_x25519_generate_key (uint8_t out[X_PUBLIC_BYTES], const uint8_t scalar[X_PRIVATE_BYTES])
void API_NS() | point_mul_by_ratio_and_encode_like_x25519 (uint8_t out[X_PUBLIC_BYTES], const point_t p)
void | decaf_x25519_derive_public_key (uint8_t out[X_PUBLIC_BYTES], const uint8_t scalar[X_PRIVATE_BYTES])

## Variables

const uint8_t | decaf_x25519_base_point [DECAF_X25519_PUBLIC_BYTES] = { 0x09 }
| The base point for X25519 Diffie-Hellman.
const gf | RISTRETTO_FACTOR

## Detailed Description

Decaf high-level functions.

Author
  Mike Hamburg

Copyright
  Copyright (c) 2015-2016 Cryptography Research, Inc.
  Released under the MIT License. See LICENSE.txt for license information.

Warning
  This file was automatically generated in Python. Please do not edit it.

## Function Documentation

## decaf_ed25519_convert_public_key_to_x25519()

void decaf_ed25519_convert_public_key_to_x25519 | ( | uint8_t | x[DECAF_X25519_PUBLIC_BYTES],
|  | const uint8_t | ed[DECAF_EDDSA_25519_PUBLIC_BYTES]
| ) |  |

EdDSA to ECDH public key conversion Deserialize the point to get y on Edwards curve, Convert it to u coordinate on Montgomery curve.

Warning
  This function does not check that the public key being converted is a valid EdDSA public key (FUTURE?)

Parameters

  [out] | x | The ECDH public key as in RFC7748(point on Montgomery curve)
  [in] | ed | The EdDSA public key(point on Edwards curve)

## Variable Documentation

## RISTRETTO_FACTOR

const gf RISTRETTO_FACTOR

Initial value:
= {FIELD_LITERAL(
0x702557fa2bf03, 0x514b7d1a82cc6, 0x7f89efd8b43a7, 0x1aef49ec23700, 0x079376fa30500
)}