aboutsummaryrefslogtreecommitdiff
path: root/crypto/internal.h
diff options
context:
space:
mode:
authorDavid Benjamin <davidben@google.com>2022-05-13 17:06:56 -0400
committerBoringssl LUCI CQ <boringssl-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-06-08 18:05:50 +0000
commit1e469e45a46ff580899cbef939babe02ad916c85 (patch)
treec974f3ebd4ad18e808fea1e5e39ffcefb9e7afd5 /crypto/internal.h
parentf575d9b3632cc6bcaa14e8bb0328c9f68579a342 (diff)
downloadboringssl-1e469e45a46ff580899cbef939babe02ad916c85.zip
boringssl-1e469e45a46ff580899cbef939babe02ad916c85.tar.gz
boringssl-1e469e45a46ff580899cbef939babe02ad916c85.tar.bz2
Replace some more C unions.
I don't think these are all UB by C's rules, but it's easier not to think about the pointers. Still more to go, but these were some easy ones. Bug: 301 Change-Id: Icdcb7fb40f85983cbf566786c5f7dbfd7bb06571 Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/52905 Reviewed-by: Bob Beck <bbe@google.com> Commit-Queue: Bob Beck <bbe@google.com>
Diffstat (limited to 'crypto/internal.h')
-rw-r--r--crypto/internal.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/crypto/internal.h b/crypto/internal.h
index c9b5e8e..2e94399 100644
--- a/crypto/internal.h
+++ b/crypto/internal.h
@@ -881,6 +881,16 @@ static inline void CRYPTO_store_u32_be(void *out, uint32_t v) {
OPENSSL_memcpy(out, &v, sizeof(v));
}
+static inline uint64_t CRYPTO_load_u64_le(const void *in) {
+ uint64_t v;
+ OPENSSL_memcpy(&v, in, sizeof(v));
+ return v;
+}
+
+static inline void CRYPTO_store_u64_le(void *out, uint64_t v) {
+ OPENSSL_memcpy(out, &v, sizeof(v));
+}
+
static inline uint64_t CRYPTO_load_u64_be(const void *ptr) {
uint64_t ret;
OPENSSL_memcpy(&ret, ptr, sizeof(ret));