2010-02-19 10:05:26 -07:00
|
|
|
// Copyright 2007,2008 Segher Boessenkool <segher@kernel.crashing.org>
|
|
|
|
// Licensed under the terms of the GNU GPL, version 2
|
|
|
|
// http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
|
|
|
|
|
|
|
|
#ifndef _TOOLS_H
|
|
|
|
#define _TOOLS_H
|
2013-08-15 06:24:10 -06:00
|
|
|
#include <polarssl/sha1.h>
|
2010-02-19 10:05:26 -07:00
|
|
|
|
|
|
|
// bignum
|
|
|
|
int bn_compare(u8 *a, u8 *b, u32 n);
|
|
|
|
void bn_sub_modulus(u8 *a, u8 *N, u32 n);
|
|
|
|
void bn_add(u8 *d, u8 *a, u8 *b, u8 *N, u32 n);
|
|
|
|
void bn_mul(u8 *d, u8 *a, u8 *b, u8 *N, u32 n);
|
2014-02-16 21:51:41 -07:00
|
|
|
void bn_inv(u8 *d, u8 *a, u8 *N, u32 n); // only for prime N
|
2010-02-19 10:05:26 -07:00
|
|
|
void bn_exp(u8 *d, u8 *a, u8 *N, u32 n, u8 *e, u32 en);
|
2013-01-28 05:18:53 -07:00
|
|
|
void point_mul(u8 *d, const u8 *a, u8 *b);
|
2010-02-19 10:05:26 -07:00
|
|
|
|
2013-01-28 05:18:53 -07:00
|
|
|
void generate_ecdsa(u8 *R, u8 *S, const u8 *k, u8 *hash);
|
2010-02-19 10:05:26 -07:00
|
|
|
|
2013-01-28 05:18:53 -07:00
|
|
|
void ec_priv_to_pub(const u8 *k, u8 *Q);
|
2010-02-19 10:05:26 -07:00
|
|
|
|
|
|
|
#endif
|