diff options
Diffstat (limited to 'src/lib/libcrypto/crypto_internal.h')
-rw-r--r-- | src/lib/libcrypto/crypto_internal.h | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/src/lib/libcrypto/crypto_internal.h b/src/lib/libcrypto/crypto_internal.h index af2a87216e..fa1dc504f7 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.1 2023/04/12 04:40:39 jsing Exp $ */ | 1 | /* $OpenBSD: crypto_internal.h,v 1.2 2023/04/12 04:54:15 jsing Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> |
4 | * | 4 | * |
@@ -31,4 +31,36 @@ crypto_store_htobe64(uint8_t *dst, uint64_t v) | |||
31 | } | 31 | } |
32 | #endif | 32 | #endif |
33 | 33 | ||
34 | #ifndef HAVE_CRYPTO_ROL_U32 | ||
35 | static inline uint32_t | ||
36 | crypto_rol_u32(uint32_t v, size_t shift) | ||
37 | { | ||
38 | return (v << shift) | (v >> (32 - shift)); | ||
39 | } | ||
40 | #endif | ||
41 | |||
42 | #ifndef HAVE_CRYPTO_ROR_U32 | ||
43 | static inline uint32_t | ||
44 | crypto_ror_u32(uint32_t v, size_t shift) | ||
45 | { | ||
46 | return (v << (32 - shift)) | (v >> shift); | ||
47 | } | ||
48 | #endif | ||
49 | |||
50 | #ifndef HAVE_CRYPTO_ROL_U64 | ||
51 | static inline uint64_t | ||
52 | crypto_rol_u64(uint64_t v, size_t shift) | ||
53 | { | ||
54 | return (v << shift) | (v >> (64 - shift)); | ||
55 | } | ||
56 | #endif | ||
57 | |||
58 | #ifndef HAVE_CRYPTO_ROR_U64 | ||
59 | static inline uint64_t | ||
60 | crypto_ror_u64(uint64_t v, size_t shift) | ||
61 | { | ||
62 | return (v << (64 - shift)) | (v >> shift); | ||
63 | } | ||
64 | #endif | ||
65 | |||
34 | #endif | 66 | #endif |