OPENSSL_LOAD_U16_LE(3ossl)
π OPENSSL_LOAD_U16_LE π
okay bestie, welcome to the 3ossl manual page for OPENSSL_load_u16_le and its entire friend group π«Ά β twelve little header-only functions that read and write unsigned 16, 32 and 64-bit integers in a specific byte order. no cap, they're tiny but they ate.
β¨ NAME β¨
OPENSSL_load_u16_le, OPENSSL_load_u16_be, OPENSSL_load_u32_le, OPENSSL_load_u32_be, OPENSSL_load_u64_le, OPENSSL_load_u64_be, OPENSSL_store_u16_le, OPENSSL_store_u16_be, OPENSSL_store_u32_le, OPENSSL_store_u32_be, OPENSSL_store_u64_le, OPENSSL_store_u64_be β Read and write unsigned 16, 32 and 64-bit integers in a specific byte order. that's the whole job, and they do it flawlessly π
πΈ SYNOPSIS πΈ
#include <openssl/byteorder.h>
static ossl_inline unsigned char *OPENSSL_store_u16_le(
unsigned char *out, uint16_t val);
static ossl_inline unsigned char *OPENSSL_store_u16_be(
unsigned char *out, uint16_t val);
static ossl_inline unsigned char *OPENSSL_store_u32_le(
unsigned char *out, uint32_t val);
static ossl_inline unsigned char *OPENSSL_store_u32_be(
unsigned char *out, uint32_t val);
static ossl_inline unsigned char *OPENSSL_store_u64_le(
unsigned char *out, uint64_t val);
static ossl_inline unsigned char *OPENSSL_store_u64_be(
unsigned char *out, uint64_t val);
static ossl_inline const unsigned char *OPENSSL_load_u16_le(
uint16_t *val, const unsigned char *in);
static ossl_inline const unsigned char *OPENSSL_load_u16_be(
uint16_t *val, const unsigned char *in);
static ossl_inline const unsigned char *OPENSSL_load_u32_le(
uint32_t *val, const unsigned char *in);
static ossl_inline const unsigned char *OPENSSL_load_u32_be(
uint32_t *val, const unsigned char *in);
static ossl_inline const unsigned char *OPENSSL_load_u64_le(
uint64_t *val, const unsigned char *in);
static ossl_inline const unsigned char *OPENSSL_load_u64_be(
uint64_t *val, const unsigned char *in);
look at them all lined up, so organized, so demure π
π¦ DESCRIPTION π¦
so here's the tea β β these functions read and write 16, 32 and 64 bit unsigned integers in a specified byte order. that's it, that's the function.
- the
"_be"girlies use big-endian byte order - the
"_le"girlies use little-endian byte order
they're implemented directly in the header file, and declared static. and when the compiler supports inline functions, they're also declared inline. the way that an optimising compiler will often convert these to just one or two machine instructions π β a load or store with a possible byte swap. literally iconic, the compiler is doing all the heavy lifting for you, as she should π
π the load girlies
the "load" functions write the decoded integer value at the address pointed to by val, which must be a valid (possibly suitably aligned) address of an object of the appropriate type. yes bestie, possibly suitably aligned β that's not me being vague, that's the actual spec, so don't come for me π
π the store girlies
the "store" functions write the encoding of val at the address pointed to by out.
β the convenience moment
for convenience, these functions return the updated input or output pointer, making it easy to continue reading or writing more data at the next memory location. it's giving "chaining, but make it memory" π₯
β οΈ no bounds checks are performed. the caller is responsible for making sure that the input or output buffers are sufficiently large for the requested read or write. that's on YOU, bestie. this is not a drill, there is no safety net, do not come crying to the manpage π
π RETURN VALUES π
all these functions return the next memory address following the last byte written or read. every single one. no exceptions. periodt π
π HISTORY π
these functions were added in OpenSSL 3.5. babygirl is new here but she's already thriving β¨
π COPYRIGHT π
Copyright 2025 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.
okay that's the whole page bestie, go forth and byte-swap responsibly π§ββοΈπ this was OpenSSL 3.5.9, dated 2026-09-29, and the page itself is OPENSSL_LOAD_U16_LE(3ossl) β mwah, love u, bye π«ΆπΈ
π¦ where this page comes from
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms