summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/modes/modes_lcl.h
diff options
context:
space:
mode:
authortb <>2022-11-26 16:08:57 +0000
committertb <>2022-11-26 16:08:57 +0000
commitd0a21970fdc0fbbfc7ad31bc135f5a8fde1d3d49 (patch)
tree556ebf909e81599dc3d8da585217d1576eabe0e4 /src/lib/libcrypto/modes/modes_lcl.h
parentbcbac728558eebfaa4404c405e7dc22769585345 (diff)
downloadopenbsd-d0a21970fdc0fbbfc7ad31bc135f5a8fde1d3d49.tar.gz
openbsd-d0a21970fdc0fbbfc7ad31bc135f5a8fde1d3d49.tar.bz2
openbsd-d0a21970fdc0fbbfc7ad31bc135f5a8fde1d3d49.zip
Make internal header file names consistent
Libcrypto currently has a mess of *_lcl.h, *_locl.h, and *_local.h names used for internal headers. Move all these headers we inherited from OpenSSL to *_local.h, reserving the name *_internal.h for our own code. Similarly, move dtls_locl.h and ssl_locl.h to dtls_local and ssl_local.h. constant_time_locl.h is moved to constant_time.h since it's special. Adjust all .c files in libcrypto, libssl and regress. The diff is mechanical with the exception of tls13_quic.c, where #include <ssl_locl.h> was fixed manually. discussed with jsing, no objection bcook
Diffstat (limited to 'src/lib/libcrypto/modes/modes_lcl.h')
-rw-r--r--src/lib/libcrypto/modes/modes_lcl.h111
1 files changed, 0 insertions, 111 deletions
diff --git a/src/lib/libcrypto/modes/modes_lcl.h b/src/lib/libcrypto/modes/modes_lcl.h
deleted file mode 100644
index 91820897f7..0000000000
--- a/src/lib/libcrypto/modes/modes_lcl.h
+++ /dev/null
@@ -1,111 +0,0 @@
1/* $OpenBSD: modes_lcl.h,v 1.11 2021/11/09 18:40:21 bcook Exp $ */
2/* ====================================================================
3 * Copyright (c) 2010 The OpenSSL Project. All rights reserved.
4 *
5 * Redistribution and use is governed by OpenSSL license.
6 * ====================================================================
7 */
8
9#include <endian.h>
10
11#include <openssl/opensslconf.h>
12
13#include <openssl/modes.h>
14
15__BEGIN_HIDDEN_DECLS
16
17#if defined(_LP64)
18typedef long i64;
19typedef unsigned long u64;
20#define U64(C) C##UL
21#else
22typedef long long i64;
23typedef unsigned long long u64;
24#define U64(C) C##ULL
25#endif
26
27typedef unsigned int u32;
28typedef unsigned char u8;
29
30#if !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM)
31#if defined(__GNUC__) && __GNUC__>=2
32# if defined(__x86_64) || defined(__x86_64__)
33# define BSWAP8(x) ({ u64 ret=(x); \
34 asm ("bswapq %0" \
35 : "+r"(ret)); ret; })
36# define BSWAP4(x) ({ u32 ret=(x); \
37 asm ("bswapl %0" \
38 : "+r"(ret)); ret; })
39# elif (defined(__i386) || defined(__i386__))
40# define BSWAP8(x) ({ u32 lo=(u64)(x)>>32,hi=(x); \
41 asm ("bswapl %0; bswapl %1" \
42 : "+r"(hi),"+r"(lo)); \
43 (u64)hi<<32|lo; })
44# define BSWAP4(x) ({ u32 ret=(x); \
45 asm ("bswapl %0" \
46 : "+r"(ret)); ret; })
47# elif (defined(__arm__) || defined(__arm)) && !defined(__STRICT_ALIGNMENT)
48# define BSWAP8(x) ({ u32 lo=(u64)(x)>>32,hi=(x); \
49 asm ("rev %0,%0; rev %1,%1" \
50 : "+r"(hi),"+r"(lo)); \
51 (u64)hi<<32|lo; })
52# define BSWAP4(x) ({ u32 ret; \
53 asm ("rev %0,%1" \
54 : "=r"(ret) : "r"((u32)(x))); \
55 ret; })
56# endif
57#endif
58#endif
59
60#if defined(BSWAP4) && !defined(__STRICT_ALIGNMENT)
61#define GETU32(p) BSWAP4(*(const u32 *)(p))
62#define PUTU32(p,v) *(u32 *)(p) = BSWAP4(v)
63#else
64#define GETU32(p) ((u32)(p)[0]<<24|(u32)(p)[1]<<16|(u32)(p)[2]<<8|(u32)(p)[3])
65#define PUTU32(p,v) ((p)[0]=(u8)((v)>>24),(p)[1]=(u8)((v)>>16),(p)[2]=(u8)((v)>>8),(p)[3]=(u8)(v))
66#endif
67
68/* GCM definitions */
69
70typedef struct { u64 hi,lo; } u128;
71
72#ifdef TABLE_BITS
73#undef TABLE_BITS
74#endif
75/*
76 * Even though permitted values for TABLE_BITS are 8, 4 and 1, it should
77 * never be set to 8 [or 1]. For further information see gcm128.c.
78 */
79#define TABLE_BITS 4
80
81struct gcm128_context {
82 /* Following 6 names follow names in GCM specification */
83 union { u64 u[2]; u32 d[4]; u8 c[16]; size_t t[16/sizeof(size_t)]; }
84 Yi,EKi,EK0,len,Xi,H;
85 /* Relative position of Xi, H and pre-computed Htable is used
86 * in some assembler modules, i.e. don't change the order! */
87#if TABLE_BITS==8
88 u128 Htable[256];
89#else
90 u128 Htable[16];
91 void (*gmult)(u64 Xi[2],const u128 Htable[16]);
92 void (*ghash)(u64 Xi[2],const u128 Htable[16],const u8 *inp,size_t len);
93#endif
94 unsigned int mres, ares;
95 block128_f block;
96 void *key;
97};
98
99struct xts128_context {
100 void *key1, *key2;
101 block128_f block1,block2;
102};
103
104struct ccm128_context {
105 union { u64 u[2]; u8 c[16]; } nonce, cmac;
106 u64 blocks;
107 block128_f block;
108 void *key;
109};
110
111__END_HIDDEN_DECLS