1 /* $NetBSD: bn.h,v 1.1.1.2 2011/04/14 14:08:30 elric Exp $ */
4 * Copyright (c) 2006 Kungliga Tekniska Högskolan
5 * (Royal Institute of Technology, Stockholm, Sweden).
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * 3. Neither the name of the Institute nor the names of its contributors
20 * may be used to endorse or promote products derived from this software
21 * without specific prior written permission.
23 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
44 #define BN_GENCB_call hc_BN_GENCB_call
45 #define BN_GENCB_set hc_BN_GENCB_set
46 #define BN_bin2bn hc_BN_bin2bn
47 #define BN_bn2bin hc_BN_bn2bin
48 #define BN_bn2hex hc_BN_bn2hex
49 #define BN_clear hc_BN_clear
50 #define BN_clear_bit hc_BN_clear_bit
51 #define BN_clear_free hc_BN_clear_free
52 #define BN_cmp hc_BN_cmp
53 #define BN_dup hc_BN_dup
54 #define BN_free hc_BN_free
55 #define BN_is_negative hc_BN_is_negative
56 #define BN_get_word hc_BN_get_word
57 #define BN_hex2bn hc_BN_hex2bn
58 #define BN_is_bit_set hc_BN_is_bit_set
59 #define BN_new hc_BN_new
60 #define BN_num_bits hc_BN_num_bits
61 #define BN_num_bytes hc_BN_num_bytes
62 #define BN_rand hc_BN_rand
63 #define BN_set_bit hc_BN_set_bit
64 #define BN_set_negative hc_BN_set_negative
65 #define BN_set_word hc_BN_set_word
66 #define BN_uadd hc_BN_uadd
67 #define BN_CTX_new hc_BN_CTX_new
68 #define BN_CTX_free hc_BN_CTX_free
69 #define BN_CTX_get hc_BN_CTX_get
70 #define BN_CTX_start hc_BN_CTX_start
71 #define BN_CTX_end hc_BN_CTX_end
77 typedef struct BIGNUM BIGNUM
;
78 typedef struct BN_GENCB BN_GENCB
;
79 typedef struct BN_CTX BN_CTX
;
80 typedef struct BN_MONT_CTX BN_MONT_CTX
;
81 typedef struct BN_BLINDING BN_BLINDING
;
87 int (*cb_2
)(int, int, BN_GENCB
*);
96 void BN_free(BIGNUM
*);
97 void BN_clear_free(BIGNUM
*);
98 void BN_clear(BIGNUM
*);
99 BIGNUM
*BN_dup(const BIGNUM
*);
101 int BN_num_bits(const BIGNUM
*);
102 int BN_num_bytes(const BIGNUM
*);
104 int BN_cmp(const BIGNUM
*, const BIGNUM
*);
106 void BN_set_negative(BIGNUM
*, int);
107 int BN_is_negative(const BIGNUM
*);
109 int BN_is_bit_set(const BIGNUM
*, int);
110 int BN_set_bit(BIGNUM
*, int);
111 int BN_clear_bit(BIGNUM
*, int);
113 int BN_set_word(BIGNUM
*, unsigned long);
114 unsigned long BN_get_word(const BIGNUM
*);
116 BIGNUM
*BN_bin2bn(const void *,int len
,BIGNUM
*);
117 int BN_bn2bin(const BIGNUM
*, void *);
118 int BN_hex2bn(BIGNUM
**, const char *);
119 char * BN_bn2hex(const BIGNUM
*);
121 int BN_uadd(BIGNUM
*, const BIGNUM
*, const BIGNUM
*);
123 int BN_rand(BIGNUM
*, int, int, int);
125 void BN_GENCB_set(BN_GENCB
*, int (*)(int, int, BN_GENCB
*), void *);
126 int BN_GENCB_call(BN_GENCB
*, int, int);
128 BN_CTX
*BN_CTX_new(void);
129 void BN_CTX_free(BN_CTX
*);
130 BIGNUM
*BN_CTX_get(BN_CTX
*);
131 void BN_CTX_start(BN_CTX
*);
132 void BN_CTX_end(BN_CTX
*);