diff options
author | Joel Sing <jsing@cvs.openbsd.org> | 2023-04-14 10:42:52 +0000 |
---|---|---|
committer | Joel Sing <jsing@cvs.openbsd.org> | 2023-04-14 10:42:52 +0000 |
commit | e263bd605284bca41f4093ec00a68e6227f060ec (patch) | |
tree | a845d18c8933b2f2cfd14d0e361950c5fad0af24 /lib/libcrypto/crypto_internal.h | |
parent | 71c181f2447bf45da32e1dbc31eed5b7c3681c56 (diff) |
Provide soon to be used crypto_store_htobe32().
ok tb@
Diffstat (limited to 'lib/libcrypto/crypto_internal.h')
-rw-r--r-- | lib/libcrypto/crypto_internal.h | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/lib/libcrypto/crypto_internal.h b/lib/libcrypto/crypto_internal.h index fa1dc504f74..24a06256dbf 100644 --- a/lib/libcrypto/crypto_internal.h +++ b/lib/libcrypto/crypto_internal.h @@ -1,4 +1,4 @@ -/* $OpenBSD: crypto_internal.h,v 1.2 2023/04/12 04:54:15 jsing Exp $ */ +/* $OpenBSD: crypto_internal.h,v 1.3 2023/04/14 10:42:51 jsing Exp $ */ /* * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> * @@ -22,6 +22,25 @@ #ifndef HEADER_CRYPTO_INTERNAL_H #define HEADER_CRYPTO_INTERNAL_H +/* + * crypto_store_htobe32() stores a 32 bit unsigned host endian value + * as a 32 bit unsigned big endian value, at the specified location in + * memory. The memory location may have any alignment. + */ +#ifndef HAVE_CRYPTO_STORE_HTOBE32 +static inline void +crypto_store_htobe32(uint8_t *dst, uint32_t v) +{ + v = htobe32(v); + memcpy(dst, &v, sizeof(v)); +} +#endif + +/* + * crypto_store_htobe64() stores a 64 bit unsigned host endian value + * as a 64 bit unsigned big endian value, at the specified location in + * memory. The memory location may have any alignment. + */ #ifndef HAVE_CRYPTO_STORE_HTOBE64 static inline void crypto_store_htobe64(uint8_t *dst, uint64_t v) |