Home | History | Annotate | Download | only in bn_extra

Lines Matching refs:BN

57 #include <openssl/bn.h>
69 #include "../fipsmodule/bn/internal.h"
79 char *BN_bn2hex(const BIGNUM *bn) {
81 bn->top * BN_BYTES * 2 + 1 /* trailing NUL */);
83 OPENSSL_PUT_ERROR(BN, ERR_R_MALLOC_FAILURE);
88 if (bn->neg) {
92 if (BN_is_zero(bn)) {
97 for (int i = bn->top - 1; i >= 0; i--) {
100 int v = ((int)(bn->d[i] >> (long)j)) & 0xff;
113 // decode_hex decodes |in_len| bytes of hex data from |in| and updates |bn|.
114 static int decode_hex(BIGNUM *bn, const char *in, int in_len) {
116 OPENSSL_PUT_ERROR(BN, BN_R_BIGNUM_TOO_LONG);
120 if (!bn_expand(bn, in_len * 4)) {
152 bn->d[i++] = word;
155 assert(i <= bn->dmax);
156 bn->top = i;
160 // decode_dec decodes |in_len| bytes of decimal data from |in| and updates |bn|.
161 static int decode_dec(BIGNUM *bn, const char *in, int in_len) {
175 if (!BN_mul_word(bn, BN_DEC_CONV) ||
176 !BN_add_word(bn, l)) {
186 typedef int (*decode_func) (BIGNUM *bn, const char *in, int in_len);
304 OPENSSL_PUT_ERROR(BN, ERR_R_MALLOC_FAILURE);
426 OPENSSL_PUT_ERROR(BN, BN_R_BAD_ENCODING);
434 OPENSSL_PUT_ERROR(BN, BN_R_BAD_ENCODING);
442 OPENSSL_PUT_ERROR(BN, ERR_R_MALLOC_FAILURE);