[BACK]Return to sc25519.h CVS log [TXT][DIR] Up to [local] / src / usr.bin / signify

File: [local] / src / usr.bin / signify / sc25519.h (download)

Revision 1.1, Tue Jul 22 00:41:19 2014 UTC (9 years, 10 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, OPENBSD_7_3_BASE, OPENBSD_7_3, OPENBSD_7_2_BASE, OPENBSD_7_2, OPENBSD_7_1_BASE, OPENBSD_7_1, OPENBSD_7_0_BASE, OPENBSD_7_0, OPENBSD_6_9_BASE, OPENBSD_6_9, OPENBSD_6_8_BASE, OPENBSD_6_8, OPENBSD_6_7_BASE, OPENBSD_6_7, OPENBSD_6_6_BASE, OPENBSD_6_6, OPENBSD_6_5_BASE, OPENBSD_6_5, OPENBSD_6_4_BASE, OPENBSD_6_4, OPENBSD_6_3_BASE, OPENBSD_6_3, OPENBSD_6_2_BASE, OPENBSD_6_2, OPENBSD_6_1_BASE, OPENBSD_6_1, OPENBSD_6_0_BASE, OPENBSD_6_0, OPENBSD_5_9_BASE, OPENBSD_5_9, OPENBSD_5_8_BASE, OPENBSD_5_8, OPENBSD_5_7_BASE, OPENBSD_5_7, OPENBSD_5_6_BASE, OPENBSD_5_6, HEAD

Pull in all the parts.  Let's face the facts --  .PATH from other
parts of the tree is PAINFUL for basically everyone upstream, not
just for us in our own tree.

/* $OpenBSD: sc25519.h,v 1.1 2014/07/22 00:41:19 deraadt Exp $ */

/*
 * Public Domain, Authors: Daniel J. Bernstein, Niels Duif, Tanja Lange,
 * Peter Schwabe, Bo-Yin Yang.
 * Copied from supercop-20130419/crypto_sign/ed25519/ref/sc25519.h
 */

#ifndef SC25519_H
#define SC25519_H

#include "crypto_api.h"

#define sc25519                  crypto_sign_ed25519_ref_sc25519
#define shortsc25519             crypto_sign_ed25519_ref_shortsc25519
#define sc25519_from32bytes      crypto_sign_ed25519_ref_sc25519_from32bytes
#define shortsc25519_from16bytes crypto_sign_ed25519_ref_shortsc25519_from16bytes
#define sc25519_from64bytes      crypto_sign_ed25519_ref_sc25519_from64bytes
#define sc25519_from_shortsc     crypto_sign_ed25519_ref_sc25519_from_shortsc
#define sc25519_to32bytes        crypto_sign_ed25519_ref_sc25519_to32bytes
#define sc25519_iszero_vartime   crypto_sign_ed25519_ref_sc25519_iszero_vartime
#define sc25519_isshort_vartime  crypto_sign_ed25519_ref_sc25519_isshort_vartime
#define sc25519_lt_vartime       crypto_sign_ed25519_ref_sc25519_lt_vartime
#define sc25519_add              crypto_sign_ed25519_ref_sc25519_add
#define sc25519_sub_nored        crypto_sign_ed25519_ref_sc25519_sub_nored
#define sc25519_mul              crypto_sign_ed25519_ref_sc25519_mul
#define sc25519_mul_shortsc      crypto_sign_ed25519_ref_sc25519_mul_shortsc
#define sc25519_window3          crypto_sign_ed25519_ref_sc25519_window3
#define sc25519_window5          crypto_sign_ed25519_ref_sc25519_window5
#define sc25519_2interleave2     crypto_sign_ed25519_ref_sc25519_2interleave2

typedef struct 
{
  crypto_uint32 v[32]; 
}
sc25519;

typedef struct 
{
  crypto_uint32 v[16]; 
}
shortsc25519;

void sc25519_from32bytes(sc25519 *r, const unsigned char x[32]);

void shortsc25519_from16bytes(shortsc25519 *r, const unsigned char x[16]);

void sc25519_from64bytes(sc25519 *r, const unsigned char x[64]);

void sc25519_from_shortsc(sc25519 *r, const shortsc25519 *x);

void sc25519_to32bytes(unsigned char r[32], const sc25519 *x);

int sc25519_iszero_vartime(const sc25519 *x);

int sc25519_isshort_vartime(const sc25519 *x);

int sc25519_lt_vartime(const sc25519 *x, const sc25519 *y);

void sc25519_add(sc25519 *r, const sc25519 *x, const sc25519 *y);

void sc25519_sub_nored(sc25519 *r, const sc25519 *x, const sc25519 *y);

void sc25519_mul(sc25519 *r, const sc25519 *x, const sc25519 *y);

void sc25519_mul_shortsc(sc25519 *r, const sc25519 *x, const shortsc25519 *y);

/* Convert s into a representation of the form \sum_{i=0}^{84}r[i]2^3
 * with r[i] in {-4,...,3}
 */
void sc25519_window3(signed char r[85], const sc25519 *s);

/* Convert s into a representation of the form \sum_{i=0}^{50}r[i]2^5
 * with r[i] in {-16,...,15}
 */
void sc25519_window5(signed char r[51], const sc25519 *s);

void sc25519_2interleave2(unsigned char r[127], const sc25519 *s1, const sc25519 *s2);

#endif