1 #include "tommath_private.h"
3 /* LibTomMath, multiple-precision integer library -- Tom St Denis */
4 /* SPDX-License-Identifier: Unlicense */
6 /* store in signed [big endian] format */
7 mp_err
mp_to_sbin(const mp_int
*a
, unsigned char *buf
, size_t maxlen
, size_t *written
)
13 if ((err
= mp_to_ubin(a
, buf
+ 1, maxlen
- 1u, written
)) != MP_OKAY
) {
16 if (written
!= NULL
) {
19 buf
[0] = (a
->sign
== MP_ZPOS
) ? (unsigned char)0 : (unsigned char)1;