Elliptic curves over GF(p), new BIGNUM functions, Montgomery re-implementation.
[oweals/openssl.git] / crypto / bn / bn_modfs.h
1 /*\r
2  *\r
3  *      bn_modfs.h\r
4  *\r
5  *      Some Modular Arithmetic Functions.\r
6  *\r
7  *      Copyright (C) Lenka Fibikova 2000\r
8  *\r
9  *\r
10  */\r
11 \r
12 #ifndef HEADER_BN_MODFS_H\r
13 #define HEADER_BN_MODFS_H\r
14 \r
15 \r
16 #include "bn.h"\r
17 \r
18 #ifdef BN_is_zero\r
19 #undef BN_is_zero\r
20 #define BN_is_zero(a)   (((a)->top == 0) || (((a)->top == 1) && ((a)->d[0] == (BN_ULONG)0)))\r
21 #endif /*BN_is_zero(a)*/\r
22 \r
23 \r
24 int BN_smod(BIGNUM *rem, BIGNUM *m, BIGNUM *d, BN_CTX *ctx);\r
25 int BN_mod_sub(BIGNUM *r, BIGNUM *a, BIGNUM *b, BIGNUM *m, BN_CTX *ctx);\r
26 int BN_mod_add(BIGNUM *r, BIGNUM *a, BIGNUM *b, BIGNUM *m, BN_CTX *ctx); \r
27 int BN_mod_sqr(BIGNUM *r, BIGNUM *a, BIGNUM *p, BN_CTX *ctx);\r
28 int BN_swap(BIGNUM *x, BIGNUM *y);\r
29 int BN_legendre(BIGNUM *a, BIGNUM *p, BN_CTX *ctx);\r
30 int BN_mod_sqrt(BIGNUM *x, BIGNUM *a, BIGNUM *p, BN_CTX *ctx);\r
31 \r
32 #endif