diff options
author | jsing <> | 2023-04-14 10:42:51 +0000 |
---|---|---|
committer | jsing <> | 2023-04-14 10:42:51 +0000 |
commit | 38e781696b993f5328727fb10c9758dbf229fa61 (patch) | |
tree | 43200e5fbd81e19c965803734d77bd226185114f /src | |
parent | cf895e83a27b7058fe80bc71da00f9a8e4e1ac6f (diff) | |
download | openbsd-38e781696b993f5328727fb10c9758dbf229fa61.tar.gz openbsd-38e781696b993f5328727fb10c9758dbf229fa61.tar.bz2 openbsd-38e781696b993f5328727fb10c9758dbf229fa61.zip |
Provide soon to be used crypto_store_htobe32().
ok tb@
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libcrypto/crypto_internal.h | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/lib/libcrypto/crypto_internal.h b/src/lib/libcrypto/crypto_internal.h index fa1dc504f7..24a06256db 100644 --- a/src/lib/libcrypto/crypto_internal.h +++ b/src/lib/libcrypto/crypto_internal.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: crypto_internal.h,v 1.2 2023/04/12 04:54:15 jsing Exp $ */ | 1 | /* $OpenBSD: crypto_internal.h,v 1.3 2023/04/14 10:42:51 jsing Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> |
4 | * | 4 | * |
@@ -22,6 +22,25 @@ | |||
22 | #ifndef HEADER_CRYPTO_INTERNAL_H | 22 | #ifndef HEADER_CRYPTO_INTERNAL_H |
23 | #define HEADER_CRYPTO_INTERNAL_H | 23 | #define HEADER_CRYPTO_INTERNAL_H |
24 | 24 | ||
25 | /* | ||
26 | * crypto_store_htobe32() stores a 32 bit unsigned host endian value | ||
27 | * as a 32 bit unsigned big endian value, at the specified location in | ||
28 | * memory. The memory location may have any alignment. | ||
29 | */ | ||
30 | #ifndef HAVE_CRYPTO_STORE_HTOBE32 | ||
31 | static inline void | ||
32 | crypto_store_htobe32(uint8_t *dst, uint32_t v) | ||
33 | { | ||
34 | v = htobe32(v); | ||
35 | memcpy(dst, &v, sizeof(v)); | ||
36 | } | ||
37 | #endif | ||
38 | |||
39 | /* | ||
40 | * crypto_store_htobe64() stores a 64 bit unsigned host endian value | ||
41 | * as a 64 bit unsigned big endian value, at the specified location in | ||
42 | * memory. The memory location may have any alignment. | ||
43 | */ | ||
25 | #ifndef HAVE_CRYPTO_STORE_HTOBE64 | 44 | #ifndef HAVE_CRYPTO_STORE_HTOBE64 |
26 | static inline void | 45 | static inline void |
27 | crypto_store_htobe64(uint8_t *dst, uint64_t v) | 46 | crypto_store_htobe64(uint8_t *dst, uint64_t v) |