Branch : - branch - develop v1.2 - tag - 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.10 0.11 0.12 0.13 0.14 0.15 0.16 0.17 0.18 0.19 0.20 0.21 0.22 0.23 0.24 0.25 0.26 0.27 0.28 0.29 0.30 0.31 0.32 0.33 0.34 0.35 0.36 0.37 0.38 0.39 0.40 0.41 semver v0.42.0 v0.43.0-rc0 v1.0 v1.0-rc1 v1.0-rc2 v1.0.0-rc0 v1.0.1 v1.0.1-rc1 v1.0.1-rc2 v1.1.0 v1.1.0-rc1 v1.1.0-rc2 v1.1.0-rc3 v1.1.0-rc4 v1.1.0-rc5 v1.2.0 v1.2.0-rc1 v1.2.0-rc2 v1.2.0-rc3
#include "tommath_private.h" #ifdef BN_MP_READ_UNSIGNED_BIN_C /* LibTomMath, multiple-precision integer library -- Tom St Denis */ /* SPDX-License-Identifier: Unlicense */ /* reads a unsigned char array, assumes the msb is stored first [big endian] */ mp_err mp_read_unsigned_bin(mp_int *a, const unsigned char *b, int c) { mp_err err; /* make sure there are at least two digits */ if (a->alloc < 2) { if ((err = mp_grow(a, 2)) != MP_OKAY) { return err; } } /* zero the int */ mp_zero(a); /* read the bytes in */ while (c-- > 0) { if ((err = mp_mul_2d(a, 8, a)) != MP_OKAY) { return err; } #ifndef MP_8BIT a->dp[0] |= *b++; a->used += 1; #else a->dp[0] = (*b & MP_MASK); a->dp[1] |= ((*b++ >> 7) & 1u); a->used += 2; #endif } mp_clamp(a); return MP_OKAY; } #endif