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