source: git/src-ed25519/supercop-ref/fe25519.h

Last change on this file was 9598517, checked in by Brian Warner <warner@…>, at 2012-02-12T15:05:37Z

Add Ed25519 signatures, in pycryptopp.publickey.ed25519 . Closes #75.

This copies in version 1.0 of python-ed25519, from
https://github.com/warner/python-ed25519 (or pypi), with minor source-code
rearrangement to match pycryptopp's build process. It includes unit tests,
power-on self-tests, and full known-answer tests. The standard 'setup.py
test' target only exercises 10% of the test vectors, to let the suite run in
about 1.0s on my laptop. The API documentation is in README.ed25519 .

Tests have been run successfully on Linux, OS-X and windows.

  • Property mode set to 100644
File size: 2.1 KB
Line 
1#ifndef FE25519_H
2#define FE25519_H
3
4#include "crypto_int32.h"
5#include "crypto_uint32.h"
6
7#define fe25519              crypto_sign_ed25519_ref_fe25519
8#define fe25519_freeze       crypto_sign_ed25519_ref_fe25519_freeze
9#define fe25519_unpack       crypto_sign_ed25519_ref_fe25519_unpack
10#define fe25519_pack         crypto_sign_ed25519_ref_fe25519_pack
11#define fe25519_iszero       crypto_sign_ed25519_ref_fe25519_iszero
12#define fe25519_iseq_vartime crypto_sign_ed25519_ref_fe25519_iseq_vartime
13#define fe25519_cmov         crypto_sign_ed25519_ref_fe25519_cmov
14#define fe25519_setone       crypto_sign_ed25519_ref_fe25519_setone
15#define fe25519_setzero      crypto_sign_ed25519_ref_fe25519_setzero
16#define fe25519_neg          crypto_sign_ed25519_ref_fe25519_neg
17#define fe25519_getparity    crypto_sign_ed25519_ref_fe25519_getparity
18#define fe25519_add          crypto_sign_ed25519_ref_fe25519_add
19#define fe25519_sub          crypto_sign_ed25519_ref_fe25519_sub
20#define fe25519_mul          crypto_sign_ed25519_ref_fe25519_mul
21#define fe25519_square       crypto_sign_ed25519_ref_fe25519_square
22#define fe25519_invert       crypto_sign_ed25519_ref_fe25519_invert
23#define fe25519_pow2523      crypto_sign_ed25519_ref_fe25519_pow2523
24
25typedef struct 
26{
27  crypto_uint32 v[32]; 
28}
29fe25519;
30
31void fe25519_freeze(fe25519 *r);
32
33void fe25519_unpack(fe25519 *r, const unsigned char x[32]);
34
35void fe25519_pack(unsigned char r[32], const fe25519 *x);
36
37int fe25519_iszero(const fe25519 *x);
38
39int fe25519_iseq_vartime(const fe25519 *x, const fe25519 *y);
40
41void fe25519_cmov(fe25519 *r, const fe25519 *x, unsigned char b);
42
43void fe25519_setone(fe25519 *r);
44
45void fe25519_setzero(fe25519 *r);
46
47void fe25519_neg(fe25519 *r, const fe25519 *x);
48
49unsigned char fe25519_getparity(const fe25519 *x);
50
51void fe25519_add(fe25519 *r, const fe25519 *x, const fe25519 *y);
52
53void fe25519_sub(fe25519 *r, const fe25519 *x, const fe25519 *y);
54
55void fe25519_mul(fe25519 *r, const fe25519 *x, const fe25519 *y);
56
57void fe25519_square(fe25519 *r, const fe25519 *x);
58
59void fe25519_invert(fe25519 *r, const fe25519 *x);
60
61void fe25519_pow2523(fe25519 *r, const fe25519 *x);
62
63#endif
Note: See TracBrowser for help on using the repository browser.