diff options
| author | Mattias Andrée <m@maandree.se> | 2026-09-23 23:26:11 +0200 |
|---|---|---|
| committer | Mattias Andrée <m@maandree.se> | 2026-09-23 23:26:11 +0200 |
| commit | e60342575a888dd13fc2df841a8d4c7ef683ae6e (patch) | |
| tree | b0265cc2a6349fcf2907f55c1c0058a53a4304d4 /librecrypt_concat_uint_.c | |
| parent | Add version testing functionality and bump to version 1.2 (diff) | |
| download | librecrypt-e60342575a888dd13fc2df841a8d4c7ef683ae6e.tar.gz librecrypt-e60342575a888dd13fc2df841a8d4c7ef683ae6e.tar.bz2 librecrypt-e60342575a888dd13fc2df841a8d4c7ef683ae6e.tar.xz | |
Introduce librecrypt_concat_*_
Signed-off-by: Mattias Andrée <m@maandree.se>
Diffstat (limited to '')
| -rw-r--r-- | librecrypt_concat_uint_.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/librecrypt_concat_uint_.c b/librecrypt_concat_uint_.c new file mode 100644 index 0000000..a492e0b --- /dev/null +++ b/librecrypt_concat_uint_.c @@ -0,0 +1,41 @@ +/* See LICENSE file for copyright and license details. */ +#include "common.h" +#ifndef TEST +#include <stdio.h> + +/* TODO use of sprintf(3) should be eliminated; + * this will make it easier to use in an unhosted environment (kernels) + * and make_settings will be AS-Safe, + * however librecrypt_add_algorithm will not be AS-Safe as hash + * functions may require memory allocations which is AS-Unsafe + */ + + +void +librecrypt_concat_uint_(struct concat_state *state, uintmax_t value) +{ + char buf[3u * sizeof(uintmax_t) + 1u]; + int len = sprintf(buf, "%ju", value); + if (len < 1) + abort(); /* $covered$ (impossible reliably) */ + librecrypt_concat_mem_(state, buf, (size_t)len); +} + + +#else + + +int +main(void) +{ + SET_UP_ALARM(); + INIT_RESOURCE_TEST(); + + /* TODO test */ + + STOP_RESOURCE_TEST(); + return 0; +} + + +#endif |
