Lines Matching refs:bn
95 #include <openssl/bn.h>
268 static int bn2gmp(const BIGNUM *bn, mpz_t g)
270 bn_check_top(bn);
271 if (((sizeof(bn->d[0]) * 8) == GMP_NUMB_BITS) &&
274 if (!_mpz_realloc(g, bn->top))
276 memcpy(&g->_mp_d[0], &bn->d[0], bn->top * sizeof(bn->d[0]));
277 g->_mp_size = bn->top;
278 if (bn->neg)
283 char *tmpchar = BN_bn2hex(bn);
292 static int gmp2bn(mpz_t g, BIGNUM *bn)
294 if (((sizeof(bn->d[0]) * 8) == GMP_NUMB_BITS) &&
298 BN_zero(bn);
299 if (bn_expand2(bn, s) == NULL)
301 bn->top = s;
302 memcpy(&bn->d[0], &g->_mp_d[0], s * sizeof(bn->d[0]));
303 bn_correct_top(bn);
304 bn->neg = g->_mp_size >= 0 ? 0 : 1;
312 toret = BN_hex2bn(&bn, tmpchar);