$search
00001 /* 00002 * Big number math 00003 * Copyright (c) 2006, Jouni Malinen <j@w1.fi> 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License version 2 as 00007 * published by the Free Software Foundation. 00008 * 00009 * Alternatively, this software may be distributed under the terms of BSD 00010 * license. 00011 * 00012 * See README and COPYING for more details. 00013 */ 00014 00015 #ifndef BIGNUM_H 00016 #define BIGNUM_H 00017 00018 struct bignum; 00019 00020 struct bignum * bignum_init(void); 00021 void bignum_deinit(struct bignum *n); 00022 size_t bignum_get_unsigned_bin_len(struct bignum *n); 00023 int bignum_get_unsigned_bin(const struct bignum *n, u8 *buf, size_t *len); 00024 int bignum_set_unsigned_bin(struct bignum *n, const u8 *buf, size_t len); 00025 int bignum_cmp(const struct bignum *a, const struct bignum *b); 00026 int bignum_cmp_d(const struct bignum *a, unsigned long b); 00027 int bignum_add(const struct bignum *a, const struct bignum *b, 00028 struct bignum *c); 00029 int bignum_sub(const struct bignum *a, const struct bignum *b, 00030 struct bignum *c); 00031 int bignum_mul(const struct bignum *a, const struct bignum *b, 00032 struct bignum *c); 00033 int bignum_mulmod(const struct bignum *a, const struct bignum *b, 00034 const struct bignum *c, struct bignum *d); 00035 int bignum_exptmod(const struct bignum *a, const struct bignum *b, 00036 const struct bignum *c, struct bignum *d); 00037 00038 #endif /* BIGNUM_H */