| 1 |
/* |
| 2 |
* Copyright (c) 2006-2016 Kungliga Tekniska Högskolan |
| 3 |
* (Royal Institute of Technology, Stockholm, Sweden). |
| 4 |
* All rights reserved. |
| 5 |
* |
| 6 |
* Redistribution and use in source and binary forms, with or without |
| 7 |
* modification, are permitted provided that the following conditions |
| 8 |
* are met: |
| 9 |
* |
| 10 |
* 1. Redistributions of source code must retain the above copyright |
| 11 |
* notice, this list of conditions and the following disclaimer. |
| 12 |
* |
| 13 |
* 2. Redistributions in binary form must reproduce the above copyright |
| 14 |
* notice, this list of conditions and the following disclaimer in the |
| 15 |
* documentation and/or other materials provided with the distribution. |
| 16 |
* |
| 17 |
* 3. Neither the name of the Institute nor the names of its contributors |
| 18 |
* may be used to endorse or promote products derived from this software |
| 19 |
* without specific prior written permission. |
| 20 |
* |
| 21 |
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND |
| 22 |
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 23 |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 24 |
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE |
| 25 |
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 26 |
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
| 27 |
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 28 |
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
| 29 |
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 30 |
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 31 |
* SUCH DAMAGE. |
| 32 |
*/ |
| 33 |
|
| 34 |
/* |
| 35 |
* $Id$ |
| 36 |
*/ |
| 37 |
|
| 38 |
#ifndef _HEIM_BN_H |
| 39 |
#define _HEIM_BN_H 1 |
| 40 |
|
| 41 |
/* symbol renaming */ |
| 42 |
#define BN_GENCB_call hc_BN_GENCB_call |
| 43 |
#define BN_GENCB_set hc_BN_GENCB_set |
| 44 |
#define BN_bin2bn hc_BN_bin2bn |
| 45 |
#define BN_bn2bin hc_BN_bn2bin |
| 46 |
#define BN_bn2hex hc_BN_bn2hex |
| 47 |
#define BN_clear hc_BN_clear |
| 48 |
#define BN_clear_bit hc_BN_clear_bit |
| 49 |
#define BN_clear_free hc_BN_clear_free |
| 50 |
#define BN_cmp hc_BN_cmp |
| 51 |
#define BN_dup hc_BN_dup |
| 52 |
#define BN_free hc_BN_free |
| 53 |
#define BN_is_negative hc_BN_is_negative |
| 54 |
#define BN_get_word hc_BN_get_word |
| 55 |
#define BN_hex2bn hc_BN_hex2bn |
| 56 |
#define BN_is_bit_set hc_BN_is_bit_set |
| 57 |
#define BN_new hc_BN_new |
| 58 |
#define BN_num_bits hc_BN_num_bits |
| 59 |
#define BN_num_bytes hc_BN_num_bytes |
| 60 |
#define BN_rand hc_BN_rand |
| 61 |
#define BN_set_bit hc_BN_set_bit |
| 62 |
#define BN_set_negative hc_BN_set_negative |
| 63 |
#define BN_set_word hc_BN_set_word |
| 64 |
#define BN_uadd hc_BN_uadd |
| 65 |
#define BN_CTX_new hc_BN_CTX_new |
| 66 |
#define BN_CTX_free hc_BN_CTX_free |
| 67 |
#define BN_CTX_get hc_BN_CTX_get |
| 68 |
#define BN_CTX_start hc_BN_CTX_start |
| 69 |
#define BN_CTX_end hc_BN_CTX_end |
| 70 |
|
| 71 |
#define BIGNUM hc_BIGNUM |
| 72 |
#define BN_GENCB hc_BN_GENCB |
| 73 |
#define BN_CTX hc_BN_CTX |
| 74 |
#define BN_BLINDING hc_BN_BLINDING |
| 75 |
#define BN_MONT_CTX hc_BN_MONT_CTX |
| 76 |
|
| 77 |
|
| 78 |
/* |
| 79 |
* |
| 80 |
*/ |
| 81 |
|
| 82 |
typedef struct BIGNUM BIGNUM; |
| 83 |
typedef struct BN_GENCB BN_GENCB; |
| 84 |
typedef struct BN_CTX BN_CTX; |
| 85 |
typedef struct BN_MONT_CTX BN_MONT_CTX; |
| 86 |
typedef struct BN_BLINDING BN_BLINDING; |
| 87 |
|
| 88 |
struct BN_GENCB { |
| 89 |
unsigned int ver; |
| 90 |
void *arg; |
| 91 |
union { |
| 92 |
int (*cb_2)(int, int, BN_GENCB *); |
| 93 |
} cb; |
| 94 |
}; |
| 95 |
|
| 96 |
/* |
| 97 |
* |
| 98 |
*/ |
| 99 |
|
| 100 |
BIGNUM *BN_new(void); |
| 101 |
void BN_free(BIGNUM *); |
| 102 |
void BN_clear_free(BIGNUM *); |
| 103 |
void BN_clear(BIGNUM *); |
| 104 |
BIGNUM *BN_dup(const BIGNUM *); |
| 105 |
|
| 106 |
int BN_num_bits(const BIGNUM *); |
| 107 |
int BN_num_bytes(const BIGNUM *); |
| 108 |
|
| 109 |
int BN_cmp(const BIGNUM *, const BIGNUM *); |
| 110 |
|
| 111 |
void BN_set_negative(BIGNUM *, int); |
| 112 |
int BN_is_negative(const BIGNUM *); |
| 113 |
|
| 114 |
int BN_is_bit_set(const BIGNUM *, int); |
| 115 |
int BN_set_bit(BIGNUM *, int); |
| 116 |
int BN_clear_bit(BIGNUM *, int); |
| 117 |
|
| 118 |
int BN_set_word(BIGNUM *, unsigned long); |
| 119 |
unsigned long BN_get_word(const BIGNUM *); |
| 120 |
|
| 121 |
BIGNUM *BN_bin2bn(const void *,int len,BIGNUM *); |
| 122 |
int BN_bn2bin(const BIGNUM *, void *); |
| 123 |
int BN_hex2bn(BIGNUM **, const char *); |
| 124 |
char * BN_bn2hex(const BIGNUM *); |
| 125 |
|
| 126 |
int BN_uadd(BIGNUM *, const BIGNUM *, const BIGNUM *); |
| 127 |
|
| 128 |
int BN_rand(BIGNUM *, int, int, int); |
| 129 |
|
| 130 |
void BN_GENCB_set(BN_GENCB *, int (*)(int, int, BN_GENCB *), void *); |
| 131 |
int BN_GENCB_call(BN_GENCB *, int, int); |
| 132 |
|
| 133 |
BN_CTX *BN_CTX_new(void); |
| 134 |
void BN_CTX_free(BN_CTX *); |
| 135 |
BIGNUM *BN_CTX_get(BN_CTX *); |
| 136 |
void BN_CTX_start(BN_CTX *); |
| 137 |
void BN_CTX_end(BN_CTX *); |
| 138 |
|
| 139 |
#endif |