Home | History | Annotate | Download | only in bn

Lines Matching defs:bn

57 #include <openssl/bn.h>
76 BIGNUM *bn = NULL;
79 ret = bn = BN_new();
94 if (bn) {
95 BN_free(bn);
206 char *BN_bn2hex(const BIGNUM *bn) {
211 buf = (char *)OPENSSL_malloc(bn->top * BN_BYTES * 2 + 2);
213 OPENSSL_PUT_ERROR(BN, ERR_R_MALLOC_FAILURE);
218 if (bn->neg) {
222 if (BN_is_zero(bn)) {
226 for (i = bn->top - 1; i >= 0; i--) {
229 v = ((int)(bn->d[i] >> (long)j)) & 0xff;
242 /* decode_hex decodes |in_len| bytes of hex data from |in| and updates |bn|. */
243 static int decode_hex(BIGNUM *bn, const char *in, int in_len) {
245 OPENSSL_PUT_ERROR(BN, BN_R_BIGNUM_TOO_LONG);
249 if (bn_expand(bn, in_len * 4) == NULL) {
281 bn->d[i++] = word;
284 assert(i <= bn->dmax);
285 bn->top = i;
289 /* decode_dec decodes |in_len| bytes of decimal data from |in| and updates |bn|. */
290 static int decode_dec(BIGNUM *bn, const char *in, int in_len) {
304 if (!BN_mul_word(bn, BN_DEC_CONV) ||
305 !BN_add_word(bn, l)) {
315 typedef int (*decode_func) (BIGNUM *bn, const char *in, int in_len);
392 OPENSSL_PUT_ERROR(BN, ERR_R_MALLOC_FAILURE);
516 BN_ULONG BN_get_word(const BIGNUM *bn) {
517 switch (bn->top) {
521 return bn->d[0];
569 OPENSSL_PUT_ERROR(BN, BN_R_BAD_ENCODING);
577 OPENSSL_PUT_ERROR(BN, BN_R_BAD_ENCODING);
585 OPENSSL_PUT_ERROR(BN, ERR_R_MALLOC_FAILURE);