Mercurial > dropbear
annotate libtommath/bn_mp_ubin_size.c @ 1777:97ad26e397a5
Add server postauth fuzzer, wrap connect_remote()
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Fri, 13 Nov 2020 23:18:05 +0800 |
parents | 1051e4eea25a |
children |
rev | line source |
---|---|
1692
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
diff
changeset
|
1 #include "tommath_private.h" |
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
diff
changeset
|
2 #ifdef BN_MP_UBIN_SIZE_C |
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
diff
changeset
|
3 /* LibTomMath, multiple-precision integer library -- Tom St Denis */ |
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
diff
changeset
|
4 /* SPDX-License-Identifier: Unlicense */ |
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
diff
changeset
|
5 |
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
diff
changeset
|
6 /* get the size for an unsigned equivalent */ |
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
diff
changeset
|
7 size_t mp_ubin_size(const mp_int *a) |
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
diff
changeset
|
8 { |
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
diff
changeset
|
9 size_t size = (size_t)mp_count_bits(a); |
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
diff
changeset
|
10 return (size / 8u) + (((size & 7u) != 0u) ? 1u : 0u); |
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
diff
changeset
|
11 } |
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
diff
changeset
|
12 #endif |