Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
db4543ad54 | ||
|
|
06b93f7bdb | ||
|
|
c2b59f5d4a | ||
|
|
4456467c50 | ||
|
|
a25e89b220 | ||
|
|
b743de6747 | ||
|
|
3d87ec6720 | ||
|
|
80c7d1ed53 | ||
|
|
9fadb58c76 | ||
|
|
a818ace83c | ||
|
|
31883edc09 | ||
|
|
61b9031269 | ||
|
|
d49ebe521d | ||
|
|
292c3191dc | ||
|
|
5e012019ba | ||
|
|
42dd70fe20 | ||
|
|
3d18b2119a | ||
|
|
70556391dd | ||
|
|
d4f10db1f2 | ||
|
|
9ce1a58bc3 | ||
|
|
d7accf1d30 | ||
|
|
5227d4d78e | ||
|
|
808747f9d2 | ||
|
|
599c891c00 | ||
|
|
12b1bd4786 | ||
|
|
1076e7614a | ||
|
|
774c0d2545 | ||
|
|
3f1957a9c9 | ||
|
|
5f124fcb3a | ||
|
|
425d737ca0 | ||
|
|
5841f27df9 | ||
|
|
c73db530f4 | ||
|
|
59f0f16f74 | ||
|
|
cac5adaafc | ||
|
|
88269df548 | ||
|
|
613aa7291a | ||
|
|
697044d84b | ||
|
|
0378e96470 | ||
|
|
3fe3a11494 | ||
|
|
b63c97c5eb | ||
|
|
f5ac7ba45f | ||
|
|
23fb50b7d4 | ||
|
|
81f0d6c031 | ||
|
|
4aedca8ee0 | ||
|
|
3ab5154db1 | ||
|
|
a801a2999a | ||
|
|
445bd8bbb9 | ||
|
|
915c587964 | ||
|
|
f33a205fd9 | ||
|
|
29d7ee1a18 | ||
|
|
fd1b085279 | ||
|
|
0a0b709e8a | ||
|
|
ac43ad92ef | ||
|
|
f29150d20e | ||
|
|
66acde0301 | ||
|
|
5ed1a07dc4 | ||
|
|
d365a4f948 | ||
|
|
51747dc0ea | ||
|
|
36618b0ad0 | ||
|
|
cdd9c56b3d | ||
|
|
5501889d33 | ||
|
|
235a8a622c | ||
|
|
b2c0d81396 | ||
|
|
c7e23f750d | ||
|
|
5eb44307ee | ||
|
|
5bb24d714a | ||
|
|
6fd6e9cbaa | ||
|
|
2cbed0dcdf | ||
|
|
2e34e49186 | ||
|
|
d8048979e3 | ||
|
|
5f40f3726c | ||
|
|
2a97471b51 | ||
|
|
7240879792 | ||
|
|
4309865570 | ||
|
|
3b3aed50e5 | ||
|
|
0b22d5e870 | ||
|
|
a628c19341 | ||
|
|
49ba0c4850 | ||
|
|
6b87a31c6f | ||
|
|
a190c21217 | ||
|
|
f96e4a7320 | ||
|
|
74d64fec87 | ||
|
|
4884b080e8 | ||
|
|
f77b18aa68 | ||
|
|
cc9ce35c4d | ||
|
|
6a51116873 | ||
|
|
d6b04a98f0 | ||
|
|
ab83f5d685 | ||
|
|
ca4e85826f | ||
|
|
1e336113a5 | ||
|
|
356aa27108 | ||
|
|
8c0351b45b | ||
|
|
d3c165de79 | ||
|
|
c66f410831 | ||
|
|
8b92f32c47 | ||
|
|
454d25d37f | ||
|
|
951b4072e5 | ||
|
|
c4021e1fc9 | ||
|
|
4f9bfb0fdc | ||
|
|
8807321f1d | ||
|
|
559681ea01 | ||
|
|
e99092ca70 | ||
|
|
ebc2d03290 | ||
|
|
0a6cbbbf06 | ||
|
|
36ae4b3057 | ||
|
|
cbb84809d8 | ||
|
|
96f1bacd43 | ||
|
|
6a3d536d38 | ||
|
|
389de9d456 | ||
|
|
bc75e1ae99 | ||
|
|
46f4bf2dfb | ||
|
|
50a489e316 | ||
|
|
99db28e2e2 | ||
|
|
cc891e3670 | ||
|
|
d4f312c9d8 | ||
|
|
de621aa555 | ||
|
|
82f59b2469 | ||
|
|
1d875ddbd1 | ||
|
|
dcb5ae25c6 | ||
|
|
56a937fabb | ||
|
|
dc4fd792f6 | ||
|
|
5bff9df3fc | ||
|
|
45e1dd9f6c | ||
|
|
13c02fe50b | ||
|
|
cd10d0cc1b | ||
|
|
1c832ff7f2 | ||
|
|
3d388f8e45 | ||
|
|
27b5431130 | ||
|
|
bb55f52b29 | ||
|
|
4a3cded174 | ||
|
|
106ac2ff0f | ||
|
|
6bfa4294cc | ||
|
|
c11df75225 | ||
|
|
4d2abf34d0 | ||
|
|
3a158a241c | ||
|
|
4146c73657 | ||
|
|
4c0e86dcc5 | ||
|
|
bfb17d0d25 | ||
|
|
6236ed1eb4 | ||
|
|
c271911fcb | ||
|
|
27d40f5678 | ||
|
|
a7dd86ff0f | ||
|
|
b4cb34fea9 | ||
|
|
1456882f16 | ||
|
|
3b1626f415 | ||
|
|
315a0855dc | ||
|
|
eaa10cc7d3 | ||
|
|
1c5fab1645 | ||
|
|
cc3e11d30d | ||
|
|
7c5bf3e73d | ||
|
|
929065e7be | ||
|
|
5ce453797c | ||
|
|
ae37e812ee | ||
|
|
d9a1a9ebcb | ||
|
|
16f23e164c | ||
|
|
39f0928de7 | ||
|
|
8f718d9b39 | ||
|
|
abe7e99a77 | ||
|
|
ac5b174b5f | ||
|
|
cc0e4bbd7a | ||
|
|
73aa2725b9 | ||
|
|
37d0297f07 | ||
|
|
7160ea8f42 | ||
|
|
434812f87d | ||
|
|
c99a1c375e | ||
|
|
fff7c67af6 | ||
|
|
3ae6298746 | ||
|
|
38cd207f5d | ||
|
|
6c8336b497 | ||
|
|
c208b7368e | ||
|
|
15a50db0a7 | ||
|
|
ca35e6e26f | ||
|
|
679136e73e | ||
|
|
b637c94e24 | ||
|
|
f76cd79bb0 | ||
|
|
39c8daa9b0 | ||
|
|
cd4f3675fd | ||
|
|
bbb3d8c2fa | ||
|
|
ca671d6453 | ||
|
|
a522424491 | ||
|
|
b1ddec1b8a | ||
|
|
1922f87dd2 | ||
|
|
8eab26c1f6 | ||
|
|
04f4eb9947 | ||
|
|
5cea1167be | ||
|
|
0c04f7516b | ||
|
|
e6b4fe3a85 | ||
|
|
d3a339247b | ||
|
|
33986f4893 | ||
|
|
e5f5720867 | ||
|
|
d7b49a3d06 | ||
|
|
c85039ea0a | ||
|
|
a447452521 | ||
|
|
614b03994c | ||
|
|
99e3bcbc6d | ||
|
|
8f02e73b9c | ||
|
|
7651ee8602 | ||
|
|
4ff965a2b4 | ||
|
|
77b688c981 | ||
|
|
c93f09e9ac | ||
|
|
96b9eea70a | ||
|
|
ca0d7626d2 | ||
|
|
8d4c118ae6 | ||
|
|
d477cbfee9 | ||
|
|
870a5832ea | ||
|
|
8e0f1283c6 | ||
|
|
2de21b2b6b | ||
|
|
53b7151fb7 | ||
|
|
d2149851b2 | ||
|
|
ca6f76565c | ||
|
|
d15cd77a28 | ||
|
|
1a9312d2d1 | ||
|
|
f3a8406050 | ||
|
|
ff6b290580 | ||
|
|
da0ec983ba | ||
|
|
6220335f63 | ||
|
|
c7f7b7b29b | ||
|
|
59fead7b5f | ||
|
|
b89428bf35 | ||
|
|
3928dd76a3 | ||
|
|
d80d8f21da | ||
|
|
d269df9171 | ||
|
|
2fb6252285 | ||
|
|
2c3e1ca518 | ||
|
|
f72fda9b71 | ||
|
|
c906a46bcc | ||
|
|
6c9fef8793 | ||
|
|
bbdb4104bf | ||
|
|
8d0f419093 | ||
|
|
f3a05c14b1 | ||
|
|
d118558eda | ||
|
|
76decec0fe | ||
|
|
9eed43bc8d | ||
|
|
a72e6eb391 | ||
|
|
e9d60e6e23 | ||
|
|
42df128f62 | ||
|
|
32cc7af371 | ||
|
|
033ff077ef | ||
|
|
0416dadbba | ||
|
|
91238da50d | ||
|
|
221617fe02 | ||
|
|
dd845823b6 | ||
|
|
b41b27bfe4 | ||
|
|
6bcd593b6d | ||
|
|
5c77f5ce14 | ||
|
|
ac2855198b | ||
|
|
52b4afb8cf | ||
|
|
35dc2d89a0 | ||
|
|
d99122b25f | ||
|
|
d55d40e7a2 | ||
|
|
25a6e2d07a | ||
|
|
18259b8526 | ||
|
|
f04d892ac8 | ||
|
|
c844ba7614 | ||
|
|
09018e2b4d | ||
|
|
6045baadb8 | ||
|
|
84e3565de1 | ||
|
|
70dbb6b255 | ||
|
|
0ddbc1aced | ||
|
|
8bd6f3b60a | ||
|
|
8815c4f896 | ||
|
|
8de5c00a39 | ||
|
|
d359148841 | ||
|
|
11e8b122fe | ||
|
|
0a1ecfc4ab | ||
|
|
c08315cd79 | ||
|
|
5611ba621c | ||
|
|
c6c6e1d5ef | ||
|
|
61089e5fae | ||
|
|
bcde74368d | ||
|
|
6ba6b0289d | ||
|
|
86c4f14cf4 | ||
|
|
13052b7cae | ||
|
|
43398e405e | ||
|
|
29929e48b2 | ||
|
|
d0bad75284 | ||
|
|
9d2e9ec8ca | ||
|
|
2d7f224a22 | ||
|
|
c8973282cb | ||
|
|
7bbc47a0ee | ||
|
|
eeacbe5d61 | ||
|
|
7c09e9dd8c | ||
|
|
d99510e46d | ||
|
|
b97f086c0c | ||
|
|
f24e7acc48 | ||
|
|
0cd7516bde | ||
|
|
a646e0417d | ||
|
|
23c9a4f242 | ||
|
|
85a5774a0f | ||
|
|
f2a95848ce | ||
|
|
f146af121a | ||
|
|
72dcdc5a6f | ||
|
|
8e170cf971 | ||
|
|
6d0b1bb07b | ||
|
|
bcccbefb77 | ||
|
|
92f6683fe1 | ||
|
|
d7408ad4df | ||
|
|
5296e534ed | ||
|
|
5a1430e904 | ||
|
|
218ee4f43d | ||
|
|
45553ec5b6 | ||
|
|
837d89c8b5 | ||
|
|
c1433b4b5d | ||
|
|
71963b740b | ||
|
|
5b37df26fd | ||
|
|
851fed4739 | ||
|
|
103123f533 | ||
|
|
66c950cecb | ||
|
|
91d4c0a523 | ||
|
|
abafd673a2 | ||
|
|
2765d95950 | ||
|
|
931492a294 | ||
|
|
d3b9e7faae | ||
|
|
5757ec7965 | ||
|
|
eaa0cc6d0b | ||
|
|
63ef75b7ce | ||
|
|
1335d636da | ||
|
|
b4ef42923a | ||
|
|
8c64886512 | ||
|
|
773f5d5973 | ||
|
|
2843a260b0 | ||
|
|
3f662f1ca7 | ||
|
|
8e5ec20cf2 | ||
|
|
96688166ba | ||
|
|
1f538719a8 | ||
|
|
9f6476a7c4 | ||
|
|
5a20355547 | ||
|
|
1430ab3261 | ||
|
|
ec7cfa1d63 | ||
|
|
fc0be64880 | ||
|
|
be09b271e1 | ||
|
|
4064bbe25d | ||
|
|
fcd3b13ca8 | ||
|
|
99be79b7ae | ||
|
|
dc83c2df42 | ||
|
|
a52874fe08 | ||
|
|
7aeb7b6ed5 | ||
|
|
498c7d15b3 | ||
|
|
9aca587654 | ||
|
|
da024fb3fb | ||
|
|
a5a04aaab7 | ||
|
|
c846d11efa | ||
|
|
9fe8ab746a | ||
|
|
8c7f612449 | ||
|
|
d1aa7a2c02 | ||
|
|
c0a632a4c6 | ||
|
|
085543b0f1 | ||
|
|
1fd431ba76 | ||
|
|
268a427172 | ||
|
|
620aaf6827 | ||
|
|
d6fb612475 | ||
|
|
54c88539e5 | ||
|
|
92bf9c9ccb | ||
|
|
99fc15ae41 | ||
|
|
62e962f216 | ||
|
|
740ec8baf3 | ||
|
|
83d671c90f | ||
|
|
5b7d3903b5 | ||
|
|
da443283f2 | ||
|
|
e5bb405f79 | ||
|
|
6e743ada0b | ||
|
|
d808462fe1 | ||
|
|
e264e092f6 | ||
|
|
707dcdbbb4 | ||
|
|
1c1bb3a5ff | ||
|
|
cd43caafb2 | ||
|
|
d757c33bcb | ||
|
|
5af017bf09 | ||
|
|
32a75f4670 | ||
|
|
d7f38ecfdb | ||
|
|
6485e800d6 | ||
|
|
fba4143dd1 | ||
|
|
4ea6ed252c | ||
|
|
534d3650c4 | ||
|
|
2ed86b5e08 | ||
|
|
8dd1c936e2 | ||
|
|
ccab37658a | ||
|
|
4e0627e6a3 | ||
|
|
dc48091d5b | ||
|
|
4d2b12a9dd | ||
|
|
4279e79aa7 | ||
|
|
14387d69ca | ||
|
|
744ebfba0d | ||
|
|
5a92c3306f | ||
|
|
5d9554780f | ||
|
|
84a52b9dcf | ||
|
|
571ec7d80c | ||
|
|
ead4f909ee | ||
|
|
e762e3cbd1 | ||
|
|
6c32b478af | ||
|
|
b813d94486 | ||
|
|
0fe67b16d5 | ||
|
|
b69d61617f | ||
|
|
929436e29d |
No files matched your search
@@ -1,6 +1,10 @@
|
|||||||
# Auto detect text files and perform LF normalization
|
# Auto detect text files and perform LF normalization
|
||||||
* text=auto
|
* text=auto
|
||||||
|
|
||||||
|
# Shell scripts must keep LF line endings even when checked out on Windows,
|
||||||
|
# otherwise Linux refuses them with "bad interpreter: /usr/bin/env^M".
|
||||||
|
*.sh text eol=lf
|
||||||
|
|
||||||
# Custom for Visual Studio
|
# Custom for Visual Studio
|
||||||
*.cs diff=csharp
|
*.cs diff=csharp
|
||||||
|
|
||||||
|
|||||||
+19
@@ -81,7 +81,26 @@ Releases/*
|
|||||||
linux/Makefile
|
linux/Makefile
|
||||||
linux/cmake_install.cmake
|
linux/cmake_install.cmake
|
||||||
.vs
|
.vs
|
||||||
|
client/ghost_vs2015.vcxproj.user
|
||||||
docs/macOS_Support_Design.md
|
docs/macOS_Support_Design.md
|
||||||
settings.local.json
|
settings.local.json
|
||||||
*.zip
|
*.zip
|
||||||
*.lic
|
*.lic
|
||||||
|
YAMA.code-workspace
|
||||||
|
.claude/settings.json
|
||||||
|
.vscode/settings.json
|
||||||
|
Bin/*
|
||||||
|
nul
|
||||||
|
server/go/web/assets/index.html
|
||||||
|
server/go/users.json
|
||||||
|
server/go/devices.json
|
||||||
|
server/go/build/
|
||||||
|
server/go/cmd/*.syso
|
||||||
|
server/go/.claude/settings.json
|
||||||
|
android/app/.cxx/
|
||||||
|
|
||||||
|
# MCP 工具清单的中间产物(dump_tools.py 的默认输出)
|
||||||
|
tools_raw.json
|
||||||
|
|
||||||
|
# AI 助手的本地工作记忆(含个人上下文,与 .claude/settings.json 同理)
|
||||||
|
.workbuddy-ai/
|
||||||
+90
-5
@@ -2,20 +2,105 @@
|
|||||||
|
|
||||||
## compress
|
## compress
|
||||||
|
|
||||||
|
Prebuilt binaries under `compress/`, linked via `#pragma comment(lib, ...)`.
|
||||||
|
|
||||||
- [zlib v1.3.2](https://zlib.net)
|
- [zlib v1.3.2](https://zlib.net)
|
||||||
- [zstd v1.5.7](https://github.com/facebook/zstd/tree/v1.5.7)
|
- [zstd v1.5.7](https://github.com/facebook/zstd/tree/v1.5.7)
|
||||||
- [x264 v0.164.3194](https://github.com/corecodec/x264)
|
- [x264 v0.164.3194](https://github.com/corecodec/x264) — GPL-2.0, see note below
|
||||||
- [libyuv v190](https://chromium.googlesource.com/libyuv/libyuv)
|
- [libyuv v190](https://chromium.googlesource.com/libyuv/libyuv)
|
||||||
- [ffmpeg 7.1](https://git.ffmpeg.org/ffmpeg.git)
|
- [ffmpeg 7.1](https://git.ffmpeg.org/ffmpeg.git) — LGPL-2.1, linked statically, see note below
|
||||||
- [jsoncpp v1.9.6](https://github.com/open-source-parsers/jsoncpp)
|
- [jsoncpp v1.9.6](https://github.com/open-source-parsers/jsoncpp)
|
||||||
- [jpeg v3.1.1](https://github.com/libjpeg-turbo/libjpeg-turbo)
|
- [jpeg v3.1.1](https://github.com/libjpeg-turbo/libjpeg-turbo)
|
||||||
- [opus-1.6.1](https://opus-codec.org/release/stable/2026/01/14/libopus-1_6_1.html)
|
- [opus-1.6.1](https://opus-codec.org/release/stable/2026/01/14/libopus-1_6_1.html)
|
||||||
- [libpeconv c7d1e48](https://github.com/hasherezade/libpeconv)
|
- [libpeconv c7d1e48](https://github.com/hasherezade/libpeconv) — `server/2015Remote/libpeconv/`
|
||||||
|
- [libvpl v2.16.0](https://github.com/intel/libvpl) — `compress/ffmpeg/vpl_x64*.lib`
|
||||||
|
- [dav1d 62501cc](https://github.com/videolan/dav1d) — `compress/ffmpeg/dav1d_x64.lib`
|
||||||
|
|
||||||
|
## execution
|
||||||
|
|
||||||
|
- [MemoryModule](https://github.com/fancycode/MemoryModule.git) — `client/MemoryModule.c`
|
||||||
|
- [sRDI](https://github.com/Drewsif/sRDI.git)
|
||||||
|
- [pe_to_shellcode](https://github.com/hasherezade/pe_to_shellcode.git)
|
||||||
|
|
||||||
|
## vendored source
|
||||||
|
|
||||||
|
Single-file libraries compiled into the product as source.
|
||||||
|
|
||||||
|
- [KCP (ikcp)](https://github.com/skywind3000/kcp) — `common/ikcp.c`, `common/ikcp.h`
|
||||||
|
- [xxHash v0.8.3](https://github.com/Cyan4973/xxHash) — `common/xxhash.h`
|
||||||
|
- [tiny-AES-c](https://github.com/kokke/tiny-AES-c) — `common/aes.c`, `common/aes.h`
|
||||||
|
- [skCrypter](https://github.com/skadro-official/skCrypter) — `common/skCrypter.h`
|
||||||
|
- [cpp-httplib v0.14.3](https://github.com/yhirose/cpp-httplib) — `server/2015Remote/httplib.h`
|
||||||
|
|
||||||
|
## runtime / data
|
||||||
|
|
||||||
|
Shipped with the product or linked by the Linux/macOS builds.
|
||||||
|
|
||||||
|
- [OpenSSL](https://github.com/openssl/openssl) — Linux/macOS client TLS (`client/TlsChannelLinux.cpp`) and `libsign.a` HMAC; version follows the system/package OpenSSL 3.x
|
||||||
|
- [FRP (frpc / frps) v0.69.2-0.20260605064132-d58c00d0332c](https://github.com/fatedier/frp) — `Bin/res/frpc.dll`, `Bin/res/frps.dll`
|
||||||
|
- [ip2region (xdb v4)](https://github.com/lionsoul2014/ip2region) — `Bin/ip2region_v4.xdb`
|
||||||
|
- [QQWry / 纯真 IP 库](https://www.cz88.net/) — `Bin/qqwry.dat`
|
||||||
|
- Microsoft DirectX SDK headers — `client/d3d/`, included by `client/dxtrans.h` for legacy D3D texture formats; used under the DirectX SDK EULA, not open source
|
||||||
|
|
||||||
|
## server-go
|
||||||
|
|
||||||
|
`server/go/`, shipped as `Bin/YAMAGo_x64.exe`.
|
||||||
|
|
||||||
|
- [github.com/golang-jwt/jwt/v5 v5.3.1](https://github.com/golang-jwt/jwt)
|
||||||
|
- [github.com/gorilla/websocket v1.5.3](https://github.com/gorilla/websocket)
|
||||||
|
- [github.com/klauspost/compress v1.18.2](https://github.com/klauspost/compress)
|
||||||
|
- [github.com/rs/zerolog v1.34.0](https://github.com/rs/zerolog)
|
||||||
|
- [golang.org/x/sync v0.20.0](https://pkg.go.dev/golang.org/x/sync)
|
||||||
|
- [golang.org/x/text v0.32.0](https://pkg.go.dev/golang.org/x/text)
|
||||||
|
- [gopkg.in/natefinch/lumberjack.v2 v2.2.1](https://github.com/natefinch/lumberjack)
|
||||||
|
- indirect: [mattn/go-colorable v0.1.13](https://github.com/mattn/go-colorable), [mattn/go-isatty v0.0.19](https://github.com/mattn/go-isatty), [golang.org/x/sys v0.12.0](https://pkg.go.dev/golang.org/x/sys)
|
||||||
|
|
||||||
|
## android
|
||||||
|
|
||||||
|
`android/`, shipped as `Bin/ghost.apk`.
|
||||||
|
|
||||||
|
- [androidx.core:core-ktx 1.13.1](https://developer.android.com/jetpack/androidx/releases/core)
|
||||||
|
- [androidx.appcompat:appcompat 1.7.0](https://developer.android.com/jetpack/androidx/releases/appcompat)
|
||||||
|
- [Kotlin standard library 2.1.21](https://kotlinlang.org/)
|
||||||
|
|
||||||
|
## test
|
||||||
|
|
||||||
|
Build/test only, not shipped.
|
||||||
|
|
||||||
|
- [GoogleTest v1.14.0](https://github.com/google/googletest) — fetched via CMake `FetchContent`
|
||||||
|
|
||||||
## *Note*
|
## *Note*
|
||||||
|
|
||||||
The proper operation of the program depends on the above library files.
|
The proper operation of the program depends on the above library files.
|
||||||
Some libraries are not open source, please contact author for details.
|
Some libraries are not open source, please contact author for details.
|
||||||
|
|
||||||
These libraries are all compiled personally by the author and can be used with confidence.
|
These libraries are all compiled personally by the author and can be used with confidence.
|
||||||
If you use libraries from other sources, there may be compilation risks.
|
If you use libraries from other sources, there may be compilation risks.
|
||||||
|
|
||||||
|
### Private libraries (not third-party)
|
||||||
|
|
||||||
|
`lib/` ships `FileUpload_Lib`, `PrivateDesktop_Lib` and `shrink` as prebuilt
|
||||||
|
binaries; `linux/lib/libsign.a`, `macos/lib/libsign.a` and
|
||||||
|
`android/.../lib/<abi>/libsign.a` are likewise the author's own. They are part
|
||||||
|
of the multi-layer licensing architecture and are **not** covered by the
|
||||||
|
open-source notices above.
|
||||||
|
|
||||||
|
### GPL note
|
||||||
|
|
||||||
|
`x264` is GPL-2.0 and `ffmpeg` is LGPL-2.1; both are linked **statically** on
|
||||||
|
Windows. `common/config.h` exposes `DISABLE_X264_FOR_TEST` and
|
||||||
|
`DISABLE_FFMPEG_FOR_TEST` (both default `0`, i.e. enabled) to build without
|
||||||
|
them. With `DISABLE_X264_FOR_TEST=1` neither the x264 library nor its headers
|
||||||
|
are needed — the whole `compress/x264/` directory can be deleted. The same
|
||||||
|
holds for `DISABLE_FFMPEG_FOR_TEST=1` and `compress/ffmpeg/`.
|
||||||
|
|
||||||
|
Binaries that include x264 are subject to GPL-2.0 unless covered by a
|
||||||
|
commercial x264 license.
|
||||||
|
|
||||||
|
**Important:** the bundled FFmpeg is a decode-only build (`--disable-encoders`,
|
||||||
|
see the configure line in `LICENSE-THIRD-PARTY.txt` section 19), so it provides
|
||||||
|
no encoder. x264 is therefore the product's *only* H.264 encoder, and
|
||||||
|
`DISABLE_X264_FOR_TEST=1` means no H.264 at all — the client falls back to raw
|
||||||
|
RGB565 frames. Keeping H.264 while staying GPL-free needs a different encoder
|
||||||
|
or a commercial x264 license. See `LICENSE-THIRD-PARTY.txt` for the full text
|
||||||
|
and the obligations that come with static LGPL linking.
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2019-2026 yuanyuanxiang
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to furnish persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE, OR IN CONNECTION WITH THE USE OR
|
||||||
|
OTHER DEALINGS IN THE SOFTWARE.
|
||||||
@@ -0,0 +1,657 @@
|
|||||||
|
THIRD-PARTY SOFTWARE NOTICES AND LICENSES
|
||||||
|
|
||||||
|
This document contains intellectual property notices and license information for
|
||||||
|
third-party software components used in this product.
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
SUMMARY OF LICENSE TYPES
|
||||||
|
================================================================================
|
||||||
|
The third-party components included in this software are governed by the following
|
||||||
|
open-source licenses. For complete compliance, ensure that any modifications to
|
||||||
|
LGPL, MPL and GPL covered components are made available under their respective
|
||||||
|
terms, and this text file is distributed with your software product.
|
||||||
|
|
||||||
|
1. Zlib License
|
||||||
|
- zlib v1.3.2
|
||||||
|
2. BSD 3-Clause License
|
||||||
|
- zstd v1.5.7
|
||||||
|
- libyuv v190
|
||||||
|
- jpeg (libjpeg-turbo) v3.1.1
|
||||||
|
- opus-1.6.1
|
||||||
|
- GoogleTest v1.14.0
|
||||||
|
- github.com/klauspost/compress v1.18.2
|
||||||
|
- golang.org/x/sync, golang.org/x/text, golang.org/x/sys
|
||||||
|
3. BSD 2-Clause License
|
||||||
|
- libpeconv c7d1e48
|
||||||
|
- pe_to_shellcode
|
||||||
|
- dav1d 62501cc
|
||||||
|
- xxHash v0.8.3
|
||||||
|
- github.com/gorilla/websocket v1.5.3
|
||||||
|
4. MIT License
|
||||||
|
- jsoncpp v1.9.6
|
||||||
|
- sRDI
|
||||||
|
- libvpl v2.16.0
|
||||||
|
- KCP (ikcp)
|
||||||
|
- skCrypter
|
||||||
|
- cpp-httplib v0.14.3
|
||||||
|
- github.com/golang-jwt/jwt/v5 v5.3.1
|
||||||
|
- github.com/rs/zerolog v1.34.0
|
||||||
|
- gopkg.in/natefinch/lumberjack.v2 v2.2.1
|
||||||
|
- github.com/mattn/go-colorable v0.1.13
|
||||||
|
- github.com/mattn/go-isatty v0.0.19
|
||||||
|
5. The Unlicense (public domain dedication)
|
||||||
|
- tiny-AES-c
|
||||||
|
6. Apache License 2.0
|
||||||
|
- OpenSSL (Linux / macOS builds only)
|
||||||
|
- FRP (frpc.dll / frps.dll)
|
||||||
|
- ip2region (xdb v4)
|
||||||
|
- androidx.core:core-ktx 1.13.1
|
||||||
|
- androidx.appcompat:appcompat 1.7.0
|
||||||
|
- Kotlin standard library 2.1.21
|
||||||
|
7. GNU Lesser General Public License v2.1 (LGPL v2.1)
|
||||||
|
- ffmpeg v7.1 (statically linked, non-GPL build)
|
||||||
|
8. Mozilla Public License v2.0 (MPL 2.0)
|
||||||
|
- MemoryModule
|
||||||
|
9. GNU General Public License v2.0 (GPL v2.0)
|
||||||
|
- x264 v0.164.3194 (Windows builds only, opt-out available)
|
||||||
|
10. Custom terms
|
||||||
|
- QQWry / 纯真 IP database (qqwry.dat)
|
||||||
|
|
||||||
|
IMPORTANT: items 7 and 9 carry copyleft obligations. See the corresponding
|
||||||
|
sections at the end of this file before distributing a build.
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
1. zlib v1.3.2 (Zlib License)
|
||||||
|
================================================================================
|
||||||
|
Copyright (C) 1995-2024 Jean-loup Gailly and Mark Adler
|
||||||
|
|
||||||
|
This software is provided 'as-is', without any express or implied
|
||||||
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
arising from the use of this software.
|
||||||
|
|
||||||
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
|
including commercial applications, and to alter it and redistribute it
|
||||||
|
freely, subject to the following restrictions:
|
||||||
|
|
||||||
|
1. The origin of this software must not be misrepresented; you must not
|
||||||
|
claim that you wrote the original software. If you use this software
|
||||||
|
in a product, an acknowledgment in the product documentation would be
|
||||||
|
appreciated but is not required.
|
||||||
|
2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
misrepresented as being the original software.
|
||||||
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
2. zstd v1.5.7 (BSD 3-Clause License)
|
||||||
|
================================================================================
|
||||||
|
Copyright (c) 2016-present, Facebook, Inc. All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright notice, this
|
||||||
|
list of conditions and the following disclaimer.
|
||||||
|
|
||||||
|
* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer in the documentation
|
||||||
|
and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
* Neither the name Facebook nor the names of its contributors may be used to
|
||||||
|
endorse or promote products derived from this software without specific
|
||||||
|
prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||||
|
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
3. libyuv v190 (BSD 3-Clause License)
|
||||||
|
================================================================================
|
||||||
|
Copyright 2011 The LibYuv Project Authors. All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright notice, this
|
||||||
|
list of conditions and the following disclaimer.
|
||||||
|
|
||||||
|
* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer in the documentation
|
||||||
|
and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
* Neither the name of Google nor the names of its contributors may be used to
|
||||||
|
endorse or promote products derived from this software without specific
|
||||||
|
prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||||
|
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
4. jpeg (libjpeg-turbo) v3.1.1 (BSD 3-Clause / IJG License)
|
||||||
|
================================================================================
|
||||||
|
Copyright (C) 2009-2024 D. R. Commander. All Rights Reserved.
|
||||||
|
Copyright (C) 2015 Viktor Szathmáry. All Rights Reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
- Redistributions of source code must retain the above copyright notice, this
|
||||||
|
list of conditions and the following disclaimer.
|
||||||
|
- Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer in the documentation
|
||||||
|
and/or other materials provided with the distribution.
|
||||||
|
- Neither the name of the libjpeg-turbo Project nor the names of its
|
||||||
|
contributors may be used to endorse or promote products derived from this
|
||||||
|
software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||||
|
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
5. opus-1.6.1 (BSD 3-Clause License)
|
||||||
|
================================================================================
|
||||||
|
Copyright 2001-2011 Xiph.Org, Skype Limited, Octasic,
|
||||||
|
Jean-Marc Valin, Timothy B. Terriberry,
|
||||||
|
CSIRO, Gregory Maxwell, Mark Borgerding,
|
||||||
|
Erik de Castro Lopo
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions
|
||||||
|
are met:
|
||||||
|
|
||||||
|
- Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
|
||||||
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
- Neither the name of the Xiph.Org Foundation nor the names of its
|
||||||
|
contributors may be used to endorse or promote products derived from
|
||||||
|
this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION
|
||||||
|
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
6. libpeconv c7d1e48 & pe_to_shellcode (BSD 2-Clause License)
|
||||||
|
================================================================================
|
||||||
|
Copyright (c) 2020, hasherezade
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
1. Redistributions of source code must retain the above copyright notice, this
|
||||||
|
list of conditions and the following disclaimer.
|
||||||
|
|
||||||
|
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer in the documentation
|
||||||
|
and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||||
|
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
|
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
7. jsoncpp v1.9.6 (MIT License)
|
||||||
|
================================================================================
|
||||||
|
Copyright (c) 2007-2010 The JsonCpp Authors
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
8. sRDI (MIT License)
|
||||||
|
================================================================================
|
||||||
|
Copyright (c) 2017 Drewsif
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
9. libvpl v2.16.0 (MIT License)
|
||||||
|
================================================================================
|
||||||
|
Copyright (c) 2021 Intel Corporation
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
10. dav1d 62501cc (BSD 2-Clause License)
|
||||||
|
================================================================================
|
||||||
|
Copyright (c) 2018-2024, VideoLAN and dav1d authors
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
1. Redistributions of source code must retain the above copyright notice, this
|
||||||
|
list of conditions and the following disclaimer.
|
||||||
|
|
||||||
|
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer in the documentation
|
||||||
|
and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||||
|
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
11. xxHash v0.8.3 (BSD 2-Clause License)
|
||||||
|
================================================================================
|
||||||
|
Copyright (c) 2012-2023 Yann Collet
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
1. Redistributions of source code must retain the above copyright notice, this
|
||||||
|
list of conditions and the following disclaimer.
|
||||||
|
|
||||||
|
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer in the documentation
|
||||||
|
and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||||
|
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
12. KCP / ikcp (MIT License)
|
||||||
|
================================================================================
|
||||||
|
Copyright (c) 2010-2011 skywind3000 (at) gmail.com
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
13. skCrypter (MIT License)
|
||||||
|
================================================================================
|
||||||
|
Copyright (c) 2020 skadro
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
14. cpp-httplib v0.14.3 (MIT License)
|
||||||
|
================================================================================
|
||||||
|
Copyright (c) 2023 Yuji Hirose. All rights reserved.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
15. tiny-AES-c (The Unlicense)
|
||||||
|
================================================================================
|
||||||
|
This is free and unencumbered software released into the public domain.
|
||||||
|
|
||||||
|
Anyone is free to copy, modify, publish, use, compile, sell, or distribute this
|
||||||
|
software, either in source code form or as a compiled binary, for any purpose,
|
||||||
|
commercial or non-commercial, and by any means.
|
||||||
|
|
||||||
|
In jurisdictions that recognize copyright laws, the author or authors of this
|
||||||
|
software dedicate any and all copyright interest in the software to the public
|
||||||
|
domain. We make this dedication for the benefit of the public at large and to
|
||||||
|
the detriment of our heirs and successors. We intend this dedication to be an
|
||||||
|
overt act of relinquishment in perpetuity of all present and future rights to
|
||||||
|
this software under copyright law.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||||
|
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
For more information, please refer to <http://unlicense.org/>
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
16. Go module dependencies (MIT / BSD)
|
||||||
|
================================================================================
|
||||||
|
The Go server (server/go, shipped as YAMAGo_x64.exe) depends on the following
|
||||||
|
modules. Each is distributed under the license noted next to it; the full text
|
||||||
|
of each license is available in the corresponding module repository.
|
||||||
|
|
||||||
|
github.com/golang-jwt/jwt/v5 v5.3.1 MIT
|
||||||
|
github.com/gorilla/websocket v1.5.3 BSD 2-Clause
|
||||||
|
github.com/klauspost/compress v1.18.2 BSD 3-Clause
|
||||||
|
github.com/rs/zerolog v1.34.0 MIT
|
||||||
|
golang.org/x/sync v0.20.0 BSD 3-Clause
|
||||||
|
golang.org/x/text v0.32.0 BSD 3-Clause
|
||||||
|
gopkg.in/natefinch/lumberjack.v2 v2.2.1 MIT
|
||||||
|
github.com/mattn/go-colorable v0.1.13 MIT (indirect)
|
||||||
|
github.com/mattn/go-isatty v0.0.19 MIT (indirect)
|
||||||
|
golang.org/x/sys v0.12.0 BSD 3-Clause (indirect)
|
||||||
|
|
||||||
|
MIT License text: see section 7 above.
|
||||||
|
BSD 2-Clause License text: see section 6 above.
|
||||||
|
BSD 3-Clause License text: see section 2 above.
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
17. GoogleTest v1.14.0 (BSD 3-Clause License)
|
||||||
|
================================================================================
|
||||||
|
Copyright 2008, Google Inc. All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright notice, this
|
||||||
|
list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer in the documentation
|
||||||
|
and/or other materials provided with the distribution.
|
||||||
|
* Neither the name of Google Inc. nor the names of its contributors may be
|
||||||
|
used to endorse or promote products derived from this software without
|
||||||
|
specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||||
|
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
GoogleTest is used only to build and run the unit tests under test/; it is not
|
||||||
|
shipped with the product.
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
18. Apache License 2.0 components
|
||||||
|
================================================================================
|
||||||
|
The following components are licensed under the Apache License, Version 2.0
|
||||||
|
(https://www.apache.org/licenses/LICENSE-2.0). A copy of the license is
|
||||||
|
available at that URL and will be provided on request.
|
||||||
|
|
||||||
|
OpenSSL (Linux / macOS builds only)
|
||||||
|
Copyright (c) 1998-2024 The OpenSSL Project Authors
|
||||||
|
Used by the Linux/macOS client for TLS (client/TlsChannelLinux.cpp) and
|
||||||
|
by libsign.a for HMAC. OpenSSL 3.x is Apache-2.0; builds against OpenSSL
|
||||||
|
1.1.1 or earlier fall under the original OpenSSL/SSLeay license, which is
|
||||||
|
included with that distribution.
|
||||||
|
|
||||||
|
FRP (frpc / frps)
|
||||||
|
Copyright 2016-2024 fatedier, fatedier@gmail.com, and The FRP Authors
|
||||||
|
Bundled as Bin/res/frpc.dll and Bin/res/frps.dll.
|
||||||
|
Version: v0.69.2-0.20260605064132-d58c00d0332c (commit d58c00d0332c).
|
||||||
|
NOTE: the bundled binaries report a "+dirty" build, i.e. the FRP sources
|
||||||
|
were modified locally. Apache-2.0 section 4(b) requires modified files to
|
||||||
|
carry prominent notices stating that they were changed.
|
||||||
|
|
||||||
|
ip2region (xdb v4)
|
||||||
|
Copyright 2019-2024 lionsoul2014 and contributors
|
||||||
|
Data file: Bin/ip2region_v4.xdb
|
||||||
|
|
||||||
|
androidx.core:core-ktx 1.13.1
|
||||||
|
androidx.appcompat:appcompat 1.7.0
|
||||||
|
Copyright (C) 2005-2024 The Android Open Source Project
|
||||||
|
Used by the Android client (Bin/ghost.apk).
|
||||||
|
|
||||||
|
Kotlin standard library 2.1.21
|
||||||
|
Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language
|
||||||
|
contributors
|
||||||
|
Used by the Android client (Bin/ghost.apk).
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
19. ffmpeg v7.1 (GNU Lesser General Public License v2.1)
|
||||||
|
================================================================================
|
||||||
|
This software uses libraries from the FFmpeg project (v7.1), licensed under the
|
||||||
|
GNU Lesser General Public License (LGPL) version 2.1.
|
||||||
|
FFmpeg is a trademark of Fabrice Bellard, originator of the FFmpeg project.
|
||||||
|
|
||||||
|
The FFmpeg libraries were built WITHOUT any GPL-licensed components, so the
|
||||||
|
FFmpeg binaries themselves are covered by LGPL v2.1 and not by the GPL. The
|
||||||
|
configure line embedded in libavutil is:
|
||||||
|
|
||||||
|
--toolchain=msvc --arch=x86_64 --target-os=win64 --enable-static
|
||||||
|
--disable-shared --extra-cflags=-MT --extra-cxxflags=-MT --disable-everything
|
||||||
|
--disable-all --enable-avcodec --enable-avutil --enable-swresample
|
||||||
|
--enable-decoder=h264 --enable-decoder=aac --enable-decoder=aac_latm
|
||||||
|
--enable-decoder=pcm_s16le --enable-decoder=pcm_s16be --enable-decoder=pcm_f32le
|
||||||
|
--enable-parser=h264 --enable-parser=aac --enable-parser=aac_latm
|
||||||
|
--disable-iconv --disable-zlib --disable-bzlib --disable-lzma --disable-sdl2
|
||||||
|
--disable-doc --disable-programs --disable-network --disable-encoders
|
||||||
|
--disable-muxers --disable-demuxers --disable-filters --disable-devices
|
||||||
|
--disable-bsfs --disable-debug --enable-small --prefix=./install-win64
|
||||||
|
|
||||||
|
Note that this build is DECODE ONLY (--disable-encoders): it provides the
|
||||||
|
H.264/AAC/PCM decoders used to display remote screens, and contains no
|
||||||
|
encoder of any kind. The hardware-encoder paths in the client therefore cannot
|
||||||
|
be satisfied by these libraries, and software H.264 encoding is provided
|
||||||
|
exclusively by x264 (section 21).
|
||||||
|
|
||||||
|
HOW IT IS LINKED: on Windows the FFmpeg libraries (libavcodec, libavutil,
|
||||||
|
libswresample) are linked STATICALLY into the client and server executables
|
||||||
|
(see the #pragma comment(lib, "ffmpeg/...") directives in
|
||||||
|
client/CFFmpegH264Encoder.cpp, client/CFFmpegAV1Encoder.cpp and
|
||||||
|
server/2015Remote/ScreenSpyDlg.h). No FFmpeg DLL is shipped.
|
||||||
|
|
||||||
|
Because the linking is static, LGPL v2.1 section 6 applies: recipients are
|
||||||
|
entitled to modify FFmpeg and relink it with this product. To satisfy that,
|
||||||
|
the following are available on request from the author:
|
||||||
|
- the exact FFmpeg build scripts and configuration used (quoted above);
|
||||||
|
- the object files of the product sufficient to relink it against a
|
||||||
|
modified FFmpeg.
|
||||||
|
|
||||||
|
To build without FFmpeg entirely, set DISABLE_FFMPEG_FOR_TEST to 1 in
|
||||||
|
common/config.h; the encoder implementations and the FFmpeg include paths are
|
||||||
|
then removed from the build, and the compress/ffmpeg/ directory is no longer
|
||||||
|
needed at all.
|
||||||
|
|
||||||
|
The source code of FFmpeg v7.1 can be obtained from the official FFmpeg
|
||||||
|
website (https://ffmpeg.org).
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
20. MemoryModule (Mozilla Public License v2.0)
|
||||||
|
================================================================================
|
||||||
|
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
||||||
|
If a copy of the MPL was not distributed with this file, You can obtain one at
|
||||||
|
http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
|
MemoryModule is Copyright (c) Joachim Bauch.
|
||||||
|
|
||||||
|
Under the terms of the MPL 2.0, you may distribute this component as part of
|
||||||
|
your commercial/proprietary application without being required to open-source
|
||||||
|
your own proprietary code, provided that:
|
||||||
|
1. MemoryModule source files remain unmodified, or if modified, those modifications
|
||||||
|
are made available under the MPL 2.0.
|
||||||
|
2. Users are informed that MemoryModule is used and where they can find its source.
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
21. x264 v0.164.3194 (GNU General Public License v2.0)
|
||||||
|
================================================================================
|
||||||
|
The Windows build links libx264 statically for software H.264 encoding, used as
|
||||||
|
the CPU fallback when hardware encoders are unavailable (see
|
||||||
|
client/X264Encoder.cpp, client/EncoderFactory.h).
|
||||||
|
|
||||||
|
x264 is Copyright (C) 2003-2024 x264 project (Laurent Aimar, Loren Merritt,
|
||||||
|
Fiona Glaser, Jason Garrett-Glaser, Steven Walters and contributors) and is
|
||||||
|
licensed under the GNU General Public License version 2.0, not the LGPL.
|
||||||
|
Commercial licenses for x264 are available from x264 LLC
|
||||||
|
(https://www.x264licensing.com).
|
||||||
|
|
||||||
|
CONSEQUENCE: a binary that statically links x264 is, as a whole, a work
|
||||||
|
covered by the GPL v2.0 and must be distributed under GPL v2.0 terms
|
||||||
|
(accompanying complete corresponding source code, or a written offer valid for
|
||||||
|
three years), unless it is covered by a commercial x264 license.
|
||||||
|
|
||||||
|
To build without x264, set DISABLE_X264_FOR_TEST to 1 in common/config.h. The
|
||||||
|
x264 header is then no longer included and libx264 is no longer linked, so a
|
||||||
|
compliant build needs neither the x264 library nor its headers; the
|
||||||
|
compress/x264/ directory can be deleted outright.
|
||||||
|
|
||||||
|
IMPORTANT CONSEQUENCE: because the bundled FFmpeg is a decode-only build (see
|
||||||
|
section 19), x264 is the ONLY H.264 encoder in the product. A build with
|
||||||
|
DISABLE_X264_FOR_TEST=1 therefore has no H.264 encoder at all, and the client
|
||||||
|
falls back to raw RGB565 frames (client/ScreenCapture.h). Keeping H.264 while
|
||||||
|
staying GPL-free requires replacing x264 with an LGPL-compatible or licensed
|
||||||
|
encoder, or obtaining a commercial x264 license.
|
||||||
|
|
||||||
|
The text of the GPL v2.0 is available at https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
and is provided with any binary that includes x264.
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
22. QQWry / 纯真 IP database (custom terms)
|
||||||
|
================================================================================
|
||||||
|
Bin/qqwry.dat is the QQWry (纯真) IP geolocation database, published by
|
||||||
|
cz88.net (https://www.cz88.net/). It is not open source and is not covered by
|
||||||
|
any of the licenses above. The publisher's terms permit free use for
|
||||||
|
non-commercial purposes; redistribution inside a commercial product requires
|
||||||
|
the publisher's permission.
|
||||||
|
|
||||||
|
The product does not require this file. IP geolocation is selected at runtime
|
||||||
|
by the settings key settings/IPLocType: 1 uses qqwry.dat, 2 uses the ip2region
|
||||||
|
database (Bin/ip2region_v4.xdb, Apache-2.0). If the selected database cannot be
|
||||||
|
loaded, the server logs "IP数据库加载: failed" and falls back to a built-in
|
||||||
|
converter that returns no location, so shipping without qqwry.dat is supported
|
||||||
|
as long as IPLocType is set to 2.
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
END OF NOTICES
|
||||||
|
================================================================================
|
||||||
+547
-544
File diff suppressed because it is too large.
Load diff
+527
-523
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,82 @@
|
|||||||
|
# YAMA 使用方法与技巧
|
||||||
|
|
||||||
|
## 编译程序
|
||||||
|
|
||||||
|
编译此程序需要Visual Studio 2019及以上版本。如果编译Go服务端,需要Go 1.25及以上版本。
|
||||||
|
除了直接通过Visual Studio打开项目文件进行编译,也可以通过以下命令进行编译:
|
||||||
|
|
||||||
|
- build.cmd: 编译YAMA.exe(自动提前编译客户端程序)
|
||||||
|
- build.cmd publish:编译YAMA.exe且通过upx压缩,所生成的可执行文件较小。
|
||||||
|
- buld.cmd server:只编译YAMA.exe,需保证所依赖的客户端程序已经编译。
|
||||||
|
- build.cmd go-server:编译 Go 服务端,可以选择带publish 参数进行upx压缩。
|
||||||
|
- build.cmd serverd:编译 Debug 版服务端(x64),输出 Bin\Yama_x64d.exe。
|
||||||
|
- build.cmd client:编译 Debug 版客户端(x64),输出 x64\Debug\ghost.exe。
|
||||||
|
|
||||||
|
## Go 服务端
|
||||||
|
|
||||||
|
支持在Windows、Linux、MacOS系统运行,使得用户不再依赖Windows服务器来搭建远程控制系统,且部署Go服务端在Linux或MacOS具有更高安全性。
|
||||||
|
但是用户仍然需要有一台Windows电脑,使用YAMA生成客户端程序。
|
||||||
|
|
||||||
|
## 生成客户端
|
||||||
|
|
||||||
|
自版本v1.3.4起,不论是服务端/主控端,还是客户端/受管端,都支持在全平台运行(Windows、Linux、MacOS)。
|
||||||
|
关于在生成客户端时怎么填参数,参考早期在 GitHub 的[文档](https://github.com/yuanyuanxiang/SimpleRemoter/wiki#生成参数)。
|
||||||
|
此文档也许已经过时,但新文档没有准备好。因为生成客户端的逻辑没有改变,所以这篇文档仍然具有参考价值。
|
||||||
|
|
||||||
|
## 更新内嵌资源
|
||||||
|
|
||||||
|
参看 "server\2015Remote\BuildDlg.cpp" 描述,YAMA作为一个功能强大的远程管理系统,内嵌了包含客户端、开源工具在内的10多个资源。
|
||||||
|
较新版本的YAMA支持在不修改源代码、不重新编译的情况下,更新内嵌的这些资源。用户只需要在当前YAMA进程的目录下,增加res子目录,
|
||||||
|
将资源命名为如下所述的名称即可。例如编译了新版本的 frpc.dll, 将其放到 res/frps.dll 位置即可,重启YAMA即会使用该磁盘上的资源。
|
||||||
|
|
||||||
|
```
|
||||||
|
namespace ResFileName {
|
||||||
|
// Ghost 主程序
|
||||||
|
const char* GHOST_X86 = "ghost_x86.exe";
|
||||||
|
const char* GHOST_X64 = "ghost_x64.exe";
|
||||||
|
const char* GHOST_LINUX = "ghost_linux";
|
||||||
|
const char* GHOST_MACOS = "ghost_macos";
|
||||||
|
// TestRun 加载器
|
||||||
|
const char* TESTRUN_X86 = "testrun_x86.dll";
|
||||||
|
const char* TESTRUN_X64 = "testrun_x64.dll";
|
||||||
|
// ServerDll
|
||||||
|
const char* SERVERDLL_X86 = "serverdll_x86.dll";
|
||||||
|
const char* SERVERDLL_X64 = "serverdll_x64.dll";
|
||||||
|
// TinyRun
|
||||||
|
const char* TINYRUN_X86 = "tinyrun_x86.exe";
|
||||||
|
const char* TINYRUN_X64 = "tinyrun_x64.exe";
|
||||||
|
// SCLoader (Shellcode加载器)
|
||||||
|
const char* SCLOADER_X86 = "scloader_x86.bin";
|
||||||
|
const char* SCLOADER_X64 = "scloader_x64.bin";
|
||||||
|
const char* SCLOADER_X86_OLD = "scloader_old_x86.bin";
|
||||||
|
const char* SCLOADER_X64_OLD = "scloader_old_x64.bin";
|
||||||
|
// FRP 相关 (无架构区分,64位DLL)
|
||||||
|
const char* FRPC_DLL = "frpc.dll";
|
||||||
|
const char* FRPS_DLL = "frps.dll";
|
||||||
|
// 工具
|
||||||
|
const char* UPX_EXE = "upx.exe";
|
||||||
|
const char* RCEDIT_EXE = "rcedit.exe";
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## 使用插件
|
||||||
|
|
||||||
|
将64位的Windows DLL放到Plugins目录,主控程序会加载DLL,且可以通过在线主机的右键菜单,将DLL发送的目标主机执行。
|
||||||
|
开发自定义插件需要遵循一些规范:https://simpleremoter.com/plugins
|
||||||
|
|
||||||
|
## 载荷分离
|
||||||
|
|
||||||
|
通过设置 Web 端口(默认值8080),来开启Web远程桌面,且本机会提供文件下载服务。将文件放置于该目录,从外部访问链接即可下载。
|
||||||
|
比如,生成服务端时,选择 Shellcode+AES, 开启文件下载,将载荷生成为单独的文件 "1.bin",将此文件放置于Payloads 目录。
|
||||||
|
访问 http://127.0.0.1:8080/payloads/1.bin 即可下载此载荷文件。如果本机具有公网IP,则127.0.0.1可替换为公网IP。在有公网IP的计算机开启Web功能,必须设置登录密码,否则存在安全风险。
|
||||||
|
采用载荷分离方式生成的程序,只有7KB,运行此程序会下载载荷,解密载荷中的Shellcode并执行。加载器源代码见 client\SimpleSCLoader.c,采用了高级编程技巧,无导入函数。本项目不提供任何“面纱”保证,且使用场景只限技术研究和学习。
|
||||||
|
|
||||||
|
## Web 远程桌面
|
||||||
|
|
||||||
|
通过设置 Web 端口(默认值8080),即开启Web远程桌面,在浏览器地址栏访问本机8080端口就进入Web远程桌面,默认的密码是admin。
|
||||||
|
如果本机有公网IP,务必修改默认密码,设置为较复杂的密码,否则可能被别人登录。Web登录已做防护,连续3次输入错误密码会冻结。
|
||||||
|
从外部访问Web远程桌面,需要域名和证书(浏览器H264解码硬性要求);Web 远程桌面支持2个主机同时在线,如需突破此限制,请联系管理员。
|
||||||
|
|
||||||
|
## 获取更多
|
||||||
|
|
||||||
|
访问源代码的docs目录,阅读本项目更多内容;也可以访问官方网站:https://simpleremoter.com,成为注册用户,可获取额外的资源与支持。官方网站将不定期地更新有关此软件的公告、用法、案例等内容。
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
# Build output
|
||||||
|
build/
|
||||||
|
app/build/
|
||||||
|
|
||||||
|
# Gradle cache and generated configs
|
||||||
|
.gradle/
|
||||||
|
gradle/gradle-daemon-jvm.properties
|
||||||
|
|
||||||
|
# Local config (contains SDK path, machine-specific)
|
||||||
|
local.properties
|
||||||
|
|
||||||
|
# Android Studio project files
|
||||||
|
.idea/
|
||||||
|
*.iml
|
||||||
|
|
||||||
|
# Signing config
|
||||||
|
*.jks
|
||||||
|
*.keystore
|
||||||
|
|
||||||
|
# Force-track prebuilt static libs (overrides root .gitignore *.a rule)
|
||||||
|
!app/src/main/cpp/lib/**/*.a
|
||||||
|
|
||||||
|
# OpenSSL cross-compile scratch (source tree / tarball / build dirs / logs).
|
||||||
|
# The produced libs + headers under app/src/main/cpp/lib/<ABI>/ are tracked.
|
||||||
|
openssl-*/
|
||||||
|
openssl-*.tar.gz
|
||||||
|
openssl_build/
|
||||||
|
openssl_install/
|
||||||
|
openssl_build_*.log
|
||||||
+266
@@ -0,0 +1,266 @@
|
|||||||
|
# Android 客户端开发计划书
|
||||||
|
|
||||||
|
> 目标功能:屏幕浏览 + 操作控制(触控/键盘输入注入)
|
||||||
|
> 参考实现:`linux/` 与 `macos/`,两者已验证的共用策略同样适用于 Android
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 一、代码复用分析
|
||||||
|
|
||||||
|
### 1.1 可 100% 直接复用(NDK 无改动)
|
||||||
|
|
||||||
|
| 文件 | 用途 | 依赖 |
|
||||||
|
|------|------|------|
|
||||||
|
| `common/ikcp.c/.h` | KCP 可靠 UDP 传输 | 纯 C,无 OS 依赖 |
|
||||||
|
| `common/aes.c/.h` | AES 加密 | 纯 C |
|
||||||
|
| `common/commands.h` | 协议定义(全平台共享) | 无 |
|
||||||
|
| `common/client_auth_state.h` | 认证状态机 | 无 |
|
||||||
|
| `common/posix_net_helpers.h` | POSIX socket 辅助函数 | POSIX(Android NDK 支持) |
|
||||||
|
| `common/sub_conn_thread.h` | 子连接线程 | POSIX |
|
||||||
|
| `common/rtt_estimator.h` | RTT 估计器 | 无 |
|
||||||
|
| `common/logger.h` | 日志 | 无 |
|
||||||
|
| `common/locker.h` | 互斥锁 | `std::mutex` |
|
||||||
|
| `common/FileTransferV2.h` | V2 文件传输协议 | 无 |
|
||||||
|
| `common/xxhash.h` | xxHash 校验 | 纯头文件 |
|
||||||
|
| `client/IOCPClient.cpp/.h` | TCP/KCP 连接管理(Linux 已复用) | POSIX socket |
|
||||||
|
| `client/Buffer.cpp/.h` | 数据缓冲区 | 无 |
|
||||||
|
| `client/sign_shim_unix.cpp` | 签名垫片(Linux/macOS 已复用) | `libsign.a` |
|
||||||
|
|
||||||
|
### 1.2 可参考逻辑、重新实现 Android 版本
|
||||||
|
|
||||||
|
| 现有文件 | Android 对应实现 | 原因 |
|
||||||
|
|----------|-----------------|------|
|
||||||
|
| `linux/ScreenHandler.h` | `android/cpp/ScreenHandler.h` | 捕获 API 不同(MediaProjection vs X11) |
|
||||||
|
| `macos/InputHandler.mm` | `ControlService.kt` + `main.cpp::DispatchControlEvent` | 注入方式不同(AccessibilityService vs CGEvent) |
|
||||||
|
| `linux/SystemManager.h` | `android/cpp/SystemManager.cpp`(Phase 4) | 系统 API 不同 |
|
||||||
|
| `macos/H264Encoder.mm` | Android MediaCodec 路径(Java 侧) | 硬件编码器 API 不同 |
|
||||||
|
| `linux/main.cpp` | `android/cpp/main.cpp` | 参考连接逻辑,逐段移植 |
|
||||||
|
|
||||||
|
### 1.3 不复用(Windows 专属)
|
||||||
|
|
||||||
|
- `client/ScreenCapturerDXGI.h`、`client/IOCPBase.h`、`client/ScreenSpy.cpp`(Windows GDI/DXGI)
|
||||||
|
- `client/KeyboardManager.cpp`(SendInput API)
|
||||||
|
- `client/KernelManager.cpp`、`client/ServicesManager.cpp`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 二、技术选型
|
||||||
|
|
||||||
|
### 2.1 屏幕捕获
|
||||||
|
|
||||||
|
**方案**:`MediaProjection` API(Android 5.0+)
|
||||||
|
|
||||||
|
```
|
||||||
|
MediaProjection
|
||||||
|
└── VirtualDisplay (Surface)
|
||||||
|
└── MediaCodec (Surface input,零拷贝)
|
||||||
|
└── H.264 NALU → JNI → C++ ScreenHandler → 网络发送
|
||||||
|
```
|
||||||
|
|
||||||
|
- 无需 root,官方公开 API
|
||||||
|
- 通过 `ForegroundService` + `FOREGROUND_SERVICE_MEDIA_PROJECTION` 维持后台运行
|
||||||
|
- **实际采用零拷贝路径(Path A)**:VirtualDisplay 的 Surface 直接绑定 `MediaCodec` 输入 Surface,无 ImageReader 中间环节
|
||||||
|
|
||||||
|
### 2.2 视频编码
|
||||||
|
|
||||||
|
**已采用**:Android `MediaCodec`(硬件 H.264 加速)✅
|
||||||
|
|
||||||
|
- VirtualDisplay Surface → MediaCodec Surface input → H.264 NALU,零拷贝
|
||||||
|
- 关键帧前自动拼接 SPS+PPS,确保解码器可初始化
|
||||||
|
- 每 2 秒强制触发一次 IDR(兼容忽略 `KEY_I_FRAME_INTERVAL` 的软编码器)
|
||||||
|
- 编码分辨率:长边限制 1080,保持宽高比,宽高各自 2 对齐(H.264 要求)
|
||||||
|
|
||||||
|
**编码流水线**:
|
||||||
|
```
|
||||||
|
VirtualDisplay → MediaCodec(Surface input) → CODEC_CONFIG(SPS/PPS) + IDR+P 帧
|
||||||
|
→ onOutputBufferAvailable → JNI nativeOnH264Frame → C++ g_screenHandlers (broadcast) → TCP
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2.3 输入控制
|
||||||
|
|
||||||
|
**已采用**:`AccessibilityService`(`ControlService.kt`)✅
|
||||||
|
|
||||||
|
| 事件 | 映射 |
|
||||||
|
| --- | --- |
|
||||||
|
| `WM_LBUTTONDOWN/MOVE/UP` | 累积路径,UP 时判断:位移 < 10px → 单击(dispatchTap),否则 → 拖拽(dispatchTouchGesture) |
|
||||||
|
| `WM_LBUTTONDBLCLK` | 双击:两次 80ms 手势,间隔 200ms |
|
||||||
|
| `WM_RBUTTONDOWN` | 长按 600ms |
|
||||||
|
| `WM_MOUSEWHEEL` | delta > 0(滚轮上)→ 手指下划 +400px;delta < 0 → 手指上划 -400px |
|
||||||
|
| `WM_KEYDOWN` Backspace/ESC | `GLOBAL_ACTION_BACK` |
|
||||||
|
| `WM_KEYDOWN` VK_HOME (0x24) | `GLOBAL_ACTION_HOME` |
|
||||||
|
| `WM_KEYDOWN` VK_APPS (0x5D) | `GLOBAL_ACTION_RECENTS` |
|
||||||
|
| `WM_KEYDOWN` PrtSc (0x2C) | `GLOBAL_ACTION_TAKE_SCREENSHOT` |
|
||||||
|
|
||||||
|
**关键实现细节**:
|
||||||
|
|
||||||
|
- 协议:`COMMAND_SCREEN_CONTROL` + MSG64(固定 48 字节),**坐标从 lParam(offset 24)读取**,与 Windows/Linux/macOS 客户端完全一致;不读 pt.x/pt.y(64-bit MSG 与 MSG64 的 pt 偏移不同,直接读会得到错误 Y 坐标)
|
||||||
|
- 坐标映射:`phys = enc * physSize / encSize`(编码空间 → 物理屏幕空间)
|
||||||
|
- 单击路径非退化:`moveTo(x,y); lineTo(x+1,y)`,避免 Android 静默拒绝零长度手势路径
|
||||||
|
- C++ → Kotlin 回调:`DispatchControlEvent()` 全局函数通过 JNI AttachCurrentThread → `ControlService.onControlEvent(@JvmStatic)` → post 到主线程 Handler
|
||||||
|
|
||||||
|
### 2.4 网络传输
|
||||||
|
|
||||||
|
与 Linux 完全相同的 POSIX socket 路径:
|
||||||
|
- TCP 控制通道(`IOCPClient.cpp` 已在 Linux 验证)
|
||||||
|
- KCP over UDP 视频流(`ikcp.c` 纯 C,NDK 直接编译,当前未启用)
|
||||||
|
- TLS/AES 加密复用 `common/aes.c`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 三、目录结构(实际)
|
||||||
|
|
||||||
|
```
|
||||||
|
android/
|
||||||
|
├── PLAN.md # 本文件
|
||||||
|
├── README.md # 编译与安装说明
|
||||||
|
├── build_apk.sh # 编译脚本(release/debug/clean)
|
||||||
|
├── yama-release.jks # 签名密钥库(密码通过 YAMA_PWD 环境变量传入)
|
||||||
|
├── app/
|
||||||
|
│ ├── build.gradle
|
||||||
|
│ ├── proguard-rules.pro # 保留 JNI 方法名
|
||||||
|
│ └── src/main/
|
||||||
|
│ ├── AndroidManifest.xml
|
||||||
|
│ ├── java/com/yama/client/
|
||||||
|
│ │ ├── MainActivity.kt # 权限申请 + 启动 Service
|
||||||
|
│ │ ├── CaptureService.kt # ForegroundService:MediaProjection + MediaCodec
|
||||||
|
│ │ ├── ControlService.kt # AccessibilityService:手势注入 + 全局键 + 活动窗口上报
|
||||||
|
│ │ └── YamaBridge.kt # JNI 声明(nativeInit/Stop/SetScreenSize/OnH264Frame)
|
||||||
|
│ ├── cpp/
|
||||||
|
│ │ ├── CMakeLists.txt
|
||||||
|
│ │ ├── main.cpp # NDK 入口:连接/心跳/DataProcess/DispatchControlEvent
|
||||||
|
│ │ ├── ScreenHandler.h # 子连接管理:发送 BitmapInfo/H264 帧,接收 SCREEN_CONTROL
|
||||||
|
│ │ ├── android_compat.h # 平台兼容头(强制注入替代修改共用源文件)
|
||||||
|
│ │ ├── common/ → ../../common/ # 符号链接(commands.h 等)
|
||||||
|
│ │ ├── client/ → ../../client/ # 符号链接(IOCPClient 等)
|
||||||
|
│ │ └── lib/
|
||||||
|
│ │ ├── arm64-v8a/libsign.a
|
||||||
|
│ │ ├── arm64-v8a/libzstd.a
|
||||||
|
│ │ ├── armeabi-v7a/libsign.a
|
||||||
|
│ │ └── armeabi-v7a/libzstd.a
|
||||||
|
│ └── res/
|
||||||
|
│ ├── mipmap-*/ic_launcher.png # 传统图标(各密度)
|
||||||
|
│ ├── mipmap-*/ic_launcher_foreground.png # Adaptive Icon 前景层
|
||||||
|
│ ├── mipmap-anydpi-v26/ic_launcher.xml # Adaptive Icon 定义
|
||||||
|
│ ├── values/colors.xml # ic_launcher_background (#F2F2F2)
|
||||||
|
│ ├── values/strings.xml
|
||||||
|
│ └── xml/accessibility_service_config.xml
|
||||||
|
├── build.gradle (project-level)
|
||||||
|
└── settings.gradle
|
||||||
|
```
|
||||||
|
|
||||||
|
> **注**:原计划中的 `InputHandler.cpp` 已合并至 `main.cpp`(`DispatchControlEvent` 全局函数)和 `ControlService.kt`;`SystemManager.cpp` 留待 Phase 4。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 四、开发阶段
|
||||||
|
|
||||||
|
### Phase 0:工程初始化 ✅ 已完成
|
||||||
|
|
||||||
|
- 创建 Android Studio 项目,配置 NDK + CMake
|
||||||
|
- `CMakeLists.txt` 引入 `common/`、`client/` 源文件(与 `linux/CMakeLists.txt` 同构)
|
||||||
|
- 编译验证 `IOCPClient.cpp + Buffer.cpp + sign_shim_unix.cpp + ikcp.c` 在 NDK 下无错误
|
||||||
|
- `SimplePlugins/sign_lib/` 新增 `sha256_portable.h`(纯 C,零外部依赖)和 `build_android.sh`,在 WSL + NDK r27c 下成功交叉编译,产物已复制至 `android/app/src/main/cpp/lib/{arm64-v8a,armeabi-v7a}/libsign.a`
|
||||||
|
|
||||||
|
### Phase 1:连接与协议 ✅ 已完成
|
||||||
|
|
||||||
|
- 移植 `linux/main.cpp` 的连接逻辑到 `android/cpp/main.cpp`
|
||||||
|
- `CaptureService.kt` 通过 `YamaBridge.nativeInit()` 启动 C++ 网络线程
|
||||||
|
- 实现登录握手(`LOGIN_INFOR`)、心跳(`TOKEN_HEARTBEAT` + `CMD_HEARTBEAT_ACK` RTT 估算)、认证状态机(`client_auth_state.h`)
|
||||||
|
- 设备信息上报:ANDROID_ID(XXH64 作为 ClientID)、型号、OS 版本、分辨率
|
||||||
|
- 心跳日志限流:60 秒最多打印一次,避免 logcat 刷屏
|
||||||
|
|
||||||
|
### Phase 2:屏幕捕获与编码 ✅ 已完成
|
||||||
|
|
||||||
|
- `CaptureService.kt`:申请 `MediaProjection`,建立 `VirtualDisplay`,Surface 直连 `MediaCodec`
|
||||||
|
- SPS/PPS 缓存,IDR 帧发送前自动拼接,子连接 `COMMAND_NEXT` 后开始推流
|
||||||
|
- `ScreenHandler.h`:发送 `TOKEN_BITMAPINFO`(含 `ScreenSettings.QualityLevel=H264`),`SendH264` 封装帧头
|
||||||
|
- 服务端 H264 解码器正常显示 Android 屏幕 ✅
|
||||||
|
- 服务端适配:`ScreenSpyDlg.cpp` 新增 `ComputeAdaptiveLayout()` 自适应缩放和信箱黑边,`m_offsetX/Y` 修正坐标映射(已合入 `main` 分支)
|
||||||
|
|
||||||
|
### Phase 3:操作控制 ✅ 已完成(branch: feature/android-remote-control)
|
||||||
|
|
||||||
|
- `ControlService.kt`(`AccessibilityService`):手势注入、全局键、双击/长按/滚轮
|
||||||
|
- `main.cpp::DispatchControlEvent()`:JNI 反向调用,将 `COMMAND_SCREEN_CONTROL` 路由到 Kotlin
|
||||||
|
- `ScreenHandler.h::OnReceive`:子连接也可接收 `COMMAND_SCREEN_CONTROL`,统一调用 `DispatchControlEvent`
|
||||||
|
- 坐标 Bug 修复:64-bit MSG 与 MSG64 的 `pt.x/pt.y` 偏移不同(MSG: offset 36,MSG64: offset 40);改为从 lParam(两者均在 offset 24)提取坐标,与其他所有客户端保持一致
|
||||||
|
- 单击无效 Bug 修复:零长度手势路径被 Android 静默拒绝;tap 改用 `lineTo(x+1, y)` 非退化路径
|
||||||
|
- 代码审查修复:JNI `ExceptionClear()`
|
||||||
|
|
||||||
|
### Phase 3 后期修复 ✅ 已完成
|
||||||
|
|
||||||
|
发现并修复的生产问题:
|
||||||
|
|
||||||
|
| 问题 | 根因 | 修复文件 |
|
||||||
|
|------|------|---------- |
|
||||||
|
| 静止屏幕首帧黑屏 10-60 秒 | SurfaceFlinger 空闲优化:无脏区时不向 VirtualDisplay 推帧,`REQUEST_SYNC_FRAME` 永远排队等不到输入帧 | `CaptureService.forceFirstFrame()`:VirtualDisplay 临时 resize +2px 触发强制合成;`main.cpp` 在 `SendBitmapInfo` 后调用 `ForceFirstFrameFromJava()` |
|
||||||
|
| 部分硬件编码器 IDR 帧未被识别 | 高通等 SoC 对强制 IDR 不设置 `BUFFER_FLAG_KEY_FRAME`,`SendLoop` 将其当作 P 帧丢弃,首帧永远发不出 | `CaptureService.isNaluKeyframe()`:扫描 Annex-B NALU type 5/7/8 补充判断 |
|
||||||
|
| H.264 推流在 `SendBitmapInfo` 前卡住 | 推送模式下服务端 `COMMAND_NEXT` 到达时 `setManagerCallBack` 尚未注册消息被丢弃,`m_started` 永远为 `false` | `ScreenHandler.h::SendBitmapInfo()` 末尾直接 `m_started=true; m_cond.notify_all()` |
|
||||||
|
| 多用户不能同时观看/控制 | `g_screenHandler` 单指针 + `g_screenSpyRunning` 互斥锁,只允许一条子连接 | `main.cpp`:改为 `std::set<AndroidScreenHandler*> g_screenHandlers`,`nativeOnH264Frame` 广播给全部 handler;每个 `COMMAND_SCREEN_SPY` 独立建立子连接,对齐 Windows/Linux/macOS 客户端行为 |
|
||||||
|
|
||||||
|
### Phase 4:系统信息与稳定性(进行中)
|
||||||
|
|
||||||
|
**已完成:**
|
||||||
|
|
||||||
|
| 功能 | 说明 |
|
||||||
|
|------|------|
|
||||||
|
| 活动窗口上报 | `ControlService` 监听 `TYPE_WINDOW_STATE_CHANGED`,通过 JNI `getActiveWindow()` 上报当前前台包名;锁屏时上报 `"Locked"` |
|
||||||
|
| 心跳间隔下限 | Android 侧将服务端下发的 `ReportInterval` 强制限制为 `max(收到值, 30)`,防止 5s 高频心跳耗电 |
|
||||||
|
| 服务端心跳超时延长 | `CheckHeartbeat()` 超时阈值从 `max(60, interval*3)` 改为 `max(120, interval*3)`,与 30s 心跳间隔留出 4 倍余量 |
|
||||||
|
| CPU 频率上报 | `GetCpuMHz()` 优先读 `/sys/devices/system/cpu/*/cpufreq/cpuinfo_max_freq`,虚拟机无此节点时回退读 `/proc/cpuinfo` 的 `BogoMIPS` |
|
||||||
|
| 后台保活 | `ForegroundService` + 持久通知(Phase 2 已完成),豁免 Doze 模式网络限制 |
|
||||||
|
| 应用图标 | 自定义眼睛图标,支持 Android 8+ Adaptive Icon(前景层 + 浅灰背景),兼容各厂商形状裁切 |
|
||||||
|
| Release 签名 | `yama-release.jks` 随仓库分发,密码通过 `YAMA_PWD` 环境变量或交互输入,保证多机一致签名 |
|
||||||
|
|
||||||
|
**待完成:**
|
||||||
|
|
||||||
|
- 处理 `MediaProjection` 被用户撤销的情况(弹出通知,引导重授权)
|
||||||
|
- 连接断线自动重连后子连接同步重建(目前 `ScreenSpyThread` 有 20 次重试,但主连接重连后子连接未同步恢复)
|
||||||
|
- `WM_MBUTTONDOWN`(中键)手势映射(目前静默丢弃)
|
||||||
|
- `SystemManager` 封装:将 Java 层已上报的设备信息(型号、版本、IP)统一封装为独立模块
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 五、关键约束与风险
|
||||||
|
|
||||||
|
| 风险 | 影响 | 状态 |
|
||||||
|
|------|------|------|
|
||||||
|
| ~~`libsign.a` 无 ARM 构建~~ | ~~Phase 0 阻塞~~ | ✅ 已解决:`sha256_portable.h` + `build_android.sh` |
|
||||||
|
| Android 12+ `MediaProjection` 需每次重新申请 | 后台录屏被中断 | `ForegroundService` 保活 + 通知引导重授权 |
|
||||||
|
| `AccessibilityService` 用户需手动开启 | 操作控制功能受限 | UI 引导流程,说明开启步骤 |
|
||||||
|
| 某些厂商 ROM 限制后台 Service | 连接断开 | 电池优化白名单申请 |
|
||||||
|
| H.264 Baseline Level 对齐 | 服务端解码兼容性 | `MediaCodec` 输出指定 `profile=Baseline`,与 x264 现有配置一致 |
|
||||||
|
| `AccessibilityService` 无法向系统设置页面注入手势 | 设置界面无法远程操作 | Android 安全限制,无解,提示用户 |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 六、代码审查注意事项
|
||||||
|
|
||||||
|
### 最高原则:既有功能无破坏
|
||||||
|
|
||||||
|
增加 Android 客户端支持时,Windows/Linux/macOS 客户端的全部既有功能必须保持正常。每次改动上线前须验证:
|
||||||
|
|
||||||
|
| 检查项 | 说明 |
|
||||||
|
| --- | --- |
|
||||||
|
| `isAndroidRemote` 初始值为 `false` | 非 Android 客户端走原有代码路径,不受影响 |
|
||||||
|
| `updateUIForOrientation()` Android 分支有 `isAndroidRemote &&` 守卫 | 非 Android 客户端不会进入沉浸模式分支 |
|
||||||
|
| `NotifyResolutionChange` 新参数有默认值 `= ""` | 现有调用点即便漏传也能正常编译和运行 |
|
||||||
|
| `FindHostByClientID` 与 `FindHostByIP` 一致的指针返回约定 | ScreenSpyDlg 在 UI 线程(OnInitDialog)调用,OnReceiveComplete 在 IO 线程调用,后者读 `additonalInfo[]` 为只读操作,低概率竞争 |
|
||||||
|
| Web 端坐标映射 `getTouchPos` 使用 `getBoundingClientRect()` | 动态取 canvas 实际显示尺寸,CSS 拉伸不影响坐标精度 |
|
||||||
|
| Android 边缘手势检测有时间和距离双重门槛 | 普通慢速拖拽不会被误识别为系统手势 |
|
||||||
|
|
||||||
|
### 审查流程
|
||||||
|
|
||||||
|
1. `git diff HEAD` 逐文件审查,重点关注非 Android 代码路径的改动
|
||||||
|
2. 确认所有新增条件分支均以 `isAndroidRemote`、`client_type === 'APK'` 等 Android 专有标志守卫
|
||||||
|
3. 共享协议结构体(`commands.h`、`LOGIN_INFOR`、`szReserved`)改动需确认向前/向后兼容
|
||||||
|
4. 服务端 C++ 改动在 Windows 下编译,前端 `index.html` 在桌面和移动浏览器两端验证
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 七、不在本期范围
|
||||||
|
|
||||||
|
- 音频监听(`AudioRecord` + Opus 编码)
|
||||||
|
- 文件管理(已有 `FileTransferV2`,后期可直接接入)
|
||||||
|
- 摄像头(前/后摄)
|
||||||
|
- Shell 终端(`/system/bin/sh` + PTY,可参考 `PTYHandler.h`)
|
||||||
|
- Root 特权功能(uinput、内核注入)
|
||||||
@@ -0,0 +1,172 @@
|
|||||||
|
# YAMA Android 客户端
|
||||||
|
|
||||||
|
YAMA 的 Android 客户端,允许服务端将 Android 设备作为受控主机进行远程查看和操控。功能包括:
|
||||||
|
|
||||||
|
- 屏幕实时截图并推流给服务端
|
||||||
|
- 接收服务端的触控/按键指令并注入到系统
|
||||||
|
- 后台保持心跳连接,支持长期驻留
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 编译前:配置服务端地址
|
||||||
|
|
||||||
|
服务端 IP 和端口在源码中硬编码,编译前必须修改:
|
||||||
|
|
||||||
|
文件:`app/src/main/java/com/yama/client/MainActivity.kt`
|
||||||
|
|
||||||
|
```kotlin
|
||||||
|
private val serverIp = "91.99.165.207" // 改为你的服务端 IP
|
||||||
|
private val serverPort = 443 // 改为你的服务端端口
|
||||||
|
```
|
||||||
|
|
||||||
|
改完再执行编译,否则客户端连不上服务端。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 编译环境
|
||||||
|
|
||||||
|
在 **WSL(Ubuntu)或原生 Linux** 上编译,Windows 原生环境不支持。
|
||||||
|
|
||||||
|
| 依赖 | 版本要求 | 安装命令 |
|
||||||
|
|---|---|---|
|
||||||
|
| Java | 17+ | `sudo apt install openjdk-17-jdk` |
|
||||||
|
| CMake | 3.22+ | `sudo apt install cmake` |
|
||||||
|
| Ninja | 任意 | `sudo apt install ninja-build` |
|
||||||
|
| Android SDK | 含 build-tools | 见下方说明 |
|
||||||
|
| Android NDK | 30.x(Linux 版) | 见下方说明 |
|
||||||
|
|
||||||
|
### Android SDK
|
||||||
|
|
||||||
|
推荐通过 Android Studio 安装,安装后 SDK 默认在:
|
||||||
|
|
||||||
|
- Windows:`%USERPROFILE%\AppData\Local\Android\Sdk`
|
||||||
|
- Linux:`~/Android/Sdk`
|
||||||
|
|
||||||
|
WSL 环境下脚本会自动检测 Windows 侧的 SDK,也可以手动指定:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export ANDROID_HOME=/mnt/c/Users/<用户名>/AppData/Local/Android/Sdk
|
||||||
|
```
|
||||||
|
|
||||||
|
### Android NDK(Linux 版)
|
||||||
|
|
||||||
|
> **重要**:必须使用 **Linux 版 NDK**,Windows NDK 的 `.exe` 工具无法在 WSL 内执行。
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 下载 Linux NDK(约 600 MB)
|
||||||
|
wget https://dl.google.com/android/repository/android-ndk-r30b-linux.zip
|
||||||
|
unzip android-ndk-r30b-linux.zip -d $HOME
|
||||||
|
|
||||||
|
# 解压目录名可能带字母后缀(r30、r30b 等),统一重命名
|
||||||
|
mv $HOME/android-ndk-r30* $HOME/android-ndk
|
||||||
|
```
|
||||||
|
|
||||||
|
脚本会自动检测 `~/android-ndk`,也可以通过环境变量指定:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export ANDROID_NDK_HOME=$HOME/android-ndk
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 签名密钥(一次性准备)
|
||||||
|
|
||||||
|
Release APK 需要签名密钥。密钥库文件 `yama-release.jks` 已在仓库中,**密码需向仓库维护者获取**,或通过以下方式传入:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 方式一:环境变量(推荐,避免每次输入)
|
||||||
|
export YAMA_PWD=密钥库密码
|
||||||
|
|
||||||
|
# 方式二:编译时脚本会交互提示输入
|
||||||
|
```
|
||||||
|
|
||||||
|
如需重新生成密钥库(密码遗失等情况):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd android/
|
||||||
|
keytool -genkeypair -keystore yama-release.jks \
|
||||||
|
-alias yama -keyalg RSA -keysize 2048 -validity 10000 \
|
||||||
|
-dname 'CN=YAMA,O=Internal,C=CN'
|
||||||
|
```
|
||||||
|
|
||||||
|
> 密钥库文件本身不含私密信息,可以提交到 git;密码不要提交。
|
||||||
|
> 重新生成密钥库后,已安装旧版本的设备需要先卸载再安装。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 编译
|
||||||
|
|
||||||
|
在 WSL 或 Linux 终端中,进入 `android/` 目录:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd android/
|
||||||
|
|
||||||
|
# 编译 Release(默认,约 1.7 MB,推荐部署用)
|
||||||
|
./build_apk.sh
|
||||||
|
|
||||||
|
# 编译 Debug(约 4 MB,含调试符号,开发排查用)
|
||||||
|
./build_apk.sh debug
|
||||||
|
|
||||||
|
# 清理所有编译产物(切换配置或遇到奇怪错误时使用)
|
||||||
|
./build_apk.sh clean
|
||||||
|
```
|
||||||
|
|
||||||
|
编译成功后产物:
|
||||||
|
|
||||||
|
| 类型 | 路径 |
|
||||||
|
|---|---|
|
||||||
|
| Release | `ghost.apk` |
|
||||||
|
| Debug | `ghost-debug.apk` |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 安装到设备
|
||||||
|
|
||||||
|
### 1. 传输 APK
|
||||||
|
|
||||||
|
将 `ghost.apk` 拷贝到手机(USB 传输、微信文件传输等均可)。
|
||||||
|
|
||||||
|
### 2. 安装
|
||||||
|
|
||||||
|
在手机上用文件管理器找到 APK,点击安装。
|
||||||
|
|
||||||
|
如提示"禁止安装未知来源应用",需先开启允许:
|
||||||
|
|
||||||
|
- **Android 8+**:设置 → 应用 → 找到你使用的文件管理器 → 允许安装未知应用
|
||||||
|
- **MIUI/ColorOS 等**:设置 → 隐私/安全 → 安装未知应用
|
||||||
|
|
||||||
|
### 3. 解除受限设置(Android 13+ 必须)
|
||||||
|
|
||||||
|
Android 13 及以上系统对手动安装的 APK 有额外限制,若不解除,无法授权 Accessibility Service:
|
||||||
|
|
||||||
|
1. 打开 **设置 → 应用 → YAMA**
|
||||||
|
2. 点击右上角 **三点菜单**
|
||||||
|
3. 选择 **"允许受限设置"**(Allow restricted settings)
|
||||||
|
4. 使用 PIN 或指纹确认
|
||||||
|
|
||||||
|
> 此步骤每次重新安装 APK 后都需要重复执行一次。
|
||||||
|
|
||||||
|
### 4. 授权必要权限
|
||||||
|
|
||||||
|
**Accessibility Service**(必须,用于注入触控/按键)
|
||||||
|
|
||||||
|
设置 → 无障碍 → 已安装的应用 → YAMA → 开启
|
||||||
|
|
||||||
|
> 重装 APK 后此权限会被重置,需重新授权。
|
||||||
|
|
||||||
|
### 5. 启动
|
||||||
|
|
||||||
|
点击桌面 YAMA 图标启动,系统会弹出屏幕录制确认框,点击 **"立即开始"** 授权。
|
||||||
|
|
||||||
|
授权后应用进入后台运行,通知栏会显示一条持久通知表示服务正在运行。此后服务端即可在主机列表中看到该设备。
|
||||||
|
|
||||||
|
> 屏幕录制确认在每次应用重启后都会弹出,这是 Android 系统的强制要求,无法跳过。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 注意事项
|
||||||
|
|
||||||
|
- 建议在电池优化设置中将 YAMA 设为 **"不限制"**(或"不优化"),防止系统在后台将其杀掉
|
||||||
|
- 路径:设置 → 应用 → YAMA → 电池 → 不限制
|
||||||
|
- 心跳间隔最小 30 秒,长期后台运行耗电量与微信后台相当
|
||||||
|
- 服务端可在设置中调大上报间隔(建议不超过 60 秒)以进一步降低耗电
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
plugins {
|
||||||
|
id 'com.android.application'
|
||||||
|
id 'org.jetbrains.kotlin.android'
|
||||||
|
}
|
||||||
|
|
||||||
|
// 模拟器调试时传 -PincludeEmulatorAbis=true;build_apk.sh 发布时强制传 false
|
||||||
|
def INCLUDE_EMULATOR_ABIS = project.findProperty('includeEmulatorAbis')?.toBoolean() ?: false
|
||||||
|
|
||||||
|
android {
|
||||||
|
namespace 'com.yama.client'
|
||||||
|
compileSdk 35
|
||||||
|
ndkVersion "30.0.14904198"
|
||||||
|
|
||||||
|
defaultConfig {
|
||||||
|
applicationId "com.yama.client"
|
||||||
|
minSdk 21
|
||||||
|
targetSdk 35
|
||||||
|
versionCode 2
|
||||||
|
versionName "1.1"
|
||||||
|
|
||||||
|
ndk {
|
||||||
|
if (INCLUDE_EMULATOR_ABIS) {
|
||||||
|
abiFilters 'arm64-v8a', 'armeabi-v7a', 'x86', 'x86_64'
|
||||||
|
} else {
|
||||||
|
abiFilters 'arm64-v8a', 'armeabi-v7a'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
externalNativeBuild {
|
||||||
|
cmake {
|
||||||
|
cppFlags '-std=c++17'
|
||||||
|
arguments '-DANDROID_STL=c++_static'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
externalNativeBuild {
|
||||||
|
cmake {
|
||||||
|
path "src/main/cpp/CMakeLists.txt"
|
||||||
|
version "3.22.1"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
buildFeatures {
|
||||||
|
// AGP 8 默认不生成 BuildConfig;登录时要把真实版本号/versionCode 上报给服务端
|
||||||
|
buildConfig true
|
||||||
|
}
|
||||||
|
|
||||||
|
signingConfigs {
|
||||||
|
release {
|
||||||
|
storeFile file("../yama-release.jks")
|
||||||
|
storePassword System.getenv("YAMA_PWD") ?: ""
|
||||||
|
keyAlias 'yama'
|
||||||
|
keyPassword System.getenv("YAMA_PWD") ?: ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
buildTypes {
|
||||||
|
release {
|
||||||
|
minifyEnabled true
|
||||||
|
shrinkResources true
|
||||||
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'),
|
||||||
|
'proguard-rules.pro'
|
||||||
|
signingConfig signingConfigs.release
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
packagingOptions {
|
||||||
|
jniLibs {
|
||||||
|
// .so 文件不压缩(ZIP_STORED),使服务端 patch 工具可直接在 APK 中搜索 FLAG_GHOST
|
||||||
|
useLegacyPackaging false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility JavaVersion.VERSION_17
|
||||||
|
targetCompatibility JavaVersion.VERSION_17
|
||||||
|
}
|
||||||
|
|
||||||
|
kotlinOptions {
|
||||||
|
jvmTarget = '17'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation 'androidx.core:core-ktx:1.13.1'
|
||||||
|
implementation 'androidx.appcompat:appcompat:1.7.0'
|
||||||
|
}
|
||||||
Vendored
+2
@@ -0,0 +1,2 @@
|
|||||||
|
# Keep all app classes — JNI method names must match exactly
|
||||||
|
-keep class com.yama.client.** { *; }
|
||||||
@@ -0,0 +1,82 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||||
|
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />
|
||||||
|
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION" />
|
||||||
|
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MICROPHONE" />
|
||||||
|
<!-- 语音监听(COMMAND_AUDIO):AudioRecord 采集麦克风;后台采集要求前台服务带
|
||||||
|
microphone 类型(Android 11+),类型权限在上面的 FOREGROUND_SERVICE_MICROPHONE -->
|
||||||
|
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
||||||
|
<!-- 在线升级:走 PackageInstaller 会话安装服务端下发的 APK,仍需系统安装器人工确认 -->
|
||||||
|
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
|
||||||
|
<!-- 卸载主机(TOKEN_UNINSTALL):ACTION_DELETE 拉系统卸载确认框,缺这个权限
|
||||||
|
UninstallerActivity 会直接报 "does not have REQUEST_DELETE_PACKAGES" 并退出 -->
|
||||||
|
<uses-permission android:name="android.permission.REQUEST_DELETE_PACKAGES" />
|
||||||
|
<!-- 升级完成/需要人工确认时的提示通知(Android 13+ 是运行时权限) -->
|
||||||
|
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
||||||
|
|
||||||
|
<application
|
||||||
|
android:allowBackup="false"
|
||||||
|
android:extractNativeLibs="false"
|
||||||
|
android:icon="@mipmap/ic_launcher"
|
||||||
|
android:roundIcon="@mipmap/ic_launcher_round"
|
||||||
|
android:label="YAMA"
|
||||||
|
android:supportsRtl="true"
|
||||||
|
android:theme="@style/Theme.YAMA">
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name=".MainActivity"
|
||||||
|
android:exported="true">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
|
||||||
|
<!-- 远程交谈(COMMAND_CHAT):单实例,会话进行中重复拉起只走 onNewIntent -->
|
||||||
|
<activity
|
||||||
|
android:name=".ChatActivity"
|
||||||
|
android:exported="false"
|
||||||
|
android:launchMode="singleTop" />
|
||||||
|
|
||||||
|
<service
|
||||||
|
android:name=".CaptureService"
|
||||||
|
android:foregroundServiceType="dataSync|mediaProjection|microphone"
|
||||||
|
android:exported="false" />
|
||||||
|
|
||||||
|
<service
|
||||||
|
android:name=".ControlService"
|
||||||
|
android:description="@string/accessibility_service_description"
|
||||||
|
android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE"
|
||||||
|
android:exported="true">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.accessibilityservice.AccessibilityService" />
|
||||||
|
</intent-filter>
|
||||||
|
<meta-data
|
||||||
|
android:name="android.accessibilityservice"
|
||||||
|
android:resource="@xml/accessibility_service_config" />
|
||||||
|
</service>
|
||||||
|
|
||||||
|
<!-- 安装会话状态回执(PendingIntent 指向本 receiver) -->
|
||||||
|
<receiver
|
||||||
|
android:name=".InstallResultReceiver"
|
||||||
|
android:exported="false">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="com.yama.client.INSTALL_STATUS" />
|
||||||
|
</intent-filter>
|
||||||
|
</receiver>
|
||||||
|
|
||||||
|
<!-- 覆盖安装完成后,提醒用户打开 App 重新授权录屏 -->
|
||||||
|
<receiver
|
||||||
|
android:name=".ReplacedReceiver"
|
||||||
|
android:exported="false">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
|
||||||
|
</intent-filter>
|
||||||
|
</receiver>
|
||||||
|
|
||||||
|
</application>
|
||||||
|
|
||||||
|
</manifest>
|
||||||
@@ -0,0 +1,191 @@
|
|||||||
|
#pragma once
|
||||||
|
// Android 语音监听(COMMAND_AUDIO)子连接。
|
||||||
|
//
|
||||||
|
// 协议与 Windows 客户端完全一致(client/AudioManager.cpp + client/Audio.cpp):
|
||||||
|
// 主连接 [COMMAND_AUDIO] → 子连接(ConnAuth)→ 首包单字节 [TOKEN_AUDIO_START]
|
||||||
|
// → 服务端弹出 CAudioDlg 后回单字节 [COMMAND_NEXT] → 双向音频开始
|
||||||
|
// 上行:[TOKEN_AUDIO_DATA:1][1000 字节 GSM 流](服务端 CAudio::PlayBuffer 固定按
|
||||||
|
// 1000 字节一块拷贝,包长必须正好 1000,且不能短——短了服务端会越界读)
|
||||||
|
// 下行:服务端直接发裸 GSM 流(无 token,不带长度头),也是 1000 字节一块
|
||||||
|
//
|
||||||
|
// 编码格式是服务端 ACM 的 WAVE_FORMAT_GSM610:8000 Hz 单声道,
|
||||||
|
// 65 字节 / 320 采样(40ms)。libgsm 的 WAV49 模式产出完全相同的打包
|
||||||
|
// (每块 2 × 160 采样帧:第一帧 32 字节、第二帧 33 字节),见 gsm/README.md。
|
||||||
|
// 编码与解码必须各用一个 gsm 状态:frame_index/frame_chain 是共用的。
|
||||||
|
//
|
||||||
|
// 语音流是连续的:1000 不是 65 的整数倍,65 字节块会跨包切开,这是允许的——
|
||||||
|
// 服务端把每个 1000 字节缓冲按顺序写给 waveOut,编解码状态跨缓冲延续。
|
||||||
|
#include "common/commands.h"
|
||||||
|
#include "common/logger.h"
|
||||||
|
#include "client/IOCPClient.h"
|
||||||
|
#include <algorithm>
|
||||||
|
#include <chrono>
|
||||||
|
#include <condition_variable>
|
||||||
|
#include <cstdint>
|
||||||
|
#include <cstring>
|
||||||
|
#include <mutex>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
// 与 LOGI_SH 同理:进 logcat 的同时进 Logger 内存 ring(MCP get_client_log)
|
||||||
|
#define LOGI_AUD(...) android_log_tag(ANDROID_LOG_INFO, "YAMA_AUD", __VA_ARGS__)
|
||||||
|
#define LOGE_AUD(...) android_log_tag(ANDROID_LOG_ERROR, "YAMA_AUD", __VA_ARGS__)
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
#include "gsm.h"
|
||||||
|
}
|
||||||
|
|
||||||
|
// 定义在 main.cpp:把解码后的 PCM 交给 Kotlin(AudioMonitor.onPcm)播放
|
||||||
|
extern void DispatchAudioPcm(const int16_t* samples, size_t count);
|
||||||
|
|
||||||
|
class AndroidAudioHandler : public IOCPManager
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit AndroidAudioHandler(IOCPClient* client)
|
||||||
|
: m_client(client), m_enc(nullptr), m_dec(nullptr), m_open(false),
|
||||||
|
m_pendingCount(0), m_frameFill(0), m_pktFill(0), m_decFill(0),
|
||||||
|
m_pktsSent(0), m_blocksDecoded(0)
|
||||||
|
{
|
||||||
|
m_enc = gsm_create();
|
||||||
|
m_dec = gsm_create();
|
||||||
|
int one = 1;
|
||||||
|
if (m_enc) gsm_option(m_enc, GSM_OPT_WAV49, &one);
|
||||||
|
if (m_dec) gsm_option(m_dec, GSM_OPT_WAV49, &one);
|
||||||
|
if (!m_enc || !m_dec) LOGE_AUD("gsm_create failed (enc=%p dec=%p)", m_enc, m_dec);
|
||||||
|
|
||||||
|
// 子连接首包:服务端据此把本连接绑定到语音监听对话框
|
||||||
|
m_pkt[0] = TOKEN_AUDIO_DATA;
|
||||||
|
BYTE token = TOKEN_AUDIO_START;
|
||||||
|
m_client->Send2Server((char*)&token, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
~AndroidAudioHandler() override
|
||||||
|
{
|
||||||
|
if (m_enc) gsm_destroy(m_enc);
|
||||||
|
if (m_dec) gsm_destroy(m_dec);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 等服务端 CAudioDlg 打开(COMMAND_NEXT)。Windows 客户端等 8 秒 + 150ms,
|
||||||
|
// 这里同样 8 秒;超时说明服务端没接管子连接,调用方应放弃本次会话。
|
||||||
|
bool WaitDialogOpen(int timeoutMs)
|
||||||
|
{
|
||||||
|
std::unique_lock<std::mutex> lk(m_openMx);
|
||||||
|
return m_openCv.wait_for(lk, std::chrono::milliseconds(timeoutMs),
|
||||||
|
[&]{ return m_open; });
|
||||||
|
}
|
||||||
|
|
||||||
|
// Kotlin 采集线程:8kHz/16bit/单声道 PCM,长度任意;内部攒满 160 采样编一帧
|
||||||
|
void SendPcm(const int16_t* samples, size_t count)
|
||||||
|
{
|
||||||
|
if (!m_enc || !samples || !count) return;
|
||||||
|
std::lock_guard<std::mutex> lk(m_txMx);
|
||||||
|
size_t i = 0;
|
||||||
|
while (i < count) {
|
||||||
|
const size_t take = std::min(count - i, (size_t)160 - m_pendingCount);
|
||||||
|
memcpy(m_pcmPending + m_pendingCount, samples + i, take * sizeof(int16_t));
|
||||||
|
m_pendingCount += take;
|
||||||
|
i += take;
|
||||||
|
if (m_pendingCount == 160) {
|
||||||
|
EncodeFrame(m_pcmPending);
|
||||||
|
m_pendingCount = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual VOID OnReceive(PBYTE data, ULONG size) override
|
||||||
|
{
|
||||||
|
if (!data || !size) return;
|
||||||
|
if (size == 1) {
|
||||||
|
switch (data[0]) {
|
||||||
|
case COMMAND_NEXT:
|
||||||
|
// 服务端对话框已打开(CAudioDlg::OnInitDialog 发 COMMAND_NEXT)
|
||||||
|
{
|
||||||
|
std::lock_guard<std::mutex> lk(m_openMx);
|
||||||
|
m_open = true;
|
||||||
|
}
|
||||||
|
m_openCv.notify_all();
|
||||||
|
LOGI_AUD("dialog open (COMMAND_NEXT)");
|
||||||
|
return;
|
||||||
|
default:
|
||||||
|
LOGI_AUD("ignore 1-byte control 0x%02X", (unsigned)data[0]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
DecodeBytes(data, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
// 一帧 = 160 采样。WAV49 的两帧拼成一个 65 字节块:先写 32 字节,再写 33 字节。
|
||||||
|
void EncodeFrame(const int16_t* samples)
|
||||||
|
{
|
||||||
|
if (m_frameFill == 0) {
|
||||||
|
gsm_encode(m_enc, (gsm_signal*)samples, m_frameBuf); // 32 字节
|
||||||
|
m_frameFill = 32;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
gsm_encode(m_enc, (gsm_signal*)samples, m_frameBuf + 32); // 33 字节
|
||||||
|
m_frameFill = 0;
|
||||||
|
|
||||||
|
// 65 字节块可能跨 1000 字节包切分;音频流仍然是连续的
|
||||||
|
size_t off = 0;
|
||||||
|
while (off < sizeof(m_frameBuf)) {
|
||||||
|
const size_t n = std::min(sizeof(m_frameBuf) - off, (size_t)1000 - m_pktFill);
|
||||||
|
memcpy(m_pkt + 1 + m_pktFill, m_frameBuf + off, n);
|
||||||
|
m_pktFill += n;
|
||||||
|
off += n;
|
||||||
|
if (m_pktFill == 1000) {
|
||||||
|
m_client->Send2Server((char*)m_pkt, 1 + 1000);
|
||||||
|
m_pktFill = 0;
|
||||||
|
if (++m_pktsSent == 1)
|
||||||
|
LOGI_AUD("first uplink packet sent (1+1000 bytes = 615 ms GSM)");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 下行 GSM 流按 65 字节块解码(两块 = 320 采样)。接收缓冲不足 65 字节时留着,
|
||||||
|
// 网络分片不会破坏半字节对齐。
|
||||||
|
void DecodeBytes(const uint8_t* data, size_t size)
|
||||||
|
{
|
||||||
|
if (!m_dec) return;
|
||||||
|
std::lock_guard<std::mutex> lk(m_rxMx);
|
||||||
|
while (size) {
|
||||||
|
const size_t take = std::min(size, sizeof(m_decBuf) - m_decFill);
|
||||||
|
memcpy(m_decBuf + m_decFill, data, take);
|
||||||
|
m_decFill += take;
|
||||||
|
data += take;
|
||||||
|
size -= take;
|
||||||
|
if (m_decFill == sizeof(m_decBuf)) {
|
||||||
|
int16_t pcm[320];
|
||||||
|
gsm_decode(m_dec, m_decBuf, pcm);
|
||||||
|
gsm_decode(m_dec, m_decBuf + 33, pcm + 160);
|
||||||
|
DispatchAudioPcm(pcm, 320);
|
||||||
|
m_decFill = 0;
|
||||||
|
if (++m_blocksDecoded == 1)
|
||||||
|
LOGI_AUD("first downlink block decoded (320 samples, master is sending voice)");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
IOCPClient* m_client;
|
||||||
|
gsm m_enc;
|
||||||
|
gsm m_dec;
|
||||||
|
|
||||||
|
std::mutex m_openMx;
|
||||||
|
std::condition_variable m_openCv;
|
||||||
|
bool m_open;
|
||||||
|
|
||||||
|
// 上行:PCM 攒帧 → GSM 帧 → 1000 字节包
|
||||||
|
std::mutex m_txMx;
|
||||||
|
int16_t m_pcmPending[160];
|
||||||
|
size_t m_pendingCount;
|
||||||
|
uint8_t m_frameBuf[65];
|
||||||
|
size_t m_frameFill; // 0 = 下一帧写 32 字节;32 = 下一帧写 33 字节
|
||||||
|
uint8_t m_pkt[1 + 1000]; // [TOKEN_AUDIO_DATA][音频]
|
||||||
|
size_t m_pktFill;
|
||||||
|
unsigned m_pktsSent;
|
||||||
|
|
||||||
|
// 下行
|
||||||
|
std::mutex m_rxMx;
|
||||||
|
uint8_t m_decBuf[65];
|
||||||
|
size_t m_decFill;
|
||||||
|
unsigned m_blocksDecoded;
|
||||||
|
};
|
||||||
@@ -0,0 +1,96 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.22)
|
||||||
|
project(yama_client LANGUAGES CXX C)
|
||||||
|
|
||||||
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||||
|
|
||||||
|
# YAMA 根目录(相对于本文件:cpp/ → main/ → src/ → app/ → android/ → YAMA/)
|
||||||
|
get_filename_component(YAMA_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../" ABSOLUTE)
|
||||||
|
|
||||||
|
# ---- 头文件搜索路径(与 linux/CMakeLists.txt 同构)----
|
||||||
|
include_directories(
|
||||||
|
${YAMA_ROOT}
|
||||||
|
${YAMA_ROOT}/client
|
||||||
|
${YAMA_ROOT}/compress
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR} # android_compat.h
|
||||||
|
)
|
||||||
|
|
||||||
|
# ---- 强制注入兼容头(替代修改共用源文件)----
|
||||||
|
add_compile_options(-include "${CMAKE_CURRENT_SOURCE_DIR}/android_compat.h")
|
||||||
|
|
||||||
|
# ---- 核心源文件(与 linux/CMakeLists.txt 相同)----
|
||||||
|
set(CORE_SOURCES
|
||||||
|
${YAMA_ROOT}/client/Buffer.cpp
|
||||||
|
${YAMA_ROOT}/client/IOCPClient.cpp
|
||||||
|
${YAMA_ROOT}/client/TlsChannelLinux.cpp # 单向 TLS(OpenSSL),Linux/Android 共用
|
||||||
|
${YAMA_ROOT}/client/sign_shim_unix.cpp
|
||||||
|
${YAMA_ROOT}/common/logger.cpp
|
||||||
|
${YAMA_ROOT}/common/ikcp.c
|
||||||
|
)
|
||||||
|
|
||||||
|
# ---- Android NDK 入口 ----
|
||||||
|
set(ANDROID_SOURCES
|
||||||
|
main.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
# ---- libgsm(语音监听:服务端 AudioDlg 要 GSM 6.10/WAV49,见 gsm/README.md)----
|
||||||
|
# WAV49 = MS-GSM 打包(65 字节/320 采样),与 Windows ACM 的 WAVE_FORMAT_GSM610 一致。
|
||||||
|
# SASR 是 AOSP Android.mk 里的定点右移开关,必须与它保持一致。
|
||||||
|
set(GSM_SOURCES
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/gsm/src/add.c
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/gsm/src/code.c
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/gsm/src/decode.c
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/gsm/src/gsm_create.c
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/gsm/src/gsm_decode.c
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/gsm/src/gsm_destroy.c
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/gsm/src/gsm_encode.c
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/gsm/src/gsm_option.c
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/gsm/src/long_term.c
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/gsm/src/lpc.c
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/gsm/src/preprocess.c
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/gsm/src/rpe.c
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/gsm/src/short_term.c
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/gsm/src/table.c
|
||||||
|
)
|
||||||
|
add_library(gsm610 STATIC ${GSM_SOURCES})
|
||||||
|
target_include_directories(gsm610 PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/gsm/inc")
|
||||||
|
target_compile_options(gsm610 PRIVATE -DSASR -DWAV49 -O2 -fvisibility=hidden -Wno-unused-parameter)
|
||||||
|
|
||||||
|
add_library(yama SHARED ${CORE_SOURCES} ${ANDROID_SOURCES})
|
||||||
|
|
||||||
|
# ---- 预编译静态库(由 android/build_android_libs.ps1 产出)----
|
||||||
|
# 支持 arm64-v8a / armeabi-v7a(真机)和 x86 / x86_64(Android 模拟器)
|
||||||
|
target_link_libraries(yama PRIVATE
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/lib/${ANDROID_ABI}/libsign.a"
|
||||||
|
)
|
||||||
|
target_link_libraries(yama PRIVATE
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/lib/${ANDROID_ABI}/libzstd.a"
|
||||||
|
)
|
||||||
|
|
||||||
|
# ---- OpenSSL(单向 TLS,client/TlsChannelLinux.cpp)----
|
||||||
|
# 静态库与头文件由 build_android_libs.ps1 按 ABI 产出。opensslconf.h 各架构不同,故头文件
|
||||||
|
# 也按 ABI 存放(lib/<ABI>/include)。libssl 依赖 libcrypto,链接顺序 ssl 在前。
|
||||||
|
target_include_directories(yama PRIVATE
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/lib/${ANDROID_ABI}/include"
|
||||||
|
)
|
||||||
|
target_link_libraries(yama PRIVATE
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/lib/${ANDROID_ABI}/libssl.a"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/lib/${ANDROID_ABI}/libcrypto.a"
|
||||||
|
)
|
||||||
|
# 语音监听(GSM 6.10/WAV49);符号由下面的 --exclude-libs,ALL 一并隐藏
|
||||||
|
target_link_libraries(yama PRIVATE gsm610)
|
||||||
|
# 不把静态库(OpenSSL/sign/zstd)的符号导出到 libyama.so 之外,与 Java 层 Conscrypt 隔离;
|
||||||
|
# JNI 入口来自目标文件(非归档),不受影响,仍正常导出。
|
||||||
|
target_link_options(yama PRIVATE "-Wl,--exclude-libs,ALL")
|
||||||
|
|
||||||
|
# ---- Android 系统库 ----
|
||||||
|
target_link_libraries(yama PRIVATE android log dl)
|
||||||
|
|
||||||
|
# ---- 编译选项 ----
|
||||||
|
target_compile_options(yama PRIVATE
|
||||||
|
-O2
|
||||||
|
-fvisibility=hidden
|
||||||
|
-Wno-unused-parameter
|
||||||
|
-Wno-missing-field-initializers
|
||||||
|
)
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
#pragma once
|
||||||
|
// Android 远程交谈(COMMAND_CHAT)子连接。
|
||||||
|
//
|
||||||
|
// 协议与 Windows 客户端完全一致(见 client/ChatManager.cpp、server/2015Remote/McpChat.cpp):
|
||||||
|
// 主连接 [COMMAND_CHAT] → 本线程开子连接(ConnAuth)→ 首包单字节 [TOKEN_CHAT_START]
|
||||||
|
// → 服务端绑定后回单字节 [COMMAND_NEXT_CHAT](0)→ 弹出聊天界面
|
||||||
|
// → 双向文本 [GBK 字节][NUL];服务端单字节 [COMMAND_CHAT_CLOSE](1)结束会话。
|
||||||
|
// 单字节包都是控制/心跳,不是文本(客户端发文本至少带尾部 NUL)。
|
||||||
|
#include "common/commands.h"
|
||||||
|
#include "client/IOCPClient.h"
|
||||||
|
#include <vector>
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
|
// 定义在 main.cpp:把会话事件交给 Kotlin(ChatSession.onNativeEvent)。
|
||||||
|
// kind: 1 = 服务端已绑定(可以显示聊天界面),2 = 会话结束,3 = 一条对方文本
|
||||||
|
// (data 为 GBK 字节,不含结尾 NUL)。必须从非 UI 线程调用,Kotlin 侧自己 post 到主线程。
|
||||||
|
extern void DispatchChatEvent(int kind, const uint8_t* data, size_t size);
|
||||||
|
|
||||||
|
class AndroidChatHandler : public IOCPManager {
|
||||||
|
public:
|
||||||
|
explicit AndroidChatHandler(IOCPClient* client) : m_client(client) {
|
||||||
|
BYTE bToken = TOKEN_CHAT_START;
|
||||||
|
m_client->Send2Server((char*)&bToken, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Java 侧点「发送」:GBK 字节 + 结尾 NUL(与 Windows 客户端 Send() 的载荷一致)。
|
||||||
|
bool SendText(const uint8_t* gbk, size_t size) {
|
||||||
|
if (!m_client || !m_client->IsConnected() || !gbk || size == 0) return false;
|
||||||
|
std::vector<char> pkt(size + 1);
|
||||||
|
memcpy(pkt.data(), gbk, size);
|
||||||
|
pkt[size] = '\0';
|
||||||
|
return m_client->Send2Server(pkt.data(), (ULONG)pkt.size()) != FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual VOID OnReceive(PBYTE data, ULONG size) override {
|
||||||
|
if (!data || !size) return;
|
||||||
|
|
||||||
|
if (size == 1) {
|
||||||
|
switch (data[0]) {
|
||||||
|
case COMMAND_NEXT_CHAT:
|
||||||
|
DispatchChatEvent(1, nullptr, 0);
|
||||||
|
return;
|
||||||
|
case COMMAND_CHAT_CLOSE:
|
||||||
|
DispatchChatEvent(2, nullptr, 0);
|
||||||
|
return;
|
||||||
|
case COMMAND_CHAT_SCREEN_LOCK:
|
||||||
|
case COMMAND_CHAT_SCREEN_UNLOCK:
|
||||||
|
// 服务端手动交谈时的「锁定屏幕/屏蔽功能键」在 Android 上没有对应语义
|
||||||
|
// (Windows 是 ClipCursor + 隐藏任务栏)。忽略,不锁设备。
|
||||||
|
return;
|
||||||
|
default:
|
||||||
|
// 单字节心跳等:聊天通道不承载,丢弃
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// GBK 文本,NUL 结尾;上限与 Windows 输入缓冲一致,防异常对端撑爆内存
|
||||||
|
const size_t kMaxIncoming = 8u * 1024u;
|
||||||
|
size_t n = 0;
|
||||||
|
while (n < size && n < kMaxIncoming && data[n] != 0) ++n;
|
||||||
|
if (n) DispatchChatEvent(3, data, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
IOCPClient* m_client;
|
||||||
|
};
|
||||||
@@ -0,0 +1,307 @@
|
|||||||
|
#pragma once
|
||||||
|
// Android 屏幕处理器:管理截屏子连接,接收 Java 侧 MediaCodec 输出的 H.264 NALU,
|
||||||
|
// 按协议封装后通过子连接发送给服务端。
|
||||||
|
#include "common/commands.h"
|
||||||
|
#include "common/logger.h"
|
||||||
|
#include "client/IOCPClient.h"
|
||||||
|
#include <atomic>
|
||||||
|
#include <mutex>
|
||||||
|
#include <condition_variable>
|
||||||
|
#include <queue>
|
||||||
|
#include <vector>
|
||||||
|
#include <thread>
|
||||||
|
#include <cstring>
|
||||||
|
#include <string>
|
||||||
|
#include <cinttypes>
|
||||||
|
#include <android/log.h>
|
||||||
|
|
||||||
|
// 与 main.cpp 的 LOGI/LOGE 同理:进 logcat 的同时进 Logger 内存 ring(MCP get_client_log)。
|
||||||
|
// 抓屏链路的问题(黑屏、码率)只能靠这些日志定位,必须能被主控取到。
|
||||||
|
#define LOGI_SH(...) android_log_tag(ANDROID_LOG_INFO, "YAMA_SCR", __VA_ARGS__)
|
||||||
|
#define LOGE_SH(...) android_log_tag(ANDROID_LOG_ERROR, "YAMA_SCR", __VA_ARGS__)
|
||||||
|
|
||||||
|
extern uint64_t g_myClientID;
|
||||||
|
// 定义在 main.cpp,供子连接的 OnReceive 调用
|
||||||
|
extern void DispatchControlEvent(uint32_t msgVal, uint64_t wParam, int32_t ptX, int32_t ptY);
|
||||||
|
extern void DispatchClipboardText(const uint8_t* data, size_t size);
|
||||||
|
extern void DispatchLockScreen();
|
||||||
|
// 隐私 overlay(COMMAND_SCREEN_BLANK / COMMAND_SCREEN_BLOCK_INPUT),定义在 main.cpp
|
||||||
|
extern void DispatchPrivacyOverlay(bool black, bool block);
|
||||||
|
// 画质/帧率协商:读写 ScreenTuning(SharedPreferences),定义在 main.cpp
|
||||||
|
extern int GetClientQualityLevel(); // 上报用,读不到时回落 QUALITY_GOOD
|
||||||
|
extern int GetClientMaxFps(); // 上报用,读不到时回落 20
|
||||||
|
extern void DispatchQualityLevel(int level, bool persist);
|
||||||
|
extern void DispatchMaxFps(int fps);
|
||||||
|
extern void DispatchQualityProfilesCsv(const char* csv);
|
||||||
|
|
||||||
|
// Linux/macOS 共用的 BITMAPINFOHEADER 布局(与 Windows 完全一致)
|
||||||
|
#pragma pack(push, 1)
|
||||||
|
struct BmpInfoHeader {
|
||||||
|
uint32_t biSize;
|
||||||
|
int32_t biWidth;
|
||||||
|
int32_t biHeight;
|
||||||
|
uint16_t biPlanes;
|
||||||
|
uint16_t biBitCount;
|
||||||
|
uint32_t biCompression;
|
||||||
|
uint32_t biSizeImage;
|
||||||
|
int32_t biXPelsPerMeter;
|
||||||
|
int32_t biYPelsPerMeter;
|
||||||
|
uint32_t biClrUsed;
|
||||||
|
uint32_t biClrImportant;
|
||||||
|
};
|
||||||
|
#pragma pack(pop)
|
||||||
|
|
||||||
|
class AndroidScreenHandler : public IOCPManager {
|
||||||
|
public:
|
||||||
|
AndroidScreenHandler(IOCPClient* client, int width, int height)
|
||||||
|
: m_client(client), m_width(width), m_height(height),
|
||||||
|
m_started(false), m_running(true), m_firstSent(false)
|
||||||
|
{
|
||||||
|
memset(&m_bmpHdr, 0, sizeof(m_bmpHdr));
|
||||||
|
m_bmpHdr.biSize = sizeof(BmpInfoHeader);
|
||||||
|
m_bmpHdr.biWidth = width;
|
||||||
|
m_bmpHdr.biHeight = height;
|
||||||
|
m_bmpHdr.biPlanes = 1;
|
||||||
|
m_bmpHdr.biBitCount = 32;
|
||||||
|
m_bmpHdr.biCompression = 0;
|
||||||
|
m_bmpHdr.biSizeImage = (uint32_t)(width * height * 4);
|
||||||
|
// 1 = top-down H264(Android MediaCodec 标准编码顺序);
|
||||||
|
// 服务端据此用负步长写 DIB,抵消 GDI bottom-up 翻转
|
||||||
|
m_bmpHdr.biClrImportant = 1;
|
||||||
|
|
||||||
|
m_sendThread = std::thread(&AndroidScreenHandler::SendLoop, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
~AndroidScreenHandler() {
|
||||||
|
// 屏幕子连接断了 overlay 就没人能解除:全屏黑色/不可触摸窗口会把本机用户锁在外面,
|
||||||
|
// 必须在 handler 销毁时兜底撤掉(服务端侧也有强制解锁 + 关闭会话的路径,但断网时
|
||||||
|
// 服务端已经发不出任何报文)。
|
||||||
|
if (m_black.load() || m_block.load()) {
|
||||||
|
LOGE_SH("screen conn ended with overlay on (black=%d block=%d); clearing",
|
||||||
|
(int)m_black.load(), (int)m_block.load());
|
||||||
|
DispatchPrivacyOverlay(false, false);
|
||||||
|
}
|
||||||
|
m_running = false;
|
||||||
|
m_cond.notify_all();
|
||||||
|
if (m_sendThread.joinable())
|
||||||
|
m_sendThread.join();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 子连接建立后立即调用,告知服务端屏幕尺寸和编码格式
|
||||||
|
void SendBitmapInfo() {
|
||||||
|
const uint32_t total = 1 + sizeof(BmpInfoHeader) + 2 * sizeof(uint64_t) + sizeof(ScreenSettings);
|
||||||
|
std::vector<uint8_t> buf(total, 0);
|
||||||
|
|
||||||
|
buf[0] = TOKEN_BITMAPINFO;
|
||||||
|
memcpy(&buf[1], &m_bmpHdr, sizeof(BmpInfoHeader));
|
||||||
|
|
||||||
|
uint64_t clientID = g_myClientID;
|
||||||
|
uint64_t zero = 0;
|
||||||
|
size_t off = 1 + sizeof(BmpInfoHeader);
|
||||||
|
memcpy(&buf[off], &clientID, 8);
|
||||||
|
memcpy(&buf[off + 8], &zero, 8);
|
||||||
|
|
||||||
|
ScreenSettings ss = {};
|
||||||
|
ss.MaxFPS = GetClientMaxFps();
|
||||||
|
ss.ScreenWidth = m_width;
|
||||||
|
ss.ScreenHeight = m_height;
|
||||||
|
// 上报主控端上次为本机选择的档位(含 QUALITY_ADAPTIVE)。写死成 Good 会让服务端
|
||||||
|
// 认为这是「固定档位会话」,m_AdaptiveQuality.enabled 永远为 false——自适应质量
|
||||||
|
// 在 Android 主机上根本不会启动。具体编码参数由 ScreenTuning 在 Kotlin 侧应用。
|
||||||
|
ss.QualityLevel = GetClientQualityLevel();
|
||||||
|
ss.ScreenType = USING_VIRTUAL; // 虚拟显示
|
||||||
|
memcpy(&buf[off + 16], &ss, sizeof(ss));
|
||||||
|
|
||||||
|
m_client->Send2Server((char*)buf.data(), total);
|
||||||
|
LOGI_SH("SendBitmapInfo %dx%d clientID=%" PRIu64, m_width, m_height, clientID);
|
||||||
|
|
||||||
|
// H.264 是推送模式,不需要等 COMMAND_NEXT 才开始发帧。
|
||||||
|
// 服务端在 auth 通过瞬间发 COMMAND_NEXT,此时 setManagerCallBack 尚未注册,
|
||||||
|
// 消息被 WorkThread 丢弃,m_started 永远 false 导致帧全部卡在队列里。
|
||||||
|
m_started = true;
|
||||||
|
m_cond.notify_all();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 由 JNI 线程调用,投递 MediaCodec 输出的 NALU
|
||||||
|
void OnFrameData(const uint8_t* data, uint32_t size, bool isKeyframe) {
|
||||||
|
if (!m_running || size == 0) return;
|
||||||
|
{
|
||||||
|
std::lock_guard<std::mutex> lk(m_mutex);
|
||||||
|
while (m_queue.size() >= 6) m_queue.pop();
|
||||||
|
m_queue.push({std::vector<uint8_t>(data, data + size), isKeyframe});
|
||||||
|
}
|
||||||
|
m_cond.notify_one();
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual VOID OnReceive(PBYTE data, ULONG size) override {
|
||||||
|
if (!size) return;
|
||||||
|
switch (data[0]) {
|
||||||
|
case COMMAND_NEXT:
|
||||||
|
// 推送模式下已在 SendBitmapInfo 里开始推流;此处保留兼容,无副作用。
|
||||||
|
LOGI_SH("COMMAND_NEXT received");
|
||||||
|
m_started = true;
|
||||||
|
m_cond.notify_all();
|
||||||
|
break;
|
||||||
|
case CMD_QUALITY_LEVEL: {
|
||||||
|
// [cmd][level:int8][persist:1]。level 有符号(-2 关闭 / -1 自适应 / 0-5 具体档),
|
||||||
|
// persist=1 表示这是主控端选定的档位、要落盘(老主控端的负载只有 4 字节)。
|
||||||
|
if (size >= 2) {
|
||||||
|
const int level = (int)(int8_t)data[1];
|
||||||
|
const bool persist = size >= 3 && data[2] != 0;
|
||||||
|
DispatchQualityLevel(level, persist);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case CMD_FPS:
|
||||||
|
// [cmd][fps:1],255 = 不限帧。帧率只能写进 MediaCodec 的 KEY_FRAME_RATE
|
||||||
|
// (码控提示),surface 编码器没有运行时限帧开关,所以下次开抓才生效。
|
||||||
|
if (size >= 2) DispatchMaxFps((int)(uint8_t)data[1]);
|
||||||
|
break;
|
||||||
|
case CMD_QUALITY_PROFILES: {
|
||||||
|
// [cmd][QualityProfile × QUALITY_COUNT](每档 16 字节)。存下来供开抓与
|
||||||
|
// 档位切换时按主控端自定义的码率表取参数(主控端权威,见 ScreenSpyDlg)。
|
||||||
|
const size_t need = 1 + sizeof(QualityProfile) * QUALITY_COUNT;
|
||||||
|
if ((size_t)size < need) {
|
||||||
|
LOGE_SH("QUALITY_PROFILES short: %u < %u", (unsigned)size, (unsigned)need);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
std::string csv;
|
||||||
|
for (int i = 0; i < QUALITY_COUNT; i++) {
|
||||||
|
QualityProfile p;
|
||||||
|
memcpy(&p, data + 1 + i * sizeof(QualityProfile), sizeof(p));
|
||||||
|
if (i) csv += ';';
|
||||||
|
csv += std::to_string(p.maxFPS) + ',' + std::to_string(p.maxWidth) + ',' +
|
||||||
|
std::to_string(p.algorithm) + ',' + std::to_string(p.bitRate);
|
||||||
|
}
|
||||||
|
DispatchQualityProfilesCsv(csv.c_str());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case CMD_SCREEN_TUNING: {
|
||||||
|
// [cmd][flags:4][version:1]。Android 抓屏是 MediaProjection + MediaCodec(H264),
|
||||||
|
// 四个开关(x264 VBV / GDI 去延时 / 发送节流 / 自适应判据)都没有对应实现,
|
||||||
|
// 因此只记日志、不落盘,也不声明 SCREEN_CAP_TUNING_FLAGS。
|
||||||
|
uint32_t flags = 0;
|
||||||
|
if (size >= 5) memcpy(&flags, data + 1, 4);
|
||||||
|
const int ver = size >= 6 ? (int)data[5] : -1;
|
||||||
|
LOGI_SH("SCREEN_TUNING flags=0x%X ver=%d (no-op on Android)", flags, ver);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case CMD_SCREEN_SIZE:
|
||||||
|
// [cmd][strategy][maxWidth:int]。自适应质量要求缩放编码宽度;Android 源是
|
||||||
|
// 整屏抓取、尺寸在开抓时固定(改尺寸需重建 MediaCodec),故忽略。
|
||||||
|
// 服务端会按「客户端可能重启」先置分辨率切换标记,1 秒后超时自愈
|
||||||
|
// (CheckResolutionChangeTimeout:刷新解码器 + 请求 IDR),表现为切档后
|
||||||
|
// 画面停约 1 秒。回发 TOKEN_BITMAPINFO 能立刻清标记,但会连带 PrepareDrawing、
|
||||||
|
// 通知 web 端重建解码器,比 1 秒停顿更扰动,因此不这么做。
|
||||||
|
LOGI_SH("SCREEN_SIZE ignored on Android (%u bytes)", (unsigned)size);
|
||||||
|
break;
|
||||||
|
case COMMAND_SCREEN_SET_CLIPBOARD:
|
||||||
|
// 服务端写剪贴板: [cmd:1][GBK text:N](与 Windows CF_TEXT 同编码;人类剪贴板
|
||||||
|
// 同步会带 '\0' 结尾,MCP 路径不带,Kotlin 侧统一去掉尾随 NUL)
|
||||||
|
if (size > 1) DispatchClipboardText(data + 1, (size_t)size - 1);
|
||||||
|
break;
|
||||||
|
case COMMAND_SCREEN_CTRL_ALT_DEL:
|
||||||
|
// Ctrl+Alt+Del 在 Android 无对应键,客户端映射为锁屏(GLOBAL_ACTION_LOCK_SCREEN)
|
||||||
|
DispatchLockScreen();
|
||||||
|
break;
|
||||||
|
case COMMAND_SCREEN_BLOCK_INPUT:
|
||||||
|
// [cmd][0|1]:1=吃掉本机触摸(透明 overlay),0=解除。
|
||||||
|
// 与 Windows 的 BlockInput 语义对齐:服务端注入的手势照常穿透(Kotlin 侧在
|
||||||
|
// 手势在飞时临时置 FLAG_NOT_TOUCHABLE,等价于 Windows 的 BlockInput(false) 包裹)。
|
||||||
|
if (size >= 2) ApplyOverlay(m_black.load(), data[1] != 0);
|
||||||
|
break;
|
||||||
|
case COMMAND_SCREEN_BLANK:
|
||||||
|
// [cmd][0|1]:1=全屏黑,0=恢复。注意 Android 没有「窗口不参与抓屏」的等价物
|
||||||
|
// (Windows 是 WDA_EXCLUDEFROMCAPTURE),黑色 overlay 会被 MediaProjection
|
||||||
|
// 一起抓走,主控端看到的画面也会变黑——这是给本机旁观者看的隐私屏,不是隐身。
|
||||||
|
if (size >= 2) ApplyOverlay(data[1] != 0, m_block.load());
|
||||||
|
break;
|
||||||
|
case COMMAND_SCREEN_CONTROL: {
|
||||||
|
// 服务端通过子连接下发鼠标/键盘控制包(MSG64 固定 48 字节)
|
||||||
|
// 坐标从 lParam(offset 24)读取,与 Windows/Linux/macOS 客户端一致:
|
||||||
|
// lParam = MAKELPARAM(enc_x, enc_y),低16位=x,高16位=y。
|
||||||
|
// 不读 pt.x/pt.y (offset 40/44):64-bit MSG 的 pt 在 offset 36,
|
||||||
|
// 与 MSG64 offset 40 不同,直接读会得到错误坐标。
|
||||||
|
if ((ULONG)size < 1 + 48u) break;
|
||||||
|
const uint8_t* p = data + 1;
|
||||||
|
uint64_t msgVal = 0, wParam = 0, lParam = 0;
|
||||||
|
memcpy(&msgVal, p + 8, 8);
|
||||||
|
memcpy(&wParam, p + 16, 8);
|
||||||
|
memcpy(&lParam, p + 24, 8);
|
||||||
|
int32_t ptX = (int32_t)(int16_t)(lParam & 0xFFFF);
|
||||||
|
int32_t ptY = (int32_t)(int16_t)((lParam >> 16) & 0xFFFF);
|
||||||
|
DispatchControlEvent((uint32_t)msgVal, wParam, ptX, ptY);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
// 服务端下发的是「绝对状态」(black/block 各一个 bool),这里只记客户端当前状态,
|
||||||
|
// 用于两条收尾路径:另一条命令到来时保持它不变、子连接断开时整体撤掉。
|
||||||
|
void ApplyOverlay(bool black, bool block) {
|
||||||
|
m_black.store(black);
|
||||||
|
m_block.store(block);
|
||||||
|
LOGI_SH("privacy overlay: black=%d block=%d", (int)black, (int)block);
|
||||||
|
DispatchPrivacyOverlay(black, block);
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Frame { std::vector<uint8_t> data; bool isKeyframe; };
|
||||||
|
|
||||||
|
IOCPClient* m_client;
|
||||||
|
int m_width, m_height;
|
||||||
|
std::atomic<bool> m_started;
|
||||||
|
std::atomic<bool> m_running;
|
||||||
|
std::atomic<bool> m_firstSent;
|
||||||
|
std::atomic<bool> m_skipLogged{false};
|
||||||
|
std::atomic<bool> m_black{false}; // 隐私 overlay:全屏黑(COMMAND_SCREEN_BLANK)
|
||||||
|
std::atomic<bool> m_block{false}; // 隐私 overlay:吃掉本机触摸(COMMAND_SCREEN_BLOCK_INPUT)
|
||||||
|
|
||||||
|
BmpInfoHeader m_bmpHdr;
|
||||||
|
|
||||||
|
std::queue<Frame> m_queue;
|
||||||
|
std::mutex m_mutex;
|
||||||
|
std::condition_variable m_cond;
|
||||||
|
std::thread m_sendThread;
|
||||||
|
|
||||||
|
void SendLoop() {
|
||||||
|
while (m_running) {
|
||||||
|
std::unique_lock<std::mutex> lk(m_mutex);
|
||||||
|
m_cond.wait(lk, [&]{ return (!m_queue.empty() && m_started) || !m_running; });
|
||||||
|
if (!m_running) break;
|
||||||
|
|
||||||
|
Frame f = std::move(m_queue.front());
|
||||||
|
m_queue.pop();
|
||||||
|
lk.unlock();
|
||||||
|
|
||||||
|
// 第一帧必须是关键帧
|
||||||
|
if (!m_firstSent && !f.isKeyframe) {
|
||||||
|
if (!m_skipLogged.exchange(true))
|
||||||
|
LOGI_SH("SendLoop: waiting for first IDR, skipping P-frames");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!m_firstSent)
|
||||||
|
LOGI_SH("SendH264 first IDR size=%u", (uint32_t)f.data.size());
|
||||||
|
SendH264(f.data.data(), (uint32_t)f.data.size());
|
||||||
|
m_firstSent = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 格式: [TOKEN_NEXTSCREEN:1][ALGORITHM_H264:1][cursorX:4][cursorY:4][cursorType:1][NALU:N]
|
||||||
|
void SendH264(const uint8_t* nalu, uint32_t naluSize) {
|
||||||
|
const uint32_t hdrSize = 1 + 1 + 4 + 4 + 1;
|
||||||
|
std::vector<uint8_t> pkt(hdrSize + naluSize);
|
||||||
|
|
||||||
|
pkt[0] = TOKEN_NEXTSCREEN;
|
||||||
|
pkt[1] = ALGORITHM_H264;
|
||||||
|
// cursor: (0,0), type: IDC_ARROW=1
|
||||||
|
memset(&pkt[2], 0, 8);
|
||||||
|
pkt[10] = 1;
|
||||||
|
memcpy(&pkt[hdrSize], nalu, naluSize);
|
||||||
|
|
||||||
|
m_client->Send2Server((char*)pkt.data(), pkt.size());
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
// android_compat.h - Android NDK 兼容垫片,通过 CMake force-include 注入每个源文件
|
||||||
|
// 不修改任何共用代码(client/、common/)
|
||||||
|
#pragma once
|
||||||
|
#ifdef __ANDROID__
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#include <cstring>
|
||||||
|
#include <cstdlib>
|
||||||
|
|
||||||
|
// strcpy_s(dest, src) — MSVC 2-arg 扩展,Android NDK 无此签名
|
||||||
|
template<size_t N>
|
||||||
|
inline int strcpy_s(char (&dest)[N], const char* src) {
|
||||||
|
strncpy(dest, src ? src : "", N - 1);
|
||||||
|
dest[N - 1] = '\0';
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif // __cplusplus
|
||||||
|
|
||||||
|
// rand_s — Windows 安全随机数,Android 用 arc4random 替代
|
||||||
|
#define rand_s(p) (*(p) = (unsigned int)arc4random(), 0)
|
||||||
|
|
||||||
|
#endif // __ANDROID__
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
Copyright 1992, 1993, 1994 by Jutta Degener and Carsten Bormann,
|
||||||
|
Technische Universitaet Berlin
|
||||||
|
|
||||||
|
Any use of this software is permitted provided that this notice is not
|
||||||
|
removed and that neither the authors nor the Technische Universitaet Berlin
|
||||||
|
are deemed to have made any representations as to the suitability of this
|
||||||
|
software for any purpose nor are held responsible for any defects of
|
||||||
|
this software. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
|
||||||
|
|
||||||
|
As a matter of courtesy, the authors request to be informed about uses
|
||||||
|
this software has found, about bugs in this software, and about any
|
||||||
|
improvements that may be of general interest.
|
||||||
|
|
||||||
|
Berlin, 28.11.1994
|
||||||
|
Jutta Degener
|
||||||
|
Carsten Bormann
|
||||||
|
|
||||||
|
oOo
|
||||||
|
|
||||||
|
Since the original terms of 15 years ago maybe do not make our
|
||||||
|
intentions completely clear given today's refined usage of the legal
|
||||||
|
terms, we append this additional permission:
|
||||||
|
|
||||||
|
Permission to use, copy, modify, and distribute this software
|
||||||
|
for any purpose with or without fee is hereby granted,
|
||||||
|
provided that this notice is not removed and that neither
|
||||||
|
the authors nor the Technische Universitaet Berlin are
|
||||||
|
deemed to have made any representations as to the suitability
|
||||||
|
of this software for any purpose nor are held responsible
|
||||||
|
for any defects of this software. THERE IS ABSOLUTELY NO
|
||||||
|
WARRANTY FOR THIS SOFTWARE.
|
||||||
|
|
||||||
|
Berkeley/Bremen, 05.04.2009
|
||||||
|
Jutta Degener
|
||||||
|
Carsten Bormann
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
# libgsm (GSM 06.10)
|
||||||
|
|
||||||
|
语音监听(`COMMAND_AUDIO` / `TOKEN_AUDIO_START`)的客户端音频编码器。
|
||||||
|
|
||||||
|
## 为什么放在这里
|
||||||
|
|
||||||
|
Windows 客户端的「语音监听」用系统 ACM 的 `WAVE_FORMAT_GSM610`
|
||||||
|
(`client/Audio.cpp`:8000 Hz、单声道、blockAlign=65、320 采样/块,VBR 1625 B/s)。
|
||||||
|
Android 没有可用的 GSM 6.10 编码器(`AudioRecord` 只出 PCM,`MediaCodec` 不提供
|
||||||
|
GSM),所以把 Jutta Degener / Carsten Bormann 的参考实现随 App 编译,用
|
||||||
|
`GSM_OPT_WAV49` 产出与 ACM 完全相同的 65 字节 MS-GSM 块,服务端
|
||||||
|
`CAudioDlg`/`CAudio::PlayBuffer` 不需要任何改动。
|
||||||
|
|
||||||
|
## 来源与许可
|
||||||
|
|
||||||
|
- 源码:gsm-1.0.13,来自 AOSP `external/libgsm` 的镜像
|
||||||
|
(https://github.com/CyanogenMod/android_external_libgsm,分支 cm-10.2),
|
||||||
|
只保留编解码必需的文件,未做任何修改。
|
||||||
|
- 许可:见 `NOTICE`(TU Berlin 的 BSD 风格许可,保留本声明即可使用)。
|
||||||
|
|
||||||
|
## 编译
|
||||||
|
|
||||||
|
`CMakeLists.txt` 里以静态库 `gsm610` 编译,固定加 `-DSASR -DWAV49`
|
||||||
|
(与 AOSP 的 `Android.mk` 一致)。`WAV49` 打开 MS-GSM 打包;调用时必须成对:
|
||||||
|
每 65 字节块写入两次(`gsm_encode(state, pcm, out)` 写 32 字节、
|
||||||
|
`gsm_encode(state, pcm + 160, out + 32)` 写 33 字节),解码同理
|
||||||
|
(`gsm_decode(state, p, pcm)`、`gsm_decode(state, p + 33, pcm + 160)`)。
|
||||||
|
编码与解码必须用**两个独立的 `gsm` 状态**——`frame_index` / `frame_chain`
|
||||||
|
是编解码共用的,混用会打乱半字节对齐。
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
|
||||||
|
* Universitaet Berlin. See the accompanying file "COPYRIGHT" for
|
||||||
|
* details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*$Header: /tmp_amd/presto/export/kbs/jutta/src/gsm/RCS/config.h,v 1.5 1996/07/02 11:26:20 jutta Exp $*/
|
||||||
|
|
||||||
|
#ifndef CONFIG_H
|
||||||
|
#define CONFIG_H
|
||||||
|
|
||||||
|
#define HAS_STDLIB_H 1 /* /usr/include/stdlib.h */
|
||||||
|
#define HAS_LIMITS_H 1 /* /usr/include/limits.h */
|
||||||
|
#define HAS_FCNTL_H 1 /* /usr/include/fcntl.h */
|
||||||
|
#define HAS_ERRNO_DECL 1 /* errno.h declares errno */
|
||||||
|
|
||||||
|
#define HAS_FSTAT 1 /* fstat syscall */
|
||||||
|
#define HAS_FCHMOD 1 /* fchmod syscall */
|
||||||
|
#define HAS_CHMOD 1 /* chmod syscall */
|
||||||
|
#define HAS_FCHOWN 1 /* fchown syscall */
|
||||||
|
#define HAS_CHOWN 1 /* chown syscall */
|
||||||
|
|
||||||
|
#define HAS_STRING_H 1 /* /usr/include/string.h */
|
||||||
|
|
||||||
|
#define HAS_UNISTD_H 1 /* /usr/include/unistd.h */
|
||||||
|
#define HAS_UTIME 1 /* POSIX utime(path, times) */
|
||||||
|
#define HAS_UTIME_H 1 /* UTIME header file */
|
||||||
|
#define HAS_UTIMBUF 1 /* struct utimbuf */
|
||||||
|
|
||||||
|
#endif /* CONFIG_H */
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
|
||||||
|
* Universitaet Berlin. See the accompanying file "COPYRIGHT" for
|
||||||
|
* details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*$Header: /home/kbs/jutta/src/gsm/gsm-1.0/inc/RCS/gsm.h,v 1.11 1996/07/05 18:02:56 jutta Exp $*/
|
||||||
|
|
||||||
|
#ifndef GSM_H
|
||||||
|
#define GSM_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
# define NeedFunctionPrototypes 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if __STDC__
|
||||||
|
# define NeedFunctionPrototypes 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _NO_PROTO
|
||||||
|
# undef NeedFunctionPrototypes
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef NeedFunctionPrototypes
|
||||||
|
# include <stdio.h> /* for FILE * */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#undef GSM_P
|
||||||
|
#if NeedFunctionPrototypes
|
||||||
|
# define GSM_P( protos ) protos
|
||||||
|
#else
|
||||||
|
# define GSM_P( protos ) ( /* protos */ )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Interface
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef struct gsm_state * gsm;
|
||||||
|
typedef short gsm_signal; /* signed 16 bit */
|
||||||
|
typedef unsigned char gsm_byte;
|
||||||
|
typedef gsm_byte gsm_frame[33]; /* 33 * 8 bits */
|
||||||
|
|
||||||
|
#define GSM_MAGIC 0xD /* 13 kbit/s RPE-LTP */
|
||||||
|
|
||||||
|
#define GSM_PATCHLEVEL 10
|
||||||
|
#define GSM_MINOR 0
|
||||||
|
#define GSM_MAJOR 1
|
||||||
|
|
||||||
|
#define GSM_OPT_VERBOSE 1
|
||||||
|
#define GSM_OPT_FAST 2
|
||||||
|
#define GSM_OPT_LTP_CUT 3
|
||||||
|
#define GSM_OPT_WAV49 4
|
||||||
|
#define GSM_OPT_FRAME_INDEX 5
|
||||||
|
#define GSM_OPT_FRAME_CHAIN 6
|
||||||
|
|
||||||
|
extern gsm gsm_create GSM_P((void));
|
||||||
|
extern void gsm_destroy GSM_P((gsm));
|
||||||
|
|
||||||
|
extern int gsm_print GSM_P((FILE *, gsm, gsm_byte *));
|
||||||
|
extern int gsm_option GSM_P((gsm, int, int *));
|
||||||
|
|
||||||
|
extern void gsm_encode GSM_P((gsm, gsm_signal *, gsm_byte *));
|
||||||
|
extern int gsm_decode GSM_P((gsm, gsm_byte *, gsm_signal *));
|
||||||
|
|
||||||
|
extern int gsm_explode GSM_P((gsm, gsm_byte *, gsm_signal *));
|
||||||
|
extern void gsm_implode GSM_P((gsm, gsm_signal *, gsm_byte *));
|
||||||
|
|
||||||
|
#undef GSM_P
|
||||||
|
|
||||||
|
#endif /* GSM_H */
|
||||||
@@ -0,0 +1,269 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
|
||||||
|
* Universitaet Berlin. See the accompanying file "COPYRIGHT" for
|
||||||
|
* details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*$Header: /tmp_amd/presto/export/kbs/jutta/src/gsm/RCS/private.h,v 1.6 1996/07/02 10:15:26 jutta Exp $*/
|
||||||
|
|
||||||
|
#ifndef PRIVATE_H
|
||||||
|
#define PRIVATE_H
|
||||||
|
|
||||||
|
typedef short word; /* 16 bit signed int */
|
||||||
|
typedef long longword; /* 32 bit signed int */
|
||||||
|
|
||||||
|
typedef unsigned short uword; /* unsigned word */
|
||||||
|
typedef unsigned long ulongword; /* unsigned longword */
|
||||||
|
|
||||||
|
struct gsm_state {
|
||||||
|
|
||||||
|
word dp0[ 280 ];
|
||||||
|
word e[ 50 ]; /* code.c */
|
||||||
|
|
||||||
|
word z1; /* preprocessing.c, Offset_com. */
|
||||||
|
longword L_z2; /* Offset_com. */
|
||||||
|
int mp; /* Preemphasis */
|
||||||
|
|
||||||
|
word u[8]; /* short_term_aly_filter.c */
|
||||||
|
word LARpp[2][8]; /* */
|
||||||
|
word j; /* */
|
||||||
|
|
||||||
|
word ltp_cut; /* long_term.c, LTP crosscorr. */
|
||||||
|
word nrp; /* 40 */ /* long_term.c, synthesis */
|
||||||
|
word v[9]; /* short_term.c, synthesis */
|
||||||
|
word msr; /* decoder.c, Postprocessing */
|
||||||
|
|
||||||
|
char verbose; /* only used if !NDEBUG */
|
||||||
|
char fast; /* only used if FAST */
|
||||||
|
|
||||||
|
char wav_fmt; /* only used if WAV49 defined */
|
||||||
|
unsigned char frame_index; /* odd/even chaining */
|
||||||
|
unsigned char frame_chain; /* half-byte to carry forward */
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#define MIN_WORD (-32767 - 1)
|
||||||
|
#define MAX_WORD 32767
|
||||||
|
|
||||||
|
#define MIN_LONGWORD (-2147483647 - 1)
|
||||||
|
#define MAX_LONGWORD 2147483647
|
||||||
|
|
||||||
|
#ifdef SASR /* flag: >> is a signed arithmetic shift right */
|
||||||
|
#undef SASR
|
||||||
|
#define SASR(x, by) ((x) >> (by))
|
||||||
|
#else
|
||||||
|
#define SASR(x, by) ((x) >= 0 ? (x) >> (by) : (~(-((x) + 1) >> (by))))
|
||||||
|
#endif /* SASR */
|
||||||
|
|
||||||
|
#include "proto.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Prototypes from add.c
|
||||||
|
*/
|
||||||
|
extern word gsm_mult P((word a, word b));
|
||||||
|
extern longword gsm_L_mult P((word a, word b));
|
||||||
|
extern word gsm_mult_r P((word a, word b));
|
||||||
|
|
||||||
|
extern word gsm_div P((word num, word denum));
|
||||||
|
|
||||||
|
extern word gsm_add P(( word a, word b ));
|
||||||
|
extern longword gsm_L_add P(( longword a, longword b ));
|
||||||
|
|
||||||
|
extern word gsm_sub P((word a, word b));
|
||||||
|
extern longword gsm_L_sub P((longword a, longword b));
|
||||||
|
|
||||||
|
extern word gsm_abs P((word a));
|
||||||
|
|
||||||
|
extern word gsm_norm P(( longword a ));
|
||||||
|
|
||||||
|
extern longword gsm_L_asl P((longword a, int n));
|
||||||
|
extern word gsm_asl P((word a, int n));
|
||||||
|
|
||||||
|
extern longword gsm_L_asr P((longword a, int n));
|
||||||
|
extern word gsm_asr P((word a, int n));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Inlined functions from add.h
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* #define GSM_MULT_R(a, b) (* word a, word b, !(a == b == MIN_WORD) *) \
|
||||||
|
* (0x0FFFF & SASR(((longword)(a) * (longword)(b) + 16384), 15))
|
||||||
|
*/
|
||||||
|
#define GSM_MULT_R(a, b) /* word a, word b, !(a == b == MIN_WORD) */ \
|
||||||
|
(SASR( ((longword)(a) * (longword)(b) + 16384), 15 ))
|
||||||
|
|
||||||
|
# define GSM_MULT(a,b) /* word a, word b, !(a == b == MIN_WORD) */ \
|
||||||
|
(SASR( ((longword)(a) * (longword)(b)), 15 ))
|
||||||
|
|
||||||
|
# define GSM_L_MULT(a, b) /* word a, word b */ \
|
||||||
|
(((longword)(a) * (longword)(b)) << 1)
|
||||||
|
|
||||||
|
# define GSM_L_ADD(a, b) \
|
||||||
|
( (a) < 0 ? ( (b) >= 0 ? (a) + (b) \
|
||||||
|
: (utmp = (ulongword)-((a) + 1) + (ulongword)-((b) + 1)) \
|
||||||
|
>= MAX_LONGWORD ? MIN_LONGWORD : -(longword)utmp-2 ) \
|
||||||
|
: ((b) <= 0 ? (a) + (b) \
|
||||||
|
: (utmp = (ulongword)(a) + (ulongword)(b)) >= MAX_LONGWORD \
|
||||||
|
? MAX_LONGWORD : utmp))
|
||||||
|
|
||||||
|
/*
|
||||||
|
* # define GSM_ADD(a, b) \
|
||||||
|
* ((ltmp = (longword)(a) + (longword)(b)) >= MAX_WORD \
|
||||||
|
* ? MAX_WORD : ltmp <= MIN_WORD ? MIN_WORD : ltmp)
|
||||||
|
*/
|
||||||
|
/* Nonportable, but faster: */
|
||||||
|
|
||||||
|
#define GSM_ADD(a, b) \
|
||||||
|
((ulongword)((ltmp = (longword)(a) + (longword)(b)) - MIN_WORD) > \
|
||||||
|
MAX_WORD - MIN_WORD ? (ltmp > 0 ? MAX_WORD : MIN_WORD) : ltmp)
|
||||||
|
|
||||||
|
# define GSM_SUB(a, b) \
|
||||||
|
((ltmp = (longword)(a) - (longword)(b)) >= MAX_WORD \
|
||||||
|
? MAX_WORD : ltmp <= MIN_WORD ? MIN_WORD : ltmp)
|
||||||
|
|
||||||
|
# define GSM_ABS(a) ((a) < 0 ? ((a) == MIN_WORD ? MAX_WORD : -(a)) : (a))
|
||||||
|
|
||||||
|
/* Use these if necessary:
|
||||||
|
|
||||||
|
# define GSM_MULT_R(a, b) gsm_mult_r(a, b)
|
||||||
|
# define GSM_MULT(a, b) gsm_mult(a, b)
|
||||||
|
# define GSM_L_MULT(a, b) gsm_L_mult(a, b)
|
||||||
|
|
||||||
|
# define GSM_L_ADD(a, b) gsm_L_add(a, b)
|
||||||
|
# define GSM_ADD(a, b) gsm_add(a, b)
|
||||||
|
# define GSM_SUB(a, b) gsm_sub(a, b)
|
||||||
|
|
||||||
|
# define GSM_ABS(a) gsm_abs(a)
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* More prototypes from implementations..
|
||||||
|
*/
|
||||||
|
extern void Gsm_Coder P((
|
||||||
|
struct gsm_state * S,
|
||||||
|
word * s, /* [0..159] samples IN */
|
||||||
|
word * LARc, /* [0..7] LAR coefficients OUT */
|
||||||
|
word * Nc, /* [0..3] LTP lag OUT */
|
||||||
|
word * bc, /* [0..3] coded LTP gain OUT */
|
||||||
|
word * Mc, /* [0..3] RPE grid selection OUT */
|
||||||
|
word * xmaxc,/* [0..3] Coded maximum amplitude OUT */
|
||||||
|
word * xMc /* [13*4] normalized RPE samples OUT */));
|
||||||
|
|
||||||
|
extern void Gsm_Long_Term_Predictor P(( /* 4x for 160 samples */
|
||||||
|
struct gsm_state * S,
|
||||||
|
word * d, /* [0..39] residual signal IN */
|
||||||
|
word * dp, /* [-120..-1] d' IN */
|
||||||
|
word * e, /* [0..40] OUT */
|
||||||
|
word * dpp, /* [0..40] OUT */
|
||||||
|
word * Nc, /* correlation lag OUT */
|
||||||
|
word * bc /* gain factor OUT */));
|
||||||
|
|
||||||
|
extern void Gsm_LPC_Analysis P((
|
||||||
|
struct gsm_state * S,
|
||||||
|
word * s, /* 0..159 signals IN/OUT */
|
||||||
|
word * LARc)); /* 0..7 LARc's OUT */
|
||||||
|
|
||||||
|
extern void Gsm_Preprocess P((
|
||||||
|
struct gsm_state * S,
|
||||||
|
word * s, word * so));
|
||||||
|
|
||||||
|
extern void Gsm_Encoding P((
|
||||||
|
struct gsm_state * S,
|
||||||
|
word * e,
|
||||||
|
word * ep,
|
||||||
|
word * xmaxc,
|
||||||
|
word * Mc,
|
||||||
|
word * xMc));
|
||||||
|
|
||||||
|
extern void Gsm_Short_Term_Analysis_Filter P((
|
||||||
|
struct gsm_state * S,
|
||||||
|
word * LARc, /* coded log area ratio [0..7] IN */
|
||||||
|
word * d /* st res. signal [0..159] IN/OUT */));
|
||||||
|
|
||||||
|
extern void Gsm_Decoder P((
|
||||||
|
struct gsm_state * S,
|
||||||
|
word * LARcr, /* [0..7] IN */
|
||||||
|
word * Ncr, /* [0..3] IN */
|
||||||
|
word * bcr, /* [0..3] IN */
|
||||||
|
word * Mcr, /* [0..3] IN */
|
||||||
|
word * xmaxcr, /* [0..3] IN */
|
||||||
|
word * xMcr, /* [0..13*4] IN */
|
||||||
|
word * s)); /* [0..159] OUT */
|
||||||
|
|
||||||
|
extern void Gsm_Decoding P((
|
||||||
|
struct gsm_state * S,
|
||||||
|
word xmaxcr,
|
||||||
|
word Mcr,
|
||||||
|
word * xMcr, /* [0..12] IN */
|
||||||
|
word * erp)); /* [0..39] OUT */
|
||||||
|
|
||||||
|
extern void Gsm_Long_Term_Synthesis_Filtering P((
|
||||||
|
struct gsm_state* S,
|
||||||
|
word Ncr,
|
||||||
|
word bcr,
|
||||||
|
word * erp, /* [0..39] IN */
|
||||||
|
word * drp)); /* [-120..-1] IN, [0..40] OUT */
|
||||||
|
|
||||||
|
void Gsm_RPE_Decoding P((
|
||||||
|
struct gsm_state *S,
|
||||||
|
word xmaxcr,
|
||||||
|
word Mcr,
|
||||||
|
word * xMcr, /* [0..12], 3 bits IN */
|
||||||
|
word * erp)); /* [0..39] OUT */
|
||||||
|
|
||||||
|
void Gsm_RPE_Encoding P((
|
||||||
|
struct gsm_state * S,
|
||||||
|
word * e, /* -5..-1][0..39][40..44 IN/OUT */
|
||||||
|
word * xmaxc, /* OUT */
|
||||||
|
word * Mc, /* OUT */
|
||||||
|
word * xMc)); /* [0..12] OUT */
|
||||||
|
|
||||||
|
extern void Gsm_Short_Term_Synthesis_Filter P((
|
||||||
|
struct gsm_state * S,
|
||||||
|
word * LARcr, /* log area ratios [0..7] IN */
|
||||||
|
word * drp, /* received d [0...39] IN */
|
||||||
|
word * s)); /* signal s [0..159] OUT */
|
||||||
|
|
||||||
|
extern void Gsm_Update_of_reconstructed_short_time_residual_signal P((
|
||||||
|
word * dpp, /* [0...39] IN */
|
||||||
|
word * ep, /* [0...39] IN */
|
||||||
|
word * dp)); /* [-120...-1] IN/OUT */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Tables from table.c
|
||||||
|
*/
|
||||||
|
#ifndef GSM_TABLE_C
|
||||||
|
|
||||||
|
extern word gsm_A[8], gsm_B[8], gsm_MIC[8], gsm_MAC[8];
|
||||||
|
extern word gsm_INVA[8];
|
||||||
|
extern word gsm_DLB[4], gsm_QLB[4];
|
||||||
|
extern word gsm_H[11];
|
||||||
|
extern word gsm_NRFAC[8];
|
||||||
|
extern word gsm_FAC[8];
|
||||||
|
|
||||||
|
#endif /* GSM_TABLE_C */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Debugging
|
||||||
|
*/
|
||||||
|
#ifdef NDEBUG
|
||||||
|
|
||||||
|
# define gsm_debug_words(a, b, c, d) /* nil */
|
||||||
|
# define gsm_debug_longwords(a, b, c, d) /* nil */
|
||||||
|
# define gsm_debug_word(a, b) /* nil */
|
||||||
|
# define gsm_debug_longword(a, b) /* nil */
|
||||||
|
|
||||||
|
#else /* !NDEBUG => DEBUG */
|
||||||
|
|
||||||
|
extern void gsm_debug_words P((char * name, int, int, word *));
|
||||||
|
extern void gsm_debug_longwords P((char * name, int, int, longword *));
|
||||||
|
extern void gsm_debug_longword P((char * name, longword));
|
||||||
|
extern void gsm_debug_word P((char * name, word));
|
||||||
|
|
||||||
|
#endif /* !NDEBUG */
|
||||||
|
|
||||||
|
#include "unproto.h"
|
||||||
|
|
||||||
|
#endif /* PRIVATE_H */
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
|
||||||
|
* Universitaet Berlin. See the accompanying file "COPYRIGHT" for
|
||||||
|
* details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*$Header: /tmp_amd/presto/export/kbs/jutta/src/gsm/RCS/proto.h,v 1.1 1992/10/28 00:11:08 jutta Exp $*/
|
||||||
|
|
||||||
|
#ifndef PROTO_H
|
||||||
|
#define PROTO_H
|
||||||
|
|
||||||
|
#if __cplusplus
|
||||||
|
# define NeedFunctionPrototypes 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if __STDC__
|
||||||
|
# define NeedFunctionPrototypes 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _NO_PROTO
|
||||||
|
# undef NeedFunctionPrototypes
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#undef P /* gnu stdio.h actually defines this... */
|
||||||
|
#undef P0
|
||||||
|
#undef P1
|
||||||
|
#undef P2
|
||||||
|
#undef P3
|
||||||
|
#undef P4
|
||||||
|
#undef P5
|
||||||
|
#undef P6
|
||||||
|
#undef P7
|
||||||
|
#undef P8
|
||||||
|
|
||||||
|
#if NeedFunctionPrototypes
|
||||||
|
|
||||||
|
# define P( protos ) protos
|
||||||
|
|
||||||
|
# define P0() (void)
|
||||||
|
# define P1(x, a) (a)
|
||||||
|
# define P2(x, a, b) (a, b)
|
||||||
|
# define P3(x, a, b, c) (a, b, c)
|
||||||
|
# define P4(x, a, b, c, d) (a, b, c, d)
|
||||||
|
# define P5(x, a, b, c, d, e) (a, b, c, d, e)
|
||||||
|
# define P6(x, a, b, c, d, e, f) (a, b, c, d, e, f)
|
||||||
|
# define P7(x, a, b, c, d, e, f, g) (a, b, c, d, e, f, g)
|
||||||
|
# define P8(x, a, b, c, d, e, f, g, h) (a, b, c, d, e, f, g, h)
|
||||||
|
|
||||||
|
#else /* !NeedFunctionPrototypes */
|
||||||
|
|
||||||
|
# define P( protos ) ( /* protos */ )
|
||||||
|
|
||||||
|
# define P0() ()
|
||||||
|
# define P1(x, a) x a;
|
||||||
|
# define P2(x, a, b) x a; b;
|
||||||
|
# define P3(x, a, b, c) x a; b; c;
|
||||||
|
# define P4(x, a, b, c, d) x a; b; c; d;
|
||||||
|
# define P5(x, a, b, c, d, e) x a; b; c; d; e;
|
||||||
|
# define P6(x, a, b, c, d, e, f) x a; b; c; d; e; f;
|
||||||
|
# define P7(x, a, b, c, d, e, f, g) x a; b; c; d; e; f; g;
|
||||||
|
# define P8(x, a, b, c, d, e, f, g, h) x a; b; c; d; e; f; g; h;
|
||||||
|
|
||||||
|
#endif /* !NeedFunctionPrototypes */
|
||||||
|
|
||||||
|
#endif /* PROTO_H */
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
|
||||||
|
* Universitaet Berlin. See the accompanying file "COPYRIGHT" for
|
||||||
|
* details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*$Header: /tmp_amd/presto/export/kbs/jutta/src/gsm/RCS/unproto.h,v 1.1 1992/10/28 00:11:08 jutta Exp $*/
|
||||||
|
|
||||||
|
#ifdef PROTO_H /* sic */
|
||||||
|
#undef PROTO_H
|
||||||
|
|
||||||
|
#undef P
|
||||||
|
#undef P0
|
||||||
|
#undef P1
|
||||||
|
#undef P2
|
||||||
|
#undef P3
|
||||||
|
#undef P4
|
||||||
|
#undef P5
|
||||||
|
#undef P6
|
||||||
|
#undef P7
|
||||||
|
#undef P8
|
||||||
|
|
||||||
|
#endif /* PROTO_H */
|
||||||
@@ -0,0 +1,235 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
|
||||||
|
* Universitaet Berlin. See the accompanying file "COPYRIGHT" for
|
||||||
|
* details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* $Header: /tmp_amd/presto/export/kbs/jutta/src/gsm/RCS/add.c,v 1.6 1996/07/02 09:57:33 jutta Exp $ */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* See private.h for the more commonly used macro versions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
#include "private.h"
|
||||||
|
#include "gsm.h"
|
||||||
|
#include "proto.h"
|
||||||
|
|
||||||
|
#define saturate(x) \
|
||||||
|
((x) < MIN_WORD ? MIN_WORD : (x) > MAX_WORD ? MAX_WORD: (x))
|
||||||
|
|
||||||
|
word gsm_add P2((a,b), word a, word b)
|
||||||
|
{
|
||||||
|
longword sum = (longword)a + (longword)b;
|
||||||
|
return saturate(sum);
|
||||||
|
}
|
||||||
|
|
||||||
|
word gsm_sub P2((a,b), word a, word b)
|
||||||
|
{
|
||||||
|
longword diff = (longword)a - (longword)b;
|
||||||
|
return saturate(diff);
|
||||||
|
}
|
||||||
|
|
||||||
|
word gsm_mult P2((a,b), word a, word b)
|
||||||
|
{
|
||||||
|
if (a == MIN_WORD && b == MIN_WORD) return MAX_WORD;
|
||||||
|
else return SASR( (longword)a * (longword)b, 15 );
|
||||||
|
}
|
||||||
|
|
||||||
|
word gsm_mult_r P2((a,b), word a, word b)
|
||||||
|
{
|
||||||
|
if (b == MIN_WORD && a == MIN_WORD) return MAX_WORD;
|
||||||
|
else {
|
||||||
|
longword prod = (longword)a * (longword)b + 16384;
|
||||||
|
prod >>= 15;
|
||||||
|
return prod & 0xFFFF;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
word gsm_abs P1((a), word a)
|
||||||
|
{
|
||||||
|
return a < 0 ? (a == MIN_WORD ? MAX_WORD : -a) : a;
|
||||||
|
}
|
||||||
|
|
||||||
|
longword gsm_L_mult P2((a,b),word a, word b)
|
||||||
|
{
|
||||||
|
assert( a != MIN_WORD || b != MIN_WORD );
|
||||||
|
return ((longword)a * (longword)b) << 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
longword gsm_L_add P2((a,b), longword a, longword b)
|
||||||
|
{
|
||||||
|
if (a < 0) {
|
||||||
|
if (b >= 0) return a + b;
|
||||||
|
else {
|
||||||
|
ulongword A = (ulongword)-(a + 1) + (ulongword)-(b + 1);
|
||||||
|
return A >= MAX_LONGWORD ? MIN_LONGWORD :-(longword)A-2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (b <= 0) return a + b;
|
||||||
|
else {
|
||||||
|
ulongword A = (ulongword)a + (ulongword)b;
|
||||||
|
return A > MAX_LONGWORD ? MAX_LONGWORD : A;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
longword gsm_L_sub P2((a,b), longword a, longword b)
|
||||||
|
{
|
||||||
|
if (a >= 0) {
|
||||||
|
if (b >= 0) return a - b;
|
||||||
|
else {
|
||||||
|
/* a>=0, b<0 */
|
||||||
|
|
||||||
|
ulongword A = (ulongword)a + -(b + 1);
|
||||||
|
return A >= MAX_LONGWORD ? MAX_LONGWORD : (A + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (b <= 0) return a - b;
|
||||||
|
else {
|
||||||
|
/* a<0, b>0 */
|
||||||
|
|
||||||
|
ulongword A = (ulongword)-(a + 1) + b;
|
||||||
|
return A >= MAX_LONGWORD ? MIN_LONGWORD : -(longword)A - 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static unsigned char const bitoff[ 256 ] = {
|
||||||
|
8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4,
|
||||||
|
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
|
||||||
|
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||||
|
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||||
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||||
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||||
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||||
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||||
|
};
|
||||||
|
|
||||||
|
word gsm_norm P1((a), longword a )
|
||||||
|
/*
|
||||||
|
* the number of left shifts needed to normalize the 32 bit
|
||||||
|
* variable L_var1 for positive values on the interval
|
||||||
|
*
|
||||||
|
* with minimum of
|
||||||
|
* minimum of 1073741824 (01000000000000000000000000000000) and
|
||||||
|
* maximum of 2147483647 (01111111111111111111111111111111)
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* and for negative values on the interval with
|
||||||
|
* minimum of -2147483648 (-10000000000000000000000000000000) and
|
||||||
|
* maximum of -1073741824 ( -1000000000000000000000000000000).
|
||||||
|
*
|
||||||
|
* in order to normalize the result, the following
|
||||||
|
* operation must be done: L_norm_var1 = L_var1 << norm( L_var1 );
|
||||||
|
*
|
||||||
|
* (That's 'ffs', only from the left, not the right..)
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
assert(a != 0);
|
||||||
|
|
||||||
|
if (a < 0) {
|
||||||
|
if (a <= -1073741824) return 0;
|
||||||
|
a = ~a;
|
||||||
|
}
|
||||||
|
|
||||||
|
return a & 0xffff0000
|
||||||
|
? ( a & 0xff000000
|
||||||
|
? -1 + bitoff[ 0xFF & (a >> 24) ]
|
||||||
|
: 7 + bitoff[ 0xFF & (a >> 16) ] )
|
||||||
|
: ( a & 0xff00
|
||||||
|
? 15 + bitoff[ 0xFF & (a >> 8) ]
|
||||||
|
: 23 + bitoff[ 0xFF & a ] );
|
||||||
|
}
|
||||||
|
|
||||||
|
longword gsm_L_asl P2((a,n), longword a, int n)
|
||||||
|
{
|
||||||
|
if (n >= 32) return 0;
|
||||||
|
if (n <= -32) return -(a < 0);
|
||||||
|
if (n < 0) return gsm_L_asr(a, -n);
|
||||||
|
return a << n;
|
||||||
|
}
|
||||||
|
|
||||||
|
word gsm_asl P2((a,n), word a, int n)
|
||||||
|
{
|
||||||
|
if (n >= 16) return 0;
|
||||||
|
if (n <= -16) return -(a < 0);
|
||||||
|
if (n < 0) return gsm_asr(a, -n);
|
||||||
|
return a << n;
|
||||||
|
}
|
||||||
|
|
||||||
|
longword gsm_L_asr P2((a,n), longword a, int n)
|
||||||
|
{
|
||||||
|
if (n >= 32) return -(a < 0);
|
||||||
|
if (n <= -32) return 0;
|
||||||
|
if (n < 0) return a << -n;
|
||||||
|
|
||||||
|
# ifdef SASR
|
||||||
|
return a >> n;
|
||||||
|
# else
|
||||||
|
if (a >= 0) return a >> n;
|
||||||
|
else return -(longword)( -(ulongword)a >> n );
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
|
||||||
|
word gsm_asr P2((a,n), word a, int n)
|
||||||
|
{
|
||||||
|
if (n >= 16) return -(a < 0);
|
||||||
|
if (n <= -16) return 0;
|
||||||
|
if (n < 0) return a << -n;
|
||||||
|
|
||||||
|
# ifdef SASR
|
||||||
|
return a >> n;
|
||||||
|
# else
|
||||||
|
if (a >= 0) return a >> n;
|
||||||
|
else return -(word)( -(uword)a >> n );
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (From p. 46, end of section 4.2.5)
|
||||||
|
*
|
||||||
|
* NOTE: The following lines gives [sic] one correct implementation
|
||||||
|
* of the div(num, denum) arithmetic operation. Compute div
|
||||||
|
* which is the integer division of num by denum: with denum
|
||||||
|
* >= num > 0
|
||||||
|
*/
|
||||||
|
|
||||||
|
word gsm_div P2((num,denum), word num, word denum)
|
||||||
|
{
|
||||||
|
longword L_num = num;
|
||||||
|
longword L_denum = denum;
|
||||||
|
word div = 0;
|
||||||
|
int k = 15;
|
||||||
|
|
||||||
|
/* The parameter num sometimes becomes zero.
|
||||||
|
* Although this is explicitly guarded against in 4.2.5,
|
||||||
|
* we assume that the result should then be zero as well.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* assert(num != 0); */
|
||||||
|
|
||||||
|
assert(num >= 0 && denum >= num);
|
||||||
|
if (num == 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
while (k--) {
|
||||||
|
div <<= 1;
|
||||||
|
L_num <<= 1;
|
||||||
|
|
||||||
|
if (L_num >= L_denum) {
|
||||||
|
L_num -= L_denum;
|
||||||
|
div++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return div;
|
||||||
|
}
|
||||||
@@ -0,0 +1,97 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
|
||||||
|
* Universitaet Berlin. See the accompanying file "COPYRIGHT" for
|
||||||
|
* details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* $Header: /tmp_amd/presto/export/kbs/jutta/src/gsm/RCS/code.c,v 1.3 1996/07/02 09:59:05 jutta Exp $ */
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef HAS_STDLIB_H
|
||||||
|
#include <stdlib.h>
|
||||||
|
#else
|
||||||
|
# include "proto.h"
|
||||||
|
extern char * memcpy P((char *, char *, int));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "private.h"
|
||||||
|
#include "gsm.h"
|
||||||
|
#include "proto.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 4.2 FIXED POINT IMPLEMENTATION OF THE RPE-LTP CODER
|
||||||
|
*/
|
||||||
|
|
||||||
|
void Gsm_Coder P8((S,s,LARc,Nc,bc,Mc,xmaxc,xMc),
|
||||||
|
|
||||||
|
struct gsm_state * S,
|
||||||
|
|
||||||
|
word * s, /* [0..159] samples IN */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The RPE-LTD coder works on a frame by frame basis. The length of
|
||||||
|
* the frame is equal to 160 samples. Some computations are done
|
||||||
|
* once per frame to produce at the output of the coder the
|
||||||
|
* LARc[1..8] parameters which are the coded LAR coefficients and
|
||||||
|
* also to realize the inverse filtering operation for the entire
|
||||||
|
* frame (160 samples of signal d[0..159]). These parts produce at
|
||||||
|
* the output of the coder:
|
||||||
|
*/
|
||||||
|
|
||||||
|
word * LARc, /* [0..7] LAR coefficients OUT */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Procedure 4.2.11 to 4.2.18 are to be executed four times per
|
||||||
|
* frame. That means once for each sub-segment RPE-LTP analysis of
|
||||||
|
* 40 samples. These parts produce at the output of the coder:
|
||||||
|
*/
|
||||||
|
|
||||||
|
word * Nc, /* [0..3] LTP lag OUT */
|
||||||
|
word * bc, /* [0..3] coded LTP gain OUT */
|
||||||
|
word * Mc, /* [0..3] RPE grid selection OUT */
|
||||||
|
word * xmaxc,/* [0..3] Coded maximum amplitude OUT */
|
||||||
|
word * xMc /* [13*4] normalized RPE samples OUT */
|
||||||
|
)
|
||||||
|
{
|
||||||
|
int k;
|
||||||
|
word * dp = S->dp0 + 120; /* [ -120...-1 ] */
|
||||||
|
word * dpp = dp; /* [ 0...39 ] */
|
||||||
|
|
||||||
|
word so[160];
|
||||||
|
|
||||||
|
Gsm_Preprocess (S, s, so);
|
||||||
|
Gsm_LPC_Analysis (S, so, LARc);
|
||||||
|
Gsm_Short_Term_Analysis_Filter (S, LARc, so);
|
||||||
|
|
||||||
|
for (k = 0; k <= 3; k++, xMc += 13) {
|
||||||
|
|
||||||
|
Gsm_Long_Term_Predictor ( S,
|
||||||
|
so+k*40, /* d [0..39] IN */
|
||||||
|
dp, /* dp [-120..-1] IN */
|
||||||
|
S->e + 5, /* e [0..39] OUT */
|
||||||
|
dpp, /* dpp [0..39] OUT */
|
||||||
|
Nc++,
|
||||||
|
bc++);
|
||||||
|
|
||||||
|
Gsm_RPE_Encoding ( S,
|
||||||
|
S->e + 5,/* e ][0..39][ IN/OUT */
|
||||||
|
xmaxc++, Mc++, xMc );
|
||||||
|
/*
|
||||||
|
* Gsm_Update_of_reconstructed_short_time_residual_signal
|
||||||
|
* ( dpp, S->e + 5, dp );
|
||||||
|
*/
|
||||||
|
|
||||||
|
{ register int i;
|
||||||
|
register longword ltmp;
|
||||||
|
for (i = 0; i <= 39; i++)
|
||||||
|
dp[ i ] = GSM_ADD( S->e[5 + i], dpp[i] );
|
||||||
|
}
|
||||||
|
dp += 40;
|
||||||
|
dpp += 40;
|
||||||
|
|
||||||
|
}
|
||||||
|
(void)memcpy( (char *)S->dp0, (char *)(S->dp0 + 160),
|
||||||
|
120 * sizeof(*S->dp0) );
|
||||||
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
|
||||||
|
* Universitaet Berlin. See the accompanying file "COPYRIGHT" for
|
||||||
|
* details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* $Header: /tmp_amd/presto/export/kbs/jutta/src/gsm/RCS/decode.c,v 1.1 1992/10/28 00:15:50 jutta Exp $ */
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "private.h"
|
||||||
|
#include "gsm.h"
|
||||||
|
#include "proto.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 4.3 FIXED POINT IMPLEMENTATION OF THE RPE-LTP DECODER
|
||||||
|
*/
|
||||||
|
|
||||||
|
static void Postprocessing P2((S,s),
|
||||||
|
struct gsm_state * S,
|
||||||
|
register word * s)
|
||||||
|
{
|
||||||
|
register int k;
|
||||||
|
register word msr = S->msr;
|
||||||
|
register longword ltmp; /* for GSM_ADD */
|
||||||
|
register word tmp;
|
||||||
|
|
||||||
|
for (k = 160; k--; s++) {
|
||||||
|
tmp = GSM_MULT_R( msr, 28180 );
|
||||||
|
msr = GSM_ADD(*s, tmp); /* Deemphasis */
|
||||||
|
*s = GSM_ADD(msr, msr) & 0xFFF8; /* Truncation & Upscaling */
|
||||||
|
}
|
||||||
|
S->msr = msr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Gsm_Decoder P8((S,LARcr, Ncr,bcr,Mcr,xmaxcr,xMcr,s),
|
||||||
|
struct gsm_state * S,
|
||||||
|
|
||||||
|
word * LARcr, /* [0..7] IN */
|
||||||
|
|
||||||
|
word * Ncr, /* [0..3] IN */
|
||||||
|
word * bcr, /* [0..3] IN */
|
||||||
|
word * Mcr, /* [0..3] IN */
|
||||||
|
word * xmaxcr, /* [0..3] IN */
|
||||||
|
word * xMcr, /* [0..13*4] IN */
|
||||||
|
|
||||||
|
word * s) /* [0..159] OUT */
|
||||||
|
{
|
||||||
|
int j, k;
|
||||||
|
word erp[40], wt[160];
|
||||||
|
word * drp = S->dp0 + 120;
|
||||||
|
|
||||||
|
for (j=0; j <= 3; j++, xmaxcr++, bcr++, Ncr++, Mcr++, xMcr += 13) {
|
||||||
|
|
||||||
|
Gsm_RPE_Decoding( S, *xmaxcr, *Mcr, xMcr, erp );
|
||||||
|
Gsm_Long_Term_Synthesis_Filtering( S, *Ncr, *bcr, erp, drp );
|
||||||
|
|
||||||
|
for (k = 0; k <= 39; k++) wt[ j * 40 + k ] = drp[ k ];
|
||||||
|
}
|
||||||
|
|
||||||
|
Gsm_Short_Term_Synthesis_Filter( S, LARcr, wt, s );
|
||||||
|
Postprocessing(S, s);
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
|
||||||
|
* Universitaet Berlin. See the accompanying file "COPYRIGHT" for
|
||||||
|
* details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
static char const ident[] = "$Header: /tmp_amd/presto/export/kbs/jutta/src/gsm/RCS/gsm_create.c,v 1.4 1996/07/02 09:59:05 jutta Exp $";
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#ifdef HAS_STRING_H
|
||||||
|
#include <string.h>
|
||||||
|
#else
|
||||||
|
# include "proto.h"
|
||||||
|
extern char * memset P((char *, int, int));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAS_STDLIB_H
|
||||||
|
# include <stdlib.h>
|
||||||
|
#else
|
||||||
|
# ifdef HAS_MALLOC_H
|
||||||
|
# include <malloc.h>
|
||||||
|
# else
|
||||||
|
extern char * malloc();
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "gsm.h"
|
||||||
|
#include "private.h"
|
||||||
|
#include "proto.h"
|
||||||
|
|
||||||
|
gsm gsm_create P0()
|
||||||
|
{
|
||||||
|
gsm r;
|
||||||
|
|
||||||
|
r = (gsm)malloc(sizeof(struct gsm_state));
|
||||||
|
if (!r) return r;
|
||||||
|
|
||||||
|
memset((char *)r, 0, sizeof(*r));
|
||||||
|
r->nrp = 40;
|
||||||
|
|
||||||
|
return r;
|
||||||
|
}
|
||||||
@@ -0,0 +1,361 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
|
||||||
|
* Universitaet Berlin. See the accompanying file "COPYRIGHT" for
|
||||||
|
* details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* $Header: /tmp_amd/presto/export/kbs/jutta/src/gsm/RCS/gsm_decode.c,v 1.2 1996/07/02 09:59:05 jutta Exp $ */
|
||||||
|
|
||||||
|
#include "private.h"
|
||||||
|
|
||||||
|
#include "gsm.h"
|
||||||
|
#include "proto.h"
|
||||||
|
|
||||||
|
int gsm_decode P3((s, c, target), gsm s, gsm_byte * c, gsm_signal * target)
|
||||||
|
{
|
||||||
|
word LARc[8], Nc[4], Mc[4], bc[4], xmaxc[4], xmc[13*4];
|
||||||
|
|
||||||
|
#ifdef WAV49
|
||||||
|
if (s->wav_fmt) {
|
||||||
|
|
||||||
|
uword sr = 0;
|
||||||
|
|
||||||
|
s->frame_index = !s->frame_index;
|
||||||
|
if (s->frame_index) {
|
||||||
|
|
||||||
|
sr = *c++;
|
||||||
|
LARc[0] = sr & 0x3f; sr >>= 6;
|
||||||
|
sr |= (uword)*c++ << 2;
|
||||||
|
LARc[1] = sr & 0x3f; sr >>= 6;
|
||||||
|
sr |= (uword)*c++ << 4;
|
||||||
|
LARc[2] = sr & 0x1f; sr >>= 5;
|
||||||
|
LARc[3] = sr & 0x1f; sr >>= 5;
|
||||||
|
sr |= (uword)*c++ << 2;
|
||||||
|
LARc[4] = sr & 0xf; sr >>= 4;
|
||||||
|
LARc[5] = sr & 0xf; sr >>= 4;
|
||||||
|
sr |= (uword)*c++ << 2; /* 5 */
|
||||||
|
LARc[6] = sr & 0x7; sr >>= 3;
|
||||||
|
LARc[7] = sr & 0x7; sr >>= 3;
|
||||||
|
sr |= (uword)*c++ << 4;
|
||||||
|
Nc[0] = sr & 0x7f; sr >>= 7;
|
||||||
|
bc[0] = sr & 0x3; sr >>= 2;
|
||||||
|
Mc[0] = sr & 0x3; sr >>= 2;
|
||||||
|
sr |= (uword)*c++ << 1;
|
||||||
|
xmaxc[0] = sr & 0x3f; sr >>= 6;
|
||||||
|
xmc[0] = sr & 0x7; sr >>= 3;
|
||||||
|
sr = *c++;
|
||||||
|
xmc[1] = sr & 0x7; sr >>= 3;
|
||||||
|
xmc[2] = sr & 0x7; sr >>= 3;
|
||||||
|
sr |= (uword)*c++ << 2;
|
||||||
|
xmc[3] = sr & 0x7; sr >>= 3;
|
||||||
|
xmc[4] = sr & 0x7; sr >>= 3;
|
||||||
|
xmc[5] = sr & 0x7; sr >>= 3;
|
||||||
|
sr |= (uword)*c++ << 1; /* 10 */
|
||||||
|
xmc[6] = sr & 0x7; sr >>= 3;
|
||||||
|
xmc[7] = sr & 0x7; sr >>= 3;
|
||||||
|
xmc[8] = sr & 0x7; sr >>= 3;
|
||||||
|
sr = *c++;
|
||||||
|
xmc[9] = sr & 0x7; sr >>= 3;
|
||||||
|
xmc[10] = sr & 0x7; sr >>= 3;
|
||||||
|
sr |= (uword)*c++ << 2;
|
||||||
|
xmc[11] = sr & 0x7; sr >>= 3;
|
||||||
|
xmc[12] = sr & 0x7; sr >>= 3;
|
||||||
|
sr |= (uword)*c++ << 4;
|
||||||
|
Nc[1] = sr & 0x7f; sr >>= 7;
|
||||||
|
bc[1] = sr & 0x3; sr >>= 2;
|
||||||
|
Mc[1] = sr & 0x3; sr >>= 2;
|
||||||
|
sr |= (uword)*c++ << 1;
|
||||||
|
xmaxc[1] = sr & 0x3f; sr >>= 6;
|
||||||
|
xmc[13] = sr & 0x7; sr >>= 3;
|
||||||
|
sr = *c++; /* 15 */
|
||||||
|
xmc[14] = sr & 0x7; sr >>= 3;
|
||||||
|
xmc[15] = sr & 0x7; sr >>= 3;
|
||||||
|
sr |= (uword)*c++ << 2;
|
||||||
|
xmc[16] = sr & 0x7; sr >>= 3;
|
||||||
|
xmc[17] = sr & 0x7; sr >>= 3;
|
||||||
|
xmc[18] = sr & 0x7; sr >>= 3;
|
||||||
|
sr |= (uword)*c++ << 1;
|
||||||
|
xmc[19] = sr & 0x7; sr >>= 3;
|
||||||
|
xmc[20] = sr & 0x7; sr >>= 3;
|
||||||
|
xmc[21] = sr & 0x7; sr >>= 3;
|
||||||
|
sr = *c++;
|
||||||
|
xmc[22] = sr & 0x7; sr >>= 3;
|
||||||
|
xmc[23] = sr & 0x7; sr >>= 3;
|
||||||
|
sr |= (uword)*c++ << 2;
|
||||||
|
xmc[24] = sr & 0x7; sr >>= 3;
|
||||||
|
xmc[25] = sr & 0x7; sr >>= 3;
|
||||||
|
sr |= (uword)*c++ << 4; /* 20 */
|
||||||
|
Nc[2] = sr & 0x7f; sr >>= 7;
|
||||||
|
bc[2] = sr & 0x3; sr >>= 2;
|
||||||
|
Mc[2] = sr & 0x3; sr >>= 2;
|
||||||
|
sr |= (uword)*c++ << 1;
|
||||||
|
xmaxc[2] = sr & 0x3f; sr >>= 6;
|
||||||
|
xmc[26] = sr & 0x7; sr >>= 3;
|
||||||
|
sr = *c++;
|
||||||
|
xmc[27] = sr & 0x7; sr >>= 3;
|
||||||
|
xmc[28] = sr & 0x7; sr >>= 3;
|
||||||
|
sr |= (uword)*c++ << 2;
|
||||||
|
xmc[29] = sr & 0x7; sr >>= 3;
|
||||||
|
xmc[30] = sr & 0x7; sr >>= 3;
|
||||||
|
xmc[31] = sr & 0x7; sr >>= 3;
|
||||||
|
sr |= (uword)*c++ << 1;
|
||||||
|
xmc[32] = sr & 0x7; sr >>= 3;
|
||||||
|
xmc[33] = sr & 0x7; sr >>= 3;
|
||||||
|
xmc[34] = sr & 0x7; sr >>= 3;
|
||||||
|
sr = *c++; /* 25 */
|
||||||
|
xmc[35] = sr & 0x7; sr >>= 3;
|
||||||
|
xmc[36] = sr & 0x7; sr >>= 3;
|
||||||
|
sr |= (uword)*c++ << 2;
|
||||||
|
xmc[37] = sr & 0x7; sr >>= 3;
|
||||||
|
xmc[38] = sr & 0x7; sr >>= 3;
|
||||||
|
sr |= (uword)*c++ << 4;
|
||||||
|
Nc[3] = sr & 0x7f; sr >>= 7;
|
||||||
|
bc[3] = sr & 0x3; sr >>= 2;
|
||||||
|
Mc[3] = sr & 0x3; sr >>= 2;
|
||||||
|
sr |= (uword)*c++ << 1;
|
||||||
|
xmaxc[3] = sr & 0x3f; sr >>= 6;
|
||||||
|
xmc[39] = sr & 0x7; sr >>= 3;
|
||||||
|
sr = *c++;
|
||||||
|
xmc[40] = sr & 0x7; sr >>= 3;
|
||||||
|
xmc[41] = sr & 0x7; sr >>= 3;
|
||||||
|
sr |= (uword)*c++ << 2; /* 30 */
|
||||||
|
xmc[42] = sr & 0x7; sr >>= 3;
|
||||||
|
xmc[43] = sr & 0x7; sr >>= 3;
|
||||||
|
xmc[44] = sr & 0x7; sr >>= 3;
|
||||||
|
sr |= (uword)*c++ << 1;
|
||||||
|
xmc[45] = sr & 0x7; sr >>= 3;
|
||||||
|
xmc[46] = sr & 0x7; sr >>= 3;
|
||||||
|
xmc[47] = sr & 0x7; sr >>= 3;
|
||||||
|
sr = *c++;
|
||||||
|
xmc[48] = sr & 0x7; sr >>= 3;
|
||||||
|
xmc[49] = sr & 0x7; sr >>= 3;
|
||||||
|
sr |= (uword)*c++ << 2;
|
||||||
|
xmc[50] = sr & 0x7; sr >>= 3;
|
||||||
|
xmc[51] = sr & 0x7; sr >>= 3;
|
||||||
|
|
||||||
|
s->frame_chain = sr & 0xf;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
sr = s->frame_chain;
|
||||||
|
sr |= (uword)*c++ << 4; /* 1 */
|
||||||
|
LARc[0] = sr & 0x3f; sr >>= 6;
|
||||||
|
LARc[1] = sr & 0x3f; sr >>= 6;
|
||||||
|
sr = *c++;
|
||||||
|
LARc[2] = sr & 0x1f; sr >>= 5;
|
||||||
|
sr |= (uword)*c++ << 3;
|
||||||
|
LARc[3] = sr & 0x1f; sr >>= 5;
|
||||||
|
LARc[4] = sr & 0xf; sr >>= 4;
|
||||||
|
sr |= (uword)*c++ << 2;
|
||||||
|
LARc[5] = sr & 0xf; sr >>= 4;
|
||||||
|
LARc[6] = sr & 0x7; sr >>= 3;
|
||||||
|
LARc[7] = sr & 0x7; sr >>= 3;
|
||||||
|
sr = *c++; /* 5 */
|
||||||
|
Nc[0] = sr & 0x7f; sr >>= 7;
|
||||||
|
sr |= (uword)*c++ << 1;
|
||||||
|
bc[0] = sr & 0x3; sr >>= 2;
|
||||||
|
Mc[0] = sr & 0x3; sr >>= 2;
|
||||||
|
sr |= (uword)*c++ << 5;
|
||||||
|
xmaxc[0] = sr & 0x3f; sr >>= 6;
|
||||||
|
xmc[0] = sr & 0x7; sr >>= 3;
|
||||||
|
xmc[1] = sr & 0x7; sr >>= 3;
|
||||||
|
sr |= (uword)*c++ << 1;
|
||||||
|
xmc[2] = sr & 0x7; sr >>= 3;
|
||||||
|
xmc[3] = sr & 0x7; sr >>= 3;
|
||||||
|
xmc[4] = sr & 0x7; sr >>= 3;
|
||||||
|
sr = *c++;
|
||||||
|
xmc[5] = sr & 0x7; sr >>= 3;
|
||||||
|
xmc[6] = sr & 0x7; sr >>= 3;
|
||||||
|
sr |= (uword)*c++ << 2; /* 10 */
|
||||||
|
xmc[7] = sr & 0x7; sr >>= 3;
|
||||||
|
xmc[8] = sr & 0x7; sr >>= 3;
|
||||||
|
xmc[9] = sr & 0x7; sr >>= 3;
|
||||||
|
sr |= (uword)*c++ << 1;
|
||||||
|
xmc[10] = sr & 0x7; sr >>= 3;
|
||||||
|
xmc[11] = sr & 0x7; sr >>= 3;
|
||||||
|
xmc[12] = sr & 0x7; sr >>= 3;
|
||||||
|
sr = *c++;
|
||||||
|
Nc[1] = sr & 0x7f; sr >>= 7;
|
||||||
|
sr |= (uword)*c++ << 1;
|
||||||
|
bc[1] = sr & 0x3; sr >>= 2;
|
||||||
|
Mc[1] = sr & 0x3; sr >>= 2;
|
||||||
|
sr |= (uword)*c++ << 5;
|
||||||
|
xmaxc[1] = sr & 0x3f; sr >>= 6;
|
||||||
|
xmc[13] = sr & 0x7; sr >>= 3;
|
||||||
|
xmc[14] = sr & 0x7; sr >>= 3;
|
||||||
|
sr |= (uword)*c++ << 1; /* 15 */
|
||||||
|
xmc[15] = sr & 0x7; sr >>= 3;
|
||||||
|
xmc[16] = sr & 0x7; sr >>= 3;
|
||||||
|
xmc[17] = sr & 0x7; sr >>= 3;
|
||||||
|
sr = *c++;
|
||||||
|
xmc[18] = sr & 0x7; sr >>= 3;
|
||||||
|
xmc[19] = sr & 0x7; sr >>= 3;
|
||||||
|
sr |= (uword)*c++ << 2;
|
||||||
|
xmc[20] = sr & 0x7; sr >>= 3;
|
||||||
|
xmc[21] = sr & 0x7; sr >>= 3;
|
||||||
|
xmc[22] = sr & 0x7; sr >>= 3;
|
||||||
|
sr |= (uword)*c++ << 1;
|
||||||
|
xmc[23] = sr & 0x7; sr >>= 3;
|
||||||
|
xmc[24] = sr & 0x7; sr >>= 3;
|
||||||
|
xmc[25] = sr & 0x7; sr >>= 3;
|
||||||
|
sr = *c++;
|
||||||
|
Nc[2] = sr & 0x7f; sr >>= 7;
|
||||||
|
sr |= (uword)*c++ << 1; /* 20 */
|
||||||
|
bc[2] = sr & 0x3; sr >>= 2;
|
||||||
|
Mc[2] = sr & 0x3; sr >>= 2;
|
||||||
|
sr |= (uword)*c++ << 5;
|
||||||
|
xmaxc[2] = sr & 0x3f; sr >>= 6;
|
||||||
|
xmc[26] = sr & 0x7; sr >>= 3;
|
||||||
|
xmc[27] = sr & 0x7; sr >>= 3;
|
||||||
|
sr |= (uword)*c++ << 1;
|
||||||
|
xmc[28] = sr & 0x7; sr >>= 3;
|
||||||
|
xmc[29] = sr & 0x7; sr >>= 3;
|
||||||
|
xmc[30] = sr & 0x7; sr >>= 3;
|
||||||
|
sr = *c++;
|
||||||
|
xmc[31] = sr & 0x7; sr >>= 3;
|
||||||
|
xmc[32] = sr & 0x7; sr >>= 3;
|
||||||
|
sr |= (uword)*c++ << 2;
|
||||||
|
xmc[33] = sr & 0x7; sr >>= 3;
|
||||||
|
xmc[34] = sr & 0x7; sr >>= 3;
|
||||||
|
xmc[35] = sr & 0x7; sr >>= 3;
|
||||||
|
sr |= (uword)*c++ << 1; /* 25 */
|
||||||
|
xmc[36] = sr & 0x7; sr >>= 3;
|
||||||
|
xmc[37] = sr & 0x7; sr >>= 3;
|
||||||
|
xmc[38] = sr & 0x7; sr >>= 3;
|
||||||
|
sr = *c++;
|
||||||
|
Nc[3] = sr & 0x7f; sr >>= 7;
|
||||||
|
sr |= (uword)*c++ << 1;
|
||||||
|
bc[3] = sr & 0x3; sr >>= 2;
|
||||||
|
Mc[3] = sr & 0x3; sr >>= 2;
|
||||||
|
sr |= (uword)*c++ << 5;
|
||||||
|
xmaxc[3] = sr & 0x3f; sr >>= 6;
|
||||||
|
xmc[39] = sr & 0x7; sr >>= 3;
|
||||||
|
xmc[40] = sr & 0x7; sr >>= 3;
|
||||||
|
sr |= (uword)*c++ << 1;
|
||||||
|
xmc[41] = sr & 0x7; sr >>= 3;
|
||||||
|
xmc[42] = sr & 0x7; sr >>= 3;
|
||||||
|
xmc[43] = sr & 0x7; sr >>= 3;
|
||||||
|
sr = *c++; /* 30 */
|
||||||
|
xmc[44] = sr & 0x7; sr >>= 3;
|
||||||
|
xmc[45] = sr & 0x7; sr >>= 3;
|
||||||
|
sr |= (uword)*c++ << 2;
|
||||||
|
xmc[46] = sr & 0x7; sr >>= 3;
|
||||||
|
xmc[47] = sr & 0x7; sr >>= 3;
|
||||||
|
xmc[48] = sr & 0x7; sr >>= 3;
|
||||||
|
sr |= (uword)*c++ << 1;
|
||||||
|
xmc[49] = sr & 0x7; sr >>= 3;
|
||||||
|
xmc[50] = sr & 0x7; sr >>= 3;
|
||||||
|
xmc[51] = sr & 0x7; sr >>= 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
/* GSM_MAGIC = (*c >> 4) & 0xF; */
|
||||||
|
|
||||||
|
if (((*c >> 4) & 0x0F) != GSM_MAGIC) return -1;
|
||||||
|
|
||||||
|
LARc[0] = (*c++ & 0xF) << 2; /* 1 */
|
||||||
|
LARc[0] |= (*c >> 6) & 0x3;
|
||||||
|
LARc[1] = *c++ & 0x3F;
|
||||||
|
LARc[2] = (*c >> 3) & 0x1F;
|
||||||
|
LARc[3] = (*c++ & 0x7) << 2;
|
||||||
|
LARc[3] |= (*c >> 6) & 0x3;
|
||||||
|
LARc[4] = (*c >> 2) & 0xF;
|
||||||
|
LARc[5] = (*c++ & 0x3) << 2;
|
||||||
|
LARc[5] |= (*c >> 6) & 0x3;
|
||||||
|
LARc[6] = (*c >> 3) & 0x7;
|
||||||
|
LARc[7] = *c++ & 0x7;
|
||||||
|
Nc[0] = (*c >> 1) & 0x7F;
|
||||||
|
bc[0] = (*c++ & 0x1) << 1;
|
||||||
|
bc[0] |= (*c >> 7) & 0x1;
|
||||||
|
Mc[0] = (*c >> 5) & 0x3;
|
||||||
|
xmaxc[0] = (*c++ & 0x1F) << 1;
|
||||||
|
xmaxc[0] |= (*c >> 7) & 0x1;
|
||||||
|
xmc[0] = (*c >> 4) & 0x7;
|
||||||
|
xmc[1] = (*c >> 1) & 0x7;
|
||||||
|
xmc[2] = (*c++ & 0x1) << 2;
|
||||||
|
xmc[2] |= (*c >> 6) & 0x3;
|
||||||
|
xmc[3] = (*c >> 3) & 0x7;
|
||||||
|
xmc[4] = *c++ & 0x7;
|
||||||
|
xmc[5] = (*c >> 5) & 0x7;
|
||||||
|
xmc[6] = (*c >> 2) & 0x7;
|
||||||
|
xmc[7] = (*c++ & 0x3) << 1; /* 10 */
|
||||||
|
xmc[7] |= (*c >> 7) & 0x1;
|
||||||
|
xmc[8] = (*c >> 4) & 0x7;
|
||||||
|
xmc[9] = (*c >> 1) & 0x7;
|
||||||
|
xmc[10] = (*c++ & 0x1) << 2;
|
||||||
|
xmc[10] |= (*c >> 6) & 0x3;
|
||||||
|
xmc[11] = (*c >> 3) & 0x7;
|
||||||
|
xmc[12] = *c++ & 0x7;
|
||||||
|
Nc[1] = (*c >> 1) & 0x7F;
|
||||||
|
bc[1] = (*c++ & 0x1) << 1;
|
||||||
|
bc[1] |= (*c >> 7) & 0x1;
|
||||||
|
Mc[1] = (*c >> 5) & 0x3;
|
||||||
|
xmaxc[1] = (*c++ & 0x1F) << 1;
|
||||||
|
xmaxc[1] |= (*c >> 7) & 0x1;
|
||||||
|
xmc[13] = (*c >> 4) & 0x7;
|
||||||
|
xmc[14] = (*c >> 1) & 0x7;
|
||||||
|
xmc[15] = (*c++ & 0x1) << 2;
|
||||||
|
xmc[15] |= (*c >> 6) & 0x3;
|
||||||
|
xmc[16] = (*c >> 3) & 0x7;
|
||||||
|
xmc[17] = *c++ & 0x7;
|
||||||
|
xmc[18] = (*c >> 5) & 0x7;
|
||||||
|
xmc[19] = (*c >> 2) & 0x7;
|
||||||
|
xmc[20] = (*c++ & 0x3) << 1;
|
||||||
|
xmc[20] |= (*c >> 7) & 0x1;
|
||||||
|
xmc[21] = (*c >> 4) & 0x7;
|
||||||
|
xmc[22] = (*c >> 1) & 0x7;
|
||||||
|
xmc[23] = (*c++ & 0x1) << 2;
|
||||||
|
xmc[23] |= (*c >> 6) & 0x3;
|
||||||
|
xmc[24] = (*c >> 3) & 0x7;
|
||||||
|
xmc[25] = *c++ & 0x7;
|
||||||
|
Nc[2] = (*c >> 1) & 0x7F;
|
||||||
|
bc[2] = (*c++ & 0x1) << 1; /* 20 */
|
||||||
|
bc[2] |= (*c >> 7) & 0x1;
|
||||||
|
Mc[2] = (*c >> 5) & 0x3;
|
||||||
|
xmaxc[2] = (*c++ & 0x1F) << 1;
|
||||||
|
xmaxc[2] |= (*c >> 7) & 0x1;
|
||||||
|
xmc[26] = (*c >> 4) & 0x7;
|
||||||
|
xmc[27] = (*c >> 1) & 0x7;
|
||||||
|
xmc[28] = (*c++ & 0x1) << 2;
|
||||||
|
xmc[28] |= (*c >> 6) & 0x3;
|
||||||
|
xmc[29] = (*c >> 3) & 0x7;
|
||||||
|
xmc[30] = *c++ & 0x7;
|
||||||
|
xmc[31] = (*c >> 5) & 0x7;
|
||||||
|
xmc[32] = (*c >> 2) & 0x7;
|
||||||
|
xmc[33] = (*c++ & 0x3) << 1;
|
||||||
|
xmc[33] |= (*c >> 7) & 0x1;
|
||||||
|
xmc[34] = (*c >> 4) & 0x7;
|
||||||
|
xmc[35] = (*c >> 1) & 0x7;
|
||||||
|
xmc[36] = (*c++ & 0x1) << 2;
|
||||||
|
xmc[36] |= (*c >> 6) & 0x3;
|
||||||
|
xmc[37] = (*c >> 3) & 0x7;
|
||||||
|
xmc[38] = *c++ & 0x7;
|
||||||
|
Nc[3] = (*c >> 1) & 0x7F;
|
||||||
|
bc[3] = (*c++ & 0x1) << 1;
|
||||||
|
bc[3] |= (*c >> 7) & 0x1;
|
||||||
|
Mc[3] = (*c >> 5) & 0x3;
|
||||||
|
xmaxc[3] = (*c++ & 0x1F) << 1;
|
||||||
|
xmaxc[3] |= (*c >> 7) & 0x1;
|
||||||
|
xmc[39] = (*c >> 4) & 0x7;
|
||||||
|
xmc[40] = (*c >> 1) & 0x7;
|
||||||
|
xmc[41] = (*c++ & 0x1) << 2;
|
||||||
|
xmc[41] |= (*c >> 6) & 0x3;
|
||||||
|
xmc[42] = (*c >> 3) & 0x7;
|
||||||
|
xmc[43] = *c++ & 0x7; /* 30 */
|
||||||
|
xmc[44] = (*c >> 5) & 0x7;
|
||||||
|
xmc[45] = (*c >> 2) & 0x7;
|
||||||
|
xmc[46] = (*c++ & 0x3) << 1;
|
||||||
|
xmc[46] |= (*c >> 7) & 0x1;
|
||||||
|
xmc[47] = (*c >> 4) & 0x7;
|
||||||
|
xmc[48] = (*c >> 1) & 0x7;
|
||||||
|
xmc[49] = (*c++ & 0x1) << 2;
|
||||||
|
xmc[49] |= (*c >> 6) & 0x3;
|
||||||
|
xmc[50] = (*c >> 3) & 0x7;
|
||||||
|
xmc[51] = *c & 0x7; /* 33 */
|
||||||
|
}
|
||||||
|
|
||||||
|
Gsm_Decoder(s, LARc, Nc, bc, Mc, xmaxc, xmc, target);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
|
||||||
|
* Universitaet Berlin. See the accompanying file "COPYRIGHT" for
|
||||||
|
* details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* $Header: /tmp_amd/presto/export/kbs/jutta/src/gsm/RCS/gsm_destroy.c,v 1.3 1994/11/28 19:52:25 jutta Exp $ */
|
||||||
|
|
||||||
|
#include "gsm.h"
|
||||||
|
#include "config.h"
|
||||||
|
#include "proto.h"
|
||||||
|
|
||||||
|
#ifdef HAS_STDLIB_H
|
||||||
|
# include <stdlib.h>
|
||||||
|
#else
|
||||||
|
# ifdef HAS_MALLOC_H
|
||||||
|
# include <malloc.h>
|
||||||
|
# else
|
||||||
|
extern void free();
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void gsm_destroy P1((S), gsm S)
|
||||||
|
{
|
||||||
|
if (S) free((char *)S);
|
||||||
|
}
|
||||||
@@ -0,0 +1,451 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
|
||||||
|
* Universitaet Berlin. See the accompanying file "COPYRIGHT" for
|
||||||
|
* details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* $Header: /tmp_amd/presto/export/kbs/jutta/src/gsm/RCS/gsm_encode.c,v 1.2 1996/07/02 09:59:05 jutta Exp $ */
|
||||||
|
|
||||||
|
#include "private.h"
|
||||||
|
#include "gsm.h"
|
||||||
|
#include "proto.h"
|
||||||
|
|
||||||
|
void gsm_encode P3((s, source, c), gsm s, gsm_signal * source, gsm_byte * c)
|
||||||
|
{
|
||||||
|
word LARc[8], Nc[4], Mc[4], bc[4], xmaxc[4], xmc[13*4];
|
||||||
|
|
||||||
|
Gsm_Coder(s, source, LARc, Nc, bc, Mc, xmaxc, xmc);
|
||||||
|
|
||||||
|
|
||||||
|
/* variable size
|
||||||
|
|
||||||
|
GSM_MAGIC 4
|
||||||
|
|
||||||
|
LARc[0] 6
|
||||||
|
LARc[1] 6
|
||||||
|
LARc[2] 5
|
||||||
|
LARc[3] 5
|
||||||
|
LARc[4] 4
|
||||||
|
LARc[5] 4
|
||||||
|
LARc[6] 3
|
||||||
|
LARc[7] 3
|
||||||
|
|
||||||
|
Nc[0] 7
|
||||||
|
bc[0] 2
|
||||||
|
Mc[0] 2
|
||||||
|
xmaxc[0] 6
|
||||||
|
xmc[0] 3
|
||||||
|
xmc[1] 3
|
||||||
|
xmc[2] 3
|
||||||
|
xmc[3] 3
|
||||||
|
xmc[4] 3
|
||||||
|
xmc[5] 3
|
||||||
|
xmc[6] 3
|
||||||
|
xmc[7] 3
|
||||||
|
xmc[8] 3
|
||||||
|
xmc[9] 3
|
||||||
|
xmc[10] 3
|
||||||
|
xmc[11] 3
|
||||||
|
xmc[12] 3
|
||||||
|
|
||||||
|
Nc[1] 7
|
||||||
|
bc[1] 2
|
||||||
|
Mc[1] 2
|
||||||
|
xmaxc[1] 6
|
||||||
|
xmc[13] 3
|
||||||
|
xmc[14] 3
|
||||||
|
xmc[15] 3
|
||||||
|
xmc[16] 3
|
||||||
|
xmc[17] 3
|
||||||
|
xmc[18] 3
|
||||||
|
xmc[19] 3
|
||||||
|
xmc[20] 3
|
||||||
|
xmc[21] 3
|
||||||
|
xmc[22] 3
|
||||||
|
xmc[23] 3
|
||||||
|
xmc[24] 3
|
||||||
|
xmc[25] 3
|
||||||
|
|
||||||
|
Nc[2] 7
|
||||||
|
bc[2] 2
|
||||||
|
Mc[2] 2
|
||||||
|
xmaxc[2] 6
|
||||||
|
xmc[26] 3
|
||||||
|
xmc[27] 3
|
||||||
|
xmc[28] 3
|
||||||
|
xmc[29] 3
|
||||||
|
xmc[30] 3
|
||||||
|
xmc[31] 3
|
||||||
|
xmc[32] 3
|
||||||
|
xmc[33] 3
|
||||||
|
xmc[34] 3
|
||||||
|
xmc[35] 3
|
||||||
|
xmc[36] 3
|
||||||
|
xmc[37] 3
|
||||||
|
xmc[38] 3
|
||||||
|
|
||||||
|
Nc[3] 7
|
||||||
|
bc[3] 2
|
||||||
|
Mc[3] 2
|
||||||
|
xmaxc[3] 6
|
||||||
|
xmc[39] 3
|
||||||
|
xmc[40] 3
|
||||||
|
xmc[41] 3
|
||||||
|
xmc[42] 3
|
||||||
|
xmc[43] 3
|
||||||
|
xmc[44] 3
|
||||||
|
xmc[45] 3
|
||||||
|
xmc[46] 3
|
||||||
|
xmc[47] 3
|
||||||
|
xmc[48] 3
|
||||||
|
xmc[49] 3
|
||||||
|
xmc[50] 3
|
||||||
|
xmc[51] 3
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef WAV49
|
||||||
|
|
||||||
|
if (s->wav_fmt) {
|
||||||
|
s->frame_index = !s->frame_index;
|
||||||
|
if (s->frame_index) {
|
||||||
|
|
||||||
|
uword sr;
|
||||||
|
|
||||||
|
sr = 0;
|
||||||
|
sr = sr >> 6 | LARc[0] << 10;
|
||||||
|
sr = sr >> 6 | LARc[1] << 10;
|
||||||
|
*c++ = sr >> 4;
|
||||||
|
sr = sr >> 5 | LARc[2] << 11;
|
||||||
|
*c++ = sr >> 7;
|
||||||
|
sr = sr >> 5 | LARc[3] << 11;
|
||||||
|
sr = sr >> 4 | LARc[4] << 12;
|
||||||
|
*c++ = sr >> 6;
|
||||||
|
sr = sr >> 4 | LARc[5] << 12;
|
||||||
|
sr = sr >> 3 | LARc[6] << 13;
|
||||||
|
*c++ = sr >> 7;
|
||||||
|
sr = sr >> 3 | LARc[7] << 13;
|
||||||
|
sr = sr >> 7 | Nc[0] << 9;
|
||||||
|
*c++ = sr >> 5;
|
||||||
|
sr = sr >> 2 | bc[0] << 14;
|
||||||
|
sr = sr >> 2 | Mc[0] << 14;
|
||||||
|
sr = sr >> 6 | xmaxc[0] << 10;
|
||||||
|
*c++ = sr >> 3;
|
||||||
|
sr = sr >> 3 | xmc[0] << 13;
|
||||||
|
*c++ = sr >> 8;
|
||||||
|
sr = sr >> 3 | xmc[1] << 13;
|
||||||
|
sr = sr >> 3 | xmc[2] << 13;
|
||||||
|
sr = sr >> 3 | xmc[3] << 13;
|
||||||
|
*c++ = sr >> 7;
|
||||||
|
sr = sr >> 3 | xmc[4] << 13;
|
||||||
|
sr = sr >> 3 | xmc[5] << 13;
|
||||||
|
sr = sr >> 3 | xmc[6] << 13;
|
||||||
|
*c++ = sr >> 6;
|
||||||
|
sr = sr >> 3 | xmc[7] << 13;
|
||||||
|
sr = sr >> 3 | xmc[8] << 13;
|
||||||
|
*c++ = sr >> 8;
|
||||||
|
sr = sr >> 3 | xmc[9] << 13;
|
||||||
|
sr = sr >> 3 | xmc[10] << 13;
|
||||||
|
sr = sr >> 3 | xmc[11] << 13;
|
||||||
|
*c++ = sr >> 7;
|
||||||
|
sr = sr >> 3 | xmc[12] << 13;
|
||||||
|
sr = sr >> 7 | Nc[1] << 9;
|
||||||
|
*c++ = sr >> 5;
|
||||||
|
sr = sr >> 2 | bc[1] << 14;
|
||||||
|
sr = sr >> 2 | Mc[1] << 14;
|
||||||
|
sr = sr >> 6 | xmaxc[1] << 10;
|
||||||
|
*c++ = sr >> 3;
|
||||||
|
sr = sr >> 3 | xmc[13] << 13;
|
||||||
|
*c++ = sr >> 8;
|
||||||
|
sr = sr >> 3 | xmc[14] << 13;
|
||||||
|
sr = sr >> 3 | xmc[15] << 13;
|
||||||
|
sr = sr >> 3 | xmc[16] << 13;
|
||||||
|
*c++ = sr >> 7;
|
||||||
|
sr = sr >> 3 | xmc[17] << 13;
|
||||||
|
sr = sr >> 3 | xmc[18] << 13;
|
||||||
|
sr = sr >> 3 | xmc[19] << 13;
|
||||||
|
*c++ = sr >> 6;
|
||||||
|
sr = sr >> 3 | xmc[20] << 13;
|
||||||
|
sr = sr >> 3 | xmc[21] << 13;
|
||||||
|
*c++ = sr >> 8;
|
||||||
|
sr = sr >> 3 | xmc[22] << 13;
|
||||||
|
sr = sr >> 3 | xmc[23] << 13;
|
||||||
|
sr = sr >> 3 | xmc[24] << 13;
|
||||||
|
*c++ = sr >> 7;
|
||||||
|
sr = sr >> 3 | xmc[25] << 13;
|
||||||
|
sr = sr >> 7 | Nc[2] << 9;
|
||||||
|
*c++ = sr >> 5;
|
||||||
|
sr = sr >> 2 | bc[2] << 14;
|
||||||
|
sr = sr >> 2 | Mc[2] << 14;
|
||||||
|
sr = sr >> 6 | xmaxc[2] << 10;
|
||||||
|
*c++ = sr >> 3;
|
||||||
|
sr = sr >> 3 | xmc[26] << 13;
|
||||||
|
*c++ = sr >> 8;
|
||||||
|
sr = sr >> 3 | xmc[27] << 13;
|
||||||
|
sr = sr >> 3 | xmc[28] << 13;
|
||||||
|
sr = sr >> 3 | xmc[29] << 13;
|
||||||
|
*c++ = sr >> 7;
|
||||||
|
sr = sr >> 3 | xmc[30] << 13;
|
||||||
|
sr = sr >> 3 | xmc[31] << 13;
|
||||||
|
sr = sr >> 3 | xmc[32] << 13;
|
||||||
|
*c++ = sr >> 6;
|
||||||
|
sr = sr >> 3 | xmc[33] << 13;
|
||||||
|
sr = sr >> 3 | xmc[34] << 13;
|
||||||
|
*c++ = sr >> 8;
|
||||||
|
sr = sr >> 3 | xmc[35] << 13;
|
||||||
|
sr = sr >> 3 | xmc[36] << 13;
|
||||||
|
sr = sr >> 3 | xmc[37] << 13;
|
||||||
|
*c++ = sr >> 7;
|
||||||
|
sr = sr >> 3 | xmc[38] << 13;
|
||||||
|
sr = sr >> 7 | Nc[3] << 9;
|
||||||
|
*c++ = sr >> 5;
|
||||||
|
sr = sr >> 2 | bc[3] << 14;
|
||||||
|
sr = sr >> 2 | Mc[3] << 14;
|
||||||
|
sr = sr >> 6 | xmaxc[3] << 10;
|
||||||
|
*c++ = sr >> 3;
|
||||||
|
sr = sr >> 3 | xmc[39] << 13;
|
||||||
|
*c++ = sr >> 8;
|
||||||
|
sr = sr >> 3 | xmc[40] << 13;
|
||||||
|
sr = sr >> 3 | xmc[41] << 13;
|
||||||
|
sr = sr >> 3 | xmc[42] << 13;
|
||||||
|
*c++ = sr >> 7;
|
||||||
|
sr = sr >> 3 | xmc[43] << 13;
|
||||||
|
sr = sr >> 3 | xmc[44] << 13;
|
||||||
|
sr = sr >> 3 | xmc[45] << 13;
|
||||||
|
*c++ = sr >> 6;
|
||||||
|
sr = sr >> 3 | xmc[46] << 13;
|
||||||
|
sr = sr >> 3 | xmc[47] << 13;
|
||||||
|
*c++ = sr >> 8;
|
||||||
|
sr = sr >> 3 | xmc[48] << 13;
|
||||||
|
sr = sr >> 3 | xmc[49] << 13;
|
||||||
|
sr = sr >> 3 | xmc[50] << 13;
|
||||||
|
*c++ = sr >> 7;
|
||||||
|
sr = sr >> 3 | xmc[51] << 13;
|
||||||
|
sr = sr >> 4;
|
||||||
|
*c = sr >> 8;
|
||||||
|
s->frame_chain = *c;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
uword sr;
|
||||||
|
|
||||||
|
sr = 0;
|
||||||
|
sr = sr >> 4 | s->frame_chain << 12;
|
||||||
|
sr = sr >> 6 | LARc[0] << 10;
|
||||||
|
*c++ = sr >> 6;
|
||||||
|
sr = sr >> 6 | LARc[1] << 10;
|
||||||
|
*c++ = sr >> 8;
|
||||||
|
sr = sr >> 5 | LARc[2] << 11;
|
||||||
|
sr = sr >> 5 | LARc[3] << 11;
|
||||||
|
*c++ = sr >> 6;
|
||||||
|
sr = sr >> 4 | LARc[4] << 12;
|
||||||
|
sr = sr >> 4 | LARc[5] << 12;
|
||||||
|
*c++ = sr >> 6;
|
||||||
|
sr = sr >> 3 | LARc[6] << 13;
|
||||||
|
sr = sr >> 3 | LARc[7] << 13;
|
||||||
|
*c++ = sr >> 8;
|
||||||
|
sr = sr >> 7 | Nc[0] << 9;
|
||||||
|
sr = sr >> 2 | bc[0] << 14;
|
||||||
|
*c++ = sr >> 7;
|
||||||
|
sr = sr >> 2 | Mc[0] << 14;
|
||||||
|
sr = sr >> 6 | xmaxc[0] << 10;
|
||||||
|
*c++ = sr >> 7;
|
||||||
|
sr = sr >> 3 | xmc[0] << 13;
|
||||||
|
sr = sr >> 3 | xmc[1] << 13;
|
||||||
|
sr = sr >> 3 | xmc[2] << 13;
|
||||||
|
*c++ = sr >> 6;
|
||||||
|
sr = sr >> 3 | xmc[3] << 13;
|
||||||
|
sr = sr >> 3 | xmc[4] << 13;
|
||||||
|
*c++ = sr >> 8;
|
||||||
|
sr = sr >> 3 | xmc[5] << 13;
|
||||||
|
sr = sr >> 3 | xmc[6] << 13;
|
||||||
|
sr = sr >> 3 | xmc[7] << 13;
|
||||||
|
*c++ = sr >> 7;
|
||||||
|
sr = sr >> 3 | xmc[8] << 13;
|
||||||
|
sr = sr >> 3 | xmc[9] << 13;
|
||||||
|
sr = sr >> 3 | xmc[10] << 13;
|
||||||
|
*c++ = sr >> 6;
|
||||||
|
sr = sr >> 3 | xmc[11] << 13;
|
||||||
|
sr = sr >> 3 | xmc[12] << 13;
|
||||||
|
*c++ = sr >> 8;
|
||||||
|
sr = sr >> 7 | Nc[1] << 9;
|
||||||
|
sr = sr >> 2 | bc[1] << 14;
|
||||||
|
*c++ = sr >> 7;
|
||||||
|
sr = sr >> 2 | Mc[1] << 14;
|
||||||
|
sr = sr >> 6 | xmaxc[1] << 10;
|
||||||
|
*c++ = sr >> 7;
|
||||||
|
sr = sr >> 3 | xmc[13] << 13;
|
||||||
|
sr = sr >> 3 | xmc[14] << 13;
|
||||||
|
sr = sr >> 3 | xmc[15] << 13;
|
||||||
|
*c++ = sr >> 6;
|
||||||
|
sr = sr >> 3 | xmc[16] << 13;
|
||||||
|
sr = sr >> 3 | xmc[17] << 13;
|
||||||
|
*c++ = sr >> 8;
|
||||||
|
sr = sr >> 3 | xmc[18] << 13;
|
||||||
|
sr = sr >> 3 | xmc[19] << 13;
|
||||||
|
sr = sr >> 3 | xmc[20] << 13;
|
||||||
|
*c++ = sr >> 7;
|
||||||
|
sr = sr >> 3 | xmc[21] << 13;
|
||||||
|
sr = sr >> 3 | xmc[22] << 13;
|
||||||
|
sr = sr >> 3 | xmc[23] << 13;
|
||||||
|
*c++ = sr >> 6;
|
||||||
|
sr = sr >> 3 | xmc[24] << 13;
|
||||||
|
sr = sr >> 3 | xmc[25] << 13;
|
||||||
|
*c++ = sr >> 8;
|
||||||
|
sr = sr >> 7 | Nc[2] << 9;
|
||||||
|
sr = sr >> 2 | bc[2] << 14;
|
||||||
|
*c++ = sr >> 7;
|
||||||
|
sr = sr >> 2 | Mc[2] << 14;
|
||||||
|
sr = sr >> 6 | xmaxc[2] << 10;
|
||||||
|
*c++ = sr >> 7;
|
||||||
|
sr = sr >> 3 | xmc[26] << 13;
|
||||||
|
sr = sr >> 3 | xmc[27] << 13;
|
||||||
|
sr = sr >> 3 | xmc[28] << 13;
|
||||||
|
*c++ = sr >> 6;
|
||||||
|
sr = sr >> 3 | xmc[29] << 13;
|
||||||
|
sr = sr >> 3 | xmc[30] << 13;
|
||||||
|
*c++ = sr >> 8;
|
||||||
|
sr = sr >> 3 | xmc[31] << 13;
|
||||||
|
sr = sr >> 3 | xmc[32] << 13;
|
||||||
|
sr = sr >> 3 | xmc[33] << 13;
|
||||||
|
*c++ = sr >> 7;
|
||||||
|
sr = sr >> 3 | xmc[34] << 13;
|
||||||
|
sr = sr >> 3 | xmc[35] << 13;
|
||||||
|
sr = sr >> 3 | xmc[36] << 13;
|
||||||
|
*c++ = sr >> 6;
|
||||||
|
sr = sr >> 3 | xmc[37] << 13;
|
||||||
|
sr = sr >> 3 | xmc[38] << 13;
|
||||||
|
*c++ = sr >> 8;
|
||||||
|
sr = sr >> 7 | Nc[3] << 9;
|
||||||
|
sr = sr >> 2 | bc[3] << 14;
|
||||||
|
*c++ = sr >> 7;
|
||||||
|
sr = sr >> 2 | Mc[3] << 14;
|
||||||
|
sr = sr >> 6 | xmaxc[3] << 10;
|
||||||
|
*c++ = sr >> 7;
|
||||||
|
sr = sr >> 3 | xmc[39] << 13;
|
||||||
|
sr = sr >> 3 | xmc[40] << 13;
|
||||||
|
sr = sr >> 3 | xmc[41] << 13;
|
||||||
|
*c++ = sr >> 6;
|
||||||
|
sr = sr >> 3 | xmc[42] << 13;
|
||||||
|
sr = sr >> 3 | xmc[43] << 13;
|
||||||
|
*c++ = sr >> 8;
|
||||||
|
sr = sr >> 3 | xmc[44] << 13;
|
||||||
|
sr = sr >> 3 | xmc[45] << 13;
|
||||||
|
sr = sr >> 3 | xmc[46] << 13;
|
||||||
|
*c++ = sr >> 7;
|
||||||
|
sr = sr >> 3 | xmc[47] << 13;
|
||||||
|
sr = sr >> 3 | xmc[48] << 13;
|
||||||
|
sr = sr >> 3 | xmc[49] << 13;
|
||||||
|
*c++ = sr >> 6;
|
||||||
|
sr = sr >> 3 | xmc[50] << 13;
|
||||||
|
sr = sr >> 3 | xmc[51] << 13;
|
||||||
|
*c++ = sr >> 8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
#endif /* WAV49 */
|
||||||
|
{
|
||||||
|
|
||||||
|
*c++ = ((GSM_MAGIC & 0xF) << 4) /* 1 */
|
||||||
|
| ((LARc[0] >> 2) & 0xF);
|
||||||
|
*c++ = ((LARc[0] & 0x3) << 6)
|
||||||
|
| (LARc[1] & 0x3F);
|
||||||
|
*c++ = ((LARc[2] & 0x1F) << 3)
|
||||||
|
| ((LARc[3] >> 2) & 0x7);
|
||||||
|
*c++ = ((LARc[3] & 0x3) << 6)
|
||||||
|
| ((LARc[4] & 0xF) << 2)
|
||||||
|
| ((LARc[5] >> 2) & 0x3);
|
||||||
|
*c++ = ((LARc[5] & 0x3) << 6)
|
||||||
|
| ((LARc[6] & 0x7) << 3)
|
||||||
|
| (LARc[7] & 0x7);
|
||||||
|
*c++ = ((Nc[0] & 0x7F) << 1)
|
||||||
|
| ((bc[0] >> 1) & 0x1);
|
||||||
|
*c++ = ((bc[0] & 0x1) << 7)
|
||||||
|
| ((Mc[0] & 0x3) << 5)
|
||||||
|
| ((xmaxc[0] >> 1) & 0x1F);
|
||||||
|
*c++ = ((xmaxc[0] & 0x1) << 7)
|
||||||
|
| ((xmc[0] & 0x7) << 4)
|
||||||
|
| ((xmc[1] & 0x7) << 1)
|
||||||
|
| ((xmc[2] >> 2) & 0x1);
|
||||||
|
*c++ = ((xmc[2] & 0x3) << 6)
|
||||||
|
| ((xmc[3] & 0x7) << 3)
|
||||||
|
| (xmc[4] & 0x7);
|
||||||
|
*c++ = ((xmc[5] & 0x7) << 5) /* 10 */
|
||||||
|
| ((xmc[6] & 0x7) << 2)
|
||||||
|
| ((xmc[7] >> 1) & 0x3);
|
||||||
|
*c++ = ((xmc[7] & 0x1) << 7)
|
||||||
|
| ((xmc[8] & 0x7) << 4)
|
||||||
|
| ((xmc[9] & 0x7) << 1)
|
||||||
|
| ((xmc[10] >> 2) & 0x1);
|
||||||
|
*c++ = ((xmc[10] & 0x3) << 6)
|
||||||
|
| ((xmc[11] & 0x7) << 3)
|
||||||
|
| (xmc[12] & 0x7);
|
||||||
|
*c++ = ((Nc[1] & 0x7F) << 1)
|
||||||
|
| ((bc[1] >> 1) & 0x1);
|
||||||
|
*c++ = ((bc[1] & 0x1) << 7)
|
||||||
|
| ((Mc[1] & 0x3) << 5)
|
||||||
|
| ((xmaxc[1] >> 1) & 0x1F);
|
||||||
|
*c++ = ((xmaxc[1] & 0x1) << 7)
|
||||||
|
| ((xmc[13] & 0x7) << 4)
|
||||||
|
| ((xmc[14] & 0x7) << 1)
|
||||||
|
| ((xmc[15] >> 2) & 0x1);
|
||||||
|
*c++ = ((xmc[15] & 0x3) << 6)
|
||||||
|
| ((xmc[16] & 0x7) << 3)
|
||||||
|
| (xmc[17] & 0x7);
|
||||||
|
*c++ = ((xmc[18] & 0x7) << 5)
|
||||||
|
| ((xmc[19] & 0x7) << 2)
|
||||||
|
| ((xmc[20] >> 1) & 0x3);
|
||||||
|
*c++ = ((xmc[20] & 0x1) << 7)
|
||||||
|
| ((xmc[21] & 0x7) << 4)
|
||||||
|
| ((xmc[22] & 0x7) << 1)
|
||||||
|
| ((xmc[23] >> 2) & 0x1);
|
||||||
|
*c++ = ((xmc[23] & 0x3) << 6)
|
||||||
|
| ((xmc[24] & 0x7) << 3)
|
||||||
|
| (xmc[25] & 0x7);
|
||||||
|
*c++ = ((Nc[2] & 0x7F) << 1) /* 20 */
|
||||||
|
| ((bc[2] >> 1) & 0x1);
|
||||||
|
*c++ = ((bc[2] & 0x1) << 7)
|
||||||
|
| ((Mc[2] & 0x3) << 5)
|
||||||
|
| ((xmaxc[2] >> 1) & 0x1F);
|
||||||
|
*c++ = ((xmaxc[2] & 0x1) << 7)
|
||||||
|
| ((xmc[26] & 0x7) << 4)
|
||||||
|
| ((xmc[27] & 0x7) << 1)
|
||||||
|
| ((xmc[28] >> 2) & 0x1);
|
||||||
|
*c++ = ((xmc[28] & 0x3) << 6)
|
||||||
|
| ((xmc[29] & 0x7) << 3)
|
||||||
|
| (xmc[30] & 0x7);
|
||||||
|
*c++ = ((xmc[31] & 0x7) << 5)
|
||||||
|
| ((xmc[32] & 0x7) << 2)
|
||||||
|
| ((xmc[33] >> 1) & 0x3);
|
||||||
|
*c++ = ((xmc[33] & 0x1) << 7)
|
||||||
|
| ((xmc[34] & 0x7) << 4)
|
||||||
|
| ((xmc[35] & 0x7) << 1)
|
||||||
|
| ((xmc[36] >> 2) & 0x1);
|
||||||
|
*c++ = ((xmc[36] & 0x3) << 6)
|
||||||
|
| ((xmc[37] & 0x7) << 3)
|
||||||
|
| (xmc[38] & 0x7);
|
||||||
|
*c++ = ((Nc[3] & 0x7F) << 1)
|
||||||
|
| ((bc[3] >> 1) & 0x1);
|
||||||
|
*c++ = ((bc[3] & 0x1) << 7)
|
||||||
|
| ((Mc[3] & 0x3) << 5)
|
||||||
|
| ((xmaxc[3] >> 1) & 0x1F);
|
||||||
|
*c++ = ((xmaxc[3] & 0x1) << 7)
|
||||||
|
| ((xmc[39] & 0x7) << 4)
|
||||||
|
| ((xmc[40] & 0x7) << 1)
|
||||||
|
| ((xmc[41] >> 2) & 0x1);
|
||||||
|
*c++ = ((xmc[41] & 0x3) << 6) /* 30 */
|
||||||
|
| ((xmc[42] & 0x7) << 3)
|
||||||
|
| (xmc[43] & 0x7);
|
||||||
|
*c++ = ((xmc[44] & 0x7) << 5)
|
||||||
|
| ((xmc[45] & 0x7) << 2)
|
||||||
|
| ((xmc[46] >> 1) & 0x3);
|
||||||
|
*c++ = ((xmc[46] & 0x1) << 7)
|
||||||
|
| ((xmc[47] & 0x7) << 4)
|
||||||
|
| ((xmc[48] & 0x7) << 1)
|
||||||
|
| ((xmc[49] >> 2) & 0x1);
|
||||||
|
*c++ = ((xmc[49] & 0x3) << 6)
|
||||||
|
| ((xmc[50] & 0x7) << 3)
|
||||||
|
| (xmc[51] & 0x7);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
|
||||||
|
* Universitaet Berlin. See the accompanying file "COPYRIGHT" for
|
||||||
|
* details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* $Header: /tmp_amd/presto/export/kbs/jutta/src/gsm/RCS/gsm_option.c,v 1.3 1996/07/02 09:59:05 jutta Exp $ */
|
||||||
|
|
||||||
|
#include "private.h"
|
||||||
|
|
||||||
|
#include "gsm.h"
|
||||||
|
#include "proto.h"
|
||||||
|
|
||||||
|
int gsm_option P3((r, opt, val), gsm r, int opt, int * val)
|
||||||
|
{
|
||||||
|
int result = -1;
|
||||||
|
|
||||||
|
switch (opt) {
|
||||||
|
case GSM_OPT_LTP_CUT:
|
||||||
|
#ifdef LTP_CUT
|
||||||
|
result = r->ltp_cut;
|
||||||
|
if (val) r->ltp_cut = *val;
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GSM_OPT_VERBOSE:
|
||||||
|
#ifndef NDEBUG
|
||||||
|
result = r->verbose;
|
||||||
|
if (val) r->verbose = *val;
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GSM_OPT_FAST:
|
||||||
|
|
||||||
|
#if defined(FAST) && defined(USE_FLOAT_MUL)
|
||||||
|
result = r->fast;
|
||||||
|
if (val) r->fast = !!*val;
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GSM_OPT_FRAME_CHAIN:
|
||||||
|
|
||||||
|
#ifdef WAV49
|
||||||
|
result = r->frame_chain;
|
||||||
|
if (val) r->frame_chain = *val;
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GSM_OPT_FRAME_INDEX:
|
||||||
|
|
||||||
|
#ifdef WAV49
|
||||||
|
result = r->frame_index;
|
||||||
|
if (val) r->frame_index = *val;
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GSM_OPT_WAV49:
|
||||||
|
|
||||||
|
#ifdef WAV49
|
||||||
|
result = r->wav_fmt;
|
||||||
|
if (val) r->wav_fmt = !!*val;
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
@@ -0,0 +1,949 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
|
||||||
|
* Universitaet Berlin. See the accompanying file "COPYRIGHT" for
|
||||||
|
* details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* $Header: /tmp_amd/presto/export/kbs/jutta/src/gsm/RCS/long_term.c,v 1.6 1996/07/02 12:33:19 jutta Exp $ */
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
#include "private.h"
|
||||||
|
|
||||||
|
#include "gsm.h"
|
||||||
|
#include "proto.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 4.2.11 .. 4.2.12 LONG TERM PREDICTOR (LTP) SECTION
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This module computes the LTP gain (bc) and the LTP lag (Nc)
|
||||||
|
* for the long term analysis filter. This is done by calculating a
|
||||||
|
* maximum of the cross-correlation function between the current
|
||||||
|
* sub-segment short term residual signal d[0..39] (output of
|
||||||
|
* the short term analysis filter; for simplification the index
|
||||||
|
* of this array begins at 0 and ends at 39 for each sub-segment of the
|
||||||
|
* RPE-LTP analysis) and the previous reconstructed short term
|
||||||
|
* residual signal dp[ -120 .. -1 ]. A dynamic scaling must be
|
||||||
|
* performed to avoid overflow.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* The next procedure exists in six versions. First two integer
|
||||||
|
* version (if USE_FLOAT_MUL is not defined); then four floating
|
||||||
|
* point versions, twice with proper scaling (USE_FLOAT_MUL defined),
|
||||||
|
* once without (USE_FLOAT_MUL and FAST defined, and fast run-time
|
||||||
|
* option used). Every pair has first a Cut version (see the -C
|
||||||
|
* option to toast or the LTP_CUT option to gsm_option()), then the
|
||||||
|
* uncut one. (For a detailed explanation of why this is altogether
|
||||||
|
* a bad idea, see Henry Spencer and Geoff Collyer, ``#ifdef Considered
|
||||||
|
* Harmful''.)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef USE_FLOAT_MUL
|
||||||
|
|
||||||
|
#ifdef LTP_CUT
|
||||||
|
|
||||||
|
static void Cut_Calculation_of_the_LTP_parameters P5((st, d,dp,bc_out,Nc_out),
|
||||||
|
|
||||||
|
struct gsm_state * st,
|
||||||
|
|
||||||
|
register word * d, /* [0..39] IN */
|
||||||
|
register word * dp, /* [-120..-1] IN */
|
||||||
|
word * bc_out, /* OUT */
|
||||||
|
word * Nc_out /* OUT */
|
||||||
|
)
|
||||||
|
{
|
||||||
|
register int k, lambda;
|
||||||
|
word Nc, bc;
|
||||||
|
word wt[40];
|
||||||
|
|
||||||
|
longword L_result;
|
||||||
|
longword L_max, L_power;
|
||||||
|
word R, S, dmax, scal, best_k;
|
||||||
|
word ltp_cut;
|
||||||
|
|
||||||
|
register word temp, wt_k;
|
||||||
|
|
||||||
|
/* Search of the optimum scaling of d[0..39].
|
||||||
|
*/
|
||||||
|
dmax = 0;
|
||||||
|
for (k = 0; k <= 39; k++) {
|
||||||
|
temp = d[k];
|
||||||
|
temp = GSM_ABS( temp );
|
||||||
|
if (temp > dmax) {
|
||||||
|
dmax = temp;
|
||||||
|
best_k = k;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
temp = 0;
|
||||||
|
if (dmax == 0) scal = 0;
|
||||||
|
else {
|
||||||
|
assert(dmax > 0);
|
||||||
|
temp = gsm_norm( (longword)dmax << 16 );
|
||||||
|
}
|
||||||
|
if (temp > 6) scal = 0;
|
||||||
|
else scal = 6 - temp;
|
||||||
|
assert(scal >= 0);
|
||||||
|
|
||||||
|
/* Search for the maximum cross-correlation and coding of the LTP lag
|
||||||
|
*/
|
||||||
|
L_max = 0;
|
||||||
|
Nc = 40; /* index for the maximum cross-correlation */
|
||||||
|
wt_k = SASR(d[best_k], scal);
|
||||||
|
|
||||||
|
for (lambda = 40; lambda <= 120; lambda++) {
|
||||||
|
L_result = (longword)wt_k * dp[best_k - lambda];
|
||||||
|
if (L_result > L_max) {
|
||||||
|
Nc = lambda;
|
||||||
|
L_max = L_result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*Nc_out = Nc;
|
||||||
|
L_max <<= 1;
|
||||||
|
|
||||||
|
/* Rescaling of L_max
|
||||||
|
*/
|
||||||
|
assert(scal <= 100 && scal >= -100);
|
||||||
|
L_max = L_max >> (6 - scal); /* sub(6, scal) */
|
||||||
|
|
||||||
|
assert( Nc <= 120 && Nc >= 40);
|
||||||
|
|
||||||
|
/* Compute the power of the reconstructed short term residual
|
||||||
|
* signal dp[..]
|
||||||
|
*/
|
||||||
|
L_power = 0;
|
||||||
|
for (k = 0; k <= 39; k++) {
|
||||||
|
|
||||||
|
register longword L_temp;
|
||||||
|
|
||||||
|
L_temp = SASR( dp[k - Nc], 3 );
|
||||||
|
L_power += L_temp * L_temp;
|
||||||
|
}
|
||||||
|
L_power <<= 1; /* from L_MULT */
|
||||||
|
|
||||||
|
/* Normalization of L_max and L_power
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (L_max <= 0) {
|
||||||
|
*bc_out = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (L_max >= L_power) {
|
||||||
|
*bc_out = 3;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
temp = gsm_norm( L_power );
|
||||||
|
|
||||||
|
R = SASR( L_max << temp, 16 );
|
||||||
|
S = SASR( L_power << temp, 16 );
|
||||||
|
|
||||||
|
/* Coding of the LTP gain
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Table 4.3a must be used to obtain the level DLB[i] for the
|
||||||
|
* quantization of the LTP gain b to get the coded version bc.
|
||||||
|
*/
|
||||||
|
for (bc = 0; bc <= 2; bc++) if (R <= gsm_mult(S, gsm_DLB[bc])) break;
|
||||||
|
*bc_out = bc;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* LTP_CUT */
|
||||||
|
|
||||||
|
static void Calculation_of_the_LTP_parameters P4((d,dp,bc_out,Nc_out),
|
||||||
|
register word * d, /* [0..39] IN */
|
||||||
|
register word * dp, /* [-120..-1] IN */
|
||||||
|
word * bc_out, /* OUT */
|
||||||
|
word * Nc_out /* OUT */
|
||||||
|
)
|
||||||
|
{
|
||||||
|
register int k, lambda;
|
||||||
|
word Nc, bc;
|
||||||
|
word wt[40];
|
||||||
|
|
||||||
|
longword L_max, L_power;
|
||||||
|
word R, S, dmax, scal;
|
||||||
|
register word temp;
|
||||||
|
|
||||||
|
/* Search of the optimum scaling of d[0..39].
|
||||||
|
*/
|
||||||
|
dmax = 0;
|
||||||
|
|
||||||
|
for (k = 0; k <= 39; k++) {
|
||||||
|
temp = d[k];
|
||||||
|
temp = GSM_ABS( temp );
|
||||||
|
if (temp > dmax) dmax = temp;
|
||||||
|
}
|
||||||
|
|
||||||
|
temp = 0;
|
||||||
|
if (dmax == 0) scal = 0;
|
||||||
|
else {
|
||||||
|
assert(dmax > 0);
|
||||||
|
temp = gsm_norm( (longword)dmax << 16 );
|
||||||
|
}
|
||||||
|
|
||||||
|
if (temp > 6) scal = 0;
|
||||||
|
else scal = 6 - temp;
|
||||||
|
|
||||||
|
assert(scal >= 0);
|
||||||
|
|
||||||
|
/* Initialization of a working array wt
|
||||||
|
*/
|
||||||
|
|
||||||
|
for (k = 0; k <= 39; k++) wt[k] = SASR( d[k], scal );
|
||||||
|
|
||||||
|
/* Search for the maximum cross-correlation and coding of the LTP lag
|
||||||
|
*/
|
||||||
|
L_max = 0;
|
||||||
|
Nc = 40; /* index for the maximum cross-correlation */
|
||||||
|
|
||||||
|
for (lambda = 40; lambda <= 120; lambda++) {
|
||||||
|
|
||||||
|
# undef STEP
|
||||||
|
# define STEP(k) (longword)wt[k] * dp[k - lambda]
|
||||||
|
|
||||||
|
register longword L_result;
|
||||||
|
|
||||||
|
L_result = STEP(0) ; L_result += STEP(1) ;
|
||||||
|
L_result += STEP(2) ; L_result += STEP(3) ;
|
||||||
|
L_result += STEP(4) ; L_result += STEP(5) ;
|
||||||
|
L_result += STEP(6) ; L_result += STEP(7) ;
|
||||||
|
L_result += STEP(8) ; L_result += STEP(9) ;
|
||||||
|
L_result += STEP(10) ; L_result += STEP(11) ;
|
||||||
|
L_result += STEP(12) ; L_result += STEP(13) ;
|
||||||
|
L_result += STEP(14) ; L_result += STEP(15) ;
|
||||||
|
L_result += STEP(16) ; L_result += STEP(17) ;
|
||||||
|
L_result += STEP(18) ; L_result += STEP(19) ;
|
||||||
|
L_result += STEP(20) ; L_result += STEP(21) ;
|
||||||
|
L_result += STEP(22) ; L_result += STEP(23) ;
|
||||||
|
L_result += STEP(24) ; L_result += STEP(25) ;
|
||||||
|
L_result += STEP(26) ; L_result += STEP(27) ;
|
||||||
|
L_result += STEP(28) ; L_result += STEP(29) ;
|
||||||
|
L_result += STEP(30) ; L_result += STEP(31) ;
|
||||||
|
L_result += STEP(32) ; L_result += STEP(33) ;
|
||||||
|
L_result += STEP(34) ; L_result += STEP(35) ;
|
||||||
|
L_result += STEP(36) ; L_result += STEP(37) ;
|
||||||
|
L_result += STEP(38) ; L_result += STEP(39) ;
|
||||||
|
|
||||||
|
if (L_result > L_max) {
|
||||||
|
|
||||||
|
Nc = lambda;
|
||||||
|
L_max = L_result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*Nc_out = Nc;
|
||||||
|
|
||||||
|
L_max <<= 1;
|
||||||
|
|
||||||
|
/* Rescaling of L_max
|
||||||
|
*/
|
||||||
|
assert(scal <= 100 && scal >= -100);
|
||||||
|
L_max = L_max >> (6 - scal); /* sub(6, scal) */
|
||||||
|
|
||||||
|
assert( Nc <= 120 && Nc >= 40);
|
||||||
|
|
||||||
|
/* Compute the power of the reconstructed short term residual
|
||||||
|
* signal dp[..]
|
||||||
|
*/
|
||||||
|
L_power = 0;
|
||||||
|
for (k = 0; k <= 39; k++) {
|
||||||
|
|
||||||
|
register longword L_temp;
|
||||||
|
|
||||||
|
L_temp = SASR( dp[k - Nc], 3 );
|
||||||
|
L_power += L_temp * L_temp;
|
||||||
|
}
|
||||||
|
L_power <<= 1; /* from L_MULT */
|
||||||
|
|
||||||
|
/* Normalization of L_max and L_power
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (L_max <= 0) {
|
||||||
|
*bc_out = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (L_max >= L_power) {
|
||||||
|
*bc_out = 3;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
temp = gsm_norm( L_power );
|
||||||
|
|
||||||
|
R = SASR( L_max << temp, 16 );
|
||||||
|
S = SASR( L_power << temp, 16 );
|
||||||
|
|
||||||
|
/* Coding of the LTP gain
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Table 4.3a must be used to obtain the level DLB[i] for the
|
||||||
|
* quantization of the LTP gain b to get the coded version bc.
|
||||||
|
*/
|
||||||
|
for (bc = 0; bc <= 2; bc++) if (R <= gsm_mult(S, gsm_DLB[bc])) break;
|
||||||
|
*bc_out = bc;
|
||||||
|
}
|
||||||
|
|
||||||
|
#else /* USE_FLOAT_MUL */
|
||||||
|
|
||||||
|
#ifdef LTP_CUT
|
||||||
|
|
||||||
|
static void Cut_Calculation_of_the_LTP_parameters P5((st, d,dp,bc_out,Nc_out),
|
||||||
|
struct gsm_state * st, /* IN */
|
||||||
|
register word * d, /* [0..39] IN */
|
||||||
|
register word * dp, /* [-120..-1] IN */
|
||||||
|
word * bc_out, /* OUT */
|
||||||
|
word * Nc_out /* OUT */
|
||||||
|
)
|
||||||
|
{
|
||||||
|
register int k, lambda;
|
||||||
|
word Nc, bc;
|
||||||
|
word ltp_cut;
|
||||||
|
|
||||||
|
float wt_float[40];
|
||||||
|
float dp_float_base[120], * dp_float = dp_float_base + 120;
|
||||||
|
|
||||||
|
longword L_max, L_power;
|
||||||
|
word R, S, dmax, scal;
|
||||||
|
register word temp;
|
||||||
|
|
||||||
|
/* Search of the optimum scaling of d[0..39].
|
||||||
|
*/
|
||||||
|
dmax = 0;
|
||||||
|
|
||||||
|
for (k = 0; k <= 39; k++) {
|
||||||
|
temp = d[k];
|
||||||
|
temp = GSM_ABS( temp );
|
||||||
|
if (temp > dmax) dmax = temp;
|
||||||
|
}
|
||||||
|
|
||||||
|
temp = 0;
|
||||||
|
if (dmax == 0) scal = 0;
|
||||||
|
else {
|
||||||
|
assert(dmax > 0);
|
||||||
|
temp = gsm_norm( (longword)dmax << 16 );
|
||||||
|
}
|
||||||
|
|
||||||
|
if (temp > 6) scal = 0;
|
||||||
|
else scal = 6 - temp;
|
||||||
|
|
||||||
|
assert(scal >= 0);
|
||||||
|
ltp_cut = (longword)SASR(dmax, scal) * st->ltp_cut / 100;
|
||||||
|
|
||||||
|
|
||||||
|
/* Initialization of a working array wt
|
||||||
|
*/
|
||||||
|
|
||||||
|
for (k = 0; k < 40; k++) {
|
||||||
|
register word w = SASR( d[k], scal );
|
||||||
|
if (w < 0 ? w > -ltp_cut : w < ltp_cut) {
|
||||||
|
wt_float[k] = 0.0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
wt_float[k] = w;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (k = -120; k < 0; k++) dp_float[k] = dp[k];
|
||||||
|
|
||||||
|
/* Search for the maximum cross-correlation and coding of the LTP lag
|
||||||
|
*/
|
||||||
|
L_max = 0;
|
||||||
|
Nc = 40; /* index for the maximum cross-correlation */
|
||||||
|
|
||||||
|
for (lambda = 40; lambda <= 120; lambda += 9) {
|
||||||
|
|
||||||
|
/* Calculate L_result for l = lambda .. lambda + 9.
|
||||||
|
*/
|
||||||
|
register float *lp = dp_float - lambda;
|
||||||
|
|
||||||
|
register float W;
|
||||||
|
register float a = lp[-8], b = lp[-7], c = lp[-6],
|
||||||
|
d = lp[-5], e = lp[-4], f = lp[-3],
|
||||||
|
g = lp[-2], h = lp[-1];
|
||||||
|
register float E;
|
||||||
|
register float S0 = 0, S1 = 0, S2 = 0, S3 = 0, S4 = 0,
|
||||||
|
S5 = 0, S6 = 0, S7 = 0, S8 = 0;
|
||||||
|
|
||||||
|
# undef STEP
|
||||||
|
# define STEP(K, a, b, c, d, e, f, g, h) \
|
||||||
|
if ((W = wt_float[K]) != 0.0) { \
|
||||||
|
E = W * a; S8 += E; \
|
||||||
|
E = W * b; S7 += E; \
|
||||||
|
E = W * c; S6 += E; \
|
||||||
|
E = W * d; S5 += E; \
|
||||||
|
E = W * e; S4 += E; \
|
||||||
|
E = W * f; S3 += E; \
|
||||||
|
E = W * g; S2 += E; \
|
||||||
|
E = W * h; S1 += E; \
|
||||||
|
a = lp[K]; \
|
||||||
|
E = W * a; S0 += E; } else (a = lp[K])
|
||||||
|
|
||||||
|
# define STEP_A(K) STEP(K, a, b, c, d, e, f, g, h)
|
||||||
|
# define STEP_B(K) STEP(K, b, c, d, e, f, g, h, a)
|
||||||
|
# define STEP_C(K) STEP(K, c, d, e, f, g, h, a, b)
|
||||||
|
# define STEP_D(K) STEP(K, d, e, f, g, h, a, b, c)
|
||||||
|
# define STEP_E(K) STEP(K, e, f, g, h, a, b, c, d)
|
||||||
|
# define STEP_F(K) STEP(K, f, g, h, a, b, c, d, e)
|
||||||
|
# define STEP_G(K) STEP(K, g, h, a, b, c, d, e, f)
|
||||||
|
# define STEP_H(K) STEP(K, h, a, b, c, d, e, f, g)
|
||||||
|
|
||||||
|
STEP_A( 0); STEP_B( 1); STEP_C( 2); STEP_D( 3);
|
||||||
|
STEP_E( 4); STEP_F( 5); STEP_G( 6); STEP_H( 7);
|
||||||
|
|
||||||
|
STEP_A( 8); STEP_B( 9); STEP_C(10); STEP_D(11);
|
||||||
|
STEP_E(12); STEP_F(13); STEP_G(14); STEP_H(15);
|
||||||
|
|
||||||
|
STEP_A(16); STEP_B(17); STEP_C(18); STEP_D(19);
|
||||||
|
STEP_E(20); STEP_F(21); STEP_G(22); STEP_H(23);
|
||||||
|
|
||||||
|
STEP_A(24); STEP_B(25); STEP_C(26); STEP_D(27);
|
||||||
|
STEP_E(28); STEP_F(29); STEP_G(30); STEP_H(31);
|
||||||
|
|
||||||
|
STEP_A(32); STEP_B(33); STEP_C(34); STEP_D(35);
|
||||||
|
STEP_E(36); STEP_F(37); STEP_G(38); STEP_H(39);
|
||||||
|
|
||||||
|
if (S0 > L_max) { L_max = S0; Nc = lambda; }
|
||||||
|
if (S1 > L_max) { L_max = S1; Nc = lambda + 1; }
|
||||||
|
if (S2 > L_max) { L_max = S2; Nc = lambda + 2; }
|
||||||
|
if (S3 > L_max) { L_max = S3; Nc = lambda + 3; }
|
||||||
|
if (S4 > L_max) { L_max = S4; Nc = lambda + 4; }
|
||||||
|
if (S5 > L_max) { L_max = S5; Nc = lambda + 5; }
|
||||||
|
if (S6 > L_max) { L_max = S6; Nc = lambda + 6; }
|
||||||
|
if (S7 > L_max) { L_max = S7; Nc = lambda + 7; }
|
||||||
|
if (S8 > L_max) { L_max = S8; Nc = lambda + 8; }
|
||||||
|
|
||||||
|
}
|
||||||
|
*Nc_out = Nc;
|
||||||
|
|
||||||
|
L_max <<= 1;
|
||||||
|
|
||||||
|
/* Rescaling of L_max
|
||||||
|
*/
|
||||||
|
assert(scal <= 100 && scal >= -100);
|
||||||
|
L_max = L_max >> (6 - scal); /* sub(6, scal) */
|
||||||
|
|
||||||
|
assert( Nc <= 120 && Nc >= 40);
|
||||||
|
|
||||||
|
/* Compute the power of the reconstructed short term residual
|
||||||
|
* signal dp[..]
|
||||||
|
*/
|
||||||
|
L_power = 0;
|
||||||
|
for (k = 0; k <= 39; k++) {
|
||||||
|
|
||||||
|
register longword L_temp;
|
||||||
|
|
||||||
|
L_temp = SASR( dp[k - Nc], 3 );
|
||||||
|
L_power += L_temp * L_temp;
|
||||||
|
}
|
||||||
|
L_power <<= 1; /* from L_MULT */
|
||||||
|
|
||||||
|
/* Normalization of L_max and L_power
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (L_max <= 0) {
|
||||||
|
*bc_out = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (L_max >= L_power) {
|
||||||
|
*bc_out = 3;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
temp = gsm_norm( L_power );
|
||||||
|
|
||||||
|
R = SASR( L_max << temp, 16 );
|
||||||
|
S = SASR( L_power << temp, 16 );
|
||||||
|
|
||||||
|
/* Coding of the LTP gain
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Table 4.3a must be used to obtain the level DLB[i] for the
|
||||||
|
* quantization of the LTP gain b to get the coded version bc.
|
||||||
|
*/
|
||||||
|
for (bc = 0; bc <= 2; bc++) if (R <= gsm_mult(S, gsm_DLB[bc])) break;
|
||||||
|
*bc_out = bc;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* LTP_CUT */
|
||||||
|
|
||||||
|
static void Calculation_of_the_LTP_parameters P4((d,dp,bc_out,Nc_out),
|
||||||
|
register word * d, /* [0..39] IN */
|
||||||
|
register word * dp, /* [-120..-1] IN */
|
||||||
|
word * bc_out, /* OUT */
|
||||||
|
word * Nc_out /* OUT */
|
||||||
|
)
|
||||||
|
{
|
||||||
|
register int k, lambda;
|
||||||
|
word Nc, bc;
|
||||||
|
|
||||||
|
float wt_float[40];
|
||||||
|
float dp_float_base[120], * dp_float = dp_float_base + 120;
|
||||||
|
|
||||||
|
longword L_max, L_power;
|
||||||
|
word R, S, dmax, scal;
|
||||||
|
register word temp;
|
||||||
|
|
||||||
|
/* Search of the optimum scaling of d[0..39].
|
||||||
|
*/
|
||||||
|
dmax = 0;
|
||||||
|
|
||||||
|
for (k = 0; k <= 39; k++) {
|
||||||
|
temp = d[k];
|
||||||
|
temp = GSM_ABS( temp );
|
||||||
|
if (temp > dmax) dmax = temp;
|
||||||
|
}
|
||||||
|
|
||||||
|
temp = 0;
|
||||||
|
if (dmax == 0) scal = 0;
|
||||||
|
else {
|
||||||
|
assert(dmax > 0);
|
||||||
|
temp = gsm_norm( (longword)dmax << 16 );
|
||||||
|
}
|
||||||
|
|
||||||
|
if (temp > 6) scal = 0;
|
||||||
|
else scal = 6 - temp;
|
||||||
|
|
||||||
|
assert(scal >= 0);
|
||||||
|
|
||||||
|
/* Initialization of a working array wt
|
||||||
|
*/
|
||||||
|
|
||||||
|
for (k = 0; k < 40; k++) wt_float[k] = SASR( d[k], scal );
|
||||||
|
for (k = -120; k < 0; k++) dp_float[k] = dp[k];
|
||||||
|
|
||||||
|
/* Search for the maximum cross-correlation and coding of the LTP lag
|
||||||
|
*/
|
||||||
|
L_max = 0;
|
||||||
|
Nc = 40; /* index for the maximum cross-correlation */
|
||||||
|
|
||||||
|
for (lambda = 40; lambda <= 120; lambda += 9) {
|
||||||
|
|
||||||
|
/* Calculate L_result for l = lambda .. lambda + 9.
|
||||||
|
*/
|
||||||
|
register float *lp = dp_float - lambda;
|
||||||
|
|
||||||
|
register float W;
|
||||||
|
register float a = lp[-8], b = lp[-7], c = lp[-6],
|
||||||
|
d = lp[-5], e = lp[-4], f = lp[-3],
|
||||||
|
g = lp[-2], h = lp[-1];
|
||||||
|
register float E;
|
||||||
|
register float S0 = 0, S1 = 0, S2 = 0, S3 = 0, S4 = 0,
|
||||||
|
S5 = 0, S6 = 0, S7 = 0, S8 = 0;
|
||||||
|
|
||||||
|
# undef STEP
|
||||||
|
# define STEP(K, a, b, c, d, e, f, g, h) \
|
||||||
|
W = wt_float[K]; \
|
||||||
|
E = W * a; S8 += E; \
|
||||||
|
E = W * b; S7 += E; \
|
||||||
|
E = W * c; S6 += E; \
|
||||||
|
E = W * d; S5 += E; \
|
||||||
|
E = W * e; S4 += E; \
|
||||||
|
E = W * f; S3 += E; \
|
||||||
|
E = W * g; S2 += E; \
|
||||||
|
E = W * h; S1 += E; \
|
||||||
|
a = lp[K]; \
|
||||||
|
E = W * a; S0 += E
|
||||||
|
|
||||||
|
# define STEP_A(K) STEP(K, a, b, c, d, e, f, g, h)
|
||||||
|
# define STEP_B(K) STEP(K, b, c, d, e, f, g, h, a)
|
||||||
|
# define STEP_C(K) STEP(K, c, d, e, f, g, h, a, b)
|
||||||
|
# define STEP_D(K) STEP(K, d, e, f, g, h, a, b, c)
|
||||||
|
# define STEP_E(K) STEP(K, e, f, g, h, a, b, c, d)
|
||||||
|
# define STEP_F(K) STEP(K, f, g, h, a, b, c, d, e)
|
||||||
|
# define STEP_G(K) STEP(K, g, h, a, b, c, d, e, f)
|
||||||
|
# define STEP_H(K) STEP(K, h, a, b, c, d, e, f, g)
|
||||||
|
|
||||||
|
STEP_A( 0); STEP_B( 1); STEP_C( 2); STEP_D( 3);
|
||||||
|
STEP_E( 4); STEP_F( 5); STEP_G( 6); STEP_H( 7);
|
||||||
|
|
||||||
|
STEP_A( 8); STEP_B( 9); STEP_C(10); STEP_D(11);
|
||||||
|
STEP_E(12); STEP_F(13); STEP_G(14); STEP_H(15);
|
||||||
|
|
||||||
|
STEP_A(16); STEP_B(17); STEP_C(18); STEP_D(19);
|
||||||
|
STEP_E(20); STEP_F(21); STEP_G(22); STEP_H(23);
|
||||||
|
|
||||||
|
STEP_A(24); STEP_B(25); STEP_C(26); STEP_D(27);
|
||||||
|
STEP_E(28); STEP_F(29); STEP_G(30); STEP_H(31);
|
||||||
|
|
||||||
|
STEP_A(32); STEP_B(33); STEP_C(34); STEP_D(35);
|
||||||
|
STEP_E(36); STEP_F(37); STEP_G(38); STEP_H(39);
|
||||||
|
|
||||||
|
if (S0 > L_max) { L_max = S0; Nc = lambda; }
|
||||||
|
if (S1 > L_max) { L_max = S1; Nc = lambda + 1; }
|
||||||
|
if (S2 > L_max) { L_max = S2; Nc = lambda + 2; }
|
||||||
|
if (S3 > L_max) { L_max = S3; Nc = lambda + 3; }
|
||||||
|
if (S4 > L_max) { L_max = S4; Nc = lambda + 4; }
|
||||||
|
if (S5 > L_max) { L_max = S5; Nc = lambda + 5; }
|
||||||
|
if (S6 > L_max) { L_max = S6; Nc = lambda + 6; }
|
||||||
|
if (S7 > L_max) { L_max = S7; Nc = lambda + 7; }
|
||||||
|
if (S8 > L_max) { L_max = S8; Nc = lambda + 8; }
|
||||||
|
}
|
||||||
|
*Nc_out = Nc;
|
||||||
|
|
||||||
|
L_max <<= 1;
|
||||||
|
|
||||||
|
/* Rescaling of L_max
|
||||||
|
*/
|
||||||
|
assert(scal <= 100 && scal >= -100);
|
||||||
|
L_max = L_max >> (6 - scal); /* sub(6, scal) */
|
||||||
|
|
||||||
|
assert( Nc <= 120 && Nc >= 40);
|
||||||
|
|
||||||
|
/* Compute the power of the reconstructed short term residual
|
||||||
|
* signal dp[..]
|
||||||
|
*/
|
||||||
|
L_power = 0;
|
||||||
|
for (k = 0; k <= 39; k++) {
|
||||||
|
|
||||||
|
register longword L_temp;
|
||||||
|
|
||||||
|
L_temp = SASR( dp[k - Nc], 3 );
|
||||||
|
L_power += L_temp * L_temp;
|
||||||
|
}
|
||||||
|
L_power <<= 1; /* from L_MULT */
|
||||||
|
|
||||||
|
/* Normalization of L_max and L_power
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (L_max <= 0) {
|
||||||
|
*bc_out = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (L_max >= L_power) {
|
||||||
|
*bc_out = 3;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
temp = gsm_norm( L_power );
|
||||||
|
|
||||||
|
R = SASR( L_max << temp, 16 );
|
||||||
|
S = SASR( L_power << temp, 16 );
|
||||||
|
|
||||||
|
/* Coding of the LTP gain
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Table 4.3a must be used to obtain the level DLB[i] for the
|
||||||
|
* quantization of the LTP gain b to get the coded version bc.
|
||||||
|
*/
|
||||||
|
for (bc = 0; bc <= 2; bc++) if (R <= gsm_mult(S, gsm_DLB[bc])) break;
|
||||||
|
*bc_out = bc;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef FAST
|
||||||
|
#ifdef LTP_CUT
|
||||||
|
|
||||||
|
static void Cut_Fast_Calculation_of_the_LTP_parameters P5((st,
|
||||||
|
d,dp,bc_out,Nc_out),
|
||||||
|
struct gsm_state * st, /* IN */
|
||||||
|
register word * d, /* [0..39] IN */
|
||||||
|
register word * dp, /* [-120..-1] IN */
|
||||||
|
word * bc_out, /* OUT */
|
||||||
|
word * Nc_out /* OUT */
|
||||||
|
)
|
||||||
|
{
|
||||||
|
register int k, lambda;
|
||||||
|
register float wt_float;
|
||||||
|
word Nc, bc;
|
||||||
|
word wt_max, best_k, ltp_cut;
|
||||||
|
|
||||||
|
float dp_float_base[120], * dp_float = dp_float_base + 120;
|
||||||
|
|
||||||
|
register float L_result, L_max, L_power;
|
||||||
|
|
||||||
|
wt_max = 0;
|
||||||
|
|
||||||
|
for (k = 0; k < 40; ++k) {
|
||||||
|
if ( d[k] > wt_max) wt_max = d[best_k = k];
|
||||||
|
else if (-d[k] > wt_max) wt_max = -d[best_k = k];
|
||||||
|
}
|
||||||
|
|
||||||
|
assert(wt_max >= 0);
|
||||||
|
wt_float = (float)wt_max;
|
||||||
|
|
||||||
|
for (k = -120; k < 0; ++k) dp_float[k] = (float)dp[k];
|
||||||
|
|
||||||
|
/* Search for the maximum cross-correlation and coding of the LTP lag
|
||||||
|
*/
|
||||||
|
L_max = 0;
|
||||||
|
Nc = 40; /* index for the maximum cross-correlation */
|
||||||
|
|
||||||
|
for (lambda = 40; lambda <= 120; lambda++) {
|
||||||
|
L_result = wt_float * dp_float[best_k - lambda];
|
||||||
|
if (L_result > L_max) {
|
||||||
|
Nc = lambda;
|
||||||
|
L_max = L_result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*Nc_out = Nc;
|
||||||
|
if (L_max <= 0.) {
|
||||||
|
*bc_out = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Compute the power of the reconstructed short term residual
|
||||||
|
* signal dp[..]
|
||||||
|
*/
|
||||||
|
dp_float -= Nc;
|
||||||
|
L_power = 0;
|
||||||
|
for (k = 0; k < 40; ++k) {
|
||||||
|
register float f = dp_float[k];
|
||||||
|
L_power += f * f;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (L_max >= L_power) {
|
||||||
|
*bc_out = 3;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Coding of the LTP gain
|
||||||
|
* Table 4.3a must be used to obtain the level DLB[i] for the
|
||||||
|
* quantization of the LTP gain b to get the coded version bc.
|
||||||
|
*/
|
||||||
|
lambda = L_max / L_power * 32768.;
|
||||||
|
for (bc = 0; bc <= 2; ++bc) if (lambda <= gsm_DLB[bc]) break;
|
||||||
|
*bc_out = bc;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* LTP_CUT */
|
||||||
|
|
||||||
|
static void Fast_Calculation_of_the_LTP_parameters P4((d,dp,bc_out,Nc_out),
|
||||||
|
register word * d, /* [0..39] IN */
|
||||||
|
register word * dp, /* [-120..-1] IN */
|
||||||
|
word * bc_out, /* OUT */
|
||||||
|
word * Nc_out /* OUT */
|
||||||
|
)
|
||||||
|
{
|
||||||
|
register int k, lambda;
|
||||||
|
word Nc, bc;
|
||||||
|
|
||||||
|
float wt_float[40];
|
||||||
|
float dp_float_base[120], * dp_float = dp_float_base + 120;
|
||||||
|
|
||||||
|
register float L_max, L_power;
|
||||||
|
|
||||||
|
for (k = 0; k < 40; ++k) wt_float[k] = (float)d[k];
|
||||||
|
for (k = -120; k < 0; ++k) dp_float[k] = (float)dp[k];
|
||||||
|
|
||||||
|
/* Search for the maximum cross-correlation and coding of the LTP lag
|
||||||
|
*/
|
||||||
|
L_max = 0;
|
||||||
|
Nc = 40; /* index for the maximum cross-correlation */
|
||||||
|
|
||||||
|
for (lambda = 40; lambda <= 120; lambda += 9) {
|
||||||
|
|
||||||
|
/* Calculate L_result for l = lambda .. lambda + 9.
|
||||||
|
*/
|
||||||
|
register float *lp = dp_float - lambda;
|
||||||
|
|
||||||
|
register float W;
|
||||||
|
register float a = lp[-8], b = lp[-7], c = lp[-6],
|
||||||
|
d = lp[-5], e = lp[-4], f = lp[-3],
|
||||||
|
g = lp[-2], h = lp[-1];
|
||||||
|
register float E;
|
||||||
|
register float S0 = 0, S1 = 0, S2 = 0, S3 = 0, S4 = 0,
|
||||||
|
S5 = 0, S6 = 0, S7 = 0, S8 = 0;
|
||||||
|
|
||||||
|
# undef STEP
|
||||||
|
# define STEP(K, a, b, c, d, e, f, g, h) \
|
||||||
|
W = wt_float[K]; \
|
||||||
|
E = W * a; S8 += E; \
|
||||||
|
E = W * b; S7 += E; \
|
||||||
|
E = W * c; S6 += E; \
|
||||||
|
E = W * d; S5 += E; \
|
||||||
|
E = W * e; S4 += E; \
|
||||||
|
E = W * f; S3 += E; \
|
||||||
|
E = W * g; S2 += E; \
|
||||||
|
E = W * h; S1 += E; \
|
||||||
|
a = lp[K]; \
|
||||||
|
E = W * a; S0 += E
|
||||||
|
|
||||||
|
# define STEP_A(K) STEP(K, a, b, c, d, e, f, g, h)
|
||||||
|
# define STEP_B(K) STEP(K, b, c, d, e, f, g, h, a)
|
||||||
|
# define STEP_C(K) STEP(K, c, d, e, f, g, h, a, b)
|
||||||
|
# define STEP_D(K) STEP(K, d, e, f, g, h, a, b, c)
|
||||||
|
# define STEP_E(K) STEP(K, e, f, g, h, a, b, c, d)
|
||||||
|
# define STEP_F(K) STEP(K, f, g, h, a, b, c, d, e)
|
||||||
|
# define STEP_G(K) STEP(K, g, h, a, b, c, d, e, f)
|
||||||
|
# define STEP_H(K) STEP(K, h, a, b, c, d, e, f, g)
|
||||||
|
|
||||||
|
STEP_A( 0); STEP_B( 1); STEP_C( 2); STEP_D( 3);
|
||||||
|
STEP_E( 4); STEP_F( 5); STEP_G( 6); STEP_H( 7);
|
||||||
|
|
||||||
|
STEP_A( 8); STEP_B( 9); STEP_C(10); STEP_D(11);
|
||||||
|
STEP_E(12); STEP_F(13); STEP_G(14); STEP_H(15);
|
||||||
|
|
||||||
|
STEP_A(16); STEP_B(17); STEP_C(18); STEP_D(19);
|
||||||
|
STEP_E(20); STEP_F(21); STEP_G(22); STEP_H(23);
|
||||||
|
|
||||||
|
STEP_A(24); STEP_B(25); STEP_C(26); STEP_D(27);
|
||||||
|
STEP_E(28); STEP_F(29); STEP_G(30); STEP_H(31);
|
||||||
|
|
||||||
|
STEP_A(32); STEP_B(33); STEP_C(34); STEP_D(35);
|
||||||
|
STEP_E(36); STEP_F(37); STEP_G(38); STEP_H(39);
|
||||||
|
|
||||||
|
if (S0 > L_max) { L_max = S0; Nc = lambda; }
|
||||||
|
if (S1 > L_max) { L_max = S1; Nc = lambda + 1; }
|
||||||
|
if (S2 > L_max) { L_max = S2; Nc = lambda + 2; }
|
||||||
|
if (S3 > L_max) { L_max = S3; Nc = lambda + 3; }
|
||||||
|
if (S4 > L_max) { L_max = S4; Nc = lambda + 4; }
|
||||||
|
if (S5 > L_max) { L_max = S5; Nc = lambda + 5; }
|
||||||
|
if (S6 > L_max) { L_max = S6; Nc = lambda + 6; }
|
||||||
|
if (S7 > L_max) { L_max = S7; Nc = lambda + 7; }
|
||||||
|
if (S8 > L_max) { L_max = S8; Nc = lambda + 8; }
|
||||||
|
}
|
||||||
|
*Nc_out = Nc;
|
||||||
|
|
||||||
|
if (L_max <= 0.) {
|
||||||
|
*bc_out = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Compute the power of the reconstructed short term residual
|
||||||
|
* signal dp[..]
|
||||||
|
*/
|
||||||
|
dp_float -= Nc;
|
||||||
|
L_power = 0;
|
||||||
|
for (k = 0; k < 40; ++k) {
|
||||||
|
register float f = dp_float[k];
|
||||||
|
L_power += f * f;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (L_max >= L_power) {
|
||||||
|
*bc_out = 3;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Coding of the LTP gain
|
||||||
|
* Table 4.3a must be used to obtain the level DLB[i] for the
|
||||||
|
* quantization of the LTP gain b to get the coded version bc.
|
||||||
|
*/
|
||||||
|
lambda = L_max / L_power * 32768.;
|
||||||
|
for (bc = 0; bc <= 2; ++bc) if (lambda <= gsm_DLB[bc]) break;
|
||||||
|
*bc_out = bc;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* FAST */
|
||||||
|
#endif /* USE_FLOAT_MUL */
|
||||||
|
|
||||||
|
|
||||||
|
/* 4.2.12 */
|
||||||
|
|
||||||
|
static void Long_term_analysis_filtering P6((bc,Nc,dp,d,dpp,e),
|
||||||
|
word bc, /* IN */
|
||||||
|
word Nc, /* IN */
|
||||||
|
register word * dp, /* previous d [-120..-1] IN */
|
||||||
|
register word * d, /* d [0..39] IN */
|
||||||
|
register word * dpp, /* estimate [0..39] OUT */
|
||||||
|
register word * e /* long term res. signal [0..39] OUT */
|
||||||
|
)
|
||||||
|
/*
|
||||||
|
* In this part, we have to decode the bc parameter to compute
|
||||||
|
* the samples of the estimate dpp[0..39]. The decoding of bc needs the
|
||||||
|
* use of table 4.3b. The long term residual signal e[0..39]
|
||||||
|
* is then calculated to be fed to the RPE encoding section.
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
register int k;
|
||||||
|
register longword ltmp;
|
||||||
|
|
||||||
|
# undef STEP
|
||||||
|
# define STEP(BP) \
|
||||||
|
for (k = 0; k <= 39; k++) { \
|
||||||
|
dpp[k] = GSM_MULT_R( BP, dp[k - Nc]); \
|
||||||
|
e[k] = GSM_SUB( d[k], dpp[k] ); \
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (bc) {
|
||||||
|
case 0: STEP( 3277 ); break;
|
||||||
|
case 1: STEP( 11469 ); break;
|
||||||
|
case 2: STEP( 21299 ); break;
|
||||||
|
case 3: STEP( 32767 ); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Gsm_Long_Term_Predictor P7((S,d,dp,e,dpp,Nc,bc), /* 4x for 160 samples */
|
||||||
|
|
||||||
|
struct gsm_state * S,
|
||||||
|
|
||||||
|
word * d, /* [0..39] residual signal IN */
|
||||||
|
word * dp, /* [-120..-1] d' IN */
|
||||||
|
|
||||||
|
word * e, /* [0..39] OUT */
|
||||||
|
word * dpp, /* [0..39] OUT */
|
||||||
|
word * Nc, /* correlation lag OUT */
|
||||||
|
word * bc /* gain factor OUT */
|
||||||
|
)
|
||||||
|
{
|
||||||
|
assert( d ); assert( dp ); assert( e );
|
||||||
|
assert( dpp); assert( Nc ); assert( bc );
|
||||||
|
|
||||||
|
#if defined(FAST) && defined(USE_FLOAT_MUL)
|
||||||
|
if (S->fast)
|
||||||
|
#if defined (LTP_CUT)
|
||||||
|
if (S->ltp_cut)
|
||||||
|
Cut_Fast_Calculation_of_the_LTP_parameters(S,
|
||||||
|
d, dp, bc, Nc);
|
||||||
|
else
|
||||||
|
#endif /* LTP_CUT */
|
||||||
|
Fast_Calculation_of_the_LTP_parameters(d, dp, bc, Nc );
|
||||||
|
else
|
||||||
|
#endif /* FAST & USE_FLOAT_MUL */
|
||||||
|
#ifdef LTP_CUT
|
||||||
|
if (S->ltp_cut)
|
||||||
|
Cut_Calculation_of_the_LTP_parameters(S, d, dp, bc, Nc);
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
Calculation_of_the_LTP_parameters(d, dp, bc, Nc);
|
||||||
|
|
||||||
|
Long_term_analysis_filtering( *bc, *Nc, dp, d, dpp, e );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 4.3.2 */
|
||||||
|
void Gsm_Long_Term_Synthesis_Filtering P5((S,Ncr,bcr,erp,drp),
|
||||||
|
struct gsm_state * S,
|
||||||
|
|
||||||
|
word Ncr,
|
||||||
|
word bcr,
|
||||||
|
register word * erp, /* [0..39] IN */
|
||||||
|
register word * drp /* [-120..-1] IN, [-120..40] OUT */
|
||||||
|
)
|
||||||
|
/*
|
||||||
|
* This procedure uses the bcr and Ncr parameter to realize the
|
||||||
|
* long term synthesis filtering. The decoding of bcr needs
|
||||||
|
* table 4.3b.
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
register longword ltmp; /* for ADD */
|
||||||
|
register int k;
|
||||||
|
word brp, drpp, Nr;
|
||||||
|
|
||||||
|
/* Check the limits of Nr.
|
||||||
|
*/
|
||||||
|
Nr = Ncr < 40 || Ncr > 120 ? S->nrp : Ncr;
|
||||||
|
S->nrp = Nr;
|
||||||
|
assert(Nr >= 40 && Nr <= 120);
|
||||||
|
|
||||||
|
/* Decoding of the LTP gain bcr
|
||||||
|
*/
|
||||||
|
brp = gsm_QLB[ bcr ];
|
||||||
|
|
||||||
|
/* Computation of the reconstructed short term residual
|
||||||
|
* signal drp[0..39]
|
||||||
|
*/
|
||||||
|
assert(brp != MIN_WORD);
|
||||||
|
|
||||||
|
for (k = 0; k <= 39; k++) {
|
||||||
|
drpp = GSM_MULT_R( brp, drp[ k - Nr ] );
|
||||||
|
drp[k] = GSM_ADD( erp[k], drpp );
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Update of the reconstructed short term residual signal
|
||||||
|
* drp[ -1..-120 ]
|
||||||
|
*/
|
||||||
|
|
||||||
|
for (k = 0; k <= 119; k++) drp[ -120 + k ] = drp[ -80 + k ];
|
||||||
|
}
|
||||||
@@ -0,0 +1,341 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
|
||||||
|
* Universitaet Berlin. See the accompanying file "COPYRIGHT" for
|
||||||
|
* details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* $Header: /tmp_amd/presto/export/kbs/jutta/src/gsm/RCS/lpc.c,v 1.5 1994/12/30 23:14:54 jutta Exp $ */
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
#include "private.h"
|
||||||
|
|
||||||
|
#include "gsm.h"
|
||||||
|
#include "proto.h"
|
||||||
|
|
||||||
|
#undef P
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 4.2.4 .. 4.2.7 LPC ANALYSIS SECTION
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* 4.2.4 */
|
||||||
|
|
||||||
|
|
||||||
|
static void Autocorrelation P2((s, L_ACF),
|
||||||
|
word * s, /* [0..159] IN/OUT */
|
||||||
|
longword * L_ACF) /* [0..8] OUT */
|
||||||
|
/*
|
||||||
|
* The goal is to compute the array L_ACF[k]. The signal s[i] must
|
||||||
|
* be scaled in order to avoid an overflow situation.
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
register int k, i;
|
||||||
|
|
||||||
|
word temp, smax, scalauto;
|
||||||
|
|
||||||
|
#ifdef USE_FLOAT_MUL
|
||||||
|
float float_s[160];
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Dynamic scaling of the array s[0..159]
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Search for the maximum.
|
||||||
|
*/
|
||||||
|
smax = 0;
|
||||||
|
for (k = 0; k <= 159; k++) {
|
||||||
|
temp = GSM_ABS( s[k] );
|
||||||
|
if (temp > smax) smax = temp;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Computation of the scaling factor.
|
||||||
|
*/
|
||||||
|
if (smax == 0) scalauto = 0;
|
||||||
|
else {
|
||||||
|
assert(smax > 0);
|
||||||
|
scalauto = 4 - gsm_norm( (longword)smax << 16 );/* sub(4,..) */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Scaling of the array s[0...159]
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (scalauto > 0) {
|
||||||
|
|
||||||
|
# ifdef USE_FLOAT_MUL
|
||||||
|
# define SCALE(n) \
|
||||||
|
case n: for (k = 0; k <= 159; k++) \
|
||||||
|
float_s[k] = (float) \
|
||||||
|
(s[k] = GSM_MULT_R(s[k], 16384 >> (n-1)));\
|
||||||
|
break;
|
||||||
|
# else
|
||||||
|
# define SCALE(n) \
|
||||||
|
case n: for (k = 0; k <= 159; k++) \
|
||||||
|
s[k] = GSM_MULT_R( s[k], 16384 >> (n-1) );\
|
||||||
|
break;
|
||||||
|
# endif /* USE_FLOAT_MUL */
|
||||||
|
|
||||||
|
switch (scalauto) {
|
||||||
|
SCALE(1)
|
||||||
|
SCALE(2)
|
||||||
|
SCALE(3)
|
||||||
|
SCALE(4)
|
||||||
|
}
|
||||||
|
# undef SCALE
|
||||||
|
}
|
||||||
|
# ifdef USE_FLOAT_MUL
|
||||||
|
else for (k = 0; k <= 159; k++) float_s[k] = (float) s[k];
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/* Compute the L_ACF[..].
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
# ifdef USE_FLOAT_MUL
|
||||||
|
register float * sp = float_s;
|
||||||
|
register float sl = *sp;
|
||||||
|
|
||||||
|
# define STEP(k) L_ACF[k] += (longword)(sl * sp[ -(k) ]);
|
||||||
|
# else
|
||||||
|
word * sp = s;
|
||||||
|
word sl = *sp;
|
||||||
|
|
||||||
|
# define STEP(k) L_ACF[k] += ((longword)sl * sp[ -(k) ]);
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# define NEXTI sl = *++sp
|
||||||
|
|
||||||
|
|
||||||
|
for (k = 9; k--; L_ACF[k] = 0) ;
|
||||||
|
|
||||||
|
STEP (0);
|
||||||
|
NEXTI;
|
||||||
|
STEP(0); STEP(1);
|
||||||
|
NEXTI;
|
||||||
|
STEP(0); STEP(1); STEP(2);
|
||||||
|
NEXTI;
|
||||||
|
STEP(0); STEP(1); STEP(2); STEP(3);
|
||||||
|
NEXTI;
|
||||||
|
STEP(0); STEP(1); STEP(2); STEP(3); STEP(4);
|
||||||
|
NEXTI;
|
||||||
|
STEP(0); STEP(1); STEP(2); STEP(3); STEP(4); STEP(5);
|
||||||
|
NEXTI;
|
||||||
|
STEP(0); STEP(1); STEP(2); STEP(3); STEP(4); STEP(5); STEP(6);
|
||||||
|
NEXTI;
|
||||||
|
STEP(0); STEP(1); STEP(2); STEP(3); STEP(4); STEP(5); STEP(6); STEP(7);
|
||||||
|
|
||||||
|
for (i = 8; i <= 159; i++) {
|
||||||
|
|
||||||
|
NEXTI;
|
||||||
|
|
||||||
|
STEP(0);
|
||||||
|
STEP(1); STEP(2); STEP(3); STEP(4);
|
||||||
|
STEP(5); STEP(6); STEP(7); STEP(8);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (k = 9; k--; L_ACF[k] <<= 1) ;
|
||||||
|
|
||||||
|
}
|
||||||
|
/* Rescaling of the array s[0..159]
|
||||||
|
*/
|
||||||
|
if (scalauto > 0) {
|
||||||
|
assert(scalauto <= 4);
|
||||||
|
for (k = 160; k--; *s++ <<= scalauto) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(USE_FLOAT_MUL) && defined(FAST)
|
||||||
|
|
||||||
|
static void Fast_Autocorrelation P2((s, L_ACF),
|
||||||
|
word * s, /* [0..159] IN/OUT */
|
||||||
|
longword * L_ACF) /* [0..8] OUT */
|
||||||
|
{
|
||||||
|
register int k, i;
|
||||||
|
float f_L_ACF[9];
|
||||||
|
float scale;
|
||||||
|
|
||||||
|
float s_f[160];
|
||||||
|
register float *sf = s_f;
|
||||||
|
|
||||||
|
for (i = 0; i < 160; ++i) sf[i] = s[i];
|
||||||
|
for (k = 0; k <= 8; k++) {
|
||||||
|
register float L_temp2 = 0;
|
||||||
|
register float *sfl = sf - k;
|
||||||
|
for (i = k; i < 160; ++i) L_temp2 += sf[i] * sfl[i];
|
||||||
|
f_L_ACF[k] = L_temp2;
|
||||||
|
}
|
||||||
|
scale = MAX_LONGWORD / f_L_ACF[0];
|
||||||
|
|
||||||
|
for (k = 0; k <= 8; k++) {
|
||||||
|
L_ACF[k] = f_L_ACF[k] * scale;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif /* defined (USE_FLOAT_MUL) && defined (FAST) */
|
||||||
|
|
||||||
|
/* 4.2.5 */
|
||||||
|
|
||||||
|
static void Reflection_coefficients P2( (L_ACF, r),
|
||||||
|
longword * L_ACF, /* 0...8 IN */
|
||||||
|
register word * r /* 0...7 OUT */
|
||||||
|
)
|
||||||
|
{
|
||||||
|
register int i, m, n;
|
||||||
|
register word temp;
|
||||||
|
register longword ltmp;
|
||||||
|
word ACF[9]; /* 0..8 */
|
||||||
|
word P[ 9]; /* 0..8 */
|
||||||
|
word K[ 9]; /* 2..8 */
|
||||||
|
|
||||||
|
/* Schur recursion with 16 bits arithmetic.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (L_ACF[0] == 0) {
|
||||||
|
for (i = 8; i--; *r++ = 0) ;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
assert( L_ACF[0] != 0 );
|
||||||
|
temp = gsm_norm( L_ACF[0] );
|
||||||
|
|
||||||
|
assert(temp >= 0 && temp < 32);
|
||||||
|
|
||||||
|
/* ? overflow ? */
|
||||||
|
for (i = 0; i <= 8; i++) ACF[i] = SASR( L_ACF[i] << temp, 16 );
|
||||||
|
|
||||||
|
/* Initialize array P[..] and K[..] for the recursion.
|
||||||
|
*/
|
||||||
|
|
||||||
|
for (i = 1; i <= 7; i++) K[ i ] = ACF[ i ];
|
||||||
|
for (i = 0; i <= 8; i++) P[ i ] = ACF[ i ];
|
||||||
|
|
||||||
|
/* Compute reflection coefficients
|
||||||
|
*/
|
||||||
|
for (n = 1; n <= 8; n++, r++) {
|
||||||
|
|
||||||
|
temp = P[1];
|
||||||
|
temp = GSM_ABS(temp);
|
||||||
|
if (P[0] < temp) {
|
||||||
|
for (i = n; i <= 8; i++) *r++ = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
*r = gsm_div( temp, P[0] );
|
||||||
|
|
||||||
|
assert(*r >= 0);
|
||||||
|
if (P[1] > 0) *r = -*r; /* r[n] = sub(0, r[n]) */
|
||||||
|
assert (*r != MIN_WORD);
|
||||||
|
if (n == 8) return;
|
||||||
|
|
||||||
|
/* Schur recursion
|
||||||
|
*/
|
||||||
|
temp = GSM_MULT_R( P[1], *r );
|
||||||
|
P[0] = GSM_ADD( P[0], temp );
|
||||||
|
|
||||||
|
for (m = 1; m <= 8 - n; m++) {
|
||||||
|
temp = GSM_MULT_R( K[ m ], *r );
|
||||||
|
P[m] = GSM_ADD( P[ m+1 ], temp );
|
||||||
|
|
||||||
|
temp = GSM_MULT_R( P[ m+1 ], *r );
|
||||||
|
K[m] = GSM_ADD( K[ m ], temp );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 4.2.6 */
|
||||||
|
|
||||||
|
static void Transformation_to_Log_Area_Ratios P1((r),
|
||||||
|
register word * r /* 0..7 IN/OUT */
|
||||||
|
)
|
||||||
|
/*
|
||||||
|
* The following scaling for r[..] and LAR[..] has been used:
|
||||||
|
*
|
||||||
|
* r[..] = integer( real_r[..]*32768. ); -1 <= real_r < 1.
|
||||||
|
* LAR[..] = integer( real_LAR[..] * 16384 );
|
||||||
|
* with -1.625 <= real_LAR <= 1.625
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
register word temp;
|
||||||
|
register int i;
|
||||||
|
|
||||||
|
|
||||||
|
/* Computation of the LAR[0..7] from the r[0..7]
|
||||||
|
*/
|
||||||
|
for (i = 1; i <= 8; i++, r++) {
|
||||||
|
|
||||||
|
temp = *r;
|
||||||
|
temp = GSM_ABS(temp);
|
||||||
|
assert(temp >= 0);
|
||||||
|
|
||||||
|
if (temp < 22118) {
|
||||||
|
temp >>= 1;
|
||||||
|
} else if (temp < 31130) {
|
||||||
|
assert( temp >= 11059 );
|
||||||
|
temp -= 11059;
|
||||||
|
} else {
|
||||||
|
assert( temp >= 26112 );
|
||||||
|
temp -= 26112;
|
||||||
|
temp <<= 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
*r = *r < 0 ? -temp : temp;
|
||||||
|
assert( *r != MIN_WORD );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 4.2.7 */
|
||||||
|
|
||||||
|
static void Quantization_and_coding P1((LAR),
|
||||||
|
register word * LAR /* [0..7] IN/OUT */
|
||||||
|
)
|
||||||
|
{
|
||||||
|
register word temp;
|
||||||
|
longword ltmp;
|
||||||
|
|
||||||
|
|
||||||
|
/* This procedure needs four tables; the following equations
|
||||||
|
* give the optimum scaling for the constants:
|
||||||
|
*
|
||||||
|
* A[0..7] = integer( real_A[0..7] * 1024 )
|
||||||
|
* B[0..7] = integer( real_B[0..7] * 512 )
|
||||||
|
* MAC[0..7] = maximum of the LARc[0..7]
|
||||||
|
* MIC[0..7] = minimum of the LARc[0..7]
|
||||||
|
*/
|
||||||
|
|
||||||
|
# undef STEP
|
||||||
|
# define STEP( A, B, MAC, MIC ) \
|
||||||
|
temp = GSM_MULT( A, *LAR ); \
|
||||||
|
temp = GSM_ADD( temp, B ); \
|
||||||
|
temp = GSM_ADD( temp, 256 ); \
|
||||||
|
temp = SASR( temp, 9 ); \
|
||||||
|
*LAR = temp>MAC ? MAC - MIC : (temp<MIC ? 0 : temp - MIC); \
|
||||||
|
LAR++;
|
||||||
|
|
||||||
|
STEP( 20480, 0, 31, -32 );
|
||||||
|
STEP( 20480, 0, 31, -32 );
|
||||||
|
STEP( 20480, 2048, 15, -16 );
|
||||||
|
STEP( 20480, -2560, 15, -16 );
|
||||||
|
|
||||||
|
STEP( 13964, 94, 7, -8 );
|
||||||
|
STEP( 15360, -1792, 7, -8 );
|
||||||
|
STEP( 8534, -341, 3, -4 );
|
||||||
|
STEP( 9036, -1144, 3, -4 );
|
||||||
|
|
||||||
|
# undef STEP
|
||||||
|
}
|
||||||
|
|
||||||
|
void Gsm_LPC_Analysis P3((S, s,LARc),
|
||||||
|
struct gsm_state *S,
|
||||||
|
word * s, /* 0..159 signals IN/OUT */
|
||||||
|
word * LARc) /* 0..7 LARc's OUT */
|
||||||
|
{
|
||||||
|
longword L_ACF[9];
|
||||||
|
|
||||||
|
#if defined(USE_FLOAT_MUL) && defined(FAST)
|
||||||
|
if (S->fast) Fast_Autocorrelation (s, L_ACF );
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
Autocorrelation (s, L_ACF );
|
||||||
|
Reflection_coefficients (L_ACF, LARc );
|
||||||
|
Transformation_to_Log_Area_Ratios (LARc);
|
||||||
|
Quantization_and_coding (LARc);
|
||||||
|
}
|
||||||
@@ -0,0 +1,113 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
|
||||||
|
* Universitaet Berlin. See the accompanying file "COPYRIGHT" for
|
||||||
|
* details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* $Header: /tmp_amd/presto/export/kbs/jutta/src/gsm/RCS/preprocess.c,v 1.2 1994/05/10 20:18:45 jutta Exp $ */
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
#include "private.h"
|
||||||
|
|
||||||
|
#include "gsm.h"
|
||||||
|
#include "proto.h"
|
||||||
|
|
||||||
|
/* 4.2.0 .. 4.2.3 PREPROCESSING SECTION
|
||||||
|
*
|
||||||
|
* After A-law to linear conversion (or directly from the
|
||||||
|
* Ato D converter) the following scaling is assumed for
|
||||||
|
* input to the RPE-LTP algorithm:
|
||||||
|
*
|
||||||
|
* in: 0.1.....................12
|
||||||
|
* S.v.v.v.v.v.v.v.v.v.v.v.v.*.*.*
|
||||||
|
*
|
||||||
|
* Where S is the sign bit, v a valid bit, and * a "don't care" bit.
|
||||||
|
* The original signal is called sop[..]
|
||||||
|
*
|
||||||
|
* out: 0.1................... 12
|
||||||
|
* S.S.v.v.v.v.v.v.v.v.v.v.v.v.0.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
void Gsm_Preprocess P3((S, s, so),
|
||||||
|
struct gsm_state * S,
|
||||||
|
word * s,
|
||||||
|
word * so ) /* [0..159] IN/OUT */
|
||||||
|
{
|
||||||
|
|
||||||
|
word z1 = S->z1;
|
||||||
|
longword L_z2 = S->L_z2;
|
||||||
|
word mp = S->mp;
|
||||||
|
|
||||||
|
word s1;
|
||||||
|
longword L_s2;
|
||||||
|
|
||||||
|
longword L_temp;
|
||||||
|
|
||||||
|
word msp, lsp;
|
||||||
|
word SO;
|
||||||
|
|
||||||
|
longword ltmp; /* for ADD */
|
||||||
|
ulongword utmp; /* for L_ADD */
|
||||||
|
|
||||||
|
register int k = 160;
|
||||||
|
|
||||||
|
while (k--) {
|
||||||
|
|
||||||
|
/* 4.2.1 Downscaling of the input signal
|
||||||
|
*/
|
||||||
|
SO = SASR( *s, 3 ) << 2;
|
||||||
|
s++;
|
||||||
|
|
||||||
|
assert (SO >= -0x4000); /* downscaled by */
|
||||||
|
assert (SO <= 0x3FFC); /* previous routine. */
|
||||||
|
|
||||||
|
|
||||||
|
/* 4.2.2 Offset compensation
|
||||||
|
*
|
||||||
|
* This part implements a high-pass filter and requires extended
|
||||||
|
* arithmetic precision for the recursive part of this filter.
|
||||||
|
* The input of this procedure is the array so[0...159] and the
|
||||||
|
* output the array sof[ 0...159 ].
|
||||||
|
*/
|
||||||
|
/* Compute the non-recursive part
|
||||||
|
*/
|
||||||
|
|
||||||
|
s1 = SO - z1; /* s1 = gsm_sub( *so, z1 ); */
|
||||||
|
z1 = SO;
|
||||||
|
|
||||||
|
assert(s1 != MIN_WORD);
|
||||||
|
|
||||||
|
/* Compute the recursive part
|
||||||
|
*/
|
||||||
|
L_s2 = s1;
|
||||||
|
L_s2 <<= 15;
|
||||||
|
|
||||||
|
/* Execution of a 31 bv 16 bits multiplication
|
||||||
|
*/
|
||||||
|
|
||||||
|
msp = SASR( L_z2, 15 );
|
||||||
|
lsp = L_z2-((longword)msp<<15); /* gsm_L_sub(L_z2,(msp<<15)); */
|
||||||
|
|
||||||
|
L_s2 += GSM_MULT_R( lsp, 32735 );
|
||||||
|
L_temp = (longword)msp * 32735; /* GSM_L_MULT(msp,32735) >> 1;*/
|
||||||
|
L_z2 = GSM_L_ADD( L_temp, L_s2 );
|
||||||
|
|
||||||
|
/* Compute sof[k] with rounding
|
||||||
|
*/
|
||||||
|
L_temp = GSM_L_ADD( L_z2, 16384 );
|
||||||
|
|
||||||
|
/* 4.2.3 Preemphasis
|
||||||
|
*/
|
||||||
|
|
||||||
|
msp = GSM_MULT_R( mp, -28180 );
|
||||||
|
mp = SASR( L_temp, 15 );
|
||||||
|
*so++ = GSM_ADD( mp, msp );
|
||||||
|
}
|
||||||
|
|
||||||
|
S->z1 = z1;
|
||||||
|
S->L_z2 = L_z2;
|
||||||
|
S->mp = mp;
|
||||||
|
}
|
||||||
@@ -0,0 +1,488 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
|
||||||
|
* Universitaet Berlin. See the accompanying file "COPYRIGHT" for
|
||||||
|
* details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* $Header: /tmp_amd/presto/export/kbs/jutta/src/gsm/RCS/rpe.c,v 1.3 1994/05/10 20:18:46 jutta Exp $ */
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
#include "private.h"
|
||||||
|
|
||||||
|
#include "gsm.h"
|
||||||
|
#include "proto.h"
|
||||||
|
|
||||||
|
/* 4.2.13 .. 4.2.17 RPE ENCODING SECTION
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* 4.2.13 */
|
||||||
|
|
||||||
|
static void Weighting_filter P2((e, x),
|
||||||
|
register word * e, /* signal [-5..0.39.44] IN */
|
||||||
|
word * x /* signal [0..39] OUT */
|
||||||
|
)
|
||||||
|
/*
|
||||||
|
* The coefficients of the weighting filter are stored in a table
|
||||||
|
* (see table 4.4). The following scaling is used:
|
||||||
|
*
|
||||||
|
* H[0..10] = integer( real_H[ 0..10] * 8192 );
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
/* word wt[ 50 ]; */
|
||||||
|
|
||||||
|
register longword L_result;
|
||||||
|
register int k /* , i */ ;
|
||||||
|
|
||||||
|
/* Initialization of a temporary working array wt[0...49]
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* for (k = 0; k <= 4; k++) wt[k] = 0;
|
||||||
|
* for (k = 5; k <= 44; k++) wt[k] = *e++;
|
||||||
|
* for (k = 45; k <= 49; k++) wt[k] = 0;
|
||||||
|
*
|
||||||
|
* (e[-5..-1] and e[40..44] are allocated by the caller,
|
||||||
|
* are initially zero and are not written anywhere.)
|
||||||
|
*/
|
||||||
|
e -= 5;
|
||||||
|
|
||||||
|
/* Compute the signal x[0..39]
|
||||||
|
*/
|
||||||
|
for (k = 0; k <= 39; k++) {
|
||||||
|
|
||||||
|
L_result = 8192 >> 1;
|
||||||
|
|
||||||
|
/* for (i = 0; i <= 10; i++) {
|
||||||
|
* L_temp = GSM_L_MULT( wt[k+i], gsm_H[i] );
|
||||||
|
* L_result = GSM_L_ADD( L_result, L_temp );
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
|
||||||
|
#undef STEP
|
||||||
|
#define STEP( i, H ) (e[ k + i ] * (longword)H)
|
||||||
|
|
||||||
|
/* Every one of these multiplications is done twice --
|
||||||
|
* but I don't see an elegant way to optimize this.
|
||||||
|
* Do you?
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef STUPID_COMPILER
|
||||||
|
L_result += STEP( 0, -134 ) ;
|
||||||
|
L_result += STEP( 1, -374 ) ;
|
||||||
|
/* + STEP( 2, 0 ) */
|
||||||
|
L_result += STEP( 3, 2054 ) ;
|
||||||
|
L_result += STEP( 4, 5741 ) ;
|
||||||
|
L_result += STEP( 5, 8192 ) ;
|
||||||
|
L_result += STEP( 6, 5741 ) ;
|
||||||
|
L_result += STEP( 7, 2054 ) ;
|
||||||
|
/* + STEP( 8, 0 ) */
|
||||||
|
L_result += STEP( 9, -374 ) ;
|
||||||
|
L_result += STEP( 10, -134 ) ;
|
||||||
|
#else
|
||||||
|
L_result +=
|
||||||
|
STEP( 0, -134 )
|
||||||
|
+ STEP( 1, -374 )
|
||||||
|
/* + STEP( 2, 0 ) */
|
||||||
|
+ STEP( 3, 2054 )
|
||||||
|
+ STEP( 4, 5741 )
|
||||||
|
+ STEP( 5, 8192 )
|
||||||
|
+ STEP( 6, 5741 )
|
||||||
|
+ STEP( 7, 2054 )
|
||||||
|
/* + STEP( 8, 0 ) */
|
||||||
|
+ STEP( 9, -374 )
|
||||||
|
+ STEP(10, -134 )
|
||||||
|
;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* L_result = GSM_L_ADD( L_result, L_result ); (* scaling(x2) *)
|
||||||
|
* L_result = GSM_L_ADD( L_result, L_result ); (* scaling(x4) *)
|
||||||
|
*
|
||||||
|
* x[k] = SASR( L_result, 16 );
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* 2 adds vs. >>16 => 14, minus one shift to compensate for
|
||||||
|
* those we lost when replacing L_MULT by '*'.
|
||||||
|
*/
|
||||||
|
|
||||||
|
L_result = SASR( L_result, 13 );
|
||||||
|
x[k] = ( L_result < MIN_WORD ? MIN_WORD
|
||||||
|
: (L_result > MAX_WORD ? MAX_WORD : L_result ));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 4.2.14 */
|
||||||
|
|
||||||
|
static void RPE_grid_selection P3((x,xM,Mc_out),
|
||||||
|
word * x, /* [0..39] IN */
|
||||||
|
word * xM, /* [0..12] OUT */
|
||||||
|
word * Mc_out /* OUT */
|
||||||
|
)
|
||||||
|
/*
|
||||||
|
* The signal x[0..39] is used to select the RPE grid which is
|
||||||
|
* represented by Mc.
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
/* register word temp1; */
|
||||||
|
register int /* m, */ i;
|
||||||
|
register longword L_result, L_temp;
|
||||||
|
longword EM; /* xxx should be L_EM? */
|
||||||
|
word Mc;
|
||||||
|
|
||||||
|
longword L_common_0_3;
|
||||||
|
|
||||||
|
EM = 0;
|
||||||
|
Mc = 0;
|
||||||
|
|
||||||
|
/* for (m = 0; m <= 3; m++) {
|
||||||
|
* L_result = 0;
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* for (i = 0; i <= 12; i++) {
|
||||||
|
*
|
||||||
|
* temp1 = SASR( x[m + 3*i], 2 );
|
||||||
|
*
|
||||||
|
* assert(temp1 != MIN_WORD);
|
||||||
|
*
|
||||||
|
* L_temp = GSM_L_MULT( temp1, temp1 );
|
||||||
|
* L_result = GSM_L_ADD( L_temp, L_result );
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* if (L_result > EM) {
|
||||||
|
* Mc = m;
|
||||||
|
* EM = L_result;
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
|
||||||
|
#undef STEP
|
||||||
|
#define STEP( m, i ) L_temp = SASR( x[m + 3 * i], 2 ); \
|
||||||
|
L_result += L_temp * L_temp;
|
||||||
|
|
||||||
|
/* common part of 0 and 3 */
|
||||||
|
|
||||||
|
L_result = 0;
|
||||||
|
STEP( 0, 1 ); STEP( 0, 2 ); STEP( 0, 3 ); STEP( 0, 4 );
|
||||||
|
STEP( 0, 5 ); STEP( 0, 6 ); STEP( 0, 7 ); STEP( 0, 8 );
|
||||||
|
STEP( 0, 9 ); STEP( 0, 10); STEP( 0, 11); STEP( 0, 12);
|
||||||
|
L_common_0_3 = L_result;
|
||||||
|
|
||||||
|
/* i = 0 */
|
||||||
|
|
||||||
|
STEP( 0, 0 );
|
||||||
|
L_result <<= 1; /* implicit in L_MULT */
|
||||||
|
EM = L_result;
|
||||||
|
|
||||||
|
/* i = 1 */
|
||||||
|
|
||||||
|
L_result = 0;
|
||||||
|
STEP( 1, 0 );
|
||||||
|
STEP( 1, 1 ); STEP( 1, 2 ); STEP( 1, 3 ); STEP( 1, 4 );
|
||||||
|
STEP( 1, 5 ); STEP( 1, 6 ); STEP( 1, 7 ); STEP( 1, 8 );
|
||||||
|
STEP( 1, 9 ); STEP( 1, 10); STEP( 1, 11); STEP( 1, 12);
|
||||||
|
L_result <<= 1;
|
||||||
|
if (L_result > EM) {
|
||||||
|
Mc = 1;
|
||||||
|
EM = L_result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* i = 2 */
|
||||||
|
|
||||||
|
L_result = 0;
|
||||||
|
STEP( 2, 0 );
|
||||||
|
STEP( 2, 1 ); STEP( 2, 2 ); STEP( 2, 3 ); STEP( 2, 4 );
|
||||||
|
STEP( 2, 5 ); STEP( 2, 6 ); STEP( 2, 7 ); STEP( 2, 8 );
|
||||||
|
STEP( 2, 9 ); STEP( 2, 10); STEP( 2, 11); STEP( 2, 12);
|
||||||
|
L_result <<= 1;
|
||||||
|
if (L_result > EM) {
|
||||||
|
Mc = 2;
|
||||||
|
EM = L_result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* i = 3 */
|
||||||
|
|
||||||
|
L_result = L_common_0_3;
|
||||||
|
STEP( 3, 12 );
|
||||||
|
L_result <<= 1;
|
||||||
|
if (L_result > EM) {
|
||||||
|
Mc = 3;
|
||||||
|
EM = L_result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**/
|
||||||
|
|
||||||
|
/* Down-sampling by a factor 3 to get the selected xM[0..12]
|
||||||
|
* RPE sequence.
|
||||||
|
*/
|
||||||
|
for (i = 0; i <= 12; i ++) xM[i] = x[Mc + 3*i];
|
||||||
|
*Mc_out = Mc;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 4.12.15 */
|
||||||
|
|
||||||
|
static void APCM_quantization_xmaxc_to_exp_mant P3((xmaxc,exp_out,mant_out),
|
||||||
|
word xmaxc, /* IN */
|
||||||
|
word * exp_out, /* OUT */
|
||||||
|
word * mant_out ) /* OUT */
|
||||||
|
{
|
||||||
|
word exp, mant;
|
||||||
|
|
||||||
|
/* Compute exponent and mantissa of the decoded version of xmaxc
|
||||||
|
*/
|
||||||
|
|
||||||
|
exp = 0;
|
||||||
|
if (xmaxc > 15) exp = SASR(xmaxc, 3) - 1;
|
||||||
|
mant = xmaxc - (exp << 3);
|
||||||
|
|
||||||
|
if (mant == 0) {
|
||||||
|
exp = -4;
|
||||||
|
mant = 7;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
while (mant <= 7) {
|
||||||
|
mant = mant << 1 | 1;
|
||||||
|
exp--;
|
||||||
|
}
|
||||||
|
mant -= 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
assert( exp >= -4 && exp <= 6 );
|
||||||
|
assert( mant >= 0 && mant <= 7 );
|
||||||
|
|
||||||
|
*exp_out = exp;
|
||||||
|
*mant_out = mant;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void APCM_quantization P5((xM,xMc,mant_out,exp_out,xmaxc_out),
|
||||||
|
word * xM, /* [0..12] IN */
|
||||||
|
|
||||||
|
word * xMc, /* [0..12] OUT */
|
||||||
|
word * mant_out, /* OUT */
|
||||||
|
word * exp_out, /* OUT */
|
||||||
|
word * xmaxc_out /* OUT */
|
||||||
|
)
|
||||||
|
{
|
||||||
|
int i, itest;
|
||||||
|
|
||||||
|
word xmax, xmaxc, temp, temp1, temp2;
|
||||||
|
word exp, mant;
|
||||||
|
|
||||||
|
|
||||||
|
/* Find the maximum absolute value xmax of xM[0..12].
|
||||||
|
*/
|
||||||
|
|
||||||
|
xmax = 0;
|
||||||
|
for (i = 0; i <= 12; i++) {
|
||||||
|
temp = xM[i];
|
||||||
|
temp = GSM_ABS(temp);
|
||||||
|
if (temp > xmax) xmax = temp;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Qantizing and coding of xmax to get xmaxc.
|
||||||
|
*/
|
||||||
|
|
||||||
|
exp = 0;
|
||||||
|
temp = SASR( xmax, 9 );
|
||||||
|
itest = 0;
|
||||||
|
|
||||||
|
for (i = 0; i <= 5; i++) {
|
||||||
|
|
||||||
|
itest |= (temp <= 0);
|
||||||
|
temp = SASR( temp, 1 );
|
||||||
|
|
||||||
|
assert(exp <= 5);
|
||||||
|
if (itest == 0) exp++; /* exp = add (exp, 1) */
|
||||||
|
}
|
||||||
|
|
||||||
|
assert(exp <= 6 && exp >= 0);
|
||||||
|
temp = exp + 5;
|
||||||
|
|
||||||
|
assert(temp <= 11 && temp >= 0);
|
||||||
|
xmaxc = gsm_add( SASR(xmax, temp), exp << 3 );
|
||||||
|
|
||||||
|
/* Quantizing and coding of the xM[0..12] RPE sequence
|
||||||
|
* to get the xMc[0..12]
|
||||||
|
*/
|
||||||
|
|
||||||
|
APCM_quantization_xmaxc_to_exp_mant( xmaxc, &exp, &mant );
|
||||||
|
|
||||||
|
/* This computation uses the fact that the decoded version of xmaxc
|
||||||
|
* can be calculated by using the exponent and the mantissa part of
|
||||||
|
* xmaxc (logarithmic table).
|
||||||
|
* So, this method avoids any division and uses only a scaling
|
||||||
|
* of the RPE samples by a function of the exponent. A direct
|
||||||
|
* multiplication by the inverse of the mantissa (NRFAC[0..7]
|
||||||
|
* found in table 4.5) gives the 3 bit coded version xMc[0..12]
|
||||||
|
* of the RPE samples.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/* Direct computation of xMc[0..12] using table 4.5
|
||||||
|
*/
|
||||||
|
|
||||||
|
assert( exp <= 4096 && exp >= -4096);
|
||||||
|
assert( mant >= 0 && mant <= 7 );
|
||||||
|
|
||||||
|
temp1 = 6 - exp; /* normalization by the exponent */
|
||||||
|
temp2 = gsm_NRFAC[ mant ]; /* inverse mantissa */
|
||||||
|
|
||||||
|
for (i = 0; i <= 12; i++) {
|
||||||
|
|
||||||
|
assert(temp1 >= 0 && temp1 < 16);
|
||||||
|
|
||||||
|
temp = xM[i] << temp1;
|
||||||
|
temp = GSM_MULT( temp, temp2 );
|
||||||
|
temp = SASR(temp, 12);
|
||||||
|
xMc[i] = temp + 4; /* see note below */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* NOTE: This equation is used to make all the xMc[i] positive.
|
||||||
|
*/
|
||||||
|
|
||||||
|
*mant_out = mant;
|
||||||
|
*exp_out = exp;
|
||||||
|
*xmaxc_out = xmaxc;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 4.2.16 */
|
||||||
|
|
||||||
|
static void APCM_inverse_quantization P4((xMc,mant,exp,xMp),
|
||||||
|
register word * xMc, /* [0..12] IN */
|
||||||
|
word mant,
|
||||||
|
word exp,
|
||||||
|
register word * xMp) /* [0..12] OUT */
|
||||||
|
/*
|
||||||
|
* This part is for decoding the RPE sequence of coded xMc[0..12]
|
||||||
|
* samples to obtain the xMp[0..12] array. Table 4.6 is used to get
|
||||||
|
* the mantissa of xmaxc (FAC[0..7]).
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
word temp, temp1, temp2, temp3;
|
||||||
|
longword ltmp;
|
||||||
|
|
||||||
|
assert( mant >= 0 && mant <= 7 );
|
||||||
|
|
||||||
|
temp1 = gsm_FAC[ mant ]; /* see 4.2-15 for mant */
|
||||||
|
temp2 = gsm_sub( 6, exp ); /* see 4.2-15 for exp */
|
||||||
|
temp3 = gsm_asl( 1, gsm_sub( temp2, 1 ));
|
||||||
|
|
||||||
|
for (i = 13; i--;) {
|
||||||
|
|
||||||
|
assert( *xMc <= 7 && *xMc >= 0 ); /* 3 bit unsigned */
|
||||||
|
|
||||||
|
/* temp = gsm_sub( *xMc++ << 1, 7 ); */
|
||||||
|
temp = (*xMc++ << 1) - 7; /* restore sign */
|
||||||
|
assert( temp <= 7 && temp >= -7 ); /* 4 bit signed */
|
||||||
|
|
||||||
|
temp <<= 12; /* 16 bit signed */
|
||||||
|
temp = GSM_MULT_R( temp1, temp );
|
||||||
|
temp = GSM_ADD( temp, temp3 );
|
||||||
|
*xMp++ = gsm_asr( temp, temp2 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 4.2.17 */
|
||||||
|
|
||||||
|
static void RPE_grid_positioning P3((Mc,xMp,ep),
|
||||||
|
word Mc, /* grid position IN */
|
||||||
|
register word * xMp, /* [0..12] IN */
|
||||||
|
register word * ep /* [0..39] OUT */
|
||||||
|
)
|
||||||
|
/*
|
||||||
|
* This procedure computes the reconstructed long term residual signal
|
||||||
|
* ep[0..39] for the LTP analysis filter. The inputs are the Mc
|
||||||
|
* which is the grid position selection and the xMp[0..12] decoded
|
||||||
|
* RPE samples which are upsampled by a factor of 3 by inserting zero
|
||||||
|
* values.
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
int i = 13;
|
||||||
|
|
||||||
|
assert(0 <= Mc && Mc <= 3);
|
||||||
|
|
||||||
|
switch (Mc) {
|
||||||
|
case 3: *ep++ = 0;
|
||||||
|
case 2: do {
|
||||||
|
*ep++ = 0;
|
||||||
|
case 1: *ep++ = 0;
|
||||||
|
case 0: *ep++ = *xMp++;
|
||||||
|
} while (--i);
|
||||||
|
}
|
||||||
|
while (++Mc < 4) *ep++ = 0;
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
int i, k;
|
||||||
|
for (k = 0; k <= 39; k++) ep[k] = 0;
|
||||||
|
for (i = 0; i <= 12; i++) {
|
||||||
|
ep[ Mc + (3*i) ] = xMp[i];
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 4.2.18 */
|
||||||
|
|
||||||
|
/* This procedure adds the reconstructed long term residual signal
|
||||||
|
* ep[0..39] to the estimated signal dpp[0..39] from the long term
|
||||||
|
* analysis filter to compute the reconstructed short term residual
|
||||||
|
* signal dp[-40..-1]; also the reconstructed short term residual
|
||||||
|
* array dp[-120..-41] is updated.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if 0 /* Has been inlined in code.c */
|
||||||
|
void Gsm_Update_of_reconstructed_short_time_residual_signal P3((dpp, ep, dp),
|
||||||
|
word * dpp, /* [0...39] IN */
|
||||||
|
word * ep, /* [0...39] IN */
|
||||||
|
word * dp) /* [-120...-1] IN/OUT */
|
||||||
|
{
|
||||||
|
int k;
|
||||||
|
|
||||||
|
for (k = 0; k <= 79; k++)
|
||||||
|
dp[ -120 + k ] = dp[ -80 + k ];
|
||||||
|
|
||||||
|
for (k = 0; k <= 39; k++)
|
||||||
|
dp[ -40 + k ] = gsm_add( ep[k], dpp[k] );
|
||||||
|
}
|
||||||
|
#endif /* Has been inlined in code.c */
|
||||||
|
|
||||||
|
void Gsm_RPE_Encoding P5((S,e,xmaxc,Mc,xMc),
|
||||||
|
|
||||||
|
struct gsm_state * S,
|
||||||
|
|
||||||
|
word * e, /* -5..-1][0..39][40..44 IN/OUT */
|
||||||
|
word * xmaxc, /* OUT */
|
||||||
|
word * Mc, /* OUT */
|
||||||
|
word * xMc) /* [0..12] OUT */
|
||||||
|
{
|
||||||
|
word x[40];
|
||||||
|
word xM[13], xMp[13];
|
||||||
|
word mant, exp;
|
||||||
|
|
||||||
|
Weighting_filter(e, x);
|
||||||
|
RPE_grid_selection(x, xM, Mc);
|
||||||
|
|
||||||
|
APCM_quantization( xM, xMc, &mant, &exp, xmaxc);
|
||||||
|
APCM_inverse_quantization( xMc, mant, exp, xMp);
|
||||||
|
|
||||||
|
RPE_grid_positioning( *Mc, xMp, e );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Gsm_RPE_Decoding P5((S, xmaxcr, Mcr, xMcr, erp),
|
||||||
|
struct gsm_state * S,
|
||||||
|
|
||||||
|
word xmaxcr,
|
||||||
|
word Mcr,
|
||||||
|
word * xMcr, /* [0..12], 3 bits IN */
|
||||||
|
word * erp /* [0..39] OUT */
|
||||||
|
)
|
||||||
|
{
|
||||||
|
word exp, mant;
|
||||||
|
word xMp[ 13 ];
|
||||||
|
|
||||||
|
APCM_quantization_xmaxc_to_exp_mant( xmaxcr, &exp, &mant );
|
||||||
|
APCM_inverse_quantization( xMcr, mant, exp, xMp );
|
||||||
|
RPE_grid_positioning( Mcr, xMp, erp );
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,429 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
|
||||||
|
* Universitaet Berlin. See the accompanying file "COPYRIGHT" for
|
||||||
|
* details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* $Header: /tmp_amd/presto/export/kbs/jutta/src/gsm/RCS/short_term.c,v 1.2 1994/05/10 20:18:47 jutta Exp $ */
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
#include "private.h"
|
||||||
|
|
||||||
|
#include "gsm.h"
|
||||||
|
#include "proto.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* SHORT TERM ANALYSIS FILTERING SECTION
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* 4.2.8 */
|
||||||
|
|
||||||
|
static void Decoding_of_the_coded_Log_Area_Ratios P2((LARc,LARpp),
|
||||||
|
word * LARc, /* coded log area ratio [0..7] IN */
|
||||||
|
word * LARpp) /* out: decoded .. */
|
||||||
|
{
|
||||||
|
register word temp1 /* , temp2 */;
|
||||||
|
register long ltmp; /* for GSM_ADD */
|
||||||
|
|
||||||
|
/* This procedure requires for efficient implementation
|
||||||
|
* two tables.
|
||||||
|
*
|
||||||
|
* INVA[1..8] = integer( (32768 * 8) / real_A[1..8])
|
||||||
|
* MIC[1..8] = minimum value of the LARc[1..8]
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Compute the LARpp[1..8]
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* for (i = 1; i <= 8; i++, B++, MIC++, INVA++, LARc++, LARpp++) {
|
||||||
|
*
|
||||||
|
* temp1 = GSM_ADD( *LARc, *MIC ) << 10;
|
||||||
|
* temp2 = *B << 1;
|
||||||
|
* temp1 = GSM_SUB( temp1, temp2 );
|
||||||
|
*
|
||||||
|
* assert(*INVA != MIN_WORD);
|
||||||
|
*
|
||||||
|
* temp1 = GSM_MULT_R( *INVA, temp1 );
|
||||||
|
* *LARpp = GSM_ADD( temp1, temp1 );
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
|
||||||
|
#undef STEP
|
||||||
|
#define STEP( B, MIC, INVA ) \
|
||||||
|
temp1 = GSM_ADD( *LARc++, MIC ) << 10; \
|
||||||
|
temp1 = GSM_SUB( temp1, B << 1 ); \
|
||||||
|
temp1 = GSM_MULT_R( INVA, temp1 ); \
|
||||||
|
*LARpp++ = GSM_ADD( temp1, temp1 );
|
||||||
|
|
||||||
|
STEP( 0, -32, 13107 );
|
||||||
|
STEP( 0, -32, 13107 );
|
||||||
|
STEP( 2048, -16, 13107 );
|
||||||
|
STEP( -2560, -16, 13107 );
|
||||||
|
|
||||||
|
STEP( 94, -8, 19223 );
|
||||||
|
STEP( -1792, -8, 17476 );
|
||||||
|
STEP( -341, -4, 31454 );
|
||||||
|
STEP( -1144, -4, 29708 );
|
||||||
|
|
||||||
|
/* NOTE: the addition of *MIC is used to restore
|
||||||
|
* the sign of *LARc.
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 4.2.9 */
|
||||||
|
/* Computation of the quantized reflection coefficients
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* 4.2.9.1 Interpolation of the LARpp[1..8] to get the LARp[1..8]
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Within each frame of 160 analyzed speech samples the short term
|
||||||
|
* analysis and synthesis filters operate with four different sets of
|
||||||
|
* coefficients, derived from the previous set of decoded LARs(LARpp(j-1))
|
||||||
|
* and the actual set of decoded LARs (LARpp(j))
|
||||||
|
*
|
||||||
|
* (Initial value: LARpp(j-1)[1..8] = 0.)
|
||||||
|
*/
|
||||||
|
|
||||||
|
static void Coefficients_0_12 P3((LARpp_j_1, LARpp_j, LARp),
|
||||||
|
register word * LARpp_j_1,
|
||||||
|
register word * LARpp_j,
|
||||||
|
register word * LARp)
|
||||||
|
{
|
||||||
|
register int i;
|
||||||
|
register longword ltmp;
|
||||||
|
|
||||||
|
for (i = 1; i <= 8; i++, LARp++, LARpp_j_1++, LARpp_j++) {
|
||||||
|
*LARp = GSM_ADD( SASR( *LARpp_j_1, 2 ), SASR( *LARpp_j, 2 ));
|
||||||
|
*LARp = GSM_ADD( *LARp, SASR( *LARpp_j_1, 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Coefficients_13_26 P3((LARpp_j_1, LARpp_j, LARp),
|
||||||
|
register word * LARpp_j_1,
|
||||||
|
register word * LARpp_j,
|
||||||
|
register word * LARp)
|
||||||
|
{
|
||||||
|
register int i;
|
||||||
|
register longword ltmp;
|
||||||
|
for (i = 1; i <= 8; i++, LARpp_j_1++, LARpp_j++, LARp++) {
|
||||||
|
*LARp = GSM_ADD( SASR( *LARpp_j_1, 1), SASR( *LARpp_j, 1 ));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Coefficients_27_39 P3((LARpp_j_1, LARpp_j, LARp),
|
||||||
|
register word * LARpp_j_1,
|
||||||
|
register word * LARpp_j,
|
||||||
|
register word * LARp)
|
||||||
|
{
|
||||||
|
register int i;
|
||||||
|
register longword ltmp;
|
||||||
|
|
||||||
|
for (i = 1; i <= 8; i++, LARpp_j_1++, LARpp_j++, LARp++) {
|
||||||
|
*LARp = GSM_ADD( SASR( *LARpp_j_1, 2 ), SASR( *LARpp_j, 2 ));
|
||||||
|
*LARp = GSM_ADD( *LARp, SASR( *LARpp_j, 1 ));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void Coefficients_40_159 P2((LARpp_j, LARp),
|
||||||
|
register word * LARpp_j,
|
||||||
|
register word * LARp)
|
||||||
|
{
|
||||||
|
register int i;
|
||||||
|
|
||||||
|
for (i = 1; i <= 8; i++, LARp++, LARpp_j++)
|
||||||
|
*LARp = *LARpp_j;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 4.2.9.2 */
|
||||||
|
|
||||||
|
static void LARp_to_rp P1((LARp),
|
||||||
|
register word * LARp) /* [0..7] IN/OUT */
|
||||||
|
/*
|
||||||
|
* The input of this procedure is the interpolated LARp[0..7] array.
|
||||||
|
* The reflection coefficients, rp[i], are used in the analysis
|
||||||
|
* filter and in the synthesis filter.
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
register int i;
|
||||||
|
register word temp;
|
||||||
|
register longword ltmp;
|
||||||
|
|
||||||
|
for (i = 1; i <= 8; i++, LARp++) {
|
||||||
|
|
||||||
|
/* temp = GSM_ABS( *LARp );
|
||||||
|
*
|
||||||
|
* if (temp < 11059) temp <<= 1;
|
||||||
|
* else if (temp < 20070) temp += 11059;
|
||||||
|
* else temp = GSM_ADD( temp >> 2, 26112 );
|
||||||
|
*
|
||||||
|
* *LARp = *LARp < 0 ? -temp : temp;
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (*LARp < 0) {
|
||||||
|
temp = *LARp == MIN_WORD ? MAX_WORD : -(*LARp);
|
||||||
|
*LARp = - ((temp < 11059) ? temp << 1
|
||||||
|
: ((temp < 20070) ? temp + 11059
|
||||||
|
: GSM_ADD( temp >> 2, 26112 )));
|
||||||
|
} else {
|
||||||
|
temp = *LARp;
|
||||||
|
*LARp = (temp < 11059) ? temp << 1
|
||||||
|
: ((temp < 20070) ? temp + 11059
|
||||||
|
: GSM_ADD( temp >> 2, 26112 ));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* 4.2.10 */
|
||||||
|
static void Short_term_analysis_filtering P4((S,rp,k_n,s),
|
||||||
|
struct gsm_state * S,
|
||||||
|
register word * rp, /* [0..7] IN */
|
||||||
|
register int k_n, /* k_end - k_start */
|
||||||
|
register word * s /* [0..n-1] IN/OUT */
|
||||||
|
)
|
||||||
|
/*
|
||||||
|
* This procedure computes the short term residual signal d[..] to be fed
|
||||||
|
* to the RPE-LTP loop from the s[..] signal and from the local rp[..]
|
||||||
|
* array (quantized reflection coefficients). As the call of this
|
||||||
|
* procedure can be done in many ways (see the interpolation of the LAR
|
||||||
|
* coefficient), it is assumed that the computation begins with index
|
||||||
|
* k_start (for arrays d[..] and s[..]) and stops with index k_end
|
||||||
|
* (k_start and k_end are defined in 4.2.9.1). This procedure also
|
||||||
|
* needs to keep the array u[0..7] in memory for each call.
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
register word * u = S->u;
|
||||||
|
register int i;
|
||||||
|
register word di, zzz, ui, sav, rpi;
|
||||||
|
register longword ltmp;
|
||||||
|
|
||||||
|
for (; k_n--; s++) {
|
||||||
|
|
||||||
|
di = sav = *s;
|
||||||
|
|
||||||
|
for (i = 0; i < 8; i++) { /* YYY */
|
||||||
|
|
||||||
|
ui = u[i];
|
||||||
|
rpi = rp[i];
|
||||||
|
u[i] = sav;
|
||||||
|
|
||||||
|
zzz = GSM_MULT_R(rpi, di);
|
||||||
|
sav = GSM_ADD( ui, zzz);
|
||||||
|
|
||||||
|
zzz = GSM_MULT_R(rpi, ui);
|
||||||
|
di = GSM_ADD( di, zzz );
|
||||||
|
}
|
||||||
|
|
||||||
|
*s = di;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(USE_FLOAT_MUL) && defined(FAST)
|
||||||
|
|
||||||
|
static void Fast_Short_term_analysis_filtering P4((S,rp,k_n,s),
|
||||||
|
struct gsm_state * S,
|
||||||
|
register word * rp, /* [0..7] IN */
|
||||||
|
register int k_n, /* k_end - k_start */
|
||||||
|
register word * s /* [0..n-1] IN/OUT */
|
||||||
|
)
|
||||||
|
{
|
||||||
|
register word * u = S->u;
|
||||||
|
register int i;
|
||||||
|
|
||||||
|
float uf[8],
|
||||||
|
rpf[8];
|
||||||
|
|
||||||
|
register float scalef = 3.0517578125e-5;
|
||||||
|
register float sav, di, temp;
|
||||||
|
|
||||||
|
for (i = 0; i < 8; ++i) {
|
||||||
|
uf[i] = u[i];
|
||||||
|
rpf[i] = rp[i] * scalef;
|
||||||
|
}
|
||||||
|
for (; k_n--; s++) {
|
||||||
|
sav = di = *s;
|
||||||
|
for (i = 0; i < 8; ++i) {
|
||||||
|
register float rpfi = rpf[i];
|
||||||
|
register float ufi = uf[i];
|
||||||
|
|
||||||
|
uf[i] = sav;
|
||||||
|
temp = rpfi * di + ufi;
|
||||||
|
di += rpfi * ufi;
|
||||||
|
sav = temp;
|
||||||
|
}
|
||||||
|
*s = di;
|
||||||
|
}
|
||||||
|
for (i = 0; i < 8; ++i) u[i] = uf[i];
|
||||||
|
}
|
||||||
|
#endif /* ! (defined (USE_FLOAT_MUL) && defined (FAST)) */
|
||||||
|
|
||||||
|
static void Short_term_synthesis_filtering P5((S,rrp,k,wt,sr),
|
||||||
|
struct gsm_state * S,
|
||||||
|
register word * rrp, /* [0..7] IN */
|
||||||
|
register int k, /* k_end - k_start */
|
||||||
|
register word * wt, /* [0..k-1] IN */
|
||||||
|
register word * sr /* [0..k-1] OUT */
|
||||||
|
)
|
||||||
|
{
|
||||||
|
register word * v = S->v;
|
||||||
|
register int i;
|
||||||
|
register word sri, tmp1, tmp2;
|
||||||
|
register longword ltmp; /* for GSM_ADD & GSM_SUB */
|
||||||
|
|
||||||
|
while (k--) {
|
||||||
|
sri = *wt++;
|
||||||
|
for (i = 8; i--;) {
|
||||||
|
|
||||||
|
/* sri = GSM_SUB( sri, gsm_mult_r( rrp[i], v[i] ) );
|
||||||
|
*/
|
||||||
|
tmp1 = rrp[i];
|
||||||
|
tmp2 = v[i];
|
||||||
|
tmp2 = ( tmp1 == MIN_WORD && tmp2 == MIN_WORD
|
||||||
|
? MAX_WORD
|
||||||
|
: 0x0FFFF & (( (longword)tmp1 * (longword)tmp2
|
||||||
|
+ 16384) >> 15)) ;
|
||||||
|
|
||||||
|
sri = GSM_SUB( sri, tmp2 );
|
||||||
|
|
||||||
|
/* v[i+1] = GSM_ADD( v[i], gsm_mult_r( rrp[i], sri ) );
|
||||||
|
*/
|
||||||
|
tmp1 = ( tmp1 == MIN_WORD && sri == MIN_WORD
|
||||||
|
? MAX_WORD
|
||||||
|
: 0x0FFFF & (( (longword)tmp1 * (longword)sri
|
||||||
|
+ 16384) >> 15)) ;
|
||||||
|
|
||||||
|
v[i+1] = GSM_ADD( v[i], tmp1);
|
||||||
|
}
|
||||||
|
*sr++ = v[0] = sri;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(FAST) && defined(USE_FLOAT_MUL)
|
||||||
|
|
||||||
|
static void Fast_Short_term_synthesis_filtering P5((S,rrp,k,wt,sr),
|
||||||
|
struct gsm_state * S,
|
||||||
|
register word * rrp, /* [0..7] IN */
|
||||||
|
register int k, /* k_end - k_start */
|
||||||
|
register word * wt, /* [0..k-1] IN */
|
||||||
|
register word * sr /* [0..k-1] OUT */
|
||||||
|
)
|
||||||
|
{
|
||||||
|
register word * v = S->v;
|
||||||
|
register int i;
|
||||||
|
|
||||||
|
float va[9], rrpa[8];
|
||||||
|
register float scalef = 3.0517578125e-5, temp;
|
||||||
|
|
||||||
|
for (i = 0; i < 8; ++i) {
|
||||||
|
va[i] = v[i];
|
||||||
|
rrpa[i] = (float)rrp[i] * scalef;
|
||||||
|
}
|
||||||
|
while (k--) {
|
||||||
|
register float sri = *wt++;
|
||||||
|
for (i = 8; i--;) {
|
||||||
|
sri -= rrpa[i] * va[i];
|
||||||
|
if (sri < -32768.) sri = -32768.;
|
||||||
|
else if (sri > 32767.) sri = 32767.;
|
||||||
|
|
||||||
|
temp = va[i] + rrpa[i] * sri;
|
||||||
|
if (temp < -32768.) temp = -32768.;
|
||||||
|
else if (temp > 32767.) temp = 32767.;
|
||||||
|
va[i+1] = temp;
|
||||||
|
}
|
||||||
|
*sr++ = va[0] = sri;
|
||||||
|
}
|
||||||
|
for (i = 0; i < 9; ++i) v[i] = va[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* defined(FAST) && defined(USE_FLOAT_MUL) */
|
||||||
|
|
||||||
|
void Gsm_Short_Term_Analysis_Filter P3((S,LARc,s),
|
||||||
|
|
||||||
|
struct gsm_state * S,
|
||||||
|
|
||||||
|
word * LARc, /* coded log area ratio [0..7] IN */
|
||||||
|
word * s /* signal [0..159] IN/OUT */
|
||||||
|
)
|
||||||
|
{
|
||||||
|
word * LARpp_j = S->LARpp[ S->j ];
|
||||||
|
word * LARpp_j_1 = S->LARpp[ S->j ^= 1 ];
|
||||||
|
|
||||||
|
word LARp[8];
|
||||||
|
|
||||||
|
#undef FILTER
|
||||||
|
#if defined(FAST) && defined(USE_FLOAT_MUL)
|
||||||
|
# define FILTER (* (S->fast \
|
||||||
|
? Fast_Short_term_analysis_filtering \
|
||||||
|
: Short_term_analysis_filtering ))
|
||||||
|
|
||||||
|
#else
|
||||||
|
# define FILTER Short_term_analysis_filtering
|
||||||
|
#endif
|
||||||
|
|
||||||
|
Decoding_of_the_coded_Log_Area_Ratios( LARc, LARpp_j );
|
||||||
|
|
||||||
|
Coefficients_0_12( LARpp_j_1, LARpp_j, LARp );
|
||||||
|
LARp_to_rp( LARp );
|
||||||
|
FILTER( S, LARp, 13, s);
|
||||||
|
|
||||||
|
Coefficients_13_26( LARpp_j_1, LARpp_j, LARp);
|
||||||
|
LARp_to_rp( LARp );
|
||||||
|
FILTER( S, LARp, 14, s + 13);
|
||||||
|
|
||||||
|
Coefficients_27_39( LARpp_j_1, LARpp_j, LARp);
|
||||||
|
LARp_to_rp( LARp );
|
||||||
|
FILTER( S, LARp, 13, s + 27);
|
||||||
|
|
||||||
|
Coefficients_40_159( LARpp_j, LARp);
|
||||||
|
LARp_to_rp( LARp );
|
||||||
|
FILTER( S, LARp, 120, s + 40);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Gsm_Short_Term_Synthesis_Filter P4((S, LARcr, wt, s),
|
||||||
|
struct gsm_state * S,
|
||||||
|
|
||||||
|
word * LARcr, /* received log area ratios [0..7] IN */
|
||||||
|
word * wt, /* received d [0..159] IN */
|
||||||
|
|
||||||
|
word * s /* signal s [0..159] OUT */
|
||||||
|
)
|
||||||
|
{
|
||||||
|
word * LARpp_j = S->LARpp[ S->j ];
|
||||||
|
word * LARpp_j_1 = S->LARpp[ S->j ^=1 ];
|
||||||
|
|
||||||
|
word LARp[8];
|
||||||
|
|
||||||
|
#undef FILTER
|
||||||
|
#if defined(FAST) && defined(USE_FLOAT_MUL)
|
||||||
|
|
||||||
|
# define FILTER (* (S->fast \
|
||||||
|
? Fast_Short_term_synthesis_filtering \
|
||||||
|
: Short_term_synthesis_filtering ))
|
||||||
|
#else
|
||||||
|
# define FILTER Short_term_synthesis_filtering
|
||||||
|
#endif
|
||||||
|
|
||||||
|
Decoding_of_the_coded_Log_Area_Ratios( LARcr, LARpp_j );
|
||||||
|
|
||||||
|
Coefficients_0_12( LARpp_j_1, LARpp_j, LARp );
|
||||||
|
LARp_to_rp( LARp );
|
||||||
|
FILTER( S, LARp, 13, wt, s );
|
||||||
|
|
||||||
|
Coefficients_13_26( LARpp_j_1, LARpp_j, LARp);
|
||||||
|
LARp_to_rp( LARp );
|
||||||
|
FILTER( S, LARp, 14, wt + 13, s + 13 );
|
||||||
|
|
||||||
|
Coefficients_27_39( LARpp_j_1, LARpp_j, LARp);
|
||||||
|
LARp_to_rp( LARp );
|
||||||
|
FILTER( S, LARp, 13, wt + 27, s + 27 );
|
||||||
|
|
||||||
|
Coefficients_40_159( LARpp_j, LARp );
|
||||||
|
LARp_to_rp( LARp );
|
||||||
|
FILTER(S, LARp, 120, wt + 40, s + 40);
|
||||||
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
|
||||||
|
* Universitaet Berlin. See the accompanying file "COPYRIGHT" for
|
||||||
|
* details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* $Header: /tmp_amd/presto/export/kbs/jutta/src/gsm/RCS/table.c,v 1.1 1992/10/28 00:15:50 jutta Exp $ */
|
||||||
|
|
||||||
|
/* Most of these tables are inlined at their point of use.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* 4.4 TABLES USED IN THE FIXED POINT IMPLEMENTATION OF THE RPE-LTP
|
||||||
|
* CODER AND DECODER
|
||||||
|
*
|
||||||
|
* (Most of them inlined, so watch out.)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define GSM_TABLE_C
|
||||||
|
#include "private.h"
|
||||||
|
#include "gsm.h"
|
||||||
|
|
||||||
|
/* Table 4.1 Quantization of the Log.-Area Ratios
|
||||||
|
*/
|
||||||
|
/* i 1 2 3 4 5 6 7 8 */
|
||||||
|
word gsm_A[8] = {20480, 20480, 20480, 20480, 13964, 15360, 8534, 9036};
|
||||||
|
word gsm_B[8] = { 0, 0, 2048, -2560, 94, -1792, -341, -1144};
|
||||||
|
word gsm_MIC[8] = { -32, -32, -16, -16, -8, -8, -4, -4 };
|
||||||
|
word gsm_MAC[8] = { 31, 31, 15, 15, 7, 7, 3, 3 };
|
||||||
|
|
||||||
|
|
||||||
|
/* Table 4.2 Tabulation of 1/A[1..8]
|
||||||
|
*/
|
||||||
|
word gsm_INVA[8]={ 13107, 13107, 13107, 13107, 19223, 17476, 31454, 29708 };
|
||||||
|
|
||||||
|
|
||||||
|
/* Table 4.3a Decision level of the LTP gain quantizer
|
||||||
|
*/
|
||||||
|
/* bc 0 1 2 3 */
|
||||||
|
word gsm_DLB[4] = { 6554, 16384, 26214, 32767 };
|
||||||
|
|
||||||
|
|
||||||
|
/* Table 4.3b Quantization levels of the LTP gain quantizer
|
||||||
|
*/
|
||||||
|
/* bc 0 1 2 3 */
|
||||||
|
word gsm_QLB[4] = { 3277, 11469, 21299, 32767 };
|
||||||
|
|
||||||
|
|
||||||
|
/* Table 4.4 Coefficients of the weighting filter
|
||||||
|
*/
|
||||||
|
/* i 0 1 2 3 4 5 6 7 8 9 10 */
|
||||||
|
word gsm_H[11] = {-134, -374, 0, 2054, 5741, 8192, 5741, 2054, 0, -374, -134 };
|
||||||
|
|
||||||
|
|
||||||
|
/* Table 4.5 Normalized inverse mantissa used to compute xM/xmax
|
||||||
|
*/
|
||||||
|
/* i 0 1 2 3 4 5 6 7 */
|
||||||
|
word gsm_NRFAC[8] = { 29128, 26215, 23832, 21846, 20165, 18725, 17476, 16384 };
|
||||||
|
|
||||||
|
|
||||||
|
/* Table 4.6 Normalized direct mantissa used to compute xM/xmax
|
||||||
|
*/
|
||||||
|
/* i 0 1 2 3 4 5 6 7 */
|
||||||
|
word gsm_FAC[8] = { 18431, 20479, 22527, 24575, 26623, 28671, 30719, 32767 };
|
||||||
@@ -0,0 +1,111 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2002-2020 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef OPENSSL_AES_H
|
||||||
|
# define OPENSSL_AES_H
|
||||||
|
# pragma once
|
||||||
|
|
||||||
|
# include <openssl/macros.h>
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
# define HEADER_AES_H
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# include <openssl/opensslconf.h>
|
||||||
|
|
||||||
|
# include <stddef.h>
|
||||||
|
# ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# define AES_BLOCK_SIZE 16
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
|
||||||
|
# define AES_ENCRYPT 1
|
||||||
|
# define AES_DECRYPT 0
|
||||||
|
|
||||||
|
# define AES_MAXNR 14
|
||||||
|
|
||||||
|
|
||||||
|
/* This should be a hidden type, but EVP requires that the size be known */
|
||||||
|
struct aes_key_st {
|
||||||
|
# ifdef AES_LONG
|
||||||
|
unsigned long rd_key[4 * (AES_MAXNR + 1)];
|
||||||
|
# else
|
||||||
|
unsigned int rd_key[4 * (AES_MAXNR + 1)];
|
||||||
|
# endif
|
||||||
|
int rounds;
|
||||||
|
};
|
||||||
|
typedef struct aes_key_st AES_KEY;
|
||||||
|
|
||||||
|
# endif
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
OSSL_DEPRECATEDIN_3_0 const char *AES_options(void);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
int AES_set_encrypt_key(const unsigned char *userKey, const int bits,
|
||||||
|
AES_KEY *key);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
int AES_set_decrypt_key(const unsigned char *userKey, const int bits,
|
||||||
|
AES_KEY *key);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
void AES_encrypt(const unsigned char *in, unsigned char *out,
|
||||||
|
const AES_KEY *key);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
void AES_decrypt(const unsigned char *in, unsigned char *out,
|
||||||
|
const AES_KEY *key);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
void AES_ecb_encrypt(const unsigned char *in, unsigned char *out,
|
||||||
|
const AES_KEY *key, const int enc);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
void AES_cbc_encrypt(const unsigned char *in, unsigned char *out,
|
||||||
|
size_t length, const AES_KEY *key,
|
||||||
|
unsigned char *ivec, const int enc);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
void AES_cfb128_encrypt(const unsigned char *in, unsigned char *out,
|
||||||
|
size_t length, const AES_KEY *key,
|
||||||
|
unsigned char *ivec, int *num, const int enc);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
void AES_cfb1_encrypt(const unsigned char *in, unsigned char *out,
|
||||||
|
size_t length, const AES_KEY *key,
|
||||||
|
unsigned char *ivec, int *num, const int enc);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
void AES_cfb8_encrypt(const unsigned char *in, unsigned char *out,
|
||||||
|
size_t length, const AES_KEY *key,
|
||||||
|
unsigned char *ivec, int *num, const int enc);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
void AES_ofb128_encrypt(const unsigned char *in, unsigned char *out,
|
||||||
|
size_t length, const AES_KEY *key,
|
||||||
|
unsigned char *ivec, int *num);
|
||||||
|
|
||||||
|
/* NB: the IV is _two_ blocks long */
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
void AES_ige_encrypt(const unsigned char *in, unsigned char *out,
|
||||||
|
size_t length, const AES_KEY *key,
|
||||||
|
unsigned char *ivec, const int enc);
|
||||||
|
/* NB: the IV is _four_ blocks long */
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
void AES_bi_ige_encrypt(const unsigned char *in, unsigned char *out,
|
||||||
|
size_t length, const AES_KEY *key, const AES_KEY *key2,
|
||||||
|
const unsigned char *ivec, const int enc);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
int AES_wrap_key(AES_KEY *key, const unsigned char *iv,
|
||||||
|
unsigned char *out, const unsigned char *in,
|
||||||
|
unsigned int inlen);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
int AES_unwrap_key(AES_KEY *key, const unsigned char *iv,
|
||||||
|
unsigned char *out, const unsigned char *in,
|
||||||
|
unsigned int inlen);
|
||||||
|
# endif
|
||||||
|
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
|
||||||
|
#endif
|
||||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,142 @@
|
|||||||
|
/*
|
||||||
|
* Generated by util/mkerr.pl DO NOT EDIT
|
||||||
|
* Copyright 1995-2024 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef OPENSSL_ASN1ERR_H
|
||||||
|
# define OPENSSL_ASN1ERR_H
|
||||||
|
# pragma once
|
||||||
|
|
||||||
|
# include <openssl/opensslconf.h>
|
||||||
|
# include <openssl/symhacks.h>
|
||||||
|
# include <openssl/cryptoerr_legacy.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ASN1 reason codes.
|
||||||
|
*/
|
||||||
|
# define ASN1_R_ADDING_OBJECT 171
|
||||||
|
# define ASN1_R_ASN1_PARSE_ERROR 203
|
||||||
|
# define ASN1_R_ASN1_SIG_PARSE_ERROR 204
|
||||||
|
# define ASN1_R_AUX_ERROR 100
|
||||||
|
# define ASN1_R_BAD_OBJECT_HEADER 102
|
||||||
|
# define ASN1_R_BAD_TEMPLATE 230
|
||||||
|
# define ASN1_R_BMPSTRING_IS_WRONG_LENGTH 214
|
||||||
|
# define ASN1_R_BN_LIB 105
|
||||||
|
# define ASN1_R_BOOLEAN_IS_WRONG_LENGTH 106
|
||||||
|
# define ASN1_R_BUFFER_TOO_SMALL 107
|
||||||
|
# define ASN1_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER 108
|
||||||
|
# define ASN1_R_CONTEXT_NOT_INITIALISED 217
|
||||||
|
# define ASN1_R_DATA_IS_WRONG 109
|
||||||
|
# define ASN1_R_DECODE_ERROR 110
|
||||||
|
# define ASN1_R_DEPTH_EXCEEDED 174
|
||||||
|
# define ASN1_R_DIGEST_AND_KEY_TYPE_NOT_SUPPORTED 198
|
||||||
|
# define ASN1_R_ENCODE_ERROR 112
|
||||||
|
# define ASN1_R_ERROR_GETTING_TIME 173
|
||||||
|
# define ASN1_R_ERROR_LOADING_SECTION 172
|
||||||
|
# define ASN1_R_ERROR_SETTING_CIPHER_PARAMS 114
|
||||||
|
# define ASN1_R_EXPECTING_AN_INTEGER 115
|
||||||
|
# define ASN1_R_EXPECTING_AN_OBJECT 116
|
||||||
|
# define ASN1_R_EXPLICIT_LENGTH_MISMATCH 119
|
||||||
|
# define ASN1_R_EXPLICIT_TAG_NOT_CONSTRUCTED 120
|
||||||
|
# define ASN1_R_FIELD_MISSING 121
|
||||||
|
# define ASN1_R_FIRST_NUM_TOO_LARGE 122
|
||||||
|
# define ASN1_R_GENERALIZEDTIME_IS_TOO_SHORT 232
|
||||||
|
# define ASN1_R_HEADER_TOO_LONG 123
|
||||||
|
# define ASN1_R_ILLEGAL_BITSTRING_FORMAT 175
|
||||||
|
# define ASN1_R_ILLEGAL_BOOLEAN 176
|
||||||
|
# define ASN1_R_ILLEGAL_CHARACTERS 124
|
||||||
|
# define ASN1_R_ILLEGAL_FORMAT 177
|
||||||
|
# define ASN1_R_ILLEGAL_HEX 178
|
||||||
|
# define ASN1_R_ILLEGAL_IMPLICIT_TAG 179
|
||||||
|
# define ASN1_R_ILLEGAL_INTEGER 180
|
||||||
|
# define ASN1_R_ILLEGAL_NEGATIVE_VALUE 226
|
||||||
|
# define ASN1_R_ILLEGAL_NESTED_TAGGING 181
|
||||||
|
# define ASN1_R_ILLEGAL_NULL 125
|
||||||
|
# define ASN1_R_ILLEGAL_NULL_VALUE 182
|
||||||
|
# define ASN1_R_ILLEGAL_OBJECT 183
|
||||||
|
# define ASN1_R_ILLEGAL_OPTIONAL_ANY 126
|
||||||
|
# define ASN1_R_ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE 170
|
||||||
|
# define ASN1_R_ILLEGAL_PADDING 221
|
||||||
|
# define ASN1_R_ILLEGAL_TAGGED_ANY 127
|
||||||
|
# define ASN1_R_ILLEGAL_TIME_VALUE 184
|
||||||
|
# define ASN1_R_ILLEGAL_ZERO_CONTENT 222
|
||||||
|
# define ASN1_R_INTEGER_NOT_ASCII_FORMAT 185
|
||||||
|
# define ASN1_R_INTEGER_TOO_LARGE_FOR_LONG 128
|
||||||
|
# define ASN1_R_INVALID_BIT_STRING_BITS_LEFT 220
|
||||||
|
# define ASN1_R_INVALID_BMPSTRING_LENGTH 129
|
||||||
|
# define ASN1_R_INVALID_DIGIT 130
|
||||||
|
# define ASN1_R_INVALID_MIME_TYPE 205
|
||||||
|
# define ASN1_R_INVALID_MODIFIER 186
|
||||||
|
# define ASN1_R_INVALID_NUMBER 187
|
||||||
|
# define ASN1_R_INVALID_OBJECT_ENCODING 216
|
||||||
|
# define ASN1_R_INVALID_SCRYPT_PARAMETERS 227
|
||||||
|
# define ASN1_R_INVALID_SEPARATOR 131
|
||||||
|
# define ASN1_R_INVALID_STRING_TABLE_VALUE 218
|
||||||
|
# define ASN1_R_INVALID_UNIVERSALSTRING_LENGTH 133
|
||||||
|
# define ASN1_R_INVALID_UTF8STRING 134
|
||||||
|
# define ASN1_R_INVALID_VALUE 219
|
||||||
|
# define ASN1_R_LENGTH_TOO_LONG 231
|
||||||
|
# define ASN1_R_LIST_ERROR 188
|
||||||
|
# define ASN1_R_MIME_NO_CONTENT_TYPE 206
|
||||||
|
# define ASN1_R_MIME_PARSE_ERROR 207
|
||||||
|
# define ASN1_R_MIME_SIG_PARSE_ERROR 208
|
||||||
|
# define ASN1_R_MISSING_EOC 137
|
||||||
|
# define ASN1_R_MISSING_SECOND_NUMBER 138
|
||||||
|
# define ASN1_R_MISSING_VALUE 189
|
||||||
|
# define ASN1_R_MSTRING_NOT_UNIVERSAL 139
|
||||||
|
# define ASN1_R_MSTRING_WRONG_TAG 140
|
||||||
|
# define ASN1_R_NESTED_ASN1_STRING 197
|
||||||
|
# define ASN1_R_NESTED_TOO_DEEP 201
|
||||||
|
# define ASN1_R_NON_HEX_CHARACTERS 141
|
||||||
|
# define ASN1_R_NOT_ASCII_FORMAT 190
|
||||||
|
# define ASN1_R_NOT_ENOUGH_DATA 142
|
||||||
|
# define ASN1_R_NO_CONTENT_TYPE 209
|
||||||
|
# define ASN1_R_NO_MATCHING_CHOICE_TYPE 143
|
||||||
|
# define ASN1_R_NO_MULTIPART_BODY_FAILURE 210
|
||||||
|
# define ASN1_R_NO_MULTIPART_BOUNDARY 211
|
||||||
|
# define ASN1_R_NO_SIG_CONTENT_TYPE 212
|
||||||
|
# define ASN1_R_NULL_IS_WRONG_LENGTH 144
|
||||||
|
# define ASN1_R_OBJECT_NOT_ASCII_FORMAT 191
|
||||||
|
# define ASN1_R_ODD_NUMBER_OF_CHARS 145
|
||||||
|
# define ASN1_R_SECOND_NUMBER_TOO_LARGE 147
|
||||||
|
# define ASN1_R_SEQUENCE_LENGTH_MISMATCH 148
|
||||||
|
# define ASN1_R_SEQUENCE_NOT_CONSTRUCTED 149
|
||||||
|
# define ASN1_R_SEQUENCE_OR_SET_NEEDS_CONFIG 192
|
||||||
|
# define ASN1_R_SHORT_LINE 150
|
||||||
|
# define ASN1_R_SIG_INVALID_MIME_TYPE 213
|
||||||
|
# define ASN1_R_STREAMING_NOT_SUPPORTED 202
|
||||||
|
# define ASN1_R_STRING_TOO_LONG 151
|
||||||
|
# define ASN1_R_STRING_TOO_SHORT 152
|
||||||
|
# define ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 154
|
||||||
|
# define ASN1_R_TIME_NOT_ASCII_FORMAT 193
|
||||||
|
# define ASN1_R_TOO_LARGE 223
|
||||||
|
# define ASN1_R_TOO_LONG 155
|
||||||
|
# define ASN1_R_TOO_SMALL 224
|
||||||
|
# define ASN1_R_TYPE_NOT_CONSTRUCTED 156
|
||||||
|
# define ASN1_R_TYPE_NOT_PRIMITIVE 195
|
||||||
|
# define ASN1_R_UNEXPECTED_EOC 159
|
||||||
|
# define ASN1_R_UNIVERSALSTRING_IS_WRONG_LENGTH 215
|
||||||
|
# define ASN1_R_UNKNOWN_DIGEST 229
|
||||||
|
# define ASN1_R_UNKNOWN_FORMAT 160
|
||||||
|
# define ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM 161
|
||||||
|
# define ASN1_R_UNKNOWN_OBJECT_TYPE 162
|
||||||
|
# define ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE 163
|
||||||
|
# define ASN1_R_UNKNOWN_SIGNATURE_ALGORITHM 199
|
||||||
|
# define ASN1_R_UNKNOWN_TAG 194
|
||||||
|
# define ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE 164
|
||||||
|
# define ASN1_R_UNSUPPORTED_CIPHER 228
|
||||||
|
# define ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE 167
|
||||||
|
# define ASN1_R_UNSUPPORTED_TYPE 196
|
||||||
|
# define ASN1_R_UTCTIME_IS_TOO_SHORT 233
|
||||||
|
# define ASN1_R_WRONG_INTEGER_TYPE 225
|
||||||
|
# define ASN1_R_WRONG_PUBLIC_KEY_TYPE 200
|
||||||
|
# define ASN1_R_WRONG_TAG 168
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,946 @@
|
|||||||
|
/*
|
||||||
|
* WARNING: do not edit!
|
||||||
|
* Generated by Makefile from ../../openssl-3.5.0/include/openssl/asn1t.h.in
|
||||||
|
*
|
||||||
|
* Copyright 2000-2021 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef OPENSSL_ASN1T_H
|
||||||
|
# define OPENSSL_ASN1T_H
|
||||||
|
# pragma once
|
||||||
|
|
||||||
|
# include <openssl/macros.h>
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
# define HEADER_ASN1T_H
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# include <stddef.h>
|
||||||
|
# include <openssl/e_os2.h>
|
||||||
|
# include <openssl/asn1.h>
|
||||||
|
|
||||||
|
# ifdef OPENSSL_BUILD_SHLIBCRYPTO
|
||||||
|
# undef OPENSSL_EXTERN
|
||||||
|
# define OPENSSL_EXTERN OPENSSL_EXPORT
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/* ASN1 template defines, structures and functions */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*-
|
||||||
|
* These are the possible values for the itype field of the
|
||||||
|
* ASN1_ITEM structure and determine how it is interpreted.
|
||||||
|
*
|
||||||
|
* For PRIMITIVE types the underlying type
|
||||||
|
* determines the behaviour if items is NULL.
|
||||||
|
*
|
||||||
|
* Otherwise templates must contain a single
|
||||||
|
* template and the type is treated in the
|
||||||
|
* same way as the type specified in the template.
|
||||||
|
*
|
||||||
|
* For SEQUENCE types the templates field points
|
||||||
|
* to the members, the size field is the
|
||||||
|
* structure size.
|
||||||
|
*
|
||||||
|
* For CHOICE types the templates field points
|
||||||
|
* to each possible member (typically a union)
|
||||||
|
* and the 'size' field is the offset of the
|
||||||
|
* selector.
|
||||||
|
*
|
||||||
|
* The 'funcs' field is used for application-specific
|
||||||
|
* data and functions.
|
||||||
|
*
|
||||||
|
* The EXTERN type uses a new style d2i/i2d.
|
||||||
|
* The new style should be used where possible
|
||||||
|
* because it avoids things like the d2i IMPLICIT
|
||||||
|
* hack.
|
||||||
|
*
|
||||||
|
* MSTRING is a multiple string type, it is used
|
||||||
|
* for a CHOICE of character strings where the
|
||||||
|
* actual strings all occupy an ASN1_STRING
|
||||||
|
* structure. In this case the 'utype' field
|
||||||
|
* has a special meaning, it is used as a mask
|
||||||
|
* of acceptable types using the B_ASN1 constants.
|
||||||
|
*
|
||||||
|
* NDEF_SEQUENCE is the same as SEQUENCE except
|
||||||
|
* that it will use indefinite length constructed
|
||||||
|
* encoding if requested.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
# define ASN1_ITYPE_PRIMITIVE 0x0
|
||||||
|
# define ASN1_ITYPE_SEQUENCE 0x1
|
||||||
|
# define ASN1_ITYPE_CHOICE 0x2
|
||||||
|
/* unused value 0x3 */
|
||||||
|
# define ASN1_ITYPE_EXTERN 0x4
|
||||||
|
# define ASN1_ITYPE_MSTRING 0x5
|
||||||
|
# define ASN1_ITYPE_NDEF_SEQUENCE 0x6
|
||||||
|
|
||||||
|
/* Macro to obtain ASN1_ADB pointer from a type (only used internally) */
|
||||||
|
# define ASN1_ADB_ptr(iptr) ((const ASN1_ADB *)((iptr)()))
|
||||||
|
|
||||||
|
/* Macros for start and end of ASN1_ITEM definition */
|
||||||
|
|
||||||
|
# define ASN1_ITEM_start(itname) \
|
||||||
|
const ASN1_ITEM * itname##_it(void) \
|
||||||
|
{ \
|
||||||
|
static const ASN1_ITEM local_it = {
|
||||||
|
|
||||||
|
# define static_ASN1_ITEM_start(itname) \
|
||||||
|
static ASN1_ITEM_start(itname)
|
||||||
|
|
||||||
|
# define ASN1_ITEM_end(itname) \
|
||||||
|
}; \
|
||||||
|
return &local_it; \
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Macros to aid ASN1 template writing */
|
||||||
|
|
||||||
|
# define ASN1_ITEM_TEMPLATE(tname) \
|
||||||
|
static const ASN1_TEMPLATE tname##_item_tt
|
||||||
|
|
||||||
|
# define ASN1_ITEM_TEMPLATE_END(tname) \
|
||||||
|
;\
|
||||||
|
ASN1_ITEM_start(tname) \
|
||||||
|
ASN1_ITYPE_PRIMITIVE,\
|
||||||
|
-1,\
|
||||||
|
&tname##_item_tt,\
|
||||||
|
0,\
|
||||||
|
NULL,\
|
||||||
|
0,\
|
||||||
|
#tname \
|
||||||
|
ASN1_ITEM_end(tname)
|
||||||
|
# define static_ASN1_ITEM_TEMPLATE_END(tname) \
|
||||||
|
;\
|
||||||
|
static_ASN1_ITEM_start(tname) \
|
||||||
|
ASN1_ITYPE_PRIMITIVE,\
|
||||||
|
-1,\
|
||||||
|
&tname##_item_tt,\
|
||||||
|
0,\
|
||||||
|
NULL,\
|
||||||
|
0,\
|
||||||
|
#tname \
|
||||||
|
ASN1_ITEM_end(tname)
|
||||||
|
|
||||||
|
/* This is a ASN1 type which just embeds a template */
|
||||||
|
|
||||||
|
/*-
|
||||||
|
* This pair helps declare a SEQUENCE. We can do:
|
||||||
|
*
|
||||||
|
* ASN1_SEQUENCE(stname) = {
|
||||||
|
* ... SEQUENCE components ...
|
||||||
|
* } ASN1_SEQUENCE_END(stname)
|
||||||
|
*
|
||||||
|
* This will produce an ASN1_ITEM called stname_it
|
||||||
|
* for a structure called stname.
|
||||||
|
*
|
||||||
|
* If you want the same structure but a different
|
||||||
|
* name then use:
|
||||||
|
*
|
||||||
|
* ASN1_SEQUENCE(itname) = {
|
||||||
|
* ... SEQUENCE components ...
|
||||||
|
* } ASN1_SEQUENCE_END_name(stname, itname)
|
||||||
|
*
|
||||||
|
* This will create an item called itname_it using
|
||||||
|
* a structure called stname.
|
||||||
|
*/
|
||||||
|
|
||||||
|
# define ASN1_SEQUENCE(tname) \
|
||||||
|
static const ASN1_TEMPLATE tname##_seq_tt[]
|
||||||
|
|
||||||
|
# define ASN1_SEQUENCE_END(stname) ASN1_SEQUENCE_END_name(stname, stname)
|
||||||
|
|
||||||
|
# define static_ASN1_SEQUENCE_END(stname) static_ASN1_SEQUENCE_END_name(stname, stname)
|
||||||
|
|
||||||
|
# define ASN1_SEQUENCE_END_name(stname, tname) \
|
||||||
|
;\
|
||||||
|
ASN1_ITEM_start(tname) \
|
||||||
|
ASN1_ITYPE_SEQUENCE,\
|
||||||
|
V_ASN1_SEQUENCE,\
|
||||||
|
tname##_seq_tt,\
|
||||||
|
sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
|
||||||
|
NULL,\
|
||||||
|
sizeof(stname),\
|
||||||
|
#tname \
|
||||||
|
ASN1_ITEM_end(tname)
|
||||||
|
|
||||||
|
# define static_ASN1_SEQUENCE_END_name(stname, tname) \
|
||||||
|
;\
|
||||||
|
static_ASN1_ITEM_start(tname) \
|
||||||
|
ASN1_ITYPE_SEQUENCE,\
|
||||||
|
V_ASN1_SEQUENCE,\
|
||||||
|
tname##_seq_tt,\
|
||||||
|
sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
|
||||||
|
NULL,\
|
||||||
|
sizeof(stname),\
|
||||||
|
#stname \
|
||||||
|
ASN1_ITEM_end(tname)
|
||||||
|
|
||||||
|
# define ASN1_NDEF_SEQUENCE(tname) \
|
||||||
|
ASN1_SEQUENCE(tname)
|
||||||
|
|
||||||
|
# define ASN1_NDEF_SEQUENCE_cb(tname, cb) \
|
||||||
|
ASN1_SEQUENCE_cb(tname, cb)
|
||||||
|
|
||||||
|
# define ASN1_SEQUENCE_cb(tname, cb) \
|
||||||
|
static const ASN1_AUX tname##_aux = {NULL, 0, 0, 0, cb, 0, NULL}; \
|
||||||
|
ASN1_SEQUENCE(tname)
|
||||||
|
|
||||||
|
# define ASN1_SEQUENCE_const_cb(tname, const_cb) \
|
||||||
|
static const ASN1_AUX tname##_aux = \
|
||||||
|
{NULL, ASN1_AFLG_CONST_CB, 0, 0, NULL, 0, const_cb}; \
|
||||||
|
ASN1_SEQUENCE(tname)
|
||||||
|
|
||||||
|
# define ASN1_SEQUENCE_cb_const_cb(tname, cb, const_cb) \
|
||||||
|
static const ASN1_AUX tname##_aux = \
|
||||||
|
{NULL, ASN1_AFLG_CONST_CB, 0, 0, cb, 0, const_cb}; \
|
||||||
|
ASN1_SEQUENCE(tname)
|
||||||
|
|
||||||
|
# define ASN1_SEQUENCE_ref(tname, cb) \
|
||||||
|
static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_REFCOUNT, offsetof(tname, references), offsetof(tname, lock), cb, 0, NULL}; \
|
||||||
|
ASN1_SEQUENCE(tname)
|
||||||
|
|
||||||
|
# define ASN1_SEQUENCE_enc(tname, enc, cb) \
|
||||||
|
static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_ENCODING, 0, 0, cb, offsetof(tname, enc), NULL}; \
|
||||||
|
ASN1_SEQUENCE(tname)
|
||||||
|
|
||||||
|
# define ASN1_NDEF_SEQUENCE_END(tname) \
|
||||||
|
;\
|
||||||
|
ASN1_ITEM_start(tname) \
|
||||||
|
ASN1_ITYPE_NDEF_SEQUENCE,\
|
||||||
|
V_ASN1_SEQUENCE,\
|
||||||
|
tname##_seq_tt,\
|
||||||
|
sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
|
||||||
|
NULL,\
|
||||||
|
sizeof(tname),\
|
||||||
|
#tname \
|
||||||
|
ASN1_ITEM_end(tname)
|
||||||
|
# define static_ASN1_NDEF_SEQUENCE_END(tname) \
|
||||||
|
;\
|
||||||
|
static_ASN1_ITEM_start(tname) \
|
||||||
|
ASN1_ITYPE_NDEF_SEQUENCE,\
|
||||||
|
V_ASN1_SEQUENCE,\
|
||||||
|
tname##_seq_tt,\
|
||||||
|
sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
|
||||||
|
NULL,\
|
||||||
|
sizeof(tname),\
|
||||||
|
#tname \
|
||||||
|
ASN1_ITEM_end(tname)
|
||||||
|
|
||||||
|
|
||||||
|
# define ASN1_SEQUENCE_END_enc(stname, tname) ASN1_SEQUENCE_END_ref(stname, tname)
|
||||||
|
|
||||||
|
# define ASN1_SEQUENCE_END_cb(stname, tname) ASN1_SEQUENCE_END_ref(stname, tname)
|
||||||
|
# define static_ASN1_SEQUENCE_END_cb(stname, tname) static_ASN1_SEQUENCE_END_ref(stname, tname)
|
||||||
|
|
||||||
|
# define ASN1_SEQUENCE_END_ref(stname, tname) \
|
||||||
|
;\
|
||||||
|
ASN1_ITEM_start(tname) \
|
||||||
|
ASN1_ITYPE_SEQUENCE,\
|
||||||
|
V_ASN1_SEQUENCE,\
|
||||||
|
tname##_seq_tt,\
|
||||||
|
sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
|
||||||
|
&tname##_aux,\
|
||||||
|
sizeof(stname),\
|
||||||
|
#tname \
|
||||||
|
ASN1_ITEM_end(tname)
|
||||||
|
# define static_ASN1_SEQUENCE_END_ref(stname, tname) \
|
||||||
|
;\
|
||||||
|
static_ASN1_ITEM_start(tname) \
|
||||||
|
ASN1_ITYPE_SEQUENCE,\
|
||||||
|
V_ASN1_SEQUENCE,\
|
||||||
|
tname##_seq_tt,\
|
||||||
|
sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
|
||||||
|
&tname##_aux,\
|
||||||
|
sizeof(stname),\
|
||||||
|
#stname \
|
||||||
|
ASN1_ITEM_end(tname)
|
||||||
|
|
||||||
|
# define ASN1_NDEF_SEQUENCE_END_cb(stname, tname) \
|
||||||
|
;\
|
||||||
|
ASN1_ITEM_start(tname) \
|
||||||
|
ASN1_ITYPE_NDEF_SEQUENCE,\
|
||||||
|
V_ASN1_SEQUENCE,\
|
||||||
|
tname##_seq_tt,\
|
||||||
|
sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
|
||||||
|
&tname##_aux,\
|
||||||
|
sizeof(stname),\
|
||||||
|
#stname \
|
||||||
|
ASN1_ITEM_end(tname)
|
||||||
|
|
||||||
|
/*-
|
||||||
|
* This pair helps declare a CHOICE type. We can do:
|
||||||
|
*
|
||||||
|
* ASN1_CHOICE(chname) = {
|
||||||
|
* ... CHOICE options ...
|
||||||
|
* ASN1_CHOICE_END(chname)
|
||||||
|
*
|
||||||
|
* This will produce an ASN1_ITEM called chname_it
|
||||||
|
* for a structure called chname. The structure
|
||||||
|
* definition must look like this:
|
||||||
|
* typedef struct {
|
||||||
|
* int type;
|
||||||
|
* union {
|
||||||
|
* ASN1_SOMETHING *opt1;
|
||||||
|
* ASN1_SOMEOTHER *opt2;
|
||||||
|
* } value;
|
||||||
|
* } chname;
|
||||||
|
*
|
||||||
|
* the name of the selector must be 'type'.
|
||||||
|
* to use an alternative selector name use the
|
||||||
|
* ASN1_CHOICE_END_selector() version.
|
||||||
|
*/
|
||||||
|
|
||||||
|
# define ASN1_CHOICE(tname) \
|
||||||
|
static const ASN1_TEMPLATE tname##_ch_tt[]
|
||||||
|
|
||||||
|
# define ASN1_CHOICE_cb(tname, cb) \
|
||||||
|
static const ASN1_AUX tname##_aux = {NULL, 0, 0, 0, cb, 0, NULL}; \
|
||||||
|
ASN1_CHOICE(tname)
|
||||||
|
|
||||||
|
# define ASN1_CHOICE_END(stname) ASN1_CHOICE_END_name(stname, stname)
|
||||||
|
|
||||||
|
# define static_ASN1_CHOICE_END(stname) static_ASN1_CHOICE_END_name(stname, stname)
|
||||||
|
|
||||||
|
# define ASN1_CHOICE_END_name(stname, tname) ASN1_CHOICE_END_selector(stname, tname, type)
|
||||||
|
|
||||||
|
# define static_ASN1_CHOICE_END_name(stname, tname) static_ASN1_CHOICE_END_selector(stname, tname, type)
|
||||||
|
|
||||||
|
# define ASN1_CHOICE_END_selector(stname, tname, selname) \
|
||||||
|
;\
|
||||||
|
ASN1_ITEM_start(tname) \
|
||||||
|
ASN1_ITYPE_CHOICE,\
|
||||||
|
offsetof(stname,selname) ,\
|
||||||
|
tname##_ch_tt,\
|
||||||
|
sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\
|
||||||
|
NULL,\
|
||||||
|
sizeof(stname),\
|
||||||
|
#stname \
|
||||||
|
ASN1_ITEM_end(tname)
|
||||||
|
|
||||||
|
# define static_ASN1_CHOICE_END_selector(stname, tname, selname) \
|
||||||
|
;\
|
||||||
|
static_ASN1_ITEM_start(tname) \
|
||||||
|
ASN1_ITYPE_CHOICE,\
|
||||||
|
offsetof(stname,selname) ,\
|
||||||
|
tname##_ch_tt,\
|
||||||
|
sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\
|
||||||
|
NULL,\
|
||||||
|
sizeof(stname),\
|
||||||
|
#stname \
|
||||||
|
ASN1_ITEM_end(tname)
|
||||||
|
|
||||||
|
# define ASN1_CHOICE_END_cb(stname, tname, selname) \
|
||||||
|
;\
|
||||||
|
ASN1_ITEM_start(tname) \
|
||||||
|
ASN1_ITYPE_CHOICE,\
|
||||||
|
offsetof(stname,selname) ,\
|
||||||
|
tname##_ch_tt,\
|
||||||
|
sizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\
|
||||||
|
&tname##_aux,\
|
||||||
|
sizeof(stname),\
|
||||||
|
#stname \
|
||||||
|
ASN1_ITEM_end(tname)
|
||||||
|
|
||||||
|
/* This helps with the template wrapper form of ASN1_ITEM */
|
||||||
|
|
||||||
|
# define ASN1_EX_TEMPLATE_TYPE(flags, tag, name, type) { \
|
||||||
|
(flags), (tag), 0,\
|
||||||
|
#name, ASN1_ITEM_ref(type) }
|
||||||
|
|
||||||
|
/* These help with SEQUENCE or CHOICE components */
|
||||||
|
|
||||||
|
/* used to declare other types */
|
||||||
|
|
||||||
|
# define ASN1_EX_TYPE(flags, tag, stname, field, type) { \
|
||||||
|
(flags), (tag), offsetof(stname, field),\
|
||||||
|
#field, ASN1_ITEM_ref(type) }
|
||||||
|
|
||||||
|
/* implicit and explicit helper macros */
|
||||||
|
|
||||||
|
# define ASN1_IMP_EX(stname, field, type, tag, ex) \
|
||||||
|
ASN1_EX_TYPE(ASN1_TFLG_IMPLICIT | (ex), tag, stname, field, type)
|
||||||
|
|
||||||
|
# define ASN1_EXP_EX(stname, field, type, tag, ex) \
|
||||||
|
ASN1_EX_TYPE(ASN1_TFLG_EXPLICIT | (ex), tag, stname, field, type)
|
||||||
|
|
||||||
|
/* Any defined by macros: the field used is in the table itself */
|
||||||
|
|
||||||
|
# define ASN1_ADB_OBJECT(tblname) { ASN1_TFLG_ADB_OID, -1, 0, #tblname, tblname##_adb }
|
||||||
|
# define ASN1_ADB_INTEGER(tblname) { ASN1_TFLG_ADB_INT, -1, 0, #tblname, tblname##_adb }
|
||||||
|
|
||||||
|
/* Plain simple type */
|
||||||
|
# define ASN1_SIMPLE(stname, field, type) ASN1_EX_TYPE(0,0, stname, field, type)
|
||||||
|
/* Embedded simple type */
|
||||||
|
# define ASN1_EMBED(stname, field, type) ASN1_EX_TYPE(ASN1_TFLG_EMBED,0, stname, field, type)
|
||||||
|
|
||||||
|
/* OPTIONAL simple type */
|
||||||
|
# define ASN1_OPT(stname, field, type) ASN1_EX_TYPE(ASN1_TFLG_OPTIONAL, 0, stname, field, type)
|
||||||
|
# define ASN1_OPT_EMBED(stname, field, type) ASN1_EX_TYPE(ASN1_TFLG_OPTIONAL|ASN1_TFLG_EMBED, 0, stname, field, type)
|
||||||
|
|
||||||
|
/* IMPLICIT tagged simple type */
|
||||||
|
# define ASN1_IMP(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, 0)
|
||||||
|
# define ASN1_IMP_EMBED(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_EMBED)
|
||||||
|
|
||||||
|
/* IMPLICIT tagged OPTIONAL simple type */
|
||||||
|
# define ASN1_IMP_OPT(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL)
|
||||||
|
# define ASN1_IMP_OPT_EMBED(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL|ASN1_TFLG_EMBED)
|
||||||
|
|
||||||
|
/* Same as above but EXPLICIT */
|
||||||
|
|
||||||
|
# define ASN1_EXP(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, 0)
|
||||||
|
# define ASN1_EXP_EMBED(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_EMBED)
|
||||||
|
# define ASN1_EXP_OPT(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL)
|
||||||
|
# define ASN1_EXP_OPT_EMBED(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL|ASN1_TFLG_EMBED)
|
||||||
|
|
||||||
|
/* SEQUENCE OF type */
|
||||||
|
# define ASN1_SEQUENCE_OF(stname, field, type) \
|
||||||
|
ASN1_EX_TYPE(ASN1_TFLG_SEQUENCE_OF, 0, stname, field, type)
|
||||||
|
|
||||||
|
/* OPTIONAL SEQUENCE OF */
|
||||||
|
# define ASN1_SEQUENCE_OF_OPT(stname, field, type) \
|
||||||
|
ASN1_EX_TYPE(ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL, 0, stname, field, type)
|
||||||
|
|
||||||
|
/* Same as above but for SET OF */
|
||||||
|
|
||||||
|
# define ASN1_SET_OF(stname, field, type) \
|
||||||
|
ASN1_EX_TYPE(ASN1_TFLG_SET_OF, 0, stname, field, type)
|
||||||
|
|
||||||
|
# define ASN1_SET_OF_OPT(stname, field, type) \
|
||||||
|
ASN1_EX_TYPE(ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL, 0, stname, field, type)
|
||||||
|
|
||||||
|
/* Finally compound types of SEQUENCE, SET, IMPLICIT, EXPLICIT and OPTIONAL */
|
||||||
|
|
||||||
|
# define ASN1_IMP_SET_OF(stname, field, type, tag) \
|
||||||
|
ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF)
|
||||||
|
|
||||||
|
# define ASN1_EXP_SET_OF(stname, field, type, tag) \
|
||||||
|
ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF)
|
||||||
|
|
||||||
|
# define ASN1_IMP_SET_OF_OPT(stname, field, type, tag) \
|
||||||
|
ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL)
|
||||||
|
|
||||||
|
# define ASN1_EXP_SET_OF_OPT(stname, field, type, tag) \
|
||||||
|
ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL)
|
||||||
|
|
||||||
|
# define ASN1_IMP_SEQUENCE_OF(stname, field, type, tag) \
|
||||||
|
ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF)
|
||||||
|
|
||||||
|
# define ASN1_IMP_SEQUENCE_OF_OPT(stname, field, type, tag) \
|
||||||
|
ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL)
|
||||||
|
|
||||||
|
# define ASN1_EXP_SEQUENCE_OF(stname, field, type, tag) \
|
||||||
|
ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF)
|
||||||
|
|
||||||
|
# define ASN1_EXP_SEQUENCE_OF_OPT(stname, field, type, tag) \
|
||||||
|
ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL)
|
||||||
|
|
||||||
|
/* EXPLICIT using indefinite length constructed form */
|
||||||
|
# define ASN1_NDEF_EXP(stname, field, type, tag) \
|
||||||
|
ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_NDEF)
|
||||||
|
|
||||||
|
/* EXPLICIT OPTIONAL using indefinite length constructed form */
|
||||||
|
# define ASN1_NDEF_EXP_OPT(stname, field, type, tag) \
|
||||||
|
ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL|ASN1_TFLG_NDEF)
|
||||||
|
|
||||||
|
/* Macros for the ASN1_ADB structure */
|
||||||
|
|
||||||
|
# define ASN1_ADB(name) \
|
||||||
|
static const ASN1_ADB_TABLE name##_adbtbl[]
|
||||||
|
|
||||||
|
# define ASN1_ADB_END(name, flags, field, adb_cb, def, none) \
|
||||||
|
;\
|
||||||
|
static const ASN1_ITEM *name##_adb(void) \
|
||||||
|
{ \
|
||||||
|
static const ASN1_ADB internal_adb = \
|
||||||
|
{\
|
||||||
|
flags,\
|
||||||
|
offsetof(name, field),\
|
||||||
|
adb_cb,\
|
||||||
|
name##_adbtbl,\
|
||||||
|
sizeof(name##_adbtbl) / sizeof(ASN1_ADB_TABLE),\
|
||||||
|
def,\
|
||||||
|
none\
|
||||||
|
}; \
|
||||||
|
return (const ASN1_ITEM *) &internal_adb; \
|
||||||
|
} \
|
||||||
|
void dummy_function(void)
|
||||||
|
|
||||||
|
# define ADB_ENTRY(val, template) {val, template}
|
||||||
|
|
||||||
|
# define ASN1_ADB_TEMPLATE(name) \
|
||||||
|
static const ASN1_TEMPLATE name##_tt
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This is the ASN1 template structure that defines a wrapper round the
|
||||||
|
* actual type. It determines the actual position of the field in the value
|
||||||
|
* structure, various flags such as OPTIONAL and the field name.
|
||||||
|
*/
|
||||||
|
|
||||||
|
struct ASN1_TEMPLATE_st {
|
||||||
|
unsigned long flags; /* Various flags */
|
||||||
|
long tag; /* tag, not used if no tagging */
|
||||||
|
unsigned long offset; /* Offset of this field in structure */
|
||||||
|
const char *field_name; /* Field name */
|
||||||
|
ASN1_ITEM_EXP *item; /* Relevant ASN1_ITEM or ASN1_ADB */
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Macro to extract ASN1_ITEM and ASN1_ADB pointer from ASN1_TEMPLATE */
|
||||||
|
|
||||||
|
# define ASN1_TEMPLATE_item(t) (t->item_ptr)
|
||||||
|
# define ASN1_TEMPLATE_adb(t) (t->item_ptr)
|
||||||
|
|
||||||
|
typedef struct ASN1_ADB_TABLE_st ASN1_ADB_TABLE;
|
||||||
|
typedef struct ASN1_ADB_st ASN1_ADB;
|
||||||
|
|
||||||
|
struct ASN1_ADB_st {
|
||||||
|
unsigned long flags; /* Various flags */
|
||||||
|
unsigned long offset; /* Offset of selector field */
|
||||||
|
int (*adb_cb)(long *psel); /* Application callback */
|
||||||
|
const ASN1_ADB_TABLE *tbl; /* Table of possible types */
|
||||||
|
long tblcount; /* Number of entries in tbl */
|
||||||
|
const ASN1_TEMPLATE *default_tt; /* Type to use if no match */
|
||||||
|
const ASN1_TEMPLATE *null_tt; /* Type to use if selector is NULL */
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ASN1_ADB_TABLE_st {
|
||||||
|
long value; /* NID for an object or value for an int */
|
||||||
|
const ASN1_TEMPLATE tt; /* item for this value */
|
||||||
|
};
|
||||||
|
|
||||||
|
/* template flags */
|
||||||
|
|
||||||
|
/* Field is optional */
|
||||||
|
# define ASN1_TFLG_OPTIONAL (0x1)
|
||||||
|
|
||||||
|
/* Field is a SET OF */
|
||||||
|
# define ASN1_TFLG_SET_OF (0x1 << 1)
|
||||||
|
|
||||||
|
/* Field is a SEQUENCE OF */
|
||||||
|
# define ASN1_TFLG_SEQUENCE_OF (0x2 << 1)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Special case: this refers to a SET OF that will be sorted into DER order
|
||||||
|
* when encoded *and* the corresponding STACK will be modified to match the
|
||||||
|
* new order.
|
||||||
|
*/
|
||||||
|
# define ASN1_TFLG_SET_ORDER (0x3 << 1)
|
||||||
|
|
||||||
|
/* Mask for SET OF or SEQUENCE OF */
|
||||||
|
# define ASN1_TFLG_SK_MASK (0x3 << 1)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* These flags mean the tag should be taken from the tag field. If EXPLICIT
|
||||||
|
* then the underlying type is used for the inner tag.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* IMPLICIT tagging */
|
||||||
|
# define ASN1_TFLG_IMPTAG (0x1 << 3)
|
||||||
|
|
||||||
|
/* EXPLICIT tagging, inner tag from underlying type */
|
||||||
|
# define ASN1_TFLG_EXPTAG (0x2 << 3)
|
||||||
|
|
||||||
|
# define ASN1_TFLG_TAG_MASK (0x3 << 3)
|
||||||
|
|
||||||
|
/* context specific IMPLICIT */
|
||||||
|
# define ASN1_TFLG_IMPLICIT (ASN1_TFLG_IMPTAG|ASN1_TFLG_CONTEXT)
|
||||||
|
|
||||||
|
/* context specific EXPLICIT */
|
||||||
|
# define ASN1_TFLG_EXPLICIT (ASN1_TFLG_EXPTAG|ASN1_TFLG_CONTEXT)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If tagging is in force these determine the type of tag to use. Otherwise
|
||||||
|
* the tag is determined by the underlying type. These values reflect the
|
||||||
|
* actual octet format.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Universal tag */
|
||||||
|
# define ASN1_TFLG_UNIVERSAL (0x0<<6)
|
||||||
|
/* Application tag */
|
||||||
|
# define ASN1_TFLG_APPLICATION (0x1<<6)
|
||||||
|
/* Context specific tag */
|
||||||
|
# define ASN1_TFLG_CONTEXT (0x2<<6)
|
||||||
|
/* Private tag */
|
||||||
|
# define ASN1_TFLG_PRIVATE (0x3<<6)
|
||||||
|
|
||||||
|
# define ASN1_TFLG_TAG_CLASS (0x3<<6)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* These are for ANY DEFINED BY type. In this case the 'item' field points to
|
||||||
|
* an ASN1_ADB structure which contains a table of values to decode the
|
||||||
|
* relevant type
|
||||||
|
*/
|
||||||
|
|
||||||
|
# define ASN1_TFLG_ADB_MASK (0x3<<8)
|
||||||
|
|
||||||
|
# define ASN1_TFLG_ADB_OID (0x1<<8)
|
||||||
|
|
||||||
|
# define ASN1_TFLG_ADB_INT (0x1<<9)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This flag when present in a SEQUENCE OF, SET OF or EXPLICIT causes
|
||||||
|
* indefinite length constructed encoding to be used if required.
|
||||||
|
*/
|
||||||
|
|
||||||
|
# define ASN1_TFLG_NDEF (0x1<<11)
|
||||||
|
|
||||||
|
/* Field is embedded and not a pointer */
|
||||||
|
# define ASN1_TFLG_EMBED (0x1 << 12)
|
||||||
|
|
||||||
|
/* This is the actual ASN1 item itself */
|
||||||
|
|
||||||
|
struct ASN1_ITEM_st {
|
||||||
|
char itype; /* The item type, primitive, SEQUENCE, CHOICE
|
||||||
|
* or extern */
|
||||||
|
long utype; /* underlying type */
|
||||||
|
const ASN1_TEMPLATE *templates; /* If SEQUENCE or CHOICE this contains
|
||||||
|
* the contents */
|
||||||
|
long tcount; /* Number of templates if SEQUENCE or CHOICE */
|
||||||
|
const void *funcs; /* further data and type-specific functions */
|
||||||
|
/* funcs can be ASN1_PRIMITIVE_FUNCS*, ASN1_EXTERN_FUNCS*, or ASN1_AUX* */
|
||||||
|
long size; /* Structure size (usually) */
|
||||||
|
const char *sname; /* Structure name */
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Cache for ASN1 tag and length, so we don't keep re-reading it for things
|
||||||
|
* like CHOICE
|
||||||
|
*/
|
||||||
|
|
||||||
|
struct ASN1_TLC_st {
|
||||||
|
char valid; /* Values below are valid */
|
||||||
|
int ret; /* return value */
|
||||||
|
long plen; /* length */
|
||||||
|
int ptag; /* class value */
|
||||||
|
int pclass; /* class value */
|
||||||
|
int hdrlen; /* header length */
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Typedefs for ASN1 function pointers */
|
||||||
|
typedef int ASN1_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len,
|
||||||
|
const ASN1_ITEM *it, int tag, int aclass, char opt,
|
||||||
|
ASN1_TLC *ctx);
|
||||||
|
|
||||||
|
typedef int ASN1_ex_d2i_ex(ASN1_VALUE **pval, const unsigned char **in, long len,
|
||||||
|
const ASN1_ITEM *it, int tag, int aclass, char opt,
|
||||||
|
ASN1_TLC *ctx, OSSL_LIB_CTX *libctx,
|
||||||
|
const char *propq);
|
||||||
|
typedef int ASN1_ex_i2d(const ASN1_VALUE **pval, unsigned char **out,
|
||||||
|
const ASN1_ITEM *it, int tag, int aclass);
|
||||||
|
typedef int ASN1_ex_new_func(ASN1_VALUE **pval, const ASN1_ITEM *it);
|
||||||
|
typedef int ASN1_ex_new_ex_func(ASN1_VALUE **pval, const ASN1_ITEM *it,
|
||||||
|
OSSL_LIB_CTX *libctx, const char *propq);
|
||||||
|
typedef void ASN1_ex_free_func(ASN1_VALUE **pval, const ASN1_ITEM *it);
|
||||||
|
|
||||||
|
typedef int ASN1_ex_print_func(BIO *out, const ASN1_VALUE **pval,
|
||||||
|
int indent, const char *fname,
|
||||||
|
const ASN1_PCTX *pctx);
|
||||||
|
|
||||||
|
typedef int ASN1_primitive_i2c(const ASN1_VALUE **pval, unsigned char *cont,
|
||||||
|
int *putype, const ASN1_ITEM *it);
|
||||||
|
typedef int ASN1_primitive_c2i(ASN1_VALUE **pval, const unsigned char *cont,
|
||||||
|
int len, int utype, char *free_cont,
|
||||||
|
const ASN1_ITEM *it);
|
||||||
|
typedef int ASN1_primitive_print(BIO *out, const ASN1_VALUE **pval,
|
||||||
|
const ASN1_ITEM *it, int indent,
|
||||||
|
const ASN1_PCTX *pctx);
|
||||||
|
|
||||||
|
typedef struct ASN1_EXTERN_FUNCS_st {
|
||||||
|
void *app_data;
|
||||||
|
ASN1_ex_new_func *asn1_ex_new;
|
||||||
|
ASN1_ex_free_func *asn1_ex_free;
|
||||||
|
ASN1_ex_free_func *asn1_ex_clear;
|
||||||
|
ASN1_ex_d2i *asn1_ex_d2i;
|
||||||
|
ASN1_ex_i2d *asn1_ex_i2d;
|
||||||
|
ASN1_ex_print_func *asn1_ex_print;
|
||||||
|
ASN1_ex_new_ex_func *asn1_ex_new_ex;
|
||||||
|
ASN1_ex_d2i_ex *asn1_ex_d2i_ex;
|
||||||
|
} ASN1_EXTERN_FUNCS;
|
||||||
|
|
||||||
|
typedef struct ASN1_PRIMITIVE_FUNCS_st {
|
||||||
|
void *app_data;
|
||||||
|
unsigned long flags;
|
||||||
|
ASN1_ex_new_func *prim_new;
|
||||||
|
ASN1_ex_free_func *prim_free;
|
||||||
|
ASN1_ex_free_func *prim_clear;
|
||||||
|
ASN1_primitive_c2i *prim_c2i;
|
||||||
|
ASN1_primitive_i2c *prim_i2c;
|
||||||
|
ASN1_primitive_print *prim_print;
|
||||||
|
} ASN1_PRIMITIVE_FUNCS;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This is the ASN1_AUX structure: it handles various miscellaneous
|
||||||
|
* requirements. For example the use of reference counts and an informational
|
||||||
|
* callback. The "informational callback" is called at various points during
|
||||||
|
* the ASN1 encoding and decoding. It can be used to provide minor
|
||||||
|
* customisation of the structures used. This is most useful where the
|
||||||
|
* supplied routines *almost* do the right thing but need some extra help at
|
||||||
|
* a few points. If the callback returns zero then it is assumed a fatal
|
||||||
|
* error has occurred and the main operation should be abandoned. If major
|
||||||
|
* changes in the default behaviour are required then an external type is
|
||||||
|
* more appropriate.
|
||||||
|
* For the operations ASN1_OP_I2D_PRE, ASN1_OP_I2D_POST, ASN1_OP_PRINT_PRE, and
|
||||||
|
* ASN1_OP_PRINT_POST, meanwhile a variant of the callback with const parameter
|
||||||
|
* 'in' is provided to make clear statically that its input is not modified. If
|
||||||
|
* and only if this variant is in use the flag ASN1_AFLG_CONST_CB must be set.
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef int ASN1_aux_cb(int operation, ASN1_VALUE **in, const ASN1_ITEM *it,
|
||||||
|
void *exarg);
|
||||||
|
typedef int ASN1_aux_const_cb(int operation, const ASN1_VALUE **in,
|
||||||
|
const ASN1_ITEM *it, void *exarg);
|
||||||
|
|
||||||
|
typedef struct ASN1_AUX_st {
|
||||||
|
void *app_data;
|
||||||
|
int flags;
|
||||||
|
int ref_offset; /* Offset of reference value */
|
||||||
|
int ref_lock; /* Offset of lock value */
|
||||||
|
ASN1_aux_cb *asn1_cb;
|
||||||
|
int enc_offset; /* Offset of ASN1_ENCODING structure */
|
||||||
|
ASN1_aux_const_cb *asn1_const_cb; /* for ASN1_OP_I2D_ and ASN1_OP_PRINT_ */
|
||||||
|
} ASN1_AUX;
|
||||||
|
|
||||||
|
/* For print related callbacks exarg points to this structure */
|
||||||
|
typedef struct ASN1_PRINT_ARG_st {
|
||||||
|
BIO *out;
|
||||||
|
int indent;
|
||||||
|
const ASN1_PCTX *pctx;
|
||||||
|
} ASN1_PRINT_ARG;
|
||||||
|
|
||||||
|
/* For streaming related callbacks exarg points to this structure */
|
||||||
|
typedef struct ASN1_STREAM_ARG_st {
|
||||||
|
/* BIO to stream through */
|
||||||
|
BIO *out;
|
||||||
|
/* BIO with filters appended */
|
||||||
|
BIO *ndef_bio;
|
||||||
|
/* Streaming I/O boundary */
|
||||||
|
unsigned char **boundary;
|
||||||
|
} ASN1_STREAM_ARG;
|
||||||
|
|
||||||
|
/* Flags in ASN1_AUX */
|
||||||
|
|
||||||
|
/* Use a reference count */
|
||||||
|
# define ASN1_AFLG_REFCOUNT 1
|
||||||
|
/* Save the encoding of structure (useful for signatures) */
|
||||||
|
# define ASN1_AFLG_ENCODING 2
|
||||||
|
/* The Sequence length is invalid */
|
||||||
|
# define ASN1_AFLG_BROKEN 4
|
||||||
|
/* Use the new asn1_const_cb */
|
||||||
|
# define ASN1_AFLG_CONST_CB 8
|
||||||
|
|
||||||
|
/* operation values for asn1_cb */
|
||||||
|
|
||||||
|
# define ASN1_OP_NEW_PRE 0
|
||||||
|
# define ASN1_OP_NEW_POST 1
|
||||||
|
# define ASN1_OP_FREE_PRE 2
|
||||||
|
# define ASN1_OP_FREE_POST 3
|
||||||
|
# define ASN1_OP_D2I_PRE 4
|
||||||
|
# define ASN1_OP_D2I_POST 5
|
||||||
|
# define ASN1_OP_I2D_PRE 6
|
||||||
|
# define ASN1_OP_I2D_POST 7
|
||||||
|
# define ASN1_OP_PRINT_PRE 8
|
||||||
|
# define ASN1_OP_PRINT_POST 9
|
||||||
|
# define ASN1_OP_STREAM_PRE 10
|
||||||
|
# define ASN1_OP_STREAM_POST 11
|
||||||
|
# define ASN1_OP_DETACHED_PRE 12
|
||||||
|
# define ASN1_OP_DETACHED_POST 13
|
||||||
|
# define ASN1_OP_DUP_PRE 14
|
||||||
|
# define ASN1_OP_DUP_POST 15
|
||||||
|
# define ASN1_OP_GET0_LIBCTX 16
|
||||||
|
# define ASN1_OP_GET0_PROPQ 17
|
||||||
|
|
||||||
|
/* Macro to implement a primitive type */
|
||||||
|
# define IMPLEMENT_ASN1_TYPE(stname) IMPLEMENT_ASN1_TYPE_ex(stname, stname, 0)
|
||||||
|
# define IMPLEMENT_ASN1_TYPE_ex(itname, vname, ex) \
|
||||||
|
ASN1_ITEM_start(itname) \
|
||||||
|
ASN1_ITYPE_PRIMITIVE, V_##vname, NULL, 0, NULL, ex, #itname \
|
||||||
|
ASN1_ITEM_end(itname)
|
||||||
|
|
||||||
|
/* Macro to implement a multi string type */
|
||||||
|
# define IMPLEMENT_ASN1_MSTRING(itname, mask) \
|
||||||
|
ASN1_ITEM_start(itname) \
|
||||||
|
ASN1_ITYPE_MSTRING, mask, NULL, 0, NULL, sizeof(ASN1_STRING), #itname \
|
||||||
|
ASN1_ITEM_end(itname)
|
||||||
|
|
||||||
|
# define IMPLEMENT_EXTERN_ASN1(sname, tag, fptrs) \
|
||||||
|
ASN1_ITEM_start(sname) \
|
||||||
|
ASN1_ITYPE_EXTERN, \
|
||||||
|
tag, \
|
||||||
|
NULL, \
|
||||||
|
0, \
|
||||||
|
&fptrs, \
|
||||||
|
0, \
|
||||||
|
#sname \
|
||||||
|
ASN1_ITEM_end(sname)
|
||||||
|
|
||||||
|
/* Macro to implement standard functions in terms of ASN1_ITEM structures */
|
||||||
|
|
||||||
|
# define IMPLEMENT_ASN1_FUNCTIONS(stname) IMPLEMENT_ASN1_FUNCTIONS_fname(stname, stname, stname)
|
||||||
|
|
||||||
|
# define IMPLEMENT_ASN1_FUNCTIONS_name(stname, itname) IMPLEMENT_ASN1_FUNCTIONS_fname(stname, itname, itname)
|
||||||
|
|
||||||
|
# define IMPLEMENT_ASN1_FUNCTIONS_ENCODE_name(stname, itname) \
|
||||||
|
IMPLEMENT_ASN1_FUNCTIONS_ENCODE_fname(stname, itname, itname)
|
||||||
|
|
||||||
|
# define IMPLEMENT_STATIC_ASN1_ALLOC_FUNCTIONS(stname) \
|
||||||
|
IMPLEMENT_ASN1_ALLOC_FUNCTIONS_pfname(static, stname, stname, stname)
|
||||||
|
|
||||||
|
# define IMPLEMENT_ASN1_ALLOC_FUNCTIONS(stname) \
|
||||||
|
IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, stname, stname)
|
||||||
|
|
||||||
|
# define IMPLEMENT_ASN1_ALLOC_FUNCTIONS_pfname(pre, stname, itname, fname) \
|
||||||
|
pre stname *fname##_new(void) \
|
||||||
|
{ \
|
||||||
|
return (stname *)ASN1_item_new(ASN1_ITEM_rptr(itname)); \
|
||||||
|
} \
|
||||||
|
pre void fname##_free(stname *a) \
|
||||||
|
{ \
|
||||||
|
ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \
|
||||||
|
}
|
||||||
|
|
||||||
|
# define IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) \
|
||||||
|
stname *fname##_new(void) \
|
||||||
|
{ \
|
||||||
|
return (stname *)ASN1_item_new(ASN1_ITEM_rptr(itname)); \
|
||||||
|
} \
|
||||||
|
void fname##_free(stname *a) \
|
||||||
|
{ \
|
||||||
|
ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \
|
||||||
|
}
|
||||||
|
|
||||||
|
# define IMPLEMENT_ASN1_FUNCTIONS_fname(stname, itname, fname) \
|
||||||
|
IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(stname, itname, fname) \
|
||||||
|
IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname)
|
||||||
|
|
||||||
|
# define IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(stname, itname, fname) \
|
||||||
|
stname *d2i_##fname(stname **a, const unsigned char **in, long len) \
|
||||||
|
{ \
|
||||||
|
return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\
|
||||||
|
} \
|
||||||
|
int i2d_##fname(const stname *a, unsigned char **out) \
|
||||||
|
{ \
|
||||||
|
return ASN1_item_i2d((const ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\
|
||||||
|
}
|
||||||
|
|
||||||
|
# define IMPLEMENT_ASN1_NDEF_FUNCTION(stname) \
|
||||||
|
int i2d_##stname##_NDEF(const stname *a, unsigned char **out) \
|
||||||
|
{ \
|
||||||
|
return ASN1_item_ndef_i2d((const ASN1_VALUE *)a, out, ASN1_ITEM_rptr(stname));\
|
||||||
|
}
|
||||||
|
|
||||||
|
# define IMPLEMENT_STATIC_ASN1_ENCODE_FUNCTIONS(stname) \
|
||||||
|
static stname *d2i_##stname(stname **a, \
|
||||||
|
const unsigned char **in, long len) \
|
||||||
|
{ \
|
||||||
|
return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, \
|
||||||
|
ASN1_ITEM_rptr(stname)); \
|
||||||
|
} \
|
||||||
|
static int i2d_##stname(const stname *a, unsigned char **out) \
|
||||||
|
{ \
|
||||||
|
return ASN1_item_i2d((const ASN1_VALUE *)a, out, \
|
||||||
|
ASN1_ITEM_rptr(stname)); \
|
||||||
|
}
|
||||||
|
|
||||||
|
# define IMPLEMENT_ASN1_DUP_FUNCTION(stname) \
|
||||||
|
stname * stname##_dup(const stname *x) \
|
||||||
|
{ \
|
||||||
|
return ASN1_item_dup(ASN1_ITEM_rptr(stname), x); \
|
||||||
|
}
|
||||||
|
|
||||||
|
# define IMPLEMENT_ASN1_PRINT_FUNCTION(stname) \
|
||||||
|
IMPLEMENT_ASN1_PRINT_FUNCTION_fname(stname, stname, stname)
|
||||||
|
|
||||||
|
# define IMPLEMENT_ASN1_PRINT_FUNCTION_fname(stname, itname, fname) \
|
||||||
|
int fname##_print_ctx(BIO *out, const stname *x, int indent, \
|
||||||
|
const ASN1_PCTX *pctx) \
|
||||||
|
{ \
|
||||||
|
return ASN1_item_print(out, (const ASN1_VALUE *)x, indent, \
|
||||||
|
ASN1_ITEM_rptr(itname), pctx); \
|
||||||
|
}
|
||||||
|
|
||||||
|
/* external definitions for primitive types */
|
||||||
|
|
||||||
|
DECLARE_ASN1_ITEM(ASN1_BOOLEAN)
|
||||||
|
DECLARE_ASN1_ITEM(ASN1_TBOOLEAN)
|
||||||
|
DECLARE_ASN1_ITEM(ASN1_FBOOLEAN)
|
||||||
|
DECLARE_ASN1_ITEM(ASN1_SEQUENCE)
|
||||||
|
DECLARE_ASN1_ITEM(CBIGNUM)
|
||||||
|
DECLARE_ASN1_ITEM(BIGNUM)
|
||||||
|
DECLARE_ASN1_ITEM(INT32)
|
||||||
|
DECLARE_ASN1_ITEM(ZINT32)
|
||||||
|
DECLARE_ASN1_ITEM(UINT32)
|
||||||
|
DECLARE_ASN1_ITEM(ZUINT32)
|
||||||
|
DECLARE_ASN1_ITEM(INT64)
|
||||||
|
DECLARE_ASN1_ITEM(ZINT64)
|
||||||
|
DECLARE_ASN1_ITEM(UINT64)
|
||||||
|
DECLARE_ASN1_ITEM(ZUINT64)
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
/*
|
||||||
|
* LONG and ZLONG are strongly discouraged for use as stored data, as the
|
||||||
|
* underlying C type (long) differs in size depending on the architecture.
|
||||||
|
* They are designed with 32-bit longs in mind.
|
||||||
|
*/
|
||||||
|
DECLARE_ASN1_ITEM(LONG)
|
||||||
|
DECLARE_ASN1_ITEM(ZLONG)
|
||||||
|
# endif
|
||||||
|
|
||||||
|
SKM_DEFINE_STACK_OF_INTERNAL(ASN1_VALUE, ASN1_VALUE, ASN1_VALUE)
|
||||||
|
#define sk_ASN1_VALUE_num(sk) OPENSSL_sk_num(ossl_check_const_ASN1_VALUE_sk_type(sk))
|
||||||
|
#define sk_ASN1_VALUE_value(sk, idx) ((ASN1_VALUE *)OPENSSL_sk_value(ossl_check_const_ASN1_VALUE_sk_type(sk), (idx)))
|
||||||
|
#define sk_ASN1_VALUE_new(cmp) ((STACK_OF(ASN1_VALUE) *)OPENSSL_sk_new(ossl_check_ASN1_VALUE_compfunc_type(cmp)))
|
||||||
|
#define sk_ASN1_VALUE_new_null() ((STACK_OF(ASN1_VALUE) *)OPENSSL_sk_new_null())
|
||||||
|
#define sk_ASN1_VALUE_new_reserve(cmp, n) ((STACK_OF(ASN1_VALUE) *)OPENSSL_sk_new_reserve(ossl_check_ASN1_VALUE_compfunc_type(cmp), (n)))
|
||||||
|
#define sk_ASN1_VALUE_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_ASN1_VALUE_sk_type(sk), (n))
|
||||||
|
#define sk_ASN1_VALUE_free(sk) OPENSSL_sk_free(ossl_check_ASN1_VALUE_sk_type(sk))
|
||||||
|
#define sk_ASN1_VALUE_zero(sk) OPENSSL_sk_zero(ossl_check_ASN1_VALUE_sk_type(sk))
|
||||||
|
#define sk_ASN1_VALUE_delete(sk, i) ((ASN1_VALUE *)OPENSSL_sk_delete(ossl_check_ASN1_VALUE_sk_type(sk), (i)))
|
||||||
|
#define sk_ASN1_VALUE_delete_ptr(sk, ptr) ((ASN1_VALUE *)OPENSSL_sk_delete_ptr(ossl_check_ASN1_VALUE_sk_type(sk), ossl_check_ASN1_VALUE_type(ptr)))
|
||||||
|
#define sk_ASN1_VALUE_push(sk, ptr) OPENSSL_sk_push(ossl_check_ASN1_VALUE_sk_type(sk), ossl_check_ASN1_VALUE_type(ptr))
|
||||||
|
#define sk_ASN1_VALUE_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_ASN1_VALUE_sk_type(sk), ossl_check_ASN1_VALUE_type(ptr))
|
||||||
|
#define sk_ASN1_VALUE_pop(sk) ((ASN1_VALUE *)OPENSSL_sk_pop(ossl_check_ASN1_VALUE_sk_type(sk)))
|
||||||
|
#define sk_ASN1_VALUE_shift(sk) ((ASN1_VALUE *)OPENSSL_sk_shift(ossl_check_ASN1_VALUE_sk_type(sk)))
|
||||||
|
#define sk_ASN1_VALUE_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_ASN1_VALUE_sk_type(sk),ossl_check_ASN1_VALUE_freefunc_type(freefunc))
|
||||||
|
#define sk_ASN1_VALUE_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_ASN1_VALUE_sk_type(sk), ossl_check_ASN1_VALUE_type(ptr), (idx))
|
||||||
|
#define sk_ASN1_VALUE_set(sk, idx, ptr) ((ASN1_VALUE *)OPENSSL_sk_set(ossl_check_ASN1_VALUE_sk_type(sk), (idx), ossl_check_ASN1_VALUE_type(ptr)))
|
||||||
|
#define sk_ASN1_VALUE_find(sk, ptr) OPENSSL_sk_find(ossl_check_ASN1_VALUE_sk_type(sk), ossl_check_ASN1_VALUE_type(ptr))
|
||||||
|
#define sk_ASN1_VALUE_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_ASN1_VALUE_sk_type(sk), ossl_check_ASN1_VALUE_type(ptr))
|
||||||
|
#define sk_ASN1_VALUE_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_ASN1_VALUE_sk_type(sk), ossl_check_ASN1_VALUE_type(ptr), pnum)
|
||||||
|
#define sk_ASN1_VALUE_sort(sk) OPENSSL_sk_sort(ossl_check_ASN1_VALUE_sk_type(sk))
|
||||||
|
#define sk_ASN1_VALUE_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_ASN1_VALUE_sk_type(sk))
|
||||||
|
#define sk_ASN1_VALUE_dup(sk) ((STACK_OF(ASN1_VALUE) *)OPENSSL_sk_dup(ossl_check_const_ASN1_VALUE_sk_type(sk)))
|
||||||
|
#define sk_ASN1_VALUE_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(ASN1_VALUE) *)OPENSSL_sk_deep_copy(ossl_check_const_ASN1_VALUE_sk_type(sk), ossl_check_ASN1_VALUE_copyfunc_type(copyfunc), ossl_check_ASN1_VALUE_freefunc_type(freefunc)))
|
||||||
|
#define sk_ASN1_VALUE_set_cmp_func(sk, cmp) ((sk_ASN1_VALUE_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_ASN1_VALUE_sk_type(sk), ossl_check_ASN1_VALUE_compfunc_type(cmp)))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Functions used internally by the ASN1 code */
|
||||||
|
|
||||||
|
int ASN1_item_ex_new(ASN1_VALUE **pval, const ASN1_ITEM *it);
|
||||||
|
void ASN1_item_ex_free(ASN1_VALUE **pval, const ASN1_ITEM *it);
|
||||||
|
|
||||||
|
int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len,
|
||||||
|
const ASN1_ITEM *it, int tag, int aclass, char opt,
|
||||||
|
ASN1_TLC *ctx);
|
||||||
|
|
||||||
|
int ASN1_item_ex_i2d(const ASN1_VALUE **pval, unsigned char **out,
|
||||||
|
const ASN1_ITEM *it, int tag, int aclass);
|
||||||
|
|
||||||
|
/* Legacy compatibility */
|
||||||
|
# define IMPLEMENT_ASN1_FUNCTIONS_const(name) IMPLEMENT_ASN1_FUNCTIONS(name)
|
||||||
|
# define IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(stname, itname, fname) \
|
||||||
|
IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(stname, itname, fname)
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,104 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2015-2022 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#ifndef OPENSSL_ASYNC_H
|
||||||
|
# define OPENSSL_ASYNC_H
|
||||||
|
# pragma once
|
||||||
|
|
||||||
|
# include <openssl/macros.h>
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
# define HEADER_ASYNC_H
|
||||||
|
# endif
|
||||||
|
|
||||||
|
#if defined(_WIN32)
|
||||||
|
# if defined(BASETYPES) || defined(_WINDEF_H)
|
||||||
|
/* application has to include <windows.h> to use this */
|
||||||
|
#define OSSL_ASYNC_FD HANDLE
|
||||||
|
#define OSSL_BAD_ASYNC_FD INVALID_HANDLE_VALUE
|
||||||
|
# endif
|
||||||
|
#else
|
||||||
|
#define OSSL_ASYNC_FD int
|
||||||
|
#define OSSL_BAD_ASYNC_FD -1
|
||||||
|
#endif
|
||||||
|
# include <openssl/asyncerr.h>
|
||||||
|
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
# endif
|
||||||
|
|
||||||
|
typedef struct async_job_st ASYNC_JOB;
|
||||||
|
typedef struct async_wait_ctx_st ASYNC_WAIT_CTX;
|
||||||
|
typedef int (*ASYNC_callback_fn)(void *arg);
|
||||||
|
|
||||||
|
#define ASYNC_ERR 0
|
||||||
|
#define ASYNC_NO_JOBS 1
|
||||||
|
#define ASYNC_PAUSE 2
|
||||||
|
#define ASYNC_FINISH 3
|
||||||
|
|
||||||
|
#define ASYNC_STATUS_UNSUPPORTED 0
|
||||||
|
#define ASYNC_STATUS_ERR 1
|
||||||
|
#define ASYNC_STATUS_OK 2
|
||||||
|
#define ASYNC_STATUS_EAGAIN 3
|
||||||
|
|
||||||
|
int ASYNC_init_thread(size_t max_size, size_t init_size);
|
||||||
|
void ASYNC_cleanup_thread(void);
|
||||||
|
|
||||||
|
#ifdef OSSL_ASYNC_FD
|
||||||
|
ASYNC_WAIT_CTX *ASYNC_WAIT_CTX_new(void);
|
||||||
|
void ASYNC_WAIT_CTX_free(ASYNC_WAIT_CTX *ctx);
|
||||||
|
int ASYNC_WAIT_CTX_set_wait_fd(ASYNC_WAIT_CTX *ctx, const void *key,
|
||||||
|
OSSL_ASYNC_FD fd,
|
||||||
|
void *custom_data,
|
||||||
|
void (*cleanup)(ASYNC_WAIT_CTX *, const void *,
|
||||||
|
OSSL_ASYNC_FD, void *));
|
||||||
|
int ASYNC_WAIT_CTX_get_fd(ASYNC_WAIT_CTX *ctx, const void *key,
|
||||||
|
OSSL_ASYNC_FD *fd, void **custom_data);
|
||||||
|
int ASYNC_WAIT_CTX_get_all_fds(ASYNC_WAIT_CTX *ctx, OSSL_ASYNC_FD *fd,
|
||||||
|
size_t *numfds);
|
||||||
|
int ASYNC_WAIT_CTX_get_callback(ASYNC_WAIT_CTX *ctx,
|
||||||
|
ASYNC_callback_fn *callback,
|
||||||
|
void **callback_arg);
|
||||||
|
int ASYNC_WAIT_CTX_set_callback(ASYNC_WAIT_CTX *ctx,
|
||||||
|
ASYNC_callback_fn callback,
|
||||||
|
void *callback_arg);
|
||||||
|
int ASYNC_WAIT_CTX_set_status(ASYNC_WAIT_CTX *ctx, int status);
|
||||||
|
int ASYNC_WAIT_CTX_get_status(ASYNC_WAIT_CTX *ctx);
|
||||||
|
int ASYNC_WAIT_CTX_get_changed_fds(ASYNC_WAIT_CTX *ctx, OSSL_ASYNC_FD *addfd,
|
||||||
|
size_t *numaddfds, OSSL_ASYNC_FD *delfd,
|
||||||
|
size_t *numdelfds);
|
||||||
|
int ASYNC_WAIT_CTX_clear_fd(ASYNC_WAIT_CTX *ctx, const void *key);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int ASYNC_is_capable(void);
|
||||||
|
|
||||||
|
typedef void *(*ASYNC_stack_alloc_fn)(size_t *num);
|
||||||
|
typedef void (*ASYNC_stack_free_fn)(void *addr);
|
||||||
|
|
||||||
|
int ASYNC_set_mem_functions(ASYNC_stack_alloc_fn alloc_fn,
|
||||||
|
ASYNC_stack_free_fn free_fn);
|
||||||
|
void ASYNC_get_mem_functions(ASYNC_stack_alloc_fn *alloc_fn,
|
||||||
|
ASYNC_stack_free_fn *free_fn);
|
||||||
|
|
||||||
|
int ASYNC_start_job(ASYNC_JOB **job, ASYNC_WAIT_CTX *ctx, int *ret,
|
||||||
|
int (*func)(void *), void *args, size_t size);
|
||||||
|
int ASYNC_pause_job(void);
|
||||||
|
|
||||||
|
ASYNC_JOB *ASYNC_get_current_job(void);
|
||||||
|
ASYNC_WAIT_CTX *ASYNC_get_wait_ctx(ASYNC_JOB *job);
|
||||||
|
void ASYNC_block_pause(void);
|
||||||
|
void ASYNC_unblock_pause(void);
|
||||||
|
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* Generated by util/mkerr.pl DO NOT EDIT
|
||||||
|
* Copyright 1995-2021 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef OPENSSL_ASYNCERR_H
|
||||||
|
# define OPENSSL_ASYNCERR_H
|
||||||
|
# pragma once
|
||||||
|
|
||||||
|
# include <openssl/opensslconf.h>
|
||||||
|
# include <openssl/symhacks.h>
|
||||||
|
# include <openssl/cryptoerr_legacy.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ASYNC reason codes.
|
||||||
|
*/
|
||||||
|
# define ASYNC_R_FAILED_TO_SET_POOL 101
|
||||||
|
# define ASYNC_R_FAILED_TO_SWAP_CONTEXT 102
|
||||||
|
# define ASYNC_R_INIT_FAILED 105
|
||||||
|
# define ASYNC_R_INVALID_POOL_SIZE 103
|
||||||
|
|
||||||
|
#endif
|
||||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,72 @@
|
|||||||
|
/*
|
||||||
|
* Generated by util/mkerr.pl DO NOT EDIT
|
||||||
|
* Copyright 1995-2022 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef OPENSSL_BIOERR_H
|
||||||
|
# define OPENSSL_BIOERR_H
|
||||||
|
# pragma once
|
||||||
|
|
||||||
|
# include <openssl/opensslconf.h>
|
||||||
|
# include <openssl/symhacks.h>
|
||||||
|
# include <openssl/cryptoerr_legacy.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* BIO reason codes.
|
||||||
|
*/
|
||||||
|
# define BIO_R_ACCEPT_ERROR 100
|
||||||
|
# define BIO_R_ADDRINFO_ADDR_IS_NOT_AF_INET 141
|
||||||
|
# define BIO_R_AMBIGUOUS_HOST_OR_SERVICE 129
|
||||||
|
# define BIO_R_BAD_FOPEN_MODE 101
|
||||||
|
# define BIO_R_BROKEN_PIPE 124
|
||||||
|
# define BIO_R_CONNECT_ERROR 103
|
||||||
|
# define BIO_R_CONNECT_TIMEOUT 147
|
||||||
|
# define BIO_R_GETHOSTBYNAME_ADDR_IS_NOT_AF_INET 107
|
||||||
|
# define BIO_R_GETSOCKNAME_ERROR 132
|
||||||
|
# define BIO_R_GETSOCKNAME_TRUNCATED_ADDRESS 133
|
||||||
|
# define BIO_R_GETTING_SOCKTYPE 134
|
||||||
|
# define BIO_R_INVALID_ARGUMENT 125
|
||||||
|
# define BIO_R_INVALID_SOCKET 135
|
||||||
|
# define BIO_R_IN_USE 123
|
||||||
|
# define BIO_R_LENGTH_TOO_LONG 102
|
||||||
|
# define BIO_R_LISTEN_V6_ONLY 136
|
||||||
|
# define BIO_R_LOCAL_ADDR_NOT_AVAILABLE 111
|
||||||
|
# define BIO_R_LOOKUP_RETURNED_NOTHING 142
|
||||||
|
# define BIO_R_MALFORMED_HOST_OR_SERVICE 130
|
||||||
|
# define BIO_R_NBIO_CONNECT_ERROR 110
|
||||||
|
# define BIO_R_NON_FATAL 112
|
||||||
|
# define BIO_R_NO_ACCEPT_ADDR_OR_SERVICE_SPECIFIED 143
|
||||||
|
# define BIO_R_NO_HOSTNAME_OR_SERVICE_SPECIFIED 144
|
||||||
|
# define BIO_R_NO_PORT_DEFINED 113
|
||||||
|
# define BIO_R_NO_SUCH_FILE 128
|
||||||
|
# define BIO_R_NULL_PARAMETER 115 /* unused */
|
||||||
|
# define BIO_R_TFO_DISABLED 106
|
||||||
|
# define BIO_R_TFO_NO_KERNEL_SUPPORT 108
|
||||||
|
# define BIO_R_TRANSFER_ERROR 104
|
||||||
|
# define BIO_R_TRANSFER_TIMEOUT 105
|
||||||
|
# define BIO_R_UNABLE_TO_BIND_SOCKET 117
|
||||||
|
# define BIO_R_UNABLE_TO_CREATE_SOCKET 118
|
||||||
|
# define BIO_R_UNABLE_TO_KEEPALIVE 137
|
||||||
|
# define BIO_R_UNABLE_TO_LISTEN_SOCKET 119
|
||||||
|
# define BIO_R_UNABLE_TO_NODELAY 138
|
||||||
|
# define BIO_R_UNABLE_TO_REUSEADDR 139
|
||||||
|
# define BIO_R_UNABLE_TO_TFO 109
|
||||||
|
# define BIO_R_UNAVAILABLE_IP_FAMILY 145
|
||||||
|
# define BIO_R_UNINITIALIZED 120
|
||||||
|
# define BIO_R_UNKNOWN_INFO_TYPE 140
|
||||||
|
# define BIO_R_UNSUPPORTED_IP_FAMILY 146
|
||||||
|
# define BIO_R_UNSUPPORTED_METHOD 121
|
||||||
|
# define BIO_R_UNSUPPORTED_PROTOCOL_FAMILY 131
|
||||||
|
# define BIO_R_WRITE_TO_READ_ONLY_BIO 126
|
||||||
|
# define BIO_R_WSASTARTUP 122
|
||||||
|
# define BIO_R_PORT_MISMATCH 150
|
||||||
|
# define BIO_R_PEER_ADDR_NOT_AVAILABLE 151
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 1995-2020 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef OPENSSL_BLOWFISH_H
|
||||||
|
# define OPENSSL_BLOWFISH_H
|
||||||
|
# pragma once
|
||||||
|
|
||||||
|
# include <openssl/macros.h>
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
# define HEADER_BLOWFISH_H
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# include <openssl/opensslconf.h>
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_BF
|
||||||
|
# include <openssl/e_os2.h>
|
||||||
|
# ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# define BF_BLOCK 8
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
|
||||||
|
# define BF_ENCRYPT 1
|
||||||
|
# define BF_DECRYPT 0
|
||||||
|
|
||||||
|
/*-
|
||||||
|
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
* ! BF_LONG has to be at least 32 bits wide. !
|
||||||
|
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
*/
|
||||||
|
# define BF_LONG unsigned int
|
||||||
|
|
||||||
|
# define BF_ROUNDS 16
|
||||||
|
|
||||||
|
typedef struct bf_key_st {
|
||||||
|
BF_LONG P[BF_ROUNDS + 2];
|
||||||
|
BF_LONG S[4 * 256];
|
||||||
|
} BF_KEY;
|
||||||
|
|
||||||
|
# endif /* OPENSSL_NO_DEPRECATED_3_0 */
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
OSSL_DEPRECATEDIN_3_0 void BF_set_key(BF_KEY *key, int len,
|
||||||
|
const unsigned char *data);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 void BF_encrypt(BF_LONG *data, const BF_KEY *key);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 void BF_decrypt(BF_LONG *data, const BF_KEY *key);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 void BF_ecb_encrypt(const unsigned char *in,
|
||||||
|
unsigned char *out, const BF_KEY *key,
|
||||||
|
int enc);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 void BF_cbc_encrypt(const unsigned char *in,
|
||||||
|
unsigned char *out, long length,
|
||||||
|
const BF_KEY *schedule,
|
||||||
|
unsigned char *ivec, int enc);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 void BF_cfb64_encrypt(const unsigned char *in,
|
||||||
|
unsigned char *out,
|
||||||
|
long length, const BF_KEY *schedule,
|
||||||
|
unsigned char *ivec, int *num,
|
||||||
|
int enc);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 void BF_ofb64_encrypt(const unsigned char *in,
|
||||||
|
unsigned char *out,
|
||||||
|
long length, const BF_KEY *schedule,
|
||||||
|
unsigned char *ivec, int *num);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 const char *BF_options(void);
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,590 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 1995-2022 The OpenSSL Project Authors. All Rights Reserved.
|
||||||
|
* Copyright (c) 2002, Oracle and/or its affiliates. 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef OPENSSL_BN_H
|
||||||
|
# define OPENSSL_BN_H
|
||||||
|
# pragma once
|
||||||
|
|
||||||
|
# include <openssl/macros.h>
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
# define HEADER_BN_H
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# include <openssl/e_os2.h>
|
||||||
|
# ifndef OPENSSL_NO_STDIO
|
||||||
|
# include <stdio.h>
|
||||||
|
# endif
|
||||||
|
# include <openssl/opensslconf.h>
|
||||||
|
# include <openssl/types.h>
|
||||||
|
# include <openssl/crypto.h>
|
||||||
|
# include <openssl/bnerr.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 64-bit processor with LP64 ABI
|
||||||
|
*/
|
||||||
|
# ifdef SIXTY_FOUR_BIT_LONG
|
||||||
|
# define BN_ULONG unsigned long
|
||||||
|
# define BN_BYTES 8
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 64-bit processor other than LP64 ABI
|
||||||
|
*/
|
||||||
|
# ifdef SIXTY_FOUR_BIT
|
||||||
|
# define BN_ULONG unsigned long long
|
||||||
|
# define BN_BYTES 8
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifdef THIRTY_TWO_BIT
|
||||||
|
# define BN_ULONG unsigned int
|
||||||
|
# define BN_BYTES 4
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# define BN_BITS2 (BN_BYTES * 8)
|
||||||
|
# define BN_BITS (BN_BITS2 * 2)
|
||||||
|
# define BN_TBIT ((BN_ULONG)1 << (BN_BITS2 - 1))
|
||||||
|
|
||||||
|
# define BN_FLG_MALLOCED 0x01
|
||||||
|
# define BN_FLG_STATIC_DATA 0x02
|
||||||
|
|
||||||
|
/*
|
||||||
|
* avoid leaking exponent information through timing,
|
||||||
|
* BN_mod_exp_mont() will call BN_mod_exp_mont_consttime,
|
||||||
|
* BN_div() will call BN_div_no_branch,
|
||||||
|
* BN_mod_inverse() will call bn_mod_inverse_no_branch.
|
||||||
|
*/
|
||||||
|
# define BN_FLG_CONSTTIME 0x04
|
||||||
|
# define BN_FLG_SECURE 0x08
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_0_9_8
|
||||||
|
/* deprecated name for the flag */
|
||||||
|
# define BN_FLG_EXP_CONSTTIME BN_FLG_CONSTTIME
|
||||||
|
# define BN_FLG_FREE 0x8000 /* used for debugging */
|
||||||
|
# endif
|
||||||
|
|
||||||
|
void BN_set_flags(BIGNUM *b, int n);
|
||||||
|
int BN_get_flags(const BIGNUM *b, int n);
|
||||||
|
|
||||||
|
/* Values for |top| in BN_rand() */
|
||||||
|
#define BN_RAND_TOP_ANY -1
|
||||||
|
#define BN_RAND_TOP_ONE 0
|
||||||
|
#define BN_RAND_TOP_TWO 1
|
||||||
|
|
||||||
|
/* Values for |bottom| in BN_rand() */
|
||||||
|
#define BN_RAND_BOTTOM_ANY 0
|
||||||
|
#define BN_RAND_BOTTOM_ODD 1
|
||||||
|
|
||||||
|
/*
|
||||||
|
* get a clone of a BIGNUM with changed flags, for *temporary* use only (the
|
||||||
|
* two BIGNUMs cannot be used in parallel!). Also only for *read only* use. The
|
||||||
|
* value |dest| should be a newly allocated BIGNUM obtained via BN_new() that
|
||||||
|
* has not been otherwise initialised or used.
|
||||||
|
*/
|
||||||
|
void BN_with_flags(BIGNUM *dest, const BIGNUM *b, int flags);
|
||||||
|
|
||||||
|
/* Wrapper function to make using BN_GENCB easier */
|
||||||
|
int BN_GENCB_call(BN_GENCB *cb, int a, int b);
|
||||||
|
|
||||||
|
BN_GENCB *BN_GENCB_new(void);
|
||||||
|
void BN_GENCB_free(BN_GENCB *cb);
|
||||||
|
|
||||||
|
/* Populate a BN_GENCB structure with an "old"-style callback */
|
||||||
|
void BN_GENCB_set_old(BN_GENCB *gencb, void (*callback) (int, int, void *),
|
||||||
|
void *cb_arg);
|
||||||
|
|
||||||
|
/* Populate a BN_GENCB structure with a "new"-style callback */
|
||||||
|
void BN_GENCB_set(BN_GENCB *gencb, int (*callback) (int, int, BN_GENCB *),
|
||||||
|
void *cb_arg);
|
||||||
|
|
||||||
|
void *BN_GENCB_get_arg(BN_GENCB *cb);
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
# define BN_prime_checks 0 /* default: select number of iterations based
|
||||||
|
* on the size of the number */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* BN_prime_checks_for_size() returns the number of Miller-Rabin iterations
|
||||||
|
* that will be done for checking that a random number is probably prime. The
|
||||||
|
* error rate for accepting a composite number as prime depends on the size of
|
||||||
|
* the prime |b|. The error rates used are for calculating an RSA key with 2 primes,
|
||||||
|
* and so the level is what you would expect for a key of double the size of the
|
||||||
|
* prime.
|
||||||
|
*
|
||||||
|
* This table is generated using the algorithm of FIPS PUB 186-4
|
||||||
|
* Digital Signature Standard (DSS), section F.1, page 117.
|
||||||
|
* (https://dx.doi.org/10.6028/NIST.FIPS.186-4)
|
||||||
|
*
|
||||||
|
* The following magma script was used to generate the output:
|
||||||
|
* securitybits:=125;
|
||||||
|
* k:=1024;
|
||||||
|
* for t:=1 to 65 do
|
||||||
|
* for M:=3 to Floor(2*Sqrt(k-1)-1) do
|
||||||
|
* S:=0;
|
||||||
|
* // Sum over m
|
||||||
|
* for m:=3 to M do
|
||||||
|
* s:=0;
|
||||||
|
* // Sum over j
|
||||||
|
* for j:=2 to m do
|
||||||
|
* s+:=(RealField(32)!2)^-(j+(k-1)/j);
|
||||||
|
* end for;
|
||||||
|
* S+:=2^(m-(m-1)*t)*s;
|
||||||
|
* end for;
|
||||||
|
* A:=2^(k-2-M*t);
|
||||||
|
* B:=8*(Pi(RealField(32))^2-6)/3*2^(k-2)*S;
|
||||||
|
* pkt:=2.00743*Log(2)*k*2^-k*(A+B);
|
||||||
|
* seclevel:=Floor(-Log(2,pkt));
|
||||||
|
* if seclevel ge securitybits then
|
||||||
|
* printf "k: %5o, security: %o bits (t: %o, M: %o)\n",k,seclevel,t,M;
|
||||||
|
* break;
|
||||||
|
* end if;
|
||||||
|
* end for;
|
||||||
|
* if seclevel ge securitybits then break; end if;
|
||||||
|
* end for;
|
||||||
|
*
|
||||||
|
* It can be run online at:
|
||||||
|
* http://magma.maths.usyd.edu.au/calc
|
||||||
|
*
|
||||||
|
* And will output:
|
||||||
|
* k: 1024, security: 129 bits (t: 6, M: 23)
|
||||||
|
*
|
||||||
|
* k is the number of bits of the prime, securitybits is the level we want to
|
||||||
|
* reach.
|
||||||
|
*
|
||||||
|
* prime length | RSA key size | # MR tests | security level
|
||||||
|
* -------------+--------------|------------+---------------
|
||||||
|
* (b) >= 6394 | >= 12788 | 3 | 256 bit
|
||||||
|
* (b) >= 3747 | >= 7494 | 3 | 192 bit
|
||||||
|
* (b) >= 1345 | >= 2690 | 4 | 128 bit
|
||||||
|
* (b) >= 1080 | >= 2160 | 5 | 128 bit
|
||||||
|
* (b) >= 852 | >= 1704 | 5 | 112 bit
|
||||||
|
* (b) >= 476 | >= 952 | 5 | 80 bit
|
||||||
|
* (b) >= 400 | >= 800 | 6 | 80 bit
|
||||||
|
* (b) >= 347 | >= 694 | 7 | 80 bit
|
||||||
|
* (b) >= 308 | >= 616 | 8 | 80 bit
|
||||||
|
* (b) >= 55 | >= 110 | 27 | 64 bit
|
||||||
|
* (b) >= 6 | >= 12 | 34 | 64 bit
|
||||||
|
*/
|
||||||
|
|
||||||
|
# define BN_prime_checks_for_size(b) ((b) >= 3747 ? 3 : \
|
||||||
|
(b) >= 1345 ? 4 : \
|
||||||
|
(b) >= 476 ? 5 : \
|
||||||
|
(b) >= 400 ? 6 : \
|
||||||
|
(b) >= 347 ? 7 : \
|
||||||
|
(b) >= 308 ? 8 : \
|
||||||
|
(b) >= 55 ? 27 : \
|
||||||
|
/* b >= 6 */ 34)
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# define BN_num_bytes(a) ((BN_num_bits(a)+7)/8)
|
||||||
|
|
||||||
|
int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w);
|
||||||
|
int BN_is_zero(const BIGNUM *a);
|
||||||
|
int BN_is_one(const BIGNUM *a);
|
||||||
|
int BN_is_word(const BIGNUM *a, const BN_ULONG w);
|
||||||
|
int BN_is_odd(const BIGNUM *a);
|
||||||
|
|
||||||
|
# define BN_one(a) (BN_set_word((a),1))
|
||||||
|
|
||||||
|
void BN_zero_ex(BIGNUM *a);
|
||||||
|
|
||||||
|
# if OPENSSL_API_LEVEL > 908
|
||||||
|
# define BN_zero(a) BN_zero_ex(a)
|
||||||
|
# else
|
||||||
|
# define BN_zero(a) (BN_set_word((a),0))
|
||||||
|
# endif
|
||||||
|
|
||||||
|
const BIGNUM *BN_value_one(void);
|
||||||
|
char *BN_options(void);
|
||||||
|
BN_CTX *BN_CTX_new_ex(OSSL_LIB_CTX *ctx);
|
||||||
|
BN_CTX *BN_CTX_new(void);
|
||||||
|
BN_CTX *BN_CTX_secure_new_ex(OSSL_LIB_CTX *ctx);
|
||||||
|
BN_CTX *BN_CTX_secure_new(void);
|
||||||
|
void BN_CTX_free(BN_CTX *c);
|
||||||
|
void BN_CTX_start(BN_CTX *ctx);
|
||||||
|
BIGNUM *BN_CTX_get(BN_CTX *ctx);
|
||||||
|
void BN_CTX_end(BN_CTX *ctx);
|
||||||
|
int BN_rand_ex(BIGNUM *rnd, int bits, int top, int bottom,
|
||||||
|
unsigned int strength, BN_CTX *ctx);
|
||||||
|
int BN_rand(BIGNUM *rnd, int bits, int top, int bottom);
|
||||||
|
int BN_priv_rand_ex(BIGNUM *rnd, int bits, int top, int bottom,
|
||||||
|
unsigned int strength, BN_CTX *ctx);
|
||||||
|
int BN_priv_rand(BIGNUM *rnd, int bits, int top, int bottom);
|
||||||
|
int BN_rand_range_ex(BIGNUM *r, const BIGNUM *range, unsigned int strength,
|
||||||
|
BN_CTX *ctx);
|
||||||
|
int BN_rand_range(BIGNUM *rnd, const BIGNUM *range);
|
||||||
|
int BN_priv_rand_range_ex(BIGNUM *r, const BIGNUM *range,
|
||||||
|
unsigned int strength, BN_CTX *ctx);
|
||||||
|
int BN_priv_rand_range(BIGNUM *rnd, const BIGNUM *range);
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
int BN_pseudo_rand(BIGNUM *rnd, int bits, int top, int bottom);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
int BN_pseudo_rand_range(BIGNUM *rnd, const BIGNUM *range);
|
||||||
|
# endif
|
||||||
|
int BN_num_bits(const BIGNUM *a);
|
||||||
|
int BN_num_bits_word(BN_ULONG l);
|
||||||
|
int BN_security_bits(int L, int N);
|
||||||
|
BIGNUM *BN_new(void);
|
||||||
|
BIGNUM *BN_secure_new(void);
|
||||||
|
void BN_clear_free(BIGNUM *a);
|
||||||
|
BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b);
|
||||||
|
void BN_swap(BIGNUM *a, BIGNUM *b);
|
||||||
|
BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret);
|
||||||
|
BIGNUM *BN_signed_bin2bn(const unsigned char *s, int len, BIGNUM *ret);
|
||||||
|
int BN_bn2bin(const BIGNUM *a, unsigned char *to);
|
||||||
|
int BN_bn2binpad(const BIGNUM *a, unsigned char *to, int tolen);
|
||||||
|
int BN_signed_bn2bin(const BIGNUM *a, unsigned char *to, int tolen);
|
||||||
|
BIGNUM *BN_lebin2bn(const unsigned char *s, int len, BIGNUM *ret);
|
||||||
|
BIGNUM *BN_signed_lebin2bn(const unsigned char *s, int len, BIGNUM *ret);
|
||||||
|
int BN_bn2lebinpad(const BIGNUM *a, unsigned char *to, int tolen);
|
||||||
|
int BN_signed_bn2lebin(const BIGNUM *a, unsigned char *to, int tolen);
|
||||||
|
BIGNUM *BN_native2bn(const unsigned char *s, int len, BIGNUM *ret);
|
||||||
|
BIGNUM *BN_signed_native2bn(const unsigned char *s, int len, BIGNUM *ret);
|
||||||
|
int BN_bn2nativepad(const BIGNUM *a, unsigned char *to, int tolen);
|
||||||
|
int BN_signed_bn2native(const BIGNUM *a, unsigned char *to, int tolen);
|
||||||
|
BIGNUM *BN_mpi2bn(const unsigned char *s, int len, BIGNUM *ret);
|
||||||
|
int BN_bn2mpi(const BIGNUM *a, unsigned char *to);
|
||||||
|
int BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);
|
||||||
|
int BN_usub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);
|
||||||
|
int BN_uadd(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);
|
||||||
|
int BN_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);
|
||||||
|
int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx);
|
||||||
|
int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx);
|
||||||
|
/** BN_set_negative sets sign of a BIGNUM
|
||||||
|
* \param b pointer to the BIGNUM object
|
||||||
|
* \param n 0 if the BIGNUM b should be positive and a value != 0 otherwise
|
||||||
|
*/
|
||||||
|
void BN_set_negative(BIGNUM *b, int n);
|
||||||
|
/** BN_is_negative returns 1 if the BIGNUM is negative
|
||||||
|
* \param b pointer to the BIGNUM object
|
||||||
|
* \return 1 if a < 0 and 0 otherwise
|
||||||
|
*/
|
||||||
|
int BN_is_negative(const BIGNUM *b);
|
||||||
|
|
||||||
|
int BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, const BIGNUM *d,
|
||||||
|
BN_CTX *ctx);
|
||||||
|
# define BN_mod(rem,m,d,ctx) BN_div(NULL,(rem),(m),(d),(ctx))
|
||||||
|
int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx);
|
||||||
|
int BN_mod_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m,
|
||||||
|
BN_CTX *ctx);
|
||||||
|
int BN_mod_add_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
|
||||||
|
const BIGNUM *m);
|
||||||
|
int BN_mod_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m,
|
||||||
|
BN_CTX *ctx);
|
||||||
|
int BN_mod_sub_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
|
||||||
|
const BIGNUM *m);
|
||||||
|
int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m,
|
||||||
|
BN_CTX *ctx);
|
||||||
|
int BN_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx);
|
||||||
|
int BN_mod_lshift1(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx);
|
||||||
|
int BN_mod_lshift1_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *m);
|
||||||
|
int BN_mod_lshift(BIGNUM *r, const BIGNUM *a, int n, const BIGNUM *m,
|
||||||
|
BN_CTX *ctx);
|
||||||
|
int BN_mod_lshift_quick(BIGNUM *r, const BIGNUM *a, int n, const BIGNUM *m);
|
||||||
|
|
||||||
|
BN_ULONG BN_mod_word(const BIGNUM *a, BN_ULONG w);
|
||||||
|
BN_ULONG BN_div_word(BIGNUM *a, BN_ULONG w);
|
||||||
|
int BN_mul_word(BIGNUM *a, BN_ULONG w);
|
||||||
|
int BN_add_word(BIGNUM *a, BN_ULONG w);
|
||||||
|
int BN_sub_word(BIGNUM *a, BN_ULONG w);
|
||||||
|
int BN_set_word(BIGNUM *a, BN_ULONG w);
|
||||||
|
BN_ULONG BN_get_word(const BIGNUM *a);
|
||||||
|
|
||||||
|
int BN_cmp(const BIGNUM *a, const BIGNUM *b);
|
||||||
|
void BN_free(BIGNUM *a);
|
||||||
|
int BN_is_bit_set(const BIGNUM *a, int n);
|
||||||
|
int BN_lshift(BIGNUM *r, const BIGNUM *a, int n);
|
||||||
|
int BN_lshift1(BIGNUM *r, const BIGNUM *a);
|
||||||
|
int BN_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx);
|
||||||
|
|
||||||
|
int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
|
||||||
|
const BIGNUM *m, BN_CTX *ctx);
|
||||||
|
int BN_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
|
||||||
|
const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
|
||||||
|
int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
|
||||||
|
const BIGNUM *m, BN_CTX *ctx,
|
||||||
|
BN_MONT_CTX *in_mont);
|
||||||
|
int BN_mod_exp_mont_word(BIGNUM *r, BN_ULONG a, const BIGNUM *p,
|
||||||
|
const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
|
||||||
|
int BN_mod_exp2_mont(BIGNUM *r, const BIGNUM *a1, const BIGNUM *p1,
|
||||||
|
const BIGNUM *a2, const BIGNUM *p2, const BIGNUM *m,
|
||||||
|
BN_CTX *ctx, BN_MONT_CTX *m_ctx);
|
||||||
|
int BN_mod_exp_simple(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
|
||||||
|
const BIGNUM *m, BN_CTX *ctx);
|
||||||
|
int BN_mod_exp_mont_consttime_x2(BIGNUM *rr1, const BIGNUM *a1, const BIGNUM *p1,
|
||||||
|
const BIGNUM *m1, BN_MONT_CTX *in_mont1,
|
||||||
|
BIGNUM *rr2, const BIGNUM *a2, const BIGNUM *p2,
|
||||||
|
const BIGNUM *m2, BN_MONT_CTX *in_mont2,
|
||||||
|
BN_CTX *ctx);
|
||||||
|
|
||||||
|
int BN_mask_bits(BIGNUM *a, int n);
|
||||||
|
# ifndef OPENSSL_NO_STDIO
|
||||||
|
int BN_print_fp(FILE *fp, const BIGNUM *a);
|
||||||
|
# endif
|
||||||
|
int BN_print(BIO *bio, const BIGNUM *a);
|
||||||
|
int BN_reciprocal(BIGNUM *r, const BIGNUM *m, int len, BN_CTX *ctx);
|
||||||
|
int BN_rshift(BIGNUM *r, const BIGNUM *a, int n);
|
||||||
|
int BN_rshift1(BIGNUM *r, const BIGNUM *a);
|
||||||
|
void BN_clear(BIGNUM *a);
|
||||||
|
BIGNUM *BN_dup(const BIGNUM *a);
|
||||||
|
int BN_ucmp(const BIGNUM *a, const BIGNUM *b);
|
||||||
|
int BN_set_bit(BIGNUM *a, int n);
|
||||||
|
int BN_clear_bit(BIGNUM *a, int n);
|
||||||
|
char *BN_bn2hex(const BIGNUM *a);
|
||||||
|
char *BN_bn2dec(const BIGNUM *a);
|
||||||
|
int BN_hex2bn(BIGNUM **a, const char *str);
|
||||||
|
int BN_dec2bn(BIGNUM **a, const char *str);
|
||||||
|
int BN_asc2bn(BIGNUM **a, const char *str);
|
||||||
|
int BN_gcd(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx);
|
||||||
|
int BN_kronecker(const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx); /* returns
|
||||||
|
* -2 for
|
||||||
|
* error */
|
||||||
|
int BN_are_coprime(BIGNUM *a, const BIGNUM *b, BN_CTX *ctx);
|
||||||
|
BIGNUM *BN_mod_inverse(BIGNUM *ret,
|
||||||
|
const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx);
|
||||||
|
BIGNUM *BN_mod_sqrt(BIGNUM *ret,
|
||||||
|
const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx);
|
||||||
|
|
||||||
|
void BN_consttime_swap(BN_ULONG swap, BIGNUM *a, BIGNUM *b, int nwords);
|
||||||
|
|
||||||
|
/* Deprecated versions */
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_0_9_8
|
||||||
|
OSSL_DEPRECATEDIN_0_9_8
|
||||||
|
BIGNUM *BN_generate_prime(BIGNUM *ret, int bits, int safe,
|
||||||
|
const BIGNUM *add, const BIGNUM *rem,
|
||||||
|
void (*callback) (int, int, void *),
|
||||||
|
void *cb_arg);
|
||||||
|
OSSL_DEPRECATEDIN_0_9_8
|
||||||
|
int BN_is_prime(const BIGNUM *p, int nchecks,
|
||||||
|
void (*callback) (int, int, void *),
|
||||||
|
BN_CTX *ctx, void *cb_arg);
|
||||||
|
OSSL_DEPRECATEDIN_0_9_8
|
||||||
|
int BN_is_prime_fasttest(const BIGNUM *p, int nchecks,
|
||||||
|
void (*callback) (int, int, void *),
|
||||||
|
BN_CTX *ctx, void *cb_arg,
|
||||||
|
int do_trial_division);
|
||||||
|
# endif
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
int BN_is_prime_ex(const BIGNUM *p, int nchecks, BN_CTX *ctx, BN_GENCB *cb);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
int BN_is_prime_fasttest_ex(const BIGNUM *p, int nchecks, BN_CTX *ctx,
|
||||||
|
int do_trial_division, BN_GENCB *cb);
|
||||||
|
# endif
|
||||||
|
/* Newer versions */
|
||||||
|
int BN_generate_prime_ex2(BIGNUM *ret, int bits, int safe,
|
||||||
|
const BIGNUM *add, const BIGNUM *rem, BN_GENCB *cb,
|
||||||
|
BN_CTX *ctx);
|
||||||
|
int BN_generate_prime_ex(BIGNUM *ret, int bits, int safe, const BIGNUM *add,
|
||||||
|
const BIGNUM *rem, BN_GENCB *cb);
|
||||||
|
int BN_check_prime(const BIGNUM *p, BN_CTX *ctx, BN_GENCB *cb);
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
int BN_X931_generate_Xpq(BIGNUM *Xp, BIGNUM *Xq, int nbits, BN_CTX *ctx);
|
||||||
|
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
int BN_X931_derive_prime_ex(BIGNUM *p, BIGNUM *p1, BIGNUM *p2,
|
||||||
|
const BIGNUM *Xp, const BIGNUM *Xp1,
|
||||||
|
const BIGNUM *Xp2, const BIGNUM *e, BN_CTX *ctx,
|
||||||
|
BN_GENCB *cb);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
int BN_X931_generate_prime_ex(BIGNUM *p, BIGNUM *p1, BIGNUM *p2, BIGNUM *Xp1,
|
||||||
|
BIGNUM *Xp2, const BIGNUM *Xp, const BIGNUM *e,
|
||||||
|
BN_CTX *ctx, BN_GENCB *cb);
|
||||||
|
# endif
|
||||||
|
|
||||||
|
BN_MONT_CTX *BN_MONT_CTX_new(void);
|
||||||
|
int BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
|
||||||
|
BN_MONT_CTX *mont, BN_CTX *ctx);
|
||||||
|
int BN_to_montgomery(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont,
|
||||||
|
BN_CTX *ctx);
|
||||||
|
int BN_from_montgomery(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont,
|
||||||
|
BN_CTX *ctx);
|
||||||
|
void BN_MONT_CTX_free(BN_MONT_CTX *mont);
|
||||||
|
int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx);
|
||||||
|
BN_MONT_CTX *BN_MONT_CTX_copy(BN_MONT_CTX *to, BN_MONT_CTX *from);
|
||||||
|
BN_MONT_CTX *BN_MONT_CTX_set_locked(BN_MONT_CTX **pmont, CRYPTO_RWLOCK *lock,
|
||||||
|
const BIGNUM *mod, BN_CTX *ctx);
|
||||||
|
|
||||||
|
/* BN_BLINDING flags */
|
||||||
|
# define BN_BLINDING_NO_UPDATE 0x00000001
|
||||||
|
# define BN_BLINDING_NO_RECREATE 0x00000002
|
||||||
|
|
||||||
|
BN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, BIGNUM *mod);
|
||||||
|
void BN_BLINDING_free(BN_BLINDING *b);
|
||||||
|
int BN_BLINDING_update(BN_BLINDING *b, BN_CTX *ctx);
|
||||||
|
int BN_BLINDING_convert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx);
|
||||||
|
int BN_BLINDING_invert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx);
|
||||||
|
int BN_BLINDING_convert_ex(BIGNUM *n, BIGNUM *r, BN_BLINDING *b, BN_CTX *);
|
||||||
|
int BN_BLINDING_invert_ex(BIGNUM *n, const BIGNUM *r, BN_BLINDING *b,
|
||||||
|
BN_CTX *);
|
||||||
|
|
||||||
|
int BN_BLINDING_is_current_thread(BN_BLINDING *b);
|
||||||
|
void BN_BLINDING_set_current_thread(BN_BLINDING *b);
|
||||||
|
int BN_BLINDING_lock(BN_BLINDING *b);
|
||||||
|
int BN_BLINDING_unlock(BN_BLINDING *b);
|
||||||
|
|
||||||
|
unsigned long BN_BLINDING_get_flags(const BN_BLINDING *);
|
||||||
|
void BN_BLINDING_set_flags(BN_BLINDING *, unsigned long);
|
||||||
|
BN_BLINDING *BN_BLINDING_create_param(BN_BLINDING *b,
|
||||||
|
const BIGNUM *e, BIGNUM *m, BN_CTX *ctx,
|
||||||
|
int (*bn_mod_exp) (BIGNUM *r,
|
||||||
|
const BIGNUM *a,
|
||||||
|
const BIGNUM *p,
|
||||||
|
const BIGNUM *m,
|
||||||
|
BN_CTX *ctx,
|
||||||
|
BN_MONT_CTX *m_ctx),
|
||||||
|
BN_MONT_CTX *m_ctx);
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_0_9_8
|
||||||
|
OSSL_DEPRECATEDIN_0_9_8
|
||||||
|
void BN_set_params(int mul, int high, int low, int mont);
|
||||||
|
OSSL_DEPRECATEDIN_0_9_8
|
||||||
|
int BN_get_params(int which); /* 0, mul, 1 high, 2 low, 3 mont */
|
||||||
|
# endif
|
||||||
|
|
||||||
|
BN_RECP_CTX *BN_RECP_CTX_new(void);
|
||||||
|
void BN_RECP_CTX_free(BN_RECP_CTX *recp);
|
||||||
|
int BN_RECP_CTX_set(BN_RECP_CTX *recp, const BIGNUM *rdiv, BN_CTX *ctx);
|
||||||
|
int BN_mod_mul_reciprocal(BIGNUM *r, const BIGNUM *x, const BIGNUM *y,
|
||||||
|
BN_RECP_CTX *recp, BN_CTX *ctx);
|
||||||
|
int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
|
||||||
|
const BIGNUM *m, BN_CTX *ctx);
|
||||||
|
int BN_div_recp(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m,
|
||||||
|
BN_RECP_CTX *recp, BN_CTX *ctx);
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_EC2M
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Functions for arithmetic over binary polynomials represented by BIGNUMs.
|
||||||
|
* The BIGNUM::neg property of BIGNUMs representing binary polynomials is
|
||||||
|
* ignored. Note that input arguments are not const so that their bit arrays
|
||||||
|
* can be expanded to the appropriate size if needed.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* r = a + b
|
||||||
|
*/
|
||||||
|
int BN_GF2m_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);
|
||||||
|
# define BN_GF2m_sub(r, a, b) BN_GF2m_add(r, a, b)
|
||||||
|
/*
|
||||||
|
* r=a mod p
|
||||||
|
*/
|
||||||
|
int BN_GF2m_mod(BIGNUM *r, const BIGNUM *a, const BIGNUM *p);
|
||||||
|
/* r = (a * b) mod p */
|
||||||
|
int BN_GF2m_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
|
||||||
|
const BIGNUM *p, BN_CTX *ctx);
|
||||||
|
/* r = (a * a) mod p */
|
||||||
|
int BN_GF2m_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx);
|
||||||
|
/* r = (1 / b) mod p */
|
||||||
|
int BN_GF2m_mod_inv(BIGNUM *r, const BIGNUM *b, const BIGNUM *p, BN_CTX *ctx);
|
||||||
|
/* r = (a / b) mod p */
|
||||||
|
int BN_GF2m_mod_div(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
|
||||||
|
const BIGNUM *p, BN_CTX *ctx);
|
||||||
|
/* r = (a ^ b) mod p */
|
||||||
|
int BN_GF2m_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
|
||||||
|
const BIGNUM *p, BN_CTX *ctx);
|
||||||
|
/* r = sqrt(a) mod p */
|
||||||
|
int BN_GF2m_mod_sqrt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
|
||||||
|
BN_CTX *ctx);
|
||||||
|
/* r^2 + r = a mod p */
|
||||||
|
int BN_GF2m_mod_solve_quad(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
|
||||||
|
BN_CTX *ctx);
|
||||||
|
# define BN_GF2m_cmp(a, b) BN_ucmp((a), (b))
|
||||||
|
/*-
|
||||||
|
* Some functions allow for representation of the irreducible polynomials
|
||||||
|
* as an unsigned int[], say p. The irreducible f(t) is then of the form:
|
||||||
|
* t^p[0] + t^p[1] + ... + t^p[k]
|
||||||
|
* where m = p[0] > p[1] > ... > p[k] = 0.
|
||||||
|
*/
|
||||||
|
/* r = a mod p */
|
||||||
|
int BN_GF2m_mod_arr(BIGNUM *r, const BIGNUM *a, const int p[]);
|
||||||
|
/* r = (a * b) mod p */
|
||||||
|
int BN_GF2m_mod_mul_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
|
||||||
|
const int p[], BN_CTX *ctx);
|
||||||
|
/* r = (a * a) mod p */
|
||||||
|
int BN_GF2m_mod_sqr_arr(BIGNUM *r, const BIGNUM *a, const int p[],
|
||||||
|
BN_CTX *ctx);
|
||||||
|
/* r = (1 / b) mod p */
|
||||||
|
int BN_GF2m_mod_inv_arr(BIGNUM *r, const BIGNUM *b, const int p[],
|
||||||
|
BN_CTX *ctx);
|
||||||
|
/* r = (a / b) mod p */
|
||||||
|
int BN_GF2m_mod_div_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
|
||||||
|
const int p[], BN_CTX *ctx);
|
||||||
|
/* r = (a ^ b) mod p */
|
||||||
|
int BN_GF2m_mod_exp_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
|
||||||
|
const int p[], BN_CTX *ctx);
|
||||||
|
/* r = sqrt(a) mod p */
|
||||||
|
int BN_GF2m_mod_sqrt_arr(BIGNUM *r, const BIGNUM *a,
|
||||||
|
const int p[], BN_CTX *ctx);
|
||||||
|
/* r^2 + r = a mod p */
|
||||||
|
int BN_GF2m_mod_solve_quad_arr(BIGNUM *r, const BIGNUM *a,
|
||||||
|
const int p[], BN_CTX *ctx);
|
||||||
|
int BN_GF2m_poly2arr(const BIGNUM *a, int p[], int max);
|
||||||
|
int BN_GF2m_arr2poly(const int p[], BIGNUM *a);
|
||||||
|
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* faster mod functions for the 'NIST primes' 0 <= a < p^2
|
||||||
|
*/
|
||||||
|
int BN_nist_mod_192(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx);
|
||||||
|
int BN_nist_mod_224(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx);
|
||||||
|
int BN_nist_mod_256(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx);
|
||||||
|
int BN_nist_mod_384(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx);
|
||||||
|
int BN_nist_mod_521(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx);
|
||||||
|
|
||||||
|
const BIGNUM *BN_get0_nist_prime_192(void);
|
||||||
|
const BIGNUM *BN_get0_nist_prime_224(void);
|
||||||
|
const BIGNUM *BN_get0_nist_prime_256(void);
|
||||||
|
const BIGNUM *BN_get0_nist_prime_384(void);
|
||||||
|
const BIGNUM *BN_get0_nist_prime_521(void);
|
||||||
|
|
||||||
|
int (*BN_nist_mod_func(const BIGNUM *p)) (BIGNUM *r, const BIGNUM *a,
|
||||||
|
const BIGNUM *field, BN_CTX *ctx);
|
||||||
|
|
||||||
|
int BN_generate_dsa_nonce(BIGNUM *out, const BIGNUM *range,
|
||||||
|
const BIGNUM *priv, const unsigned char *message,
|
||||||
|
size_t message_len, BN_CTX *ctx);
|
||||||
|
|
||||||
|
/* Primes from RFC 2409 */
|
||||||
|
BIGNUM *BN_get_rfc2409_prime_768(BIGNUM *bn);
|
||||||
|
BIGNUM *BN_get_rfc2409_prime_1024(BIGNUM *bn);
|
||||||
|
|
||||||
|
/* Primes from RFC 3526 */
|
||||||
|
BIGNUM *BN_get_rfc3526_prime_1536(BIGNUM *bn);
|
||||||
|
BIGNUM *BN_get_rfc3526_prime_2048(BIGNUM *bn);
|
||||||
|
BIGNUM *BN_get_rfc3526_prime_3072(BIGNUM *bn);
|
||||||
|
BIGNUM *BN_get_rfc3526_prime_4096(BIGNUM *bn);
|
||||||
|
BIGNUM *BN_get_rfc3526_prime_6144(BIGNUM *bn);
|
||||||
|
BIGNUM *BN_get_rfc3526_prime_8192(BIGNUM *bn);
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_1_1_0
|
||||||
|
# define get_rfc2409_prime_768 BN_get_rfc2409_prime_768
|
||||||
|
# define get_rfc2409_prime_1024 BN_get_rfc2409_prime_1024
|
||||||
|
# define get_rfc3526_prime_1536 BN_get_rfc3526_prime_1536
|
||||||
|
# define get_rfc3526_prime_2048 BN_get_rfc3526_prime_2048
|
||||||
|
# define get_rfc3526_prime_3072 BN_get_rfc3526_prime_3072
|
||||||
|
# define get_rfc3526_prime_4096 BN_get_rfc3526_prime_4096
|
||||||
|
# define get_rfc3526_prime_6144 BN_get_rfc3526_prime_6144
|
||||||
|
# define get_rfc3526_prime_8192 BN_get_rfc3526_prime_8192
|
||||||
|
# endif
|
||||||
|
|
||||||
|
int BN_bntest_rand(BIGNUM *rnd, int bits, int top, int bottom);
|
||||||
|
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
* Generated by util/mkerr.pl DO NOT EDIT
|
||||||
|
* Copyright 1995-2022 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef OPENSSL_BNERR_H
|
||||||
|
# define OPENSSL_BNERR_H
|
||||||
|
# pragma once
|
||||||
|
|
||||||
|
# include <openssl/opensslconf.h>
|
||||||
|
# include <openssl/symhacks.h>
|
||||||
|
# include <openssl/cryptoerr_legacy.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* BN reason codes.
|
||||||
|
*/
|
||||||
|
# define BN_R_ARG2_LT_ARG3 100
|
||||||
|
# define BN_R_BAD_RECIPROCAL 101
|
||||||
|
# define BN_R_BIGNUM_TOO_LONG 114
|
||||||
|
# define BN_R_BITS_TOO_SMALL 118
|
||||||
|
# define BN_R_CALLED_WITH_EVEN_MODULUS 102
|
||||||
|
# define BN_R_DIV_BY_ZERO 103
|
||||||
|
# define BN_R_ENCODING_ERROR 104
|
||||||
|
# define BN_R_EXPAND_ON_STATIC_BIGNUM_DATA 105
|
||||||
|
# define BN_R_INPUT_NOT_REDUCED 110
|
||||||
|
# define BN_R_INVALID_LENGTH 106
|
||||||
|
# define BN_R_INVALID_RANGE 115
|
||||||
|
# define BN_R_INVALID_SHIFT 119
|
||||||
|
# define BN_R_NOT_A_SQUARE 111
|
||||||
|
# define BN_R_NOT_INITIALIZED 107
|
||||||
|
# define BN_R_NO_INVERSE 108
|
||||||
|
# define BN_R_NO_PRIME_CANDIDATE 121
|
||||||
|
# define BN_R_NO_SOLUTION 116
|
||||||
|
# define BN_R_NO_SUITABLE_DIGEST 120
|
||||||
|
# define BN_R_PRIVATE_KEY_TOO_LARGE 117
|
||||||
|
# define BN_R_P_IS_NOT_PRIME 112
|
||||||
|
# define BN_R_TOO_MANY_ITERATIONS 113
|
||||||
|
# define BN_R_TOO_MANY_TEMPORARY_VARIABLES 109
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 1995-2018 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef OPENSSL_BUFFER_H
|
||||||
|
# define OPENSSL_BUFFER_H
|
||||||
|
# pragma once
|
||||||
|
|
||||||
|
# include <openssl/macros.h>
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
# define HEADER_BUFFER_H
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# include <openssl/types.h>
|
||||||
|
# ifndef OPENSSL_CRYPTO_H
|
||||||
|
# include <openssl/crypto.h>
|
||||||
|
# endif
|
||||||
|
# include <openssl/buffererr.h>
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
# include <stddef.h>
|
||||||
|
# include <sys/types.h>
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
# define BUF_strdup(s) OPENSSL_strdup(s)
|
||||||
|
# define BUF_strndup(s, size) OPENSSL_strndup(s, size)
|
||||||
|
# define BUF_memdup(data, size) OPENSSL_memdup(data, size)
|
||||||
|
# define BUF_strlcpy(dst, src, size) OPENSSL_strlcpy(dst, src, size)
|
||||||
|
# define BUF_strlcat(dst, src, size) OPENSSL_strlcat(dst, src, size)
|
||||||
|
# define BUF_strnlen(str, maxlen) OPENSSL_strnlen(str, maxlen)
|
||||||
|
# endif
|
||||||
|
|
||||||
|
struct buf_mem_st {
|
||||||
|
size_t length; /* current number of bytes */
|
||||||
|
char *data;
|
||||||
|
size_t max; /* size of buffer */
|
||||||
|
unsigned long flags;
|
||||||
|
};
|
||||||
|
|
||||||
|
# define BUF_MEM_FLAG_SECURE 0x01
|
||||||
|
|
||||||
|
BUF_MEM *BUF_MEM_new(void);
|
||||||
|
BUF_MEM *BUF_MEM_new_ex(unsigned long flags);
|
||||||
|
void BUF_MEM_free(BUF_MEM *a);
|
||||||
|
size_t BUF_MEM_grow(BUF_MEM *str, size_t len);
|
||||||
|
size_t BUF_MEM_grow_clean(BUF_MEM *str, size_t len);
|
||||||
|
void BUF_reverse(unsigned char *out, const unsigned char *in, size_t siz);
|
||||||
|
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
/*
|
||||||
|
* Generated by util/mkerr.pl DO NOT EDIT
|
||||||
|
* Copyright 1995-2021 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef OPENSSL_BUFFERERR_H
|
||||||
|
# define OPENSSL_BUFFERERR_H
|
||||||
|
# pragma once
|
||||||
|
|
||||||
|
# include <openssl/opensslconf.h>
|
||||||
|
# include <openssl/symhacks.h>
|
||||||
|
# include <openssl/cryptoerr_legacy.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* BUF reason codes.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,339 @@
|
|||||||
|
/*
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef OPENSSL_BYTEORDER_H
|
||||||
|
# define OPENSSL_BYTEORDER_H
|
||||||
|
# pragma once
|
||||||
|
|
||||||
|
# include <openssl/e_os2.h>
|
||||||
|
# include <string.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* "Modern" compilers do a decent job of optimising these functions to just a
|
||||||
|
* couple of instruction ([swap +] store, or load [+ swap]) when either no
|
||||||
|
* swapping is required, or a suitable swap instruction is available.
|
||||||
|
*/
|
||||||
|
|
||||||
|
# if defined(_MSC_VER) && _MSC_VER>=1300
|
||||||
|
# include <stdlib.h>
|
||||||
|
# pragma intrinsic(_byteswap_ushort)
|
||||||
|
# pragma intrinsic(_byteswap_ulong)
|
||||||
|
# pragma intrinsic(_byteswap_uint64)
|
||||||
|
# define OSSL_HTOBE16(x) _byteswap_ushort(x)
|
||||||
|
# define OSSL_HTOBE32(x) _byteswap_ulong(x)
|
||||||
|
# define OSSL_HTOBE64(x) _byteswap_uint64(x)
|
||||||
|
# define OSSL_BE16TOH(x) _byteswap_ushort(x)
|
||||||
|
# define OSSL_BE32TOH(x) _byteswap_ulong(x)
|
||||||
|
# define OSSL_BE64TOH(x) _byteswap_uint64(x)
|
||||||
|
# define OSSL_HTOLE16(x) (x)
|
||||||
|
# define OSSL_HTOLE32(x) (x)
|
||||||
|
# define OSSL_HTOLE64(x) (x)
|
||||||
|
# define OSSL_LE16TOH(x) (x)
|
||||||
|
# define OSSL_LE32TOH(x) (x)
|
||||||
|
# define OSSL_LE64TOH(x) (x)
|
||||||
|
|
||||||
|
# elif defined(__GLIBC__) && defined(__GLIBC_PREREQ)
|
||||||
|
# if (__GLIBC_PREREQ(2, 19)) && defined(_DEFAULT_SOURCE)
|
||||||
|
# include <endian.h>
|
||||||
|
# define OSSL_HTOBE16(x) htobe16(x)
|
||||||
|
# define OSSL_HTOBE32(x) htobe32(x)
|
||||||
|
# define OSSL_HTOBE64(x) htobe64(x)
|
||||||
|
# define OSSL_BE16TOH(x) be16toh(x)
|
||||||
|
# define OSSL_BE32TOH(x) be32toh(x)
|
||||||
|
# define OSSL_BE64TOH(x) be64toh(x)
|
||||||
|
# define OSSL_HTOLE16(x) htole16(x)
|
||||||
|
# define OSSL_HTOLE32(x) htole32(x)
|
||||||
|
# define OSSL_HTOLE64(x) htole64(x)
|
||||||
|
# define OSSL_LE16TOH(x) le16toh(x)
|
||||||
|
# define OSSL_LE32TOH(x) le32toh(x)
|
||||||
|
# define OSSL_LE64TOH(x) le64toh(x)
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# elif defined(__FreeBSD__) || defined(__NetBSD__) || defined (__OpenBSD__)
|
||||||
|
# if defined(__OpenBSD__)
|
||||||
|
# include <sys/types.h>
|
||||||
|
# else
|
||||||
|
# include <sys/endian.h>
|
||||||
|
# endif
|
||||||
|
# define OSSL_HTOBE16(x) htobe16(x)
|
||||||
|
# define OSSL_HTOBE32(x) htobe32(x)
|
||||||
|
# define OSSL_HTOBE64(x) htobe64(x)
|
||||||
|
# define OSSL_BE16TOH(x) be16toh(x)
|
||||||
|
# define OSSL_BE32TOH(x) be32toh(x)
|
||||||
|
# define OSSL_BE64TOH(x) be64toh(x)
|
||||||
|
# define OSSL_HTOLE16(x) htole16(x)
|
||||||
|
# define OSSL_HTOLE32(x) htole32(x)
|
||||||
|
# define OSSL_HTOLE64(x) htole64(x)
|
||||||
|
# define OSSL_LE16TOH(x) le16toh(x)
|
||||||
|
# define OSSL_LE32TOH(x) le32toh(x)
|
||||||
|
# define OSSL_LE64TOH(x) le64toh(x)
|
||||||
|
|
||||||
|
# elif defined(__APPLE__)
|
||||||
|
# include <libkern/OSByteOrder.h>
|
||||||
|
# define OSSL_HTOBE16(x) OSSwapHostToBigInt16(x)
|
||||||
|
# define OSSL_HTOBE32(x) OSSwapHostToBigInt32(x)
|
||||||
|
# define OSSL_HTOBE64(x) OSSwapHostToBigInt64(x)
|
||||||
|
# define OSSL_BE16TOH(x) OSSwapBigToHostInt16(x)
|
||||||
|
# define OSSL_BE32TOH(x) OSSwapBigToHostInt32(x)
|
||||||
|
# define OSSL_BE64TOH(x) OSSwapBigToHostInt64(x)
|
||||||
|
# define OSSL_HTOLE16(x) OSSwapHostToLittleInt16(x)
|
||||||
|
# define OSSL_HTOLE32(x) OSSwapHostToLittleInt32(x)
|
||||||
|
# define OSSL_HTOLE64(x) OSSwapHostToLittleInt64(x)
|
||||||
|
# define OSSL_LE16TOH(x) OSSwapLittleToHostInt16(x)
|
||||||
|
# define OSSL_LE32TOH(x) OSSwapLittleToHostInt32(x)
|
||||||
|
# define OSSL_LE64TOH(x) OSSwapLittleToHostInt64(x)
|
||||||
|
|
||||||
|
# endif
|
||||||
|
|
||||||
|
static ossl_inline ossl_unused unsigned char *
|
||||||
|
OPENSSL_store_u16_le(unsigned char *out, uint16_t val)
|
||||||
|
{
|
||||||
|
# ifdef OSSL_HTOLE16
|
||||||
|
uint16_t t = OSSL_HTOLE16(val);
|
||||||
|
|
||||||
|
memcpy(out, (unsigned char *)&t, 2);
|
||||||
|
return out + 2;
|
||||||
|
# else
|
||||||
|
*out++ = (val & 0xff);
|
||||||
|
*out++ = (val >> 8) & 0xff;
|
||||||
|
return out;
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static ossl_inline ossl_unused unsigned char *
|
||||||
|
OPENSSL_store_u16_be(unsigned char *out, uint16_t val)
|
||||||
|
{
|
||||||
|
# ifdef OSSL_HTOBE16
|
||||||
|
uint16_t t = OSSL_HTOBE16(val);
|
||||||
|
|
||||||
|
memcpy(out, (unsigned char *)&t, 2);
|
||||||
|
return out + 2;
|
||||||
|
# else
|
||||||
|
*out++ = (val >> 8) & 0xff;
|
||||||
|
*out++ = (val & 0xff);
|
||||||
|
return out;
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static ossl_inline ossl_unused unsigned char *
|
||||||
|
OPENSSL_store_u32_le(unsigned char *out, uint32_t val)
|
||||||
|
{
|
||||||
|
# ifdef OSSL_HTOLE32
|
||||||
|
uint32_t t = OSSL_HTOLE32(val);
|
||||||
|
|
||||||
|
memcpy(out, (unsigned char *)&t, 4);
|
||||||
|
return out + 4;
|
||||||
|
# else
|
||||||
|
*out++ = (val & 0xff);
|
||||||
|
*out++ = (val >> 8) & 0xff;
|
||||||
|
*out++ = (val >> 16) & 0xff;
|
||||||
|
*out++ = (val >> 24) & 0xff;
|
||||||
|
return out;
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static ossl_inline ossl_unused unsigned char *
|
||||||
|
OPENSSL_store_u32_be(unsigned char *out, uint32_t val)
|
||||||
|
{
|
||||||
|
# ifdef OSSL_HTOBE32
|
||||||
|
uint32_t t = OSSL_HTOBE32(val);
|
||||||
|
|
||||||
|
memcpy(out, (unsigned char *)&t, 4);
|
||||||
|
return out + 4;
|
||||||
|
# else
|
||||||
|
*out++ = (val >> 24) & 0xff;
|
||||||
|
*out++ = (val >> 16) & 0xff;
|
||||||
|
*out++ = (val >> 8) & 0xff;
|
||||||
|
*out++ = (val & 0xff);
|
||||||
|
return out;
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static ossl_inline ossl_unused unsigned char *
|
||||||
|
OPENSSL_store_u64_le(unsigned char *out, uint64_t val)
|
||||||
|
{
|
||||||
|
# ifdef OSSL_HTOLE64
|
||||||
|
uint64_t t = OSSL_HTOLE64(val);
|
||||||
|
|
||||||
|
memcpy(out, (unsigned char *)&t, 8);
|
||||||
|
return out + 8;
|
||||||
|
# else
|
||||||
|
*out++ = (val & 0xff);
|
||||||
|
*out++ = (val >> 8) & 0xff;
|
||||||
|
*out++ = (val >> 16) & 0xff;
|
||||||
|
*out++ = (val >> 24) & 0xff;
|
||||||
|
*out++ = (val >> 32) & 0xff;
|
||||||
|
*out++ = (val >> 40) & 0xff;
|
||||||
|
*out++ = (val >> 48) & 0xff;
|
||||||
|
*out++ = (val >> 56) & 0xff;
|
||||||
|
return out;
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static ossl_inline ossl_unused unsigned char *
|
||||||
|
OPENSSL_store_u64_be(unsigned char *out, uint64_t val)
|
||||||
|
{
|
||||||
|
# ifdef OSSL_HTOLE64
|
||||||
|
uint64_t t = OSSL_HTOBE64(val);
|
||||||
|
|
||||||
|
memcpy(out, (unsigned char *)&t, 8);
|
||||||
|
return out + 8;
|
||||||
|
# else
|
||||||
|
*out++ = (val >> 56) & 0xff;
|
||||||
|
*out++ = (val >> 48) & 0xff;
|
||||||
|
*out++ = (val >> 40) & 0xff;
|
||||||
|
*out++ = (val >> 32) & 0xff;
|
||||||
|
*out++ = (val >> 24) & 0xff;
|
||||||
|
*out++ = (val >> 16) & 0xff;
|
||||||
|
*out++ = (val >> 8) & 0xff;
|
||||||
|
*out++ = (val & 0xff);
|
||||||
|
return out;
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static ossl_inline ossl_unused const unsigned char *
|
||||||
|
OPENSSL_load_u16_le(uint16_t *val, const unsigned char *in)
|
||||||
|
{
|
||||||
|
# ifdef OSSL_LE16TOH
|
||||||
|
uint16_t t;
|
||||||
|
|
||||||
|
memcpy((unsigned char *)&t, in, 2);
|
||||||
|
*val = OSSL_LE16TOH(t);
|
||||||
|
return in + 2;
|
||||||
|
# else
|
||||||
|
uint16_t b0 = *in++;
|
||||||
|
uint16_t b1 = *in++;
|
||||||
|
|
||||||
|
*val = b0 | (b1 << 8);
|
||||||
|
return in;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static ossl_inline ossl_unused const unsigned char *
|
||||||
|
OPENSSL_load_u16_be(uint16_t *val, const unsigned char *in)
|
||||||
|
{
|
||||||
|
# ifdef OSSL_LE16TOH
|
||||||
|
uint16_t t;
|
||||||
|
|
||||||
|
memcpy((unsigned char *)&t, in, 2);
|
||||||
|
*val = OSSL_BE16TOH(t);
|
||||||
|
return in + 2;
|
||||||
|
# else
|
||||||
|
uint16_t b1 = *in++;
|
||||||
|
uint16_t b0 = *in++;
|
||||||
|
|
||||||
|
*val = b0 | (b1 << 8);
|
||||||
|
return in;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static ossl_inline ossl_unused const unsigned char *
|
||||||
|
OPENSSL_load_u32_le(uint32_t *val, const unsigned char *in)
|
||||||
|
{
|
||||||
|
# ifdef OSSL_LE32TOH
|
||||||
|
uint32_t t;
|
||||||
|
|
||||||
|
memcpy((unsigned char *)&t, in, 4);
|
||||||
|
*val = OSSL_LE32TOH(t);
|
||||||
|
return in + 4;
|
||||||
|
# else
|
||||||
|
uint32_t b0 = *in++;
|
||||||
|
uint32_t b1 = *in++;
|
||||||
|
uint32_t b2 = *in++;
|
||||||
|
uint32_t b3 = *in++;
|
||||||
|
|
||||||
|
*val = b0 | (b1 << 8) | (b2 << 16) | (b3 << 24);
|
||||||
|
return in;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static ossl_inline ossl_unused const unsigned char *
|
||||||
|
OPENSSL_load_u32_be(uint32_t *val, const unsigned char *in)
|
||||||
|
{
|
||||||
|
# ifdef OSSL_LE32TOH
|
||||||
|
uint32_t t;
|
||||||
|
|
||||||
|
memcpy((unsigned char *)&t, in, 4);
|
||||||
|
*val = OSSL_BE32TOH(t);
|
||||||
|
return in + 4;
|
||||||
|
# else
|
||||||
|
uint32_t b3 = *in++;
|
||||||
|
uint32_t b2 = *in++;
|
||||||
|
uint32_t b1 = *in++;
|
||||||
|
uint32_t b0 = *in++;
|
||||||
|
|
||||||
|
*val = b0 | (b1 << 8) | (b2 << 16) | (b3 << 24);
|
||||||
|
return in;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static ossl_inline ossl_unused const unsigned char *
|
||||||
|
OPENSSL_load_u64_le(uint64_t *val, const unsigned char *in)
|
||||||
|
{
|
||||||
|
# ifdef OSSL_LE64TOH
|
||||||
|
uint64_t t;
|
||||||
|
|
||||||
|
memcpy((unsigned char *)&t, in, 8);
|
||||||
|
*val = OSSL_LE64TOH(t);
|
||||||
|
return in + 8;
|
||||||
|
# else
|
||||||
|
uint64_t b0 = *in++;
|
||||||
|
uint64_t b1 = *in++;
|
||||||
|
uint64_t b2 = *in++;
|
||||||
|
uint64_t b3 = *in++;
|
||||||
|
uint64_t b4 = *in++;
|
||||||
|
uint64_t b5 = *in++;
|
||||||
|
uint64_t b6 = *in++;
|
||||||
|
uint64_t b7 = *in++;
|
||||||
|
|
||||||
|
*val = b0 | (b1 << 8) | (b2 << 16) | (b3 << 24)
|
||||||
|
| (b4 << 32) | (b5 << 40) | (b6 << 48) | (b7 << 56);
|
||||||
|
return in;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static ossl_inline ossl_unused const unsigned char *
|
||||||
|
OPENSSL_load_u64_be(uint64_t *val, const unsigned char *in)
|
||||||
|
{
|
||||||
|
# ifdef OSSL_LE64TOH
|
||||||
|
uint64_t t;
|
||||||
|
|
||||||
|
memcpy((unsigned char *)&t, in, 8);
|
||||||
|
*val = OSSL_BE64TOH(t);
|
||||||
|
return in + 8;
|
||||||
|
# else
|
||||||
|
uint64_t b7 = *in++;
|
||||||
|
uint64_t b6 = *in++;
|
||||||
|
uint64_t b5 = *in++;
|
||||||
|
uint64_t b4 = *in++;
|
||||||
|
uint64_t b3 = *in++;
|
||||||
|
uint64_t b2 = *in++;
|
||||||
|
uint64_t b1 = *in++;
|
||||||
|
uint64_t b0 = *in++;
|
||||||
|
|
||||||
|
*val = b0 | (b1 << 8) | (b2 << 16) | (b3 << 24)
|
||||||
|
| (b4 << 32) | (b5 << 40) | (b6 << 48) | (b7 << 56);
|
||||||
|
return in;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
# undef OSSL_HTOBE16
|
||||||
|
# undef OSSL_HTOBE32
|
||||||
|
# undef OSSL_HTOBE64
|
||||||
|
# undef OSSL_BE16TOH
|
||||||
|
# undef OSSL_BE32TOH
|
||||||
|
# undef OSSL_BE64TOH
|
||||||
|
# undef OSSL_HTOLE16
|
||||||
|
# undef OSSL_HTOLE32
|
||||||
|
# undef OSSL_HTOLE64
|
||||||
|
# undef OSSL_LE16TOH
|
||||||
|
# undef OSSL_LE32TOH
|
||||||
|
# undef OSSL_LE64TOH
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,117 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2006-2020 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef OPENSSL_CAMELLIA_H
|
||||||
|
# define OPENSSL_CAMELLIA_H
|
||||||
|
# pragma once
|
||||||
|
|
||||||
|
# include <openssl/macros.h>
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
# define HEADER_CAMELLIA_H
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# include <openssl/opensslconf.h>
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_CAMELLIA
|
||||||
|
# include <stddef.h>
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
# define CAMELLIA_BLOCK_SIZE 16
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
|
||||||
|
# define CAMELLIA_ENCRYPT 1
|
||||||
|
# define CAMELLIA_DECRYPT 0
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Because array size can't be a const in C, the following two are macros.
|
||||||
|
* Both sizes are in bytes.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* This should be a hidden type, but EVP requires that the size be known */
|
||||||
|
|
||||||
|
# define CAMELLIA_TABLE_BYTE_LEN 272
|
||||||
|
# define CAMELLIA_TABLE_WORD_LEN (CAMELLIA_TABLE_BYTE_LEN / 4)
|
||||||
|
|
||||||
|
typedef unsigned int KEY_TABLE_TYPE[CAMELLIA_TABLE_WORD_LEN]; /* to match
|
||||||
|
* with WORD */
|
||||||
|
|
||||||
|
struct camellia_key_st {
|
||||||
|
union {
|
||||||
|
double d; /* ensures 64-bit align */
|
||||||
|
KEY_TABLE_TYPE rd_key;
|
||||||
|
} u;
|
||||||
|
int grand_rounds;
|
||||||
|
};
|
||||||
|
typedef struct camellia_key_st CAMELLIA_KEY;
|
||||||
|
|
||||||
|
# endif /* OPENSSL_NO_DEPRECATED_3_0 */
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int Camellia_set_key(const unsigned char *userKey,
|
||||||
|
const int bits,
|
||||||
|
CAMELLIA_KEY *key);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 void Camellia_encrypt(const unsigned char *in,
|
||||||
|
unsigned char *out,
|
||||||
|
const CAMELLIA_KEY *key);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 void Camellia_decrypt(const unsigned char *in,
|
||||||
|
unsigned char *out,
|
||||||
|
const CAMELLIA_KEY *key);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 void Camellia_ecb_encrypt(const unsigned char *in,
|
||||||
|
unsigned char *out,
|
||||||
|
const CAMELLIA_KEY *key,
|
||||||
|
const int enc);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 void Camellia_cbc_encrypt(const unsigned char *in,
|
||||||
|
unsigned char *out,
|
||||||
|
size_t length,
|
||||||
|
const CAMELLIA_KEY *key,
|
||||||
|
unsigned char *ivec,
|
||||||
|
const int enc);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 void Camellia_cfb128_encrypt(const unsigned char *in,
|
||||||
|
unsigned char *out,
|
||||||
|
size_t length,
|
||||||
|
const CAMELLIA_KEY *key,
|
||||||
|
unsigned char *ivec,
|
||||||
|
int *num,
|
||||||
|
const int enc);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 void Camellia_cfb1_encrypt(const unsigned char *in,
|
||||||
|
unsigned char *out,
|
||||||
|
size_t length,
|
||||||
|
const CAMELLIA_KEY *key,
|
||||||
|
unsigned char *ivec,
|
||||||
|
int *num,
|
||||||
|
const int enc);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 void Camellia_cfb8_encrypt(const unsigned char *in,
|
||||||
|
unsigned char *out,
|
||||||
|
size_t length,
|
||||||
|
const CAMELLIA_KEY *key,
|
||||||
|
unsigned char *ivec,
|
||||||
|
int *num,
|
||||||
|
const int enc);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 void Camellia_ofb128_encrypt(const unsigned char *in,
|
||||||
|
unsigned char *out,
|
||||||
|
size_t length,
|
||||||
|
const CAMELLIA_KEY *key,
|
||||||
|
unsigned char *ivec,
|
||||||
|
int *num);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
void Camellia_ctr128_encrypt(const unsigned char *in, unsigned char *out,
|
||||||
|
size_t length, const CAMELLIA_KEY *key,
|
||||||
|
unsigned char ivec[CAMELLIA_BLOCK_SIZE],
|
||||||
|
unsigned char ecount_buf[CAMELLIA_BLOCK_SIZE],
|
||||||
|
unsigned int *num);
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 1995-2020 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef OPENSSL_CAST_H
|
||||||
|
# define OPENSSL_CAST_H
|
||||||
|
# pragma once
|
||||||
|
|
||||||
|
# include <openssl/macros.h>
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
# define HEADER_CAST_H
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# include <openssl/opensslconf.h>
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_CAST
|
||||||
|
# ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# define CAST_BLOCK 8
|
||||||
|
# define CAST_KEY_LENGTH 16
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
|
||||||
|
# define CAST_ENCRYPT 1
|
||||||
|
# define CAST_DECRYPT 0
|
||||||
|
|
||||||
|
# define CAST_LONG unsigned int
|
||||||
|
|
||||||
|
typedef struct cast_key_st {
|
||||||
|
CAST_LONG data[32];
|
||||||
|
int short_key; /* Use reduced rounds for short key */
|
||||||
|
} CAST_KEY;
|
||||||
|
|
||||||
|
# endif /* OPENSSL_NO_DEPRECATED_3_0 */
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
void CAST_set_key(CAST_KEY *key, int len, const unsigned char *data);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
void CAST_ecb_encrypt(const unsigned char *in, unsigned char *out,
|
||||||
|
const CAST_KEY *key, int enc);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
void CAST_encrypt(CAST_LONG *data, const CAST_KEY *key);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
void CAST_decrypt(CAST_LONG *data, const CAST_KEY *key);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
void CAST_cbc_encrypt(const unsigned char *in, unsigned char *out,
|
||||||
|
long length, const CAST_KEY *ks, unsigned char *iv,
|
||||||
|
int enc);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
void CAST_cfb64_encrypt(const unsigned char *in, unsigned char *out,
|
||||||
|
long length, const CAST_KEY *schedule,
|
||||||
|
unsigned char *ivec, int *num, int enc);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
void CAST_ofb64_encrypt(const unsigned char *in, unsigned char *out,
|
||||||
|
long length, const CAST_KEY *schedule,
|
||||||
|
unsigned char *ivec, int *num);
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2020 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef OPENSSL_CMAC_H
|
||||||
|
# define OPENSSL_CMAC_H
|
||||||
|
# pragma once
|
||||||
|
|
||||||
|
# include <openssl/macros.h>
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
# define HEADER_CMAC_H
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_CMAC
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# include <openssl/evp.h>
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
/* Opaque */
|
||||||
|
typedef struct CMAC_CTX_st CMAC_CTX;
|
||||||
|
# endif
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
OSSL_DEPRECATEDIN_3_0 CMAC_CTX *CMAC_CTX_new(void);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 void CMAC_CTX_cleanup(CMAC_CTX *ctx);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 void CMAC_CTX_free(CMAC_CTX *ctx);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 EVP_CIPHER_CTX *CMAC_CTX_get0_cipher_ctx(CMAC_CTX *ctx);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int CMAC_CTX_copy(CMAC_CTX *out, const CMAC_CTX *in);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int CMAC_Init(CMAC_CTX *ctx,
|
||||||
|
const void *key, size_t keylen,
|
||||||
|
const EVP_CIPHER *cipher, ENGINE *impl);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int CMAC_Update(CMAC_CTX *ctx,
|
||||||
|
const void *data, size_t dlen);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int CMAC_Final(CMAC_CTX *ctx,
|
||||||
|
unsigned char *out, size_t *poutlen);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int CMAC_resume(CMAC_CTX *ctx);
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,727 @@
|
|||||||
|
/*
|
||||||
|
* WARNING: do not edit!
|
||||||
|
* Generated by Makefile from ../../openssl-3.5.0/include/openssl/cmp.h.in
|
||||||
|
*
|
||||||
|
* Copyright 2007-2024 The OpenSSL Project Authors. All Rights Reserved.
|
||||||
|
* Copyright Nokia 2007-2019
|
||||||
|
* Copyright Siemens AG 2015-2019
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef OPENSSL_CMP_H
|
||||||
|
# define OPENSSL_CMP_H
|
||||||
|
|
||||||
|
# include <openssl/opensslconf.h>
|
||||||
|
# ifndef OPENSSL_NO_CMP
|
||||||
|
|
||||||
|
# include <openssl/crmf.h>
|
||||||
|
# include <openssl/cmperr.h>
|
||||||
|
# include <openssl/cmp_util.h>
|
||||||
|
# include <openssl/http.h>
|
||||||
|
|
||||||
|
/* explicit #includes not strictly needed since implied by the above: */
|
||||||
|
# include <openssl/types.h>
|
||||||
|
# include <openssl/safestack.h>
|
||||||
|
# include <openssl/x509.h>
|
||||||
|
# include <openssl/x509v3.h>
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# define OSSL_CMP_PVNO_2 2
|
||||||
|
# define OSSL_CMP_PVNO_3 3
|
||||||
|
# define OSSL_CMP_PVNO OSSL_CMP_PVNO_2 /* v2 is the default */
|
||||||
|
|
||||||
|
/*-
|
||||||
|
* PKIFailureInfo ::= BIT STRING {
|
||||||
|
* -- since we can fail in more than one way!
|
||||||
|
* -- More codes may be added in the future if/when required.
|
||||||
|
* badAlg (0),
|
||||||
|
* -- unrecognized or unsupported Algorithm Identifier
|
||||||
|
* badMessageCheck (1),
|
||||||
|
* -- integrity check failed (e.g., signature did not verify)
|
||||||
|
* badRequest (2),
|
||||||
|
* -- transaction not permitted or supported
|
||||||
|
* badTime (3),
|
||||||
|
* -- messageTime was not sufficiently close to the system time,
|
||||||
|
* -- as defined by local policy
|
||||||
|
* badCertId (4),
|
||||||
|
* -- no certificate could be found matching the provided criteria
|
||||||
|
* badDataFormat (5),
|
||||||
|
* -- the data submitted has the wrong format
|
||||||
|
* wrongAuthority (6),
|
||||||
|
* -- the authority indicated in the request is different from the
|
||||||
|
* -- one creating the response token
|
||||||
|
* incorrectData (7),
|
||||||
|
* -- the requester's data is incorrect (for notary services)
|
||||||
|
* missingTimeStamp (8),
|
||||||
|
* -- when the timestamp is missing but should be there
|
||||||
|
* -- (by policy)
|
||||||
|
* badPOP (9),
|
||||||
|
* -- the proof-of-possession failed
|
||||||
|
* certRevoked (10),
|
||||||
|
* -- the certificate has already been revoked
|
||||||
|
* certConfirmed (11),
|
||||||
|
* -- the certificate has already been confirmed
|
||||||
|
* wrongIntegrity (12),
|
||||||
|
* -- invalid integrity, password based instead of signature or
|
||||||
|
* -- vice versa
|
||||||
|
* badRecipientNonce (13),
|
||||||
|
* -- invalid recipient nonce, either missing or wrong value
|
||||||
|
* timeNotAvailable (14),
|
||||||
|
* -- the TSA's time source is not available
|
||||||
|
* unacceptedPolicy (15),
|
||||||
|
* -- the requested TSA policy is not supported by the TSA.
|
||||||
|
* unacceptedExtension (16),
|
||||||
|
* -- the requested extension is not supported by the TSA.
|
||||||
|
* addInfoNotAvailable (17),
|
||||||
|
* -- the additional information requested could not be
|
||||||
|
* -- understood or is not available
|
||||||
|
* badSenderNonce (18),
|
||||||
|
* -- invalid sender nonce, either missing or wrong size
|
||||||
|
* badCertTemplate (19),
|
||||||
|
* -- invalid cert. template or missing mandatory information
|
||||||
|
* signerNotTrusted (20),
|
||||||
|
* -- signer of the message unknown or not trusted
|
||||||
|
* transactionIdInUse (21),
|
||||||
|
* -- the transaction identifier is already in use
|
||||||
|
* unsupportedVersion (22),
|
||||||
|
* -- the version of the message is not supported
|
||||||
|
* notAuthorized (23),
|
||||||
|
* -- the sender was not authorized to make the preceding
|
||||||
|
* -- request or perform the preceding action
|
||||||
|
* systemUnavail (24),
|
||||||
|
* -- the request cannot be handled due to system unavailability
|
||||||
|
* systemFailure (25),
|
||||||
|
* -- the request cannot be handled due to system failure
|
||||||
|
* duplicateCertReq (26)
|
||||||
|
* -- certificate cannot be issued because a duplicate
|
||||||
|
* -- certificate already exists
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
# define OSSL_CMP_PKIFAILUREINFO_badAlg 0
|
||||||
|
# define OSSL_CMP_PKIFAILUREINFO_badMessageCheck 1
|
||||||
|
# define OSSL_CMP_PKIFAILUREINFO_badRequest 2
|
||||||
|
# define OSSL_CMP_PKIFAILUREINFO_badTime 3
|
||||||
|
# define OSSL_CMP_PKIFAILUREINFO_badCertId 4
|
||||||
|
# define OSSL_CMP_PKIFAILUREINFO_badDataFormat 5
|
||||||
|
# define OSSL_CMP_PKIFAILUREINFO_wrongAuthority 6
|
||||||
|
# define OSSL_CMP_PKIFAILUREINFO_incorrectData 7
|
||||||
|
# define OSSL_CMP_PKIFAILUREINFO_missingTimeStamp 8
|
||||||
|
# define OSSL_CMP_PKIFAILUREINFO_badPOP 9
|
||||||
|
# define OSSL_CMP_PKIFAILUREINFO_certRevoked 10
|
||||||
|
# define OSSL_CMP_PKIFAILUREINFO_certConfirmed 11
|
||||||
|
# define OSSL_CMP_PKIFAILUREINFO_wrongIntegrity 12
|
||||||
|
# define OSSL_CMP_PKIFAILUREINFO_badRecipientNonce 13
|
||||||
|
# define OSSL_CMP_PKIFAILUREINFO_timeNotAvailable 14
|
||||||
|
# define OSSL_CMP_PKIFAILUREINFO_unacceptedPolicy 15
|
||||||
|
# define OSSL_CMP_PKIFAILUREINFO_unacceptedExtension 16
|
||||||
|
# define OSSL_CMP_PKIFAILUREINFO_addInfoNotAvailable 17
|
||||||
|
# define OSSL_CMP_PKIFAILUREINFO_badSenderNonce 18
|
||||||
|
# define OSSL_CMP_PKIFAILUREINFO_badCertTemplate 19
|
||||||
|
# define OSSL_CMP_PKIFAILUREINFO_signerNotTrusted 20
|
||||||
|
# define OSSL_CMP_PKIFAILUREINFO_transactionIdInUse 21
|
||||||
|
# define OSSL_CMP_PKIFAILUREINFO_unsupportedVersion 22
|
||||||
|
# define OSSL_CMP_PKIFAILUREINFO_notAuthorized 23
|
||||||
|
# define OSSL_CMP_PKIFAILUREINFO_systemUnavail 24
|
||||||
|
# define OSSL_CMP_PKIFAILUREINFO_systemFailure 25
|
||||||
|
# define OSSL_CMP_PKIFAILUREINFO_duplicateCertReq 26
|
||||||
|
# define OSSL_CMP_PKIFAILUREINFO_MAX 26
|
||||||
|
# define OSSL_CMP_PKIFAILUREINFO_MAX_BIT_PATTERN \
|
||||||
|
((1 << (OSSL_CMP_PKIFAILUREINFO_MAX + 1)) - 1)
|
||||||
|
# if OSSL_CMP_PKIFAILUREINFO_MAX_BIT_PATTERN > INT_MAX
|
||||||
|
# error CMP_PKIFAILUREINFO_MAX bit pattern does not fit in type int
|
||||||
|
# endif
|
||||||
|
typedef ASN1_BIT_STRING OSSL_CMP_PKIFAILUREINFO;
|
||||||
|
|
||||||
|
# define OSSL_CMP_CTX_FAILINFO_badAlg (1 << 0)
|
||||||
|
# define OSSL_CMP_CTX_FAILINFO_badMessageCheck (1 << 1)
|
||||||
|
# define OSSL_CMP_CTX_FAILINFO_badRequest (1 << 2)
|
||||||
|
# define OSSL_CMP_CTX_FAILINFO_badTime (1 << 3)
|
||||||
|
# define OSSL_CMP_CTX_FAILINFO_badCertId (1 << 4)
|
||||||
|
# define OSSL_CMP_CTX_FAILINFO_badDataFormat (1 << 5)
|
||||||
|
# define OSSL_CMP_CTX_FAILINFO_wrongAuthority (1 << 6)
|
||||||
|
# define OSSL_CMP_CTX_FAILINFO_incorrectData (1 << 7)
|
||||||
|
# define OSSL_CMP_CTX_FAILINFO_missingTimeStamp (1 << 8)
|
||||||
|
# define OSSL_CMP_CTX_FAILINFO_badPOP (1 << 9)
|
||||||
|
# define OSSL_CMP_CTX_FAILINFO_certRevoked (1 << 10)
|
||||||
|
# define OSSL_CMP_CTX_FAILINFO_certConfirmed (1 << 11)
|
||||||
|
# define OSSL_CMP_CTX_FAILINFO_wrongIntegrity (1 << 12)
|
||||||
|
# define OSSL_CMP_CTX_FAILINFO_badRecipientNonce (1 << 13)
|
||||||
|
# define OSSL_CMP_CTX_FAILINFO_timeNotAvailable (1 << 14)
|
||||||
|
# define OSSL_CMP_CTX_FAILINFO_unacceptedPolicy (1 << 15)
|
||||||
|
# define OSSL_CMP_CTX_FAILINFO_unacceptedExtension (1 << 16)
|
||||||
|
# define OSSL_CMP_CTX_FAILINFO_addInfoNotAvailable (1 << 17)
|
||||||
|
# define OSSL_CMP_CTX_FAILINFO_badSenderNonce (1 << 18)
|
||||||
|
# define OSSL_CMP_CTX_FAILINFO_badCertTemplate (1 << 19)
|
||||||
|
# define OSSL_CMP_CTX_FAILINFO_signerNotTrusted (1 << 20)
|
||||||
|
# define OSSL_CMP_CTX_FAILINFO_transactionIdInUse (1 << 21)
|
||||||
|
# define OSSL_CMP_CTX_FAILINFO_unsupportedVersion (1 << 22)
|
||||||
|
# define OSSL_CMP_CTX_FAILINFO_notAuthorized (1 << 23)
|
||||||
|
# define OSSL_CMP_CTX_FAILINFO_systemUnavail (1 << 24)
|
||||||
|
# define OSSL_CMP_CTX_FAILINFO_systemFailure (1 << 25)
|
||||||
|
# define OSSL_CMP_CTX_FAILINFO_duplicateCertReq (1 << 26)
|
||||||
|
|
||||||
|
/*-
|
||||||
|
* PKIStatus ::= INTEGER {
|
||||||
|
* accepted (0),
|
||||||
|
* -- you got exactly what you asked for
|
||||||
|
* grantedWithMods (1),
|
||||||
|
* -- you got something like what you asked for; the
|
||||||
|
* -- requester is responsible for ascertaining the differences
|
||||||
|
* rejection (2),
|
||||||
|
* -- you don't get it, more information elsewhere in the message
|
||||||
|
* waiting (3),
|
||||||
|
* -- the request body part has not yet been processed; expect to
|
||||||
|
* -- hear more later (note: proper handling of this status
|
||||||
|
* -- response MAY use the polling req/rep PKIMessages specified
|
||||||
|
* -- in Section 5.3.22; alternatively, polling in the underlying
|
||||||
|
* -- transport layer MAY have some utility in this regard)
|
||||||
|
* revocationWarning (4),
|
||||||
|
* -- this message contains a warning that a revocation is
|
||||||
|
* -- imminent
|
||||||
|
* revocationNotification (5),
|
||||||
|
* -- notification that a revocation has occurred
|
||||||
|
* keyUpdateWarning (6)
|
||||||
|
* -- update already done for the oldCertId specified in
|
||||||
|
* -- CertReqMsg
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
# define OSSL_CMP_PKISTATUS_request -3
|
||||||
|
# define OSSL_CMP_PKISTATUS_trans -2
|
||||||
|
# define OSSL_CMP_PKISTATUS_unspecified -1
|
||||||
|
# define OSSL_CMP_PKISTATUS_accepted 0
|
||||||
|
# define OSSL_CMP_PKISTATUS_grantedWithMods 1
|
||||||
|
# define OSSL_CMP_PKISTATUS_rejection 2
|
||||||
|
# define OSSL_CMP_PKISTATUS_waiting 3
|
||||||
|
# define OSSL_CMP_PKISTATUS_revocationWarning 4
|
||||||
|
# define OSSL_CMP_PKISTATUS_revocationNotification 5
|
||||||
|
# define OSSL_CMP_PKISTATUS_keyUpdateWarning 6
|
||||||
|
typedef ASN1_INTEGER OSSL_CMP_PKISTATUS;
|
||||||
|
|
||||||
|
DECLARE_ASN1_ITEM(OSSL_CMP_PKISTATUS)
|
||||||
|
|
||||||
|
# define OSSL_CMP_CERTORENCCERT_CERTIFICATE 0
|
||||||
|
# define OSSL_CMP_CERTORENCCERT_ENCRYPTEDCERT 1
|
||||||
|
|
||||||
|
/* data type declarations */
|
||||||
|
typedef struct ossl_cmp_ctx_st OSSL_CMP_CTX;
|
||||||
|
typedef struct ossl_cmp_pkiheader_st OSSL_CMP_PKIHEADER;
|
||||||
|
DECLARE_ASN1_FUNCTIONS(OSSL_CMP_PKIHEADER)
|
||||||
|
typedef struct ossl_cmp_msg_st OSSL_CMP_MSG;
|
||||||
|
DECLARE_ASN1_DUP_FUNCTION(OSSL_CMP_MSG)
|
||||||
|
DECLARE_ASN1_ENCODE_FUNCTIONS(OSSL_CMP_MSG, OSSL_CMP_MSG, OSSL_CMP_MSG)
|
||||||
|
typedef struct ossl_cmp_certstatus_st OSSL_CMP_CERTSTATUS;
|
||||||
|
SKM_DEFINE_STACK_OF_INTERNAL(OSSL_CMP_CERTSTATUS, OSSL_CMP_CERTSTATUS, OSSL_CMP_CERTSTATUS)
|
||||||
|
#define sk_OSSL_CMP_CERTSTATUS_num(sk) OPENSSL_sk_num(ossl_check_const_OSSL_CMP_CERTSTATUS_sk_type(sk))
|
||||||
|
#define sk_OSSL_CMP_CERTSTATUS_value(sk, idx) ((OSSL_CMP_CERTSTATUS *)OPENSSL_sk_value(ossl_check_const_OSSL_CMP_CERTSTATUS_sk_type(sk), (idx)))
|
||||||
|
#define sk_OSSL_CMP_CERTSTATUS_new(cmp) ((STACK_OF(OSSL_CMP_CERTSTATUS) *)OPENSSL_sk_new(ossl_check_OSSL_CMP_CERTSTATUS_compfunc_type(cmp)))
|
||||||
|
#define sk_OSSL_CMP_CERTSTATUS_new_null() ((STACK_OF(OSSL_CMP_CERTSTATUS) *)OPENSSL_sk_new_null())
|
||||||
|
#define sk_OSSL_CMP_CERTSTATUS_new_reserve(cmp, n) ((STACK_OF(OSSL_CMP_CERTSTATUS) *)OPENSSL_sk_new_reserve(ossl_check_OSSL_CMP_CERTSTATUS_compfunc_type(cmp), (n)))
|
||||||
|
#define sk_OSSL_CMP_CERTSTATUS_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_OSSL_CMP_CERTSTATUS_sk_type(sk), (n))
|
||||||
|
#define sk_OSSL_CMP_CERTSTATUS_free(sk) OPENSSL_sk_free(ossl_check_OSSL_CMP_CERTSTATUS_sk_type(sk))
|
||||||
|
#define sk_OSSL_CMP_CERTSTATUS_zero(sk) OPENSSL_sk_zero(ossl_check_OSSL_CMP_CERTSTATUS_sk_type(sk))
|
||||||
|
#define sk_OSSL_CMP_CERTSTATUS_delete(sk, i) ((OSSL_CMP_CERTSTATUS *)OPENSSL_sk_delete(ossl_check_OSSL_CMP_CERTSTATUS_sk_type(sk), (i)))
|
||||||
|
#define sk_OSSL_CMP_CERTSTATUS_delete_ptr(sk, ptr) ((OSSL_CMP_CERTSTATUS *)OPENSSL_sk_delete_ptr(ossl_check_OSSL_CMP_CERTSTATUS_sk_type(sk), ossl_check_OSSL_CMP_CERTSTATUS_type(ptr)))
|
||||||
|
#define sk_OSSL_CMP_CERTSTATUS_push(sk, ptr) OPENSSL_sk_push(ossl_check_OSSL_CMP_CERTSTATUS_sk_type(sk), ossl_check_OSSL_CMP_CERTSTATUS_type(ptr))
|
||||||
|
#define sk_OSSL_CMP_CERTSTATUS_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_OSSL_CMP_CERTSTATUS_sk_type(sk), ossl_check_OSSL_CMP_CERTSTATUS_type(ptr))
|
||||||
|
#define sk_OSSL_CMP_CERTSTATUS_pop(sk) ((OSSL_CMP_CERTSTATUS *)OPENSSL_sk_pop(ossl_check_OSSL_CMP_CERTSTATUS_sk_type(sk)))
|
||||||
|
#define sk_OSSL_CMP_CERTSTATUS_shift(sk) ((OSSL_CMP_CERTSTATUS *)OPENSSL_sk_shift(ossl_check_OSSL_CMP_CERTSTATUS_sk_type(sk)))
|
||||||
|
#define sk_OSSL_CMP_CERTSTATUS_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_OSSL_CMP_CERTSTATUS_sk_type(sk),ossl_check_OSSL_CMP_CERTSTATUS_freefunc_type(freefunc))
|
||||||
|
#define sk_OSSL_CMP_CERTSTATUS_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_OSSL_CMP_CERTSTATUS_sk_type(sk), ossl_check_OSSL_CMP_CERTSTATUS_type(ptr), (idx))
|
||||||
|
#define sk_OSSL_CMP_CERTSTATUS_set(sk, idx, ptr) ((OSSL_CMP_CERTSTATUS *)OPENSSL_sk_set(ossl_check_OSSL_CMP_CERTSTATUS_sk_type(sk), (idx), ossl_check_OSSL_CMP_CERTSTATUS_type(ptr)))
|
||||||
|
#define sk_OSSL_CMP_CERTSTATUS_find(sk, ptr) OPENSSL_sk_find(ossl_check_OSSL_CMP_CERTSTATUS_sk_type(sk), ossl_check_OSSL_CMP_CERTSTATUS_type(ptr))
|
||||||
|
#define sk_OSSL_CMP_CERTSTATUS_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_OSSL_CMP_CERTSTATUS_sk_type(sk), ossl_check_OSSL_CMP_CERTSTATUS_type(ptr))
|
||||||
|
#define sk_OSSL_CMP_CERTSTATUS_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_OSSL_CMP_CERTSTATUS_sk_type(sk), ossl_check_OSSL_CMP_CERTSTATUS_type(ptr), pnum)
|
||||||
|
#define sk_OSSL_CMP_CERTSTATUS_sort(sk) OPENSSL_sk_sort(ossl_check_OSSL_CMP_CERTSTATUS_sk_type(sk))
|
||||||
|
#define sk_OSSL_CMP_CERTSTATUS_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_OSSL_CMP_CERTSTATUS_sk_type(sk))
|
||||||
|
#define sk_OSSL_CMP_CERTSTATUS_dup(sk) ((STACK_OF(OSSL_CMP_CERTSTATUS) *)OPENSSL_sk_dup(ossl_check_const_OSSL_CMP_CERTSTATUS_sk_type(sk)))
|
||||||
|
#define sk_OSSL_CMP_CERTSTATUS_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(OSSL_CMP_CERTSTATUS) *)OPENSSL_sk_deep_copy(ossl_check_const_OSSL_CMP_CERTSTATUS_sk_type(sk), ossl_check_OSSL_CMP_CERTSTATUS_copyfunc_type(copyfunc), ossl_check_OSSL_CMP_CERTSTATUS_freefunc_type(freefunc)))
|
||||||
|
#define sk_OSSL_CMP_CERTSTATUS_set_cmp_func(sk, cmp) ((sk_OSSL_CMP_CERTSTATUS_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_OSSL_CMP_CERTSTATUS_sk_type(sk), ossl_check_OSSL_CMP_CERTSTATUS_compfunc_type(cmp)))
|
||||||
|
|
||||||
|
typedef struct ossl_cmp_itav_st OSSL_CMP_ITAV;
|
||||||
|
DECLARE_ASN1_DUP_FUNCTION(OSSL_CMP_ITAV)
|
||||||
|
SKM_DEFINE_STACK_OF_INTERNAL(OSSL_CMP_ITAV, OSSL_CMP_ITAV, OSSL_CMP_ITAV)
|
||||||
|
#define sk_OSSL_CMP_ITAV_num(sk) OPENSSL_sk_num(ossl_check_const_OSSL_CMP_ITAV_sk_type(sk))
|
||||||
|
#define sk_OSSL_CMP_ITAV_value(sk, idx) ((OSSL_CMP_ITAV *)OPENSSL_sk_value(ossl_check_const_OSSL_CMP_ITAV_sk_type(sk), (idx)))
|
||||||
|
#define sk_OSSL_CMP_ITAV_new(cmp) ((STACK_OF(OSSL_CMP_ITAV) *)OPENSSL_sk_new(ossl_check_OSSL_CMP_ITAV_compfunc_type(cmp)))
|
||||||
|
#define sk_OSSL_CMP_ITAV_new_null() ((STACK_OF(OSSL_CMP_ITAV) *)OPENSSL_sk_new_null())
|
||||||
|
#define sk_OSSL_CMP_ITAV_new_reserve(cmp, n) ((STACK_OF(OSSL_CMP_ITAV) *)OPENSSL_sk_new_reserve(ossl_check_OSSL_CMP_ITAV_compfunc_type(cmp), (n)))
|
||||||
|
#define sk_OSSL_CMP_ITAV_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_OSSL_CMP_ITAV_sk_type(sk), (n))
|
||||||
|
#define sk_OSSL_CMP_ITAV_free(sk) OPENSSL_sk_free(ossl_check_OSSL_CMP_ITAV_sk_type(sk))
|
||||||
|
#define sk_OSSL_CMP_ITAV_zero(sk) OPENSSL_sk_zero(ossl_check_OSSL_CMP_ITAV_sk_type(sk))
|
||||||
|
#define sk_OSSL_CMP_ITAV_delete(sk, i) ((OSSL_CMP_ITAV *)OPENSSL_sk_delete(ossl_check_OSSL_CMP_ITAV_sk_type(sk), (i)))
|
||||||
|
#define sk_OSSL_CMP_ITAV_delete_ptr(sk, ptr) ((OSSL_CMP_ITAV *)OPENSSL_sk_delete_ptr(ossl_check_OSSL_CMP_ITAV_sk_type(sk), ossl_check_OSSL_CMP_ITAV_type(ptr)))
|
||||||
|
#define sk_OSSL_CMP_ITAV_push(sk, ptr) OPENSSL_sk_push(ossl_check_OSSL_CMP_ITAV_sk_type(sk), ossl_check_OSSL_CMP_ITAV_type(ptr))
|
||||||
|
#define sk_OSSL_CMP_ITAV_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_OSSL_CMP_ITAV_sk_type(sk), ossl_check_OSSL_CMP_ITAV_type(ptr))
|
||||||
|
#define sk_OSSL_CMP_ITAV_pop(sk) ((OSSL_CMP_ITAV *)OPENSSL_sk_pop(ossl_check_OSSL_CMP_ITAV_sk_type(sk)))
|
||||||
|
#define sk_OSSL_CMP_ITAV_shift(sk) ((OSSL_CMP_ITAV *)OPENSSL_sk_shift(ossl_check_OSSL_CMP_ITAV_sk_type(sk)))
|
||||||
|
#define sk_OSSL_CMP_ITAV_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_OSSL_CMP_ITAV_sk_type(sk),ossl_check_OSSL_CMP_ITAV_freefunc_type(freefunc))
|
||||||
|
#define sk_OSSL_CMP_ITAV_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_OSSL_CMP_ITAV_sk_type(sk), ossl_check_OSSL_CMP_ITAV_type(ptr), (idx))
|
||||||
|
#define sk_OSSL_CMP_ITAV_set(sk, idx, ptr) ((OSSL_CMP_ITAV *)OPENSSL_sk_set(ossl_check_OSSL_CMP_ITAV_sk_type(sk), (idx), ossl_check_OSSL_CMP_ITAV_type(ptr)))
|
||||||
|
#define sk_OSSL_CMP_ITAV_find(sk, ptr) OPENSSL_sk_find(ossl_check_OSSL_CMP_ITAV_sk_type(sk), ossl_check_OSSL_CMP_ITAV_type(ptr))
|
||||||
|
#define sk_OSSL_CMP_ITAV_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_OSSL_CMP_ITAV_sk_type(sk), ossl_check_OSSL_CMP_ITAV_type(ptr))
|
||||||
|
#define sk_OSSL_CMP_ITAV_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_OSSL_CMP_ITAV_sk_type(sk), ossl_check_OSSL_CMP_ITAV_type(ptr), pnum)
|
||||||
|
#define sk_OSSL_CMP_ITAV_sort(sk) OPENSSL_sk_sort(ossl_check_OSSL_CMP_ITAV_sk_type(sk))
|
||||||
|
#define sk_OSSL_CMP_ITAV_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_OSSL_CMP_ITAV_sk_type(sk))
|
||||||
|
#define sk_OSSL_CMP_ITAV_dup(sk) ((STACK_OF(OSSL_CMP_ITAV) *)OPENSSL_sk_dup(ossl_check_const_OSSL_CMP_ITAV_sk_type(sk)))
|
||||||
|
#define sk_OSSL_CMP_ITAV_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(OSSL_CMP_ITAV) *)OPENSSL_sk_deep_copy(ossl_check_const_OSSL_CMP_ITAV_sk_type(sk), ossl_check_OSSL_CMP_ITAV_copyfunc_type(copyfunc), ossl_check_OSSL_CMP_ITAV_freefunc_type(freefunc)))
|
||||||
|
#define sk_OSSL_CMP_ITAV_set_cmp_func(sk, cmp) ((sk_OSSL_CMP_ITAV_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_OSSL_CMP_ITAV_sk_type(sk), ossl_check_OSSL_CMP_ITAV_compfunc_type(cmp)))
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct ossl_cmp_crlstatus_st OSSL_CMP_CRLSTATUS;
|
||||||
|
SKM_DEFINE_STACK_OF_INTERNAL(OSSL_CMP_CRLSTATUS, OSSL_CMP_CRLSTATUS, OSSL_CMP_CRLSTATUS)
|
||||||
|
#define sk_OSSL_CMP_CRLSTATUS_num(sk) OPENSSL_sk_num(ossl_check_const_OSSL_CMP_CRLSTATUS_sk_type(sk))
|
||||||
|
#define sk_OSSL_CMP_CRLSTATUS_value(sk, idx) ((OSSL_CMP_CRLSTATUS *)OPENSSL_sk_value(ossl_check_const_OSSL_CMP_CRLSTATUS_sk_type(sk), (idx)))
|
||||||
|
#define sk_OSSL_CMP_CRLSTATUS_new(cmp) ((STACK_OF(OSSL_CMP_CRLSTATUS) *)OPENSSL_sk_new(ossl_check_OSSL_CMP_CRLSTATUS_compfunc_type(cmp)))
|
||||||
|
#define sk_OSSL_CMP_CRLSTATUS_new_null() ((STACK_OF(OSSL_CMP_CRLSTATUS) *)OPENSSL_sk_new_null())
|
||||||
|
#define sk_OSSL_CMP_CRLSTATUS_new_reserve(cmp, n) ((STACK_OF(OSSL_CMP_CRLSTATUS) *)OPENSSL_sk_new_reserve(ossl_check_OSSL_CMP_CRLSTATUS_compfunc_type(cmp), (n)))
|
||||||
|
#define sk_OSSL_CMP_CRLSTATUS_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_OSSL_CMP_CRLSTATUS_sk_type(sk), (n))
|
||||||
|
#define sk_OSSL_CMP_CRLSTATUS_free(sk) OPENSSL_sk_free(ossl_check_OSSL_CMP_CRLSTATUS_sk_type(sk))
|
||||||
|
#define sk_OSSL_CMP_CRLSTATUS_zero(sk) OPENSSL_sk_zero(ossl_check_OSSL_CMP_CRLSTATUS_sk_type(sk))
|
||||||
|
#define sk_OSSL_CMP_CRLSTATUS_delete(sk, i) ((OSSL_CMP_CRLSTATUS *)OPENSSL_sk_delete(ossl_check_OSSL_CMP_CRLSTATUS_sk_type(sk), (i)))
|
||||||
|
#define sk_OSSL_CMP_CRLSTATUS_delete_ptr(sk, ptr) ((OSSL_CMP_CRLSTATUS *)OPENSSL_sk_delete_ptr(ossl_check_OSSL_CMP_CRLSTATUS_sk_type(sk), ossl_check_OSSL_CMP_CRLSTATUS_type(ptr)))
|
||||||
|
#define sk_OSSL_CMP_CRLSTATUS_push(sk, ptr) OPENSSL_sk_push(ossl_check_OSSL_CMP_CRLSTATUS_sk_type(sk), ossl_check_OSSL_CMP_CRLSTATUS_type(ptr))
|
||||||
|
#define sk_OSSL_CMP_CRLSTATUS_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_OSSL_CMP_CRLSTATUS_sk_type(sk), ossl_check_OSSL_CMP_CRLSTATUS_type(ptr))
|
||||||
|
#define sk_OSSL_CMP_CRLSTATUS_pop(sk) ((OSSL_CMP_CRLSTATUS *)OPENSSL_sk_pop(ossl_check_OSSL_CMP_CRLSTATUS_sk_type(sk)))
|
||||||
|
#define sk_OSSL_CMP_CRLSTATUS_shift(sk) ((OSSL_CMP_CRLSTATUS *)OPENSSL_sk_shift(ossl_check_OSSL_CMP_CRLSTATUS_sk_type(sk)))
|
||||||
|
#define sk_OSSL_CMP_CRLSTATUS_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_OSSL_CMP_CRLSTATUS_sk_type(sk),ossl_check_OSSL_CMP_CRLSTATUS_freefunc_type(freefunc))
|
||||||
|
#define sk_OSSL_CMP_CRLSTATUS_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_OSSL_CMP_CRLSTATUS_sk_type(sk), ossl_check_OSSL_CMP_CRLSTATUS_type(ptr), (idx))
|
||||||
|
#define sk_OSSL_CMP_CRLSTATUS_set(sk, idx, ptr) ((OSSL_CMP_CRLSTATUS *)OPENSSL_sk_set(ossl_check_OSSL_CMP_CRLSTATUS_sk_type(sk), (idx), ossl_check_OSSL_CMP_CRLSTATUS_type(ptr)))
|
||||||
|
#define sk_OSSL_CMP_CRLSTATUS_find(sk, ptr) OPENSSL_sk_find(ossl_check_OSSL_CMP_CRLSTATUS_sk_type(sk), ossl_check_OSSL_CMP_CRLSTATUS_type(ptr))
|
||||||
|
#define sk_OSSL_CMP_CRLSTATUS_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_OSSL_CMP_CRLSTATUS_sk_type(sk), ossl_check_OSSL_CMP_CRLSTATUS_type(ptr))
|
||||||
|
#define sk_OSSL_CMP_CRLSTATUS_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_OSSL_CMP_CRLSTATUS_sk_type(sk), ossl_check_OSSL_CMP_CRLSTATUS_type(ptr), pnum)
|
||||||
|
#define sk_OSSL_CMP_CRLSTATUS_sort(sk) OPENSSL_sk_sort(ossl_check_OSSL_CMP_CRLSTATUS_sk_type(sk))
|
||||||
|
#define sk_OSSL_CMP_CRLSTATUS_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_OSSL_CMP_CRLSTATUS_sk_type(sk))
|
||||||
|
#define sk_OSSL_CMP_CRLSTATUS_dup(sk) ((STACK_OF(OSSL_CMP_CRLSTATUS) *)OPENSSL_sk_dup(ossl_check_const_OSSL_CMP_CRLSTATUS_sk_type(sk)))
|
||||||
|
#define sk_OSSL_CMP_CRLSTATUS_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(OSSL_CMP_CRLSTATUS) *)OPENSSL_sk_deep_copy(ossl_check_const_OSSL_CMP_CRLSTATUS_sk_type(sk), ossl_check_OSSL_CMP_CRLSTATUS_copyfunc_type(copyfunc), ossl_check_OSSL_CMP_CRLSTATUS_freefunc_type(freefunc)))
|
||||||
|
#define sk_OSSL_CMP_CRLSTATUS_set_cmp_func(sk, cmp) ((sk_OSSL_CMP_CRLSTATUS_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_OSSL_CMP_CRLSTATUS_sk_type(sk), ossl_check_OSSL_CMP_CRLSTATUS_compfunc_type(cmp)))
|
||||||
|
|
||||||
|
|
||||||
|
typedef OSSL_CRMF_ATTRIBUTETYPEANDVALUE OSSL_CMP_ATAV;
|
||||||
|
# define OSSL_CMP_ATAV_free OSSL_CRMF_ATTRIBUTETYPEANDVALUE_free
|
||||||
|
typedef STACK_OF(OSSL_CRMF_ATTRIBUTETYPEANDVALUE) OSSL_CMP_ATAVS;
|
||||||
|
DECLARE_ASN1_FUNCTIONS(OSSL_CMP_ATAVS)
|
||||||
|
# define stack_st_OSSL_CMP_ATAV stack_st_OSSL_CRMF_ATTRIBUTETYPEANDVALUE
|
||||||
|
# define sk_OSSL_CMP_ATAV_num sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_num
|
||||||
|
# define sk_OSSL_CMP_ATAV_value sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_value
|
||||||
|
# define sk_OSSL_CMP_ATAV_push sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_push
|
||||||
|
# define sk_OSSL_CMP_ATAV_pop_free sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_pop_free
|
||||||
|
|
||||||
|
typedef struct ossl_cmp_revrepcontent_st OSSL_CMP_REVREPCONTENT;
|
||||||
|
typedef struct ossl_cmp_pkisi_st OSSL_CMP_PKISI;
|
||||||
|
DECLARE_ASN1_FUNCTIONS(OSSL_CMP_PKISI)
|
||||||
|
DECLARE_ASN1_DUP_FUNCTION(OSSL_CMP_PKISI)
|
||||||
|
SKM_DEFINE_STACK_OF_INTERNAL(OSSL_CMP_PKISI, OSSL_CMP_PKISI, OSSL_CMP_PKISI)
|
||||||
|
#define sk_OSSL_CMP_PKISI_num(sk) OPENSSL_sk_num(ossl_check_const_OSSL_CMP_PKISI_sk_type(sk))
|
||||||
|
#define sk_OSSL_CMP_PKISI_value(sk, idx) ((OSSL_CMP_PKISI *)OPENSSL_sk_value(ossl_check_const_OSSL_CMP_PKISI_sk_type(sk), (idx)))
|
||||||
|
#define sk_OSSL_CMP_PKISI_new(cmp) ((STACK_OF(OSSL_CMP_PKISI) *)OPENSSL_sk_new(ossl_check_OSSL_CMP_PKISI_compfunc_type(cmp)))
|
||||||
|
#define sk_OSSL_CMP_PKISI_new_null() ((STACK_OF(OSSL_CMP_PKISI) *)OPENSSL_sk_new_null())
|
||||||
|
#define sk_OSSL_CMP_PKISI_new_reserve(cmp, n) ((STACK_OF(OSSL_CMP_PKISI) *)OPENSSL_sk_new_reserve(ossl_check_OSSL_CMP_PKISI_compfunc_type(cmp), (n)))
|
||||||
|
#define sk_OSSL_CMP_PKISI_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_OSSL_CMP_PKISI_sk_type(sk), (n))
|
||||||
|
#define sk_OSSL_CMP_PKISI_free(sk) OPENSSL_sk_free(ossl_check_OSSL_CMP_PKISI_sk_type(sk))
|
||||||
|
#define sk_OSSL_CMP_PKISI_zero(sk) OPENSSL_sk_zero(ossl_check_OSSL_CMP_PKISI_sk_type(sk))
|
||||||
|
#define sk_OSSL_CMP_PKISI_delete(sk, i) ((OSSL_CMP_PKISI *)OPENSSL_sk_delete(ossl_check_OSSL_CMP_PKISI_sk_type(sk), (i)))
|
||||||
|
#define sk_OSSL_CMP_PKISI_delete_ptr(sk, ptr) ((OSSL_CMP_PKISI *)OPENSSL_sk_delete_ptr(ossl_check_OSSL_CMP_PKISI_sk_type(sk), ossl_check_OSSL_CMP_PKISI_type(ptr)))
|
||||||
|
#define sk_OSSL_CMP_PKISI_push(sk, ptr) OPENSSL_sk_push(ossl_check_OSSL_CMP_PKISI_sk_type(sk), ossl_check_OSSL_CMP_PKISI_type(ptr))
|
||||||
|
#define sk_OSSL_CMP_PKISI_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_OSSL_CMP_PKISI_sk_type(sk), ossl_check_OSSL_CMP_PKISI_type(ptr))
|
||||||
|
#define sk_OSSL_CMP_PKISI_pop(sk) ((OSSL_CMP_PKISI *)OPENSSL_sk_pop(ossl_check_OSSL_CMP_PKISI_sk_type(sk)))
|
||||||
|
#define sk_OSSL_CMP_PKISI_shift(sk) ((OSSL_CMP_PKISI *)OPENSSL_sk_shift(ossl_check_OSSL_CMP_PKISI_sk_type(sk)))
|
||||||
|
#define sk_OSSL_CMP_PKISI_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_OSSL_CMP_PKISI_sk_type(sk),ossl_check_OSSL_CMP_PKISI_freefunc_type(freefunc))
|
||||||
|
#define sk_OSSL_CMP_PKISI_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_OSSL_CMP_PKISI_sk_type(sk), ossl_check_OSSL_CMP_PKISI_type(ptr), (idx))
|
||||||
|
#define sk_OSSL_CMP_PKISI_set(sk, idx, ptr) ((OSSL_CMP_PKISI *)OPENSSL_sk_set(ossl_check_OSSL_CMP_PKISI_sk_type(sk), (idx), ossl_check_OSSL_CMP_PKISI_type(ptr)))
|
||||||
|
#define sk_OSSL_CMP_PKISI_find(sk, ptr) OPENSSL_sk_find(ossl_check_OSSL_CMP_PKISI_sk_type(sk), ossl_check_OSSL_CMP_PKISI_type(ptr))
|
||||||
|
#define sk_OSSL_CMP_PKISI_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_OSSL_CMP_PKISI_sk_type(sk), ossl_check_OSSL_CMP_PKISI_type(ptr))
|
||||||
|
#define sk_OSSL_CMP_PKISI_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_OSSL_CMP_PKISI_sk_type(sk), ossl_check_OSSL_CMP_PKISI_type(ptr), pnum)
|
||||||
|
#define sk_OSSL_CMP_PKISI_sort(sk) OPENSSL_sk_sort(ossl_check_OSSL_CMP_PKISI_sk_type(sk))
|
||||||
|
#define sk_OSSL_CMP_PKISI_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_OSSL_CMP_PKISI_sk_type(sk))
|
||||||
|
#define sk_OSSL_CMP_PKISI_dup(sk) ((STACK_OF(OSSL_CMP_PKISI) *)OPENSSL_sk_dup(ossl_check_const_OSSL_CMP_PKISI_sk_type(sk)))
|
||||||
|
#define sk_OSSL_CMP_PKISI_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(OSSL_CMP_PKISI) *)OPENSSL_sk_deep_copy(ossl_check_const_OSSL_CMP_PKISI_sk_type(sk), ossl_check_OSSL_CMP_PKISI_copyfunc_type(copyfunc), ossl_check_OSSL_CMP_PKISI_freefunc_type(freefunc)))
|
||||||
|
#define sk_OSSL_CMP_PKISI_set_cmp_func(sk, cmp) ((sk_OSSL_CMP_PKISI_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_OSSL_CMP_PKISI_sk_type(sk), ossl_check_OSSL_CMP_PKISI_compfunc_type(cmp)))
|
||||||
|
|
||||||
|
typedef struct ossl_cmp_certrepmessage_st OSSL_CMP_CERTREPMESSAGE;
|
||||||
|
SKM_DEFINE_STACK_OF_INTERNAL(OSSL_CMP_CERTREPMESSAGE, OSSL_CMP_CERTREPMESSAGE, OSSL_CMP_CERTREPMESSAGE)
|
||||||
|
#define sk_OSSL_CMP_CERTREPMESSAGE_num(sk) OPENSSL_sk_num(ossl_check_const_OSSL_CMP_CERTREPMESSAGE_sk_type(sk))
|
||||||
|
#define sk_OSSL_CMP_CERTREPMESSAGE_value(sk, idx) ((OSSL_CMP_CERTREPMESSAGE *)OPENSSL_sk_value(ossl_check_const_OSSL_CMP_CERTREPMESSAGE_sk_type(sk), (idx)))
|
||||||
|
#define sk_OSSL_CMP_CERTREPMESSAGE_new(cmp) ((STACK_OF(OSSL_CMP_CERTREPMESSAGE) *)OPENSSL_sk_new(ossl_check_OSSL_CMP_CERTREPMESSAGE_compfunc_type(cmp)))
|
||||||
|
#define sk_OSSL_CMP_CERTREPMESSAGE_new_null() ((STACK_OF(OSSL_CMP_CERTREPMESSAGE) *)OPENSSL_sk_new_null())
|
||||||
|
#define sk_OSSL_CMP_CERTREPMESSAGE_new_reserve(cmp, n) ((STACK_OF(OSSL_CMP_CERTREPMESSAGE) *)OPENSSL_sk_new_reserve(ossl_check_OSSL_CMP_CERTREPMESSAGE_compfunc_type(cmp), (n)))
|
||||||
|
#define sk_OSSL_CMP_CERTREPMESSAGE_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_OSSL_CMP_CERTREPMESSAGE_sk_type(sk), (n))
|
||||||
|
#define sk_OSSL_CMP_CERTREPMESSAGE_free(sk) OPENSSL_sk_free(ossl_check_OSSL_CMP_CERTREPMESSAGE_sk_type(sk))
|
||||||
|
#define sk_OSSL_CMP_CERTREPMESSAGE_zero(sk) OPENSSL_sk_zero(ossl_check_OSSL_CMP_CERTREPMESSAGE_sk_type(sk))
|
||||||
|
#define sk_OSSL_CMP_CERTREPMESSAGE_delete(sk, i) ((OSSL_CMP_CERTREPMESSAGE *)OPENSSL_sk_delete(ossl_check_OSSL_CMP_CERTREPMESSAGE_sk_type(sk), (i)))
|
||||||
|
#define sk_OSSL_CMP_CERTREPMESSAGE_delete_ptr(sk, ptr) ((OSSL_CMP_CERTREPMESSAGE *)OPENSSL_sk_delete_ptr(ossl_check_OSSL_CMP_CERTREPMESSAGE_sk_type(sk), ossl_check_OSSL_CMP_CERTREPMESSAGE_type(ptr)))
|
||||||
|
#define sk_OSSL_CMP_CERTREPMESSAGE_push(sk, ptr) OPENSSL_sk_push(ossl_check_OSSL_CMP_CERTREPMESSAGE_sk_type(sk), ossl_check_OSSL_CMP_CERTREPMESSAGE_type(ptr))
|
||||||
|
#define sk_OSSL_CMP_CERTREPMESSAGE_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_OSSL_CMP_CERTREPMESSAGE_sk_type(sk), ossl_check_OSSL_CMP_CERTREPMESSAGE_type(ptr))
|
||||||
|
#define sk_OSSL_CMP_CERTREPMESSAGE_pop(sk) ((OSSL_CMP_CERTREPMESSAGE *)OPENSSL_sk_pop(ossl_check_OSSL_CMP_CERTREPMESSAGE_sk_type(sk)))
|
||||||
|
#define sk_OSSL_CMP_CERTREPMESSAGE_shift(sk) ((OSSL_CMP_CERTREPMESSAGE *)OPENSSL_sk_shift(ossl_check_OSSL_CMP_CERTREPMESSAGE_sk_type(sk)))
|
||||||
|
#define sk_OSSL_CMP_CERTREPMESSAGE_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_OSSL_CMP_CERTREPMESSAGE_sk_type(sk),ossl_check_OSSL_CMP_CERTREPMESSAGE_freefunc_type(freefunc))
|
||||||
|
#define sk_OSSL_CMP_CERTREPMESSAGE_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_OSSL_CMP_CERTREPMESSAGE_sk_type(sk), ossl_check_OSSL_CMP_CERTREPMESSAGE_type(ptr), (idx))
|
||||||
|
#define sk_OSSL_CMP_CERTREPMESSAGE_set(sk, idx, ptr) ((OSSL_CMP_CERTREPMESSAGE *)OPENSSL_sk_set(ossl_check_OSSL_CMP_CERTREPMESSAGE_sk_type(sk), (idx), ossl_check_OSSL_CMP_CERTREPMESSAGE_type(ptr)))
|
||||||
|
#define sk_OSSL_CMP_CERTREPMESSAGE_find(sk, ptr) OPENSSL_sk_find(ossl_check_OSSL_CMP_CERTREPMESSAGE_sk_type(sk), ossl_check_OSSL_CMP_CERTREPMESSAGE_type(ptr))
|
||||||
|
#define sk_OSSL_CMP_CERTREPMESSAGE_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_OSSL_CMP_CERTREPMESSAGE_sk_type(sk), ossl_check_OSSL_CMP_CERTREPMESSAGE_type(ptr))
|
||||||
|
#define sk_OSSL_CMP_CERTREPMESSAGE_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_OSSL_CMP_CERTREPMESSAGE_sk_type(sk), ossl_check_OSSL_CMP_CERTREPMESSAGE_type(ptr), pnum)
|
||||||
|
#define sk_OSSL_CMP_CERTREPMESSAGE_sort(sk) OPENSSL_sk_sort(ossl_check_OSSL_CMP_CERTREPMESSAGE_sk_type(sk))
|
||||||
|
#define sk_OSSL_CMP_CERTREPMESSAGE_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_OSSL_CMP_CERTREPMESSAGE_sk_type(sk))
|
||||||
|
#define sk_OSSL_CMP_CERTREPMESSAGE_dup(sk) ((STACK_OF(OSSL_CMP_CERTREPMESSAGE) *)OPENSSL_sk_dup(ossl_check_const_OSSL_CMP_CERTREPMESSAGE_sk_type(sk)))
|
||||||
|
#define sk_OSSL_CMP_CERTREPMESSAGE_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(OSSL_CMP_CERTREPMESSAGE) *)OPENSSL_sk_deep_copy(ossl_check_const_OSSL_CMP_CERTREPMESSAGE_sk_type(sk), ossl_check_OSSL_CMP_CERTREPMESSAGE_copyfunc_type(copyfunc), ossl_check_OSSL_CMP_CERTREPMESSAGE_freefunc_type(freefunc)))
|
||||||
|
#define sk_OSSL_CMP_CERTREPMESSAGE_set_cmp_func(sk, cmp) ((sk_OSSL_CMP_CERTREPMESSAGE_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_OSSL_CMP_CERTREPMESSAGE_sk_type(sk), ossl_check_OSSL_CMP_CERTREPMESSAGE_compfunc_type(cmp)))
|
||||||
|
|
||||||
|
typedef struct ossl_cmp_pollrep_st OSSL_CMP_POLLREP;
|
||||||
|
typedef STACK_OF(OSSL_CMP_POLLREP) OSSL_CMP_POLLREPCONTENT;
|
||||||
|
typedef struct ossl_cmp_certresponse_st OSSL_CMP_CERTRESPONSE;
|
||||||
|
SKM_DEFINE_STACK_OF_INTERNAL(OSSL_CMP_CERTRESPONSE, OSSL_CMP_CERTRESPONSE, OSSL_CMP_CERTRESPONSE)
|
||||||
|
#define sk_OSSL_CMP_CERTRESPONSE_num(sk) OPENSSL_sk_num(ossl_check_const_OSSL_CMP_CERTRESPONSE_sk_type(sk))
|
||||||
|
#define sk_OSSL_CMP_CERTRESPONSE_value(sk, idx) ((OSSL_CMP_CERTRESPONSE *)OPENSSL_sk_value(ossl_check_const_OSSL_CMP_CERTRESPONSE_sk_type(sk), (idx)))
|
||||||
|
#define sk_OSSL_CMP_CERTRESPONSE_new(cmp) ((STACK_OF(OSSL_CMP_CERTRESPONSE) *)OPENSSL_sk_new(ossl_check_OSSL_CMP_CERTRESPONSE_compfunc_type(cmp)))
|
||||||
|
#define sk_OSSL_CMP_CERTRESPONSE_new_null() ((STACK_OF(OSSL_CMP_CERTRESPONSE) *)OPENSSL_sk_new_null())
|
||||||
|
#define sk_OSSL_CMP_CERTRESPONSE_new_reserve(cmp, n) ((STACK_OF(OSSL_CMP_CERTRESPONSE) *)OPENSSL_sk_new_reserve(ossl_check_OSSL_CMP_CERTRESPONSE_compfunc_type(cmp), (n)))
|
||||||
|
#define sk_OSSL_CMP_CERTRESPONSE_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_OSSL_CMP_CERTRESPONSE_sk_type(sk), (n))
|
||||||
|
#define sk_OSSL_CMP_CERTRESPONSE_free(sk) OPENSSL_sk_free(ossl_check_OSSL_CMP_CERTRESPONSE_sk_type(sk))
|
||||||
|
#define sk_OSSL_CMP_CERTRESPONSE_zero(sk) OPENSSL_sk_zero(ossl_check_OSSL_CMP_CERTRESPONSE_sk_type(sk))
|
||||||
|
#define sk_OSSL_CMP_CERTRESPONSE_delete(sk, i) ((OSSL_CMP_CERTRESPONSE *)OPENSSL_sk_delete(ossl_check_OSSL_CMP_CERTRESPONSE_sk_type(sk), (i)))
|
||||||
|
#define sk_OSSL_CMP_CERTRESPONSE_delete_ptr(sk, ptr) ((OSSL_CMP_CERTRESPONSE *)OPENSSL_sk_delete_ptr(ossl_check_OSSL_CMP_CERTRESPONSE_sk_type(sk), ossl_check_OSSL_CMP_CERTRESPONSE_type(ptr)))
|
||||||
|
#define sk_OSSL_CMP_CERTRESPONSE_push(sk, ptr) OPENSSL_sk_push(ossl_check_OSSL_CMP_CERTRESPONSE_sk_type(sk), ossl_check_OSSL_CMP_CERTRESPONSE_type(ptr))
|
||||||
|
#define sk_OSSL_CMP_CERTRESPONSE_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_OSSL_CMP_CERTRESPONSE_sk_type(sk), ossl_check_OSSL_CMP_CERTRESPONSE_type(ptr))
|
||||||
|
#define sk_OSSL_CMP_CERTRESPONSE_pop(sk) ((OSSL_CMP_CERTRESPONSE *)OPENSSL_sk_pop(ossl_check_OSSL_CMP_CERTRESPONSE_sk_type(sk)))
|
||||||
|
#define sk_OSSL_CMP_CERTRESPONSE_shift(sk) ((OSSL_CMP_CERTRESPONSE *)OPENSSL_sk_shift(ossl_check_OSSL_CMP_CERTRESPONSE_sk_type(sk)))
|
||||||
|
#define sk_OSSL_CMP_CERTRESPONSE_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_OSSL_CMP_CERTRESPONSE_sk_type(sk),ossl_check_OSSL_CMP_CERTRESPONSE_freefunc_type(freefunc))
|
||||||
|
#define sk_OSSL_CMP_CERTRESPONSE_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_OSSL_CMP_CERTRESPONSE_sk_type(sk), ossl_check_OSSL_CMP_CERTRESPONSE_type(ptr), (idx))
|
||||||
|
#define sk_OSSL_CMP_CERTRESPONSE_set(sk, idx, ptr) ((OSSL_CMP_CERTRESPONSE *)OPENSSL_sk_set(ossl_check_OSSL_CMP_CERTRESPONSE_sk_type(sk), (idx), ossl_check_OSSL_CMP_CERTRESPONSE_type(ptr)))
|
||||||
|
#define sk_OSSL_CMP_CERTRESPONSE_find(sk, ptr) OPENSSL_sk_find(ossl_check_OSSL_CMP_CERTRESPONSE_sk_type(sk), ossl_check_OSSL_CMP_CERTRESPONSE_type(ptr))
|
||||||
|
#define sk_OSSL_CMP_CERTRESPONSE_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_OSSL_CMP_CERTRESPONSE_sk_type(sk), ossl_check_OSSL_CMP_CERTRESPONSE_type(ptr))
|
||||||
|
#define sk_OSSL_CMP_CERTRESPONSE_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_OSSL_CMP_CERTRESPONSE_sk_type(sk), ossl_check_OSSL_CMP_CERTRESPONSE_type(ptr), pnum)
|
||||||
|
#define sk_OSSL_CMP_CERTRESPONSE_sort(sk) OPENSSL_sk_sort(ossl_check_OSSL_CMP_CERTRESPONSE_sk_type(sk))
|
||||||
|
#define sk_OSSL_CMP_CERTRESPONSE_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_OSSL_CMP_CERTRESPONSE_sk_type(sk))
|
||||||
|
#define sk_OSSL_CMP_CERTRESPONSE_dup(sk) ((STACK_OF(OSSL_CMP_CERTRESPONSE) *)OPENSSL_sk_dup(ossl_check_const_OSSL_CMP_CERTRESPONSE_sk_type(sk)))
|
||||||
|
#define sk_OSSL_CMP_CERTRESPONSE_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(OSSL_CMP_CERTRESPONSE) *)OPENSSL_sk_deep_copy(ossl_check_const_OSSL_CMP_CERTRESPONSE_sk_type(sk), ossl_check_OSSL_CMP_CERTRESPONSE_copyfunc_type(copyfunc), ossl_check_OSSL_CMP_CERTRESPONSE_freefunc_type(freefunc)))
|
||||||
|
#define sk_OSSL_CMP_CERTRESPONSE_set_cmp_func(sk, cmp) ((sk_OSSL_CMP_CERTRESPONSE_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_OSSL_CMP_CERTRESPONSE_sk_type(sk), ossl_check_OSSL_CMP_CERTRESPONSE_compfunc_type(cmp)))
|
||||||
|
|
||||||
|
typedef STACK_OF(ASN1_UTF8STRING) OSSL_CMP_PKIFREETEXT;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* function DECLARATIONS
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* from cmp_asn.c */
|
||||||
|
OSSL_CMP_ITAV *OSSL_CMP_ITAV_create(ASN1_OBJECT *type, ASN1_TYPE *value);
|
||||||
|
void OSSL_CMP_ITAV_set0(OSSL_CMP_ITAV *itav, ASN1_OBJECT *type,
|
||||||
|
ASN1_TYPE *value);
|
||||||
|
ASN1_OBJECT *OSSL_CMP_ITAV_get0_type(const OSSL_CMP_ITAV *itav);
|
||||||
|
ASN1_TYPE *OSSL_CMP_ITAV_get0_value(const OSSL_CMP_ITAV *itav);
|
||||||
|
int OSSL_CMP_ITAV_push0_stack_item(STACK_OF(OSSL_CMP_ITAV) **sk_p,
|
||||||
|
OSSL_CMP_ITAV *itav);
|
||||||
|
void OSSL_CMP_ITAV_free(OSSL_CMP_ITAV *itav);
|
||||||
|
|
||||||
|
OSSL_CMP_ITAV *OSSL_CMP_ITAV_new0_certProfile(STACK_OF(ASN1_UTF8STRING)
|
||||||
|
*certProfile);
|
||||||
|
int OSSL_CMP_ITAV_get0_certProfile(const OSSL_CMP_ITAV *itav,
|
||||||
|
STACK_OF(ASN1_UTF8STRING) **out);
|
||||||
|
OSSL_CMP_ITAV *OSSL_CMP_ITAV_new_caCerts(const STACK_OF(X509) *caCerts);
|
||||||
|
int OSSL_CMP_ITAV_get0_caCerts(const OSSL_CMP_ITAV *itav, STACK_OF(X509) **out);
|
||||||
|
|
||||||
|
OSSL_CMP_ITAV *OSSL_CMP_ITAV_new_rootCaCert(const X509 *rootCaCert);
|
||||||
|
int OSSL_CMP_ITAV_get0_rootCaCert(const OSSL_CMP_ITAV *itav, X509 **out);
|
||||||
|
OSSL_CMP_ITAV *OSSL_CMP_ITAV_new_rootCaKeyUpdate(const X509 *newWithNew,
|
||||||
|
const X509 *newWithOld,
|
||||||
|
const X509 *oldWithNew);
|
||||||
|
int OSSL_CMP_ITAV_get0_rootCaKeyUpdate(const OSSL_CMP_ITAV *itav,
|
||||||
|
X509 **newWithNew,
|
||||||
|
X509 **newWithOld,
|
||||||
|
X509 **oldWithNew);
|
||||||
|
|
||||||
|
OSSL_CMP_CRLSTATUS *OSSL_CMP_CRLSTATUS_create(const X509_CRL *crl,
|
||||||
|
const X509 *cert, int only_DN);
|
||||||
|
OSSL_CMP_CRLSTATUS *OSSL_CMP_CRLSTATUS_new1(const DIST_POINT_NAME *dpn,
|
||||||
|
const GENERAL_NAMES *issuer,
|
||||||
|
const ASN1_TIME *thisUpdate);
|
||||||
|
int OSSL_CMP_CRLSTATUS_get0(const OSSL_CMP_CRLSTATUS *crlstatus,
|
||||||
|
DIST_POINT_NAME **dpn, GENERAL_NAMES **issuer,
|
||||||
|
ASN1_TIME **thisUpdate);
|
||||||
|
void OSSL_CMP_CRLSTATUS_free(OSSL_CMP_CRLSTATUS *crlstatus);
|
||||||
|
OSSL_CMP_ITAV
|
||||||
|
*OSSL_CMP_ITAV_new0_crlStatusList(STACK_OF(OSSL_CMP_CRLSTATUS) *crlStatusList);
|
||||||
|
int OSSL_CMP_ITAV_get0_crlStatusList(const OSSL_CMP_ITAV *itav,
|
||||||
|
STACK_OF(OSSL_CMP_CRLSTATUS) **out);
|
||||||
|
OSSL_CMP_ITAV *OSSL_CMP_ITAV_new_crls(const X509_CRL *crls);
|
||||||
|
int OSSL_CMP_ITAV_get0_crls(const OSSL_CMP_ITAV *it, STACK_OF(X509_CRL) **out);
|
||||||
|
OSSL_CMP_ITAV
|
||||||
|
*OSSL_CMP_ITAV_new0_certReqTemplate(OSSL_CRMF_CERTTEMPLATE *certTemplate,
|
||||||
|
OSSL_CMP_ATAVS *keySpec);
|
||||||
|
int OSSL_CMP_ITAV_get1_certReqTemplate(const OSSL_CMP_ITAV *itav,
|
||||||
|
OSSL_CRMF_CERTTEMPLATE **certTemplate,
|
||||||
|
OSSL_CMP_ATAVS **keySpec);
|
||||||
|
|
||||||
|
OSSL_CMP_ATAV *OSSL_CMP_ATAV_create(ASN1_OBJECT *type, ASN1_TYPE *value);
|
||||||
|
void OSSL_CMP_ATAV_set0(OSSL_CMP_ATAV *itav, ASN1_OBJECT *type,
|
||||||
|
ASN1_TYPE *value);
|
||||||
|
ASN1_OBJECT *OSSL_CMP_ATAV_get0_type(const OSSL_CMP_ATAV *itav);
|
||||||
|
ASN1_TYPE *OSSL_CMP_ATAV_get0_value(const OSSL_CMP_ATAV *itav);
|
||||||
|
OSSL_CMP_ATAV *OSSL_CMP_ATAV_new_algId(const X509_ALGOR *alg);
|
||||||
|
X509_ALGOR *OSSL_CMP_ATAV_get0_algId(const OSSL_CMP_ATAV *atav);
|
||||||
|
OSSL_CMP_ATAV *OSSL_CMP_ATAV_new_rsaKeyLen(int len);
|
||||||
|
int OSSL_CMP_ATAV_get_rsaKeyLen(const OSSL_CMP_ATAV *atav);
|
||||||
|
int OSSL_CMP_ATAV_push1(OSSL_CMP_ATAVS **sk_p, const OSSL_CMP_ATAV *atav);
|
||||||
|
|
||||||
|
void OSSL_CMP_MSG_free(OSSL_CMP_MSG *msg);
|
||||||
|
|
||||||
|
/* from cmp_ctx.c */
|
||||||
|
OSSL_CMP_CTX *OSSL_CMP_CTX_new(OSSL_LIB_CTX *libctx, const char *propq);
|
||||||
|
void OSSL_CMP_CTX_free(OSSL_CMP_CTX *ctx);
|
||||||
|
int OSSL_CMP_CTX_reinit(OSSL_CMP_CTX *ctx);
|
||||||
|
OSSL_LIB_CTX *OSSL_CMP_CTX_get0_libctx(const OSSL_CMP_CTX *ctx);
|
||||||
|
const char *OSSL_CMP_CTX_get0_propq(const OSSL_CMP_CTX *ctx);
|
||||||
|
/* CMP general options: */
|
||||||
|
# define OSSL_CMP_OPT_LOG_VERBOSITY 0
|
||||||
|
/* CMP transfer options: */
|
||||||
|
# define OSSL_CMP_OPT_KEEP_ALIVE 10
|
||||||
|
# define OSSL_CMP_OPT_MSG_TIMEOUT 11
|
||||||
|
# define OSSL_CMP_OPT_TOTAL_TIMEOUT 12
|
||||||
|
# define OSSL_CMP_OPT_USE_TLS 13
|
||||||
|
/* CMP request options: */
|
||||||
|
# define OSSL_CMP_OPT_VALIDITY_DAYS 20
|
||||||
|
# define OSSL_CMP_OPT_SUBJECTALTNAME_NODEFAULT 21
|
||||||
|
# define OSSL_CMP_OPT_SUBJECTALTNAME_CRITICAL 22
|
||||||
|
# define OSSL_CMP_OPT_POLICIES_CRITICAL 23
|
||||||
|
# define OSSL_CMP_OPT_POPO_METHOD 24
|
||||||
|
# define OSSL_CMP_OPT_IMPLICIT_CONFIRM 25
|
||||||
|
# define OSSL_CMP_OPT_DISABLE_CONFIRM 26
|
||||||
|
# define OSSL_CMP_OPT_REVOCATION_REASON 27
|
||||||
|
/* CMP protection options: */
|
||||||
|
# define OSSL_CMP_OPT_UNPROTECTED_SEND 30
|
||||||
|
# define OSSL_CMP_OPT_UNPROTECTED_ERRORS 31
|
||||||
|
# define OSSL_CMP_OPT_OWF_ALGNID 32
|
||||||
|
# define OSSL_CMP_OPT_MAC_ALGNID 33
|
||||||
|
# define OSSL_CMP_OPT_DIGEST_ALGNID 34
|
||||||
|
# define OSSL_CMP_OPT_IGNORE_KEYUSAGE 35
|
||||||
|
# define OSSL_CMP_OPT_PERMIT_TA_IN_EXTRACERTS_FOR_IR 36
|
||||||
|
# define OSSL_CMP_OPT_NO_CACHE_EXTRACERTS 37
|
||||||
|
int OSSL_CMP_CTX_set_option(OSSL_CMP_CTX *ctx, int opt, int val);
|
||||||
|
int OSSL_CMP_CTX_get_option(const OSSL_CMP_CTX *ctx, int opt);
|
||||||
|
/* CMP-specific callback for logging and outputting the error queue: */
|
||||||
|
int OSSL_CMP_CTX_set_log_cb(OSSL_CMP_CTX *ctx, OSSL_CMP_log_cb_t cb);
|
||||||
|
# define OSSL_CMP_CTX_set_log_verbosity(ctx, level) \
|
||||||
|
OSSL_CMP_CTX_set_option(ctx, OSSL_CMP_OPT_LOG_VERBOSITY, level)
|
||||||
|
void OSSL_CMP_CTX_print_errors(const OSSL_CMP_CTX *ctx);
|
||||||
|
/* message transfer: */
|
||||||
|
int OSSL_CMP_CTX_set1_serverPath(OSSL_CMP_CTX *ctx, const char *path);
|
||||||
|
int OSSL_CMP_CTX_set1_server(OSSL_CMP_CTX *ctx, const char *address);
|
||||||
|
int OSSL_CMP_CTX_set_serverPort(OSSL_CMP_CTX *ctx, int port);
|
||||||
|
int OSSL_CMP_CTX_set1_proxy(OSSL_CMP_CTX *ctx, const char *name);
|
||||||
|
int OSSL_CMP_CTX_set1_no_proxy(OSSL_CMP_CTX *ctx, const char *names);
|
||||||
|
# ifndef OPENSSL_NO_HTTP
|
||||||
|
int OSSL_CMP_CTX_set_http_cb(OSSL_CMP_CTX *ctx, OSSL_HTTP_bio_cb_t cb);
|
||||||
|
int OSSL_CMP_CTX_set_http_cb_arg(OSSL_CMP_CTX *ctx, void *arg);
|
||||||
|
void *OSSL_CMP_CTX_get_http_cb_arg(const OSSL_CMP_CTX *ctx);
|
||||||
|
# endif
|
||||||
|
typedef OSSL_CMP_MSG *(*OSSL_CMP_transfer_cb_t) (OSSL_CMP_CTX *ctx,
|
||||||
|
const OSSL_CMP_MSG *req);
|
||||||
|
int OSSL_CMP_CTX_set_transfer_cb(OSSL_CMP_CTX *ctx, OSSL_CMP_transfer_cb_t cb);
|
||||||
|
int OSSL_CMP_CTX_set_transfer_cb_arg(OSSL_CMP_CTX *ctx, void *arg);
|
||||||
|
void *OSSL_CMP_CTX_get_transfer_cb_arg(const OSSL_CMP_CTX *ctx);
|
||||||
|
/* server authentication: */
|
||||||
|
int OSSL_CMP_CTX_set1_srvCert(OSSL_CMP_CTX *ctx, X509 *cert);
|
||||||
|
int OSSL_CMP_CTX_set1_expected_sender(OSSL_CMP_CTX *ctx, const X509_NAME *name);
|
||||||
|
int OSSL_CMP_CTX_set0_trustedStore(OSSL_CMP_CTX *ctx, X509_STORE *store);
|
||||||
|
# define OSSL_CMP_CTX_set0_trusted OSSL_CMP_CTX_set0_trustedStore
|
||||||
|
X509_STORE *OSSL_CMP_CTX_get0_trustedStore(const OSSL_CMP_CTX *ctx);
|
||||||
|
# define OSSL_CMP_CTX_get0_trusted OSSL_CMP_CTX_get0_trustedStore
|
||||||
|
int OSSL_CMP_CTX_set1_untrusted(OSSL_CMP_CTX *ctx, STACK_OF(X509) *certs);
|
||||||
|
STACK_OF(X509) *OSSL_CMP_CTX_get0_untrusted(const OSSL_CMP_CTX *ctx);
|
||||||
|
/* client authentication: */
|
||||||
|
int OSSL_CMP_CTX_set1_cert(OSSL_CMP_CTX *ctx, X509 *cert);
|
||||||
|
int OSSL_CMP_CTX_build_cert_chain(OSSL_CMP_CTX *ctx, X509_STORE *own_trusted,
|
||||||
|
STACK_OF(X509) *candidates);
|
||||||
|
int OSSL_CMP_CTX_set1_pkey(OSSL_CMP_CTX *ctx, EVP_PKEY *pkey);
|
||||||
|
int OSSL_CMP_CTX_set1_referenceValue(OSSL_CMP_CTX *ctx,
|
||||||
|
const unsigned char *ref, int len);
|
||||||
|
int OSSL_CMP_CTX_set1_secretValue(OSSL_CMP_CTX *ctx,
|
||||||
|
const unsigned char *sec, int len);
|
||||||
|
/* CMP message header and extra certificates: */
|
||||||
|
int OSSL_CMP_CTX_set1_recipient(OSSL_CMP_CTX *ctx, const X509_NAME *name);
|
||||||
|
int OSSL_CMP_CTX_push0_geninfo_ITAV(OSSL_CMP_CTX *ctx, OSSL_CMP_ITAV *itav);
|
||||||
|
int OSSL_CMP_CTX_reset_geninfo_ITAVs(OSSL_CMP_CTX *ctx);
|
||||||
|
STACK_OF(OSSL_CMP_ITAV)
|
||||||
|
*OSSL_CMP_CTX_get0_geninfo_ITAVs(const OSSL_CMP_CTX *ctx);
|
||||||
|
int OSSL_CMP_CTX_set1_extraCertsOut(OSSL_CMP_CTX *ctx,
|
||||||
|
STACK_OF(X509) *extraCertsOut);
|
||||||
|
/* certificate template: */
|
||||||
|
int OSSL_CMP_CTX_set0_newPkey(OSSL_CMP_CTX *ctx, int priv, EVP_PKEY *pkey);
|
||||||
|
EVP_PKEY *OSSL_CMP_CTX_get0_newPkey(const OSSL_CMP_CTX *ctx, int priv);
|
||||||
|
int OSSL_CMP_CTX_set1_issuer(OSSL_CMP_CTX *ctx, const X509_NAME *name);
|
||||||
|
int OSSL_CMP_CTX_set1_serialNumber(OSSL_CMP_CTX *ctx, const ASN1_INTEGER *sn);
|
||||||
|
int OSSL_CMP_CTX_set1_subjectName(OSSL_CMP_CTX *ctx, const X509_NAME *name);
|
||||||
|
int OSSL_CMP_CTX_push1_subjectAltName(OSSL_CMP_CTX *ctx,
|
||||||
|
const GENERAL_NAME *name);
|
||||||
|
int OSSL_CMP_CTX_set0_reqExtensions(OSSL_CMP_CTX *ctx, X509_EXTENSIONS *exts);
|
||||||
|
int OSSL_CMP_CTX_reqExtensions_have_SAN(OSSL_CMP_CTX *ctx);
|
||||||
|
int OSSL_CMP_CTX_push0_policy(OSSL_CMP_CTX *ctx, POLICYINFO *pinfo);
|
||||||
|
int OSSL_CMP_CTX_set1_oldCert(OSSL_CMP_CTX *ctx, X509 *cert);
|
||||||
|
int OSSL_CMP_CTX_set1_p10CSR(OSSL_CMP_CTX *ctx, const X509_REQ *csr);
|
||||||
|
/* misc body contents: */
|
||||||
|
int OSSL_CMP_CTX_push0_genm_ITAV(OSSL_CMP_CTX *ctx, OSSL_CMP_ITAV *itav);
|
||||||
|
/* certificate confirmation: */
|
||||||
|
typedef int (*OSSL_CMP_certConf_cb_t) (OSSL_CMP_CTX *ctx, X509 *cert,
|
||||||
|
int fail_info, const char **txt);
|
||||||
|
int OSSL_CMP_certConf_cb(OSSL_CMP_CTX *ctx, X509 *cert, int fail_info,
|
||||||
|
const char **text);
|
||||||
|
int OSSL_CMP_CTX_set_certConf_cb(OSSL_CMP_CTX *ctx, OSSL_CMP_certConf_cb_t cb);
|
||||||
|
int OSSL_CMP_CTX_set_certConf_cb_arg(OSSL_CMP_CTX *ctx, void *arg);
|
||||||
|
void *OSSL_CMP_CTX_get_certConf_cb_arg(const OSSL_CMP_CTX *ctx);
|
||||||
|
/* result fetching: */
|
||||||
|
int OSSL_CMP_CTX_get_status(const OSSL_CMP_CTX *ctx);
|
||||||
|
OSSL_CMP_PKIFREETEXT *OSSL_CMP_CTX_get0_statusString(const OSSL_CMP_CTX *ctx);
|
||||||
|
int OSSL_CMP_CTX_get_failInfoCode(const OSSL_CMP_CTX *ctx);
|
||||||
|
# define OSSL_CMP_PKISI_BUFLEN 1024
|
||||||
|
X509 *OSSL_CMP_CTX_get0_validatedSrvCert(const OSSL_CMP_CTX *ctx);
|
||||||
|
X509 *OSSL_CMP_CTX_get0_newCert(const OSSL_CMP_CTX *ctx);
|
||||||
|
STACK_OF(X509) *OSSL_CMP_CTX_get1_newChain(const OSSL_CMP_CTX *ctx);
|
||||||
|
STACK_OF(X509) *OSSL_CMP_CTX_get1_caPubs(const OSSL_CMP_CTX *ctx);
|
||||||
|
STACK_OF(X509) *OSSL_CMP_CTX_get1_extraCertsIn(const OSSL_CMP_CTX *ctx);
|
||||||
|
int OSSL_CMP_CTX_set1_transactionID(OSSL_CMP_CTX *ctx,
|
||||||
|
const ASN1_OCTET_STRING *id);
|
||||||
|
int OSSL_CMP_CTX_set1_senderNonce(OSSL_CMP_CTX *ctx,
|
||||||
|
const ASN1_OCTET_STRING *nonce);
|
||||||
|
|
||||||
|
/* from cmp_status.c */
|
||||||
|
char *OSSL_CMP_CTX_snprint_PKIStatus(const OSSL_CMP_CTX *ctx, char *buf,
|
||||||
|
size_t bufsize);
|
||||||
|
char *OSSL_CMP_snprint_PKIStatusInfo(const OSSL_CMP_PKISI *statusInfo,
|
||||||
|
char *buf, size_t bufsize);
|
||||||
|
OSSL_CMP_PKISI *
|
||||||
|
OSSL_CMP_STATUSINFO_new(int status, int fail_info, const char *text);
|
||||||
|
|
||||||
|
/* from cmp_hdr.c */
|
||||||
|
ASN1_OCTET_STRING *OSSL_CMP_HDR_get0_transactionID(const
|
||||||
|
OSSL_CMP_PKIHEADER *hdr);
|
||||||
|
ASN1_OCTET_STRING *OSSL_CMP_HDR_get0_recipNonce(const OSSL_CMP_PKIHEADER *hdr);
|
||||||
|
STACK_OF(OSSL_CMP_ITAV)
|
||||||
|
*OSSL_CMP_HDR_get0_geninfo_ITAVs(const OSSL_CMP_PKIHEADER *hdr);
|
||||||
|
|
||||||
|
/* from cmp_msg.c */
|
||||||
|
OSSL_CMP_PKIHEADER *OSSL_CMP_MSG_get0_header(const OSSL_CMP_MSG *msg);
|
||||||
|
int OSSL_CMP_MSG_get_bodytype(const OSSL_CMP_MSG *msg);
|
||||||
|
X509_PUBKEY *OSSL_CMP_MSG_get0_certreq_publickey(const OSSL_CMP_MSG *msg);
|
||||||
|
int OSSL_CMP_MSG_update_transactionID(OSSL_CMP_CTX *ctx, OSSL_CMP_MSG *msg);
|
||||||
|
int OSSL_CMP_MSG_update_recipNonce(OSSL_CMP_CTX *ctx, OSSL_CMP_MSG *msg);
|
||||||
|
OSSL_CRMF_MSG *OSSL_CMP_CTX_setup_CRM(OSSL_CMP_CTX *ctx, int for_KUR, int rid);
|
||||||
|
OSSL_CMP_MSG *OSSL_CMP_MSG_read(const char *file, OSSL_LIB_CTX *libctx,
|
||||||
|
const char *propq);
|
||||||
|
int OSSL_CMP_MSG_write(const char *file, const OSSL_CMP_MSG *msg);
|
||||||
|
OSSL_CMP_MSG *d2i_OSSL_CMP_MSG_bio(BIO *bio, OSSL_CMP_MSG **msg);
|
||||||
|
int i2d_OSSL_CMP_MSG_bio(BIO *bio, const OSSL_CMP_MSG *msg);
|
||||||
|
|
||||||
|
/* from cmp_vfy.c */
|
||||||
|
int OSSL_CMP_validate_msg(OSSL_CMP_CTX *ctx, const OSSL_CMP_MSG *msg);
|
||||||
|
int OSSL_CMP_validate_cert_path(const OSSL_CMP_CTX *ctx,
|
||||||
|
X509_STORE *trusted_store, X509 *cert);
|
||||||
|
|
||||||
|
/* from cmp_http.c */
|
||||||
|
# ifndef OPENSSL_NO_HTTP
|
||||||
|
OSSL_CMP_MSG *OSSL_CMP_MSG_http_perform(OSSL_CMP_CTX *ctx,
|
||||||
|
const OSSL_CMP_MSG *req);
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/* from cmp_server.c */
|
||||||
|
typedef struct ossl_cmp_srv_ctx_st OSSL_CMP_SRV_CTX;
|
||||||
|
OSSL_CMP_MSG *OSSL_CMP_SRV_process_request(OSSL_CMP_SRV_CTX *srv_ctx,
|
||||||
|
const OSSL_CMP_MSG *req);
|
||||||
|
OSSL_CMP_MSG * OSSL_CMP_CTX_server_perform(OSSL_CMP_CTX *client_ctx,
|
||||||
|
const OSSL_CMP_MSG *req);
|
||||||
|
OSSL_CMP_SRV_CTX *OSSL_CMP_SRV_CTX_new(OSSL_LIB_CTX *libctx, const char *propq);
|
||||||
|
void OSSL_CMP_SRV_CTX_free(OSSL_CMP_SRV_CTX *srv_ctx);
|
||||||
|
typedef OSSL_CMP_PKISI *(*OSSL_CMP_SRV_cert_request_cb_t)
|
||||||
|
(OSSL_CMP_SRV_CTX *srv_ctx, const OSSL_CMP_MSG *req, int certReqId,
|
||||||
|
const OSSL_CRMF_MSG *crm, const X509_REQ *p10cr,
|
||||||
|
X509 **certOut, STACK_OF(X509) **chainOut, STACK_OF(X509) **caPubs);
|
||||||
|
typedef OSSL_CMP_PKISI *(*OSSL_CMP_SRV_rr_cb_t)(OSSL_CMP_SRV_CTX *srv_ctx,
|
||||||
|
const OSSL_CMP_MSG *req,
|
||||||
|
const X509_NAME *issuer,
|
||||||
|
const ASN1_INTEGER *serial);
|
||||||
|
typedef int (*OSSL_CMP_SRV_genm_cb_t)(OSSL_CMP_SRV_CTX *srv_ctx,
|
||||||
|
const OSSL_CMP_MSG *req,
|
||||||
|
const STACK_OF(OSSL_CMP_ITAV) *in,
|
||||||
|
STACK_OF(OSSL_CMP_ITAV) **out);
|
||||||
|
typedef void (*OSSL_CMP_SRV_error_cb_t)(OSSL_CMP_SRV_CTX *srv_ctx,
|
||||||
|
const OSSL_CMP_MSG *req,
|
||||||
|
const OSSL_CMP_PKISI *statusInfo,
|
||||||
|
const ASN1_INTEGER *errorCode,
|
||||||
|
const OSSL_CMP_PKIFREETEXT *errDetails);
|
||||||
|
typedef int (*OSSL_CMP_SRV_certConf_cb_t)(OSSL_CMP_SRV_CTX *srv_ctx,
|
||||||
|
const OSSL_CMP_MSG *req,
|
||||||
|
int certReqId,
|
||||||
|
const ASN1_OCTET_STRING *certHash,
|
||||||
|
const OSSL_CMP_PKISI *si);
|
||||||
|
typedef int (*OSSL_CMP_SRV_pollReq_cb_t)(OSSL_CMP_SRV_CTX *srv_ctx,
|
||||||
|
const OSSL_CMP_MSG *req, int certReqId,
|
||||||
|
OSSL_CMP_MSG **certReq,
|
||||||
|
int64_t *check_after);
|
||||||
|
int OSSL_CMP_SRV_CTX_init(OSSL_CMP_SRV_CTX *srv_ctx, void *custom_ctx,
|
||||||
|
OSSL_CMP_SRV_cert_request_cb_t process_cert_request,
|
||||||
|
OSSL_CMP_SRV_rr_cb_t process_rr,
|
||||||
|
OSSL_CMP_SRV_genm_cb_t process_genm,
|
||||||
|
OSSL_CMP_SRV_error_cb_t process_error,
|
||||||
|
OSSL_CMP_SRV_certConf_cb_t process_certConf,
|
||||||
|
OSSL_CMP_SRV_pollReq_cb_t process_pollReq);
|
||||||
|
typedef int (*OSSL_CMP_SRV_delayed_delivery_cb_t)(OSSL_CMP_SRV_CTX *srv_ctx,
|
||||||
|
const OSSL_CMP_MSG *req);
|
||||||
|
typedef int (*OSSL_CMP_SRV_clean_transaction_cb_t)(OSSL_CMP_SRV_CTX *srv_ctx,
|
||||||
|
const ASN1_OCTET_STRING *id);
|
||||||
|
int OSSL_CMP_SRV_CTX_init_trans(OSSL_CMP_SRV_CTX *srv_ctx,
|
||||||
|
OSSL_CMP_SRV_delayed_delivery_cb_t delay,
|
||||||
|
OSSL_CMP_SRV_clean_transaction_cb_t clean);
|
||||||
|
OSSL_CMP_CTX *OSSL_CMP_SRV_CTX_get0_cmp_ctx(const OSSL_CMP_SRV_CTX *srv_ctx);
|
||||||
|
void *OSSL_CMP_SRV_CTX_get0_custom_ctx(const OSSL_CMP_SRV_CTX *srv_ctx);
|
||||||
|
int OSSL_CMP_SRV_CTX_set_send_unprotected_errors(OSSL_CMP_SRV_CTX *srv_ctx,
|
||||||
|
int val);
|
||||||
|
int OSSL_CMP_SRV_CTX_set_accept_unprotected(OSSL_CMP_SRV_CTX *srv_ctx, int val);
|
||||||
|
int OSSL_CMP_SRV_CTX_set_accept_raverified(OSSL_CMP_SRV_CTX *srv_ctx, int val);
|
||||||
|
int OSSL_CMP_SRV_CTX_set_grant_implicit_confirm(OSSL_CMP_SRV_CTX *srv_ctx,
|
||||||
|
int val);
|
||||||
|
|
||||||
|
/* from cmp_client.c */
|
||||||
|
X509 *OSSL_CMP_exec_certreq(OSSL_CMP_CTX *ctx, int req_type,
|
||||||
|
const OSSL_CRMF_MSG *crm);
|
||||||
|
# define OSSL_CMP_IR 0
|
||||||
|
# define OSSL_CMP_CR 2
|
||||||
|
# define OSSL_CMP_P10CR 4
|
||||||
|
# define OSSL_CMP_KUR 7
|
||||||
|
# define OSSL_CMP_GENM 21
|
||||||
|
# define OSSL_CMP_ERROR 23
|
||||||
|
# define OSSL_CMP_exec_IR_ses(ctx) \
|
||||||
|
OSSL_CMP_exec_certreq(ctx, OSSL_CMP_IR, NULL)
|
||||||
|
# define OSSL_CMP_exec_CR_ses(ctx) \
|
||||||
|
OSSL_CMP_exec_certreq(ctx, OSSL_CMP_CR, NULL)
|
||||||
|
# define OSSL_CMP_exec_P10CR_ses(ctx) \
|
||||||
|
OSSL_CMP_exec_certreq(ctx, OSSL_CMP_P10CR, NULL)
|
||||||
|
# define OSSL_CMP_exec_KUR_ses(ctx) \
|
||||||
|
OSSL_CMP_exec_certreq(ctx, OSSL_CMP_KUR, NULL)
|
||||||
|
int OSSL_CMP_try_certreq(OSSL_CMP_CTX *ctx, int req_type,
|
||||||
|
const OSSL_CRMF_MSG *crm, int *checkAfter);
|
||||||
|
int OSSL_CMP_exec_RR_ses(OSSL_CMP_CTX *ctx);
|
||||||
|
STACK_OF(OSSL_CMP_ITAV) *OSSL_CMP_exec_GENM_ses(OSSL_CMP_CTX *ctx);
|
||||||
|
|
||||||
|
/* from cmp_genm.c */
|
||||||
|
int OSSL_CMP_get1_caCerts(OSSL_CMP_CTX *ctx, STACK_OF(X509) **out);
|
||||||
|
int OSSL_CMP_get1_rootCaKeyUpdate(OSSL_CMP_CTX *ctx,
|
||||||
|
const X509 *oldWithOld, X509 **newWithNew,
|
||||||
|
X509 **newWithOld, X509 **oldWithNew);
|
||||||
|
int OSSL_CMP_get1_crlUpdate(OSSL_CMP_CTX *ctx, const X509 *crlcert,
|
||||||
|
const X509_CRL *last_crl,
|
||||||
|
X509_CRL **crl);
|
||||||
|
int OSSL_CMP_get1_certReqTemplate(OSSL_CMP_CTX *ctx,
|
||||||
|
OSSL_CRMF_CERTTEMPLATE **certTemplate,
|
||||||
|
OSSL_CMP_ATAVS **keySpec);
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
# endif /* !defined(OPENSSL_NO_CMP) */
|
||||||
|
#endif /* !defined(OPENSSL_CMP_H) */
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2007-2021 The OpenSSL Project Authors. All Rights Reserved.
|
||||||
|
* Copyright Nokia 2007-2019
|
||||||
|
* Copyright Siemens AG 2015-2019
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef OPENSSL_CMP_UTIL_H
|
||||||
|
# define OPENSSL_CMP_UTIL_H
|
||||||
|
# pragma once
|
||||||
|
|
||||||
|
# include <openssl/opensslconf.h>
|
||||||
|
# ifndef OPENSSL_NO_CMP
|
||||||
|
|
||||||
|
# include <openssl/macros.h>
|
||||||
|
# include <openssl/trace.h>
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
# endif
|
||||||
|
|
||||||
|
int OSSL_CMP_log_open(void);
|
||||||
|
void OSSL_CMP_log_close(void);
|
||||||
|
# define OSSL_CMP_LOG_PREFIX "CMP "
|
||||||
|
|
||||||
|
/*
|
||||||
|
* generalized logging/error callback mirroring the severity levels of syslog.h
|
||||||
|
*/
|
||||||
|
typedef int OSSL_CMP_severity;
|
||||||
|
# define OSSL_CMP_LOG_EMERG 0
|
||||||
|
# define OSSL_CMP_LOG_ALERT 1
|
||||||
|
# define OSSL_CMP_LOG_CRIT 2
|
||||||
|
# define OSSL_CMP_LOG_ERR 3
|
||||||
|
# define OSSL_CMP_LOG_WARNING 4
|
||||||
|
# define OSSL_CMP_LOG_NOTICE 5
|
||||||
|
# define OSSL_CMP_LOG_INFO 6
|
||||||
|
# define OSSL_CMP_LOG_DEBUG 7
|
||||||
|
# define OSSL_CMP_LOG_TRACE 8
|
||||||
|
# define OSSL_CMP_LOG_MAX OSSL_CMP_LOG_TRACE
|
||||||
|
typedef int (*OSSL_CMP_log_cb_t)(const char *func, const char *file, int line,
|
||||||
|
OSSL_CMP_severity level, const char *msg);
|
||||||
|
|
||||||
|
int OSSL_CMP_print_to_bio(BIO *bio, const char *component, const char *file,
|
||||||
|
int line, OSSL_CMP_severity level, const char *msg);
|
||||||
|
/* use of the logging callback for outputting error queue */
|
||||||
|
void OSSL_CMP_print_errors_cb(OSSL_CMP_log_cb_t log_fn);
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
# endif /* !defined(OPENSSL_NO_CMP) */
|
||||||
|
#endif /* !defined(OPENSSL_CMP_UTIL_H) */
|
||||||
@@ -0,0 +1,134 @@
|
|||||||
|
/*
|
||||||
|
* Generated by util/mkerr.pl DO NOT EDIT
|
||||||
|
* Copyright 1995-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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef OPENSSL_CMPERR_H
|
||||||
|
# define OPENSSL_CMPERR_H
|
||||||
|
# pragma once
|
||||||
|
|
||||||
|
# include <openssl/opensslconf.h>
|
||||||
|
# include <openssl/symhacks.h>
|
||||||
|
# include <openssl/cryptoerr_legacy.h>
|
||||||
|
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_CMP
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* CMP reason codes.
|
||||||
|
*/
|
||||||
|
# define CMP_R_ALGORITHM_NOT_SUPPORTED 139
|
||||||
|
# define CMP_R_BAD_CHECKAFTER_IN_POLLREP 167
|
||||||
|
# define CMP_R_BAD_REQUEST_ID 108
|
||||||
|
# define CMP_R_CERTHASH_UNMATCHED 156
|
||||||
|
# define CMP_R_CERTID_NOT_FOUND 109
|
||||||
|
# define CMP_R_CERTIFICATE_NOT_ACCEPTED 169
|
||||||
|
# define CMP_R_CERTIFICATE_NOT_FOUND 112
|
||||||
|
# define CMP_R_CERTREQMSG_NOT_FOUND 157
|
||||||
|
# define CMP_R_CERTRESPONSE_NOT_FOUND 113
|
||||||
|
# define CMP_R_CERT_AND_KEY_DO_NOT_MATCH 114
|
||||||
|
# define CMP_R_CHECKAFTER_OUT_OF_RANGE 181
|
||||||
|
# define CMP_R_ENCOUNTERED_KEYUPDATEWARNING 176
|
||||||
|
# define CMP_R_ENCOUNTERED_WAITING 162
|
||||||
|
# define CMP_R_ERROR_CALCULATING_PROTECTION 115
|
||||||
|
# define CMP_R_ERROR_CREATING_CERTCONF 116
|
||||||
|
# define CMP_R_ERROR_CREATING_CERTREP 117
|
||||||
|
# define CMP_R_ERROR_CREATING_CERTREQ 163
|
||||||
|
# define CMP_R_ERROR_CREATING_ERROR 118
|
||||||
|
# define CMP_R_ERROR_CREATING_GENM 119
|
||||||
|
# define CMP_R_ERROR_CREATING_GENP 120
|
||||||
|
# define CMP_R_ERROR_CREATING_PKICONF 122
|
||||||
|
# define CMP_R_ERROR_CREATING_POLLREP 123
|
||||||
|
# define CMP_R_ERROR_CREATING_POLLREQ 124
|
||||||
|
# define CMP_R_ERROR_CREATING_RP 125
|
||||||
|
# define CMP_R_ERROR_CREATING_RR 126
|
||||||
|
# define CMP_R_ERROR_PARSING_PKISTATUS 107
|
||||||
|
# define CMP_R_ERROR_PROCESSING_MESSAGE 158
|
||||||
|
# define CMP_R_ERROR_PROTECTING_MESSAGE 127
|
||||||
|
# define CMP_R_ERROR_SETTING_CERTHASH 128
|
||||||
|
# define CMP_R_ERROR_UNEXPECTED_CERTCONF 160
|
||||||
|
# define CMP_R_ERROR_VALIDATING_PROTECTION 140
|
||||||
|
# define CMP_R_ERROR_VALIDATING_SIGNATURE 171
|
||||||
|
# define CMP_R_EXPECTED_POLLREQ 104
|
||||||
|
# define CMP_R_FAILED_BUILDING_OWN_CHAIN 164
|
||||||
|
# define CMP_R_FAILED_EXTRACTING_CENTRAL_GEN_KEY 203
|
||||||
|
# define CMP_R_FAILED_EXTRACTING_PUBKEY 141
|
||||||
|
# define CMP_R_FAILURE_OBTAINING_RANDOM 110
|
||||||
|
# define CMP_R_FAIL_INFO_OUT_OF_RANGE 129
|
||||||
|
# define CMP_R_GENERATE_CERTREQTEMPLATE 197
|
||||||
|
# define CMP_R_GENERATE_CRLSTATUS 198
|
||||||
|
# define CMP_R_GETTING_GENP 192
|
||||||
|
# define CMP_R_GET_ITAV 199
|
||||||
|
# define CMP_R_INVALID_ARGS 100
|
||||||
|
# define CMP_R_INVALID_GENP 193
|
||||||
|
# define CMP_R_INVALID_KEYSPEC 202
|
||||||
|
# define CMP_R_INVALID_OPTION 174
|
||||||
|
# define CMP_R_INVALID_ROOTCAKEYUPDATE 195
|
||||||
|
# define CMP_R_MISSING_CENTRAL_GEN_KEY 204
|
||||||
|
# define CMP_R_MISSING_CERTID 165
|
||||||
|
# define CMP_R_MISSING_KEY_INPUT_FOR_CREATING_PROTECTION 130
|
||||||
|
# define CMP_R_MISSING_KEY_USAGE_DIGITALSIGNATURE 142
|
||||||
|
# define CMP_R_MISSING_P10CSR 121
|
||||||
|
# define CMP_R_MISSING_PBM_SECRET 166
|
||||||
|
# define CMP_R_MISSING_PRIVATE_KEY 131
|
||||||
|
# define CMP_R_MISSING_PRIVATE_KEY_FOR_POPO 190
|
||||||
|
# define CMP_R_MISSING_PROTECTION 143
|
||||||
|
# define CMP_R_MISSING_PUBLIC_KEY 183
|
||||||
|
# define CMP_R_MISSING_REFERENCE_CERT 168
|
||||||
|
# define CMP_R_MISSING_SECRET 178
|
||||||
|
# define CMP_R_MISSING_SENDER_IDENTIFICATION 111
|
||||||
|
# define CMP_R_MISSING_TRUST_ANCHOR 179
|
||||||
|
# define CMP_R_MISSING_TRUST_STORE 144
|
||||||
|
# define CMP_R_MULTIPLE_REQUESTS_NOT_SUPPORTED 161
|
||||||
|
# define CMP_R_MULTIPLE_RESPONSES_NOT_SUPPORTED 170
|
||||||
|
# define CMP_R_MULTIPLE_SAN_SOURCES 102
|
||||||
|
# define CMP_R_NO_STDIO 194
|
||||||
|
# define CMP_R_NO_SUITABLE_SENDER_CERT 145
|
||||||
|
# define CMP_R_NULL_ARGUMENT 103
|
||||||
|
# define CMP_R_PKIBODY_ERROR 146
|
||||||
|
# define CMP_R_PKISTATUSINFO_NOT_FOUND 132
|
||||||
|
# define CMP_R_POLLING_FAILED 172
|
||||||
|
# define CMP_R_POTENTIALLY_INVALID_CERTIFICATE 147
|
||||||
|
# define CMP_R_RECEIVED_ERROR 180
|
||||||
|
# define CMP_R_RECIPNONCE_UNMATCHED 148
|
||||||
|
# define CMP_R_REQUEST_NOT_ACCEPTED 149
|
||||||
|
# define CMP_R_REQUEST_REJECTED_BY_SERVER 182
|
||||||
|
# define CMP_R_SENDER_GENERALNAME_TYPE_NOT_SUPPORTED 150
|
||||||
|
# define CMP_R_SRVCERT_DOES_NOT_VALIDATE_MSG 151
|
||||||
|
# define CMP_R_TOTAL_TIMEOUT 184
|
||||||
|
# define CMP_R_TRANSACTIONID_UNMATCHED 152
|
||||||
|
# define CMP_R_TRANSFER_ERROR 159
|
||||||
|
# define CMP_R_UNCLEAN_CTX 191
|
||||||
|
# define CMP_R_UNEXPECTED_CENTRAL_GEN_KEY 205
|
||||||
|
# define CMP_R_UNEXPECTED_CERTPROFILE 196
|
||||||
|
# define CMP_R_UNEXPECTED_CRLSTATUSLIST 201
|
||||||
|
# define CMP_R_UNEXPECTED_PKIBODY 133
|
||||||
|
# define CMP_R_UNEXPECTED_PKISTATUS 185
|
||||||
|
# define CMP_R_UNEXPECTED_POLLREQ 105
|
||||||
|
# define CMP_R_UNEXPECTED_PVNO 153
|
||||||
|
# define CMP_R_UNEXPECTED_SENDER 106
|
||||||
|
# define CMP_R_UNKNOWN_ALGORITHM_ID 134
|
||||||
|
# define CMP_R_UNKNOWN_CERT_TYPE 135
|
||||||
|
# define CMP_R_UNKNOWN_CRL_ISSUER 200
|
||||||
|
# define CMP_R_UNKNOWN_PKISTATUS 186
|
||||||
|
# define CMP_R_UNSUPPORTED_ALGORITHM 136
|
||||||
|
# define CMP_R_UNSUPPORTED_KEY_TYPE 137
|
||||||
|
# define CMP_R_UNSUPPORTED_PKIBODY 101
|
||||||
|
# define CMP_R_UNSUPPORTED_PROTECTION_ALG_DHBASEDMAC 154
|
||||||
|
# define CMP_R_VALUE_TOO_LARGE 175
|
||||||
|
# define CMP_R_VALUE_TOO_SMALL 177
|
||||||
|
# define CMP_R_WRONG_ALGORITHM_OID 138
|
||||||
|
# define CMP_R_WRONG_CERTID 189
|
||||||
|
# define CMP_R_WRONG_CERTID_IN_RP 187
|
||||||
|
# define CMP_R_WRONG_PBM_VALUE 155
|
||||||
|
# define CMP_R_WRONG_RP_COMPONENT_COUNT 188
|
||||||
|
# define CMP_R_WRONG_SERIAL_IN_RP 173
|
||||||
|
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,511 @@
|
|||||||
|
/*
|
||||||
|
* WARNING: do not edit!
|
||||||
|
* Generated by Makefile from ../../openssl-3.5.0/include/openssl/cms.h.in
|
||||||
|
*
|
||||||
|
* Copyright 2008-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
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef OPENSSL_CMS_H
|
||||||
|
# define OPENSSL_CMS_H
|
||||||
|
# pragma once
|
||||||
|
|
||||||
|
# include <openssl/macros.h>
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
# define HEADER_CMS_H
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# include <openssl/opensslconf.h>
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_CMS
|
||||||
|
# include <openssl/x509.h>
|
||||||
|
# include <openssl/x509v3.h>
|
||||||
|
# include <openssl/cmserr.h>
|
||||||
|
# ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
# endif
|
||||||
|
|
||||||
|
typedef struct CMS_EnvelopedData_st CMS_EnvelopedData;
|
||||||
|
typedef struct CMS_ContentInfo_st CMS_ContentInfo;
|
||||||
|
typedef struct CMS_SignerInfo_st CMS_SignerInfo;
|
||||||
|
typedef struct CMS_SignedData_st CMS_SignedData;
|
||||||
|
typedef struct CMS_CertificateChoices CMS_CertificateChoices;
|
||||||
|
typedef struct CMS_RevocationInfoChoice_st CMS_RevocationInfoChoice;
|
||||||
|
typedef struct CMS_RecipientInfo_st CMS_RecipientInfo;
|
||||||
|
typedef struct CMS_ReceiptRequest_st CMS_ReceiptRequest;
|
||||||
|
typedef struct CMS_Receipt_st CMS_Receipt;
|
||||||
|
typedef struct CMS_RecipientEncryptedKey_st CMS_RecipientEncryptedKey;
|
||||||
|
typedef struct CMS_OtherKeyAttribute_st CMS_OtherKeyAttribute;
|
||||||
|
|
||||||
|
SKM_DEFINE_STACK_OF_INTERNAL(CMS_SignerInfo, CMS_SignerInfo, CMS_SignerInfo)
|
||||||
|
#define sk_CMS_SignerInfo_num(sk) OPENSSL_sk_num(ossl_check_const_CMS_SignerInfo_sk_type(sk))
|
||||||
|
#define sk_CMS_SignerInfo_value(sk, idx) ((CMS_SignerInfo *)OPENSSL_sk_value(ossl_check_const_CMS_SignerInfo_sk_type(sk), (idx)))
|
||||||
|
#define sk_CMS_SignerInfo_new(cmp) ((STACK_OF(CMS_SignerInfo) *)OPENSSL_sk_new(ossl_check_CMS_SignerInfo_compfunc_type(cmp)))
|
||||||
|
#define sk_CMS_SignerInfo_new_null() ((STACK_OF(CMS_SignerInfo) *)OPENSSL_sk_new_null())
|
||||||
|
#define sk_CMS_SignerInfo_new_reserve(cmp, n) ((STACK_OF(CMS_SignerInfo) *)OPENSSL_sk_new_reserve(ossl_check_CMS_SignerInfo_compfunc_type(cmp), (n)))
|
||||||
|
#define sk_CMS_SignerInfo_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_CMS_SignerInfo_sk_type(sk), (n))
|
||||||
|
#define sk_CMS_SignerInfo_free(sk) OPENSSL_sk_free(ossl_check_CMS_SignerInfo_sk_type(sk))
|
||||||
|
#define sk_CMS_SignerInfo_zero(sk) OPENSSL_sk_zero(ossl_check_CMS_SignerInfo_sk_type(sk))
|
||||||
|
#define sk_CMS_SignerInfo_delete(sk, i) ((CMS_SignerInfo *)OPENSSL_sk_delete(ossl_check_CMS_SignerInfo_sk_type(sk), (i)))
|
||||||
|
#define sk_CMS_SignerInfo_delete_ptr(sk, ptr) ((CMS_SignerInfo *)OPENSSL_sk_delete_ptr(ossl_check_CMS_SignerInfo_sk_type(sk), ossl_check_CMS_SignerInfo_type(ptr)))
|
||||||
|
#define sk_CMS_SignerInfo_push(sk, ptr) OPENSSL_sk_push(ossl_check_CMS_SignerInfo_sk_type(sk), ossl_check_CMS_SignerInfo_type(ptr))
|
||||||
|
#define sk_CMS_SignerInfo_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_CMS_SignerInfo_sk_type(sk), ossl_check_CMS_SignerInfo_type(ptr))
|
||||||
|
#define sk_CMS_SignerInfo_pop(sk) ((CMS_SignerInfo *)OPENSSL_sk_pop(ossl_check_CMS_SignerInfo_sk_type(sk)))
|
||||||
|
#define sk_CMS_SignerInfo_shift(sk) ((CMS_SignerInfo *)OPENSSL_sk_shift(ossl_check_CMS_SignerInfo_sk_type(sk)))
|
||||||
|
#define sk_CMS_SignerInfo_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_CMS_SignerInfo_sk_type(sk),ossl_check_CMS_SignerInfo_freefunc_type(freefunc))
|
||||||
|
#define sk_CMS_SignerInfo_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_CMS_SignerInfo_sk_type(sk), ossl_check_CMS_SignerInfo_type(ptr), (idx))
|
||||||
|
#define sk_CMS_SignerInfo_set(sk, idx, ptr) ((CMS_SignerInfo *)OPENSSL_sk_set(ossl_check_CMS_SignerInfo_sk_type(sk), (idx), ossl_check_CMS_SignerInfo_type(ptr)))
|
||||||
|
#define sk_CMS_SignerInfo_find(sk, ptr) OPENSSL_sk_find(ossl_check_CMS_SignerInfo_sk_type(sk), ossl_check_CMS_SignerInfo_type(ptr))
|
||||||
|
#define sk_CMS_SignerInfo_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_CMS_SignerInfo_sk_type(sk), ossl_check_CMS_SignerInfo_type(ptr))
|
||||||
|
#define sk_CMS_SignerInfo_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_CMS_SignerInfo_sk_type(sk), ossl_check_CMS_SignerInfo_type(ptr), pnum)
|
||||||
|
#define sk_CMS_SignerInfo_sort(sk) OPENSSL_sk_sort(ossl_check_CMS_SignerInfo_sk_type(sk))
|
||||||
|
#define sk_CMS_SignerInfo_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_CMS_SignerInfo_sk_type(sk))
|
||||||
|
#define sk_CMS_SignerInfo_dup(sk) ((STACK_OF(CMS_SignerInfo) *)OPENSSL_sk_dup(ossl_check_const_CMS_SignerInfo_sk_type(sk)))
|
||||||
|
#define sk_CMS_SignerInfo_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(CMS_SignerInfo) *)OPENSSL_sk_deep_copy(ossl_check_const_CMS_SignerInfo_sk_type(sk), ossl_check_CMS_SignerInfo_copyfunc_type(copyfunc), ossl_check_CMS_SignerInfo_freefunc_type(freefunc)))
|
||||||
|
#define sk_CMS_SignerInfo_set_cmp_func(sk, cmp) ((sk_CMS_SignerInfo_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_CMS_SignerInfo_sk_type(sk), ossl_check_CMS_SignerInfo_compfunc_type(cmp)))
|
||||||
|
SKM_DEFINE_STACK_OF_INTERNAL(CMS_RecipientEncryptedKey, CMS_RecipientEncryptedKey, CMS_RecipientEncryptedKey)
|
||||||
|
#define sk_CMS_RecipientEncryptedKey_num(sk) OPENSSL_sk_num(ossl_check_const_CMS_RecipientEncryptedKey_sk_type(sk))
|
||||||
|
#define sk_CMS_RecipientEncryptedKey_value(sk, idx) ((CMS_RecipientEncryptedKey *)OPENSSL_sk_value(ossl_check_const_CMS_RecipientEncryptedKey_sk_type(sk), (idx)))
|
||||||
|
#define sk_CMS_RecipientEncryptedKey_new(cmp) ((STACK_OF(CMS_RecipientEncryptedKey) *)OPENSSL_sk_new(ossl_check_CMS_RecipientEncryptedKey_compfunc_type(cmp)))
|
||||||
|
#define sk_CMS_RecipientEncryptedKey_new_null() ((STACK_OF(CMS_RecipientEncryptedKey) *)OPENSSL_sk_new_null())
|
||||||
|
#define sk_CMS_RecipientEncryptedKey_new_reserve(cmp, n) ((STACK_OF(CMS_RecipientEncryptedKey) *)OPENSSL_sk_new_reserve(ossl_check_CMS_RecipientEncryptedKey_compfunc_type(cmp), (n)))
|
||||||
|
#define sk_CMS_RecipientEncryptedKey_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_CMS_RecipientEncryptedKey_sk_type(sk), (n))
|
||||||
|
#define sk_CMS_RecipientEncryptedKey_free(sk) OPENSSL_sk_free(ossl_check_CMS_RecipientEncryptedKey_sk_type(sk))
|
||||||
|
#define sk_CMS_RecipientEncryptedKey_zero(sk) OPENSSL_sk_zero(ossl_check_CMS_RecipientEncryptedKey_sk_type(sk))
|
||||||
|
#define sk_CMS_RecipientEncryptedKey_delete(sk, i) ((CMS_RecipientEncryptedKey *)OPENSSL_sk_delete(ossl_check_CMS_RecipientEncryptedKey_sk_type(sk), (i)))
|
||||||
|
#define sk_CMS_RecipientEncryptedKey_delete_ptr(sk, ptr) ((CMS_RecipientEncryptedKey *)OPENSSL_sk_delete_ptr(ossl_check_CMS_RecipientEncryptedKey_sk_type(sk), ossl_check_CMS_RecipientEncryptedKey_type(ptr)))
|
||||||
|
#define sk_CMS_RecipientEncryptedKey_push(sk, ptr) OPENSSL_sk_push(ossl_check_CMS_RecipientEncryptedKey_sk_type(sk), ossl_check_CMS_RecipientEncryptedKey_type(ptr))
|
||||||
|
#define sk_CMS_RecipientEncryptedKey_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_CMS_RecipientEncryptedKey_sk_type(sk), ossl_check_CMS_RecipientEncryptedKey_type(ptr))
|
||||||
|
#define sk_CMS_RecipientEncryptedKey_pop(sk) ((CMS_RecipientEncryptedKey *)OPENSSL_sk_pop(ossl_check_CMS_RecipientEncryptedKey_sk_type(sk)))
|
||||||
|
#define sk_CMS_RecipientEncryptedKey_shift(sk) ((CMS_RecipientEncryptedKey *)OPENSSL_sk_shift(ossl_check_CMS_RecipientEncryptedKey_sk_type(sk)))
|
||||||
|
#define sk_CMS_RecipientEncryptedKey_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_CMS_RecipientEncryptedKey_sk_type(sk),ossl_check_CMS_RecipientEncryptedKey_freefunc_type(freefunc))
|
||||||
|
#define sk_CMS_RecipientEncryptedKey_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_CMS_RecipientEncryptedKey_sk_type(sk), ossl_check_CMS_RecipientEncryptedKey_type(ptr), (idx))
|
||||||
|
#define sk_CMS_RecipientEncryptedKey_set(sk, idx, ptr) ((CMS_RecipientEncryptedKey *)OPENSSL_sk_set(ossl_check_CMS_RecipientEncryptedKey_sk_type(sk), (idx), ossl_check_CMS_RecipientEncryptedKey_type(ptr)))
|
||||||
|
#define sk_CMS_RecipientEncryptedKey_find(sk, ptr) OPENSSL_sk_find(ossl_check_CMS_RecipientEncryptedKey_sk_type(sk), ossl_check_CMS_RecipientEncryptedKey_type(ptr))
|
||||||
|
#define sk_CMS_RecipientEncryptedKey_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_CMS_RecipientEncryptedKey_sk_type(sk), ossl_check_CMS_RecipientEncryptedKey_type(ptr))
|
||||||
|
#define sk_CMS_RecipientEncryptedKey_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_CMS_RecipientEncryptedKey_sk_type(sk), ossl_check_CMS_RecipientEncryptedKey_type(ptr), pnum)
|
||||||
|
#define sk_CMS_RecipientEncryptedKey_sort(sk) OPENSSL_sk_sort(ossl_check_CMS_RecipientEncryptedKey_sk_type(sk))
|
||||||
|
#define sk_CMS_RecipientEncryptedKey_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_CMS_RecipientEncryptedKey_sk_type(sk))
|
||||||
|
#define sk_CMS_RecipientEncryptedKey_dup(sk) ((STACK_OF(CMS_RecipientEncryptedKey) *)OPENSSL_sk_dup(ossl_check_const_CMS_RecipientEncryptedKey_sk_type(sk)))
|
||||||
|
#define sk_CMS_RecipientEncryptedKey_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(CMS_RecipientEncryptedKey) *)OPENSSL_sk_deep_copy(ossl_check_const_CMS_RecipientEncryptedKey_sk_type(sk), ossl_check_CMS_RecipientEncryptedKey_copyfunc_type(copyfunc), ossl_check_CMS_RecipientEncryptedKey_freefunc_type(freefunc)))
|
||||||
|
#define sk_CMS_RecipientEncryptedKey_set_cmp_func(sk, cmp) ((sk_CMS_RecipientEncryptedKey_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_CMS_RecipientEncryptedKey_sk_type(sk), ossl_check_CMS_RecipientEncryptedKey_compfunc_type(cmp)))
|
||||||
|
SKM_DEFINE_STACK_OF_INTERNAL(CMS_RecipientInfo, CMS_RecipientInfo, CMS_RecipientInfo)
|
||||||
|
#define sk_CMS_RecipientInfo_num(sk) OPENSSL_sk_num(ossl_check_const_CMS_RecipientInfo_sk_type(sk))
|
||||||
|
#define sk_CMS_RecipientInfo_value(sk, idx) ((CMS_RecipientInfo *)OPENSSL_sk_value(ossl_check_const_CMS_RecipientInfo_sk_type(sk), (idx)))
|
||||||
|
#define sk_CMS_RecipientInfo_new(cmp) ((STACK_OF(CMS_RecipientInfo) *)OPENSSL_sk_new(ossl_check_CMS_RecipientInfo_compfunc_type(cmp)))
|
||||||
|
#define sk_CMS_RecipientInfo_new_null() ((STACK_OF(CMS_RecipientInfo) *)OPENSSL_sk_new_null())
|
||||||
|
#define sk_CMS_RecipientInfo_new_reserve(cmp, n) ((STACK_OF(CMS_RecipientInfo) *)OPENSSL_sk_new_reserve(ossl_check_CMS_RecipientInfo_compfunc_type(cmp), (n)))
|
||||||
|
#define sk_CMS_RecipientInfo_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_CMS_RecipientInfo_sk_type(sk), (n))
|
||||||
|
#define sk_CMS_RecipientInfo_free(sk) OPENSSL_sk_free(ossl_check_CMS_RecipientInfo_sk_type(sk))
|
||||||
|
#define sk_CMS_RecipientInfo_zero(sk) OPENSSL_sk_zero(ossl_check_CMS_RecipientInfo_sk_type(sk))
|
||||||
|
#define sk_CMS_RecipientInfo_delete(sk, i) ((CMS_RecipientInfo *)OPENSSL_sk_delete(ossl_check_CMS_RecipientInfo_sk_type(sk), (i)))
|
||||||
|
#define sk_CMS_RecipientInfo_delete_ptr(sk, ptr) ((CMS_RecipientInfo *)OPENSSL_sk_delete_ptr(ossl_check_CMS_RecipientInfo_sk_type(sk), ossl_check_CMS_RecipientInfo_type(ptr)))
|
||||||
|
#define sk_CMS_RecipientInfo_push(sk, ptr) OPENSSL_sk_push(ossl_check_CMS_RecipientInfo_sk_type(sk), ossl_check_CMS_RecipientInfo_type(ptr))
|
||||||
|
#define sk_CMS_RecipientInfo_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_CMS_RecipientInfo_sk_type(sk), ossl_check_CMS_RecipientInfo_type(ptr))
|
||||||
|
#define sk_CMS_RecipientInfo_pop(sk) ((CMS_RecipientInfo *)OPENSSL_sk_pop(ossl_check_CMS_RecipientInfo_sk_type(sk)))
|
||||||
|
#define sk_CMS_RecipientInfo_shift(sk) ((CMS_RecipientInfo *)OPENSSL_sk_shift(ossl_check_CMS_RecipientInfo_sk_type(sk)))
|
||||||
|
#define sk_CMS_RecipientInfo_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_CMS_RecipientInfo_sk_type(sk),ossl_check_CMS_RecipientInfo_freefunc_type(freefunc))
|
||||||
|
#define sk_CMS_RecipientInfo_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_CMS_RecipientInfo_sk_type(sk), ossl_check_CMS_RecipientInfo_type(ptr), (idx))
|
||||||
|
#define sk_CMS_RecipientInfo_set(sk, idx, ptr) ((CMS_RecipientInfo *)OPENSSL_sk_set(ossl_check_CMS_RecipientInfo_sk_type(sk), (idx), ossl_check_CMS_RecipientInfo_type(ptr)))
|
||||||
|
#define sk_CMS_RecipientInfo_find(sk, ptr) OPENSSL_sk_find(ossl_check_CMS_RecipientInfo_sk_type(sk), ossl_check_CMS_RecipientInfo_type(ptr))
|
||||||
|
#define sk_CMS_RecipientInfo_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_CMS_RecipientInfo_sk_type(sk), ossl_check_CMS_RecipientInfo_type(ptr))
|
||||||
|
#define sk_CMS_RecipientInfo_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_CMS_RecipientInfo_sk_type(sk), ossl_check_CMS_RecipientInfo_type(ptr), pnum)
|
||||||
|
#define sk_CMS_RecipientInfo_sort(sk) OPENSSL_sk_sort(ossl_check_CMS_RecipientInfo_sk_type(sk))
|
||||||
|
#define sk_CMS_RecipientInfo_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_CMS_RecipientInfo_sk_type(sk))
|
||||||
|
#define sk_CMS_RecipientInfo_dup(sk) ((STACK_OF(CMS_RecipientInfo) *)OPENSSL_sk_dup(ossl_check_const_CMS_RecipientInfo_sk_type(sk)))
|
||||||
|
#define sk_CMS_RecipientInfo_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(CMS_RecipientInfo) *)OPENSSL_sk_deep_copy(ossl_check_const_CMS_RecipientInfo_sk_type(sk), ossl_check_CMS_RecipientInfo_copyfunc_type(copyfunc), ossl_check_CMS_RecipientInfo_freefunc_type(freefunc)))
|
||||||
|
#define sk_CMS_RecipientInfo_set_cmp_func(sk, cmp) ((sk_CMS_RecipientInfo_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_CMS_RecipientInfo_sk_type(sk), ossl_check_CMS_RecipientInfo_compfunc_type(cmp)))
|
||||||
|
SKM_DEFINE_STACK_OF_INTERNAL(CMS_RevocationInfoChoice, CMS_RevocationInfoChoice, CMS_RevocationInfoChoice)
|
||||||
|
#define sk_CMS_RevocationInfoChoice_num(sk) OPENSSL_sk_num(ossl_check_const_CMS_RevocationInfoChoice_sk_type(sk))
|
||||||
|
#define sk_CMS_RevocationInfoChoice_value(sk, idx) ((CMS_RevocationInfoChoice *)OPENSSL_sk_value(ossl_check_const_CMS_RevocationInfoChoice_sk_type(sk), (idx)))
|
||||||
|
#define sk_CMS_RevocationInfoChoice_new(cmp) ((STACK_OF(CMS_RevocationInfoChoice) *)OPENSSL_sk_new(ossl_check_CMS_RevocationInfoChoice_compfunc_type(cmp)))
|
||||||
|
#define sk_CMS_RevocationInfoChoice_new_null() ((STACK_OF(CMS_RevocationInfoChoice) *)OPENSSL_sk_new_null())
|
||||||
|
#define sk_CMS_RevocationInfoChoice_new_reserve(cmp, n) ((STACK_OF(CMS_RevocationInfoChoice) *)OPENSSL_sk_new_reserve(ossl_check_CMS_RevocationInfoChoice_compfunc_type(cmp), (n)))
|
||||||
|
#define sk_CMS_RevocationInfoChoice_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_CMS_RevocationInfoChoice_sk_type(sk), (n))
|
||||||
|
#define sk_CMS_RevocationInfoChoice_free(sk) OPENSSL_sk_free(ossl_check_CMS_RevocationInfoChoice_sk_type(sk))
|
||||||
|
#define sk_CMS_RevocationInfoChoice_zero(sk) OPENSSL_sk_zero(ossl_check_CMS_RevocationInfoChoice_sk_type(sk))
|
||||||
|
#define sk_CMS_RevocationInfoChoice_delete(sk, i) ((CMS_RevocationInfoChoice *)OPENSSL_sk_delete(ossl_check_CMS_RevocationInfoChoice_sk_type(sk), (i)))
|
||||||
|
#define sk_CMS_RevocationInfoChoice_delete_ptr(sk, ptr) ((CMS_RevocationInfoChoice *)OPENSSL_sk_delete_ptr(ossl_check_CMS_RevocationInfoChoice_sk_type(sk), ossl_check_CMS_RevocationInfoChoice_type(ptr)))
|
||||||
|
#define sk_CMS_RevocationInfoChoice_push(sk, ptr) OPENSSL_sk_push(ossl_check_CMS_RevocationInfoChoice_sk_type(sk), ossl_check_CMS_RevocationInfoChoice_type(ptr))
|
||||||
|
#define sk_CMS_RevocationInfoChoice_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_CMS_RevocationInfoChoice_sk_type(sk), ossl_check_CMS_RevocationInfoChoice_type(ptr))
|
||||||
|
#define sk_CMS_RevocationInfoChoice_pop(sk) ((CMS_RevocationInfoChoice *)OPENSSL_sk_pop(ossl_check_CMS_RevocationInfoChoice_sk_type(sk)))
|
||||||
|
#define sk_CMS_RevocationInfoChoice_shift(sk) ((CMS_RevocationInfoChoice *)OPENSSL_sk_shift(ossl_check_CMS_RevocationInfoChoice_sk_type(sk)))
|
||||||
|
#define sk_CMS_RevocationInfoChoice_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_CMS_RevocationInfoChoice_sk_type(sk),ossl_check_CMS_RevocationInfoChoice_freefunc_type(freefunc))
|
||||||
|
#define sk_CMS_RevocationInfoChoice_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_CMS_RevocationInfoChoice_sk_type(sk), ossl_check_CMS_RevocationInfoChoice_type(ptr), (idx))
|
||||||
|
#define sk_CMS_RevocationInfoChoice_set(sk, idx, ptr) ((CMS_RevocationInfoChoice *)OPENSSL_sk_set(ossl_check_CMS_RevocationInfoChoice_sk_type(sk), (idx), ossl_check_CMS_RevocationInfoChoice_type(ptr)))
|
||||||
|
#define sk_CMS_RevocationInfoChoice_find(sk, ptr) OPENSSL_sk_find(ossl_check_CMS_RevocationInfoChoice_sk_type(sk), ossl_check_CMS_RevocationInfoChoice_type(ptr))
|
||||||
|
#define sk_CMS_RevocationInfoChoice_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_CMS_RevocationInfoChoice_sk_type(sk), ossl_check_CMS_RevocationInfoChoice_type(ptr))
|
||||||
|
#define sk_CMS_RevocationInfoChoice_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_CMS_RevocationInfoChoice_sk_type(sk), ossl_check_CMS_RevocationInfoChoice_type(ptr), pnum)
|
||||||
|
#define sk_CMS_RevocationInfoChoice_sort(sk) OPENSSL_sk_sort(ossl_check_CMS_RevocationInfoChoice_sk_type(sk))
|
||||||
|
#define sk_CMS_RevocationInfoChoice_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_CMS_RevocationInfoChoice_sk_type(sk))
|
||||||
|
#define sk_CMS_RevocationInfoChoice_dup(sk) ((STACK_OF(CMS_RevocationInfoChoice) *)OPENSSL_sk_dup(ossl_check_const_CMS_RevocationInfoChoice_sk_type(sk)))
|
||||||
|
#define sk_CMS_RevocationInfoChoice_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(CMS_RevocationInfoChoice) *)OPENSSL_sk_deep_copy(ossl_check_const_CMS_RevocationInfoChoice_sk_type(sk), ossl_check_CMS_RevocationInfoChoice_copyfunc_type(copyfunc), ossl_check_CMS_RevocationInfoChoice_freefunc_type(freefunc)))
|
||||||
|
#define sk_CMS_RevocationInfoChoice_set_cmp_func(sk, cmp) ((sk_CMS_RevocationInfoChoice_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_CMS_RevocationInfoChoice_sk_type(sk), ossl_check_CMS_RevocationInfoChoice_compfunc_type(cmp)))
|
||||||
|
|
||||||
|
|
||||||
|
DECLARE_ASN1_ITEM(CMS_EnvelopedData)
|
||||||
|
DECLARE_ASN1_ALLOC_FUNCTIONS(CMS_SignedData)
|
||||||
|
DECLARE_ASN1_FUNCTIONS(CMS_ContentInfo)
|
||||||
|
DECLARE_ASN1_FUNCTIONS(CMS_ReceiptRequest)
|
||||||
|
DECLARE_ASN1_PRINT_FUNCTION(CMS_ContentInfo)
|
||||||
|
|
||||||
|
DECLARE_ASN1_DUP_FUNCTION(CMS_EnvelopedData)
|
||||||
|
|
||||||
|
CMS_ContentInfo *CMS_ContentInfo_new_ex(OSSL_LIB_CTX *libctx, const char *propq);
|
||||||
|
|
||||||
|
# define CMS_SIGNERINFO_ISSUER_SERIAL 0
|
||||||
|
# define CMS_SIGNERINFO_KEYIDENTIFIER 1
|
||||||
|
|
||||||
|
# define CMS_RECIPINFO_NONE -1
|
||||||
|
# define CMS_RECIPINFO_TRANS 0
|
||||||
|
# define CMS_RECIPINFO_AGREE 1
|
||||||
|
# define CMS_RECIPINFO_KEK 2
|
||||||
|
# define CMS_RECIPINFO_PASS 3
|
||||||
|
# define CMS_RECIPINFO_OTHER 4
|
||||||
|
|
||||||
|
/* S/MIME related flags */
|
||||||
|
|
||||||
|
# define CMS_TEXT 0x1
|
||||||
|
# define CMS_NOCERTS 0x2
|
||||||
|
# define CMS_NO_CONTENT_VERIFY 0x4
|
||||||
|
# define CMS_NO_ATTR_VERIFY 0x8
|
||||||
|
# define CMS_NOSIGS \
|
||||||
|
(CMS_NO_CONTENT_VERIFY|CMS_NO_ATTR_VERIFY)
|
||||||
|
# define CMS_NOINTERN 0x10
|
||||||
|
# define CMS_NO_SIGNER_CERT_VERIFY 0x20
|
||||||
|
# define CMS_NOVERIFY 0x20
|
||||||
|
# define CMS_DETACHED 0x40
|
||||||
|
# define CMS_BINARY 0x80
|
||||||
|
# define CMS_NOATTR 0x100
|
||||||
|
# define CMS_NOSMIMECAP 0x200
|
||||||
|
# define CMS_NOOLDMIMETYPE 0x400
|
||||||
|
# define CMS_CRLFEOL 0x800
|
||||||
|
# define CMS_STREAM 0x1000
|
||||||
|
# define CMS_NOCRL 0x2000
|
||||||
|
# define CMS_PARTIAL 0x4000
|
||||||
|
# define CMS_REUSE_DIGEST 0x8000
|
||||||
|
# define CMS_USE_KEYID 0x10000
|
||||||
|
# define CMS_DEBUG_DECRYPT 0x20000
|
||||||
|
# define CMS_KEY_PARAM 0x40000
|
||||||
|
# define CMS_ASCIICRLF 0x80000
|
||||||
|
# define CMS_CADES 0x100000
|
||||||
|
# define CMS_USE_ORIGINATOR_KEYID 0x200000
|
||||||
|
# define CMS_NO_SIGNING_TIME 0x400000
|
||||||
|
|
||||||
|
const ASN1_OBJECT *CMS_get0_type(const CMS_ContentInfo *cms);
|
||||||
|
|
||||||
|
BIO *CMS_dataInit(CMS_ContentInfo *cms, BIO *icont);
|
||||||
|
int CMS_dataFinal(CMS_ContentInfo *cms, BIO *bio);
|
||||||
|
|
||||||
|
ASN1_OCTET_STRING **CMS_get0_content(CMS_ContentInfo *cms);
|
||||||
|
int CMS_is_detached(CMS_ContentInfo *cms);
|
||||||
|
int CMS_set_detached(CMS_ContentInfo *cms, int detached);
|
||||||
|
|
||||||
|
# ifdef OPENSSL_PEM_H
|
||||||
|
DECLARE_PEM_rw(CMS, CMS_ContentInfo)
|
||||||
|
# endif
|
||||||
|
int CMS_stream(unsigned char ***boundary, CMS_ContentInfo *cms);
|
||||||
|
CMS_ContentInfo *d2i_CMS_bio(BIO *bp, CMS_ContentInfo **cms);
|
||||||
|
int i2d_CMS_bio(BIO *bp, CMS_ContentInfo *cms);
|
||||||
|
|
||||||
|
BIO *BIO_new_CMS(BIO *out, CMS_ContentInfo *cms);
|
||||||
|
int i2d_CMS_bio_stream(BIO *out, CMS_ContentInfo *cms, BIO *in, int flags);
|
||||||
|
int PEM_write_bio_CMS_stream(BIO *out, CMS_ContentInfo *cms, BIO *in,
|
||||||
|
int flags);
|
||||||
|
CMS_ContentInfo *SMIME_read_CMS(BIO *bio, BIO **bcont);
|
||||||
|
CMS_ContentInfo *SMIME_read_CMS_ex(BIO *bio, int flags, BIO **bcont, CMS_ContentInfo **ci);
|
||||||
|
int SMIME_write_CMS(BIO *bio, CMS_ContentInfo *cms, BIO *data, int flags);
|
||||||
|
|
||||||
|
int CMS_final(CMS_ContentInfo *cms, BIO *data, BIO *dcont,
|
||||||
|
unsigned int flags);
|
||||||
|
int CMS_final_digest(CMS_ContentInfo *cms,
|
||||||
|
const unsigned char *md, unsigned int mdlen, BIO *dcont,
|
||||||
|
unsigned int flags);
|
||||||
|
|
||||||
|
CMS_ContentInfo *CMS_sign(X509 *signcert, EVP_PKEY *pkey,
|
||||||
|
STACK_OF(X509) *certs, BIO *data,
|
||||||
|
unsigned int flags);
|
||||||
|
CMS_ContentInfo *CMS_sign_ex(X509 *signcert, EVP_PKEY *pkey,
|
||||||
|
STACK_OF(X509) *certs, BIO *data,
|
||||||
|
unsigned int flags, OSSL_LIB_CTX *libctx,
|
||||||
|
const char *propq);
|
||||||
|
|
||||||
|
CMS_ContentInfo *CMS_sign_receipt(CMS_SignerInfo *si,
|
||||||
|
X509 *signcert, EVP_PKEY *pkey,
|
||||||
|
STACK_OF(X509) *certs, unsigned int flags);
|
||||||
|
|
||||||
|
int CMS_data(CMS_ContentInfo *cms, BIO *out, unsigned int flags);
|
||||||
|
CMS_ContentInfo *CMS_data_create(BIO *in, unsigned int flags);
|
||||||
|
CMS_ContentInfo *CMS_data_create_ex(BIO *in, unsigned int flags,
|
||||||
|
OSSL_LIB_CTX *libctx, const char *propq);
|
||||||
|
|
||||||
|
int CMS_digest_verify(CMS_ContentInfo *cms, BIO *dcont, BIO *out,
|
||||||
|
unsigned int flags);
|
||||||
|
CMS_ContentInfo *CMS_digest_create(BIO *in, const EVP_MD *md,
|
||||||
|
unsigned int flags);
|
||||||
|
CMS_ContentInfo *CMS_digest_create_ex(BIO *in, const EVP_MD *md,
|
||||||
|
unsigned int flags, OSSL_LIB_CTX *libctx,
|
||||||
|
const char *propq);
|
||||||
|
|
||||||
|
int CMS_EncryptedData_decrypt(CMS_ContentInfo *cms,
|
||||||
|
const unsigned char *key, size_t keylen,
|
||||||
|
BIO *dcont, BIO *out, unsigned int flags);
|
||||||
|
CMS_ContentInfo *CMS_EncryptedData_encrypt(BIO *in, const EVP_CIPHER *cipher,
|
||||||
|
const unsigned char *key,
|
||||||
|
size_t keylen, unsigned int flags);
|
||||||
|
CMS_ContentInfo *CMS_EncryptedData_encrypt_ex(BIO *in, const EVP_CIPHER *cipher,
|
||||||
|
const unsigned char *key,
|
||||||
|
size_t keylen, unsigned int flags,
|
||||||
|
OSSL_LIB_CTX *libctx,
|
||||||
|
const char *propq);
|
||||||
|
|
||||||
|
int CMS_EncryptedData_set1_key(CMS_ContentInfo *cms, const EVP_CIPHER *ciph,
|
||||||
|
const unsigned char *key, size_t keylen);
|
||||||
|
|
||||||
|
int CMS_verify(CMS_ContentInfo *cms, STACK_OF(X509) *certs,
|
||||||
|
X509_STORE *store, BIO *dcont, BIO *out, unsigned int flags);
|
||||||
|
|
||||||
|
int CMS_verify_receipt(CMS_ContentInfo *rcms, CMS_ContentInfo *ocms,
|
||||||
|
STACK_OF(X509) *certs,
|
||||||
|
X509_STORE *store, unsigned int flags);
|
||||||
|
|
||||||
|
STACK_OF(X509) *CMS_get0_signers(CMS_ContentInfo *cms);
|
||||||
|
|
||||||
|
CMS_ContentInfo *CMS_encrypt(STACK_OF(X509) *certs, BIO *in,
|
||||||
|
const EVP_CIPHER *cipher, unsigned int flags);
|
||||||
|
CMS_ContentInfo *CMS_encrypt_ex(STACK_OF(X509) *certs, BIO *in,
|
||||||
|
const EVP_CIPHER *cipher, unsigned int flags,
|
||||||
|
OSSL_LIB_CTX *libctx, const char *propq);
|
||||||
|
|
||||||
|
int CMS_decrypt(CMS_ContentInfo *cms, EVP_PKEY *pkey, X509 *cert,
|
||||||
|
BIO *dcont, BIO *out, unsigned int flags);
|
||||||
|
|
||||||
|
int CMS_decrypt_set1_pkey(CMS_ContentInfo *cms, EVP_PKEY *pk, X509 *cert);
|
||||||
|
int CMS_decrypt_set1_pkey_and_peer(CMS_ContentInfo *cms, EVP_PKEY *pk,
|
||||||
|
X509 *cert, X509 *peer);
|
||||||
|
int CMS_decrypt_set1_key(CMS_ContentInfo *cms,
|
||||||
|
unsigned char *key, size_t keylen,
|
||||||
|
const unsigned char *id, size_t idlen);
|
||||||
|
int CMS_decrypt_set1_password(CMS_ContentInfo *cms,
|
||||||
|
unsigned char *pass, ossl_ssize_t passlen);
|
||||||
|
|
||||||
|
STACK_OF(CMS_RecipientInfo) *CMS_get0_RecipientInfos(CMS_ContentInfo *cms);
|
||||||
|
int CMS_RecipientInfo_type(CMS_RecipientInfo *ri);
|
||||||
|
EVP_PKEY_CTX *CMS_RecipientInfo_get0_pkey_ctx(CMS_RecipientInfo *ri);
|
||||||
|
CMS_ContentInfo *CMS_AuthEnvelopedData_create(const EVP_CIPHER *cipher);
|
||||||
|
CMS_ContentInfo *
|
||||||
|
CMS_AuthEnvelopedData_create_ex(const EVP_CIPHER *cipher, OSSL_LIB_CTX *libctx,
|
||||||
|
const char *propq);
|
||||||
|
CMS_ContentInfo *CMS_EnvelopedData_create(const EVP_CIPHER *cipher);
|
||||||
|
CMS_ContentInfo *CMS_EnvelopedData_create_ex(const EVP_CIPHER *cipher,
|
||||||
|
OSSL_LIB_CTX *libctx,
|
||||||
|
const char *propq);
|
||||||
|
BIO *CMS_EnvelopedData_decrypt(CMS_EnvelopedData *env, BIO *detached_data,
|
||||||
|
EVP_PKEY *pkey, X509 *cert,
|
||||||
|
ASN1_OCTET_STRING *secret, unsigned int flags,
|
||||||
|
OSSL_LIB_CTX *libctx, const char *propq);
|
||||||
|
|
||||||
|
CMS_RecipientInfo *CMS_add1_recipient_cert(CMS_ContentInfo *cms,
|
||||||
|
X509 *recip, unsigned int flags);
|
||||||
|
CMS_RecipientInfo *CMS_add1_recipient(CMS_ContentInfo *cms, X509 *recip,
|
||||||
|
EVP_PKEY *originatorPrivKey, X509 * originator, unsigned int flags);
|
||||||
|
int CMS_RecipientInfo_set0_pkey(CMS_RecipientInfo *ri, EVP_PKEY *pkey);
|
||||||
|
int CMS_RecipientInfo_ktri_cert_cmp(CMS_RecipientInfo *ri, X509 *cert);
|
||||||
|
int CMS_RecipientInfo_ktri_get0_algs(CMS_RecipientInfo *ri,
|
||||||
|
EVP_PKEY **pk, X509 **recip,
|
||||||
|
X509_ALGOR **palg);
|
||||||
|
int CMS_RecipientInfo_ktri_get0_signer_id(CMS_RecipientInfo *ri,
|
||||||
|
ASN1_OCTET_STRING **keyid,
|
||||||
|
X509_NAME **issuer,
|
||||||
|
ASN1_INTEGER **sno);
|
||||||
|
|
||||||
|
CMS_RecipientInfo *CMS_add0_recipient_key(CMS_ContentInfo *cms, int nid,
|
||||||
|
unsigned char *key, size_t keylen,
|
||||||
|
unsigned char *id, size_t idlen,
|
||||||
|
ASN1_GENERALIZEDTIME *date,
|
||||||
|
ASN1_OBJECT *otherTypeId,
|
||||||
|
ASN1_TYPE *otherType);
|
||||||
|
|
||||||
|
int CMS_RecipientInfo_kekri_get0_id(CMS_RecipientInfo *ri,
|
||||||
|
X509_ALGOR **palg,
|
||||||
|
ASN1_OCTET_STRING **pid,
|
||||||
|
ASN1_GENERALIZEDTIME **pdate,
|
||||||
|
ASN1_OBJECT **potherid,
|
||||||
|
ASN1_TYPE **pothertype);
|
||||||
|
|
||||||
|
int CMS_RecipientInfo_set0_key(CMS_RecipientInfo *ri,
|
||||||
|
unsigned char *key, size_t keylen);
|
||||||
|
|
||||||
|
int CMS_RecipientInfo_kekri_id_cmp(CMS_RecipientInfo *ri,
|
||||||
|
const unsigned char *id, size_t idlen);
|
||||||
|
|
||||||
|
int CMS_RecipientInfo_set0_password(CMS_RecipientInfo *ri,
|
||||||
|
unsigned char *pass,
|
||||||
|
ossl_ssize_t passlen);
|
||||||
|
|
||||||
|
CMS_RecipientInfo *CMS_add0_recipient_password(CMS_ContentInfo *cms,
|
||||||
|
int iter, int wrap_nid,
|
||||||
|
int pbe_nid,
|
||||||
|
unsigned char *pass,
|
||||||
|
ossl_ssize_t passlen,
|
||||||
|
const EVP_CIPHER *kekciph);
|
||||||
|
|
||||||
|
int CMS_RecipientInfo_decrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri);
|
||||||
|
int CMS_RecipientInfo_encrypt(const CMS_ContentInfo *cms, CMS_RecipientInfo *ri);
|
||||||
|
|
||||||
|
int CMS_uncompress(CMS_ContentInfo *cms, BIO *dcont, BIO *out,
|
||||||
|
unsigned int flags);
|
||||||
|
CMS_ContentInfo *CMS_compress(BIO *in, int comp_nid, unsigned int flags);
|
||||||
|
|
||||||
|
int CMS_set1_eContentType(CMS_ContentInfo *cms, const ASN1_OBJECT *oid);
|
||||||
|
const ASN1_OBJECT *CMS_get0_eContentType(CMS_ContentInfo *cms);
|
||||||
|
|
||||||
|
CMS_CertificateChoices *CMS_add0_CertificateChoices(CMS_ContentInfo *cms);
|
||||||
|
int CMS_add0_cert(CMS_ContentInfo *cms, X509 *cert);
|
||||||
|
int CMS_add1_cert(CMS_ContentInfo *cms, X509 *cert);
|
||||||
|
STACK_OF(X509) *CMS_get1_certs(CMS_ContentInfo *cms);
|
||||||
|
|
||||||
|
CMS_RevocationInfoChoice *CMS_add0_RevocationInfoChoice(CMS_ContentInfo *cms);
|
||||||
|
int CMS_add0_crl(CMS_ContentInfo *cms, X509_CRL *crl);
|
||||||
|
int CMS_add1_crl(CMS_ContentInfo *cms, X509_CRL *crl);
|
||||||
|
STACK_OF(X509_CRL) *CMS_get1_crls(CMS_ContentInfo *cms);
|
||||||
|
|
||||||
|
int CMS_SignedData_init(CMS_ContentInfo *cms);
|
||||||
|
CMS_SignerInfo *CMS_add1_signer(CMS_ContentInfo *cms,
|
||||||
|
X509 *signer, EVP_PKEY *pk, const EVP_MD *md,
|
||||||
|
unsigned int flags);
|
||||||
|
EVP_PKEY_CTX *CMS_SignerInfo_get0_pkey_ctx(CMS_SignerInfo *si);
|
||||||
|
EVP_MD_CTX *CMS_SignerInfo_get0_md_ctx(CMS_SignerInfo *si);
|
||||||
|
STACK_OF(CMS_SignerInfo) *CMS_get0_SignerInfos(CMS_ContentInfo *cms);
|
||||||
|
|
||||||
|
void CMS_SignerInfo_set1_signer_cert(CMS_SignerInfo *si, X509 *signer);
|
||||||
|
int CMS_SignerInfo_get0_signer_id(CMS_SignerInfo *si,
|
||||||
|
ASN1_OCTET_STRING **keyid,
|
||||||
|
X509_NAME **issuer, ASN1_INTEGER **sno);
|
||||||
|
int CMS_SignerInfo_cert_cmp(CMS_SignerInfo *si, X509 *cert);
|
||||||
|
int CMS_set1_signers_certs(CMS_ContentInfo *cms, STACK_OF(X509) *certs,
|
||||||
|
unsigned int flags);
|
||||||
|
void CMS_SignerInfo_get0_algs(CMS_SignerInfo *si, EVP_PKEY **pk,
|
||||||
|
X509 **signer, X509_ALGOR **pdig,
|
||||||
|
X509_ALGOR **psig);
|
||||||
|
ASN1_OCTET_STRING *CMS_SignerInfo_get0_signature(CMS_SignerInfo *si);
|
||||||
|
int CMS_SignerInfo_sign(CMS_SignerInfo *si);
|
||||||
|
int CMS_SignerInfo_verify(CMS_SignerInfo *si);
|
||||||
|
int CMS_SignerInfo_verify_content(CMS_SignerInfo *si, BIO *chain);
|
||||||
|
BIO *CMS_SignedData_verify(CMS_SignedData *sd, BIO *detached_data,
|
||||||
|
STACK_OF(X509) *scerts, X509_STORE *store,
|
||||||
|
STACK_OF(X509) *extra, STACK_OF(X509_CRL) *crls,
|
||||||
|
unsigned int flags,
|
||||||
|
OSSL_LIB_CTX *libctx, const char *propq);
|
||||||
|
|
||||||
|
int CMS_add_smimecap(CMS_SignerInfo *si, STACK_OF(X509_ALGOR) *algs);
|
||||||
|
int CMS_add_simple_smimecap(STACK_OF(X509_ALGOR) **algs,
|
||||||
|
int algnid, int keysize);
|
||||||
|
int CMS_add_standard_smimecap(STACK_OF(X509_ALGOR) **smcap);
|
||||||
|
|
||||||
|
int CMS_signed_get_attr_count(const CMS_SignerInfo *si);
|
||||||
|
int CMS_signed_get_attr_by_NID(const CMS_SignerInfo *si, int nid,
|
||||||
|
int lastpos);
|
||||||
|
int CMS_signed_get_attr_by_OBJ(const CMS_SignerInfo *si, const ASN1_OBJECT *obj,
|
||||||
|
int lastpos);
|
||||||
|
X509_ATTRIBUTE *CMS_signed_get_attr(const CMS_SignerInfo *si, int loc);
|
||||||
|
X509_ATTRIBUTE *CMS_signed_delete_attr(CMS_SignerInfo *si, int loc);
|
||||||
|
int CMS_signed_add1_attr(CMS_SignerInfo *si, X509_ATTRIBUTE *attr);
|
||||||
|
int CMS_signed_add1_attr_by_OBJ(CMS_SignerInfo *si,
|
||||||
|
const ASN1_OBJECT *obj, int type,
|
||||||
|
const void *bytes, int len);
|
||||||
|
int CMS_signed_add1_attr_by_NID(CMS_SignerInfo *si,
|
||||||
|
int nid, int type,
|
||||||
|
const void *bytes, int len);
|
||||||
|
int CMS_signed_add1_attr_by_txt(CMS_SignerInfo *si,
|
||||||
|
const char *attrname, int type,
|
||||||
|
const void *bytes, int len);
|
||||||
|
void *CMS_signed_get0_data_by_OBJ(const CMS_SignerInfo *si,
|
||||||
|
const ASN1_OBJECT *oid,
|
||||||
|
int lastpos, int type);
|
||||||
|
|
||||||
|
int CMS_unsigned_get_attr_count(const CMS_SignerInfo *si);
|
||||||
|
int CMS_unsigned_get_attr_by_NID(const CMS_SignerInfo *si, int nid,
|
||||||
|
int lastpos);
|
||||||
|
int CMS_unsigned_get_attr_by_OBJ(const CMS_SignerInfo *si,
|
||||||
|
const ASN1_OBJECT *obj, int lastpos);
|
||||||
|
X509_ATTRIBUTE *CMS_unsigned_get_attr(const CMS_SignerInfo *si, int loc);
|
||||||
|
X509_ATTRIBUTE *CMS_unsigned_delete_attr(CMS_SignerInfo *si, int loc);
|
||||||
|
int CMS_unsigned_add1_attr(CMS_SignerInfo *si, X509_ATTRIBUTE *attr);
|
||||||
|
int CMS_unsigned_add1_attr_by_OBJ(CMS_SignerInfo *si,
|
||||||
|
const ASN1_OBJECT *obj, int type,
|
||||||
|
const void *bytes, int len);
|
||||||
|
int CMS_unsigned_add1_attr_by_NID(CMS_SignerInfo *si,
|
||||||
|
int nid, int type,
|
||||||
|
const void *bytes, int len);
|
||||||
|
int CMS_unsigned_add1_attr_by_txt(CMS_SignerInfo *si,
|
||||||
|
const char *attrname, int type,
|
||||||
|
const void *bytes, int len);
|
||||||
|
void *CMS_unsigned_get0_data_by_OBJ(CMS_SignerInfo *si, ASN1_OBJECT *oid,
|
||||||
|
int lastpos, int type);
|
||||||
|
|
||||||
|
int CMS_get1_ReceiptRequest(CMS_SignerInfo *si, CMS_ReceiptRequest **prr);
|
||||||
|
CMS_ReceiptRequest *CMS_ReceiptRequest_create0(
|
||||||
|
unsigned char *id, int idlen, int allorfirst,
|
||||||
|
STACK_OF(GENERAL_NAMES) *receiptList,
|
||||||
|
STACK_OF(GENERAL_NAMES) *receiptsTo);
|
||||||
|
CMS_ReceiptRequest *CMS_ReceiptRequest_create0_ex(
|
||||||
|
unsigned char *id, int idlen, int allorfirst,
|
||||||
|
STACK_OF(GENERAL_NAMES) *receiptList,
|
||||||
|
STACK_OF(GENERAL_NAMES) *receiptsTo,
|
||||||
|
OSSL_LIB_CTX *libctx);
|
||||||
|
|
||||||
|
int CMS_add1_ReceiptRequest(CMS_SignerInfo *si, CMS_ReceiptRequest *rr);
|
||||||
|
void CMS_ReceiptRequest_get0_values(CMS_ReceiptRequest *rr,
|
||||||
|
ASN1_STRING **pcid,
|
||||||
|
int *pallorfirst,
|
||||||
|
STACK_OF(GENERAL_NAMES) **plist,
|
||||||
|
STACK_OF(GENERAL_NAMES) **prto);
|
||||||
|
int CMS_RecipientInfo_kari_get0_alg(CMS_RecipientInfo *ri,
|
||||||
|
X509_ALGOR **palg,
|
||||||
|
ASN1_OCTET_STRING **pukm);
|
||||||
|
STACK_OF(CMS_RecipientEncryptedKey)
|
||||||
|
*CMS_RecipientInfo_kari_get0_reks(CMS_RecipientInfo *ri);
|
||||||
|
|
||||||
|
int CMS_RecipientInfo_kari_get0_orig_id(CMS_RecipientInfo *ri,
|
||||||
|
X509_ALGOR **pubalg,
|
||||||
|
ASN1_BIT_STRING **pubkey,
|
||||||
|
ASN1_OCTET_STRING **keyid,
|
||||||
|
X509_NAME **issuer,
|
||||||
|
ASN1_INTEGER **sno);
|
||||||
|
|
||||||
|
int CMS_RecipientInfo_kari_orig_id_cmp(CMS_RecipientInfo *ri, X509 *cert);
|
||||||
|
|
||||||
|
int CMS_RecipientEncryptedKey_get0_id(CMS_RecipientEncryptedKey *rek,
|
||||||
|
ASN1_OCTET_STRING **keyid,
|
||||||
|
ASN1_GENERALIZEDTIME **tm,
|
||||||
|
CMS_OtherKeyAttribute **other,
|
||||||
|
X509_NAME **issuer, ASN1_INTEGER **sno);
|
||||||
|
int CMS_RecipientEncryptedKey_cert_cmp(CMS_RecipientEncryptedKey *rek,
|
||||||
|
X509 *cert);
|
||||||
|
int CMS_RecipientInfo_kari_set0_pkey(CMS_RecipientInfo *ri, EVP_PKEY *pk);
|
||||||
|
int CMS_RecipientInfo_kari_set0_pkey_and_peer(CMS_RecipientInfo *ri, EVP_PKEY *pk, X509 *peer);
|
||||||
|
EVP_CIPHER_CTX *CMS_RecipientInfo_kari_get0_ctx(CMS_RecipientInfo *ri);
|
||||||
|
int CMS_RecipientInfo_kari_decrypt(CMS_ContentInfo *cms,
|
||||||
|
CMS_RecipientInfo *ri,
|
||||||
|
CMS_RecipientEncryptedKey *rek);
|
||||||
|
|
||||||
|
int CMS_SharedInfo_encode(unsigned char **pder, X509_ALGOR *kekalg,
|
||||||
|
ASN1_OCTET_STRING *ukm, int keylen);
|
||||||
|
|
||||||
|
/* Backward compatibility for spelling errors. */
|
||||||
|
# define CMS_R_UNKNOWN_DIGEST_ALGORITM CMS_R_UNKNOWN_DIGEST_ALGORITHM
|
||||||
|
# define CMS_R_UNSUPPORTED_RECPIENTINFO_TYPE \
|
||||||
|
CMS_R_UNSUPPORTED_RECIPIENTINFO_TYPE
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,126 @@
|
|||||||
|
/*
|
||||||
|
* Generated by util/mkerr.pl DO NOT EDIT
|
||||||
|
* Copyright 1995-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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef OPENSSL_CMSERR_H
|
||||||
|
# define OPENSSL_CMSERR_H
|
||||||
|
# pragma once
|
||||||
|
|
||||||
|
# include <openssl/opensslconf.h>
|
||||||
|
# include <openssl/symhacks.h>
|
||||||
|
# include <openssl/cryptoerr_legacy.h>
|
||||||
|
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_CMS
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* CMS reason codes.
|
||||||
|
*/
|
||||||
|
# define CMS_R_ADD_SIGNER_ERROR 99
|
||||||
|
# define CMS_R_ATTRIBUTE_ERROR 161
|
||||||
|
# define CMS_R_CERTIFICATE_ALREADY_PRESENT 175
|
||||||
|
# define CMS_R_CERTIFICATE_HAS_NO_KEYID 160
|
||||||
|
# define CMS_R_CERTIFICATE_VERIFY_ERROR 100
|
||||||
|
# define CMS_R_CIPHER_AEAD_SET_TAG_ERROR 184
|
||||||
|
# define CMS_R_CIPHER_GET_TAG 185
|
||||||
|
# define CMS_R_CIPHER_INITIALISATION_ERROR 101
|
||||||
|
# define CMS_R_CIPHER_PARAMETER_INITIALISATION_ERROR 102
|
||||||
|
# define CMS_R_CMS_DATAFINAL_ERROR 103
|
||||||
|
# define CMS_R_CMS_LIB 104
|
||||||
|
# define CMS_R_CONTENTIDENTIFIER_MISMATCH 170
|
||||||
|
# define CMS_R_CONTENT_NOT_FOUND 105
|
||||||
|
# define CMS_R_CONTENT_TYPE_MISMATCH 171
|
||||||
|
# define CMS_R_CONTENT_TYPE_NOT_COMPRESSED_DATA 106
|
||||||
|
# define CMS_R_CONTENT_TYPE_NOT_ENVELOPED_DATA 107
|
||||||
|
# define CMS_R_CONTENT_TYPE_NOT_SIGNED_DATA 108
|
||||||
|
# define CMS_R_CONTENT_VERIFY_ERROR 109
|
||||||
|
# define CMS_R_CTRL_ERROR 110
|
||||||
|
# define CMS_R_CTRL_FAILURE 111
|
||||||
|
# define CMS_R_DECODE_ERROR 187
|
||||||
|
# define CMS_R_DECRYPT_ERROR 112
|
||||||
|
# define CMS_R_ERROR_GETTING_PUBLIC_KEY 113
|
||||||
|
# define CMS_R_ERROR_READING_MESSAGEDIGEST_ATTRIBUTE 114
|
||||||
|
# define CMS_R_ERROR_SETTING_KEY 115
|
||||||
|
# define CMS_R_ERROR_SETTING_RECIPIENTINFO 116
|
||||||
|
# define CMS_R_ERROR_UNSUPPORTED_STATIC_KEY_AGREEMENT 196
|
||||||
|
# define CMS_R_ESS_SIGNING_CERTID_MISMATCH_ERROR 183
|
||||||
|
# define CMS_R_INVALID_ENCRYPTED_KEY_LENGTH 117
|
||||||
|
# define CMS_R_INVALID_KEY_ENCRYPTION_PARAMETER 176
|
||||||
|
# define CMS_R_INVALID_KEY_LENGTH 118
|
||||||
|
# define CMS_R_INVALID_LABEL 190
|
||||||
|
# define CMS_R_INVALID_OAEP_PARAMETERS 191
|
||||||
|
# define CMS_R_KDF_PARAMETER_ERROR 186
|
||||||
|
# define CMS_R_MD_BIO_INIT_ERROR 119
|
||||||
|
# define CMS_R_MESSAGEDIGEST_ATTRIBUTE_WRONG_LENGTH 120
|
||||||
|
# define CMS_R_MESSAGEDIGEST_WRONG_LENGTH 121
|
||||||
|
# define CMS_R_MSGSIGDIGEST_ERROR 172
|
||||||
|
# define CMS_R_MSGSIGDIGEST_VERIFICATION_FAILURE 162
|
||||||
|
# define CMS_R_MSGSIGDIGEST_WRONG_LENGTH 163
|
||||||
|
# define CMS_R_NEED_ONE_SIGNER 164
|
||||||
|
# define CMS_R_NOT_A_SIGNED_RECEIPT 165
|
||||||
|
# define CMS_R_NOT_ENCRYPTED_DATA 122
|
||||||
|
# define CMS_R_NOT_KEK 123
|
||||||
|
# define CMS_R_NOT_KEY_AGREEMENT 181
|
||||||
|
# define CMS_R_NOT_KEY_TRANSPORT 124
|
||||||
|
# define CMS_R_NOT_PWRI 177
|
||||||
|
# define CMS_R_NOT_SUPPORTED_FOR_THIS_KEY_TYPE 125
|
||||||
|
# define CMS_R_NO_CIPHER 126
|
||||||
|
# define CMS_R_NO_CONTENT 127
|
||||||
|
# define CMS_R_NO_CONTENT_TYPE 173
|
||||||
|
# define CMS_R_NO_DEFAULT_DIGEST 128
|
||||||
|
# define CMS_R_NO_DIGEST_SET 129
|
||||||
|
# define CMS_R_NO_KEY 130
|
||||||
|
# define CMS_R_NO_KEY_OR_CERT 174
|
||||||
|
# define CMS_R_NO_MATCHING_DIGEST 131
|
||||||
|
# define CMS_R_NO_MATCHING_RECIPIENT 132
|
||||||
|
# define CMS_R_NO_MATCHING_SIGNATURE 166
|
||||||
|
# define CMS_R_NO_MSGSIGDIGEST 167
|
||||||
|
# define CMS_R_NO_PASSWORD 178
|
||||||
|
# define CMS_R_NO_PRIVATE_KEY 133
|
||||||
|
# define CMS_R_NO_PUBLIC_KEY 134
|
||||||
|
# define CMS_R_NO_RECEIPT_REQUEST 168
|
||||||
|
# define CMS_R_NO_SIGNERS 135
|
||||||
|
# define CMS_R_OPERATION_UNSUPPORTED 182
|
||||||
|
# define CMS_R_PEER_KEY_ERROR 188
|
||||||
|
# define CMS_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE 136
|
||||||
|
# define CMS_R_RECEIPT_DECODE_ERROR 169
|
||||||
|
# define CMS_R_RECIPIENT_ERROR 137
|
||||||
|
# define CMS_R_SHARED_INFO_ERROR 189
|
||||||
|
# define CMS_R_SIGNER_CERTIFICATE_NOT_FOUND 138
|
||||||
|
# define CMS_R_SIGNFINAL_ERROR 139
|
||||||
|
# define CMS_R_SMIME_TEXT_ERROR 140
|
||||||
|
# define CMS_R_STORE_INIT_ERROR 141
|
||||||
|
# define CMS_R_TYPE_NOT_COMPRESSED_DATA 142
|
||||||
|
# define CMS_R_TYPE_NOT_DATA 143
|
||||||
|
# define CMS_R_TYPE_NOT_DIGESTED_DATA 144
|
||||||
|
# define CMS_R_TYPE_NOT_ENCRYPTED_DATA 145
|
||||||
|
# define CMS_R_TYPE_NOT_ENVELOPED_DATA 146
|
||||||
|
# define CMS_R_UNABLE_TO_FINALIZE_CONTEXT 147
|
||||||
|
# define CMS_R_UNKNOWN_CIPHER 148
|
||||||
|
# define CMS_R_UNKNOWN_DIGEST_ALGORITHM 149
|
||||||
|
# define CMS_R_UNKNOWN_ID 150
|
||||||
|
# define CMS_R_UNSUPPORTED_COMPRESSION_ALGORITHM 151
|
||||||
|
# define CMS_R_UNSUPPORTED_CONTENT_ENCRYPTION_ALGORITHM 194
|
||||||
|
# define CMS_R_UNSUPPORTED_CONTENT_TYPE 152
|
||||||
|
# define CMS_R_UNSUPPORTED_ENCRYPTION_TYPE 192
|
||||||
|
# define CMS_R_UNSUPPORTED_KEK_ALGORITHM 153
|
||||||
|
# define CMS_R_UNSUPPORTED_KEY_ENCRYPTION_ALGORITHM 179
|
||||||
|
# define CMS_R_UNSUPPORTED_LABEL_SOURCE 193
|
||||||
|
# define CMS_R_UNSUPPORTED_RECIPIENTINFO_TYPE 155
|
||||||
|
# define CMS_R_UNSUPPORTED_RECIPIENT_TYPE 154
|
||||||
|
# define CMS_R_UNSUPPORTED_SIGNATURE_ALGORITHM 195
|
||||||
|
# define CMS_R_UNSUPPORTED_TYPE 156
|
||||||
|
# define CMS_R_UNWRAP_ERROR 157
|
||||||
|
# define CMS_R_UNWRAP_FAILURE 180
|
||||||
|
# define CMS_R_VERIFICATION_FAILURE 158
|
||||||
|
# define CMS_R_WRAP_ERROR 159
|
||||||
|
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,98 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2015-2024 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef OPENSSL_COMP_H
|
||||||
|
# define OPENSSL_COMP_H
|
||||||
|
# pragma once
|
||||||
|
|
||||||
|
# include <openssl/macros.h>
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
# define HEADER_COMP_H
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# include <openssl/opensslconf.h>
|
||||||
|
|
||||||
|
# include <openssl/crypto.h>
|
||||||
|
# include <openssl/comperr.h>
|
||||||
|
# ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
# endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_COMP
|
||||||
|
|
||||||
|
COMP_CTX *COMP_CTX_new(COMP_METHOD *meth);
|
||||||
|
const COMP_METHOD *COMP_CTX_get_method(const COMP_CTX *ctx);
|
||||||
|
int COMP_CTX_get_type(const COMP_CTX* comp);
|
||||||
|
int COMP_get_type(const COMP_METHOD *meth);
|
||||||
|
const char *COMP_get_name(const COMP_METHOD *meth);
|
||||||
|
void COMP_CTX_free(COMP_CTX *ctx);
|
||||||
|
|
||||||
|
int COMP_compress_block(COMP_CTX *ctx, unsigned char *out, int olen,
|
||||||
|
unsigned char *in, int ilen);
|
||||||
|
int COMP_expand_block(COMP_CTX *ctx, unsigned char *out, int olen,
|
||||||
|
unsigned char *in, int ilen);
|
||||||
|
|
||||||
|
COMP_METHOD *COMP_zlib(void);
|
||||||
|
COMP_METHOD *COMP_zlib_oneshot(void);
|
||||||
|
COMP_METHOD *COMP_brotli(void);
|
||||||
|
COMP_METHOD *COMP_brotli_oneshot(void);
|
||||||
|
COMP_METHOD *COMP_zstd(void);
|
||||||
|
COMP_METHOD *COMP_zstd_oneshot(void);
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_1_1_0
|
||||||
|
# define COMP_zlib_cleanup() while(0) continue
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifdef OPENSSL_BIO_H
|
||||||
|
const BIO_METHOD *BIO_f_zlib(void);
|
||||||
|
const BIO_METHOD *BIO_f_brotli(void);
|
||||||
|
const BIO_METHOD *BIO_f_zstd(void);
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# endif
|
||||||
|
|
||||||
|
typedef struct ssl_comp_st SSL_COMP;
|
||||||
|
|
||||||
|
SKM_DEFINE_STACK_OF_INTERNAL(SSL_COMP, SSL_COMP, SSL_COMP)
|
||||||
|
#define sk_SSL_COMP_num(sk) OPENSSL_sk_num(ossl_check_const_SSL_COMP_sk_type(sk))
|
||||||
|
#define sk_SSL_COMP_value(sk, idx) ((SSL_COMP *)OPENSSL_sk_value(ossl_check_const_SSL_COMP_sk_type(sk), (idx)))
|
||||||
|
#define sk_SSL_COMP_new(cmp) ((STACK_OF(SSL_COMP) *)OPENSSL_sk_new(ossl_check_SSL_COMP_compfunc_type(cmp)))
|
||||||
|
#define sk_SSL_COMP_new_null() ((STACK_OF(SSL_COMP) *)OPENSSL_sk_new_null())
|
||||||
|
#define sk_SSL_COMP_new_reserve(cmp, n) ((STACK_OF(SSL_COMP) *)OPENSSL_sk_new_reserve(ossl_check_SSL_COMP_compfunc_type(cmp), (n)))
|
||||||
|
#define sk_SSL_COMP_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_SSL_COMP_sk_type(sk), (n))
|
||||||
|
#define sk_SSL_COMP_free(sk) OPENSSL_sk_free(ossl_check_SSL_COMP_sk_type(sk))
|
||||||
|
#define sk_SSL_COMP_zero(sk) OPENSSL_sk_zero(ossl_check_SSL_COMP_sk_type(sk))
|
||||||
|
#define sk_SSL_COMP_delete(sk, i) ((SSL_COMP *)OPENSSL_sk_delete(ossl_check_SSL_COMP_sk_type(sk), (i)))
|
||||||
|
#define sk_SSL_COMP_delete_ptr(sk, ptr) ((SSL_COMP *)OPENSSL_sk_delete_ptr(ossl_check_SSL_COMP_sk_type(sk), ossl_check_SSL_COMP_type(ptr)))
|
||||||
|
#define sk_SSL_COMP_push(sk, ptr) OPENSSL_sk_push(ossl_check_SSL_COMP_sk_type(sk), ossl_check_SSL_COMP_type(ptr))
|
||||||
|
#define sk_SSL_COMP_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_SSL_COMP_sk_type(sk), ossl_check_SSL_COMP_type(ptr))
|
||||||
|
#define sk_SSL_COMP_pop(sk) ((SSL_COMP *)OPENSSL_sk_pop(ossl_check_SSL_COMP_sk_type(sk)))
|
||||||
|
#define sk_SSL_COMP_shift(sk) ((SSL_COMP *)OPENSSL_sk_shift(ossl_check_SSL_COMP_sk_type(sk)))
|
||||||
|
#define sk_SSL_COMP_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_SSL_COMP_sk_type(sk),ossl_check_SSL_COMP_freefunc_type(freefunc))
|
||||||
|
#define sk_SSL_COMP_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_SSL_COMP_sk_type(sk), ossl_check_SSL_COMP_type(ptr), (idx))
|
||||||
|
#define sk_SSL_COMP_set(sk, idx, ptr) ((SSL_COMP *)OPENSSL_sk_set(ossl_check_SSL_COMP_sk_type(sk), (idx), ossl_check_SSL_COMP_type(ptr)))
|
||||||
|
#define sk_SSL_COMP_find(sk, ptr) OPENSSL_sk_find(ossl_check_SSL_COMP_sk_type(sk), ossl_check_SSL_COMP_type(ptr))
|
||||||
|
#define sk_SSL_COMP_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_SSL_COMP_sk_type(sk), ossl_check_SSL_COMP_type(ptr))
|
||||||
|
#define sk_SSL_COMP_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_SSL_COMP_sk_type(sk), ossl_check_SSL_COMP_type(ptr), pnum)
|
||||||
|
#define sk_SSL_COMP_sort(sk) OPENSSL_sk_sort(ossl_check_SSL_COMP_sk_type(sk))
|
||||||
|
#define sk_SSL_COMP_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_SSL_COMP_sk_type(sk))
|
||||||
|
#define sk_SSL_COMP_dup(sk) ((STACK_OF(SSL_COMP) *)OPENSSL_sk_dup(ossl_check_const_SSL_COMP_sk_type(sk)))
|
||||||
|
#define sk_SSL_COMP_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(SSL_COMP) *)OPENSSL_sk_deep_copy(ossl_check_const_SSL_COMP_sk_type(sk), ossl_check_SSL_COMP_copyfunc_type(copyfunc), ossl_check_SSL_COMP_freefunc_type(freefunc)))
|
||||||
|
#define sk_SSL_COMP_set_cmp_func(sk, cmp) ((sk_SSL_COMP_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_SSL_COMP_sk_type(sk), ossl_check_SSL_COMP_compfunc_type(cmp)))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* Generated by util/mkerr.pl DO NOT EDIT
|
||||||
|
* Copyright 1995-2021 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef OPENSSL_COMPERR_H
|
||||||
|
# define OPENSSL_COMPERR_H
|
||||||
|
# pragma once
|
||||||
|
|
||||||
|
# include <openssl/opensslconf.h>
|
||||||
|
# include <openssl/symhacks.h>
|
||||||
|
# include <openssl/cryptoerr_legacy.h>
|
||||||
|
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_COMP
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* COMP reason codes.
|
||||||
|
*/
|
||||||
|
# define COMP_R_BROTLI_DECODE_ERROR 102
|
||||||
|
# define COMP_R_BROTLI_ENCODE_ERROR 103
|
||||||
|
# define COMP_R_BROTLI_NOT_SUPPORTED 104
|
||||||
|
# define COMP_R_ZLIB_DEFLATE_ERROR 99
|
||||||
|
# define COMP_R_ZLIB_INFLATE_ERROR 100
|
||||||
|
# define COMP_R_ZLIB_NOT_SUPPORTED 101
|
||||||
|
# define COMP_R_ZSTD_COMPRESS_ERROR 105
|
||||||
|
# define COMP_R_ZSTD_DECODE_ERROR 106
|
||||||
|
# define COMP_R_ZSTD_DECOMPRESS_ERROR 107
|
||||||
|
# define COMP_R_ZSTD_NOT_SUPPORTED 108
|
||||||
|
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,214 @@
|
|||||||
|
/*
|
||||||
|
* WARNING: do not edit!
|
||||||
|
* Generated by Makefile from ../../openssl-3.5.0/include/openssl/conf.h.in
|
||||||
|
*
|
||||||
|
* Copyright 1995-2021 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef OPENSSL_CONF_H
|
||||||
|
# define OPENSSL_CONF_H
|
||||||
|
# pragma once
|
||||||
|
|
||||||
|
# include <openssl/macros.h>
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
# define HEADER_CONF_H
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# include <openssl/bio.h>
|
||||||
|
# include <openssl/lhash.h>
|
||||||
|
# include <openssl/safestack.h>
|
||||||
|
# include <openssl/e_os2.h>
|
||||||
|
# include <openssl/types.h>
|
||||||
|
# include <openssl/conferr.h>
|
||||||
|
# ifndef OPENSSL_NO_STDIO
|
||||||
|
# include <stdio.h>
|
||||||
|
# endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
char *section;
|
||||||
|
char *name;
|
||||||
|
char *value;
|
||||||
|
} CONF_VALUE;
|
||||||
|
|
||||||
|
SKM_DEFINE_STACK_OF_INTERNAL(CONF_VALUE, CONF_VALUE, CONF_VALUE)
|
||||||
|
#define sk_CONF_VALUE_num(sk) OPENSSL_sk_num(ossl_check_const_CONF_VALUE_sk_type(sk))
|
||||||
|
#define sk_CONF_VALUE_value(sk, idx) ((CONF_VALUE *)OPENSSL_sk_value(ossl_check_const_CONF_VALUE_sk_type(sk), (idx)))
|
||||||
|
#define sk_CONF_VALUE_new(cmp) ((STACK_OF(CONF_VALUE) *)OPENSSL_sk_new(ossl_check_CONF_VALUE_compfunc_type(cmp)))
|
||||||
|
#define sk_CONF_VALUE_new_null() ((STACK_OF(CONF_VALUE) *)OPENSSL_sk_new_null())
|
||||||
|
#define sk_CONF_VALUE_new_reserve(cmp, n) ((STACK_OF(CONF_VALUE) *)OPENSSL_sk_new_reserve(ossl_check_CONF_VALUE_compfunc_type(cmp), (n)))
|
||||||
|
#define sk_CONF_VALUE_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_CONF_VALUE_sk_type(sk), (n))
|
||||||
|
#define sk_CONF_VALUE_free(sk) OPENSSL_sk_free(ossl_check_CONF_VALUE_sk_type(sk))
|
||||||
|
#define sk_CONF_VALUE_zero(sk) OPENSSL_sk_zero(ossl_check_CONF_VALUE_sk_type(sk))
|
||||||
|
#define sk_CONF_VALUE_delete(sk, i) ((CONF_VALUE *)OPENSSL_sk_delete(ossl_check_CONF_VALUE_sk_type(sk), (i)))
|
||||||
|
#define sk_CONF_VALUE_delete_ptr(sk, ptr) ((CONF_VALUE *)OPENSSL_sk_delete_ptr(ossl_check_CONF_VALUE_sk_type(sk), ossl_check_CONF_VALUE_type(ptr)))
|
||||||
|
#define sk_CONF_VALUE_push(sk, ptr) OPENSSL_sk_push(ossl_check_CONF_VALUE_sk_type(sk), ossl_check_CONF_VALUE_type(ptr))
|
||||||
|
#define sk_CONF_VALUE_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_CONF_VALUE_sk_type(sk), ossl_check_CONF_VALUE_type(ptr))
|
||||||
|
#define sk_CONF_VALUE_pop(sk) ((CONF_VALUE *)OPENSSL_sk_pop(ossl_check_CONF_VALUE_sk_type(sk)))
|
||||||
|
#define sk_CONF_VALUE_shift(sk) ((CONF_VALUE *)OPENSSL_sk_shift(ossl_check_CONF_VALUE_sk_type(sk)))
|
||||||
|
#define sk_CONF_VALUE_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_CONF_VALUE_sk_type(sk),ossl_check_CONF_VALUE_freefunc_type(freefunc))
|
||||||
|
#define sk_CONF_VALUE_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_CONF_VALUE_sk_type(sk), ossl_check_CONF_VALUE_type(ptr), (idx))
|
||||||
|
#define sk_CONF_VALUE_set(sk, idx, ptr) ((CONF_VALUE *)OPENSSL_sk_set(ossl_check_CONF_VALUE_sk_type(sk), (idx), ossl_check_CONF_VALUE_type(ptr)))
|
||||||
|
#define sk_CONF_VALUE_find(sk, ptr) OPENSSL_sk_find(ossl_check_CONF_VALUE_sk_type(sk), ossl_check_CONF_VALUE_type(ptr))
|
||||||
|
#define sk_CONF_VALUE_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_CONF_VALUE_sk_type(sk), ossl_check_CONF_VALUE_type(ptr))
|
||||||
|
#define sk_CONF_VALUE_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_CONF_VALUE_sk_type(sk), ossl_check_CONF_VALUE_type(ptr), pnum)
|
||||||
|
#define sk_CONF_VALUE_sort(sk) OPENSSL_sk_sort(ossl_check_CONF_VALUE_sk_type(sk))
|
||||||
|
#define sk_CONF_VALUE_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_CONF_VALUE_sk_type(sk))
|
||||||
|
#define sk_CONF_VALUE_dup(sk) ((STACK_OF(CONF_VALUE) *)OPENSSL_sk_dup(ossl_check_const_CONF_VALUE_sk_type(sk)))
|
||||||
|
#define sk_CONF_VALUE_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(CONF_VALUE) *)OPENSSL_sk_deep_copy(ossl_check_const_CONF_VALUE_sk_type(sk), ossl_check_CONF_VALUE_copyfunc_type(copyfunc), ossl_check_CONF_VALUE_freefunc_type(freefunc)))
|
||||||
|
#define sk_CONF_VALUE_set_cmp_func(sk, cmp) ((sk_CONF_VALUE_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_CONF_VALUE_sk_type(sk), ossl_check_CONF_VALUE_compfunc_type(cmp)))
|
||||||
|
DEFINE_LHASH_OF_INTERNAL(CONF_VALUE);
|
||||||
|
#define lh_CONF_VALUE_new(hfn, cmp) ((LHASH_OF(CONF_VALUE) *)OPENSSL_LH_set_thunks(OPENSSL_LH_new(ossl_check_CONF_VALUE_lh_hashfunc_type(hfn), ossl_check_CONF_VALUE_lh_compfunc_type(cmp)), lh_CONF_VALUE_hash_thunk, lh_CONF_VALUE_comp_thunk, lh_CONF_VALUE_doall_thunk, lh_CONF_VALUE_doall_arg_thunk))
|
||||||
|
#define lh_CONF_VALUE_free(lh) OPENSSL_LH_free(ossl_check_CONF_VALUE_lh_type(lh))
|
||||||
|
#define lh_CONF_VALUE_flush(lh) OPENSSL_LH_flush(ossl_check_CONF_VALUE_lh_type(lh))
|
||||||
|
#define lh_CONF_VALUE_insert(lh, ptr) ((CONF_VALUE *)OPENSSL_LH_insert(ossl_check_CONF_VALUE_lh_type(lh), ossl_check_CONF_VALUE_lh_plain_type(ptr)))
|
||||||
|
#define lh_CONF_VALUE_delete(lh, ptr) ((CONF_VALUE *)OPENSSL_LH_delete(ossl_check_CONF_VALUE_lh_type(lh), ossl_check_const_CONF_VALUE_lh_plain_type(ptr)))
|
||||||
|
#define lh_CONF_VALUE_retrieve(lh, ptr) ((CONF_VALUE *)OPENSSL_LH_retrieve(ossl_check_CONF_VALUE_lh_type(lh), ossl_check_const_CONF_VALUE_lh_plain_type(ptr)))
|
||||||
|
#define lh_CONF_VALUE_error(lh) OPENSSL_LH_error(ossl_check_CONF_VALUE_lh_type(lh))
|
||||||
|
#define lh_CONF_VALUE_num_items(lh) OPENSSL_LH_num_items(ossl_check_CONF_VALUE_lh_type(lh))
|
||||||
|
#define lh_CONF_VALUE_node_stats_bio(lh, out) OPENSSL_LH_node_stats_bio(ossl_check_const_CONF_VALUE_lh_type(lh), out)
|
||||||
|
#define lh_CONF_VALUE_node_usage_stats_bio(lh, out) OPENSSL_LH_node_usage_stats_bio(ossl_check_const_CONF_VALUE_lh_type(lh), out)
|
||||||
|
#define lh_CONF_VALUE_stats_bio(lh, out) OPENSSL_LH_stats_bio(ossl_check_const_CONF_VALUE_lh_type(lh), out)
|
||||||
|
#define lh_CONF_VALUE_get_down_load(lh) OPENSSL_LH_get_down_load(ossl_check_CONF_VALUE_lh_type(lh))
|
||||||
|
#define lh_CONF_VALUE_set_down_load(lh, dl) OPENSSL_LH_set_down_load(ossl_check_CONF_VALUE_lh_type(lh), dl)
|
||||||
|
#define lh_CONF_VALUE_doall(lh, dfn) OPENSSL_LH_doall(ossl_check_CONF_VALUE_lh_type(lh), ossl_check_CONF_VALUE_lh_doallfunc_type(dfn))
|
||||||
|
|
||||||
|
|
||||||
|
struct conf_st;
|
||||||
|
struct conf_method_st;
|
||||||
|
typedef struct conf_method_st CONF_METHOD;
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
# include <openssl/conftypes.h>
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/* Module definitions */
|
||||||
|
typedef struct conf_imodule_st CONF_IMODULE;
|
||||||
|
typedef struct conf_module_st CONF_MODULE;
|
||||||
|
|
||||||
|
STACK_OF(CONF_MODULE);
|
||||||
|
STACK_OF(CONF_IMODULE);
|
||||||
|
|
||||||
|
/* DSO module function typedefs */
|
||||||
|
typedef int conf_init_func (CONF_IMODULE *md, const CONF *cnf);
|
||||||
|
typedef void conf_finish_func (CONF_IMODULE *md);
|
||||||
|
|
||||||
|
# define CONF_MFLAGS_IGNORE_ERRORS 0x1
|
||||||
|
# define CONF_MFLAGS_IGNORE_RETURN_CODES 0x2
|
||||||
|
# define CONF_MFLAGS_SILENT 0x4
|
||||||
|
# define CONF_MFLAGS_NO_DSO 0x8
|
||||||
|
# define CONF_MFLAGS_IGNORE_MISSING_FILE 0x10
|
||||||
|
# define CONF_MFLAGS_DEFAULT_SECTION 0x20
|
||||||
|
|
||||||
|
int CONF_set_default_method(CONF_METHOD *meth);
|
||||||
|
void CONF_set_nconf(CONF *conf, LHASH_OF(CONF_VALUE) *hash);
|
||||||
|
LHASH_OF(CONF_VALUE) *CONF_load(LHASH_OF(CONF_VALUE) *conf, const char *file,
|
||||||
|
long *eline);
|
||||||
|
# ifndef OPENSSL_NO_STDIO
|
||||||
|
LHASH_OF(CONF_VALUE) *CONF_load_fp(LHASH_OF(CONF_VALUE) *conf, FILE *fp,
|
||||||
|
long *eline);
|
||||||
|
# endif
|
||||||
|
LHASH_OF(CONF_VALUE) *CONF_load_bio(LHASH_OF(CONF_VALUE) *conf, BIO *bp,
|
||||||
|
long *eline);
|
||||||
|
STACK_OF(CONF_VALUE) *CONF_get_section(LHASH_OF(CONF_VALUE) *conf,
|
||||||
|
const char *section);
|
||||||
|
char *CONF_get_string(LHASH_OF(CONF_VALUE) *conf, const char *group,
|
||||||
|
const char *name);
|
||||||
|
long CONF_get_number(LHASH_OF(CONF_VALUE) *conf, const char *group,
|
||||||
|
const char *name);
|
||||||
|
void CONF_free(LHASH_OF(CONF_VALUE) *conf);
|
||||||
|
#ifndef OPENSSL_NO_STDIO
|
||||||
|
int CONF_dump_fp(LHASH_OF(CONF_VALUE) *conf, FILE *out);
|
||||||
|
#endif
|
||||||
|
int CONF_dump_bio(LHASH_OF(CONF_VALUE) *conf, BIO *out);
|
||||||
|
#ifndef OPENSSL_NO_DEPRECATED_1_1_0
|
||||||
|
OSSL_DEPRECATEDIN_1_1_0 void OPENSSL_config(const char *config_name);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef OPENSSL_NO_DEPRECATED_1_1_0
|
||||||
|
# define OPENSSL_no_config() \
|
||||||
|
OPENSSL_init_crypto(OPENSSL_INIT_NO_LOAD_CONFIG, NULL)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* New conf code. The semantics are different from the functions above. If
|
||||||
|
* that wasn't the case, the above functions would have been replaced
|
||||||
|
*/
|
||||||
|
|
||||||
|
CONF *NCONF_new_ex(OSSL_LIB_CTX *libctx, CONF_METHOD *meth);
|
||||||
|
OSSL_LIB_CTX *NCONF_get0_libctx(const CONF *conf);
|
||||||
|
CONF *NCONF_new(CONF_METHOD *meth);
|
||||||
|
CONF_METHOD *NCONF_default(void);
|
||||||
|
#ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
OSSL_DEPRECATEDIN_3_0 CONF_METHOD *NCONF_WIN32(void);
|
||||||
|
#endif
|
||||||
|
void NCONF_free(CONF *conf);
|
||||||
|
void NCONF_free_data(CONF *conf);
|
||||||
|
|
||||||
|
int NCONF_load(CONF *conf, const char *file, long *eline);
|
||||||
|
# ifndef OPENSSL_NO_STDIO
|
||||||
|
int NCONF_load_fp(CONF *conf, FILE *fp, long *eline);
|
||||||
|
# endif
|
||||||
|
int NCONF_load_bio(CONF *conf, BIO *bp, long *eline);
|
||||||
|
STACK_OF(OPENSSL_CSTRING) *NCONF_get_section_names(const CONF *conf);
|
||||||
|
STACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf,
|
||||||
|
const char *section);
|
||||||
|
char *NCONF_get_string(const CONF *conf, const char *group, const char *name);
|
||||||
|
int NCONF_get_number_e(const CONF *conf, const char *group, const char *name,
|
||||||
|
long *result);
|
||||||
|
#ifndef OPENSSL_NO_STDIO
|
||||||
|
int NCONF_dump_fp(const CONF *conf, FILE *out);
|
||||||
|
#endif
|
||||||
|
int NCONF_dump_bio(const CONF *conf, BIO *out);
|
||||||
|
|
||||||
|
#define NCONF_get_number(c,g,n,r) NCONF_get_number_e(c,g,n,r)
|
||||||
|
|
||||||
|
/* Module functions */
|
||||||
|
|
||||||
|
int CONF_modules_load(const CONF *cnf, const char *appname,
|
||||||
|
unsigned long flags);
|
||||||
|
int CONF_modules_load_file_ex(OSSL_LIB_CTX *libctx, const char *filename,
|
||||||
|
const char *appname, unsigned long flags);
|
||||||
|
int CONF_modules_load_file(const char *filename, const char *appname,
|
||||||
|
unsigned long flags);
|
||||||
|
void CONF_modules_unload(int all);
|
||||||
|
void CONF_modules_finish(void);
|
||||||
|
#ifndef OPENSSL_NO_DEPRECATED_1_1_0
|
||||||
|
# define CONF_modules_free() while(0) continue
|
||||||
|
#endif
|
||||||
|
int CONF_module_add(const char *name, conf_init_func *ifunc,
|
||||||
|
conf_finish_func *ffunc);
|
||||||
|
|
||||||
|
const char *CONF_imodule_get_name(const CONF_IMODULE *md);
|
||||||
|
const char *CONF_imodule_get_value(const CONF_IMODULE *md);
|
||||||
|
void *CONF_imodule_get_usr_data(const CONF_IMODULE *md);
|
||||||
|
void CONF_imodule_set_usr_data(CONF_IMODULE *md, void *usr_data);
|
||||||
|
CONF_MODULE *CONF_imodule_get_module(const CONF_IMODULE *md);
|
||||||
|
unsigned long CONF_imodule_get_flags(const CONF_IMODULE *md);
|
||||||
|
void CONF_imodule_set_flags(CONF_IMODULE *md, unsigned long flags);
|
||||||
|
void *CONF_module_get_usr_data(CONF_MODULE *pmod);
|
||||||
|
void CONF_module_set_usr_data(CONF_MODULE *pmod, void *usr_data);
|
||||||
|
|
||||||
|
char *CONF_get1_default_config_file(void);
|
||||||
|
|
||||||
|
int CONF_parse_list(const char *list, int sep, int nospc,
|
||||||
|
int (*list_cb) (const char *elem, int len, void *usr),
|
||||||
|
void *arg);
|
||||||
|
|
||||||
|
void OPENSSL_load_builtin_modules(void);
|
||||||
|
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 1995-2016 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef OPENSSL_CONF_API_H
|
||||||
|
# define OPENSSL_CONF_API_H
|
||||||
|
# pragma once
|
||||||
|
|
||||||
|
# include <openssl/macros.h>
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
# define HEADER_CONF_API_H
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# include <openssl/lhash.h>
|
||||||
|
# include <openssl/conf.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Up until OpenSSL 0.9.5a, this was new_section */
|
||||||
|
CONF_VALUE *_CONF_new_section(CONF *conf, const char *section);
|
||||||
|
/* Up until OpenSSL 0.9.5a, this was get_section */
|
||||||
|
CONF_VALUE *_CONF_get_section(const CONF *conf, const char *section);
|
||||||
|
/* Up until OpenSSL 0.9.5a, this was CONF_get_section */
|
||||||
|
STACK_OF(CONF_VALUE) *_CONF_get_section_values(const CONF *conf,
|
||||||
|
const char *section);
|
||||||
|
|
||||||
|
int _CONF_add_string(CONF *conf, CONF_VALUE *section, CONF_VALUE *value);
|
||||||
|
char *_CONF_get_string(const CONF *conf, const char *section,
|
||||||
|
const char *name);
|
||||||
|
long _CONF_get_number(const CONF *conf, const char *section,
|
||||||
|
const char *name);
|
||||||
|
|
||||||
|
int _CONF_new_data(CONF *conf);
|
||||||
|
void _CONF_free_data(CONF *conf);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
* Generated by util/mkerr.pl DO NOT EDIT
|
||||||
|
* Copyright 1995-2023 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef OPENSSL_CONFERR_H
|
||||||
|
# define OPENSSL_CONFERR_H
|
||||||
|
# pragma once
|
||||||
|
|
||||||
|
# include <openssl/opensslconf.h>
|
||||||
|
# include <openssl/symhacks.h>
|
||||||
|
# include <openssl/cryptoerr_legacy.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* CONF reason codes.
|
||||||
|
*/
|
||||||
|
# define CONF_R_ERROR_LOADING_DSO 110
|
||||||
|
# define CONF_R_INVALID_PRAGMA 122
|
||||||
|
# define CONF_R_LIST_CANNOT_BE_NULL 115
|
||||||
|
# define CONF_R_MANDATORY_BRACES_IN_VARIABLE_EXPANSION 123
|
||||||
|
# define CONF_R_MISSING_CLOSE_SQUARE_BRACKET 100
|
||||||
|
# define CONF_R_MISSING_EQUAL_SIGN 101
|
||||||
|
# define CONF_R_MISSING_INIT_FUNCTION 112
|
||||||
|
# define CONF_R_MODULE_INITIALIZATION_ERROR 109
|
||||||
|
# define CONF_R_NO_CLOSE_BRACE 102
|
||||||
|
# define CONF_R_NO_CONF 105
|
||||||
|
# define CONF_R_NO_CONF_OR_ENVIRONMENT_VARIABLE 106
|
||||||
|
# define CONF_R_NO_SECTION 107
|
||||||
|
# define CONF_R_NO_SUCH_FILE 114
|
||||||
|
# define CONF_R_NO_VALUE 108
|
||||||
|
# define CONF_R_NUMBER_TOO_LARGE 121
|
||||||
|
# define CONF_R_OPENSSL_CONF_REFERENCES_MISSING_SECTION 124
|
||||||
|
# define CONF_R_RECURSIVE_DIRECTORY_INCLUDE 111
|
||||||
|
# define CONF_R_RECURSIVE_SECTION_REFERENCE 126
|
||||||
|
# define CONF_R_RELATIVE_PATH 125
|
||||||
|
# define CONF_R_SSL_COMMAND_SECTION_EMPTY 117
|
||||||
|
# define CONF_R_SSL_COMMAND_SECTION_NOT_FOUND 118
|
||||||
|
# define CONF_R_SSL_SECTION_EMPTY 119
|
||||||
|
# define CONF_R_SSL_SECTION_NOT_FOUND 120
|
||||||
|
# define CONF_R_UNABLE_TO_CREATE_NEW_SECTION 103
|
||||||
|
# define CONF_R_UNKNOWN_MODULE_NAME 113
|
||||||
|
# define CONF_R_VARIABLE_EXPANSION_TOO_LONG 116
|
||||||
|
# define CONF_R_VARIABLE_HAS_NO_VALUE 104
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,215 @@
|
|||||||
|
/*
|
||||||
|
* WARNING: do not edit!
|
||||||
|
* Generated by configdata.pm from ../../openssl-3.5.0/Configurations/common0.tmpl, ../../openssl-3.5.0/Configurations/unix-Makefile.tmpl
|
||||||
|
* via Makefile.in
|
||||||
|
*
|
||||||
|
* Copyright 2016-2021 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef OPENSSL_CONFIGURATION_H
|
||||||
|
# define OPENSSL_CONFIGURATION_H
|
||||||
|
# pragma once
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifdef OPENSSL_ALGORITHM_DEFINES
|
||||||
|
# error OPENSSL_ALGORITHM_DEFINES no longer supported
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* OpenSSL was configured with the following options:
|
||||||
|
*/
|
||||||
|
|
||||||
|
# define OPENSSL_CONFIGURED_API 30500
|
||||||
|
# ifndef OPENSSL_RAND_SEED_OS
|
||||||
|
# define OPENSSL_RAND_SEED_OS
|
||||||
|
# endif
|
||||||
|
# ifndef OPENSSL_THREADS
|
||||||
|
# define OPENSSL_THREADS
|
||||||
|
# endif
|
||||||
|
# ifndef OPENSSL_NO_ACVP_TESTS
|
||||||
|
# define OPENSSL_NO_ACVP_TESTS
|
||||||
|
# endif
|
||||||
|
# ifndef OPENSSL_NO_AFALGENG
|
||||||
|
# define OPENSSL_NO_AFALGENG
|
||||||
|
# endif
|
||||||
|
# ifndef OPENSSL_NO_APPS
|
||||||
|
# define OPENSSL_NO_APPS
|
||||||
|
# endif
|
||||||
|
# ifndef OPENSSL_NO_ASAN
|
||||||
|
# define OPENSSL_NO_ASAN
|
||||||
|
# endif
|
||||||
|
# ifndef OPENSSL_NO_BROTLI
|
||||||
|
# define OPENSSL_NO_BROTLI
|
||||||
|
# endif
|
||||||
|
# ifndef OPENSSL_NO_BROTLI_DYNAMIC
|
||||||
|
# define OPENSSL_NO_BROTLI_DYNAMIC
|
||||||
|
# endif
|
||||||
|
# ifndef OPENSSL_NO_CAPIENG
|
||||||
|
# define OPENSSL_NO_CAPIENG
|
||||||
|
# endif
|
||||||
|
# ifndef OPENSSL_NO_COMP
|
||||||
|
# define OPENSSL_NO_COMP
|
||||||
|
# endif
|
||||||
|
# ifndef OPENSSL_NO_CRYPTO_MDEBUG
|
||||||
|
# define OPENSSL_NO_CRYPTO_MDEBUG
|
||||||
|
# endif
|
||||||
|
# ifndef OPENSSL_NO_CRYPTO_MDEBUG_BACKTRACE
|
||||||
|
# define OPENSSL_NO_CRYPTO_MDEBUG_BACKTRACE
|
||||||
|
# endif
|
||||||
|
# ifndef OPENSSL_NO_DEMOS
|
||||||
|
# define OPENSSL_NO_DEMOS
|
||||||
|
# endif
|
||||||
|
# ifndef OPENSSL_NO_DEVCRYPTOENG
|
||||||
|
# define OPENSSL_NO_DEVCRYPTOENG
|
||||||
|
# endif
|
||||||
|
# ifndef OPENSSL_NO_DOCS
|
||||||
|
# define OPENSSL_NO_DOCS
|
||||||
|
# endif
|
||||||
|
# ifndef OPENSSL_NO_DSO
|
||||||
|
# define OPENSSL_NO_DSO
|
||||||
|
# endif
|
||||||
|
# ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
|
||||||
|
# define OPENSSL_NO_EC_NISTP_64_GCC_128
|
||||||
|
# endif
|
||||||
|
# ifndef OPENSSL_NO_EGD
|
||||||
|
# define OPENSSL_NO_EGD
|
||||||
|
# endif
|
||||||
|
# ifndef OPENSSL_NO_ENGINE
|
||||||
|
# define OPENSSL_NO_ENGINE
|
||||||
|
# endif
|
||||||
|
# ifndef OPENSSL_NO_EXTERNAL_TESTS
|
||||||
|
# define OPENSSL_NO_EXTERNAL_TESTS
|
||||||
|
# endif
|
||||||
|
# ifndef OPENSSL_NO_FIPS_JITTER
|
||||||
|
# define OPENSSL_NO_FIPS_JITTER
|
||||||
|
# endif
|
||||||
|
# ifndef OPENSSL_NO_FIPS_POST
|
||||||
|
# define OPENSSL_NO_FIPS_POST
|
||||||
|
# endif
|
||||||
|
# ifndef OPENSSL_NO_FIPS_SECURITYCHECKS
|
||||||
|
# define OPENSSL_NO_FIPS_SECURITYCHECKS
|
||||||
|
# endif
|
||||||
|
# ifndef OPENSSL_NO_FUZZ_AFL
|
||||||
|
# define OPENSSL_NO_FUZZ_AFL
|
||||||
|
# endif
|
||||||
|
# ifndef OPENSSL_NO_FUZZ_LIBFUZZER
|
||||||
|
# define OPENSSL_NO_FUZZ_LIBFUZZER
|
||||||
|
# endif
|
||||||
|
# ifndef OPENSSL_NO_H3DEMO
|
||||||
|
# define OPENSSL_NO_H3DEMO
|
||||||
|
# endif
|
||||||
|
# ifndef OPENSSL_NO_HQINTEROP
|
||||||
|
# define OPENSSL_NO_HQINTEROP
|
||||||
|
# endif
|
||||||
|
# ifndef OPENSSL_NO_JITTER
|
||||||
|
# define OPENSSL_NO_JITTER
|
||||||
|
# endif
|
||||||
|
# ifndef OPENSSL_NO_KTLS
|
||||||
|
# define OPENSSL_NO_KTLS
|
||||||
|
# endif
|
||||||
|
# ifndef OPENSSL_NO_LOADERENG
|
||||||
|
# define OPENSSL_NO_LOADERENG
|
||||||
|
# endif
|
||||||
|
# ifndef OPENSSL_NO_MD2
|
||||||
|
# define OPENSSL_NO_MD2
|
||||||
|
# endif
|
||||||
|
# ifndef OPENSSL_NO_MSAN
|
||||||
|
# define OPENSSL_NO_MSAN
|
||||||
|
# endif
|
||||||
|
# ifndef OPENSSL_NO_PADLOCKENG
|
||||||
|
# define OPENSSL_NO_PADLOCKENG
|
||||||
|
# endif
|
||||||
|
# ifndef OPENSSL_NO_PIE
|
||||||
|
# define OPENSSL_NO_PIE
|
||||||
|
# endif
|
||||||
|
# ifndef OPENSSL_NO_RC5
|
||||||
|
# define OPENSSL_NO_RC5
|
||||||
|
# endif
|
||||||
|
# ifndef OPENSSL_NO_SCTP
|
||||||
|
# define OPENSSL_NO_SCTP
|
||||||
|
# endif
|
||||||
|
# ifndef OPENSSL_NO_SSL3
|
||||||
|
# define OPENSSL_NO_SSL3
|
||||||
|
# endif
|
||||||
|
# ifndef OPENSSL_NO_SSL3_METHOD
|
||||||
|
# define OPENSSL_NO_SSL3_METHOD
|
||||||
|
# endif
|
||||||
|
# ifndef OPENSSL_NO_SSLKEYLOG
|
||||||
|
# define OPENSSL_NO_SSLKEYLOG
|
||||||
|
# endif
|
||||||
|
# ifndef OPENSSL_NO_TESTS
|
||||||
|
# define OPENSSL_NO_TESTS
|
||||||
|
# endif
|
||||||
|
# ifndef OPENSSL_NO_TFO
|
||||||
|
# define OPENSSL_NO_TFO
|
||||||
|
# endif
|
||||||
|
# ifndef OPENSSL_NO_TRACE
|
||||||
|
# define OPENSSL_NO_TRACE
|
||||||
|
# endif
|
||||||
|
# ifndef OPENSSL_NO_UBSAN
|
||||||
|
# define OPENSSL_NO_UBSAN
|
||||||
|
# endif
|
||||||
|
# ifndef OPENSSL_NO_UNIT_TEST
|
||||||
|
# define OPENSSL_NO_UNIT_TEST
|
||||||
|
# endif
|
||||||
|
# ifndef OPENSSL_NO_UPLINK
|
||||||
|
# define OPENSSL_NO_UPLINK
|
||||||
|
# endif
|
||||||
|
# ifndef OPENSSL_NO_WEAK_SSL_CIPHERS
|
||||||
|
# define OPENSSL_NO_WEAK_SSL_CIPHERS
|
||||||
|
# endif
|
||||||
|
# ifndef OPENSSL_NO_WINSTORE
|
||||||
|
# define OPENSSL_NO_WINSTORE
|
||||||
|
# endif
|
||||||
|
# ifndef OPENSSL_NO_ZLIB
|
||||||
|
# define OPENSSL_NO_ZLIB
|
||||||
|
# endif
|
||||||
|
# ifndef OPENSSL_NO_ZLIB_DYNAMIC
|
||||||
|
# define OPENSSL_NO_ZLIB_DYNAMIC
|
||||||
|
# endif
|
||||||
|
# ifndef OPENSSL_NO_ZSTD
|
||||||
|
# define OPENSSL_NO_ZSTD
|
||||||
|
# endif
|
||||||
|
# ifndef OPENSSL_NO_ZSTD_DYNAMIC
|
||||||
|
# define OPENSSL_NO_ZSTD_DYNAMIC
|
||||||
|
# endif
|
||||||
|
# ifndef OPENSSL_NO_DYNAMIC_ENGINE
|
||||||
|
# define OPENSSL_NO_DYNAMIC_ENGINE
|
||||||
|
# endif
|
||||||
|
|
||||||
|
|
||||||
|
/* Generate 80386 code? */
|
||||||
|
# undef I386_ONLY
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The following are cipher-specific, but are part of the public API.
|
||||||
|
*/
|
||||||
|
# if !defined(OPENSSL_SYS_UEFI)
|
||||||
|
# undef BN_LLONG
|
||||||
|
/* Only one for the following should be defined */
|
||||||
|
# define SIXTY_FOUR_BIT_LONG
|
||||||
|
# undef SIXTY_FOUR_BIT
|
||||||
|
# undef THIRTY_TWO_BIT
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# define RC4_INT unsigned char
|
||||||
|
|
||||||
|
# if defined(OPENSSL_NO_COMP) || (defined(OPENSSL_NO_BROTLI) && defined(OPENSSL_NO_ZSTD) && defined(OPENSSL_NO_ZLIB))
|
||||||
|
# define OPENSSL_NO_COMP_ALG
|
||||||
|
# else
|
||||||
|
# undef OPENSSL_NO_COMP_ALG
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
|
||||||
|
#endif /* OPENSSL_CONFIGURATION_H */
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 1995-2021 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef OPENSSL_CONFTYPES_H
|
||||||
|
# define OPENSSL_CONFTYPES_H
|
||||||
|
# pragma once
|
||||||
|
|
||||||
|
#ifndef OPENSSL_CONF_H
|
||||||
|
# include <openssl/conf.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The contents of this file are deprecated and will be made opaque
|
||||||
|
*/
|
||||||
|
struct conf_method_st {
|
||||||
|
const char *name;
|
||||||
|
CONF *(*create) (CONF_METHOD *meth);
|
||||||
|
int (*init) (CONF *conf);
|
||||||
|
int (*destroy) (CONF *conf);
|
||||||
|
int (*destroy_data) (CONF *conf);
|
||||||
|
int (*load_bio) (CONF *conf, BIO *bp, long *eline);
|
||||||
|
int (*dump) (const CONF *conf, BIO *bp);
|
||||||
|
int (*is_number) (const CONF *conf, char c);
|
||||||
|
int (*to_int) (const CONF *conf, char c);
|
||||||
|
int (*load) (CONF *conf, const char *name, long *eline);
|
||||||
|
};
|
||||||
|
|
||||||
|
struct conf_st {
|
||||||
|
CONF_METHOD *meth;
|
||||||
|
void *meth_data;
|
||||||
|
LHASH_OF(CONF_VALUE) *data;
|
||||||
|
int flag_dollarid;
|
||||||
|
int flag_abspath;
|
||||||
|
char *includedir;
|
||||||
|
OSSL_LIB_CTX *libctx;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,236 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2019-2023 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef OPENSSL_CORE_H
|
||||||
|
# define OPENSSL_CORE_H
|
||||||
|
# pragma once
|
||||||
|
|
||||||
|
# include <stddef.h>
|
||||||
|
# include <openssl/types.h>
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/*-
|
||||||
|
* Base types
|
||||||
|
* ----------
|
||||||
|
*
|
||||||
|
* These are the types that the OpenSSL core and providers have in common
|
||||||
|
* to communicate data between them.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Opaque handles to be used with core upcall functions from providers */
|
||||||
|
typedef struct ossl_core_handle_st OSSL_CORE_HANDLE;
|
||||||
|
typedef struct openssl_core_ctx_st OPENSSL_CORE_CTX;
|
||||||
|
typedef struct ossl_core_bio_st OSSL_CORE_BIO;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Dispatch table element. function_id numbers and the functions are defined
|
||||||
|
* in core_dispatch.h, see macros with 'OSSL_CORE_MAKE_FUNC' in their names.
|
||||||
|
*
|
||||||
|
* An array of these is always terminated by function_id == 0
|
||||||
|
*/
|
||||||
|
struct ossl_dispatch_st {
|
||||||
|
int function_id;
|
||||||
|
void (*function)(void);
|
||||||
|
};
|
||||||
|
|
||||||
|
# define OSSL_DISPATCH_END \
|
||||||
|
{ 0, NULL }
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Other items, essentially an int<->pointer map element.
|
||||||
|
*
|
||||||
|
* We make this type distinct from OSSL_DISPATCH to ensure that dispatch
|
||||||
|
* tables remain tables with function pointers only.
|
||||||
|
*
|
||||||
|
* This is used whenever we need to pass things like a table of error reason
|
||||||
|
* codes <-> reason string maps, ...
|
||||||
|
*
|
||||||
|
* Usage determines which field works as key if any, rather than field order.
|
||||||
|
*
|
||||||
|
* An array of these is always terminated by id == 0 && ptr == NULL
|
||||||
|
*/
|
||||||
|
struct ossl_item_st {
|
||||||
|
unsigned int id;
|
||||||
|
void *ptr;
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Type to tie together algorithm names, property definition string and
|
||||||
|
* the algorithm implementation in the form of a dispatch table.
|
||||||
|
*
|
||||||
|
* An array of these is always terminated by algorithm_names == NULL
|
||||||
|
*/
|
||||||
|
struct ossl_algorithm_st {
|
||||||
|
const char *algorithm_names; /* key */
|
||||||
|
const char *property_definition; /* key */
|
||||||
|
const OSSL_DISPATCH *implementation;
|
||||||
|
const char *algorithm_description;
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Type to pass object data in a uniform way, without exposing the object
|
||||||
|
* structure.
|
||||||
|
*
|
||||||
|
* An array of these is always terminated by key == NULL
|
||||||
|
*/
|
||||||
|
struct ossl_param_st {
|
||||||
|
const char *key; /* the name of the parameter */
|
||||||
|
unsigned int data_type; /* declare what kind of content is in buffer */
|
||||||
|
void *data; /* value being passed in or out */
|
||||||
|
size_t data_size; /* data size */
|
||||||
|
size_t return_size; /* returned content size */
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Currently supported OSSL_PARAM data types */
|
||||||
|
/*
|
||||||
|
* OSSL_PARAM_INTEGER and OSSL_PARAM_UNSIGNED_INTEGER
|
||||||
|
* are arbitrary length and therefore require an arbitrarily sized buffer,
|
||||||
|
* since they may be used to pass numbers larger than what is natively
|
||||||
|
* available.
|
||||||
|
*
|
||||||
|
* The number must be buffered in native form, i.e. MSB first on B_ENDIAN
|
||||||
|
* systems and LSB first on L_ENDIAN systems. This means that arbitrary
|
||||||
|
* native integers can be stored in the buffer, just make sure that the
|
||||||
|
* buffer size is correct and the buffer itself is properly aligned (for
|
||||||
|
* example by having the buffer field point at a C integer).
|
||||||
|
*/
|
||||||
|
# define OSSL_PARAM_INTEGER 1
|
||||||
|
# define OSSL_PARAM_UNSIGNED_INTEGER 2
|
||||||
|
/*-
|
||||||
|
* OSSL_PARAM_REAL
|
||||||
|
* is a C binary floating point values in native form and alignment.
|
||||||
|
*/
|
||||||
|
# define OSSL_PARAM_REAL 3
|
||||||
|
/*-
|
||||||
|
* OSSL_PARAM_UTF8_STRING
|
||||||
|
* is a printable string. It is expected to be printed as it is.
|
||||||
|
*/
|
||||||
|
# define OSSL_PARAM_UTF8_STRING 4
|
||||||
|
/*-
|
||||||
|
* OSSL_PARAM_OCTET_STRING
|
||||||
|
* is a string of bytes with no further specification. It is expected to be
|
||||||
|
* printed as a hexdump.
|
||||||
|
*/
|
||||||
|
# define OSSL_PARAM_OCTET_STRING 5
|
||||||
|
/*-
|
||||||
|
* OSSL_PARAM_UTF8_PTR
|
||||||
|
* is a pointer to a printable string. It is expected to be printed as it is.
|
||||||
|
*
|
||||||
|
* The difference between this and OSSL_PARAM_UTF8_STRING is that only pointers
|
||||||
|
* are manipulated for this type.
|
||||||
|
*
|
||||||
|
* This is more relevant for parameter requests, where the responding
|
||||||
|
* function doesn't need to copy the data to the provided buffer, but
|
||||||
|
* sets the provided buffer to point at the actual data instead.
|
||||||
|
*
|
||||||
|
* WARNING! Using these is FRAGILE, as it assumes that the actual
|
||||||
|
* data and its location are constant.
|
||||||
|
*
|
||||||
|
* EXTRA WARNING! If you are not completely sure you most likely want
|
||||||
|
* to use the OSSL_PARAM_UTF8_STRING type.
|
||||||
|
*/
|
||||||
|
# define OSSL_PARAM_UTF8_PTR 6
|
||||||
|
/*-
|
||||||
|
* OSSL_PARAM_OCTET_PTR
|
||||||
|
* is a pointer to a string of bytes with no further specification. It is
|
||||||
|
* expected to be printed as a hexdump.
|
||||||
|
*
|
||||||
|
* The difference between this and OSSL_PARAM_OCTET_STRING is that only pointers
|
||||||
|
* are manipulated for this type.
|
||||||
|
*
|
||||||
|
* This is more relevant for parameter requests, where the responding
|
||||||
|
* function doesn't need to copy the data to the provided buffer, but
|
||||||
|
* sets the provided buffer to point at the actual data instead.
|
||||||
|
*
|
||||||
|
* WARNING! Using these is FRAGILE, as it assumes that the actual
|
||||||
|
* data and its location are constant.
|
||||||
|
*
|
||||||
|
* EXTRA WARNING! If you are not completely sure you most likely want
|
||||||
|
* to use the OSSL_PARAM_OCTET_STRING type.
|
||||||
|
*/
|
||||||
|
# define OSSL_PARAM_OCTET_PTR 7
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Typedef for the thread stop handling callback. Used both internally and by
|
||||||
|
* providers.
|
||||||
|
*
|
||||||
|
* Providers may register for notifications about threads stopping by
|
||||||
|
* registering a callback to hear about such events. Providers register the
|
||||||
|
* callback using the OSSL_FUNC_CORE_THREAD_START function in the |in| dispatch
|
||||||
|
* table passed to OSSL_provider_init(). The arg passed back to a provider will
|
||||||
|
* be the provider side context object.
|
||||||
|
*/
|
||||||
|
typedef void (*OSSL_thread_stop_handler_fn)(void *arg);
|
||||||
|
|
||||||
|
|
||||||
|
/*-
|
||||||
|
* Provider entry point
|
||||||
|
* --------------------
|
||||||
|
*
|
||||||
|
* This function is expected to be present in any dynamically loadable
|
||||||
|
* provider module. By definition, if this function doesn't exist in a
|
||||||
|
* module, that module is not an OpenSSL provider module.
|
||||||
|
*/
|
||||||
|
/*-
|
||||||
|
* |handle| pointer to opaque type OSSL_CORE_HANDLE. This can be used
|
||||||
|
* together with some functions passed via |in| to query data.
|
||||||
|
* |in| is the array of functions that the Core passes to the provider.
|
||||||
|
* |out| will be the array of base functions that the provider passes
|
||||||
|
* back to the Core.
|
||||||
|
* |provctx| a provider side context object, optionally created if the
|
||||||
|
* provider needs it. This value is passed to other provider
|
||||||
|
* functions, notably other context constructors.
|
||||||
|
*/
|
||||||
|
typedef int (OSSL_provider_init_fn)(const OSSL_CORE_HANDLE *handle,
|
||||||
|
const OSSL_DISPATCH *in,
|
||||||
|
const OSSL_DISPATCH **out,
|
||||||
|
void **provctx);
|
||||||
|
# ifdef __VMS
|
||||||
|
# pragma names save
|
||||||
|
# pragma names uppercase,truncated
|
||||||
|
# endif
|
||||||
|
OPENSSL_EXPORT OSSL_provider_init_fn OSSL_provider_init;
|
||||||
|
# ifdef __VMS
|
||||||
|
# pragma names restore
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Generic callback function signature.
|
||||||
|
*
|
||||||
|
* The expectation is that any provider function that wants to offer
|
||||||
|
* a callback / hook can do so by taking an argument with this type,
|
||||||
|
* as well as a pointer to caller-specific data. When calling the
|
||||||
|
* callback, the provider function can populate an OSSL_PARAM array
|
||||||
|
* with data of its choice and pass that in the callback call, along
|
||||||
|
* with the caller data argument.
|
||||||
|
*
|
||||||
|
* libcrypto may use the OSSL_PARAM array to create arguments for an
|
||||||
|
* application callback it knows about.
|
||||||
|
*/
|
||||||
|
typedef int (OSSL_CALLBACK)(const OSSL_PARAM params[], void *arg);
|
||||||
|
typedef int (OSSL_INOUT_CALLBACK)(const OSSL_PARAM in_params[],
|
||||||
|
OSSL_PARAM out_params[], void *arg);
|
||||||
|
/*
|
||||||
|
* Passphrase callback function signature
|
||||||
|
*
|
||||||
|
* This is similar to the generic callback function above, but adds a
|
||||||
|
* result parameter.
|
||||||
|
*/
|
||||||
|
typedef int (OSSL_PASSPHRASE_CALLBACK)(char *pass, size_t pass_size,
|
||||||
|
size_t *pass_len,
|
||||||
|
const OSSL_PARAM params[], void *arg);
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
|
||||||
|
#endif
|
||||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,575 @@
|
|||||||
|
/*
|
||||||
|
* WARNING: do not edit!
|
||||||
|
* Generated by Makefile from ../../openssl-3.5.0/include/openssl/core_names.h.in
|
||||||
|
*
|
||||||
|
* Copyright 2019-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
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef OPENSSL_CORE_NAMES_H
|
||||||
|
# define OPENSSL_CORE_NAMES_H
|
||||||
|
# pragma once
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/* OSSL_CIPHER_PARAM_CTS_MODE Values */
|
||||||
|
# define OSSL_CIPHER_CTS_MODE_CS1 "CS1"
|
||||||
|
# define OSSL_CIPHER_CTS_MODE_CS2 "CS2"
|
||||||
|
# define OSSL_CIPHER_CTS_MODE_CS3 "CS3"
|
||||||
|
|
||||||
|
/* Known CIPHER names (not a complete list) */
|
||||||
|
# define OSSL_CIPHER_NAME_AES_128_GCM_SIV "AES-128-GCM-SIV"
|
||||||
|
# define OSSL_CIPHER_NAME_AES_192_GCM_SIV "AES-192-GCM-SIV"
|
||||||
|
# define OSSL_CIPHER_NAME_AES_256_GCM_SIV "AES-256-GCM-SIV"
|
||||||
|
|
||||||
|
/* Known DIGEST names (not a complete list) */
|
||||||
|
# define OSSL_DIGEST_NAME_MD5 "MD5"
|
||||||
|
# define OSSL_DIGEST_NAME_MD5_SHA1 "MD5-SHA1"
|
||||||
|
# define OSSL_DIGEST_NAME_SHA1 "SHA1"
|
||||||
|
# define OSSL_DIGEST_NAME_SHA2_224 "SHA2-224"
|
||||||
|
# define OSSL_DIGEST_NAME_SHA2_256 "SHA2-256"
|
||||||
|
# define OSSL_DIGEST_NAME_SHA2_256_192 "SHA2-256/192"
|
||||||
|
# define OSSL_DIGEST_NAME_SHA2_384 "SHA2-384"
|
||||||
|
# define OSSL_DIGEST_NAME_SHA2_512 "SHA2-512"
|
||||||
|
# define OSSL_DIGEST_NAME_SHA2_512_224 "SHA2-512/224"
|
||||||
|
# define OSSL_DIGEST_NAME_SHA2_512_256 "SHA2-512/256"
|
||||||
|
# define OSSL_DIGEST_NAME_MD2 "MD2"
|
||||||
|
# define OSSL_DIGEST_NAME_MD4 "MD4"
|
||||||
|
# define OSSL_DIGEST_NAME_MDC2 "MDC2"
|
||||||
|
# define OSSL_DIGEST_NAME_RIPEMD160 "RIPEMD160"
|
||||||
|
# define OSSL_DIGEST_NAME_SHA3_224 "SHA3-224"
|
||||||
|
# define OSSL_DIGEST_NAME_SHA3_256 "SHA3-256"
|
||||||
|
# define OSSL_DIGEST_NAME_SHA3_384 "SHA3-384"
|
||||||
|
# define OSSL_DIGEST_NAME_SHA3_512 "SHA3-512"
|
||||||
|
# define OSSL_DIGEST_NAME_KECCAK_KMAC128 "KECCAK-KMAC-128"
|
||||||
|
# define OSSL_DIGEST_NAME_KECCAK_KMAC256 "KECCAK-KMAC-256"
|
||||||
|
# define OSSL_DIGEST_NAME_SM3 "SM3"
|
||||||
|
|
||||||
|
/* Known MAC names */
|
||||||
|
# define OSSL_MAC_NAME_BLAKE2BMAC "BLAKE2BMAC"
|
||||||
|
# define OSSL_MAC_NAME_BLAKE2SMAC "BLAKE2SMAC"
|
||||||
|
# define OSSL_MAC_NAME_CMAC "CMAC"
|
||||||
|
# define OSSL_MAC_NAME_GMAC "GMAC"
|
||||||
|
# define OSSL_MAC_NAME_HMAC "HMAC"
|
||||||
|
# define OSSL_MAC_NAME_KMAC128 "KMAC128"
|
||||||
|
# define OSSL_MAC_NAME_KMAC256 "KMAC256"
|
||||||
|
# define OSSL_MAC_NAME_POLY1305 "POLY1305"
|
||||||
|
# define OSSL_MAC_NAME_SIPHASH "SIPHASH"
|
||||||
|
|
||||||
|
/* Known KDF names */
|
||||||
|
# define OSSL_KDF_NAME_HKDF "HKDF"
|
||||||
|
# define OSSL_KDF_NAME_TLS1_3_KDF "TLS13-KDF"
|
||||||
|
# define OSSL_KDF_NAME_PBKDF1 "PBKDF1"
|
||||||
|
# define OSSL_KDF_NAME_PBKDF2 "PBKDF2"
|
||||||
|
# define OSSL_KDF_NAME_SCRYPT "SCRYPT"
|
||||||
|
# define OSSL_KDF_NAME_SSHKDF "SSHKDF"
|
||||||
|
# define OSSL_KDF_NAME_SSKDF "SSKDF"
|
||||||
|
# define OSSL_KDF_NAME_TLS1_PRF "TLS1-PRF"
|
||||||
|
# define OSSL_KDF_NAME_X942KDF_ASN1 "X942KDF-ASN1"
|
||||||
|
# define OSSL_KDF_NAME_X942KDF_CONCAT "X942KDF-CONCAT"
|
||||||
|
# define OSSL_KDF_NAME_X963KDF "X963KDF"
|
||||||
|
# define OSSL_KDF_NAME_KBKDF "KBKDF"
|
||||||
|
# define OSSL_KDF_NAME_KRB5KDF "KRB5KDF"
|
||||||
|
# define OSSL_KDF_NAME_HMACDRBGKDF "HMAC-DRBG-KDF"
|
||||||
|
|
||||||
|
/* RSA padding modes */
|
||||||
|
# define OSSL_PKEY_RSA_PAD_MODE_NONE "none"
|
||||||
|
# define OSSL_PKEY_RSA_PAD_MODE_PKCSV15 "pkcs1"
|
||||||
|
# define OSSL_PKEY_RSA_PAD_MODE_OAEP "oaep"
|
||||||
|
# define OSSL_PKEY_RSA_PAD_MODE_X931 "x931"
|
||||||
|
# define OSSL_PKEY_RSA_PAD_MODE_PSS "pss"
|
||||||
|
|
||||||
|
/* RSA pss padding salt length */
|
||||||
|
# define OSSL_PKEY_RSA_PSS_SALT_LEN_DIGEST "digest"
|
||||||
|
# define OSSL_PKEY_RSA_PSS_SALT_LEN_MAX "max"
|
||||||
|
# define OSSL_PKEY_RSA_PSS_SALT_LEN_AUTO "auto"
|
||||||
|
# define OSSL_PKEY_RSA_PSS_SALT_LEN_AUTO_DIGEST_MAX "auto-digestmax"
|
||||||
|
|
||||||
|
/* OSSL_PKEY_PARAM_EC_ENCODING values */
|
||||||
|
# define OSSL_PKEY_EC_ENCODING_EXPLICIT "explicit"
|
||||||
|
# define OSSL_PKEY_EC_ENCODING_GROUP "named_curve"
|
||||||
|
|
||||||
|
# define OSSL_PKEY_EC_POINT_CONVERSION_FORMAT_UNCOMPRESSED "uncompressed"
|
||||||
|
# define OSSL_PKEY_EC_POINT_CONVERSION_FORMAT_COMPRESSED "compressed"
|
||||||
|
# define OSSL_PKEY_EC_POINT_CONVERSION_FORMAT_HYBRID "hybrid"
|
||||||
|
|
||||||
|
# define OSSL_PKEY_EC_GROUP_CHECK_DEFAULT "default"
|
||||||
|
# define OSSL_PKEY_EC_GROUP_CHECK_NAMED "named"
|
||||||
|
# define OSSL_PKEY_EC_GROUP_CHECK_NAMED_NIST "named-nist"
|
||||||
|
|
||||||
|
/* PROV_SKEY well known key types */
|
||||||
|
# define OSSL_SKEY_TYPE_GENERIC "GENERIC-SECRET"
|
||||||
|
# define OSSL_SKEY_TYPE_AES "AES"
|
||||||
|
|
||||||
|
/* OSSL_KEM_PARAM_OPERATION values */
|
||||||
|
#define OSSL_KEM_PARAM_OPERATION_RSASVE "RSASVE"
|
||||||
|
#define OSSL_KEM_PARAM_OPERATION_DHKEM "DHKEM"
|
||||||
|
|
||||||
|
/* Provider configuration variables */
|
||||||
|
#define OSSL_PKEY_RETAIN_SEED "pkey_retain_seed"
|
||||||
|
|
||||||
|
/* Parameter name definitions - generated by util/perl/OpenSSL/paramnames.pm */
|
||||||
|
# define OSSL_ALG_PARAM_ALGORITHM_ID "algorithm-id"
|
||||||
|
# define OSSL_ALG_PARAM_ALGORITHM_ID_PARAMS "algorithm-id-params"
|
||||||
|
# define OSSL_ALG_PARAM_CIPHER "cipher"
|
||||||
|
# define OSSL_ALG_PARAM_DIGEST "digest"
|
||||||
|
# define OSSL_ALG_PARAM_ENGINE "engine"
|
||||||
|
# define OSSL_ALG_PARAM_FIPS_APPROVED_INDICATOR "fips-indicator"
|
||||||
|
# define OSSL_ALG_PARAM_MAC "mac"
|
||||||
|
# define OSSL_ALG_PARAM_PROPERTIES "properties"
|
||||||
|
# define OSSL_ASYM_CIPHER_PARAM_DIGEST OSSL_PKEY_PARAM_DIGEST
|
||||||
|
# define OSSL_ASYM_CIPHER_PARAM_ENGINE OSSL_PKEY_PARAM_ENGINE
|
||||||
|
# define OSSL_ASYM_CIPHER_PARAM_FIPS_APPROVED_INDICATOR OSSL_ALG_PARAM_FIPS_APPROVED_INDICATOR
|
||||||
|
# define OSSL_ASYM_CIPHER_PARAM_FIPS_KEY_CHECK OSSL_PKEY_PARAM_FIPS_KEY_CHECK
|
||||||
|
# define OSSL_ASYM_CIPHER_PARAM_FIPS_RSA_PKCS15_PAD_DISABLED OSSL_PROV_PARAM_RSA_PKCS15_PAD_DISABLED
|
||||||
|
# define OSSL_ASYM_CIPHER_PARAM_IMPLICIT_REJECTION "implicit-rejection"
|
||||||
|
# define OSSL_ASYM_CIPHER_PARAM_MGF1_DIGEST OSSL_PKEY_PARAM_MGF1_DIGEST
|
||||||
|
# define OSSL_ASYM_CIPHER_PARAM_MGF1_DIGEST_PROPS OSSL_PKEY_PARAM_MGF1_PROPERTIES
|
||||||
|
# define OSSL_ASYM_CIPHER_PARAM_OAEP_DIGEST OSSL_ALG_PARAM_DIGEST
|
||||||
|
# define OSSL_ASYM_CIPHER_PARAM_OAEP_DIGEST_PROPS "digest-props"
|
||||||
|
# define OSSL_ASYM_CIPHER_PARAM_OAEP_LABEL "oaep-label"
|
||||||
|
# define OSSL_ASYM_CIPHER_PARAM_PAD_MODE OSSL_PKEY_PARAM_PAD_MODE
|
||||||
|
# define OSSL_ASYM_CIPHER_PARAM_PROPERTIES OSSL_PKEY_PARAM_PROPERTIES
|
||||||
|
# define OSSL_ASYM_CIPHER_PARAM_TLS_CLIENT_VERSION "tls-client-version"
|
||||||
|
# define OSSL_ASYM_CIPHER_PARAM_TLS_NEGOTIATED_VERSION "tls-negotiated-version"
|
||||||
|
# define OSSL_CAPABILITY_TLS_GROUP_ALG "tls-group-alg"
|
||||||
|
# define OSSL_CAPABILITY_TLS_GROUP_ID "tls-group-id"
|
||||||
|
# define OSSL_CAPABILITY_TLS_GROUP_IS_KEM "tls-group-is-kem"
|
||||||
|
# define OSSL_CAPABILITY_TLS_GROUP_MAX_DTLS "tls-max-dtls"
|
||||||
|
# define OSSL_CAPABILITY_TLS_GROUP_MAX_TLS "tls-max-tls"
|
||||||
|
# define OSSL_CAPABILITY_TLS_GROUP_MIN_DTLS "tls-min-dtls"
|
||||||
|
# define OSSL_CAPABILITY_TLS_GROUP_MIN_TLS "tls-min-tls"
|
||||||
|
# define OSSL_CAPABILITY_TLS_GROUP_NAME "tls-group-name"
|
||||||
|
# define OSSL_CAPABILITY_TLS_GROUP_NAME_INTERNAL "tls-group-name-internal"
|
||||||
|
# define OSSL_CAPABILITY_TLS_GROUP_SECURITY_BITS "tls-group-sec-bits"
|
||||||
|
# define OSSL_CAPABILITY_TLS_SIGALG_CODE_POINT "tls-sigalg-code-point"
|
||||||
|
# define OSSL_CAPABILITY_TLS_SIGALG_HASH_NAME "tls-sigalg-hash-name"
|
||||||
|
# define OSSL_CAPABILITY_TLS_SIGALG_HASH_OID "tls-sigalg-hash-oid"
|
||||||
|
# define OSSL_CAPABILITY_TLS_SIGALG_IANA_NAME "tls-sigalg-iana-name"
|
||||||
|
# define OSSL_CAPABILITY_TLS_SIGALG_KEYTYPE "tls-sigalg-keytype"
|
||||||
|
# define OSSL_CAPABILITY_TLS_SIGALG_KEYTYPE_OID "tls-sigalg-keytype-oid"
|
||||||
|
# define OSSL_CAPABILITY_TLS_SIGALG_MAX_DTLS "tls-max-dtls"
|
||||||
|
# define OSSL_CAPABILITY_TLS_SIGALG_MAX_TLS "tls-max-tls"
|
||||||
|
# define OSSL_CAPABILITY_TLS_SIGALG_MIN_DTLS "tls-min-dtls"
|
||||||
|
# define OSSL_CAPABILITY_TLS_SIGALG_MIN_TLS "tls-min-tls"
|
||||||
|
# define OSSL_CAPABILITY_TLS_SIGALG_NAME "tls-sigalg-name"
|
||||||
|
# define OSSL_CAPABILITY_TLS_SIGALG_OID "tls-sigalg-oid"
|
||||||
|
# define OSSL_CAPABILITY_TLS_SIGALG_SECURITY_BITS "tls-sigalg-sec-bits"
|
||||||
|
# define OSSL_CAPABILITY_TLS_SIGALG_SIG_NAME "tls-sigalg-sig-name"
|
||||||
|
# define OSSL_CAPABILITY_TLS_SIGALG_SIG_OID "tls-sigalg-sig-oid"
|
||||||
|
# define OSSL_CIPHER_PARAM_AEAD "aead"
|
||||||
|
# define OSSL_CIPHER_PARAM_AEAD_IVLEN OSSL_CIPHER_PARAM_IVLEN
|
||||||
|
# define OSSL_CIPHER_PARAM_AEAD_IV_GENERATED "iv-generated"
|
||||||
|
# define OSSL_CIPHER_PARAM_AEAD_MAC_KEY "mackey"
|
||||||
|
# define OSSL_CIPHER_PARAM_AEAD_TAG "tag"
|
||||||
|
# define OSSL_CIPHER_PARAM_AEAD_TAGLEN "taglen"
|
||||||
|
# define OSSL_CIPHER_PARAM_AEAD_TLS1_AAD "tlsaad"
|
||||||
|
# define OSSL_CIPHER_PARAM_AEAD_TLS1_AAD_PAD "tlsaadpad"
|
||||||
|
# define OSSL_CIPHER_PARAM_AEAD_TLS1_GET_IV_GEN "tlsivgen"
|
||||||
|
# define OSSL_CIPHER_PARAM_AEAD_TLS1_IV_FIXED "tlsivfixed"
|
||||||
|
# define OSSL_CIPHER_PARAM_AEAD_TLS1_SET_IV_INV "tlsivinv"
|
||||||
|
# define OSSL_CIPHER_PARAM_ALGORITHM_ID OSSL_ALG_PARAM_ALGORITHM_ID
|
||||||
|
# define OSSL_CIPHER_PARAM_ALGORITHM_ID_PARAMS OSSL_ALG_PARAM_ALGORITHM_ID_PARAMS
|
||||||
|
# define OSSL_CIPHER_PARAM_ALGORITHM_ID_PARAMS_OLD "alg_id_param"
|
||||||
|
# define OSSL_CIPHER_PARAM_BLOCK_SIZE "blocksize"
|
||||||
|
# define OSSL_CIPHER_PARAM_CTS "cts"
|
||||||
|
# define OSSL_CIPHER_PARAM_CTS_MODE "cts_mode"
|
||||||
|
# define OSSL_CIPHER_PARAM_CUSTOM_IV "custom-iv"
|
||||||
|
# define OSSL_CIPHER_PARAM_DECRYPT_ONLY "decrypt-only"
|
||||||
|
# define OSSL_CIPHER_PARAM_FIPS_APPROVED_INDICATOR OSSL_ALG_PARAM_FIPS_APPROVED_INDICATOR
|
||||||
|
# define OSSL_CIPHER_PARAM_FIPS_ENCRYPT_CHECK "encrypt-check"
|
||||||
|
# define OSSL_CIPHER_PARAM_HAS_RAND_KEY "has-randkey"
|
||||||
|
# define OSSL_CIPHER_PARAM_IV "iv"
|
||||||
|
# define OSSL_CIPHER_PARAM_IVLEN "ivlen"
|
||||||
|
# define OSSL_CIPHER_PARAM_KEYLEN "keylen"
|
||||||
|
# define OSSL_CIPHER_PARAM_MODE "mode"
|
||||||
|
# define OSSL_CIPHER_PARAM_NUM "num"
|
||||||
|
# define OSSL_CIPHER_PARAM_PADDING "padding"
|
||||||
|
# define OSSL_CIPHER_PARAM_PIPELINE_AEAD_TAG "pipeline-tag"
|
||||||
|
# define OSSL_CIPHER_PARAM_RANDOM_KEY "randkey"
|
||||||
|
# define OSSL_CIPHER_PARAM_RC2_KEYBITS "keybits"
|
||||||
|
# define OSSL_CIPHER_PARAM_ROUNDS "rounds"
|
||||||
|
# define OSSL_CIPHER_PARAM_SPEED "speed"
|
||||||
|
# define OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK "tls-multi"
|
||||||
|
# define OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_AAD "tls1multi_aad"
|
||||||
|
# define OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_AAD_PACKLEN "tls1multi_aadpacklen"
|
||||||
|
# define OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_ENC "tls1multi_enc"
|
||||||
|
# define OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_ENC_IN "tls1multi_encin"
|
||||||
|
# define OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_ENC_LEN "tls1multi_enclen"
|
||||||
|
# define OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_INTERLEAVE "tls1multi_interleave"
|
||||||
|
# define OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_MAX_BUFSIZE "tls1multi_maxbufsz"
|
||||||
|
# define OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_MAX_SEND_FRAGMENT "tls1multi_maxsndfrag"
|
||||||
|
# define OSSL_CIPHER_PARAM_TLS_MAC "tls-mac"
|
||||||
|
# define OSSL_CIPHER_PARAM_TLS_MAC_SIZE "tls-mac-size"
|
||||||
|
# define OSSL_CIPHER_PARAM_TLS_VERSION "tls-version"
|
||||||
|
# define OSSL_CIPHER_PARAM_UPDATED_IV "updated-iv"
|
||||||
|
# define OSSL_CIPHER_PARAM_USE_BITS "use-bits"
|
||||||
|
# define OSSL_CIPHER_PARAM_XTS_STANDARD "xts_standard"
|
||||||
|
# define OSSL_DECODER_PARAM_PROPERTIES OSSL_ALG_PARAM_PROPERTIES
|
||||||
|
# define OSSL_DIGEST_PARAM_ALGID_ABSENT "algid-absent"
|
||||||
|
# define OSSL_DIGEST_PARAM_BLOCK_SIZE "blocksize"
|
||||||
|
# define OSSL_DIGEST_PARAM_MICALG "micalg"
|
||||||
|
# define OSSL_DIGEST_PARAM_PAD_TYPE "pad-type"
|
||||||
|
# define OSSL_DIGEST_PARAM_SIZE "size"
|
||||||
|
# define OSSL_DIGEST_PARAM_SSL3_MS "ssl3-ms"
|
||||||
|
# define OSSL_DIGEST_PARAM_XOF "xof"
|
||||||
|
# define OSSL_DIGEST_PARAM_XOFLEN "xoflen"
|
||||||
|
# define OSSL_DRBG_PARAM_CIPHER OSSL_ALG_PARAM_CIPHER
|
||||||
|
# define OSSL_DRBG_PARAM_DIGEST OSSL_ALG_PARAM_DIGEST
|
||||||
|
# define OSSL_DRBG_PARAM_ENTROPY_REQUIRED "entropy_required"
|
||||||
|
# define OSSL_DRBG_PARAM_FIPS_APPROVED_INDICATOR OSSL_ALG_PARAM_FIPS_APPROVED_INDICATOR
|
||||||
|
# define OSSL_DRBG_PARAM_FIPS_DIGEST_CHECK OSSL_PKEY_PARAM_FIPS_DIGEST_CHECK
|
||||||
|
# define OSSL_DRBG_PARAM_MAC OSSL_ALG_PARAM_MAC
|
||||||
|
# define OSSL_DRBG_PARAM_MAX_ADINLEN "max_adinlen"
|
||||||
|
# define OSSL_DRBG_PARAM_MAX_ENTROPYLEN "max_entropylen"
|
||||||
|
# define OSSL_DRBG_PARAM_MAX_LENGTH "maxium_length"
|
||||||
|
# define OSSL_DRBG_PARAM_MAX_NONCELEN "max_noncelen"
|
||||||
|
# define OSSL_DRBG_PARAM_MAX_PERSLEN "max_perslen"
|
||||||
|
# define OSSL_DRBG_PARAM_MIN_ENTROPYLEN "min_entropylen"
|
||||||
|
# define OSSL_DRBG_PARAM_MIN_LENGTH "minium_length"
|
||||||
|
# define OSSL_DRBG_PARAM_MIN_NONCELEN "min_noncelen"
|
||||||
|
# define OSSL_DRBG_PARAM_PREDICTION_RESISTANCE "prediction_resistance"
|
||||||
|
# define OSSL_DRBG_PARAM_PROPERTIES OSSL_ALG_PARAM_PROPERTIES
|
||||||
|
# define OSSL_DRBG_PARAM_RANDOM_DATA "random_data"
|
||||||
|
# define OSSL_DRBG_PARAM_RESEED_COUNTER "reseed_counter"
|
||||||
|
# define OSSL_DRBG_PARAM_RESEED_REQUESTS "reseed_requests"
|
||||||
|
# define OSSL_DRBG_PARAM_RESEED_TIME "reseed_time"
|
||||||
|
# define OSSL_DRBG_PARAM_RESEED_TIME_INTERVAL "reseed_time_interval"
|
||||||
|
# define OSSL_DRBG_PARAM_SIZE "size"
|
||||||
|
# define OSSL_DRBG_PARAM_USE_DF "use_derivation_function"
|
||||||
|
# define OSSL_ENCODER_PARAM_CIPHER OSSL_ALG_PARAM_CIPHER
|
||||||
|
# define OSSL_ENCODER_PARAM_ENCRYPT_LEVEL "encrypt-level"
|
||||||
|
# define OSSL_ENCODER_PARAM_PROPERTIES OSSL_ALG_PARAM_PROPERTIES
|
||||||
|
# define OSSL_ENCODER_PARAM_SAVE_PARAMETERS "save-parameters"
|
||||||
|
# define OSSL_EXCHANGE_PARAM_EC_ECDH_COFACTOR_MODE "ecdh-cofactor-mode"
|
||||||
|
# define OSSL_EXCHANGE_PARAM_FIPS_APPROVED_INDICATOR OSSL_ALG_PARAM_FIPS_APPROVED_INDICATOR
|
||||||
|
# define OSSL_EXCHANGE_PARAM_FIPS_DIGEST_CHECK OSSL_PKEY_PARAM_FIPS_DIGEST_CHECK
|
||||||
|
# define OSSL_EXCHANGE_PARAM_FIPS_ECDH_COFACTOR_CHECK OSSL_PROV_PARAM_ECDH_COFACTOR_CHECK
|
||||||
|
# define OSSL_EXCHANGE_PARAM_FIPS_KEY_CHECK OSSL_PKEY_PARAM_FIPS_KEY_CHECK
|
||||||
|
# define OSSL_EXCHANGE_PARAM_KDF_DIGEST "kdf-digest"
|
||||||
|
# define OSSL_EXCHANGE_PARAM_KDF_DIGEST_PROPS "kdf-digest-props"
|
||||||
|
# define OSSL_EXCHANGE_PARAM_KDF_OUTLEN "kdf-outlen"
|
||||||
|
# define OSSL_EXCHANGE_PARAM_KDF_TYPE "kdf-type"
|
||||||
|
# define OSSL_EXCHANGE_PARAM_KDF_UKM "kdf-ukm"
|
||||||
|
# define OSSL_EXCHANGE_PARAM_PAD "pad"
|
||||||
|
# define OSSL_GEN_PARAM_ITERATION "iteration"
|
||||||
|
# define OSSL_GEN_PARAM_POTENTIAL "potential"
|
||||||
|
# define OSSL_KDF_PARAM_ARGON2_AD "ad"
|
||||||
|
# define OSSL_KDF_PARAM_ARGON2_LANES "lanes"
|
||||||
|
# define OSSL_KDF_PARAM_ARGON2_MEMCOST "memcost"
|
||||||
|
# define OSSL_KDF_PARAM_ARGON2_VERSION "version"
|
||||||
|
# define OSSL_KDF_PARAM_CEK_ALG "cekalg"
|
||||||
|
# define OSSL_KDF_PARAM_CIPHER OSSL_ALG_PARAM_CIPHER
|
||||||
|
# define OSSL_KDF_PARAM_CONSTANT "constant"
|
||||||
|
# define OSSL_KDF_PARAM_DATA "data"
|
||||||
|
# define OSSL_KDF_PARAM_DIGEST OSSL_ALG_PARAM_DIGEST
|
||||||
|
# define OSSL_KDF_PARAM_EARLY_CLEAN "early_clean"
|
||||||
|
# define OSSL_KDF_PARAM_FIPS_APPROVED_INDICATOR OSSL_ALG_PARAM_FIPS_APPROVED_INDICATOR
|
||||||
|
# define OSSL_KDF_PARAM_FIPS_DIGEST_CHECK OSSL_PKEY_PARAM_FIPS_DIGEST_CHECK
|
||||||
|
# define OSSL_KDF_PARAM_FIPS_EMS_CHECK "ems_check"
|
||||||
|
# define OSSL_KDF_PARAM_FIPS_KEY_CHECK OSSL_PKEY_PARAM_FIPS_KEY_CHECK
|
||||||
|
# define OSSL_KDF_PARAM_HMACDRBG_ENTROPY "entropy"
|
||||||
|
# define OSSL_KDF_PARAM_HMACDRBG_NONCE "nonce"
|
||||||
|
# define OSSL_KDF_PARAM_INFO "info"
|
||||||
|
# define OSSL_KDF_PARAM_ITER "iter"
|
||||||
|
# define OSSL_KDF_PARAM_KBKDF_R "r"
|
||||||
|
# define OSSL_KDF_PARAM_KBKDF_USE_L "use-l"
|
||||||
|
# define OSSL_KDF_PARAM_KBKDF_USE_SEPARATOR "use-separator"
|
||||||
|
# define OSSL_KDF_PARAM_KEY "key"
|
||||||
|
# define OSSL_KDF_PARAM_LABEL "label"
|
||||||
|
# define OSSL_KDF_PARAM_MAC OSSL_ALG_PARAM_MAC
|
||||||
|
# define OSSL_KDF_PARAM_MAC_SIZE "maclen"
|
||||||
|
# define OSSL_KDF_PARAM_MODE "mode"
|
||||||
|
# define OSSL_KDF_PARAM_PASSWORD "pass"
|
||||||
|
# define OSSL_KDF_PARAM_PKCS12_ID "id"
|
||||||
|
# define OSSL_KDF_PARAM_PKCS5 "pkcs5"
|
||||||
|
# define OSSL_KDF_PARAM_PREFIX "prefix"
|
||||||
|
# define OSSL_KDF_PARAM_PROPERTIES OSSL_ALG_PARAM_PROPERTIES
|
||||||
|
# define OSSL_KDF_PARAM_SALT "salt"
|
||||||
|
# define OSSL_KDF_PARAM_SCRYPT_MAXMEM "maxmem_bytes"
|
||||||
|
# define OSSL_KDF_PARAM_SCRYPT_N "n"
|
||||||
|
# define OSSL_KDF_PARAM_SCRYPT_P "p"
|
||||||
|
# define OSSL_KDF_PARAM_SCRYPT_R "r"
|
||||||
|
# define OSSL_KDF_PARAM_SECRET "secret"
|
||||||
|
# define OSSL_KDF_PARAM_SEED "seed"
|
||||||
|
# define OSSL_KDF_PARAM_SIZE "size"
|
||||||
|
# define OSSL_KDF_PARAM_SSHKDF_SESSION_ID "session_id"
|
||||||
|
# define OSSL_KDF_PARAM_SSHKDF_TYPE "type"
|
||||||
|
# define OSSL_KDF_PARAM_SSHKDF_XCGHASH "xcghash"
|
||||||
|
# define OSSL_KDF_PARAM_THREADS "threads"
|
||||||
|
# define OSSL_KDF_PARAM_UKM "ukm"
|
||||||
|
# define OSSL_KDF_PARAM_X942_ACVPINFO "acvp-info"
|
||||||
|
# define OSSL_KDF_PARAM_X942_PARTYUINFO "partyu-info"
|
||||||
|
# define OSSL_KDF_PARAM_X942_PARTYVINFO "partyv-info"
|
||||||
|
# define OSSL_KDF_PARAM_X942_SUPP_PRIVINFO "supp-privinfo"
|
||||||
|
# define OSSL_KDF_PARAM_X942_SUPP_PUBINFO "supp-pubinfo"
|
||||||
|
# define OSSL_KDF_PARAM_X942_USE_KEYBITS "use-keybits"
|
||||||
|
# define OSSL_KEM_PARAM_FIPS_APPROVED_INDICATOR OSSL_ALG_PARAM_FIPS_APPROVED_INDICATOR
|
||||||
|
# define OSSL_KEM_PARAM_FIPS_KEY_CHECK OSSL_PKEY_PARAM_FIPS_KEY_CHECK
|
||||||
|
# define OSSL_KEM_PARAM_IKME "ikme"
|
||||||
|
# define OSSL_KEM_PARAM_OPERATION "operation"
|
||||||
|
# define OSSL_LIBSSL_RECORD_LAYER_PARAM_BLOCK_PADDING "block_padding"
|
||||||
|
# define OSSL_LIBSSL_RECORD_LAYER_PARAM_HS_PADDING "hs_padding"
|
||||||
|
# define OSSL_LIBSSL_RECORD_LAYER_PARAM_MAX_EARLY_DATA "max_early_data"
|
||||||
|
# define OSSL_LIBSSL_RECORD_LAYER_PARAM_MAX_FRAG_LEN "max_frag_len"
|
||||||
|
# define OSSL_LIBSSL_RECORD_LAYER_PARAM_MODE "mode"
|
||||||
|
# define OSSL_LIBSSL_RECORD_LAYER_PARAM_OPTIONS "options"
|
||||||
|
# define OSSL_LIBSSL_RECORD_LAYER_PARAM_READ_AHEAD "read_ahead"
|
||||||
|
# define OSSL_LIBSSL_RECORD_LAYER_PARAM_STREAM_MAC "stream_mac"
|
||||||
|
# define OSSL_LIBSSL_RECORD_LAYER_PARAM_TLSTREE "tlstree"
|
||||||
|
# define OSSL_LIBSSL_RECORD_LAYER_PARAM_USE_ETM "use_etm"
|
||||||
|
# define OSSL_LIBSSL_RECORD_LAYER_READ_BUFFER_LEN "read_buffer_len"
|
||||||
|
# define OSSL_MAC_PARAM_BLOCK_SIZE "block-size"
|
||||||
|
# define OSSL_MAC_PARAM_CIPHER OSSL_ALG_PARAM_CIPHER
|
||||||
|
# define OSSL_MAC_PARAM_CUSTOM "custom"
|
||||||
|
# define OSSL_MAC_PARAM_C_ROUNDS "c-rounds"
|
||||||
|
# define OSSL_MAC_PARAM_DIGEST OSSL_ALG_PARAM_DIGEST
|
||||||
|
# define OSSL_MAC_PARAM_DIGEST_NOINIT "digest-noinit"
|
||||||
|
# define OSSL_MAC_PARAM_DIGEST_ONESHOT "digest-oneshot"
|
||||||
|
# define OSSL_MAC_PARAM_D_ROUNDS "d-rounds"
|
||||||
|
# define OSSL_MAC_PARAM_FIPS_APPROVED_INDICATOR OSSL_ALG_PARAM_FIPS_APPROVED_INDICATOR
|
||||||
|
# define OSSL_MAC_PARAM_FIPS_KEY_CHECK OSSL_PKEY_PARAM_FIPS_KEY_CHECK
|
||||||
|
# define OSSL_MAC_PARAM_FIPS_NO_SHORT_MAC OSSL_PROV_PARAM_NO_SHORT_MAC
|
||||||
|
# define OSSL_MAC_PARAM_IV "iv"
|
||||||
|
# define OSSL_MAC_PARAM_KEY "key"
|
||||||
|
# define OSSL_MAC_PARAM_PROPERTIES OSSL_ALG_PARAM_PROPERTIES
|
||||||
|
# define OSSL_MAC_PARAM_SALT "salt"
|
||||||
|
# define OSSL_MAC_PARAM_SIZE "size"
|
||||||
|
# define OSSL_MAC_PARAM_TLS_DATA_SIZE "tls-data-size"
|
||||||
|
# define OSSL_MAC_PARAM_XOF "xof"
|
||||||
|
# define OSSL_OBJECT_PARAM_DATA "data"
|
||||||
|
# define OSSL_OBJECT_PARAM_DATA_STRUCTURE "data-structure"
|
||||||
|
# define OSSL_OBJECT_PARAM_DATA_TYPE "data-type"
|
||||||
|
# define OSSL_OBJECT_PARAM_DESC "desc"
|
||||||
|
# define OSSL_OBJECT_PARAM_INPUT_TYPE "input-type"
|
||||||
|
# define OSSL_OBJECT_PARAM_REFERENCE "reference"
|
||||||
|
# define OSSL_OBJECT_PARAM_TYPE "type"
|
||||||
|
# define OSSL_PASSPHRASE_PARAM_INFO "info"
|
||||||
|
# define OSSL_PKEY_PARAM_ALGORITHM_ID OSSL_ALG_PARAM_ALGORITHM_ID
|
||||||
|
# define OSSL_PKEY_PARAM_ALGORITHM_ID_PARAMS OSSL_ALG_PARAM_ALGORITHM_ID_PARAMS
|
||||||
|
# define OSSL_PKEY_PARAM_BITS "bits"
|
||||||
|
# define OSSL_PKEY_PARAM_CIPHER OSSL_ALG_PARAM_CIPHER
|
||||||
|
# define OSSL_PKEY_PARAM_DEFAULT_DIGEST "default-digest"
|
||||||
|
# define OSSL_PKEY_PARAM_DHKEM_IKM "dhkem-ikm"
|
||||||
|
# define OSSL_PKEY_PARAM_DH_GENERATOR "safeprime-generator"
|
||||||
|
# define OSSL_PKEY_PARAM_DH_PRIV_LEN "priv_len"
|
||||||
|
# define OSSL_PKEY_PARAM_DIGEST OSSL_ALG_PARAM_DIGEST
|
||||||
|
# define OSSL_PKEY_PARAM_DIGEST_SIZE "digest-size"
|
||||||
|
# define OSSL_PKEY_PARAM_DIST_ID "distid"
|
||||||
|
# define OSSL_PKEY_PARAM_EC_A "a"
|
||||||
|
# define OSSL_PKEY_PARAM_EC_B "b"
|
||||||
|
# define OSSL_PKEY_PARAM_EC_CHAR2_M "m"
|
||||||
|
# define OSSL_PKEY_PARAM_EC_CHAR2_PP_K1 "k1"
|
||||||
|
# define OSSL_PKEY_PARAM_EC_CHAR2_PP_K2 "k2"
|
||||||
|
# define OSSL_PKEY_PARAM_EC_CHAR2_PP_K3 "k3"
|
||||||
|
# define OSSL_PKEY_PARAM_EC_CHAR2_TP_BASIS "tp"
|
||||||
|
# define OSSL_PKEY_PARAM_EC_CHAR2_TYPE "basis-type"
|
||||||
|
# define OSSL_PKEY_PARAM_EC_COFACTOR "cofactor"
|
||||||
|
# define OSSL_PKEY_PARAM_EC_DECODED_FROM_EXPLICIT_PARAMS "decoded-from-explicit"
|
||||||
|
# define OSSL_PKEY_PARAM_EC_ENCODING "encoding"
|
||||||
|
# define OSSL_PKEY_PARAM_EC_FIELD_TYPE "field-type"
|
||||||
|
# define OSSL_PKEY_PARAM_EC_GENERATOR "generator"
|
||||||
|
# define OSSL_PKEY_PARAM_EC_GROUP_CHECK_TYPE "group-check"
|
||||||
|
# define OSSL_PKEY_PARAM_EC_INCLUDE_PUBLIC "include-public"
|
||||||
|
# define OSSL_PKEY_PARAM_EC_ORDER "order"
|
||||||
|
# define OSSL_PKEY_PARAM_EC_P "p"
|
||||||
|
# define OSSL_PKEY_PARAM_EC_POINT_CONVERSION_FORMAT "point-format"
|
||||||
|
# define OSSL_PKEY_PARAM_EC_PUB_X "qx"
|
||||||
|
# define OSSL_PKEY_PARAM_EC_PUB_Y "qy"
|
||||||
|
# define OSSL_PKEY_PARAM_EC_SEED "seed"
|
||||||
|
# define OSSL_PKEY_PARAM_ENCODED_PUBLIC_KEY "encoded-pub-key"
|
||||||
|
# define OSSL_PKEY_PARAM_ENGINE OSSL_ALG_PARAM_ENGINE
|
||||||
|
# define OSSL_PKEY_PARAM_FFC_COFACTOR "j"
|
||||||
|
# define OSSL_PKEY_PARAM_FFC_DIGEST OSSL_PKEY_PARAM_DIGEST
|
||||||
|
# define OSSL_PKEY_PARAM_FFC_DIGEST_PROPS OSSL_PKEY_PARAM_PROPERTIES
|
||||||
|
# define OSSL_PKEY_PARAM_FFC_G "g"
|
||||||
|
# define OSSL_PKEY_PARAM_FFC_GINDEX "gindex"
|
||||||
|
# define OSSL_PKEY_PARAM_FFC_H "hindex"
|
||||||
|
# define OSSL_PKEY_PARAM_FFC_P "p"
|
||||||
|
# define OSSL_PKEY_PARAM_FFC_PBITS "pbits"
|
||||||
|
# define OSSL_PKEY_PARAM_FFC_PCOUNTER "pcounter"
|
||||||
|
# define OSSL_PKEY_PARAM_FFC_Q "q"
|
||||||
|
# define OSSL_PKEY_PARAM_FFC_QBITS "qbits"
|
||||||
|
# define OSSL_PKEY_PARAM_FFC_SEED "seed"
|
||||||
|
# define OSSL_PKEY_PARAM_FFC_TYPE "type"
|
||||||
|
# define OSSL_PKEY_PARAM_FFC_VALIDATE_G "validate-g"
|
||||||
|
# define OSSL_PKEY_PARAM_FFC_VALIDATE_LEGACY "validate-legacy"
|
||||||
|
# define OSSL_PKEY_PARAM_FFC_VALIDATE_PQ "validate-pq"
|
||||||
|
# define OSSL_PKEY_PARAM_FIPS_APPROVED_INDICATOR OSSL_ALG_PARAM_FIPS_APPROVED_INDICATOR
|
||||||
|
# define OSSL_PKEY_PARAM_FIPS_DIGEST_CHECK "digest-check"
|
||||||
|
# define OSSL_PKEY_PARAM_FIPS_KEY_CHECK "key-check"
|
||||||
|
# define OSSL_PKEY_PARAM_FIPS_SIGN_CHECK "sign-check"
|
||||||
|
# define OSSL_PKEY_PARAM_GROUP_NAME "group"
|
||||||
|
# define OSSL_PKEY_PARAM_IMPLICIT_REJECTION "implicit-rejection"
|
||||||
|
# define OSSL_PKEY_PARAM_MANDATORY_DIGEST "mandatory-digest"
|
||||||
|
# define OSSL_PKEY_PARAM_MASKGENFUNC "mgf"
|
||||||
|
# define OSSL_PKEY_PARAM_MAX_SIZE "max-size"
|
||||||
|
# define OSSL_PKEY_PARAM_MGF1_DIGEST "mgf1-digest"
|
||||||
|
# define OSSL_PKEY_PARAM_MGF1_PROPERTIES "mgf1-properties"
|
||||||
|
# define OSSL_PKEY_PARAM_ML_DSA_INPUT_FORMATS "ml-dsa.input_formats"
|
||||||
|
# define OSSL_PKEY_PARAM_ML_DSA_OUTPUT_FORMATS "ml-dsa.output_formats"
|
||||||
|
# define OSSL_PKEY_PARAM_ML_DSA_PREFER_SEED "ml-dsa.prefer_seed"
|
||||||
|
# define OSSL_PKEY_PARAM_ML_DSA_RETAIN_SEED "ml-dsa.retain_seed"
|
||||||
|
# define OSSL_PKEY_PARAM_ML_DSA_SEED "seed"
|
||||||
|
# define OSSL_PKEY_PARAM_ML_KEM_IMPORT_PCT_TYPE "ml-kem.import_pct_type"
|
||||||
|
# define OSSL_PKEY_PARAM_ML_KEM_INPUT_FORMATS "ml-kem.input_formats"
|
||||||
|
# define OSSL_PKEY_PARAM_ML_KEM_OUTPUT_FORMATS "ml-kem.output_formats"
|
||||||
|
# define OSSL_PKEY_PARAM_ML_KEM_PREFER_SEED "ml-kem.prefer_seed"
|
||||||
|
# define OSSL_PKEY_PARAM_ML_KEM_RETAIN_SEED "ml-kem.retain_seed"
|
||||||
|
# define OSSL_PKEY_PARAM_ML_KEM_SEED "seed"
|
||||||
|
# define OSSL_PKEY_PARAM_PAD_MODE "pad-mode"
|
||||||
|
# define OSSL_PKEY_PARAM_PRIV_KEY "priv"
|
||||||
|
# define OSSL_PKEY_PARAM_PROPERTIES OSSL_ALG_PARAM_PROPERTIES
|
||||||
|
# define OSSL_PKEY_PARAM_PUB_KEY "pub"
|
||||||
|
# define OSSL_PKEY_PARAM_RSA_BITS OSSL_PKEY_PARAM_BITS
|
||||||
|
# define OSSL_PKEY_PARAM_RSA_COEFFICIENT "rsa-coefficient"
|
||||||
|
# define OSSL_PKEY_PARAM_RSA_COEFFICIENT1 "rsa-coefficient1"
|
||||||
|
# define OSSL_PKEY_PARAM_RSA_COEFFICIENT2 "rsa-coefficient2"
|
||||||
|
# define OSSL_PKEY_PARAM_RSA_COEFFICIENT3 "rsa-coefficient3"
|
||||||
|
# define OSSL_PKEY_PARAM_RSA_COEFFICIENT4 "rsa-coefficient4"
|
||||||
|
# define OSSL_PKEY_PARAM_RSA_COEFFICIENT5 "rsa-coefficient5"
|
||||||
|
# define OSSL_PKEY_PARAM_RSA_COEFFICIENT6 "rsa-coefficient6"
|
||||||
|
# define OSSL_PKEY_PARAM_RSA_COEFFICIENT7 "rsa-coefficient7"
|
||||||
|
# define OSSL_PKEY_PARAM_RSA_COEFFICIENT8 "rsa-coefficient8"
|
||||||
|
# define OSSL_PKEY_PARAM_RSA_COEFFICIENT9 "rsa-coefficient9"
|
||||||
|
# define OSSL_PKEY_PARAM_RSA_D "d"
|
||||||
|
# define OSSL_PKEY_PARAM_RSA_DERIVE_FROM_PQ "rsa-derive-from-pq"
|
||||||
|
# define OSSL_PKEY_PARAM_RSA_DIGEST OSSL_PKEY_PARAM_DIGEST
|
||||||
|
# define OSSL_PKEY_PARAM_RSA_DIGEST_PROPS OSSL_PKEY_PARAM_PROPERTIES
|
||||||
|
# define OSSL_PKEY_PARAM_RSA_E "e"
|
||||||
|
# define OSSL_PKEY_PARAM_RSA_EXPONENT "rsa-exponent"
|
||||||
|
# define OSSL_PKEY_PARAM_RSA_EXPONENT1 "rsa-exponent1"
|
||||||
|
# define OSSL_PKEY_PARAM_RSA_EXPONENT10 "rsa-exponent10"
|
||||||
|
# define OSSL_PKEY_PARAM_RSA_EXPONENT2 "rsa-exponent2"
|
||||||
|
# define OSSL_PKEY_PARAM_RSA_EXPONENT3 "rsa-exponent3"
|
||||||
|
# define OSSL_PKEY_PARAM_RSA_EXPONENT4 "rsa-exponent4"
|
||||||
|
# define OSSL_PKEY_PARAM_RSA_EXPONENT5 "rsa-exponent5"
|
||||||
|
# define OSSL_PKEY_PARAM_RSA_EXPONENT6 "rsa-exponent6"
|
||||||
|
# define OSSL_PKEY_PARAM_RSA_EXPONENT7 "rsa-exponent7"
|
||||||
|
# define OSSL_PKEY_PARAM_RSA_EXPONENT8 "rsa-exponent8"
|
||||||
|
# define OSSL_PKEY_PARAM_RSA_EXPONENT9 "rsa-exponent9"
|
||||||
|
# define OSSL_PKEY_PARAM_RSA_FACTOR "rsa-factor"
|
||||||
|
# define OSSL_PKEY_PARAM_RSA_FACTOR1 "rsa-factor1"
|
||||||
|
# define OSSL_PKEY_PARAM_RSA_FACTOR10 "rsa-factor10"
|
||||||
|
# define OSSL_PKEY_PARAM_RSA_FACTOR2 "rsa-factor2"
|
||||||
|
# define OSSL_PKEY_PARAM_RSA_FACTOR3 "rsa-factor3"
|
||||||
|
# define OSSL_PKEY_PARAM_RSA_FACTOR4 "rsa-factor4"
|
||||||
|
# define OSSL_PKEY_PARAM_RSA_FACTOR5 "rsa-factor5"
|
||||||
|
# define OSSL_PKEY_PARAM_RSA_FACTOR6 "rsa-factor6"
|
||||||
|
# define OSSL_PKEY_PARAM_RSA_FACTOR7 "rsa-factor7"
|
||||||
|
# define OSSL_PKEY_PARAM_RSA_FACTOR8 "rsa-factor8"
|
||||||
|
# define OSSL_PKEY_PARAM_RSA_FACTOR9 "rsa-factor9"
|
||||||
|
# define OSSL_PKEY_PARAM_RSA_MASKGENFUNC OSSL_PKEY_PARAM_MASKGENFUNC
|
||||||
|
# define OSSL_PKEY_PARAM_RSA_MGF1_DIGEST OSSL_PKEY_PARAM_MGF1_DIGEST
|
||||||
|
# define OSSL_PKEY_PARAM_RSA_N "n"
|
||||||
|
# define OSSL_PKEY_PARAM_RSA_PRIMES "primes"
|
||||||
|
# define OSSL_PKEY_PARAM_RSA_PSS_SALTLEN "saltlen"
|
||||||
|
# define OSSL_PKEY_PARAM_RSA_TEST_P1 "p1"
|
||||||
|
# define OSSL_PKEY_PARAM_RSA_TEST_P2 "p2"
|
||||||
|
# define OSSL_PKEY_PARAM_RSA_TEST_Q1 "q1"
|
||||||
|
# define OSSL_PKEY_PARAM_RSA_TEST_Q2 "q2"
|
||||||
|
# define OSSL_PKEY_PARAM_RSA_TEST_XP "xp"
|
||||||
|
# define OSSL_PKEY_PARAM_RSA_TEST_XP1 "xp1"
|
||||||
|
# define OSSL_PKEY_PARAM_RSA_TEST_XP2 "xp2"
|
||||||
|
# define OSSL_PKEY_PARAM_RSA_TEST_XQ "xq"
|
||||||
|
# define OSSL_PKEY_PARAM_RSA_TEST_XQ1 "xq1"
|
||||||
|
# define OSSL_PKEY_PARAM_RSA_TEST_XQ2 "xq2"
|
||||||
|
# define OSSL_PKEY_PARAM_SECURITY_BITS "security-bits"
|
||||||
|
# define OSSL_PKEY_PARAM_SLH_DSA_SEED "seed"
|
||||||
|
# define OSSL_PKEY_PARAM_USE_COFACTOR_ECDH OSSL_PKEY_PARAM_USE_COFACTOR_FLAG
|
||||||
|
# define OSSL_PKEY_PARAM_USE_COFACTOR_FLAG "use-cofactor-flag"
|
||||||
|
# define OSSL_PROV_PARAM_BUILDINFO "buildinfo"
|
||||||
|
# define OSSL_PROV_PARAM_CORE_MODULE_FILENAME "module-filename"
|
||||||
|
# define OSSL_PROV_PARAM_CORE_PROV_NAME "provider-name"
|
||||||
|
# define OSSL_PROV_PARAM_CORE_VERSION "openssl-version"
|
||||||
|
# define OSSL_PROV_PARAM_DRBG_TRUNC_DIGEST "drbg-no-trunc-md"
|
||||||
|
# define OSSL_PROV_PARAM_DSA_SIGN_DISABLED "dsa-sign-disabled"
|
||||||
|
# define OSSL_PROV_PARAM_ECDH_COFACTOR_CHECK "ecdh-cofactor-check"
|
||||||
|
# define OSSL_PROV_PARAM_HKDF_DIGEST_CHECK "hkdf-digest-check"
|
||||||
|
# define OSSL_PROV_PARAM_HKDF_KEY_CHECK "hkdf-key-check"
|
||||||
|
# define OSSL_PROV_PARAM_HMAC_KEY_CHECK "hmac-key-check"
|
||||||
|
# define OSSL_PROV_PARAM_KBKDF_KEY_CHECK "kbkdf-key-check"
|
||||||
|
# define OSSL_PROV_PARAM_KMAC_KEY_CHECK "kmac-key-check"
|
||||||
|
# define OSSL_PROV_PARAM_NAME "name"
|
||||||
|
# define OSSL_PROV_PARAM_NO_SHORT_MAC "no-short-mac"
|
||||||
|
# define OSSL_PROV_PARAM_PBKDF2_LOWER_BOUND_CHECK "pbkdf2-lower-bound-check"
|
||||||
|
# define OSSL_PROV_PARAM_RSA_PKCS15_PAD_DISABLED "rsa-pkcs15-pad-disabled"
|
||||||
|
# define OSSL_PROV_PARAM_RSA_PSS_SALTLEN_CHECK "rsa-pss-saltlen-check"
|
||||||
|
# define OSSL_PROV_PARAM_RSA_SIGN_X931_PAD_DISABLED "rsa-sign-x931-pad-disabled"
|
||||||
|
# define OSSL_PROV_PARAM_SECURITY_CHECKS "security-checks"
|
||||||
|
# define OSSL_PROV_PARAM_SELF_TEST_DESC "st-desc"
|
||||||
|
# define OSSL_PROV_PARAM_SELF_TEST_PHASE "st-phase"
|
||||||
|
# define OSSL_PROV_PARAM_SELF_TEST_TYPE "st-type"
|
||||||
|
# define OSSL_PROV_PARAM_SIGNATURE_DIGEST_CHECK "signature-digest-check"
|
||||||
|
# define OSSL_PROV_PARAM_SSHKDF_DIGEST_CHECK "sshkdf-digest-check"
|
||||||
|
# define OSSL_PROV_PARAM_SSHKDF_KEY_CHECK "sshkdf-key-check"
|
||||||
|
# define OSSL_PROV_PARAM_SSKDF_DIGEST_CHECK "sskdf-digest-check"
|
||||||
|
# define OSSL_PROV_PARAM_SSKDF_KEY_CHECK "sskdf-key-check"
|
||||||
|
# define OSSL_PROV_PARAM_STATUS "status"
|
||||||
|
# define OSSL_PROV_PARAM_TDES_ENCRYPT_DISABLED "tdes-encrypt-disabled"
|
||||||
|
# define OSSL_PROV_PARAM_TLS13_KDF_DIGEST_CHECK "tls13-kdf-digest-check"
|
||||||
|
# define OSSL_PROV_PARAM_TLS13_KDF_KEY_CHECK "tls13-kdf-key-check"
|
||||||
|
# define OSSL_PROV_PARAM_TLS1_PRF_DIGEST_CHECK "tls1-prf-digest-check"
|
||||||
|
# define OSSL_PROV_PARAM_TLS1_PRF_EMS_CHECK "tls1-prf-ems-check"
|
||||||
|
# define OSSL_PROV_PARAM_TLS1_PRF_KEY_CHECK "tls1-prf-key-check"
|
||||||
|
# define OSSL_PROV_PARAM_VERSION "version"
|
||||||
|
# define OSSL_PROV_PARAM_X942KDF_KEY_CHECK "x942kdf-key-check"
|
||||||
|
# define OSSL_PROV_PARAM_X963KDF_DIGEST_CHECK "x963kdf-digest-check"
|
||||||
|
# define OSSL_PROV_PARAM_X963KDF_KEY_CHECK "x963kdf-key-check"
|
||||||
|
# define OSSL_RAND_PARAM_FIPS_APPROVED_INDICATOR OSSL_ALG_PARAM_FIPS_APPROVED_INDICATOR
|
||||||
|
# define OSSL_RAND_PARAM_GENERATE "generate"
|
||||||
|
# define OSSL_RAND_PARAM_MAX_REQUEST "max_request"
|
||||||
|
# define OSSL_RAND_PARAM_STATE "state"
|
||||||
|
# define OSSL_RAND_PARAM_STRENGTH "strength"
|
||||||
|
# define OSSL_RAND_PARAM_TEST_ENTROPY "test_entropy"
|
||||||
|
# define OSSL_RAND_PARAM_TEST_NONCE "test_nonce"
|
||||||
|
# define OSSL_SIGNATURE_PARAM_ADD_RANDOM "additional-random"
|
||||||
|
# define OSSL_SIGNATURE_PARAM_ALGORITHM_ID OSSL_PKEY_PARAM_ALGORITHM_ID
|
||||||
|
# define OSSL_SIGNATURE_PARAM_ALGORITHM_ID_PARAMS OSSL_PKEY_PARAM_ALGORITHM_ID_PARAMS
|
||||||
|
# define OSSL_SIGNATURE_PARAM_CONTEXT_STRING "context-string"
|
||||||
|
# define OSSL_SIGNATURE_PARAM_DETERMINISTIC "deterministic"
|
||||||
|
# define OSSL_SIGNATURE_PARAM_DIGEST OSSL_PKEY_PARAM_DIGEST
|
||||||
|
# define OSSL_SIGNATURE_PARAM_DIGEST_SIZE OSSL_PKEY_PARAM_DIGEST_SIZE
|
||||||
|
# define OSSL_SIGNATURE_PARAM_FIPS_APPROVED_INDICATOR OSSL_ALG_PARAM_FIPS_APPROVED_INDICATOR
|
||||||
|
# define OSSL_SIGNATURE_PARAM_FIPS_DIGEST_CHECK OSSL_PKEY_PARAM_FIPS_DIGEST_CHECK
|
||||||
|
# define OSSL_SIGNATURE_PARAM_FIPS_KEY_CHECK OSSL_PKEY_PARAM_FIPS_KEY_CHECK
|
||||||
|
# define OSSL_SIGNATURE_PARAM_FIPS_RSA_PSS_SALTLEN_CHECK "rsa-pss-saltlen-check"
|
||||||
|
# define OSSL_SIGNATURE_PARAM_FIPS_SIGN_CHECK OSSL_PKEY_PARAM_FIPS_SIGN_CHECK
|
||||||
|
# define OSSL_SIGNATURE_PARAM_FIPS_SIGN_X931_PAD_CHECK "sign-x931-pad-check"
|
||||||
|
# define OSSL_SIGNATURE_PARAM_FIPS_VERIFY_MESSAGE "verify-message"
|
||||||
|
# define OSSL_SIGNATURE_PARAM_INSTANCE "instance"
|
||||||
|
# define OSSL_SIGNATURE_PARAM_KAT "kat"
|
||||||
|
# define OSSL_SIGNATURE_PARAM_MESSAGE_ENCODING "message-encoding"
|
||||||
|
# define OSSL_SIGNATURE_PARAM_MGF1_DIGEST OSSL_PKEY_PARAM_MGF1_DIGEST
|
||||||
|
# define OSSL_SIGNATURE_PARAM_MGF1_PROPERTIES OSSL_PKEY_PARAM_MGF1_PROPERTIES
|
||||||
|
# define OSSL_SIGNATURE_PARAM_MU "mu"
|
||||||
|
# define OSSL_SIGNATURE_PARAM_NONCE_TYPE "nonce-type"
|
||||||
|
# define OSSL_SIGNATURE_PARAM_PAD_MODE OSSL_PKEY_PARAM_PAD_MODE
|
||||||
|
# define OSSL_SIGNATURE_PARAM_PROPERTIES OSSL_PKEY_PARAM_PROPERTIES
|
||||||
|
# define OSSL_SIGNATURE_PARAM_PSS_SALTLEN "saltlen"
|
||||||
|
# define OSSL_SIGNATURE_PARAM_SIGNATURE "signature"
|
||||||
|
# define OSSL_SIGNATURE_PARAM_TEST_ENTROPY "test-entropy"
|
||||||
|
# define OSSL_SKEY_PARAM_KEY_LENGTH "key-length"
|
||||||
|
# define OSSL_SKEY_PARAM_RAW_BYTES "raw-bytes"
|
||||||
|
# define OSSL_STORE_PARAM_ALIAS "alias"
|
||||||
|
# define OSSL_STORE_PARAM_DIGEST "digest"
|
||||||
|
# define OSSL_STORE_PARAM_EXPECT "expect"
|
||||||
|
# define OSSL_STORE_PARAM_FINGERPRINT "fingerprint"
|
||||||
|
# define OSSL_STORE_PARAM_INPUT_TYPE "input-type"
|
||||||
|
# define OSSL_STORE_PARAM_ISSUER "name"
|
||||||
|
# define OSSL_STORE_PARAM_PROPERTIES "properties"
|
||||||
|
# define OSSL_STORE_PARAM_SERIAL "serial"
|
||||||
|
# define OSSL_STORE_PARAM_SUBJECT "subject"
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2020-2021 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef OPENSSL_CORE_OBJECT_H
|
||||||
|
# define OPENSSL_CORE_OBJECT_H
|
||||||
|
# pragma once
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/*-
|
||||||
|
* Known object types
|
||||||
|
*
|
||||||
|
* These numbers are used as values for the OSSL_PARAM parameter
|
||||||
|
* OSSL_OBJECT_PARAM_TYPE.
|
||||||
|
*
|
||||||
|
* For most of these types, there's a corresponding libcrypto object type.
|
||||||
|
* The corresponding type is indicated with a comment after the number.
|
||||||
|
*/
|
||||||
|
# define OSSL_OBJECT_UNKNOWN 0
|
||||||
|
# define OSSL_OBJECT_NAME 1 /* char * */
|
||||||
|
# define OSSL_OBJECT_PKEY 2 /* EVP_PKEY * */
|
||||||
|
# define OSSL_OBJECT_CERT 3 /* X509 * */
|
||||||
|
# define OSSL_OBJECT_CRL 4 /* X509_CRL * */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The rest of the associated OSSL_PARAM elements is described in core_names.h
|
||||||
|
*/
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,278 @@
|
|||||||
|
/*-
|
||||||
|
* WARNING: do not edit!
|
||||||
|
* Generated by Makefile from ../../openssl-3.5.0/include/openssl/crmf.h.in
|
||||||
|
*
|
||||||
|
* Copyright 2007-2025 The OpenSSL Project Authors. All Rights Reserved.
|
||||||
|
* Copyright Nokia 2007-2019
|
||||||
|
* Copyright Siemens AG 2015-2019
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*
|
||||||
|
* CRMF (RFC 4211) implementation by M. Peylo, M. Viljanen, and D. von Oheimb.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef OPENSSL_CRMF_H
|
||||||
|
# define OPENSSL_CRMF_H
|
||||||
|
|
||||||
|
# include <openssl/opensslconf.h>
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_CRMF
|
||||||
|
# include <openssl/opensslv.h>
|
||||||
|
# include <openssl/safestack.h>
|
||||||
|
# include <openssl/crmferr.h>
|
||||||
|
# include <openssl/x509v3.h> /* for GENERAL_NAME etc. */
|
||||||
|
# include <openssl/cms.h>
|
||||||
|
|
||||||
|
/* explicit #includes not strictly needed since implied by the above: */
|
||||||
|
# include <openssl/types.h>
|
||||||
|
# include <openssl/x509.h>
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# define OSSL_CRMF_POPOPRIVKEY_THISMESSAGE 0
|
||||||
|
# define OSSL_CRMF_POPOPRIVKEY_SUBSEQUENTMESSAGE 1
|
||||||
|
# define OSSL_CRMF_POPOPRIVKEY_DHMAC 2
|
||||||
|
# define OSSL_CRMF_POPOPRIVKEY_AGREEMAC 3
|
||||||
|
# define OSSL_CRMF_POPOPRIVKEY_ENCRYPTEDKEY 4
|
||||||
|
|
||||||
|
# define OSSL_CRMF_SUBSEQUENTMESSAGE_ENCRCERT 0
|
||||||
|
# define OSSL_CRMF_SUBSEQUENTMESSAGE_CHALLENGERESP 1
|
||||||
|
typedef struct ossl_crmf_encryptedvalue_st OSSL_CRMF_ENCRYPTEDVALUE;
|
||||||
|
DECLARE_ASN1_FUNCTIONS(OSSL_CRMF_ENCRYPTEDVALUE)
|
||||||
|
|
||||||
|
typedef struct ossl_crmf_encryptedkey_st OSSL_CRMF_ENCRYPTEDKEY;
|
||||||
|
DECLARE_ASN1_FUNCTIONS(OSSL_CRMF_ENCRYPTEDKEY)
|
||||||
|
|
||||||
|
typedef struct ossl_crmf_msg_st OSSL_CRMF_MSG;
|
||||||
|
DECLARE_ASN1_FUNCTIONS(OSSL_CRMF_MSG)
|
||||||
|
DECLARE_ASN1_DUP_FUNCTION(OSSL_CRMF_MSG)
|
||||||
|
SKM_DEFINE_STACK_OF_INTERNAL(OSSL_CRMF_MSG, OSSL_CRMF_MSG, OSSL_CRMF_MSG)
|
||||||
|
#define sk_OSSL_CRMF_MSG_num(sk) OPENSSL_sk_num(ossl_check_const_OSSL_CRMF_MSG_sk_type(sk))
|
||||||
|
#define sk_OSSL_CRMF_MSG_value(sk, idx) ((OSSL_CRMF_MSG *)OPENSSL_sk_value(ossl_check_const_OSSL_CRMF_MSG_sk_type(sk), (idx)))
|
||||||
|
#define sk_OSSL_CRMF_MSG_new(cmp) ((STACK_OF(OSSL_CRMF_MSG) *)OPENSSL_sk_new(ossl_check_OSSL_CRMF_MSG_compfunc_type(cmp)))
|
||||||
|
#define sk_OSSL_CRMF_MSG_new_null() ((STACK_OF(OSSL_CRMF_MSG) *)OPENSSL_sk_new_null())
|
||||||
|
#define sk_OSSL_CRMF_MSG_new_reserve(cmp, n) ((STACK_OF(OSSL_CRMF_MSG) *)OPENSSL_sk_new_reserve(ossl_check_OSSL_CRMF_MSG_compfunc_type(cmp), (n)))
|
||||||
|
#define sk_OSSL_CRMF_MSG_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_OSSL_CRMF_MSG_sk_type(sk), (n))
|
||||||
|
#define sk_OSSL_CRMF_MSG_free(sk) OPENSSL_sk_free(ossl_check_OSSL_CRMF_MSG_sk_type(sk))
|
||||||
|
#define sk_OSSL_CRMF_MSG_zero(sk) OPENSSL_sk_zero(ossl_check_OSSL_CRMF_MSG_sk_type(sk))
|
||||||
|
#define sk_OSSL_CRMF_MSG_delete(sk, i) ((OSSL_CRMF_MSG *)OPENSSL_sk_delete(ossl_check_OSSL_CRMF_MSG_sk_type(sk), (i)))
|
||||||
|
#define sk_OSSL_CRMF_MSG_delete_ptr(sk, ptr) ((OSSL_CRMF_MSG *)OPENSSL_sk_delete_ptr(ossl_check_OSSL_CRMF_MSG_sk_type(sk), ossl_check_OSSL_CRMF_MSG_type(ptr)))
|
||||||
|
#define sk_OSSL_CRMF_MSG_push(sk, ptr) OPENSSL_sk_push(ossl_check_OSSL_CRMF_MSG_sk_type(sk), ossl_check_OSSL_CRMF_MSG_type(ptr))
|
||||||
|
#define sk_OSSL_CRMF_MSG_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_OSSL_CRMF_MSG_sk_type(sk), ossl_check_OSSL_CRMF_MSG_type(ptr))
|
||||||
|
#define sk_OSSL_CRMF_MSG_pop(sk) ((OSSL_CRMF_MSG *)OPENSSL_sk_pop(ossl_check_OSSL_CRMF_MSG_sk_type(sk)))
|
||||||
|
#define sk_OSSL_CRMF_MSG_shift(sk) ((OSSL_CRMF_MSG *)OPENSSL_sk_shift(ossl_check_OSSL_CRMF_MSG_sk_type(sk)))
|
||||||
|
#define sk_OSSL_CRMF_MSG_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_OSSL_CRMF_MSG_sk_type(sk),ossl_check_OSSL_CRMF_MSG_freefunc_type(freefunc))
|
||||||
|
#define sk_OSSL_CRMF_MSG_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_OSSL_CRMF_MSG_sk_type(sk), ossl_check_OSSL_CRMF_MSG_type(ptr), (idx))
|
||||||
|
#define sk_OSSL_CRMF_MSG_set(sk, idx, ptr) ((OSSL_CRMF_MSG *)OPENSSL_sk_set(ossl_check_OSSL_CRMF_MSG_sk_type(sk), (idx), ossl_check_OSSL_CRMF_MSG_type(ptr)))
|
||||||
|
#define sk_OSSL_CRMF_MSG_find(sk, ptr) OPENSSL_sk_find(ossl_check_OSSL_CRMF_MSG_sk_type(sk), ossl_check_OSSL_CRMF_MSG_type(ptr))
|
||||||
|
#define sk_OSSL_CRMF_MSG_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_OSSL_CRMF_MSG_sk_type(sk), ossl_check_OSSL_CRMF_MSG_type(ptr))
|
||||||
|
#define sk_OSSL_CRMF_MSG_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_OSSL_CRMF_MSG_sk_type(sk), ossl_check_OSSL_CRMF_MSG_type(ptr), pnum)
|
||||||
|
#define sk_OSSL_CRMF_MSG_sort(sk) OPENSSL_sk_sort(ossl_check_OSSL_CRMF_MSG_sk_type(sk))
|
||||||
|
#define sk_OSSL_CRMF_MSG_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_OSSL_CRMF_MSG_sk_type(sk))
|
||||||
|
#define sk_OSSL_CRMF_MSG_dup(sk) ((STACK_OF(OSSL_CRMF_MSG) *)OPENSSL_sk_dup(ossl_check_const_OSSL_CRMF_MSG_sk_type(sk)))
|
||||||
|
#define sk_OSSL_CRMF_MSG_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(OSSL_CRMF_MSG) *)OPENSSL_sk_deep_copy(ossl_check_const_OSSL_CRMF_MSG_sk_type(sk), ossl_check_OSSL_CRMF_MSG_copyfunc_type(copyfunc), ossl_check_OSSL_CRMF_MSG_freefunc_type(freefunc)))
|
||||||
|
#define sk_OSSL_CRMF_MSG_set_cmp_func(sk, cmp) ((sk_OSSL_CRMF_MSG_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_OSSL_CRMF_MSG_sk_type(sk), ossl_check_OSSL_CRMF_MSG_compfunc_type(cmp)))
|
||||||
|
|
||||||
|
typedef struct ossl_crmf_attributetypeandvalue_st OSSL_CRMF_ATTRIBUTETYPEANDVALUE;
|
||||||
|
void OSSL_CRMF_ATTRIBUTETYPEANDVALUE_free(OSSL_CRMF_ATTRIBUTETYPEANDVALUE *v);
|
||||||
|
DECLARE_ASN1_DUP_FUNCTION(OSSL_CRMF_ATTRIBUTETYPEANDVALUE)
|
||||||
|
SKM_DEFINE_STACK_OF_INTERNAL(OSSL_CRMF_ATTRIBUTETYPEANDVALUE, OSSL_CRMF_ATTRIBUTETYPEANDVALUE, OSSL_CRMF_ATTRIBUTETYPEANDVALUE)
|
||||||
|
#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_num(sk) OPENSSL_sk_num(ossl_check_const_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_sk_type(sk))
|
||||||
|
#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_value(sk, idx) ((OSSL_CRMF_ATTRIBUTETYPEANDVALUE *)OPENSSL_sk_value(ossl_check_const_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_sk_type(sk), (idx)))
|
||||||
|
#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_new(cmp) ((STACK_OF(OSSL_CRMF_ATTRIBUTETYPEANDVALUE) *)OPENSSL_sk_new(ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_compfunc_type(cmp)))
|
||||||
|
#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_new_null() ((STACK_OF(OSSL_CRMF_ATTRIBUTETYPEANDVALUE) *)OPENSSL_sk_new_null())
|
||||||
|
#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_new_reserve(cmp, n) ((STACK_OF(OSSL_CRMF_ATTRIBUTETYPEANDVALUE) *)OPENSSL_sk_new_reserve(ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_compfunc_type(cmp), (n)))
|
||||||
|
#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_sk_type(sk), (n))
|
||||||
|
#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_free(sk) OPENSSL_sk_free(ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_sk_type(sk))
|
||||||
|
#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_zero(sk) OPENSSL_sk_zero(ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_sk_type(sk))
|
||||||
|
#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_delete(sk, i) ((OSSL_CRMF_ATTRIBUTETYPEANDVALUE *)OPENSSL_sk_delete(ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_sk_type(sk), (i)))
|
||||||
|
#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_delete_ptr(sk, ptr) ((OSSL_CRMF_ATTRIBUTETYPEANDVALUE *)OPENSSL_sk_delete_ptr(ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_sk_type(sk), ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_type(ptr)))
|
||||||
|
#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_push(sk, ptr) OPENSSL_sk_push(ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_sk_type(sk), ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_type(ptr))
|
||||||
|
#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_sk_type(sk), ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_type(ptr))
|
||||||
|
#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_pop(sk) ((OSSL_CRMF_ATTRIBUTETYPEANDVALUE *)OPENSSL_sk_pop(ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_sk_type(sk)))
|
||||||
|
#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_shift(sk) ((OSSL_CRMF_ATTRIBUTETYPEANDVALUE *)OPENSSL_sk_shift(ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_sk_type(sk)))
|
||||||
|
#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_sk_type(sk),ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_freefunc_type(freefunc))
|
||||||
|
#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_sk_type(sk), ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_type(ptr), (idx))
|
||||||
|
#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_set(sk, idx, ptr) ((OSSL_CRMF_ATTRIBUTETYPEANDVALUE *)OPENSSL_sk_set(ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_sk_type(sk), (idx), ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_type(ptr)))
|
||||||
|
#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_find(sk, ptr) OPENSSL_sk_find(ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_sk_type(sk), ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_type(ptr))
|
||||||
|
#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_sk_type(sk), ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_type(ptr))
|
||||||
|
#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_sk_type(sk), ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_type(ptr), pnum)
|
||||||
|
#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_sort(sk) OPENSSL_sk_sort(ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_sk_type(sk))
|
||||||
|
#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_sk_type(sk))
|
||||||
|
#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_dup(sk) ((STACK_OF(OSSL_CRMF_ATTRIBUTETYPEANDVALUE) *)OPENSSL_sk_dup(ossl_check_const_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_sk_type(sk)))
|
||||||
|
#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(OSSL_CRMF_ATTRIBUTETYPEANDVALUE) *)OPENSSL_sk_deep_copy(ossl_check_const_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_sk_type(sk), ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_copyfunc_type(copyfunc), ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_freefunc_type(freefunc)))
|
||||||
|
#define sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_set_cmp_func(sk, cmp) ((sk_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_sk_type(sk), ossl_check_OSSL_CRMF_ATTRIBUTETYPEANDVALUE_compfunc_type(cmp)))
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct ossl_crmf_pbmparameter_st OSSL_CRMF_PBMPARAMETER;
|
||||||
|
DECLARE_ASN1_FUNCTIONS(OSSL_CRMF_PBMPARAMETER)
|
||||||
|
typedef struct ossl_crmf_poposigningkey_st OSSL_CRMF_POPOSIGNINGKEY;
|
||||||
|
typedef struct ossl_crmf_certrequest_st OSSL_CRMF_CERTREQUEST;
|
||||||
|
typedef struct ossl_crmf_certid_st OSSL_CRMF_CERTID;
|
||||||
|
DECLARE_ASN1_FUNCTIONS(OSSL_CRMF_CERTID)
|
||||||
|
DECLARE_ASN1_DUP_FUNCTION(OSSL_CRMF_CERTID)
|
||||||
|
SKM_DEFINE_STACK_OF_INTERNAL(OSSL_CRMF_CERTID, OSSL_CRMF_CERTID, OSSL_CRMF_CERTID)
|
||||||
|
#define sk_OSSL_CRMF_CERTID_num(sk) OPENSSL_sk_num(ossl_check_const_OSSL_CRMF_CERTID_sk_type(sk))
|
||||||
|
#define sk_OSSL_CRMF_CERTID_value(sk, idx) ((OSSL_CRMF_CERTID *)OPENSSL_sk_value(ossl_check_const_OSSL_CRMF_CERTID_sk_type(sk), (idx)))
|
||||||
|
#define sk_OSSL_CRMF_CERTID_new(cmp) ((STACK_OF(OSSL_CRMF_CERTID) *)OPENSSL_sk_new(ossl_check_OSSL_CRMF_CERTID_compfunc_type(cmp)))
|
||||||
|
#define sk_OSSL_CRMF_CERTID_new_null() ((STACK_OF(OSSL_CRMF_CERTID) *)OPENSSL_sk_new_null())
|
||||||
|
#define sk_OSSL_CRMF_CERTID_new_reserve(cmp, n) ((STACK_OF(OSSL_CRMF_CERTID) *)OPENSSL_sk_new_reserve(ossl_check_OSSL_CRMF_CERTID_compfunc_type(cmp), (n)))
|
||||||
|
#define sk_OSSL_CRMF_CERTID_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_OSSL_CRMF_CERTID_sk_type(sk), (n))
|
||||||
|
#define sk_OSSL_CRMF_CERTID_free(sk) OPENSSL_sk_free(ossl_check_OSSL_CRMF_CERTID_sk_type(sk))
|
||||||
|
#define sk_OSSL_CRMF_CERTID_zero(sk) OPENSSL_sk_zero(ossl_check_OSSL_CRMF_CERTID_sk_type(sk))
|
||||||
|
#define sk_OSSL_CRMF_CERTID_delete(sk, i) ((OSSL_CRMF_CERTID *)OPENSSL_sk_delete(ossl_check_OSSL_CRMF_CERTID_sk_type(sk), (i)))
|
||||||
|
#define sk_OSSL_CRMF_CERTID_delete_ptr(sk, ptr) ((OSSL_CRMF_CERTID *)OPENSSL_sk_delete_ptr(ossl_check_OSSL_CRMF_CERTID_sk_type(sk), ossl_check_OSSL_CRMF_CERTID_type(ptr)))
|
||||||
|
#define sk_OSSL_CRMF_CERTID_push(sk, ptr) OPENSSL_sk_push(ossl_check_OSSL_CRMF_CERTID_sk_type(sk), ossl_check_OSSL_CRMF_CERTID_type(ptr))
|
||||||
|
#define sk_OSSL_CRMF_CERTID_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_OSSL_CRMF_CERTID_sk_type(sk), ossl_check_OSSL_CRMF_CERTID_type(ptr))
|
||||||
|
#define sk_OSSL_CRMF_CERTID_pop(sk) ((OSSL_CRMF_CERTID *)OPENSSL_sk_pop(ossl_check_OSSL_CRMF_CERTID_sk_type(sk)))
|
||||||
|
#define sk_OSSL_CRMF_CERTID_shift(sk) ((OSSL_CRMF_CERTID *)OPENSSL_sk_shift(ossl_check_OSSL_CRMF_CERTID_sk_type(sk)))
|
||||||
|
#define sk_OSSL_CRMF_CERTID_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_OSSL_CRMF_CERTID_sk_type(sk),ossl_check_OSSL_CRMF_CERTID_freefunc_type(freefunc))
|
||||||
|
#define sk_OSSL_CRMF_CERTID_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_OSSL_CRMF_CERTID_sk_type(sk), ossl_check_OSSL_CRMF_CERTID_type(ptr), (idx))
|
||||||
|
#define sk_OSSL_CRMF_CERTID_set(sk, idx, ptr) ((OSSL_CRMF_CERTID *)OPENSSL_sk_set(ossl_check_OSSL_CRMF_CERTID_sk_type(sk), (idx), ossl_check_OSSL_CRMF_CERTID_type(ptr)))
|
||||||
|
#define sk_OSSL_CRMF_CERTID_find(sk, ptr) OPENSSL_sk_find(ossl_check_OSSL_CRMF_CERTID_sk_type(sk), ossl_check_OSSL_CRMF_CERTID_type(ptr))
|
||||||
|
#define sk_OSSL_CRMF_CERTID_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_OSSL_CRMF_CERTID_sk_type(sk), ossl_check_OSSL_CRMF_CERTID_type(ptr))
|
||||||
|
#define sk_OSSL_CRMF_CERTID_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_OSSL_CRMF_CERTID_sk_type(sk), ossl_check_OSSL_CRMF_CERTID_type(ptr), pnum)
|
||||||
|
#define sk_OSSL_CRMF_CERTID_sort(sk) OPENSSL_sk_sort(ossl_check_OSSL_CRMF_CERTID_sk_type(sk))
|
||||||
|
#define sk_OSSL_CRMF_CERTID_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_OSSL_CRMF_CERTID_sk_type(sk))
|
||||||
|
#define sk_OSSL_CRMF_CERTID_dup(sk) ((STACK_OF(OSSL_CRMF_CERTID) *)OPENSSL_sk_dup(ossl_check_const_OSSL_CRMF_CERTID_sk_type(sk)))
|
||||||
|
#define sk_OSSL_CRMF_CERTID_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(OSSL_CRMF_CERTID) *)OPENSSL_sk_deep_copy(ossl_check_const_OSSL_CRMF_CERTID_sk_type(sk), ossl_check_OSSL_CRMF_CERTID_copyfunc_type(copyfunc), ossl_check_OSSL_CRMF_CERTID_freefunc_type(freefunc)))
|
||||||
|
#define sk_OSSL_CRMF_CERTID_set_cmp_func(sk, cmp) ((sk_OSSL_CRMF_CERTID_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_OSSL_CRMF_CERTID_sk_type(sk), ossl_check_OSSL_CRMF_CERTID_compfunc_type(cmp)))
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct ossl_crmf_pkipublicationinfo_st OSSL_CRMF_PKIPUBLICATIONINFO;
|
||||||
|
DECLARE_ASN1_FUNCTIONS(OSSL_CRMF_PKIPUBLICATIONINFO)
|
||||||
|
typedef struct ossl_crmf_singlepubinfo_st OSSL_CRMF_SINGLEPUBINFO;
|
||||||
|
DECLARE_ASN1_FUNCTIONS(OSSL_CRMF_SINGLEPUBINFO)
|
||||||
|
typedef struct ossl_crmf_certtemplate_st OSSL_CRMF_CERTTEMPLATE;
|
||||||
|
DECLARE_ASN1_FUNCTIONS(OSSL_CRMF_CERTTEMPLATE)
|
||||||
|
DECLARE_ASN1_DUP_FUNCTION(OSSL_CRMF_CERTTEMPLATE)
|
||||||
|
typedef STACK_OF(OSSL_CRMF_MSG) OSSL_CRMF_MSGS;
|
||||||
|
DECLARE_ASN1_FUNCTIONS(OSSL_CRMF_MSGS)
|
||||||
|
|
||||||
|
typedef struct ossl_crmf_optionalvalidity_st OSSL_CRMF_OPTIONALVALIDITY;
|
||||||
|
|
||||||
|
/* crmf_pbm.c */
|
||||||
|
OSSL_CRMF_PBMPARAMETER *OSSL_CRMF_pbmp_new(OSSL_LIB_CTX *libctx, size_t slen,
|
||||||
|
int owfnid, size_t itercnt,
|
||||||
|
int macnid);
|
||||||
|
int OSSL_CRMF_pbm_new(OSSL_LIB_CTX *libctx, const char *propq,
|
||||||
|
const OSSL_CRMF_PBMPARAMETER *pbmp,
|
||||||
|
const unsigned char *msg, size_t msglen,
|
||||||
|
const unsigned char *sec, size_t seclen,
|
||||||
|
unsigned char **mac, size_t *maclen);
|
||||||
|
|
||||||
|
/* crmf_lib.c */
|
||||||
|
int OSSL_CRMF_MSG_set1_regCtrl_regToken(OSSL_CRMF_MSG *msg,
|
||||||
|
const ASN1_UTF8STRING *tok);
|
||||||
|
ASN1_UTF8STRING
|
||||||
|
*OSSL_CRMF_MSG_get0_regCtrl_regToken(const OSSL_CRMF_MSG *msg);
|
||||||
|
int OSSL_CRMF_MSG_set1_regCtrl_authenticator(OSSL_CRMF_MSG *msg,
|
||||||
|
const ASN1_UTF8STRING *auth);
|
||||||
|
ASN1_UTF8STRING
|
||||||
|
*OSSL_CRMF_MSG_get0_regCtrl_authenticator(const OSSL_CRMF_MSG *msg);
|
||||||
|
int
|
||||||
|
OSSL_CRMF_MSG_PKIPublicationInfo_push0_SinglePubInfo(OSSL_CRMF_PKIPUBLICATIONINFO *pi,
|
||||||
|
OSSL_CRMF_SINGLEPUBINFO *spi);
|
||||||
|
# define OSSL_CRMF_PUB_METHOD_DONTCARE 0
|
||||||
|
# define OSSL_CRMF_PUB_METHOD_X500 1
|
||||||
|
# define OSSL_CRMF_PUB_METHOD_WEB 2
|
||||||
|
# define OSSL_CRMF_PUB_METHOD_LDAP 3
|
||||||
|
int OSSL_CRMF_MSG_set0_SinglePubInfo(OSSL_CRMF_SINGLEPUBINFO *spi,
|
||||||
|
int method, GENERAL_NAME *nm);
|
||||||
|
# define OSSL_CRMF_PUB_ACTION_DONTPUBLISH 0
|
||||||
|
# define OSSL_CRMF_PUB_ACTION_PLEASEPUBLISH 1
|
||||||
|
int OSSL_CRMF_MSG_set_PKIPublicationInfo_action(OSSL_CRMF_PKIPUBLICATIONINFO *pi,
|
||||||
|
int action);
|
||||||
|
int OSSL_CRMF_MSG_set1_regCtrl_pkiPublicationInfo(OSSL_CRMF_MSG *msg,
|
||||||
|
const OSSL_CRMF_PKIPUBLICATIONINFO *pi);
|
||||||
|
OSSL_CRMF_PKIPUBLICATIONINFO
|
||||||
|
*OSSL_CRMF_MSG_get0_regCtrl_pkiPublicationInfo(const OSSL_CRMF_MSG *msg);
|
||||||
|
int OSSL_CRMF_MSG_set1_regCtrl_protocolEncrKey(OSSL_CRMF_MSG *msg,
|
||||||
|
const X509_PUBKEY *pubkey);
|
||||||
|
X509_PUBKEY
|
||||||
|
*OSSL_CRMF_MSG_get0_regCtrl_protocolEncrKey(const OSSL_CRMF_MSG *msg);
|
||||||
|
int OSSL_CRMF_MSG_set1_regCtrl_oldCertID(OSSL_CRMF_MSG *msg,
|
||||||
|
const OSSL_CRMF_CERTID *cid);
|
||||||
|
OSSL_CRMF_CERTID
|
||||||
|
*OSSL_CRMF_MSG_get0_regCtrl_oldCertID(const OSSL_CRMF_MSG *msg);
|
||||||
|
OSSL_CRMF_CERTID *OSSL_CRMF_CERTID_gen(const X509_NAME *issuer,
|
||||||
|
const ASN1_INTEGER *serial);
|
||||||
|
|
||||||
|
int OSSL_CRMF_MSG_set1_regInfo_utf8Pairs(OSSL_CRMF_MSG *msg,
|
||||||
|
const ASN1_UTF8STRING *utf8pairs);
|
||||||
|
ASN1_UTF8STRING
|
||||||
|
*OSSL_CRMF_MSG_get0_regInfo_utf8Pairs(const OSSL_CRMF_MSG *msg);
|
||||||
|
int OSSL_CRMF_MSG_set1_regInfo_certReq(OSSL_CRMF_MSG *msg,
|
||||||
|
const OSSL_CRMF_CERTREQUEST *cr);
|
||||||
|
OSSL_CRMF_CERTREQUEST
|
||||||
|
*OSSL_CRMF_MSG_get0_regInfo_certReq(const OSSL_CRMF_MSG *msg);
|
||||||
|
|
||||||
|
int OSSL_CRMF_MSG_set0_validity(OSSL_CRMF_MSG *crm,
|
||||||
|
ASN1_TIME *notBefore, ASN1_TIME *notAfter);
|
||||||
|
int OSSL_CRMF_MSG_set_certReqId(OSSL_CRMF_MSG *crm, int rid);
|
||||||
|
int OSSL_CRMF_MSG_get_certReqId(const OSSL_CRMF_MSG *crm);
|
||||||
|
int OSSL_CRMF_MSG_set0_extensions(OSSL_CRMF_MSG *crm, X509_EXTENSIONS *exts);
|
||||||
|
|
||||||
|
int OSSL_CRMF_MSG_push0_extension(OSSL_CRMF_MSG *crm, X509_EXTENSION *ext);
|
||||||
|
# define OSSL_CRMF_POPO_NONE -1
|
||||||
|
# define OSSL_CRMF_POPO_RAVERIFIED 0
|
||||||
|
# define OSSL_CRMF_POPO_SIGNATURE 1
|
||||||
|
# define OSSL_CRMF_POPO_KEYENC 2
|
||||||
|
# define OSSL_CRMF_POPO_KEYAGREE 3
|
||||||
|
int OSSL_CRMF_MSG_create_popo(int meth, OSSL_CRMF_MSG *crm,
|
||||||
|
EVP_PKEY *pkey, const EVP_MD *digest,
|
||||||
|
OSSL_LIB_CTX *libctx, const char *propq);
|
||||||
|
int OSSL_CRMF_MSGS_verify_popo(const OSSL_CRMF_MSGS *reqs,
|
||||||
|
int rid, int acceptRAVerified,
|
||||||
|
OSSL_LIB_CTX *libctx, const char *propq);
|
||||||
|
OSSL_CRMF_CERTTEMPLATE *OSSL_CRMF_MSG_get0_tmpl(const OSSL_CRMF_MSG *crm);
|
||||||
|
X509_PUBKEY
|
||||||
|
*OSSL_CRMF_CERTTEMPLATE_get0_publicKey(const OSSL_CRMF_CERTTEMPLATE *tmpl);
|
||||||
|
const X509_NAME
|
||||||
|
*OSSL_CRMF_CERTTEMPLATE_get0_subject(const OSSL_CRMF_CERTTEMPLATE *tmpl);
|
||||||
|
const X509_NAME
|
||||||
|
*OSSL_CRMF_CERTTEMPLATE_get0_issuer(const OSSL_CRMF_CERTTEMPLATE *tmpl);
|
||||||
|
const ASN1_INTEGER
|
||||||
|
*OSSL_CRMF_CERTTEMPLATE_get0_serialNumber(const OSSL_CRMF_CERTTEMPLATE *tmpl);
|
||||||
|
X509_EXTENSIONS
|
||||||
|
*OSSL_CRMF_CERTTEMPLATE_get0_extensions(const OSSL_CRMF_CERTTEMPLATE *tmpl);
|
||||||
|
const X509_NAME
|
||||||
|
*OSSL_CRMF_CERTID_get0_issuer(const OSSL_CRMF_CERTID *cid);
|
||||||
|
const ASN1_INTEGER
|
||||||
|
*OSSL_CRMF_CERTID_get0_serialNumber(const OSSL_CRMF_CERTID *cid);
|
||||||
|
int OSSL_CRMF_CERTTEMPLATE_fill(OSSL_CRMF_CERTTEMPLATE *tmpl,
|
||||||
|
EVP_PKEY *pubkey,
|
||||||
|
const X509_NAME *subject,
|
||||||
|
const X509_NAME *issuer,
|
||||||
|
const ASN1_INTEGER *serial);
|
||||||
|
X509 *OSSL_CRMF_ENCRYPTEDVALUE_get1_encCert(const OSSL_CRMF_ENCRYPTEDVALUE *ecert,
|
||||||
|
OSSL_LIB_CTX *libctx, const char *propq,
|
||||||
|
EVP_PKEY *pkey);
|
||||||
|
X509 *OSSL_CRMF_ENCRYPTEDKEY_get1_encCert(const OSSL_CRMF_ENCRYPTEDKEY *ecert,
|
||||||
|
OSSL_LIB_CTX *libctx, const char *propq,
|
||||||
|
EVP_PKEY *pkey, unsigned int flags);
|
||||||
|
unsigned char
|
||||||
|
*OSSL_CRMF_ENCRYPTEDVALUE_decrypt(const OSSL_CRMF_ENCRYPTEDVALUE *enc,
|
||||||
|
OSSL_LIB_CTX *libctx, const char *propq,
|
||||||
|
EVP_PKEY *pkey, int *outlen);
|
||||||
|
EVP_PKEY *OSSL_CRMF_ENCRYPTEDKEY_get1_pkey(const OSSL_CRMF_ENCRYPTEDKEY *encryptedKey,
|
||||||
|
X509_STORE *ts, STACK_OF(X509) *extra, EVP_PKEY *pkey,
|
||||||
|
X509 *cert, ASN1_OCTET_STRING *secret,
|
||||||
|
OSSL_LIB_CTX *libctx, const char *propq);
|
||||||
|
int OSSL_CRMF_MSG_centralkeygen_requested(const OSSL_CRMF_MSG *crm, const X509_REQ *p10cr);
|
||||||
|
# ifndef OPENSSL_NO_CMS
|
||||||
|
OSSL_CRMF_ENCRYPTEDKEY *OSSL_CRMF_ENCRYPTEDKEY_init_envdata(CMS_EnvelopedData *envdata);
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
# endif /* !defined(OPENSSL_NO_CRMF) */
|
||||||
|
#endif /* !defined(OPENSSL_CRMF_H) */
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
/*
|
||||||
|
* Generated by util/mkerr.pl DO NOT EDIT
|
||||||
|
* Copyright 1995-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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef OPENSSL_CRMFERR_H
|
||||||
|
# define OPENSSL_CRMFERR_H
|
||||||
|
# pragma once
|
||||||
|
|
||||||
|
# include <openssl/opensslconf.h>
|
||||||
|
# include <openssl/symhacks.h>
|
||||||
|
# include <openssl/cryptoerr_legacy.h>
|
||||||
|
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_CRMF
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* CRMF reason codes.
|
||||||
|
*/
|
||||||
|
# define CRMF_R_BAD_PBM_ITERATIONCOUNT 100
|
||||||
|
# define CRMF_R_CMS_NOT_SUPPORTED 122
|
||||||
|
# define CRMF_R_CRMFERROR 102
|
||||||
|
# define CRMF_R_ERROR 103
|
||||||
|
# define CRMF_R_ERROR_DECODING_CERTIFICATE 104
|
||||||
|
# define CRMF_R_ERROR_DECODING_ENCRYPTEDKEY 123
|
||||||
|
# define CRMF_R_ERROR_DECRYPTING_CERTIFICATE 105
|
||||||
|
# define CRMF_R_ERROR_DECRYPTING_ENCRYPTEDKEY 124
|
||||||
|
# define CRMF_R_ERROR_DECRYPTING_ENCRYPTEDVALUE 125
|
||||||
|
# define CRMF_R_ERROR_DECRYPTING_SYMMETRIC_KEY 106
|
||||||
|
# define CRMF_R_ERROR_SETTING_PURPOSE 126
|
||||||
|
# define CRMF_R_ERROR_VERIFYING_ENCRYPTEDKEY 127
|
||||||
|
# define CRMF_R_FAILURE_OBTAINING_RANDOM 107
|
||||||
|
# define CRMF_R_ITERATIONCOUNT_BELOW_100 108
|
||||||
|
# define CRMF_R_MALFORMED_IV 101
|
||||||
|
# define CRMF_R_NULL_ARGUMENT 109
|
||||||
|
# define CRMF_R_POPOSKINPUT_NOT_SUPPORTED 113
|
||||||
|
# define CRMF_R_POPO_INCONSISTENT_CENTRAL_KEYGEN 128
|
||||||
|
# define CRMF_R_POPO_INCONSISTENT_PUBLIC_KEY 117
|
||||||
|
# define CRMF_R_POPO_MISSING 121
|
||||||
|
# define CRMF_R_POPO_MISSING_PUBLIC_KEY 118
|
||||||
|
# define CRMF_R_POPO_MISSING_SUBJECT 119
|
||||||
|
# define CRMF_R_POPO_RAVERIFIED_NOT_ACCEPTED 120
|
||||||
|
# define CRMF_R_SETTING_MAC_ALGOR_FAILURE 110
|
||||||
|
# define CRMF_R_SETTING_OWF_ALGOR_FAILURE 111
|
||||||
|
# define CRMF_R_UNSUPPORTED_ALGORITHM 112
|
||||||
|
# define CRMF_R_UNSUPPORTED_CIPHER 114
|
||||||
|
# define CRMF_R_UNSUPPORTED_METHOD_FOR_CREATING_POPO 115
|
||||||
|
# define CRMF_R_UNSUPPORTED_POPO_METHOD 116
|
||||||
|
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,583 @@
|
|||||||
|
/*
|
||||||
|
* WARNING: do not edit!
|
||||||
|
* Generated by Makefile from ../../openssl-3.5.0/include/openssl/crypto.h.in
|
||||||
|
*
|
||||||
|
* Copyright 1995-2024 The OpenSSL Project Authors. All Rights Reserved.
|
||||||
|
* Copyright (c) 2002, Oracle and/or its affiliates. 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef OPENSSL_CRYPTO_H
|
||||||
|
# define OPENSSL_CRYPTO_H
|
||||||
|
# pragma once
|
||||||
|
|
||||||
|
# include <openssl/macros.h>
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
# define HEADER_CRYPTO_H
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# include <stdlib.h>
|
||||||
|
# include <time.h>
|
||||||
|
|
||||||
|
# include <openssl/e_os2.h>
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_STDIO
|
||||||
|
# include <stdio.h>
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# include <openssl/safestack.h>
|
||||||
|
# include <openssl/opensslv.h>
|
||||||
|
# include <openssl/types.h>
|
||||||
|
# include <openssl/opensslconf.h>
|
||||||
|
# include <openssl/cryptoerr.h>
|
||||||
|
# include <openssl/core.h>
|
||||||
|
|
||||||
|
# ifdef CHARSET_EBCDIC
|
||||||
|
# include <openssl/ebcdic.h>
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Resolve problems on some operating systems with symbol names that clash
|
||||||
|
* one way or another
|
||||||
|
*/
|
||||||
|
# include <openssl/symhacks.h>
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_1_1_0
|
||||||
|
# include <openssl/opensslv.h>
|
||||||
|
# endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_1_1_0
|
||||||
|
# define SSLeay OpenSSL_version_num
|
||||||
|
# define SSLeay_version OpenSSL_version
|
||||||
|
# define SSLEAY_VERSION_NUMBER OPENSSL_VERSION_NUMBER
|
||||||
|
# define SSLEAY_VERSION OPENSSL_VERSION
|
||||||
|
# define SSLEAY_CFLAGS OPENSSL_CFLAGS
|
||||||
|
# define SSLEAY_BUILT_ON OPENSSL_BUILT_ON
|
||||||
|
# define SSLEAY_PLATFORM OPENSSL_PLATFORM
|
||||||
|
# define SSLEAY_DIR OPENSSL_DIR
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Old type for allocating dynamic locks. No longer used. Use the new thread
|
||||||
|
* API instead.
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
int dummy;
|
||||||
|
} CRYPTO_dynlock;
|
||||||
|
|
||||||
|
# endif /* OPENSSL_NO_DEPRECATED_1_1_0 */
|
||||||
|
|
||||||
|
typedef void CRYPTO_RWLOCK;
|
||||||
|
|
||||||
|
CRYPTO_RWLOCK *CRYPTO_THREAD_lock_new(void);
|
||||||
|
__owur int CRYPTO_THREAD_read_lock(CRYPTO_RWLOCK *lock);
|
||||||
|
__owur int CRYPTO_THREAD_write_lock(CRYPTO_RWLOCK *lock);
|
||||||
|
int CRYPTO_THREAD_unlock(CRYPTO_RWLOCK *lock);
|
||||||
|
void CRYPTO_THREAD_lock_free(CRYPTO_RWLOCK *lock);
|
||||||
|
|
||||||
|
int CRYPTO_atomic_add(int *val, int amount, int *ret, CRYPTO_RWLOCK *lock);
|
||||||
|
int CRYPTO_atomic_add64(uint64_t *val, uint64_t op, uint64_t *ret,
|
||||||
|
CRYPTO_RWLOCK *lock);
|
||||||
|
int CRYPTO_atomic_and(uint64_t *val, uint64_t op, uint64_t *ret,
|
||||||
|
CRYPTO_RWLOCK *lock);
|
||||||
|
int CRYPTO_atomic_or(uint64_t *val, uint64_t op, uint64_t *ret,
|
||||||
|
CRYPTO_RWLOCK *lock);
|
||||||
|
int CRYPTO_atomic_load(uint64_t *val, uint64_t *ret, CRYPTO_RWLOCK *lock);
|
||||||
|
int CRYPTO_atomic_load_int(int *val, int *ret, CRYPTO_RWLOCK *lock);
|
||||||
|
int CRYPTO_atomic_store(uint64_t *dst, uint64_t val, CRYPTO_RWLOCK *lock);
|
||||||
|
|
||||||
|
/* No longer needed, so this is a no-op */
|
||||||
|
#define OPENSSL_malloc_init() while(0) continue
|
||||||
|
|
||||||
|
# define OPENSSL_malloc(num) \
|
||||||
|
CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
|
||||||
|
# define OPENSSL_zalloc(num) \
|
||||||
|
CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
|
||||||
|
# define OPENSSL_aligned_alloc(num, alignment, freeptr) \
|
||||||
|
CRYPTO_aligned_alloc(num, alignment, freeptr, \
|
||||||
|
OPENSSL_FILE, OPENSSL_LINE)
|
||||||
|
# define OPENSSL_realloc(addr, num) \
|
||||||
|
CRYPTO_realloc(addr, num, OPENSSL_FILE, OPENSSL_LINE)
|
||||||
|
# define OPENSSL_clear_realloc(addr, old_num, num) \
|
||||||
|
CRYPTO_clear_realloc(addr, old_num, num, OPENSSL_FILE, OPENSSL_LINE)
|
||||||
|
# define OPENSSL_clear_free(addr, num) \
|
||||||
|
CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
|
||||||
|
# define OPENSSL_free(addr) \
|
||||||
|
CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
|
||||||
|
# define OPENSSL_memdup(str, s) \
|
||||||
|
CRYPTO_memdup((str), s, OPENSSL_FILE, OPENSSL_LINE)
|
||||||
|
# define OPENSSL_strdup(str) \
|
||||||
|
CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
|
||||||
|
# define OPENSSL_strndup(str, n) \
|
||||||
|
CRYPTO_strndup(str, n, OPENSSL_FILE, OPENSSL_LINE)
|
||||||
|
# define OPENSSL_secure_malloc(num) \
|
||||||
|
CRYPTO_secure_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
|
||||||
|
# define OPENSSL_secure_zalloc(num) \
|
||||||
|
CRYPTO_secure_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
|
||||||
|
# define OPENSSL_secure_free(addr) \
|
||||||
|
CRYPTO_secure_free(addr, OPENSSL_FILE, OPENSSL_LINE)
|
||||||
|
# define OPENSSL_secure_clear_free(addr, num) \
|
||||||
|
CRYPTO_secure_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
|
||||||
|
# define OPENSSL_secure_actual_size(ptr) \
|
||||||
|
CRYPTO_secure_actual_size(ptr)
|
||||||
|
|
||||||
|
size_t OPENSSL_strlcpy(char *dst, const char *src, size_t siz);
|
||||||
|
size_t OPENSSL_strlcat(char *dst, const char *src, size_t siz);
|
||||||
|
size_t OPENSSL_strnlen(const char *str, size_t maxlen);
|
||||||
|
int OPENSSL_strtoul(const char *str, char **endptr, int base, unsigned long *num);
|
||||||
|
int OPENSSL_buf2hexstr_ex(char *str, size_t str_n, size_t *strlength,
|
||||||
|
const unsigned char *buf, size_t buflen,
|
||||||
|
const char sep);
|
||||||
|
char *OPENSSL_buf2hexstr(const unsigned char *buf, long buflen);
|
||||||
|
int OPENSSL_hexstr2buf_ex(unsigned char *buf, size_t buf_n, size_t *buflen,
|
||||||
|
const char *str, const char sep);
|
||||||
|
unsigned char *OPENSSL_hexstr2buf(const char *str, long *buflen);
|
||||||
|
int OPENSSL_hexchar2int(unsigned char c);
|
||||||
|
int OPENSSL_strcasecmp(const char *s1, const char *s2);
|
||||||
|
int OPENSSL_strncasecmp(const char *s1, const char *s2, size_t n);
|
||||||
|
|
||||||
|
# define OPENSSL_MALLOC_MAX_NELEMS(type) (((1U<<(sizeof(int)*8-1))-1)/sizeof(type))
|
||||||
|
|
||||||
|
/*
|
||||||
|
* These functions return the values of OPENSSL_VERSION_MAJOR,
|
||||||
|
* OPENSSL_VERSION_MINOR, OPENSSL_VERSION_PATCH, OPENSSL_VERSION_PRE_RELEASE
|
||||||
|
* and OPENSSL_VERSION_BUILD_METADATA, respectively.
|
||||||
|
*/
|
||||||
|
unsigned int OPENSSL_version_major(void);
|
||||||
|
unsigned int OPENSSL_version_minor(void);
|
||||||
|
unsigned int OPENSSL_version_patch(void);
|
||||||
|
const char *OPENSSL_version_pre_release(void);
|
||||||
|
const char *OPENSSL_version_build_metadata(void);
|
||||||
|
|
||||||
|
unsigned long OpenSSL_version_num(void);
|
||||||
|
const char *OpenSSL_version(int type);
|
||||||
|
# define OPENSSL_VERSION 0
|
||||||
|
# define OPENSSL_CFLAGS 1
|
||||||
|
# define OPENSSL_BUILT_ON 2
|
||||||
|
# define OPENSSL_PLATFORM 3
|
||||||
|
# define OPENSSL_DIR 4
|
||||||
|
# define OPENSSL_ENGINES_DIR 5
|
||||||
|
# define OPENSSL_VERSION_STRING 6
|
||||||
|
# define OPENSSL_FULL_VERSION_STRING 7
|
||||||
|
# define OPENSSL_MODULES_DIR 8
|
||||||
|
# define OPENSSL_CPU_INFO 9
|
||||||
|
# define OPENSSL_WINCTX 10
|
||||||
|
|
||||||
|
const char *OPENSSL_info(int type);
|
||||||
|
/*
|
||||||
|
* The series starts at 1001 to avoid confusion with the OpenSSL_version
|
||||||
|
* types.
|
||||||
|
*/
|
||||||
|
# define OPENSSL_INFO_CONFIG_DIR 1001
|
||||||
|
# define OPENSSL_INFO_ENGINES_DIR 1002
|
||||||
|
# define OPENSSL_INFO_MODULES_DIR 1003
|
||||||
|
# define OPENSSL_INFO_DSO_EXTENSION 1004
|
||||||
|
# define OPENSSL_INFO_DIR_FILENAME_SEPARATOR 1005
|
||||||
|
# define OPENSSL_INFO_LIST_SEPARATOR 1006
|
||||||
|
# define OPENSSL_INFO_SEED_SOURCE 1007
|
||||||
|
# define OPENSSL_INFO_CPU_SETTINGS 1008
|
||||||
|
# define OPENSSL_INFO_WINDOWS_CONTEXT 1009
|
||||||
|
|
||||||
|
int OPENSSL_issetugid(void);
|
||||||
|
|
||||||
|
struct crypto_ex_data_st {
|
||||||
|
OSSL_LIB_CTX *ctx;
|
||||||
|
STACK_OF(void) *sk;
|
||||||
|
};
|
||||||
|
|
||||||
|
SKM_DEFINE_STACK_OF_INTERNAL(void, void, void)
|
||||||
|
#define sk_void_num(sk) OPENSSL_sk_num(ossl_check_const_void_sk_type(sk))
|
||||||
|
#define sk_void_value(sk, idx) ((void *)OPENSSL_sk_value(ossl_check_const_void_sk_type(sk), (idx)))
|
||||||
|
#define sk_void_new(cmp) ((STACK_OF(void) *)OPENSSL_sk_new(ossl_check_void_compfunc_type(cmp)))
|
||||||
|
#define sk_void_new_null() ((STACK_OF(void) *)OPENSSL_sk_new_null())
|
||||||
|
#define sk_void_new_reserve(cmp, n) ((STACK_OF(void) *)OPENSSL_sk_new_reserve(ossl_check_void_compfunc_type(cmp), (n)))
|
||||||
|
#define sk_void_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_void_sk_type(sk), (n))
|
||||||
|
#define sk_void_free(sk) OPENSSL_sk_free(ossl_check_void_sk_type(sk))
|
||||||
|
#define sk_void_zero(sk) OPENSSL_sk_zero(ossl_check_void_sk_type(sk))
|
||||||
|
#define sk_void_delete(sk, i) ((void *)OPENSSL_sk_delete(ossl_check_void_sk_type(sk), (i)))
|
||||||
|
#define sk_void_delete_ptr(sk, ptr) ((void *)OPENSSL_sk_delete_ptr(ossl_check_void_sk_type(sk), ossl_check_void_type(ptr)))
|
||||||
|
#define sk_void_push(sk, ptr) OPENSSL_sk_push(ossl_check_void_sk_type(sk), ossl_check_void_type(ptr))
|
||||||
|
#define sk_void_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_void_sk_type(sk), ossl_check_void_type(ptr))
|
||||||
|
#define sk_void_pop(sk) ((void *)OPENSSL_sk_pop(ossl_check_void_sk_type(sk)))
|
||||||
|
#define sk_void_shift(sk) ((void *)OPENSSL_sk_shift(ossl_check_void_sk_type(sk)))
|
||||||
|
#define sk_void_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_void_sk_type(sk),ossl_check_void_freefunc_type(freefunc))
|
||||||
|
#define sk_void_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_void_sk_type(sk), ossl_check_void_type(ptr), (idx))
|
||||||
|
#define sk_void_set(sk, idx, ptr) ((void *)OPENSSL_sk_set(ossl_check_void_sk_type(sk), (idx), ossl_check_void_type(ptr)))
|
||||||
|
#define sk_void_find(sk, ptr) OPENSSL_sk_find(ossl_check_void_sk_type(sk), ossl_check_void_type(ptr))
|
||||||
|
#define sk_void_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_void_sk_type(sk), ossl_check_void_type(ptr))
|
||||||
|
#define sk_void_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_void_sk_type(sk), ossl_check_void_type(ptr), pnum)
|
||||||
|
#define sk_void_sort(sk) OPENSSL_sk_sort(ossl_check_void_sk_type(sk))
|
||||||
|
#define sk_void_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_void_sk_type(sk))
|
||||||
|
#define sk_void_dup(sk) ((STACK_OF(void) *)OPENSSL_sk_dup(ossl_check_const_void_sk_type(sk)))
|
||||||
|
#define sk_void_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(void) *)OPENSSL_sk_deep_copy(ossl_check_const_void_sk_type(sk), ossl_check_void_copyfunc_type(copyfunc), ossl_check_void_freefunc_type(freefunc)))
|
||||||
|
#define sk_void_set_cmp_func(sk, cmp) ((sk_void_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_void_sk_type(sk), ossl_check_void_compfunc_type(cmp)))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Per class, we have a STACK of function pointers.
|
||||||
|
*/
|
||||||
|
# define CRYPTO_EX_INDEX_SSL 0
|
||||||
|
# define CRYPTO_EX_INDEX_SSL_CTX 1
|
||||||
|
# define CRYPTO_EX_INDEX_SSL_SESSION 2
|
||||||
|
# define CRYPTO_EX_INDEX_X509 3
|
||||||
|
# define CRYPTO_EX_INDEX_X509_STORE 4
|
||||||
|
# define CRYPTO_EX_INDEX_X509_STORE_CTX 5
|
||||||
|
# define CRYPTO_EX_INDEX_DH 6
|
||||||
|
# define CRYPTO_EX_INDEX_DSA 7
|
||||||
|
# define CRYPTO_EX_INDEX_EC_KEY 8
|
||||||
|
# define CRYPTO_EX_INDEX_RSA 9
|
||||||
|
# define CRYPTO_EX_INDEX_ENGINE 10
|
||||||
|
# define CRYPTO_EX_INDEX_UI 11
|
||||||
|
# define CRYPTO_EX_INDEX_BIO 12
|
||||||
|
# define CRYPTO_EX_INDEX_APP 13
|
||||||
|
# define CRYPTO_EX_INDEX_UI_METHOD 14
|
||||||
|
# define CRYPTO_EX_INDEX_RAND_DRBG 15
|
||||||
|
# define CRYPTO_EX_INDEX_DRBG CRYPTO_EX_INDEX_RAND_DRBG
|
||||||
|
# define CRYPTO_EX_INDEX_OSSL_LIB_CTX 16
|
||||||
|
# define CRYPTO_EX_INDEX_EVP_PKEY 17
|
||||||
|
# define CRYPTO_EX_INDEX__COUNT 18
|
||||||
|
|
||||||
|
typedef void CRYPTO_EX_new (void *parent, void *ptr, CRYPTO_EX_DATA *ad,
|
||||||
|
int idx, long argl, void *argp);
|
||||||
|
typedef void CRYPTO_EX_free (void *parent, void *ptr, CRYPTO_EX_DATA *ad,
|
||||||
|
int idx, long argl, void *argp);
|
||||||
|
typedef int CRYPTO_EX_dup (CRYPTO_EX_DATA *to, const CRYPTO_EX_DATA *from,
|
||||||
|
void **from_d, int idx, long argl, void *argp);
|
||||||
|
__owur int CRYPTO_get_ex_new_index(int class_index, long argl, void *argp,
|
||||||
|
CRYPTO_EX_new *new_func,
|
||||||
|
CRYPTO_EX_dup *dup_func,
|
||||||
|
CRYPTO_EX_free *free_func);
|
||||||
|
/* No longer use an index. */
|
||||||
|
int CRYPTO_free_ex_index(int class_index, int idx);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Initialise/duplicate/free CRYPTO_EX_DATA variables corresponding to a
|
||||||
|
* given class (invokes whatever per-class callbacks are applicable)
|
||||||
|
*/
|
||||||
|
int CRYPTO_new_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad);
|
||||||
|
int CRYPTO_dup_ex_data(int class_index, CRYPTO_EX_DATA *to,
|
||||||
|
const CRYPTO_EX_DATA *from);
|
||||||
|
|
||||||
|
void CRYPTO_free_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad);
|
||||||
|
|
||||||
|
/* Allocate a single item in the CRYPTO_EX_DATA variable */
|
||||||
|
int CRYPTO_alloc_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad,
|
||||||
|
int idx);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Get/set data in a CRYPTO_EX_DATA variable corresponding to a particular
|
||||||
|
* index (relative to the class type involved)
|
||||||
|
*/
|
||||||
|
int CRYPTO_set_ex_data(CRYPTO_EX_DATA *ad, int idx, void *val);
|
||||||
|
void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx);
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_1_1_0
|
||||||
|
/*
|
||||||
|
* This function cleans up all "ex_data" state. It mustn't be called under
|
||||||
|
* potential race-conditions.
|
||||||
|
*/
|
||||||
|
# define CRYPTO_cleanup_all_ex_data() while(0) continue
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The old locking functions have been removed completely without compatibility
|
||||||
|
* macros. This is because the old functions either could not properly report
|
||||||
|
* errors, or the returned error values were not clearly documented.
|
||||||
|
* Replacing the locking functions with no-ops would cause race condition
|
||||||
|
* issues in the affected applications. It is far better for them to fail at
|
||||||
|
* compile time.
|
||||||
|
* On the other hand, the locking callbacks are no longer used. Consequently,
|
||||||
|
* the callback management functions can be safely replaced with no-op macros.
|
||||||
|
*/
|
||||||
|
# define CRYPTO_num_locks() (1)
|
||||||
|
# define CRYPTO_set_locking_callback(func)
|
||||||
|
# define CRYPTO_get_locking_callback() (NULL)
|
||||||
|
# define CRYPTO_set_add_lock_callback(func)
|
||||||
|
# define CRYPTO_get_add_lock_callback() (NULL)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* These defines where used in combination with the old locking callbacks,
|
||||||
|
* they are not called anymore, but old code that's not called might still
|
||||||
|
* use them.
|
||||||
|
*/
|
||||||
|
# define CRYPTO_LOCK 1
|
||||||
|
# define CRYPTO_UNLOCK 2
|
||||||
|
# define CRYPTO_READ 4
|
||||||
|
# define CRYPTO_WRITE 8
|
||||||
|
|
||||||
|
/* This structure is no longer used */
|
||||||
|
typedef struct crypto_threadid_st {
|
||||||
|
int dummy;
|
||||||
|
} CRYPTO_THREADID;
|
||||||
|
/* Only use CRYPTO_THREADID_set_[numeric|pointer]() within callbacks */
|
||||||
|
# define CRYPTO_THREADID_set_numeric(id, val)
|
||||||
|
# define CRYPTO_THREADID_set_pointer(id, ptr)
|
||||||
|
# define CRYPTO_THREADID_set_callback(threadid_func) (0)
|
||||||
|
# define CRYPTO_THREADID_get_callback() (NULL)
|
||||||
|
# define CRYPTO_THREADID_current(id)
|
||||||
|
# define CRYPTO_THREADID_cmp(a, b) (-1)
|
||||||
|
# define CRYPTO_THREADID_cpy(dest, src)
|
||||||
|
# define CRYPTO_THREADID_hash(id) (0UL)
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_1_0_0
|
||||||
|
# define CRYPTO_set_id_callback(func)
|
||||||
|
# define CRYPTO_get_id_callback() (NULL)
|
||||||
|
# define CRYPTO_thread_id() (0UL)
|
||||||
|
# endif /* OPENSSL_NO_DEPRECATED_1_0_0 */
|
||||||
|
|
||||||
|
# define CRYPTO_set_dynlock_create_callback(dyn_create_function)
|
||||||
|
# define CRYPTO_set_dynlock_lock_callback(dyn_lock_function)
|
||||||
|
# define CRYPTO_set_dynlock_destroy_callback(dyn_destroy_function)
|
||||||
|
# define CRYPTO_get_dynlock_create_callback() (NULL)
|
||||||
|
# define CRYPTO_get_dynlock_lock_callback() (NULL)
|
||||||
|
# define CRYPTO_get_dynlock_destroy_callback() (NULL)
|
||||||
|
# endif /* OPENSSL_NO_DEPRECATED_1_1_0 */
|
||||||
|
|
||||||
|
typedef void *(*CRYPTO_malloc_fn)(size_t num, const char *file, int line);
|
||||||
|
typedef void *(*CRYPTO_realloc_fn)(void *addr, size_t num, const char *file,
|
||||||
|
int line);
|
||||||
|
typedef void (*CRYPTO_free_fn)(void *addr, const char *file, int line);
|
||||||
|
int CRYPTO_set_mem_functions(CRYPTO_malloc_fn malloc_fn,
|
||||||
|
CRYPTO_realloc_fn realloc_fn,
|
||||||
|
CRYPTO_free_fn free_fn);
|
||||||
|
void CRYPTO_get_mem_functions(CRYPTO_malloc_fn *malloc_fn,
|
||||||
|
CRYPTO_realloc_fn *realloc_fn,
|
||||||
|
CRYPTO_free_fn *free_fn);
|
||||||
|
|
||||||
|
OSSL_CRYPTO_ALLOC void *CRYPTO_malloc(size_t num, const char *file, int line);
|
||||||
|
OSSL_CRYPTO_ALLOC void *CRYPTO_zalloc(size_t num, const char *file, int line);
|
||||||
|
OSSL_CRYPTO_ALLOC void *CRYPTO_aligned_alloc(size_t num, size_t align,
|
||||||
|
void **freeptr, const char *file,
|
||||||
|
int line);
|
||||||
|
OSSL_CRYPTO_ALLOC void *CRYPTO_memdup(const void *str, size_t siz, const char *file, int line);
|
||||||
|
OSSL_CRYPTO_ALLOC char *CRYPTO_strdup(const char *str, const char *file, int line);
|
||||||
|
OSSL_CRYPTO_ALLOC char *CRYPTO_strndup(const char *str, size_t s, const char *file, int line);
|
||||||
|
void CRYPTO_free(void *ptr, const char *file, int line);
|
||||||
|
void CRYPTO_clear_free(void *ptr, size_t num, const char *file, int line);
|
||||||
|
void *CRYPTO_realloc(void *addr, size_t num, const char *file, int line);
|
||||||
|
void *CRYPTO_clear_realloc(void *addr, size_t old_num, size_t num,
|
||||||
|
const char *file, int line);
|
||||||
|
|
||||||
|
int CRYPTO_secure_malloc_init(size_t sz, size_t minsize);
|
||||||
|
int CRYPTO_secure_malloc_done(void);
|
||||||
|
OSSL_CRYPTO_ALLOC void *CRYPTO_secure_malloc(size_t num, const char *file, int line);
|
||||||
|
OSSL_CRYPTO_ALLOC void *CRYPTO_secure_zalloc(size_t num, const char *file, int line);
|
||||||
|
void CRYPTO_secure_free(void *ptr, const char *file, int line);
|
||||||
|
void CRYPTO_secure_clear_free(void *ptr, size_t num,
|
||||||
|
const char *file, int line);
|
||||||
|
int CRYPTO_secure_allocated(const void *ptr);
|
||||||
|
int CRYPTO_secure_malloc_initialized(void);
|
||||||
|
size_t CRYPTO_secure_actual_size(void *ptr);
|
||||||
|
size_t CRYPTO_secure_used(void);
|
||||||
|
|
||||||
|
void OPENSSL_cleanse(void *ptr, size_t len);
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_CRYPTO_MDEBUG
|
||||||
|
/*
|
||||||
|
* The following can be used to detect memory leaks in the library. If
|
||||||
|
* used, it turns on malloc checking
|
||||||
|
*/
|
||||||
|
# define CRYPTO_MEM_CHECK_OFF 0x0 /* Control only */
|
||||||
|
# define CRYPTO_MEM_CHECK_ON 0x1 /* Control and mode bit */
|
||||||
|
# define CRYPTO_MEM_CHECK_ENABLE 0x2 /* Control and mode bit */
|
||||||
|
# define CRYPTO_MEM_CHECK_DISABLE 0x3 /* Control only */
|
||||||
|
|
||||||
|
/* max allowed length for value of OPENSSL_MALLOC_FAILURES env var. */
|
||||||
|
# define CRYPTO_MEM_CHECK_MAX_FS 256
|
||||||
|
|
||||||
|
void CRYPTO_get_alloc_counts(int *mcount, int *rcount, int *fcount);
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
# define OPENSSL_mem_debug_push(info) \
|
||||||
|
CRYPTO_mem_debug_push(info, OPENSSL_FILE, OPENSSL_LINE)
|
||||||
|
# define OPENSSL_mem_debug_pop() \
|
||||||
|
CRYPTO_mem_debug_pop()
|
||||||
|
# endif
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int CRYPTO_set_mem_debug(int flag);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int CRYPTO_mem_ctrl(int mode);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int CRYPTO_mem_debug_push(const char *info,
|
||||||
|
const char *file, int line);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int CRYPTO_mem_debug_pop(void);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 void CRYPTO_mem_debug_malloc(void *addr, size_t num,
|
||||||
|
int flag,
|
||||||
|
const char *file, int line);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 void CRYPTO_mem_debug_realloc(void *addr1, void *addr2,
|
||||||
|
size_t num, int flag,
|
||||||
|
const char *file, int line);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 void CRYPTO_mem_debug_free(void *addr, int flag,
|
||||||
|
const char *file, int line);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
int CRYPTO_mem_leaks_cb(int (*cb)(const char *str, size_t len, void *u),
|
||||||
|
void *u);
|
||||||
|
# endif
|
||||||
|
# ifndef OPENSSL_NO_STDIO
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int CRYPTO_mem_leaks_fp(FILE *);
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int CRYPTO_mem_leaks(BIO *bio);
|
||||||
|
# endif
|
||||||
|
# endif /* OPENSSL_NO_CRYPTO_MDEBUG */
|
||||||
|
|
||||||
|
/* die if we have to */
|
||||||
|
ossl_noreturn void OPENSSL_die(const char *assertion, const char *file, int line);
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_1_1_0
|
||||||
|
# define OpenSSLDie(f,l,a) OPENSSL_die((a),(f),(l))
|
||||||
|
# endif
|
||||||
|
# define OPENSSL_assert(e) \
|
||||||
|
(void)((e) ? 0 : (OPENSSL_die("assertion failed: " #e, OPENSSL_FILE, OPENSSL_LINE), 1))
|
||||||
|
|
||||||
|
int OPENSSL_isservice(void);
|
||||||
|
|
||||||
|
void OPENSSL_init(void);
|
||||||
|
# ifdef OPENSSL_SYS_UNIX
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
OSSL_DEPRECATEDIN_3_0 void OPENSSL_fork_prepare(void);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 void OPENSSL_fork_parent(void);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 void OPENSSL_fork_child(void);
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
|
||||||
|
struct tm *OPENSSL_gmtime(const time_t *timer, struct tm *result);
|
||||||
|
int OPENSSL_gmtime_adj(struct tm *tm, int offset_day, long offset_sec);
|
||||||
|
int OPENSSL_gmtime_diff(int *pday, int *psec,
|
||||||
|
const struct tm *from, const struct tm *to);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* CRYPTO_memcmp returns zero iff the |len| bytes at |a| and |b| are equal.
|
||||||
|
* It takes an amount of time dependent on |len|, but independent of the
|
||||||
|
* contents of |a| and |b|. Unlike memcmp, it cannot be used to put elements
|
||||||
|
* into a defined order as the return value when a != b is undefined, other
|
||||||
|
* than to be non-zero.
|
||||||
|
*/
|
||||||
|
int CRYPTO_memcmp(const void * in_a, const void * in_b, size_t len);
|
||||||
|
|
||||||
|
/* Standard initialisation options */
|
||||||
|
# define OPENSSL_INIT_NO_LOAD_CRYPTO_STRINGS 0x00000001L
|
||||||
|
# define OPENSSL_INIT_LOAD_CRYPTO_STRINGS 0x00000002L
|
||||||
|
# define OPENSSL_INIT_ADD_ALL_CIPHERS 0x00000004L
|
||||||
|
# define OPENSSL_INIT_ADD_ALL_DIGESTS 0x00000008L
|
||||||
|
# define OPENSSL_INIT_NO_ADD_ALL_CIPHERS 0x00000010L
|
||||||
|
# define OPENSSL_INIT_NO_ADD_ALL_DIGESTS 0x00000020L
|
||||||
|
# define OPENSSL_INIT_LOAD_CONFIG 0x00000040L
|
||||||
|
# define OPENSSL_INIT_NO_LOAD_CONFIG 0x00000080L
|
||||||
|
# define OPENSSL_INIT_ASYNC 0x00000100L
|
||||||
|
# define OPENSSL_INIT_ENGINE_RDRAND 0x00000200L
|
||||||
|
# define OPENSSL_INIT_ENGINE_DYNAMIC 0x00000400L
|
||||||
|
# define OPENSSL_INIT_ENGINE_OPENSSL 0x00000800L
|
||||||
|
# define OPENSSL_INIT_ENGINE_CRYPTODEV 0x00001000L
|
||||||
|
# define OPENSSL_INIT_ENGINE_CAPI 0x00002000L
|
||||||
|
# define OPENSSL_INIT_ENGINE_PADLOCK 0x00004000L
|
||||||
|
# define OPENSSL_INIT_ENGINE_AFALG 0x00008000L
|
||||||
|
/* FREE: 0x00010000L */
|
||||||
|
# define OPENSSL_INIT_ATFORK 0x00020000L
|
||||||
|
/* OPENSSL_INIT_BASE_ONLY 0x00040000L */
|
||||||
|
# define OPENSSL_INIT_NO_ATEXIT 0x00080000L
|
||||||
|
/* OPENSSL_INIT flag range 0x03f00000 reserved for OPENSSL_init_ssl() */
|
||||||
|
/* FREE: 0x04000000L */
|
||||||
|
/* FREE: 0x08000000L */
|
||||||
|
/* FREE: 0x10000000L */
|
||||||
|
/* FREE: 0x20000000L */
|
||||||
|
/* FREE: 0x40000000L */
|
||||||
|
/* FREE: 0x80000000L */
|
||||||
|
/* Max OPENSSL_INIT flag value is 0x80000000 */
|
||||||
|
|
||||||
|
/* openssl and dasync not counted as builtin */
|
||||||
|
# define OPENSSL_INIT_ENGINE_ALL_BUILTIN \
|
||||||
|
(OPENSSL_INIT_ENGINE_RDRAND | OPENSSL_INIT_ENGINE_DYNAMIC \
|
||||||
|
| OPENSSL_INIT_ENGINE_CRYPTODEV | OPENSSL_INIT_ENGINE_CAPI | \
|
||||||
|
OPENSSL_INIT_ENGINE_PADLOCK)
|
||||||
|
|
||||||
|
/* Library initialisation functions */
|
||||||
|
void OPENSSL_cleanup(void);
|
||||||
|
int OPENSSL_init_crypto(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings);
|
||||||
|
int OPENSSL_atexit(void (*handler)(void));
|
||||||
|
void OPENSSL_thread_stop(void);
|
||||||
|
void OPENSSL_thread_stop_ex(OSSL_LIB_CTX *ctx);
|
||||||
|
|
||||||
|
/* Low-level control of initialization */
|
||||||
|
OPENSSL_INIT_SETTINGS *OPENSSL_INIT_new(void);
|
||||||
|
# ifndef OPENSSL_NO_STDIO
|
||||||
|
int OPENSSL_INIT_set_config_filename(OPENSSL_INIT_SETTINGS *settings,
|
||||||
|
const char *config_filename);
|
||||||
|
void OPENSSL_INIT_set_config_file_flags(OPENSSL_INIT_SETTINGS *settings,
|
||||||
|
unsigned long flags);
|
||||||
|
int OPENSSL_INIT_set_config_appname(OPENSSL_INIT_SETTINGS *settings,
|
||||||
|
const char *config_appname);
|
||||||
|
# endif
|
||||||
|
void OPENSSL_INIT_free(OPENSSL_INIT_SETTINGS *settings);
|
||||||
|
|
||||||
|
# if defined(OPENSSL_THREADS) && !defined(CRYPTO_TDEBUG)
|
||||||
|
# if defined(_WIN32)
|
||||||
|
# if defined(BASETYPES) || defined(_WINDEF_H)
|
||||||
|
/* application has to include <windows.h> in order to use this */
|
||||||
|
typedef DWORD CRYPTO_THREAD_LOCAL;
|
||||||
|
typedef DWORD CRYPTO_THREAD_ID;
|
||||||
|
|
||||||
|
typedef LONG CRYPTO_ONCE;
|
||||||
|
# define CRYPTO_ONCE_STATIC_INIT 0
|
||||||
|
# endif
|
||||||
|
# else
|
||||||
|
# if defined(__TANDEM) && defined(_SPT_MODEL_)
|
||||||
|
# define SPT_THREAD_SIGNAL 1
|
||||||
|
# define SPT_THREAD_AWARE 1
|
||||||
|
# include <spthread.h>
|
||||||
|
# else
|
||||||
|
# include <pthread.h>
|
||||||
|
# endif
|
||||||
|
typedef pthread_once_t CRYPTO_ONCE;
|
||||||
|
typedef pthread_key_t CRYPTO_THREAD_LOCAL;
|
||||||
|
typedef pthread_t CRYPTO_THREAD_ID;
|
||||||
|
|
||||||
|
# define CRYPTO_ONCE_STATIC_INIT PTHREAD_ONCE_INIT
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# if !defined(CRYPTO_ONCE_STATIC_INIT)
|
||||||
|
typedef unsigned int CRYPTO_ONCE;
|
||||||
|
typedef unsigned int CRYPTO_THREAD_LOCAL;
|
||||||
|
typedef unsigned int CRYPTO_THREAD_ID;
|
||||||
|
# define CRYPTO_ONCE_STATIC_INIT 0
|
||||||
|
# endif
|
||||||
|
|
||||||
|
int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void));
|
||||||
|
|
||||||
|
int CRYPTO_THREAD_init_local(CRYPTO_THREAD_LOCAL *key, void (*cleanup)(void *));
|
||||||
|
void *CRYPTO_THREAD_get_local(CRYPTO_THREAD_LOCAL *key);
|
||||||
|
int CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val);
|
||||||
|
int CRYPTO_THREAD_cleanup_local(CRYPTO_THREAD_LOCAL *key);
|
||||||
|
|
||||||
|
CRYPTO_THREAD_ID CRYPTO_THREAD_get_current_id(void);
|
||||||
|
int CRYPTO_THREAD_compare_id(CRYPTO_THREAD_ID a, CRYPTO_THREAD_ID b);
|
||||||
|
|
||||||
|
OSSL_LIB_CTX *OSSL_LIB_CTX_new(void);
|
||||||
|
OSSL_LIB_CTX *OSSL_LIB_CTX_new_from_dispatch(const OSSL_CORE_HANDLE *handle,
|
||||||
|
const OSSL_DISPATCH *in);
|
||||||
|
OSSL_LIB_CTX *OSSL_LIB_CTX_new_child(const OSSL_CORE_HANDLE *handle,
|
||||||
|
const OSSL_DISPATCH *in);
|
||||||
|
int OSSL_LIB_CTX_load_config(OSSL_LIB_CTX *ctx, const char *config_file);
|
||||||
|
void OSSL_LIB_CTX_free(OSSL_LIB_CTX *);
|
||||||
|
OSSL_LIB_CTX *OSSL_LIB_CTX_get0_global_default(void);
|
||||||
|
OSSL_LIB_CTX *OSSL_LIB_CTX_set0_default(OSSL_LIB_CTX *libctx);
|
||||||
|
int OSSL_LIB_CTX_get_conf_diagnostics(OSSL_LIB_CTX *ctx);
|
||||||
|
void OSSL_LIB_CTX_set_conf_diagnostics(OSSL_LIB_CTX *ctx, int value);
|
||||||
|
|
||||||
|
void OSSL_sleep(uint64_t millis);
|
||||||
|
|
||||||
|
|
||||||
|
void *OSSL_LIB_CTX_get_data(OSSL_LIB_CTX *ctx, int index);
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
/*
|
||||||
|
* Generated by util/mkerr.pl DO NOT EDIT
|
||||||
|
* Copyright 1995-2024 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef OPENSSL_CRYPTOERR_H
|
||||||
|
# define OPENSSL_CRYPTOERR_H
|
||||||
|
# pragma once
|
||||||
|
|
||||||
|
# include <openssl/opensslconf.h>
|
||||||
|
# include <openssl/symhacks.h>
|
||||||
|
# include <openssl/cryptoerr_legacy.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* CRYPTO reason codes.
|
||||||
|
*/
|
||||||
|
# define CRYPTO_R_BAD_ALGORITHM_NAME 117
|
||||||
|
# define CRYPTO_R_CONFLICTING_NAMES 118
|
||||||
|
# define CRYPTO_R_HEX_STRING_TOO_SHORT 121
|
||||||
|
# define CRYPTO_R_ILLEGAL_HEX_DIGIT 102
|
||||||
|
# define CRYPTO_R_INSUFFICIENT_DATA_SPACE 106
|
||||||
|
# define CRYPTO_R_INSUFFICIENT_PARAM_SIZE 107
|
||||||
|
# define CRYPTO_R_INSUFFICIENT_SECURE_DATA_SPACE 108
|
||||||
|
# define CRYPTO_R_INTEGER_OVERFLOW 127
|
||||||
|
# define CRYPTO_R_INVALID_NEGATIVE_VALUE 122
|
||||||
|
# define CRYPTO_R_INVALID_NULL_ARGUMENT 109
|
||||||
|
# define CRYPTO_R_INVALID_OSSL_PARAM_TYPE 110
|
||||||
|
# define CRYPTO_R_NO_PARAMS_TO_MERGE 131
|
||||||
|
# define CRYPTO_R_NO_SPACE_FOR_TERMINATING_NULL 128
|
||||||
|
# define CRYPTO_R_ODD_NUMBER_OF_DIGITS 103
|
||||||
|
# define CRYPTO_R_PARAM_CANNOT_BE_REPRESENTED_EXACTLY 123
|
||||||
|
# define CRYPTO_R_PARAM_NOT_INTEGER_TYPE 124
|
||||||
|
# define CRYPTO_R_PARAM_OF_INCOMPATIBLE_TYPE 129
|
||||||
|
# define CRYPTO_R_PARAM_UNSIGNED_INTEGER_NEGATIVE_VALUE_UNSUPPORTED 125
|
||||||
|
# define CRYPTO_R_PARAM_UNSUPPORTED_FLOATING_POINT_FORMAT 130
|
||||||
|
# define CRYPTO_R_PARAM_VALUE_TOO_LARGE_FOR_DESTINATION 126
|
||||||
|
# define CRYPTO_R_PROVIDER_ALREADY_EXISTS 104
|
||||||
|
# define CRYPTO_R_PROVIDER_SECTION_ERROR 105
|
||||||
|
# define CRYPTO_R_RANDOM_SECTION_ERROR 119
|
||||||
|
# define CRYPTO_R_SECURE_MALLOC_FAILURE 111
|
||||||
|
# define CRYPTO_R_STRING_TOO_LONG 112
|
||||||
|
# define CRYPTO_R_TOO_MANY_BYTES 113
|
||||||
|
# define CRYPTO_R_TOO_MANY_NAMES 132
|
||||||
|
# define CRYPTO_R_TOO_MANY_RECORDS 114
|
||||||
|
# define CRYPTO_R_TOO_SMALL_BUFFER 116
|
||||||
|
# define CRYPTO_R_UNKNOWN_NAME_IN_RANDOM_SECTION 120
|
||||||
|
# define CRYPTO_R_ZERO_LENGTH_NUMBER 115
|
||||||
|
|
||||||
|
#endif
|
||||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,573 @@
|
|||||||
|
/*
|
||||||
|
* WARNING: do not edit!
|
||||||
|
* Generated by Makefile from ../../openssl-3.5.0/include/openssl/ct.h.in
|
||||||
|
*
|
||||||
|
* Copyright 2016-2020 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef OPENSSL_CT_H
|
||||||
|
# define OPENSSL_CT_H
|
||||||
|
# pragma once
|
||||||
|
|
||||||
|
# include <openssl/macros.h>
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
# define HEADER_CT_H
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# include <openssl/opensslconf.h>
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_CT
|
||||||
|
# include <openssl/types.h>
|
||||||
|
# include <openssl/safestack.h>
|
||||||
|
# include <openssl/x509.h>
|
||||||
|
# include <openssl/cterr.h>
|
||||||
|
# ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
# endif
|
||||||
|
|
||||||
|
|
||||||
|
/* Minimum RSA key size, from RFC6962 */
|
||||||
|
# define SCT_MIN_RSA_BITS 2048
|
||||||
|
|
||||||
|
/* All hashes are SHA256 in v1 of Certificate Transparency */
|
||||||
|
# define CT_V1_HASHLEN SHA256_DIGEST_LENGTH
|
||||||
|
|
||||||
|
SKM_DEFINE_STACK_OF_INTERNAL(SCT, SCT, SCT)
|
||||||
|
#define sk_SCT_num(sk) OPENSSL_sk_num(ossl_check_const_SCT_sk_type(sk))
|
||||||
|
#define sk_SCT_value(sk, idx) ((SCT *)OPENSSL_sk_value(ossl_check_const_SCT_sk_type(sk), (idx)))
|
||||||
|
#define sk_SCT_new(cmp) ((STACK_OF(SCT) *)OPENSSL_sk_new(ossl_check_SCT_compfunc_type(cmp)))
|
||||||
|
#define sk_SCT_new_null() ((STACK_OF(SCT) *)OPENSSL_sk_new_null())
|
||||||
|
#define sk_SCT_new_reserve(cmp, n) ((STACK_OF(SCT) *)OPENSSL_sk_new_reserve(ossl_check_SCT_compfunc_type(cmp), (n)))
|
||||||
|
#define sk_SCT_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_SCT_sk_type(sk), (n))
|
||||||
|
#define sk_SCT_free(sk) OPENSSL_sk_free(ossl_check_SCT_sk_type(sk))
|
||||||
|
#define sk_SCT_zero(sk) OPENSSL_sk_zero(ossl_check_SCT_sk_type(sk))
|
||||||
|
#define sk_SCT_delete(sk, i) ((SCT *)OPENSSL_sk_delete(ossl_check_SCT_sk_type(sk), (i)))
|
||||||
|
#define sk_SCT_delete_ptr(sk, ptr) ((SCT *)OPENSSL_sk_delete_ptr(ossl_check_SCT_sk_type(sk), ossl_check_SCT_type(ptr)))
|
||||||
|
#define sk_SCT_push(sk, ptr) OPENSSL_sk_push(ossl_check_SCT_sk_type(sk), ossl_check_SCT_type(ptr))
|
||||||
|
#define sk_SCT_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_SCT_sk_type(sk), ossl_check_SCT_type(ptr))
|
||||||
|
#define sk_SCT_pop(sk) ((SCT *)OPENSSL_sk_pop(ossl_check_SCT_sk_type(sk)))
|
||||||
|
#define sk_SCT_shift(sk) ((SCT *)OPENSSL_sk_shift(ossl_check_SCT_sk_type(sk)))
|
||||||
|
#define sk_SCT_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_SCT_sk_type(sk),ossl_check_SCT_freefunc_type(freefunc))
|
||||||
|
#define sk_SCT_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_SCT_sk_type(sk), ossl_check_SCT_type(ptr), (idx))
|
||||||
|
#define sk_SCT_set(sk, idx, ptr) ((SCT *)OPENSSL_sk_set(ossl_check_SCT_sk_type(sk), (idx), ossl_check_SCT_type(ptr)))
|
||||||
|
#define sk_SCT_find(sk, ptr) OPENSSL_sk_find(ossl_check_SCT_sk_type(sk), ossl_check_SCT_type(ptr))
|
||||||
|
#define sk_SCT_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_SCT_sk_type(sk), ossl_check_SCT_type(ptr))
|
||||||
|
#define sk_SCT_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_SCT_sk_type(sk), ossl_check_SCT_type(ptr), pnum)
|
||||||
|
#define sk_SCT_sort(sk) OPENSSL_sk_sort(ossl_check_SCT_sk_type(sk))
|
||||||
|
#define sk_SCT_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_SCT_sk_type(sk))
|
||||||
|
#define sk_SCT_dup(sk) ((STACK_OF(SCT) *)OPENSSL_sk_dup(ossl_check_const_SCT_sk_type(sk)))
|
||||||
|
#define sk_SCT_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(SCT) *)OPENSSL_sk_deep_copy(ossl_check_const_SCT_sk_type(sk), ossl_check_SCT_copyfunc_type(copyfunc), ossl_check_SCT_freefunc_type(freefunc)))
|
||||||
|
#define sk_SCT_set_cmp_func(sk, cmp) ((sk_SCT_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_SCT_sk_type(sk), ossl_check_SCT_compfunc_type(cmp)))
|
||||||
|
SKM_DEFINE_STACK_OF_INTERNAL(CTLOG, CTLOG, CTLOG)
|
||||||
|
#define sk_CTLOG_num(sk) OPENSSL_sk_num(ossl_check_const_CTLOG_sk_type(sk))
|
||||||
|
#define sk_CTLOG_value(sk, idx) ((CTLOG *)OPENSSL_sk_value(ossl_check_const_CTLOG_sk_type(sk), (idx)))
|
||||||
|
#define sk_CTLOG_new(cmp) ((STACK_OF(CTLOG) *)OPENSSL_sk_new(ossl_check_CTLOG_compfunc_type(cmp)))
|
||||||
|
#define sk_CTLOG_new_null() ((STACK_OF(CTLOG) *)OPENSSL_sk_new_null())
|
||||||
|
#define sk_CTLOG_new_reserve(cmp, n) ((STACK_OF(CTLOG) *)OPENSSL_sk_new_reserve(ossl_check_CTLOG_compfunc_type(cmp), (n)))
|
||||||
|
#define sk_CTLOG_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_CTLOG_sk_type(sk), (n))
|
||||||
|
#define sk_CTLOG_free(sk) OPENSSL_sk_free(ossl_check_CTLOG_sk_type(sk))
|
||||||
|
#define sk_CTLOG_zero(sk) OPENSSL_sk_zero(ossl_check_CTLOG_sk_type(sk))
|
||||||
|
#define sk_CTLOG_delete(sk, i) ((CTLOG *)OPENSSL_sk_delete(ossl_check_CTLOG_sk_type(sk), (i)))
|
||||||
|
#define sk_CTLOG_delete_ptr(sk, ptr) ((CTLOG *)OPENSSL_sk_delete_ptr(ossl_check_CTLOG_sk_type(sk), ossl_check_CTLOG_type(ptr)))
|
||||||
|
#define sk_CTLOG_push(sk, ptr) OPENSSL_sk_push(ossl_check_CTLOG_sk_type(sk), ossl_check_CTLOG_type(ptr))
|
||||||
|
#define sk_CTLOG_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_CTLOG_sk_type(sk), ossl_check_CTLOG_type(ptr))
|
||||||
|
#define sk_CTLOG_pop(sk) ((CTLOG *)OPENSSL_sk_pop(ossl_check_CTLOG_sk_type(sk)))
|
||||||
|
#define sk_CTLOG_shift(sk) ((CTLOG *)OPENSSL_sk_shift(ossl_check_CTLOG_sk_type(sk)))
|
||||||
|
#define sk_CTLOG_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_CTLOG_sk_type(sk),ossl_check_CTLOG_freefunc_type(freefunc))
|
||||||
|
#define sk_CTLOG_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_CTLOG_sk_type(sk), ossl_check_CTLOG_type(ptr), (idx))
|
||||||
|
#define sk_CTLOG_set(sk, idx, ptr) ((CTLOG *)OPENSSL_sk_set(ossl_check_CTLOG_sk_type(sk), (idx), ossl_check_CTLOG_type(ptr)))
|
||||||
|
#define sk_CTLOG_find(sk, ptr) OPENSSL_sk_find(ossl_check_CTLOG_sk_type(sk), ossl_check_CTLOG_type(ptr))
|
||||||
|
#define sk_CTLOG_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_CTLOG_sk_type(sk), ossl_check_CTLOG_type(ptr))
|
||||||
|
#define sk_CTLOG_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_CTLOG_sk_type(sk), ossl_check_CTLOG_type(ptr), pnum)
|
||||||
|
#define sk_CTLOG_sort(sk) OPENSSL_sk_sort(ossl_check_CTLOG_sk_type(sk))
|
||||||
|
#define sk_CTLOG_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_CTLOG_sk_type(sk))
|
||||||
|
#define sk_CTLOG_dup(sk) ((STACK_OF(CTLOG) *)OPENSSL_sk_dup(ossl_check_const_CTLOG_sk_type(sk)))
|
||||||
|
#define sk_CTLOG_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(CTLOG) *)OPENSSL_sk_deep_copy(ossl_check_const_CTLOG_sk_type(sk), ossl_check_CTLOG_copyfunc_type(copyfunc), ossl_check_CTLOG_freefunc_type(freefunc)))
|
||||||
|
#define sk_CTLOG_set_cmp_func(sk, cmp) ((sk_CTLOG_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_CTLOG_sk_type(sk), ossl_check_CTLOG_compfunc_type(cmp)))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
CT_LOG_ENTRY_TYPE_NOT_SET = -1,
|
||||||
|
CT_LOG_ENTRY_TYPE_X509 = 0,
|
||||||
|
CT_LOG_ENTRY_TYPE_PRECERT = 1
|
||||||
|
} ct_log_entry_type_t;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
SCT_VERSION_NOT_SET = -1,
|
||||||
|
SCT_VERSION_V1 = 0
|
||||||
|
} sct_version_t;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
SCT_SOURCE_UNKNOWN,
|
||||||
|
SCT_SOURCE_TLS_EXTENSION,
|
||||||
|
SCT_SOURCE_X509V3_EXTENSION,
|
||||||
|
SCT_SOURCE_OCSP_STAPLED_RESPONSE
|
||||||
|
} sct_source_t;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
SCT_VALIDATION_STATUS_NOT_SET,
|
||||||
|
SCT_VALIDATION_STATUS_UNKNOWN_LOG,
|
||||||
|
SCT_VALIDATION_STATUS_VALID,
|
||||||
|
SCT_VALIDATION_STATUS_INVALID,
|
||||||
|
SCT_VALIDATION_STATUS_UNVERIFIED,
|
||||||
|
SCT_VALIDATION_STATUS_UNKNOWN_VERSION
|
||||||
|
} sct_validation_status_t;
|
||||||
|
|
||||||
|
/******************************************
|
||||||
|
* CT policy evaluation context functions *
|
||||||
|
******************************************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Creates a new, empty policy evaluation context associated with the given
|
||||||
|
* library context and property query string.
|
||||||
|
* The caller is responsible for calling CT_POLICY_EVAL_CTX_free when finished
|
||||||
|
* with the CT_POLICY_EVAL_CTX.
|
||||||
|
*/
|
||||||
|
CT_POLICY_EVAL_CTX *CT_POLICY_EVAL_CTX_new_ex(OSSL_LIB_CTX *libctx,
|
||||||
|
const char *propq);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The same as CT_POLICY_EVAL_CTX_new_ex() but the default library
|
||||||
|
* context and property query string is used.
|
||||||
|
*/
|
||||||
|
CT_POLICY_EVAL_CTX *CT_POLICY_EVAL_CTX_new(void);
|
||||||
|
|
||||||
|
/* Deletes a policy evaluation context and anything it owns. */
|
||||||
|
void CT_POLICY_EVAL_CTX_free(CT_POLICY_EVAL_CTX *ctx);
|
||||||
|
|
||||||
|
/* Gets the peer certificate that the SCTs are for */
|
||||||
|
X509* CT_POLICY_EVAL_CTX_get0_cert(const CT_POLICY_EVAL_CTX *ctx);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Sets the certificate associated with the received SCTs.
|
||||||
|
* Increments the reference count of cert.
|
||||||
|
* Returns 1 on success, 0 otherwise.
|
||||||
|
*/
|
||||||
|
int CT_POLICY_EVAL_CTX_set1_cert(CT_POLICY_EVAL_CTX *ctx, X509 *cert);
|
||||||
|
|
||||||
|
/* Gets the issuer of the aforementioned certificate */
|
||||||
|
X509* CT_POLICY_EVAL_CTX_get0_issuer(const CT_POLICY_EVAL_CTX *ctx);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Sets the issuer of the certificate associated with the received SCTs.
|
||||||
|
* Increments the reference count of issuer.
|
||||||
|
* Returns 1 on success, 0 otherwise.
|
||||||
|
*/
|
||||||
|
int CT_POLICY_EVAL_CTX_set1_issuer(CT_POLICY_EVAL_CTX *ctx, X509 *issuer);
|
||||||
|
|
||||||
|
/* Gets the CT logs that are trusted sources of SCTs */
|
||||||
|
const CTLOG_STORE *CT_POLICY_EVAL_CTX_get0_log_store(const CT_POLICY_EVAL_CTX *ctx);
|
||||||
|
|
||||||
|
/* Sets the log store that is in use. It must outlive the CT_POLICY_EVAL_CTX. */
|
||||||
|
void CT_POLICY_EVAL_CTX_set_shared_CTLOG_STORE(CT_POLICY_EVAL_CTX *ctx,
|
||||||
|
CTLOG_STORE *log_store);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Gets the time, in milliseconds since the Unix epoch, that will be used as the
|
||||||
|
* current time when checking whether an SCT was issued in the future.
|
||||||
|
* Such SCTs will fail validation, as required by RFC6962.
|
||||||
|
*/
|
||||||
|
uint64_t CT_POLICY_EVAL_CTX_get_time(const CT_POLICY_EVAL_CTX *ctx);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Sets the time to evaluate SCTs against, in milliseconds since the Unix epoch.
|
||||||
|
* If an SCT's timestamp is after this time, it will be interpreted as having
|
||||||
|
* been issued in the future. RFC6962 states that "TLS clients MUST reject SCTs
|
||||||
|
* whose timestamp is in the future", so an SCT will not validate in this case.
|
||||||
|
*/
|
||||||
|
void CT_POLICY_EVAL_CTX_set_time(CT_POLICY_EVAL_CTX *ctx, uint64_t time_in_ms);
|
||||||
|
|
||||||
|
/*****************
|
||||||
|
* SCT functions *
|
||||||
|
*****************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Creates a new, blank SCT.
|
||||||
|
* The caller is responsible for calling SCT_free when finished with the SCT.
|
||||||
|
*/
|
||||||
|
SCT *SCT_new(void);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Creates a new SCT from some base64-encoded strings.
|
||||||
|
* The caller is responsible for calling SCT_free when finished with the SCT.
|
||||||
|
*/
|
||||||
|
SCT *SCT_new_from_base64(unsigned char version,
|
||||||
|
const char *logid_base64,
|
||||||
|
ct_log_entry_type_t entry_type,
|
||||||
|
uint64_t timestamp,
|
||||||
|
const char *extensions_base64,
|
||||||
|
const char *signature_base64);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Frees the SCT and the underlying data structures.
|
||||||
|
*/
|
||||||
|
void SCT_free(SCT *sct);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Free a stack of SCTs, and the underlying SCTs themselves.
|
||||||
|
* Intended to be compatible with X509V3_EXT_FREE.
|
||||||
|
*/
|
||||||
|
void SCT_LIST_free(STACK_OF(SCT) *a);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Returns the version of the SCT.
|
||||||
|
*/
|
||||||
|
sct_version_t SCT_get_version(const SCT *sct);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set the version of an SCT.
|
||||||
|
* Returns 1 on success, 0 if the version is unrecognized.
|
||||||
|
*/
|
||||||
|
__owur int SCT_set_version(SCT *sct, sct_version_t version);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Returns the log entry type of the SCT.
|
||||||
|
*/
|
||||||
|
ct_log_entry_type_t SCT_get_log_entry_type(const SCT *sct);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set the log entry type of an SCT.
|
||||||
|
* Returns 1 on success, 0 otherwise.
|
||||||
|
*/
|
||||||
|
__owur int SCT_set_log_entry_type(SCT *sct, ct_log_entry_type_t entry_type);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Gets the ID of the log that an SCT came from.
|
||||||
|
* Ownership of the log ID remains with the SCT.
|
||||||
|
* Returns the length of the log ID.
|
||||||
|
*/
|
||||||
|
size_t SCT_get0_log_id(const SCT *sct, unsigned char **log_id);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set the log ID of an SCT to point directly to the *log_id specified.
|
||||||
|
* The SCT takes ownership of the specified pointer.
|
||||||
|
* Returns 1 on success, 0 otherwise.
|
||||||
|
*/
|
||||||
|
__owur int SCT_set0_log_id(SCT *sct, unsigned char *log_id, size_t log_id_len);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set the log ID of an SCT.
|
||||||
|
* This makes a copy of the log_id.
|
||||||
|
* Returns 1 on success, 0 otherwise.
|
||||||
|
*/
|
||||||
|
__owur int SCT_set1_log_id(SCT *sct, const unsigned char *log_id,
|
||||||
|
size_t log_id_len);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Returns the timestamp for the SCT (epoch time in milliseconds).
|
||||||
|
*/
|
||||||
|
uint64_t SCT_get_timestamp(const SCT *sct);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set the timestamp of an SCT (epoch time in milliseconds).
|
||||||
|
*/
|
||||||
|
void SCT_set_timestamp(SCT *sct, uint64_t timestamp);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Return the NID for the signature used by the SCT.
|
||||||
|
* For CT v1, this will be either NID_sha256WithRSAEncryption or
|
||||||
|
* NID_ecdsa_with_SHA256 (or NID_undef if incorrect/unset).
|
||||||
|
*/
|
||||||
|
int SCT_get_signature_nid(const SCT *sct);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set the signature type of an SCT
|
||||||
|
* For CT v1, this should be either NID_sha256WithRSAEncryption or
|
||||||
|
* NID_ecdsa_with_SHA256.
|
||||||
|
* Returns 1 on success, 0 otherwise.
|
||||||
|
*/
|
||||||
|
__owur int SCT_set_signature_nid(SCT *sct, int nid);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set *ext to point to the extension data for the SCT. ext must not be NULL.
|
||||||
|
* The SCT retains ownership of this pointer.
|
||||||
|
* Returns length of the data pointed to.
|
||||||
|
*/
|
||||||
|
size_t SCT_get0_extensions(const SCT *sct, unsigned char **ext);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set the extensions of an SCT to point directly to the *ext specified.
|
||||||
|
* The SCT takes ownership of the specified pointer.
|
||||||
|
*/
|
||||||
|
void SCT_set0_extensions(SCT *sct, unsigned char *ext, size_t ext_len);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set the extensions of an SCT.
|
||||||
|
* This takes a copy of the ext.
|
||||||
|
* Returns 1 on success, 0 otherwise.
|
||||||
|
*/
|
||||||
|
__owur int SCT_set1_extensions(SCT *sct, const unsigned char *ext,
|
||||||
|
size_t ext_len);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set *sig to point to the signature for the SCT. sig must not be NULL.
|
||||||
|
* The SCT retains ownership of this pointer.
|
||||||
|
* Returns length of the data pointed to.
|
||||||
|
*/
|
||||||
|
size_t SCT_get0_signature(const SCT *sct, unsigned char **sig);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set the signature of an SCT to point directly to the *sig specified.
|
||||||
|
* The SCT takes ownership of the specified pointer.
|
||||||
|
*/
|
||||||
|
void SCT_set0_signature(SCT *sct, unsigned char *sig, size_t sig_len);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set the signature of an SCT to be a copy of the *sig specified.
|
||||||
|
* Returns 1 on success, 0 otherwise.
|
||||||
|
*/
|
||||||
|
__owur int SCT_set1_signature(SCT *sct, const unsigned char *sig,
|
||||||
|
size_t sig_len);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The origin of this SCT, e.g. TLS extension, OCSP response, etc.
|
||||||
|
*/
|
||||||
|
sct_source_t SCT_get_source(const SCT *sct);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set the origin of this SCT, e.g. TLS extension, OCSP response, etc.
|
||||||
|
* Returns 1 on success, 0 otherwise.
|
||||||
|
*/
|
||||||
|
__owur int SCT_set_source(SCT *sct, sct_source_t source);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Returns a text string describing the validation status of |sct|.
|
||||||
|
*/
|
||||||
|
const char *SCT_validation_status_string(const SCT *sct);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Pretty-prints an |sct| to |out|.
|
||||||
|
* It will be indented by the number of spaces specified by |indent|.
|
||||||
|
* If |logs| is not NULL, it will be used to lookup the CT log that the SCT came
|
||||||
|
* from, so that the log name can be printed.
|
||||||
|
*/
|
||||||
|
void SCT_print(const SCT *sct, BIO *out, int indent, const CTLOG_STORE *logs);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Pretty-prints an |sct_list| to |out|.
|
||||||
|
* It will be indented by the number of spaces specified by |indent|.
|
||||||
|
* SCTs will be delimited by |separator|.
|
||||||
|
* If |logs| is not NULL, it will be used to lookup the CT log that each SCT
|
||||||
|
* came from, so that the log names can be printed.
|
||||||
|
*/
|
||||||
|
void SCT_LIST_print(const STACK_OF(SCT) *sct_list, BIO *out, int indent,
|
||||||
|
const char *separator, const CTLOG_STORE *logs);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Gets the last result of validating this SCT.
|
||||||
|
* If it has not been validated yet, returns SCT_VALIDATION_STATUS_NOT_SET.
|
||||||
|
*/
|
||||||
|
sct_validation_status_t SCT_get_validation_status(const SCT *sct);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Validates the given SCT with the provided context.
|
||||||
|
* Sets the "validation_status" field of the SCT.
|
||||||
|
* Returns 1 if the SCT is valid and the signature verifies.
|
||||||
|
* Returns 0 if the SCT is invalid or could not be verified.
|
||||||
|
* Returns -1 if an error occurs.
|
||||||
|
*/
|
||||||
|
__owur int SCT_validate(SCT *sct, const CT_POLICY_EVAL_CTX *ctx);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Validates the given list of SCTs with the provided context.
|
||||||
|
* Sets the "validation_status" field of each SCT.
|
||||||
|
* Returns 1 if there are no invalid SCTs and all signatures verify.
|
||||||
|
* Returns 0 if at least one SCT is invalid or could not be verified.
|
||||||
|
* Returns a negative integer if an error occurs.
|
||||||
|
*/
|
||||||
|
__owur int SCT_LIST_validate(const STACK_OF(SCT) *scts,
|
||||||
|
CT_POLICY_EVAL_CTX *ctx);
|
||||||
|
|
||||||
|
|
||||||
|
/*********************************
|
||||||
|
* SCT parsing and serialization *
|
||||||
|
*********************************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Serialize (to TLS format) a stack of SCTs and return the length.
|
||||||
|
* "a" must not be NULL.
|
||||||
|
* If "pp" is NULL, just return the length of what would have been serialized.
|
||||||
|
* If "pp" is not NULL and "*pp" is null, function will allocate a new pointer
|
||||||
|
* for data that caller is responsible for freeing (only if function returns
|
||||||
|
* successfully).
|
||||||
|
* If "pp" is NULL and "*pp" is not NULL, caller is responsible for ensuring
|
||||||
|
* that "*pp" is large enough to accept all of the serialized data.
|
||||||
|
* Returns < 0 on error, >= 0 indicating bytes written (or would have been)
|
||||||
|
* on success.
|
||||||
|
*/
|
||||||
|
__owur int i2o_SCT_LIST(const STACK_OF(SCT) *a, unsigned char **pp);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Convert TLS format SCT list to a stack of SCTs.
|
||||||
|
* If "a" or "*a" is NULL, a new stack will be created that the caller is
|
||||||
|
* responsible for freeing (by calling SCT_LIST_free).
|
||||||
|
* "**pp" and "*pp" must not be NULL.
|
||||||
|
* Upon success, "*pp" will point to after the last bytes read, and a stack
|
||||||
|
* will be returned.
|
||||||
|
* Upon failure, a NULL pointer will be returned, and the position of "*pp" is
|
||||||
|
* not defined.
|
||||||
|
*/
|
||||||
|
STACK_OF(SCT) *o2i_SCT_LIST(STACK_OF(SCT) **a, const unsigned char **pp,
|
||||||
|
size_t len);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Serialize (to DER format) a stack of SCTs and return the length.
|
||||||
|
* "a" must not be NULL.
|
||||||
|
* If "pp" is NULL, just returns the length of what would have been serialized.
|
||||||
|
* If "pp" is not NULL and "*pp" is null, function will allocate a new pointer
|
||||||
|
* for data that caller is responsible for freeing (only if function returns
|
||||||
|
* successfully).
|
||||||
|
* If "pp" is NULL and "*pp" is not NULL, caller is responsible for ensuring
|
||||||
|
* that "*pp" is large enough to accept all of the serialized data.
|
||||||
|
* Returns < 0 on error, >= 0 indicating bytes written (or would have been)
|
||||||
|
* on success.
|
||||||
|
*/
|
||||||
|
__owur int i2d_SCT_LIST(const STACK_OF(SCT) *a, unsigned char **pp);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Parses an SCT list in DER format and returns it.
|
||||||
|
* If "a" or "*a" is NULL, a new stack will be created that the caller is
|
||||||
|
* responsible for freeing (by calling SCT_LIST_free).
|
||||||
|
* "**pp" and "*pp" must not be NULL.
|
||||||
|
* Upon success, "*pp" will point to after the last bytes read, and a stack
|
||||||
|
* will be returned.
|
||||||
|
* Upon failure, a NULL pointer will be returned, and the position of "*pp" is
|
||||||
|
* not defined.
|
||||||
|
*/
|
||||||
|
STACK_OF(SCT) *d2i_SCT_LIST(STACK_OF(SCT) **a, const unsigned char **pp,
|
||||||
|
long len);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Serialize (to TLS format) an |sct| and write it to |out|.
|
||||||
|
* If |out| is null, no SCT will be output but the length will still be returned.
|
||||||
|
* If |out| points to a null pointer, a string will be allocated to hold the
|
||||||
|
* TLS-format SCT. It is the responsibility of the caller to free it.
|
||||||
|
* If |out| points to an allocated string, the TLS-format SCT will be written
|
||||||
|
* to it.
|
||||||
|
* The length of the SCT in TLS format will be returned.
|
||||||
|
*/
|
||||||
|
__owur int i2o_SCT(const SCT *sct, unsigned char **out);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Parses an SCT in TLS format and returns it.
|
||||||
|
* If |psct| is not null, it will end up pointing to the parsed SCT. If it
|
||||||
|
* already points to a non-null pointer, the pointer will be free'd.
|
||||||
|
* |in| should be a pointer to a string containing the TLS-format SCT.
|
||||||
|
* |in| will be advanced to the end of the SCT if parsing succeeds.
|
||||||
|
* |len| should be the length of the SCT in |in|.
|
||||||
|
* Returns NULL if an error occurs.
|
||||||
|
* If the SCT is an unsupported version, only the SCT's 'sct' and 'sct_len'
|
||||||
|
* fields will be populated (with |in| and |len| respectively).
|
||||||
|
*/
|
||||||
|
SCT *o2i_SCT(SCT **psct, const unsigned char **in, size_t len);
|
||||||
|
|
||||||
|
/********************
|
||||||
|
* CT log functions *
|
||||||
|
********************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Creates a new CT log instance with the given |public_key| and |name| and
|
||||||
|
* associates it with the give library context |libctx| and property query
|
||||||
|
* string |propq|.
|
||||||
|
* Takes ownership of |public_key| but copies |name|.
|
||||||
|
* Returns NULL if malloc fails or if |public_key| cannot be converted to DER.
|
||||||
|
* Should be deleted by the caller using CTLOG_free when no longer needed.
|
||||||
|
*/
|
||||||
|
CTLOG *CTLOG_new_ex(EVP_PKEY *public_key, const char *name, OSSL_LIB_CTX *libctx,
|
||||||
|
const char *propq);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The same as CTLOG_new_ex except that the default library context and
|
||||||
|
* property query string are used.
|
||||||
|
*/
|
||||||
|
CTLOG *CTLOG_new(EVP_PKEY *public_key, const char *name);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Creates a new CTLOG instance with the base64-encoded SubjectPublicKeyInfo DER
|
||||||
|
* in |pkey_base64| and associated with the given library context |libctx| and
|
||||||
|
* property query string |propq|. The |name| is a string to help users identify
|
||||||
|
* this log.
|
||||||
|
* Returns 1 on success, 0 on failure.
|
||||||
|
* Should be deleted by the caller using CTLOG_free when no longer needed.
|
||||||
|
*/
|
||||||
|
int CTLOG_new_from_base64_ex(CTLOG **ct_log, const char *pkey_base64,
|
||||||
|
const char *name, OSSL_LIB_CTX *libctx,
|
||||||
|
const char *propq);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The same as CTLOG_new_from_base64_ex() except that the default
|
||||||
|
* library context and property query string are used.
|
||||||
|
* Returns 1 on success, 0 on failure.
|
||||||
|
*/
|
||||||
|
int CTLOG_new_from_base64(CTLOG ** ct_log,
|
||||||
|
const char *pkey_base64, const char *name);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Deletes a CT log instance and its fields.
|
||||||
|
*/
|
||||||
|
void CTLOG_free(CTLOG *log);
|
||||||
|
|
||||||
|
/* Gets the name of the CT log */
|
||||||
|
const char *CTLOG_get0_name(const CTLOG *log);
|
||||||
|
/* Gets the ID of the CT log */
|
||||||
|
void CTLOG_get0_log_id(const CTLOG *log, const uint8_t **log_id,
|
||||||
|
size_t *log_id_len);
|
||||||
|
/* Gets the public key of the CT log */
|
||||||
|
EVP_PKEY *CTLOG_get0_public_key(const CTLOG *log);
|
||||||
|
|
||||||
|
/**************************
|
||||||
|
* CT log store functions *
|
||||||
|
**************************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Creates a new CT log store and associates it with the given libctx and
|
||||||
|
* property query string.
|
||||||
|
* Should be deleted by the caller using CTLOG_STORE_free when no longer needed.
|
||||||
|
*/
|
||||||
|
CTLOG_STORE *CTLOG_STORE_new_ex(OSSL_LIB_CTX *libctx, const char *propq);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Same as CTLOG_STORE_new_ex except that the default libctx and
|
||||||
|
* property query string are used.
|
||||||
|
* Should be deleted by the caller using CTLOG_STORE_free when no longer needed.
|
||||||
|
*/
|
||||||
|
CTLOG_STORE *CTLOG_STORE_new(void);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Deletes a CT log store and all of the CT log instances held within.
|
||||||
|
*/
|
||||||
|
void CTLOG_STORE_free(CTLOG_STORE *store);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Finds a CT log in the store based on its log ID.
|
||||||
|
* Returns the CT log, or NULL if no match is found.
|
||||||
|
*/
|
||||||
|
const CTLOG *CTLOG_STORE_get0_log_by_id(const CTLOG_STORE *store,
|
||||||
|
const uint8_t *log_id,
|
||||||
|
size_t log_id_len);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Loads a CT log list into a |store| from a |file|.
|
||||||
|
* Returns 1 if loading is successful, or 0 otherwise.
|
||||||
|
*/
|
||||||
|
__owur int CTLOG_STORE_load_file(CTLOG_STORE *store, const char *file);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Loads the default CT log list into a |store|.
|
||||||
|
* Returns 1 if loading is successful, or 0 otherwise.
|
||||||
|
*/
|
||||||
|
__owur int CTLOG_STORE_load_default_file(CTLOG_STORE *store);
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* Generated by util/mkerr.pl DO NOT EDIT
|
||||||
|
* Copyright 1995-2021 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef OPENSSL_CTERR_H
|
||||||
|
# define OPENSSL_CTERR_H
|
||||||
|
# pragma once
|
||||||
|
|
||||||
|
# include <openssl/opensslconf.h>
|
||||||
|
# include <openssl/symhacks.h>
|
||||||
|
# include <openssl/cryptoerr_legacy.h>
|
||||||
|
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_CT
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* CT reason codes.
|
||||||
|
*/
|
||||||
|
# define CT_R_BASE64_DECODE_ERROR 108
|
||||||
|
# define CT_R_INVALID_LOG_ID_LENGTH 100
|
||||||
|
# define CT_R_LOG_CONF_INVALID 109
|
||||||
|
# define CT_R_LOG_CONF_INVALID_KEY 110
|
||||||
|
# define CT_R_LOG_CONF_MISSING_DESCRIPTION 111
|
||||||
|
# define CT_R_LOG_CONF_MISSING_KEY 112
|
||||||
|
# define CT_R_LOG_KEY_INVALID 113
|
||||||
|
# define CT_R_SCT_FUTURE_TIMESTAMP 116
|
||||||
|
# define CT_R_SCT_INVALID 104
|
||||||
|
# define CT_R_SCT_INVALID_SIGNATURE 107
|
||||||
|
# define CT_R_SCT_LIST_INVALID 105
|
||||||
|
# define CT_R_SCT_LOG_ID_MISMATCH 114
|
||||||
|
# define CT_R_SCT_NOT_SET 106
|
||||||
|
# define CT_R_SCT_UNSUPPORTED_VERSION 115
|
||||||
|
# define CT_R_UNRECOGNIZED_SIGNATURE_NID 101
|
||||||
|
# define CT_R_UNSUPPORTED_ENTRY_TYPE 102
|
||||||
|
# define CT_R_UNSUPPORTED_VERSION 103
|
||||||
|
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,133 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2020-2021 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef OPENSSL_DECODER_H
|
||||||
|
# define OPENSSL_DECODER_H
|
||||||
|
# pragma once
|
||||||
|
|
||||||
|
# include <openssl/opensslconf.h>
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_STDIO
|
||||||
|
# include <stdio.h>
|
||||||
|
# endif
|
||||||
|
# include <stdarg.h>
|
||||||
|
# include <stddef.h>
|
||||||
|
# include <openssl/decodererr.h>
|
||||||
|
# include <openssl/types.h>
|
||||||
|
# include <openssl/core.h>
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
# endif
|
||||||
|
|
||||||
|
OSSL_DECODER *OSSL_DECODER_fetch(OSSL_LIB_CTX *libctx, const char *name,
|
||||||
|
const char *properties);
|
||||||
|
int OSSL_DECODER_up_ref(OSSL_DECODER *encoder);
|
||||||
|
void OSSL_DECODER_free(OSSL_DECODER *encoder);
|
||||||
|
|
||||||
|
const OSSL_PROVIDER *OSSL_DECODER_get0_provider(const OSSL_DECODER *encoder);
|
||||||
|
const char *OSSL_DECODER_get0_properties(const OSSL_DECODER *encoder);
|
||||||
|
const char *OSSL_DECODER_get0_name(const OSSL_DECODER *decoder);
|
||||||
|
const char *OSSL_DECODER_get0_description(const OSSL_DECODER *decoder);
|
||||||
|
int OSSL_DECODER_is_a(const OSSL_DECODER *encoder, const char *name);
|
||||||
|
|
||||||
|
void OSSL_DECODER_do_all_provided(OSSL_LIB_CTX *libctx,
|
||||||
|
void (*fn)(OSSL_DECODER *encoder, void *arg),
|
||||||
|
void *arg);
|
||||||
|
int OSSL_DECODER_names_do_all(const OSSL_DECODER *encoder,
|
||||||
|
void (*fn)(const char *name, void *data),
|
||||||
|
void *data);
|
||||||
|
const OSSL_PARAM *OSSL_DECODER_gettable_params(OSSL_DECODER *decoder);
|
||||||
|
int OSSL_DECODER_get_params(OSSL_DECODER *decoder, OSSL_PARAM params[]);
|
||||||
|
|
||||||
|
const OSSL_PARAM *OSSL_DECODER_settable_ctx_params(OSSL_DECODER *encoder);
|
||||||
|
OSSL_DECODER_CTX *OSSL_DECODER_CTX_new(void);
|
||||||
|
int OSSL_DECODER_CTX_set_params(OSSL_DECODER_CTX *ctx,
|
||||||
|
const OSSL_PARAM params[]);
|
||||||
|
void OSSL_DECODER_CTX_free(OSSL_DECODER_CTX *ctx);
|
||||||
|
|
||||||
|
/* Utilities that help set specific parameters */
|
||||||
|
int OSSL_DECODER_CTX_set_passphrase(OSSL_DECODER_CTX *ctx,
|
||||||
|
const unsigned char *kstr, size_t klen);
|
||||||
|
int OSSL_DECODER_CTX_set_pem_password_cb(OSSL_DECODER_CTX *ctx,
|
||||||
|
pem_password_cb *cb, void *cbarg);
|
||||||
|
int OSSL_DECODER_CTX_set_passphrase_cb(OSSL_DECODER_CTX *ctx,
|
||||||
|
OSSL_PASSPHRASE_CALLBACK *cb,
|
||||||
|
void *cbarg);
|
||||||
|
int OSSL_DECODER_CTX_set_passphrase_ui(OSSL_DECODER_CTX *ctx,
|
||||||
|
const UI_METHOD *ui_method,
|
||||||
|
void *ui_data);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Utilities to read the object to decode, with the result sent to cb.
|
||||||
|
* These will discover all provided methods
|
||||||
|
*/
|
||||||
|
|
||||||
|
int OSSL_DECODER_CTX_set_selection(OSSL_DECODER_CTX *ctx, int selection);
|
||||||
|
int OSSL_DECODER_CTX_set_input_type(OSSL_DECODER_CTX *ctx,
|
||||||
|
const char *input_type);
|
||||||
|
int OSSL_DECODER_CTX_set_input_structure(OSSL_DECODER_CTX *ctx,
|
||||||
|
const char *input_structure);
|
||||||
|
int OSSL_DECODER_CTX_add_decoder(OSSL_DECODER_CTX *ctx, OSSL_DECODER *decoder);
|
||||||
|
int OSSL_DECODER_CTX_add_extra(OSSL_DECODER_CTX *ctx,
|
||||||
|
OSSL_LIB_CTX *libctx, const char *propq);
|
||||||
|
int OSSL_DECODER_CTX_get_num_decoders(OSSL_DECODER_CTX *ctx);
|
||||||
|
|
||||||
|
typedef struct ossl_decoder_instance_st OSSL_DECODER_INSTANCE;
|
||||||
|
OSSL_DECODER *
|
||||||
|
OSSL_DECODER_INSTANCE_get_decoder(OSSL_DECODER_INSTANCE *decoder_inst);
|
||||||
|
void *
|
||||||
|
OSSL_DECODER_INSTANCE_get_decoder_ctx(OSSL_DECODER_INSTANCE *decoder_inst);
|
||||||
|
const char *
|
||||||
|
OSSL_DECODER_INSTANCE_get_input_type(OSSL_DECODER_INSTANCE *decoder_inst);
|
||||||
|
const char *
|
||||||
|
OSSL_DECODER_INSTANCE_get_input_structure(OSSL_DECODER_INSTANCE *decoder_inst,
|
||||||
|
int *was_set);
|
||||||
|
|
||||||
|
typedef int OSSL_DECODER_CONSTRUCT(OSSL_DECODER_INSTANCE *decoder_inst,
|
||||||
|
const OSSL_PARAM *params,
|
||||||
|
void *construct_data);
|
||||||
|
typedef void OSSL_DECODER_CLEANUP(void *construct_data);
|
||||||
|
|
||||||
|
int OSSL_DECODER_CTX_set_construct(OSSL_DECODER_CTX *ctx,
|
||||||
|
OSSL_DECODER_CONSTRUCT *construct);
|
||||||
|
int OSSL_DECODER_CTX_set_construct_data(OSSL_DECODER_CTX *ctx,
|
||||||
|
void *construct_data);
|
||||||
|
int OSSL_DECODER_CTX_set_cleanup(OSSL_DECODER_CTX *ctx,
|
||||||
|
OSSL_DECODER_CLEANUP *cleanup);
|
||||||
|
OSSL_DECODER_CONSTRUCT *OSSL_DECODER_CTX_get_construct(OSSL_DECODER_CTX *ctx);
|
||||||
|
void *OSSL_DECODER_CTX_get_construct_data(OSSL_DECODER_CTX *ctx);
|
||||||
|
OSSL_DECODER_CLEANUP *OSSL_DECODER_CTX_get_cleanup(OSSL_DECODER_CTX *ctx);
|
||||||
|
|
||||||
|
int OSSL_DECODER_export(OSSL_DECODER_INSTANCE *decoder_inst,
|
||||||
|
void *reference, size_t reference_sz,
|
||||||
|
OSSL_CALLBACK *export_cb, void *export_cbarg);
|
||||||
|
|
||||||
|
int OSSL_DECODER_from_bio(OSSL_DECODER_CTX *ctx, BIO *in);
|
||||||
|
#ifndef OPENSSL_NO_STDIO
|
||||||
|
int OSSL_DECODER_from_fp(OSSL_DECODER_CTX *ctx, FILE *in);
|
||||||
|
#endif
|
||||||
|
int OSSL_DECODER_from_data(OSSL_DECODER_CTX *ctx, const unsigned char **pdata,
|
||||||
|
size_t *pdata_len);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Create the OSSL_DECODER_CTX with an associated type. This will perform
|
||||||
|
* an implicit OSSL_DECODER_fetch(), suitable for the object of that type.
|
||||||
|
*/
|
||||||
|
OSSL_DECODER_CTX *
|
||||||
|
OSSL_DECODER_CTX_new_for_pkey(EVP_PKEY **pkey,
|
||||||
|
const char *input_type,
|
||||||
|
const char *input_struct,
|
||||||
|
const char *keytype, int selection,
|
||||||
|
OSSL_LIB_CTX *libctx, const char *propquery);
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
/*
|
||||||
|
* Generated by util/mkerr.pl DO NOT EDIT
|
||||||
|
* Copyright 1995-2021 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef OPENSSL_DECODERERR_H
|
||||||
|
# define OPENSSL_DECODERERR_H
|
||||||
|
# pragma once
|
||||||
|
|
||||||
|
# include <openssl/opensslconf.h>
|
||||||
|
# include <openssl/symhacks.h>
|
||||||
|
# include <openssl/cryptoerr_legacy.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* OSSL_DECODER reason codes.
|
||||||
|
*/
|
||||||
|
# define OSSL_DECODER_R_COULD_NOT_DECODE_OBJECT 101
|
||||||
|
# define OSSL_DECODER_R_DECODER_NOT_FOUND 102
|
||||||
|
# define OSSL_DECODER_R_MISSING_GET_PARAMS 100
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,211 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 1995-2020 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef OPENSSL_DES_H
|
||||||
|
# define OPENSSL_DES_H
|
||||||
|
# pragma once
|
||||||
|
|
||||||
|
# include <openssl/macros.h>
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
# define HEADER_DES_H
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# include <openssl/opensslconf.h>
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_DES
|
||||||
|
# ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
# endif
|
||||||
|
# include <openssl/e_os2.h>
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
typedef unsigned int DES_LONG;
|
||||||
|
|
||||||
|
# ifdef OPENSSL_BUILD_SHLIBCRYPTO
|
||||||
|
# undef OPENSSL_EXTERN
|
||||||
|
# define OPENSSL_EXTERN OPENSSL_EXPORT
|
||||||
|
# endif
|
||||||
|
|
||||||
|
typedef unsigned char DES_cblock[8];
|
||||||
|
typedef /* const */ unsigned char const_DES_cblock[8];
|
||||||
|
/*
|
||||||
|
* With "const", gcc 2.8.1 on Solaris thinks that DES_cblock * and
|
||||||
|
* const_DES_cblock * are incompatible pointer types.
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef struct DES_ks {
|
||||||
|
union {
|
||||||
|
DES_cblock cblock;
|
||||||
|
/*
|
||||||
|
* make sure things are correct size on machines with 8 byte longs
|
||||||
|
*/
|
||||||
|
DES_LONG deslong[2];
|
||||||
|
} ks[16];
|
||||||
|
} DES_key_schedule;
|
||||||
|
|
||||||
|
# define DES_KEY_SZ (sizeof(DES_cblock))
|
||||||
|
# define DES_SCHEDULE_SZ (sizeof(DES_key_schedule))
|
||||||
|
|
||||||
|
# define DES_ENCRYPT 1
|
||||||
|
# define DES_DECRYPT 0
|
||||||
|
|
||||||
|
# define DES_CBC_MODE 0
|
||||||
|
# define DES_PCBC_MODE 1
|
||||||
|
|
||||||
|
# define DES_ecb2_encrypt(i,o,k1,k2,e) \
|
||||||
|
DES_ecb3_encrypt((i),(o),(k1),(k2),(k1),(e))
|
||||||
|
|
||||||
|
# define DES_ede2_cbc_encrypt(i,o,l,k1,k2,iv,e) \
|
||||||
|
DES_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(e))
|
||||||
|
|
||||||
|
# define DES_ede2_cfb64_encrypt(i,o,l,k1,k2,iv,n,e) \
|
||||||
|
DES_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n),(e))
|
||||||
|
|
||||||
|
# define DES_ede2_ofb64_encrypt(i,o,l,k1,k2,iv,n) \
|
||||||
|
DES_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n))
|
||||||
|
|
||||||
|
# define DES_fixup_key_parity DES_set_odd_parity
|
||||||
|
# endif
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
OSSL_DEPRECATEDIN_3_0 const char *DES_options(void);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
void DES_ecb3_encrypt(const_DES_cblock *input, DES_cblock *output,
|
||||||
|
DES_key_schedule *ks1, DES_key_schedule *ks2,
|
||||||
|
DES_key_schedule *ks3, int enc);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
DES_LONG DES_cbc_cksum(const unsigned char *input, DES_cblock *output,
|
||||||
|
long length, DES_key_schedule *schedule,
|
||||||
|
const_DES_cblock *ivec);
|
||||||
|
# endif
|
||||||
|
/* DES_cbc_encrypt does not update the IV! Use DES_ncbc_encrypt instead. */
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
void DES_cbc_encrypt(const unsigned char *input, unsigned char *output,
|
||||||
|
long length, DES_key_schedule *schedule, DES_cblock *ivec,
|
||||||
|
int enc);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
void DES_ncbc_encrypt(const unsigned char *input, unsigned char *output,
|
||||||
|
long length, DES_key_schedule *schedule, DES_cblock *ivec,
|
||||||
|
int enc);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
void DES_xcbc_encrypt(const unsigned char *input, unsigned char *output,
|
||||||
|
long length, DES_key_schedule *schedule, DES_cblock *ivec,
|
||||||
|
const_DES_cblock *inw, const_DES_cblock *outw, int enc);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
void DES_cfb_encrypt(const unsigned char *in, unsigned char *out, int numbits,
|
||||||
|
long length, DES_key_schedule *schedule, DES_cblock *ivec,
|
||||||
|
int enc);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
void DES_ecb_encrypt(const_DES_cblock *input, DES_cblock *output,
|
||||||
|
DES_key_schedule *ks, int enc);
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This is the DES encryption function that gets called by just about every
|
||||||
|
* other DES routine in the library. You should not use this function except
|
||||||
|
* to implement 'modes' of DES. I say this because the functions that call
|
||||||
|
* this routine do the conversion from 'char *' to long, and this needs to be
|
||||||
|
* done to make sure 'non-aligned' memory access do not occur. The
|
||||||
|
* characters are loaded 'little endian'. Data is a pointer to 2 unsigned
|
||||||
|
* long's and ks is the DES_key_schedule to use. enc, is non zero specifies
|
||||||
|
* encryption, zero if decryption.
|
||||||
|
*/
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
void DES_encrypt1(DES_LONG *data, DES_key_schedule *ks, int enc);
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This functions is the same as DES_encrypt1() except that the DES initial
|
||||||
|
* permutation (IP) and final permutation (FP) have been left out. As for
|
||||||
|
* DES_encrypt1(), you should not use this function. It is used by the
|
||||||
|
* routines in the library that implement triple DES. IP() DES_encrypt2()
|
||||||
|
* DES_encrypt2() DES_encrypt2() FP() is the same as DES_encrypt1()
|
||||||
|
* DES_encrypt1() DES_encrypt1() except faster :-).
|
||||||
|
*/
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
void DES_encrypt2(DES_LONG *data, DES_key_schedule *ks, int enc);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
void DES_encrypt3(DES_LONG *data, DES_key_schedule *ks1, DES_key_schedule *ks2,
|
||||||
|
DES_key_schedule *ks3);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
void DES_decrypt3(DES_LONG *data, DES_key_schedule *ks1, DES_key_schedule *ks2,
|
||||||
|
DES_key_schedule *ks3);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
void DES_ede3_cbc_encrypt(const unsigned char *input, unsigned char *output,
|
||||||
|
long length, DES_key_schedule *ks1,
|
||||||
|
DES_key_schedule *ks2, DES_key_schedule *ks3,
|
||||||
|
DES_cblock *ivec, int enc);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
void DES_ede3_cfb64_encrypt(const unsigned char *in, unsigned char *out,
|
||||||
|
long length, DES_key_schedule *ks1,
|
||||||
|
DES_key_schedule *ks2, DES_key_schedule *ks3,
|
||||||
|
DES_cblock *ivec, int *num, int enc);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
void DES_ede3_cfb_encrypt(const unsigned char *in, unsigned char *out,
|
||||||
|
int numbits, long length, DES_key_schedule *ks1,
|
||||||
|
DES_key_schedule *ks2, DES_key_schedule *ks3,
|
||||||
|
DES_cblock *ivec, int enc);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
void DES_ede3_ofb64_encrypt(const unsigned char *in, unsigned char *out,
|
||||||
|
long length, DES_key_schedule *ks1,
|
||||||
|
DES_key_schedule *ks2, DES_key_schedule *ks3,
|
||||||
|
DES_cblock *ivec, int *num);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
char *DES_fcrypt(const char *buf, const char *salt, char *ret);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
char *DES_crypt(const char *buf, const char *salt);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
void DES_ofb_encrypt(const unsigned char *in, unsigned char *out, int numbits,
|
||||||
|
long length, DES_key_schedule *schedule, DES_cblock *ivec);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
void DES_pcbc_encrypt(const unsigned char *input, unsigned char *output,
|
||||||
|
long length, DES_key_schedule *schedule,
|
||||||
|
DES_cblock *ivec, int enc);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
DES_LONG DES_quad_cksum(const unsigned char *input, DES_cblock output[],
|
||||||
|
long length, int out_count, DES_cblock *seed);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int DES_random_key(DES_cblock *ret);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 void DES_set_odd_parity(DES_cblock *key);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int DES_check_key_parity(const_DES_cblock *key);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int DES_is_weak_key(const_DES_cblock *key);
|
||||||
|
# endif
|
||||||
|
/*
|
||||||
|
* DES_set_key (= set_key = DES_key_sched = key_sched) calls
|
||||||
|
* DES_set_key_checked
|
||||||
|
*/
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
int DES_set_key(const_DES_cblock *key, DES_key_schedule *schedule);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
int DES_key_sched(const_DES_cblock *key, DES_key_schedule *schedule);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
int DES_set_key_checked(const_DES_cblock *key, DES_key_schedule *schedule);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
void DES_set_key_unchecked(const_DES_cblock *key, DES_key_schedule *schedule);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 void DES_string_to_key(const char *str, DES_cblock *key);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
void DES_string_to_2keys(const char *str, DES_cblock *key1, DES_cblock *key2);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
void DES_cfb64_encrypt(const unsigned char *in, unsigned char *out,
|
||||||
|
long length, DES_key_schedule *schedule,
|
||||||
|
DES_cblock *ivec, int *num, int enc);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
void DES_ofb64_encrypt(const unsigned char *in, unsigned char *out,
|
||||||
|
long length, DES_key_schedule *schedule,
|
||||||
|
DES_cblock *ivec, int *num);
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,339 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 1995-2023 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef OPENSSL_DH_H
|
||||||
|
# define OPENSSL_DH_H
|
||||||
|
# pragma once
|
||||||
|
|
||||||
|
# include <openssl/macros.h>
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
# define HEADER_DH_H
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# include <openssl/opensslconf.h>
|
||||||
|
# include <openssl/types.h>
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
# endif
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* DH parameter generation types used by EVP_PKEY_CTX_set_dh_paramgen_type()
|
||||||
|
* Note that additions/changes to this set of values requires corresponding
|
||||||
|
* adjustments to range checks in dh_gen()
|
||||||
|
*/
|
||||||
|
# define DH_PARAMGEN_TYPE_GENERATOR 0 /* Use a safe prime generator */
|
||||||
|
# define DH_PARAMGEN_TYPE_FIPS_186_2 1 /* Use FIPS186-2 standard */
|
||||||
|
# define DH_PARAMGEN_TYPE_FIPS_186_4 2 /* Use FIPS186-4 standard */
|
||||||
|
# define DH_PARAMGEN_TYPE_GROUP 3 /* Use a named safe prime group */
|
||||||
|
|
||||||
|
int EVP_PKEY_CTX_set_dh_paramgen_type(EVP_PKEY_CTX *ctx, int typ);
|
||||||
|
int EVP_PKEY_CTX_set_dh_paramgen_gindex(EVP_PKEY_CTX *ctx, int gindex);
|
||||||
|
int EVP_PKEY_CTX_set_dh_paramgen_seed(EVP_PKEY_CTX *ctx,
|
||||||
|
const unsigned char *seed,
|
||||||
|
size_t seedlen);
|
||||||
|
int EVP_PKEY_CTX_set_dh_paramgen_prime_len(EVP_PKEY_CTX *ctx, int pbits);
|
||||||
|
int EVP_PKEY_CTX_set_dh_paramgen_subprime_len(EVP_PKEY_CTX *ctx, int qlen);
|
||||||
|
int EVP_PKEY_CTX_set_dh_paramgen_generator(EVP_PKEY_CTX *ctx, int gen);
|
||||||
|
int EVP_PKEY_CTX_set_dh_nid(EVP_PKEY_CTX *ctx, int nid);
|
||||||
|
int EVP_PKEY_CTX_set_dh_rfc5114(EVP_PKEY_CTX *ctx, int gen);
|
||||||
|
int EVP_PKEY_CTX_set_dhx_rfc5114(EVP_PKEY_CTX *ctx, int gen);
|
||||||
|
int EVP_PKEY_CTX_set_dh_pad(EVP_PKEY_CTX *ctx, int pad);
|
||||||
|
|
||||||
|
int EVP_PKEY_CTX_set_dh_kdf_type(EVP_PKEY_CTX *ctx, int kdf);
|
||||||
|
int EVP_PKEY_CTX_get_dh_kdf_type(EVP_PKEY_CTX *ctx);
|
||||||
|
int EVP_PKEY_CTX_set0_dh_kdf_oid(EVP_PKEY_CTX *ctx, ASN1_OBJECT *oid);
|
||||||
|
int EVP_PKEY_CTX_get0_dh_kdf_oid(EVP_PKEY_CTX *ctx, ASN1_OBJECT **oid);
|
||||||
|
int EVP_PKEY_CTX_set_dh_kdf_md(EVP_PKEY_CTX *ctx, const EVP_MD *md);
|
||||||
|
int EVP_PKEY_CTX_get_dh_kdf_md(EVP_PKEY_CTX *ctx, const EVP_MD **md);
|
||||||
|
int EVP_PKEY_CTX_set_dh_kdf_outlen(EVP_PKEY_CTX *ctx, int len);
|
||||||
|
int EVP_PKEY_CTX_get_dh_kdf_outlen(EVP_PKEY_CTX *ctx, int *len);
|
||||||
|
int EVP_PKEY_CTX_set0_dh_kdf_ukm(EVP_PKEY_CTX *ctx, unsigned char *ukm, int len);
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
int EVP_PKEY_CTX_get0_dh_kdf_ukm(EVP_PKEY_CTX *ctx, unsigned char **ukm);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
# define EVP_PKEY_CTRL_DH_PARAMGEN_PRIME_LEN (EVP_PKEY_ALG_CTRL + 1)
|
||||||
|
# define EVP_PKEY_CTRL_DH_PARAMGEN_GENERATOR (EVP_PKEY_ALG_CTRL + 2)
|
||||||
|
# define EVP_PKEY_CTRL_DH_RFC5114 (EVP_PKEY_ALG_CTRL + 3)
|
||||||
|
# define EVP_PKEY_CTRL_DH_PARAMGEN_SUBPRIME_LEN (EVP_PKEY_ALG_CTRL + 4)
|
||||||
|
# define EVP_PKEY_CTRL_DH_PARAMGEN_TYPE (EVP_PKEY_ALG_CTRL + 5)
|
||||||
|
# define EVP_PKEY_CTRL_DH_KDF_TYPE (EVP_PKEY_ALG_CTRL + 6)
|
||||||
|
# define EVP_PKEY_CTRL_DH_KDF_MD (EVP_PKEY_ALG_CTRL + 7)
|
||||||
|
# define EVP_PKEY_CTRL_GET_DH_KDF_MD (EVP_PKEY_ALG_CTRL + 8)
|
||||||
|
# define EVP_PKEY_CTRL_DH_KDF_OUTLEN (EVP_PKEY_ALG_CTRL + 9)
|
||||||
|
# define EVP_PKEY_CTRL_GET_DH_KDF_OUTLEN (EVP_PKEY_ALG_CTRL + 10)
|
||||||
|
# define EVP_PKEY_CTRL_DH_KDF_UKM (EVP_PKEY_ALG_CTRL + 11)
|
||||||
|
# define EVP_PKEY_CTRL_GET_DH_KDF_UKM (EVP_PKEY_ALG_CTRL + 12)
|
||||||
|
# define EVP_PKEY_CTRL_DH_KDF_OID (EVP_PKEY_ALG_CTRL + 13)
|
||||||
|
# define EVP_PKEY_CTRL_GET_DH_KDF_OID (EVP_PKEY_ALG_CTRL + 14)
|
||||||
|
# define EVP_PKEY_CTRL_DH_NID (EVP_PKEY_ALG_CTRL + 15)
|
||||||
|
# define EVP_PKEY_CTRL_DH_PAD (EVP_PKEY_ALG_CTRL + 16)
|
||||||
|
|
||||||
|
/* KDF types */
|
||||||
|
# define EVP_PKEY_DH_KDF_NONE 1
|
||||||
|
# define EVP_PKEY_DH_KDF_X9_42 2
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_STDIO
|
||||||
|
# include <stdio.h>
|
||||||
|
# endif
|
||||||
|
# ifndef OPENSSL_NO_DH
|
||||||
|
# include <openssl/e_os2.h>
|
||||||
|
# include <openssl/bio.h>
|
||||||
|
# include <openssl/asn1.h>
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_1_1_0
|
||||||
|
# include <openssl/bn.h>
|
||||||
|
# endif
|
||||||
|
# include <openssl/dherr.h>
|
||||||
|
|
||||||
|
# ifndef OPENSSL_DH_MAX_MODULUS_BITS
|
||||||
|
# define OPENSSL_DH_MAX_MODULUS_BITS 10000
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifndef OPENSSL_DH_CHECK_MAX_MODULUS_BITS
|
||||||
|
# define OPENSSL_DH_CHECK_MAX_MODULUS_BITS 32768
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# define OPENSSL_DH_FIPS_MIN_MODULUS_BITS 1024
|
||||||
|
|
||||||
|
# define DH_FLAG_CACHE_MONT_P 0x01
|
||||||
|
|
||||||
|
# define DH_FLAG_TYPE_MASK 0xF000
|
||||||
|
# define DH_FLAG_TYPE_DH 0x0000
|
||||||
|
# define DH_FLAG_TYPE_DHX 0x1000
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_1_1_0
|
||||||
|
/*
|
||||||
|
* Does nothing. Previously this switched off constant time behaviour.
|
||||||
|
*/
|
||||||
|
# define DH_FLAG_NO_EXP_CONSTTIME 0x00
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
/*
|
||||||
|
* If this flag is set the DH method is FIPS compliant and can be used in
|
||||||
|
* FIPS mode. This is set in the validated module method. If an application
|
||||||
|
* sets this flag in its own methods it is its responsibility to ensure the
|
||||||
|
* result is compliant.
|
||||||
|
*/
|
||||||
|
|
||||||
|
# define DH_FLAG_FIPS_METHOD 0x0400
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If this flag is set the operations normally disabled in FIPS mode are
|
||||||
|
* permitted it is then the applications responsibility to ensure that the
|
||||||
|
* usage is compliant.
|
||||||
|
*/
|
||||||
|
|
||||||
|
# define DH_FLAG_NON_FIPS_ALLOW 0x0400
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/* Already defined in ossl_typ.h */
|
||||||
|
/* typedef struct dh_st DH; */
|
||||||
|
/* typedef struct dh_method DH_METHOD; */
|
||||||
|
|
||||||
|
DECLARE_ASN1_ITEM(DHparams)
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
# define DH_GENERATOR_2 2
|
||||||
|
# define DH_GENERATOR_3 3
|
||||||
|
# define DH_GENERATOR_5 5
|
||||||
|
|
||||||
|
/* DH_check error codes, some of them shared with DH_check_pub_key */
|
||||||
|
/*
|
||||||
|
* NB: These values must align with the equivalently named macros in
|
||||||
|
* internal/ffc.h.
|
||||||
|
*/
|
||||||
|
# define DH_CHECK_P_NOT_PRIME 0x01
|
||||||
|
# define DH_CHECK_P_NOT_SAFE_PRIME 0x02
|
||||||
|
# define DH_UNABLE_TO_CHECK_GENERATOR 0x04
|
||||||
|
# define DH_NOT_SUITABLE_GENERATOR 0x08
|
||||||
|
# define DH_CHECK_Q_NOT_PRIME 0x10
|
||||||
|
# define DH_CHECK_INVALID_Q_VALUE 0x20 /* +DH_check_pub_key */
|
||||||
|
# define DH_CHECK_INVALID_J_VALUE 0x40
|
||||||
|
# define DH_MODULUS_TOO_SMALL 0x80
|
||||||
|
# define DH_MODULUS_TOO_LARGE 0x100 /* +DH_check_pub_key */
|
||||||
|
|
||||||
|
/* DH_check_pub_key error codes */
|
||||||
|
# define DH_CHECK_PUBKEY_TOO_SMALL 0x01
|
||||||
|
# define DH_CHECK_PUBKEY_TOO_LARGE 0x02
|
||||||
|
# define DH_CHECK_PUBKEY_INVALID 0x04
|
||||||
|
|
||||||
|
/*
|
||||||
|
* primes p where (p-1)/2 is prime too are called "safe"; we define this for
|
||||||
|
* backward compatibility:
|
||||||
|
*/
|
||||||
|
# define DH_CHECK_P_NOT_STRONG_PRIME DH_CHECK_P_NOT_SAFE_PRIME
|
||||||
|
|
||||||
|
# define d2i_DHparams_fp(fp, x) \
|
||||||
|
(DH *)ASN1_d2i_fp((char *(*)())DH_new, \
|
||||||
|
(char *(*)())d2i_DHparams, \
|
||||||
|
(fp), \
|
||||||
|
(unsigned char **)(x))
|
||||||
|
# define i2d_DHparams_fp(fp, x) \
|
||||||
|
ASN1_i2d_fp(i2d_DHparams,(fp), (unsigned char *)(x))
|
||||||
|
# define d2i_DHparams_bio(bp, x) \
|
||||||
|
ASN1_d2i_bio_of(DH, DH_new, d2i_DHparams, bp, x)
|
||||||
|
# define i2d_DHparams_bio(bp, x) \
|
||||||
|
ASN1_i2d_bio_of(DH, i2d_DHparams, bp, x)
|
||||||
|
|
||||||
|
# define d2i_DHxparams_fp(fp,x) \
|
||||||
|
(DH *)ASN1_d2i_fp((char *(*)())DH_new, \
|
||||||
|
(char *(*)())d2i_DHxparams, \
|
||||||
|
(fp), \
|
||||||
|
(unsigned char **)(x))
|
||||||
|
# define i2d_DHxparams_fp(fp, x) \
|
||||||
|
ASN1_i2d_fp(i2d_DHxparams,(fp), (unsigned char *)(x))
|
||||||
|
# define d2i_DHxparams_bio(bp, x) \
|
||||||
|
ASN1_d2i_bio_of(DH, DH_new, d2i_DHxparams, bp, x)
|
||||||
|
# define i2d_DHxparams_bio(bp, x) \
|
||||||
|
ASN1_i2d_bio_of(DH, i2d_DHxparams, bp, x)
|
||||||
|
|
||||||
|
DECLARE_ASN1_DUP_FUNCTION_name_attr(OSSL_DEPRECATEDIN_3_0, DH, DHparams)
|
||||||
|
|
||||||
|
OSSL_DEPRECATEDIN_3_0 const DH_METHOD *DH_OpenSSL(void);
|
||||||
|
|
||||||
|
OSSL_DEPRECATEDIN_3_0 void DH_set_default_method(const DH_METHOD *meth);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 const DH_METHOD *DH_get_default_method(void);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int DH_set_method(DH *dh, const DH_METHOD *meth);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 DH *DH_new_method(ENGINE *engine);
|
||||||
|
|
||||||
|
OSSL_DEPRECATEDIN_3_0 DH *DH_new(void);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 void DH_free(DH *dh);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int DH_up_ref(DH *dh);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int DH_bits(const DH *dh);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int DH_size(const DH *dh);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int DH_security_bits(const DH *dh);
|
||||||
|
|
||||||
|
# define DH_get_ex_new_index(l, p, newf, dupf, freef) \
|
||||||
|
CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_DH, l, p, newf, dupf, freef)
|
||||||
|
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int DH_set_ex_data(DH *d, int idx, void *arg);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 void *DH_get_ex_data(const DH *d, int idx);
|
||||||
|
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int DH_generate_parameters_ex(DH *dh, int prime_len,
|
||||||
|
int generator,
|
||||||
|
BN_GENCB *cb);
|
||||||
|
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int DH_check_params_ex(const DH *dh);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int DH_check_ex(const DH *dh);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int DH_check_pub_key_ex(const DH *dh, const BIGNUM *pub_key);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int DH_check_params(const DH *dh, int *ret);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int DH_check(const DH *dh, int *codes);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int DH_check_pub_key(const DH *dh, const BIGNUM *pub_key,
|
||||||
|
int *codes);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int DH_generate_key(DH *dh);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int DH_compute_key(unsigned char *key,
|
||||||
|
const BIGNUM *pub_key, DH *dh);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int DH_compute_key_padded(unsigned char *key,
|
||||||
|
const BIGNUM *pub_key, DH *dh);
|
||||||
|
|
||||||
|
DECLARE_ASN1_ENCODE_FUNCTIONS_only_attr(OSSL_DEPRECATEDIN_3_0, DH, DHparams)
|
||||||
|
DECLARE_ASN1_ENCODE_FUNCTIONS_only_attr(OSSL_DEPRECATEDIN_3_0, DH, DHxparams)
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_STDIO
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int DHparams_print_fp(FILE *fp, const DH *x);
|
||||||
|
# endif
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int DHparams_print(BIO *bp, const DH *x);
|
||||||
|
|
||||||
|
/* RFC 5114 parameters */
|
||||||
|
OSSL_DEPRECATEDIN_3_0 DH *DH_get_1024_160(void);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 DH *DH_get_2048_224(void);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 DH *DH_get_2048_256(void);
|
||||||
|
|
||||||
|
/* Named parameters, currently RFC7919 and RFC3526 */
|
||||||
|
OSSL_DEPRECATEDIN_3_0 DH *DH_new_by_nid(int nid);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int DH_get_nid(const DH *dh);
|
||||||
|
|
||||||
|
/* RFC2631 KDF */
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int DH_KDF_X9_42(unsigned char *out, size_t outlen,
|
||||||
|
const unsigned char *Z, size_t Zlen,
|
||||||
|
ASN1_OBJECT *key_oid,
|
||||||
|
const unsigned char *ukm,
|
||||||
|
size_t ukmlen, const EVP_MD *md);
|
||||||
|
|
||||||
|
OSSL_DEPRECATEDIN_3_0 void DH_get0_pqg(const DH *dh, const BIGNUM **p,
|
||||||
|
const BIGNUM **q, const BIGNUM **g);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 void DH_get0_key(const DH *dh, const BIGNUM **pub_key,
|
||||||
|
const BIGNUM **priv_key);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int DH_set0_key(DH *dh, BIGNUM *pub_key, BIGNUM *priv_key);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 const BIGNUM *DH_get0_p(const DH *dh);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 const BIGNUM *DH_get0_q(const DH *dh);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 const BIGNUM *DH_get0_g(const DH *dh);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 const BIGNUM *DH_get0_priv_key(const DH *dh);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 const BIGNUM *DH_get0_pub_key(const DH *dh);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 void DH_clear_flags(DH *dh, int flags);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int DH_test_flags(const DH *dh, int flags);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 void DH_set_flags(DH *dh, int flags);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 ENGINE *DH_get0_engine(DH *d);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 long DH_get_length(const DH *dh);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int DH_set_length(DH *dh, long length);
|
||||||
|
|
||||||
|
OSSL_DEPRECATEDIN_3_0 DH_METHOD *DH_meth_new(const char *name, int flags);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 void DH_meth_free(DH_METHOD *dhm);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 DH_METHOD *DH_meth_dup(const DH_METHOD *dhm);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 const char *DH_meth_get0_name(const DH_METHOD *dhm);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int DH_meth_set1_name(DH_METHOD *dhm, const char *name);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int DH_meth_get_flags(const DH_METHOD *dhm);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int DH_meth_set_flags(DH_METHOD *dhm, int flags);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 void *DH_meth_get0_app_data(const DH_METHOD *dhm);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int DH_meth_set0_app_data(DH_METHOD *dhm, void *app_data);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int (*DH_meth_get_generate_key(const DH_METHOD *dhm)) (DH *);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int DH_meth_set_generate_key(DH_METHOD *dhm,
|
||||||
|
int (*generate_key) (DH *));
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int (*DH_meth_get_compute_key(const DH_METHOD *dhm))
|
||||||
|
(unsigned char *key,
|
||||||
|
const BIGNUM *pub_key,
|
||||||
|
DH *dh);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int DH_meth_set_compute_key(DH_METHOD *dhm,
|
||||||
|
int (*compute_key)
|
||||||
|
(unsigned char *key,
|
||||||
|
const BIGNUM *pub_key,
|
||||||
|
DH *dh));
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int (*DH_meth_get_bn_mod_exp(const DH_METHOD *dhm))
|
||||||
|
(const DH *, BIGNUM *,
|
||||||
|
const BIGNUM *,
|
||||||
|
const BIGNUM *,
|
||||||
|
const BIGNUM *, BN_CTX *,
|
||||||
|
BN_MONT_CTX *);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int DH_meth_set_bn_mod_exp(DH_METHOD *dhm,
|
||||||
|
int (*bn_mod_exp)
|
||||||
|
(const DH *, BIGNUM *,
|
||||||
|
const BIGNUM *, const BIGNUM *,
|
||||||
|
const BIGNUM *, BN_CTX *,
|
||||||
|
BN_MONT_CTX *));
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int (*DH_meth_get_init(const DH_METHOD *dhm))(DH *);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int DH_meth_set_init(DH_METHOD *dhm, int (*init)(DH *));
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int (*DH_meth_get_finish(const DH_METHOD *dhm)) (DH *);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int DH_meth_set_finish(DH_METHOD *dhm, int (*finish) (DH *));
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int (*DH_meth_get_generate_params(const DH_METHOD *dhm))
|
||||||
|
(DH *, int, int,
|
||||||
|
BN_GENCB *);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int DH_meth_set_generate_params(DH_METHOD *dhm,
|
||||||
|
int (*generate_params)
|
||||||
|
(DH *, int, int,
|
||||||
|
BN_GENCB *));
|
||||||
|
# endif /* OPENSSL_NO_DEPRECATED_3_0 */
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_0_9_8
|
||||||
|
OSSL_DEPRECATEDIN_0_9_8 DH *DH_generate_parameters(int prime_len, int generator,
|
||||||
|
void (*callback) (int, int,
|
||||||
|
void *),
|
||||||
|
void *cb_arg);
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# endif
|
||||||
|
# ifdef __cplusplus
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
/*
|
||||||
|
* Generated by util/mkerr.pl DO NOT EDIT
|
||||||
|
* Copyright 1995-2023 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef OPENSSL_DHERR_H
|
||||||
|
# define OPENSSL_DHERR_H
|
||||||
|
# pragma once
|
||||||
|
|
||||||
|
# include <openssl/opensslconf.h>
|
||||||
|
# include <openssl/symhacks.h>
|
||||||
|
# include <openssl/cryptoerr_legacy.h>
|
||||||
|
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_DH
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* DH reason codes.
|
||||||
|
*/
|
||||||
|
# define DH_R_BAD_FFC_PARAMETERS 127
|
||||||
|
# define DH_R_BAD_GENERATOR 101
|
||||||
|
# define DH_R_BN_DECODE_ERROR 109
|
||||||
|
# define DH_R_BN_ERROR 106
|
||||||
|
# define DH_R_CHECK_INVALID_J_VALUE 115
|
||||||
|
# define DH_R_CHECK_INVALID_Q_VALUE 116
|
||||||
|
# define DH_R_CHECK_PUBKEY_INVALID 122
|
||||||
|
# define DH_R_CHECK_PUBKEY_TOO_LARGE 123
|
||||||
|
# define DH_R_CHECK_PUBKEY_TOO_SMALL 124
|
||||||
|
# define DH_R_CHECK_P_NOT_PRIME 117
|
||||||
|
# define DH_R_CHECK_P_NOT_SAFE_PRIME 118
|
||||||
|
# define DH_R_CHECK_Q_NOT_PRIME 119
|
||||||
|
# define DH_R_DECODE_ERROR 104
|
||||||
|
# define DH_R_INVALID_PARAMETER_NAME 110
|
||||||
|
# define DH_R_INVALID_PARAMETER_NID 114
|
||||||
|
# define DH_R_INVALID_PUBKEY 102
|
||||||
|
# define DH_R_INVALID_SECRET 128
|
||||||
|
# define DH_R_INVALID_SIZE 129
|
||||||
|
# define DH_R_KDF_PARAMETER_ERROR 112
|
||||||
|
# define DH_R_KEYS_NOT_SET 108
|
||||||
|
# define DH_R_MISSING_PUBKEY 125
|
||||||
|
# define DH_R_MODULUS_TOO_LARGE 103
|
||||||
|
# define DH_R_MODULUS_TOO_SMALL 126
|
||||||
|
# define DH_R_NOT_SUITABLE_GENERATOR 120
|
||||||
|
# define DH_R_NO_PARAMETERS_SET 107
|
||||||
|
# define DH_R_NO_PRIVATE_VALUE 100
|
||||||
|
# define DH_R_PARAMETER_ENCODING_ERROR 105
|
||||||
|
# define DH_R_PEER_KEY_ERROR 111
|
||||||
|
# define DH_R_Q_TOO_LARGE 130
|
||||||
|
# define DH_R_SHARED_INFO_ERROR 113
|
||||||
|
# define DH_R_UNABLE_TO_CHECK_GENERATOR 121
|
||||||
|
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,280 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 1995-2021 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef OPENSSL_DSA_H
|
||||||
|
# define OPENSSL_DSA_H
|
||||||
|
# pragma once
|
||||||
|
|
||||||
|
# include <openssl/macros.h>
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
# define HEADER_DSA_H
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# include <openssl/opensslconf.h>
|
||||||
|
# include <openssl/types.h>
|
||||||
|
|
||||||
|
# include <stdlib.h>
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_DSA
|
||||||
|
# include <openssl/e_os2.h>
|
||||||
|
# include <openssl/asn1.h>
|
||||||
|
# include <openssl/bio.h>
|
||||||
|
# include <openssl/crypto.h>
|
||||||
|
# include <openssl/bn.h>
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_1_1_0
|
||||||
|
# include <openssl/dh.h>
|
||||||
|
# endif
|
||||||
|
# include <openssl/dsaerr.h>
|
||||||
|
# ifndef OPENSSL_NO_STDIO
|
||||||
|
# include <stdio.h>
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
# endif
|
||||||
|
|
||||||
|
int EVP_PKEY_CTX_set_dsa_paramgen_bits(EVP_PKEY_CTX *ctx, int nbits);
|
||||||
|
int EVP_PKEY_CTX_set_dsa_paramgen_q_bits(EVP_PKEY_CTX *ctx, int qbits);
|
||||||
|
int EVP_PKEY_CTX_set_dsa_paramgen_md_props(EVP_PKEY_CTX *ctx,
|
||||||
|
const char *md_name,
|
||||||
|
const char *md_properties);
|
||||||
|
int EVP_PKEY_CTX_set_dsa_paramgen_gindex(EVP_PKEY_CTX *ctx, int gindex);
|
||||||
|
int EVP_PKEY_CTX_set_dsa_paramgen_type(EVP_PKEY_CTX *ctx, const char *name);
|
||||||
|
int EVP_PKEY_CTX_set_dsa_paramgen_seed(EVP_PKEY_CTX *ctx,
|
||||||
|
const unsigned char *seed,
|
||||||
|
size_t seedlen);
|
||||||
|
int EVP_PKEY_CTX_set_dsa_paramgen_md(EVP_PKEY_CTX *ctx, const EVP_MD *md);
|
||||||
|
|
||||||
|
# define EVP_PKEY_CTRL_DSA_PARAMGEN_BITS (EVP_PKEY_ALG_CTRL + 1)
|
||||||
|
# define EVP_PKEY_CTRL_DSA_PARAMGEN_Q_BITS (EVP_PKEY_ALG_CTRL + 2)
|
||||||
|
# define EVP_PKEY_CTRL_DSA_PARAMGEN_MD (EVP_PKEY_ALG_CTRL + 3)
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_DSA
|
||||||
|
# ifndef OPENSSL_DSA_MAX_MODULUS_BITS
|
||||||
|
# define OPENSSL_DSA_MAX_MODULUS_BITS 10000
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# define OPENSSL_DSA_FIPS_MIN_MODULUS_BITS 1024
|
||||||
|
|
||||||
|
typedef struct DSA_SIG_st DSA_SIG;
|
||||||
|
DSA_SIG *DSA_SIG_new(void);
|
||||||
|
void DSA_SIG_free(DSA_SIG *a);
|
||||||
|
DECLARE_ASN1_ENCODE_FUNCTIONS_only(DSA_SIG, DSA_SIG)
|
||||||
|
void DSA_SIG_get0(const DSA_SIG *sig, const BIGNUM **pr, const BIGNUM **ps);
|
||||||
|
int DSA_SIG_set0(DSA_SIG *sig, BIGNUM *r, BIGNUM *s);
|
||||||
|
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_1_1_0
|
||||||
|
/*
|
||||||
|
* Does nothing. Previously this switched off constant time behaviour.
|
||||||
|
*/
|
||||||
|
# define DSA_FLAG_NO_EXP_CONSTTIME 0x00
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
# define DSA_FLAG_CACHE_MONT_P 0x01
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If this flag is set the DSA method is FIPS compliant and can be used in
|
||||||
|
* FIPS mode. This is set in the validated module method. If an application
|
||||||
|
* sets this flag in its own methods it is its responsibility to ensure the
|
||||||
|
* result is compliant.
|
||||||
|
*/
|
||||||
|
|
||||||
|
# define DSA_FLAG_FIPS_METHOD 0x0400
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If this flag is set the operations normally disabled in FIPS mode are
|
||||||
|
* permitted it is then the applications responsibility to ensure that the
|
||||||
|
* usage is compliant.
|
||||||
|
*/
|
||||||
|
|
||||||
|
# define DSA_FLAG_NON_FIPS_ALLOW 0x0400
|
||||||
|
# define DSA_FLAG_FIPS_CHECKED 0x0800
|
||||||
|
|
||||||
|
/* Already defined in ossl_typ.h */
|
||||||
|
/* typedef struct dsa_st DSA; */
|
||||||
|
/* typedef struct dsa_method DSA_METHOD; */
|
||||||
|
|
||||||
|
# define d2i_DSAparams_fp(fp, x) \
|
||||||
|
(DSA *)ASN1_d2i_fp((char *(*)())DSA_new, \
|
||||||
|
(char *(*)())d2i_DSAparams, (fp), \
|
||||||
|
(unsigned char **)(x))
|
||||||
|
# define i2d_DSAparams_fp(fp, x) \
|
||||||
|
ASN1_i2d_fp(i2d_DSAparams, (fp), (unsigned char *)(x))
|
||||||
|
# define d2i_DSAparams_bio(bp, x) \
|
||||||
|
ASN1_d2i_bio_of(DSA, DSA_new, d2i_DSAparams, bp, x)
|
||||||
|
# define i2d_DSAparams_bio(bp, x) \
|
||||||
|
ASN1_i2d_bio_of(DSA, i2d_DSAparams, bp, x)
|
||||||
|
|
||||||
|
DECLARE_ASN1_DUP_FUNCTION_name_attr(OSSL_DEPRECATEDIN_3_0, DSA, DSAparams)
|
||||||
|
OSSL_DEPRECATEDIN_3_0 DSA_SIG *DSA_do_sign(const unsigned char *dgst, int dlen,
|
||||||
|
DSA *dsa);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int DSA_do_verify(const unsigned char *dgst, int dgst_len,
|
||||||
|
DSA_SIG *sig, DSA *dsa);
|
||||||
|
|
||||||
|
OSSL_DEPRECATEDIN_3_0 const DSA_METHOD *DSA_OpenSSL(void);
|
||||||
|
|
||||||
|
OSSL_DEPRECATEDIN_3_0 void DSA_set_default_method(const DSA_METHOD *);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 const DSA_METHOD *DSA_get_default_method(void);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int DSA_set_method(DSA *dsa, const DSA_METHOD *);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 const DSA_METHOD *DSA_get_method(DSA *d);
|
||||||
|
|
||||||
|
OSSL_DEPRECATEDIN_3_0 DSA *DSA_new(void);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 DSA *DSA_new_method(ENGINE *engine);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 void DSA_free(DSA *r);
|
||||||
|
/* "up" the DSA object's reference count */
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int DSA_up_ref(DSA *r);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int DSA_size(const DSA *);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int DSA_bits(const DSA *d);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int DSA_security_bits(const DSA *d);
|
||||||
|
/* next 4 return -1 on error */
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int DSA_sign_setup(DSA *dsa, BN_CTX *ctx_in,
|
||||||
|
BIGNUM **kinvp, BIGNUM **rp);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int DSA_sign(int type, const unsigned char *dgst,
|
||||||
|
int dlen, unsigned char *sig,
|
||||||
|
unsigned int *siglen, DSA *dsa);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int DSA_verify(int type, const unsigned char *dgst,
|
||||||
|
int dgst_len, const unsigned char *sigbuf,
|
||||||
|
int siglen, DSA *dsa);
|
||||||
|
|
||||||
|
# define DSA_get_ex_new_index(l, p, newf, dupf, freef) \
|
||||||
|
CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_DSA, l, p, newf, dupf, freef)
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int DSA_set_ex_data(DSA *d, int idx, void *arg);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 void *DSA_get_ex_data(const DSA *d, int idx);
|
||||||
|
|
||||||
|
DECLARE_ASN1_ENCODE_FUNCTIONS_only_attr(OSSL_DEPRECATEDIN_3_0,
|
||||||
|
DSA, DSAPublicKey)
|
||||||
|
DECLARE_ASN1_ENCODE_FUNCTIONS_only_attr(OSSL_DEPRECATEDIN_3_0,
|
||||||
|
DSA, DSAPrivateKey)
|
||||||
|
DECLARE_ASN1_ENCODE_FUNCTIONS_only_attr(OSSL_DEPRECATEDIN_3_0,
|
||||||
|
DSA, DSAparams)
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_0_9_8
|
||||||
|
/* Deprecated version */
|
||||||
|
OSSL_DEPRECATEDIN_0_9_8
|
||||||
|
DSA *DSA_generate_parameters(int bits, unsigned char *seed, int seed_len,
|
||||||
|
int *counter_ret, unsigned long *h_ret,
|
||||||
|
void (*callback) (int, int, void *),
|
||||||
|
void *cb_arg);
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
/* New version */
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int DSA_generate_parameters_ex(DSA *dsa, int bits,
|
||||||
|
const unsigned char *seed,
|
||||||
|
int seed_len,
|
||||||
|
int *counter_ret,
|
||||||
|
unsigned long *h_ret,
|
||||||
|
BN_GENCB *cb);
|
||||||
|
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int DSA_generate_key(DSA *a);
|
||||||
|
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int DSAparams_print(BIO *bp, const DSA *x);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int DSA_print(BIO *bp, const DSA *x, int off);
|
||||||
|
# ifndef OPENSSL_NO_STDIO
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int DSAparams_print_fp(FILE *fp, const DSA *x);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int DSA_print_fp(FILE *bp, const DSA *x, int off);
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# define DSS_prime_checks 64
|
||||||
|
/*
|
||||||
|
* Primality test according to FIPS PUB 186-4, Appendix C.3. Since we only
|
||||||
|
* have one value here we set the number of checks to 64 which is the 128 bit
|
||||||
|
* security level that is the highest level and valid for creating a 3072 bit
|
||||||
|
* DSA key.
|
||||||
|
*/
|
||||||
|
# define DSA_is_prime(n, callback, cb_arg) \
|
||||||
|
BN_is_prime(n, DSS_prime_checks, callback, NULL, cb_arg)
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_DH
|
||||||
|
/*
|
||||||
|
* Convert DSA structure (key or just parameters) into DH structure (be
|
||||||
|
* careful to avoid small subgroup attacks when using this!)
|
||||||
|
*/
|
||||||
|
OSSL_DEPRECATEDIN_3_0 DH *DSA_dup_DH(const DSA *r);
|
||||||
|
# endif
|
||||||
|
|
||||||
|
OSSL_DEPRECATEDIN_3_0 void DSA_get0_pqg(const DSA *d, const BIGNUM **p,
|
||||||
|
const BIGNUM **q, const BIGNUM **g);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int DSA_set0_pqg(DSA *d, BIGNUM *p, BIGNUM *q, BIGNUM *g);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 void DSA_get0_key(const DSA *d, const BIGNUM **pub_key,
|
||||||
|
const BIGNUM **priv_key);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int DSA_set0_key(DSA *d, BIGNUM *pub_key,
|
||||||
|
BIGNUM *priv_key);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 const BIGNUM *DSA_get0_p(const DSA *d);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 const BIGNUM *DSA_get0_q(const DSA *d);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 const BIGNUM *DSA_get0_g(const DSA *d);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 const BIGNUM *DSA_get0_pub_key(const DSA *d);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 const BIGNUM *DSA_get0_priv_key(const DSA *d);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 void DSA_clear_flags(DSA *d, int flags);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int DSA_test_flags(const DSA *d, int flags);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 void DSA_set_flags(DSA *d, int flags);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 ENGINE *DSA_get0_engine(DSA *d);
|
||||||
|
|
||||||
|
OSSL_DEPRECATEDIN_3_0 DSA_METHOD *DSA_meth_new(const char *name, int flags);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 void DSA_meth_free(DSA_METHOD *dsam);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 DSA_METHOD *DSA_meth_dup(const DSA_METHOD *dsam);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 const char *DSA_meth_get0_name(const DSA_METHOD *dsam);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int DSA_meth_set1_name(DSA_METHOD *dsam,
|
||||||
|
const char *name);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int DSA_meth_get_flags(const DSA_METHOD *dsam);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int DSA_meth_set_flags(DSA_METHOD *dsam, int flags);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 void *DSA_meth_get0_app_data(const DSA_METHOD *dsam);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int DSA_meth_set0_app_data(DSA_METHOD *dsam,
|
||||||
|
void *app_data);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 DSA_SIG *(*DSA_meth_get_sign(const DSA_METHOD *dsam))
|
||||||
|
(const unsigned char *, int, DSA *);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int DSA_meth_set_sign(DSA_METHOD *dsam,
|
||||||
|
DSA_SIG *(*sign) (const unsigned char *, int, DSA *));
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int (*DSA_meth_get_sign_setup(const DSA_METHOD *dsam))
|
||||||
|
(DSA *, BN_CTX *, BIGNUM **, BIGNUM **);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int DSA_meth_set_sign_setup(DSA_METHOD *dsam,
|
||||||
|
int (*sign_setup) (DSA *, BN_CTX *, BIGNUM **, BIGNUM **));
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int (*DSA_meth_get_verify(const DSA_METHOD *dsam))
|
||||||
|
(const unsigned char *, int, DSA_SIG *, DSA *);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int DSA_meth_set_verify(DSA_METHOD *dsam,
|
||||||
|
int (*verify) (const unsigned char *, int, DSA_SIG *, DSA *));
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int (*DSA_meth_get_mod_exp(const DSA_METHOD *dsam))
|
||||||
|
(DSA *, BIGNUM *, const BIGNUM *, const BIGNUM *, const BIGNUM *,
|
||||||
|
const BIGNUM *, const BIGNUM *, BN_CTX *, BN_MONT_CTX *);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int DSA_meth_set_mod_exp(DSA_METHOD *dsam,
|
||||||
|
int (*mod_exp) (DSA *, BIGNUM *, const BIGNUM *, const BIGNUM *,
|
||||||
|
const BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *,
|
||||||
|
BN_MONT_CTX *));
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int (*DSA_meth_get_bn_mod_exp(const DSA_METHOD *dsam))
|
||||||
|
(DSA *, BIGNUM *, const BIGNUM *, const BIGNUM *, const BIGNUM *,
|
||||||
|
BN_CTX *, BN_MONT_CTX *);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int DSA_meth_set_bn_mod_exp(DSA_METHOD *dsam,
|
||||||
|
int (*bn_mod_exp) (DSA *, BIGNUM *, const BIGNUM *, const BIGNUM *,
|
||||||
|
const BIGNUM *, BN_CTX *, BN_MONT_CTX *));
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int (*DSA_meth_get_init(const DSA_METHOD *dsam))(DSA *);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int DSA_meth_set_init(DSA_METHOD *dsam,
|
||||||
|
int (*init)(DSA *));
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int (*DSA_meth_get_finish(const DSA_METHOD *dsam))(DSA *);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int DSA_meth_set_finish(DSA_METHOD *dsam,
|
||||||
|
int (*finish)(DSA *));
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int (*DSA_meth_get_paramgen(const DSA_METHOD *dsam))
|
||||||
|
(DSA *, int, const unsigned char *, int, int *, unsigned long *,
|
||||||
|
BN_GENCB *);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int DSA_meth_set_paramgen(DSA_METHOD *dsam,
|
||||||
|
int (*paramgen) (DSA *, int, const unsigned char *, int, int *,
|
||||||
|
unsigned long *, BN_GENCB *));
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int (*DSA_meth_get_keygen(const DSA_METHOD *dsam))(DSA *);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int DSA_meth_set_keygen(DSA_METHOD *dsam,
|
||||||
|
int (*keygen) (DSA *));
|
||||||
|
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
# ifdef __cplusplus
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
* Generated by util/mkerr.pl DO NOT EDIT
|
||||||
|
* Copyright 1995-2023 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef OPENSSL_DSAERR_H
|
||||||
|
# define OPENSSL_DSAERR_H
|
||||||
|
# pragma once
|
||||||
|
|
||||||
|
# include <openssl/opensslconf.h>
|
||||||
|
# include <openssl/symhacks.h>
|
||||||
|
# include <openssl/cryptoerr_legacy.h>
|
||||||
|
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_DSA
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* DSA reason codes.
|
||||||
|
*/
|
||||||
|
# define DSA_R_BAD_FFC_PARAMETERS 114
|
||||||
|
# define DSA_R_BAD_Q_VALUE 102
|
||||||
|
# define DSA_R_BN_DECODE_ERROR 108
|
||||||
|
# define DSA_R_BN_ERROR 109
|
||||||
|
# define DSA_R_DECODE_ERROR 104
|
||||||
|
# define DSA_R_INVALID_DIGEST_TYPE 106
|
||||||
|
# define DSA_R_INVALID_PARAMETERS 112
|
||||||
|
# define DSA_R_MISSING_PARAMETERS 101
|
||||||
|
# define DSA_R_MISSING_PRIVATE_KEY 111
|
||||||
|
# define DSA_R_MODULUS_TOO_LARGE 103
|
||||||
|
# define DSA_R_NO_PARAMETERS_SET 107
|
||||||
|
# define DSA_R_PARAMETER_ENCODING_ERROR 105
|
||||||
|
# define DSA_R_P_NOT_PRIME 115
|
||||||
|
# define DSA_R_Q_NOT_PRIME 113
|
||||||
|
# define DSA_R_SEED_LEN_SMALL 110
|
||||||
|
# define DSA_R_TOO_MANY_RETRIES 116
|
||||||
|
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2005-2021 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef OPENSSL_DTLS1_H
|
||||||
|
# define OPENSSL_DTLS1_H
|
||||||
|
# pragma once
|
||||||
|
|
||||||
|
# include <openssl/macros.h>
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
# define HEADER_DTLS1_H
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# include <openssl/prov_ssl.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <openssl/opensslconf.h>
|
||||||
|
|
||||||
|
/* DTLS*_VERSION constants are defined in prov_ssl.h */
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
# define DTLS_MIN_VERSION DTLS1_VERSION
|
||||||
|
# define DTLS_MAX_VERSION DTLS1_2_VERSION
|
||||||
|
# endif
|
||||||
|
# define DTLS1_VERSION_MAJOR 0xFE
|
||||||
|
|
||||||
|
/* Special value for method supporting multiple versions */
|
||||||
|
# define DTLS_ANY_VERSION 0x1FFFF
|
||||||
|
|
||||||
|
/* lengths of messages */
|
||||||
|
|
||||||
|
# define DTLS1_COOKIE_LENGTH 255
|
||||||
|
|
||||||
|
# define DTLS1_RT_HEADER_LENGTH 13
|
||||||
|
|
||||||
|
# define DTLS1_HM_HEADER_LENGTH 12
|
||||||
|
|
||||||
|
# define DTLS1_HM_BAD_FRAGMENT -2
|
||||||
|
# define DTLS1_HM_FRAGMENT_RETRY -3
|
||||||
|
|
||||||
|
# define DTLS1_CCS_HEADER_LENGTH 1
|
||||||
|
|
||||||
|
# define DTLS1_AL_HEADER_LENGTH 2
|
||||||
|
|
||||||
|
# define DTLS1_TMO_ALERT_COUNT 12
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,310 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 1995-2024 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef OPENSSL_E_OS2_H
|
||||||
|
# define OPENSSL_E_OS2_H
|
||||||
|
# pragma once
|
||||||
|
|
||||||
|
# include <openssl/macros.h>
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
# define HEADER_E_OS2_H
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# include <openssl/opensslconf.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
* Detect operating systems. This probably needs completing.
|
||||||
|
* The result is that at least one OPENSSL_SYS_os macro should be defined.
|
||||||
|
* However, if none is defined, Unix is assumed.
|
||||||
|
**/
|
||||||
|
|
||||||
|
# define OPENSSL_SYS_UNIX
|
||||||
|
|
||||||
|
/* --------------------- Microsoft operating systems ---------------------- */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Note that MSDOS actually denotes 32-bit environments running on top of
|
||||||
|
* MS-DOS, such as DJGPP one.
|
||||||
|
*/
|
||||||
|
# if defined(OPENSSL_SYS_MSDOS)
|
||||||
|
# undef OPENSSL_SYS_UNIX
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* For 32 bit environment, there seems to be the CygWin environment and then
|
||||||
|
* all the others that try to do the same thing Microsoft does...
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
* UEFI lives here because it might be built with a Microsoft toolchain and
|
||||||
|
* we need to avoid the false positive match on Windows.
|
||||||
|
*/
|
||||||
|
# if defined(OPENSSL_SYS_UEFI)
|
||||||
|
# undef OPENSSL_SYS_UNIX
|
||||||
|
# elif defined(OPENSSL_SYS_UWIN)
|
||||||
|
# undef OPENSSL_SYS_UNIX
|
||||||
|
# define OPENSSL_SYS_WIN32_UWIN
|
||||||
|
# else
|
||||||
|
# if defined(__CYGWIN__) || defined(OPENSSL_SYS_CYGWIN)
|
||||||
|
# define OPENSSL_SYS_WIN32_CYGWIN
|
||||||
|
# else
|
||||||
|
# if defined(_WIN32) || defined(OPENSSL_SYS_WIN32)
|
||||||
|
# undef OPENSSL_SYS_UNIX
|
||||||
|
# if !defined(OPENSSL_SYS_WIN32)
|
||||||
|
# define OPENSSL_SYS_WIN32
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
# if defined(_WIN64) || defined(OPENSSL_SYS_WIN64)
|
||||||
|
# undef OPENSSL_SYS_UNIX
|
||||||
|
# if !defined(OPENSSL_SYS_WIN64)
|
||||||
|
# define OPENSSL_SYS_WIN64
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
# if defined(OPENSSL_SYS_WINNT)
|
||||||
|
# undef OPENSSL_SYS_UNIX
|
||||||
|
# endif
|
||||||
|
# if defined(OPENSSL_SYS_WINCE)
|
||||||
|
# undef OPENSSL_SYS_UNIX
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/* Anything that tries to look like Microsoft is "Windows" */
|
||||||
|
# if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WIN64) || defined(OPENSSL_SYS_WINNT) || defined(OPENSSL_SYS_WINCE)
|
||||||
|
# undef OPENSSL_SYS_UNIX
|
||||||
|
# define OPENSSL_SYS_WINDOWS
|
||||||
|
# ifndef OPENSSL_SYS_MSDOS
|
||||||
|
# define OPENSSL_SYS_MSDOS
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* DLL settings. This part is a bit tough, because it's up to the
|
||||||
|
* application implementer how he or she will link the application, so it
|
||||||
|
* requires some macro to be used.
|
||||||
|
*/
|
||||||
|
# ifdef OPENSSL_SYS_WINDOWS
|
||||||
|
# ifndef OPENSSL_OPT_WINDLL
|
||||||
|
# if defined(_WINDLL) /* This is used when building OpenSSL to
|
||||||
|
* indicate that DLL linkage should be used */
|
||||||
|
# define OPENSSL_OPT_WINDLL
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/* ------------------------------- OpenVMS -------------------------------- */
|
||||||
|
# if defined(__VMS) || defined(VMS)
|
||||||
|
# if !defined(OPENSSL_SYS_VMS)
|
||||||
|
# undef OPENSSL_SYS_UNIX
|
||||||
|
# define OPENSSL_SYS_VMS
|
||||||
|
# endif
|
||||||
|
# if defined(__DECC)
|
||||||
|
# define OPENSSL_SYS_VMS_DECC
|
||||||
|
# elif defined(__DECCXX)
|
||||||
|
# define OPENSSL_SYS_VMS_DECC
|
||||||
|
# define OPENSSL_SYS_VMS_DECCXX
|
||||||
|
# else
|
||||||
|
# define OPENSSL_SYS_VMS_NODECC
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/* -------------------------------- Unix ---------------------------------- */
|
||||||
|
# ifdef OPENSSL_SYS_UNIX
|
||||||
|
# if defined(linux) || defined(__linux__) && !defined(OPENSSL_SYS_LINUX)
|
||||||
|
# define OPENSSL_SYS_LINUX
|
||||||
|
# endif
|
||||||
|
# if defined(_AIX) && !defined(OPENSSL_SYS_AIX)
|
||||||
|
# define OPENSSL_SYS_AIX
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/* -------------------------------- VOS ----------------------------------- */
|
||||||
|
# if defined(__VOS__) && !defined(OPENSSL_SYS_VOS)
|
||||||
|
# define OPENSSL_SYS_VOS
|
||||||
|
# ifdef __HPPA__
|
||||||
|
# define OPENSSL_SYS_VOS_HPPA
|
||||||
|
# endif
|
||||||
|
# ifdef __IA32__
|
||||||
|
# define OPENSSL_SYS_VOS_IA32
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/* ---------------------------- HP NonStop -------------------------------- */
|
||||||
|
# ifdef __TANDEM
|
||||||
|
# ifdef _STRING
|
||||||
|
# include <strings.h>
|
||||||
|
# endif
|
||||||
|
# define OPENSSL_USE_BUILD_DATE
|
||||||
|
# if defined(OPENSSL_THREADS) && defined(_SPT_MODEL_)
|
||||||
|
# define SPT_THREAD_SIGNAL 1
|
||||||
|
# define SPT_THREAD_AWARE 1
|
||||||
|
# include <spthread.h>
|
||||||
|
# elif defined(OPENSSL_THREADS) && defined(_PUT_MODEL_)
|
||||||
|
# include <pthread.h>
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* That's it for OS-specific stuff
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
/*-
|
||||||
|
* OPENSSL_EXTERN is normally used to declare a symbol with possible extra
|
||||||
|
* attributes to handle its presence in a shared library.
|
||||||
|
* OPENSSL_EXPORT is used to define a symbol with extra possible attributes
|
||||||
|
* to make it visible in a shared library.
|
||||||
|
* Care needs to be taken when a header file is used both to declare and
|
||||||
|
* define symbols. Basically, for any library that exports some global
|
||||||
|
* variables, the following code must be present in the header file that
|
||||||
|
* declares them, before OPENSSL_EXTERN is used:
|
||||||
|
*
|
||||||
|
* #ifdef SOME_BUILD_FLAG_MACRO
|
||||||
|
* # undef OPENSSL_EXTERN
|
||||||
|
* # define OPENSSL_EXTERN OPENSSL_EXPORT
|
||||||
|
* #endif
|
||||||
|
*
|
||||||
|
* The default is to have OPENSSL_EXPORT and OPENSSL_EXTERN
|
||||||
|
* have some generally sensible values.
|
||||||
|
*/
|
||||||
|
|
||||||
|
# if defined(OPENSSL_SYS_WINDOWS) && defined(OPENSSL_OPT_WINDLL)
|
||||||
|
# define OPENSSL_EXPORT extern __declspec(dllexport)
|
||||||
|
# define OPENSSL_EXTERN extern __declspec(dllimport)
|
||||||
|
# else
|
||||||
|
# define OPENSSL_EXPORT extern
|
||||||
|
# define OPENSSL_EXTERN extern
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifdef _WIN32
|
||||||
|
# ifdef _WIN64
|
||||||
|
# define ossl_ssize_t __int64
|
||||||
|
# define OSSL_SSIZE_MAX _I64_MAX
|
||||||
|
# else
|
||||||
|
# define ossl_ssize_t int
|
||||||
|
# define OSSL_SSIZE_MAX INT_MAX
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# if defined(OPENSSL_SYS_UEFI) && !defined(ossl_ssize_t)
|
||||||
|
# define ossl_ssize_t INTN
|
||||||
|
# define OSSL_SSIZE_MAX MAX_INTN
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifndef ossl_ssize_t
|
||||||
|
# include <sys/types.h>
|
||||||
|
# define ossl_ssize_t ssize_t
|
||||||
|
# if defined(SSIZE_MAX)
|
||||||
|
# define OSSL_SSIZE_MAX SSIZE_MAX
|
||||||
|
# elif defined(_POSIX_SSIZE_MAX)
|
||||||
|
# define OSSL_SSIZE_MAX _POSIX_SSIZE_MAX
|
||||||
|
# else
|
||||||
|
# define OSSL_SSIZE_MAX ((ssize_t)(SIZE_MAX>>1))
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# if defined(UNUSEDRESULT_DEBUG)
|
||||||
|
# define __owur __attribute__((__warn_unused_result__))
|
||||||
|
# else
|
||||||
|
# define __owur
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/* Standard integer types */
|
||||||
|
# define OPENSSL_NO_INTTYPES_H
|
||||||
|
# define OPENSSL_NO_STDINT_H
|
||||||
|
# if defined(OPENSSL_SYS_UEFI)
|
||||||
|
typedef INT8 int8_t;
|
||||||
|
typedef UINT8 uint8_t;
|
||||||
|
typedef INT16 int16_t;
|
||||||
|
typedef UINT16 uint16_t;
|
||||||
|
typedef INT32 int32_t;
|
||||||
|
typedef UINT32 uint32_t;
|
||||||
|
typedef INT64 int64_t;
|
||||||
|
typedef UINT64 uint64_t;
|
||||||
|
typedef UINTN uintptr_t;
|
||||||
|
# elif (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \
|
||||||
|
defined(__osf__) || defined(__sgi) || defined(__hpux) || \
|
||||||
|
defined(OPENSSL_SYS_VMS) || defined (__OpenBSD__)
|
||||||
|
# include <inttypes.h>
|
||||||
|
# undef OPENSSL_NO_INTTYPES_H
|
||||||
|
/* Because the specs say that inttypes.h includes stdint.h if present */
|
||||||
|
# undef OPENSSL_NO_STDINT_H
|
||||||
|
# elif defined(_MSC_VER) && _MSC_VER<1600
|
||||||
|
/*
|
||||||
|
* minimally required typdefs for systems not supporting inttypes.h or
|
||||||
|
* stdint.h: currently just older VC++
|
||||||
|
*/
|
||||||
|
typedef signed char int8_t;
|
||||||
|
typedef unsigned char uint8_t;
|
||||||
|
typedef short int16_t;
|
||||||
|
typedef unsigned short uint16_t;
|
||||||
|
typedef int int32_t;
|
||||||
|
typedef unsigned int uint32_t;
|
||||||
|
typedef __int64 int64_t;
|
||||||
|
typedef unsigned __int64 uint64_t;
|
||||||
|
# elif defined(OPENSSL_SYS_TANDEM)
|
||||||
|
# include <stdint.h>
|
||||||
|
# include <sys/types.h>
|
||||||
|
# else
|
||||||
|
# include <stdint.h>
|
||||||
|
# undef OPENSSL_NO_STDINT_H
|
||||||
|
# endif
|
||||||
|
# if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L && \
|
||||||
|
defined(INTMAX_MAX) && defined(UINTMAX_MAX)
|
||||||
|
typedef intmax_t ossl_intmax_t;
|
||||||
|
typedef uintmax_t ossl_uintmax_t;
|
||||||
|
# else
|
||||||
|
/* Fall back to the largest we know we require and can handle */
|
||||||
|
typedef int64_t ossl_intmax_t;
|
||||||
|
typedef uint64_t ossl_uintmax_t;
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/* ossl_inline: portable inline definition usable in public headers */
|
||||||
|
# if !defined(inline) && !defined(__cplusplus)
|
||||||
|
# if defined(__STDC_VERSION__) && __STDC_VERSION__>=199901L
|
||||||
|
/* just use inline */
|
||||||
|
# define ossl_inline inline
|
||||||
|
# elif defined(__GNUC__) && __GNUC__>=2
|
||||||
|
# define ossl_inline __inline__
|
||||||
|
# elif defined(_MSC_VER)
|
||||||
|
/*
|
||||||
|
* Visual Studio: inline is available in C++ only, however
|
||||||
|
* __inline is available for C, see
|
||||||
|
* http://msdn.microsoft.com/en-us/library/z8y1yy88.aspx
|
||||||
|
*/
|
||||||
|
# define ossl_inline __inline
|
||||||
|
# else
|
||||||
|
# define ossl_inline
|
||||||
|
# endif
|
||||||
|
# else
|
||||||
|
# define ossl_inline inline
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L && \
|
||||||
|
!defined(__cplusplus)
|
||||||
|
# define ossl_noreturn _Noreturn
|
||||||
|
# elif defined(__GNUC__) && __GNUC__ >= 2
|
||||||
|
# define ossl_noreturn __attribute__((noreturn))
|
||||||
|
# else
|
||||||
|
# define ossl_noreturn
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/* ossl_unused: portable unused attribute for use in public headers */
|
||||||
|
# if defined(__GNUC__)
|
||||||
|
# define ossl_unused __attribute__((unused))
|
||||||
|
# else
|
||||||
|
# define ossl_unused
|
||||||
|
# endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2023 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef OPENSSL_E_OSTIME_H
|
||||||
|
# define OPENSSL_E_OSTIME_H
|
||||||
|
# pragma once
|
||||||
|
|
||||||
|
# include <openssl/macros.h>
|
||||||
|
# include <openssl/opensslconf.h>
|
||||||
|
# include <openssl/e_os2.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This header guarantees that 'struct timeval' will be available. It includes
|
||||||
|
* the minimum headers needed to facilitate this. This may still be a
|
||||||
|
* substantial set of headers on some platforms (e.g. <winsock2.h> on Win32).
|
||||||
|
*/
|
||||||
|
|
||||||
|
# if defined(OPENSSL_SYS_WINDOWS)
|
||||||
|
# if !defined(_WINSOCKAPI_)
|
||||||
|
/*
|
||||||
|
* winsock2.h defines _WINSOCK2API_ and both winsock2.h and winsock.h define
|
||||||
|
* _WINSOCKAPI_. Both of these provide struct timeval. Don't include
|
||||||
|
* winsock2.h if either header has been included to avoid breakage with
|
||||||
|
* applications that prefer to use <winsock.h> over <winsock2.h>.
|
||||||
|
*/
|
||||||
|
# include <winsock2.h>
|
||||||
|
# endif
|
||||||
|
# else
|
||||||
|
# include <sys/time.h>
|
||||||
|
# endif
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 1999-2016 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef OPENSSL_EBCDIC_H
|
||||||
|
# define OPENSSL_EBCDIC_H
|
||||||
|
# pragma once
|
||||||
|
|
||||||
|
# include <openssl/macros.h>
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
# define HEADER_EBCDIC_H
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# include <stdlib.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Avoid name clashes with other applications */
|
||||||
|
# define os_toascii _openssl_os_toascii
|
||||||
|
# define os_toebcdic _openssl_os_toebcdic
|
||||||
|
# define ebcdic2ascii _openssl_ebcdic2ascii
|
||||||
|
# define ascii2ebcdic _openssl_ascii2ebcdic
|
||||||
|
|
||||||
|
extern const unsigned char os_toascii[256];
|
||||||
|
extern const unsigned char os_toebcdic[256];
|
||||||
|
void *ebcdic2ascii(void *dest, const void *srce, size_t count);
|
||||||
|
void *ascii2ebcdic(void *dest, const void *srce, size_t count);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,10 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2002-2016 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <openssl/ec.h>
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2002-2016 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <openssl/ec.h>
|
||||||
@@ -0,0 +1,104 @@
|
|||||||
|
/*
|
||||||
|
* Generated by util/mkerr.pl DO NOT EDIT
|
||||||
|
* Copyright 1995-2023 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef OPENSSL_ECERR_H
|
||||||
|
# define OPENSSL_ECERR_H
|
||||||
|
# pragma once
|
||||||
|
|
||||||
|
# include <openssl/opensslconf.h>
|
||||||
|
# include <openssl/symhacks.h>
|
||||||
|
# include <openssl/cryptoerr_legacy.h>
|
||||||
|
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_EC
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* EC reason codes.
|
||||||
|
*/
|
||||||
|
# define EC_R_ASN1_ERROR 115
|
||||||
|
# define EC_R_BAD_SIGNATURE 156
|
||||||
|
# define EC_R_BIGNUM_OUT_OF_RANGE 144
|
||||||
|
# define EC_R_BUFFER_TOO_SMALL 100
|
||||||
|
# define EC_R_CANNOT_INVERT 165
|
||||||
|
# define EC_R_COORDINATES_OUT_OF_RANGE 146
|
||||||
|
# define EC_R_CURVE_DOES_NOT_SUPPORT_ECDH 160
|
||||||
|
# define EC_R_CURVE_DOES_NOT_SUPPORT_ECDSA 170
|
||||||
|
# define EC_R_CURVE_DOES_NOT_SUPPORT_SIGNING 159
|
||||||
|
# define EC_R_DECODE_ERROR 142
|
||||||
|
# define EC_R_DISCRIMINANT_IS_ZERO 118
|
||||||
|
# define EC_R_EC_GROUP_NEW_BY_NAME_FAILURE 119
|
||||||
|
# define EC_R_EXPLICIT_PARAMS_NOT_SUPPORTED 127
|
||||||
|
# define EC_R_FAILED_MAKING_PUBLIC_KEY 166
|
||||||
|
# define EC_R_FIELD_TOO_LARGE 143
|
||||||
|
# define EC_R_GF2M_NOT_SUPPORTED 147
|
||||||
|
# define EC_R_GROUP2PKPARAMETERS_FAILURE 120
|
||||||
|
# define EC_R_I2D_ECPKPARAMETERS_FAILURE 121
|
||||||
|
# define EC_R_INCOMPATIBLE_OBJECTS 101
|
||||||
|
# define EC_R_INVALID_A 168
|
||||||
|
# define EC_R_INVALID_ARGUMENT 112
|
||||||
|
# define EC_R_INVALID_B 169
|
||||||
|
# define EC_R_INVALID_COFACTOR 171
|
||||||
|
# define EC_R_INVALID_COMPRESSED_POINT 110
|
||||||
|
# define EC_R_INVALID_COMPRESSION_BIT 109
|
||||||
|
# define EC_R_INVALID_CURVE 141
|
||||||
|
# define EC_R_INVALID_DIGEST 151
|
||||||
|
# define EC_R_INVALID_DIGEST_TYPE 138
|
||||||
|
# define EC_R_INVALID_ENCODING 102
|
||||||
|
# define EC_R_INVALID_FIELD 103
|
||||||
|
# define EC_R_INVALID_FORM 104
|
||||||
|
# define EC_R_INVALID_GENERATOR 173
|
||||||
|
# define EC_R_INVALID_GROUP_ORDER 122
|
||||||
|
# define EC_R_INVALID_KEY 116
|
||||||
|
# define EC_R_INVALID_LENGTH 117
|
||||||
|
# define EC_R_INVALID_NAMED_GROUP_CONVERSION 174
|
||||||
|
# define EC_R_INVALID_OUTPUT_LENGTH 161
|
||||||
|
# define EC_R_INVALID_P 172
|
||||||
|
# define EC_R_INVALID_PEER_KEY 133
|
||||||
|
# define EC_R_INVALID_PENTANOMIAL_BASIS 132
|
||||||
|
# define EC_R_INVALID_PRIVATE_KEY 123
|
||||||
|
# define EC_R_INVALID_SEED 175
|
||||||
|
# define EC_R_INVALID_TRINOMIAL_BASIS 137
|
||||||
|
# define EC_R_KDF_PARAMETER_ERROR 148
|
||||||
|
# define EC_R_KEYS_NOT_SET 140
|
||||||
|
# define EC_R_LADDER_POST_FAILURE 136
|
||||||
|
# define EC_R_LADDER_PRE_FAILURE 153
|
||||||
|
# define EC_R_LADDER_STEP_FAILURE 162
|
||||||
|
# define EC_R_MISSING_OID 167
|
||||||
|
# define EC_R_MISSING_PARAMETERS 124
|
||||||
|
# define EC_R_MISSING_PRIVATE_KEY 125
|
||||||
|
# define EC_R_NEED_NEW_SETUP_VALUES 157
|
||||||
|
# define EC_R_NOT_A_NIST_PRIME 135
|
||||||
|
# define EC_R_NOT_IMPLEMENTED 126
|
||||||
|
# define EC_R_NOT_INITIALIZED 111
|
||||||
|
# define EC_R_NO_PARAMETERS_SET 139
|
||||||
|
# define EC_R_NO_PRIVATE_VALUE 154
|
||||||
|
# define EC_R_OPERATION_NOT_SUPPORTED 152
|
||||||
|
# define EC_R_PASSED_NULL_PARAMETER 134
|
||||||
|
# define EC_R_PEER_KEY_ERROR 149
|
||||||
|
# define EC_R_POINT_ARITHMETIC_FAILURE 155
|
||||||
|
# define EC_R_POINT_AT_INFINITY 106
|
||||||
|
# define EC_R_POINT_COORDINATES_BLIND_FAILURE 163
|
||||||
|
# define EC_R_POINT_IS_NOT_ON_CURVE 107
|
||||||
|
# define EC_R_RANDOM_NUMBER_GENERATION_FAILED 158
|
||||||
|
# define EC_R_SHARED_INFO_ERROR 150
|
||||||
|
# define EC_R_SLOT_FULL 108
|
||||||
|
# define EC_R_TOO_MANY_RETRIES 176
|
||||||
|
# define EC_R_UNDEFINED_GENERATOR 113
|
||||||
|
# define EC_R_UNDEFINED_ORDER 128
|
||||||
|
# define EC_R_UNKNOWN_COFACTOR 164
|
||||||
|
# define EC_R_UNKNOWN_GROUP 129
|
||||||
|
# define EC_R_UNKNOWN_ORDER 114
|
||||||
|
# define EC_R_UNSUPPORTED_FIELD 131
|
||||||
|
# define EC_R_WRONG_CURVE_PARAMETERS 145
|
||||||
|
# define EC_R_WRONG_ORDER 130
|
||||||
|
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,124 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2019-2021 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef OPENSSL_ENCODER_H
|
||||||
|
# define OPENSSL_ENCODER_H
|
||||||
|
# pragma once
|
||||||
|
|
||||||
|
# include <openssl/opensslconf.h>
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_STDIO
|
||||||
|
# include <stdio.h>
|
||||||
|
# endif
|
||||||
|
# include <stdarg.h>
|
||||||
|
# include <stddef.h>
|
||||||
|
# include <openssl/encodererr.h>
|
||||||
|
# include <openssl/types.h>
|
||||||
|
# include <openssl/core.h>
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
# endif
|
||||||
|
|
||||||
|
OSSL_ENCODER *OSSL_ENCODER_fetch(OSSL_LIB_CTX *libctx, const char *name,
|
||||||
|
const char *properties);
|
||||||
|
int OSSL_ENCODER_up_ref(OSSL_ENCODER *encoder);
|
||||||
|
void OSSL_ENCODER_free(OSSL_ENCODER *encoder);
|
||||||
|
|
||||||
|
const OSSL_PROVIDER *OSSL_ENCODER_get0_provider(const OSSL_ENCODER *encoder);
|
||||||
|
const char *OSSL_ENCODER_get0_properties(const OSSL_ENCODER *encoder);
|
||||||
|
const char *OSSL_ENCODER_get0_name(const OSSL_ENCODER *kdf);
|
||||||
|
const char *OSSL_ENCODER_get0_description(const OSSL_ENCODER *kdf);
|
||||||
|
int OSSL_ENCODER_is_a(const OSSL_ENCODER *encoder, const char *name);
|
||||||
|
|
||||||
|
void OSSL_ENCODER_do_all_provided(OSSL_LIB_CTX *libctx,
|
||||||
|
void (*fn)(OSSL_ENCODER *encoder, void *arg),
|
||||||
|
void *arg);
|
||||||
|
int OSSL_ENCODER_names_do_all(const OSSL_ENCODER *encoder,
|
||||||
|
void (*fn)(const char *name, void *data),
|
||||||
|
void *data);
|
||||||
|
const OSSL_PARAM *OSSL_ENCODER_gettable_params(OSSL_ENCODER *encoder);
|
||||||
|
int OSSL_ENCODER_get_params(OSSL_ENCODER *encoder, OSSL_PARAM params[]);
|
||||||
|
|
||||||
|
const OSSL_PARAM *OSSL_ENCODER_settable_ctx_params(OSSL_ENCODER *encoder);
|
||||||
|
OSSL_ENCODER_CTX *OSSL_ENCODER_CTX_new(void);
|
||||||
|
int OSSL_ENCODER_CTX_set_params(OSSL_ENCODER_CTX *ctx,
|
||||||
|
const OSSL_PARAM params[]);
|
||||||
|
void OSSL_ENCODER_CTX_free(OSSL_ENCODER_CTX *ctx);
|
||||||
|
|
||||||
|
/* Utilities that help set specific parameters */
|
||||||
|
int OSSL_ENCODER_CTX_set_passphrase(OSSL_ENCODER_CTX *ctx,
|
||||||
|
const unsigned char *kstr, size_t klen);
|
||||||
|
int OSSL_ENCODER_CTX_set_pem_password_cb(OSSL_ENCODER_CTX *ctx,
|
||||||
|
pem_password_cb *cb, void *cbarg);
|
||||||
|
int OSSL_ENCODER_CTX_set_passphrase_cb(OSSL_ENCODER_CTX *ctx,
|
||||||
|
OSSL_PASSPHRASE_CALLBACK *cb,
|
||||||
|
void *cbarg);
|
||||||
|
int OSSL_ENCODER_CTX_set_passphrase_ui(OSSL_ENCODER_CTX *ctx,
|
||||||
|
const UI_METHOD *ui_method,
|
||||||
|
void *ui_data);
|
||||||
|
int OSSL_ENCODER_CTX_set_cipher(OSSL_ENCODER_CTX *ctx,
|
||||||
|
const char *cipher_name,
|
||||||
|
const char *propquery);
|
||||||
|
int OSSL_ENCODER_CTX_set_selection(OSSL_ENCODER_CTX *ctx, int selection);
|
||||||
|
int OSSL_ENCODER_CTX_set_output_type(OSSL_ENCODER_CTX *ctx,
|
||||||
|
const char *output_type);
|
||||||
|
int OSSL_ENCODER_CTX_set_output_structure(OSSL_ENCODER_CTX *ctx,
|
||||||
|
const char *output_structure);
|
||||||
|
|
||||||
|
/* Utilities to add encoders */
|
||||||
|
int OSSL_ENCODER_CTX_add_encoder(OSSL_ENCODER_CTX *ctx, OSSL_ENCODER *encoder);
|
||||||
|
int OSSL_ENCODER_CTX_add_extra(OSSL_ENCODER_CTX *ctx,
|
||||||
|
OSSL_LIB_CTX *libctx, const char *propq);
|
||||||
|
int OSSL_ENCODER_CTX_get_num_encoders(OSSL_ENCODER_CTX *ctx);
|
||||||
|
|
||||||
|
typedef struct ossl_encoder_instance_st OSSL_ENCODER_INSTANCE;
|
||||||
|
OSSL_ENCODER *
|
||||||
|
OSSL_ENCODER_INSTANCE_get_encoder(OSSL_ENCODER_INSTANCE *encoder_inst);
|
||||||
|
void *
|
||||||
|
OSSL_ENCODER_INSTANCE_get_encoder_ctx(OSSL_ENCODER_INSTANCE *encoder_inst);
|
||||||
|
const char *
|
||||||
|
OSSL_ENCODER_INSTANCE_get_output_type(OSSL_ENCODER_INSTANCE *encoder_inst);
|
||||||
|
const char *
|
||||||
|
OSSL_ENCODER_INSTANCE_get_output_structure(OSSL_ENCODER_INSTANCE *encoder_inst);
|
||||||
|
|
||||||
|
typedef const void *OSSL_ENCODER_CONSTRUCT(OSSL_ENCODER_INSTANCE *encoder_inst,
|
||||||
|
void *construct_data);
|
||||||
|
typedef void OSSL_ENCODER_CLEANUP(void *construct_data);
|
||||||
|
|
||||||
|
int OSSL_ENCODER_CTX_set_construct(OSSL_ENCODER_CTX *ctx,
|
||||||
|
OSSL_ENCODER_CONSTRUCT *construct);
|
||||||
|
int OSSL_ENCODER_CTX_set_construct_data(OSSL_ENCODER_CTX *ctx,
|
||||||
|
void *construct_data);
|
||||||
|
int OSSL_ENCODER_CTX_set_cleanup(OSSL_ENCODER_CTX *ctx,
|
||||||
|
OSSL_ENCODER_CLEANUP *cleanup);
|
||||||
|
|
||||||
|
/* Utilities to output the object to encode */
|
||||||
|
int OSSL_ENCODER_to_bio(OSSL_ENCODER_CTX *ctx, BIO *out);
|
||||||
|
#ifndef OPENSSL_NO_STDIO
|
||||||
|
int OSSL_ENCODER_to_fp(OSSL_ENCODER_CTX *ctx, FILE *fp);
|
||||||
|
#endif
|
||||||
|
int OSSL_ENCODER_to_data(OSSL_ENCODER_CTX *ctx, unsigned char **pdata,
|
||||||
|
size_t *pdata_len);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Create the OSSL_ENCODER_CTX with an associated type. This will perform
|
||||||
|
* an implicit OSSL_ENCODER_fetch(), suitable for the object of that type.
|
||||||
|
* This is more useful than calling OSSL_ENCODER_CTX_new().
|
||||||
|
*/
|
||||||
|
OSSL_ENCODER_CTX *OSSL_ENCODER_CTX_new_for_pkey(const EVP_PKEY *pkey,
|
||||||
|
int selection,
|
||||||
|
const char *output_type,
|
||||||
|
const char *output_struct,
|
||||||
|
const char *propquery);
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
/*
|
||||||
|
* Generated by util/mkerr.pl DO NOT EDIT
|
||||||
|
* Copyright 1995-2021 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef OPENSSL_ENCODERERR_H
|
||||||
|
# define OPENSSL_ENCODERERR_H
|
||||||
|
# pragma once
|
||||||
|
|
||||||
|
# include <openssl/opensslconf.h>
|
||||||
|
# include <openssl/symhacks.h>
|
||||||
|
# include <openssl/cryptoerr_legacy.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* OSSL_ENCODER reason codes.
|
||||||
|
*/
|
||||||
|
# define OSSL_ENCODER_R_ENCODER_NOT_FOUND 101
|
||||||
|
# define OSSL_ENCODER_R_INCORRECT_PROPERTY_QUERY 100
|
||||||
|
# define OSSL_ENCODER_R_MISSING_GET_PARAMS 102
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,833 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.
|
||||||
|
* Copyright (c) 2002, Oracle and/or its affiliates. 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef OPENSSL_ENGINE_H
|
||||||
|
# define OPENSSL_ENGINE_H
|
||||||
|
# pragma once
|
||||||
|
|
||||||
|
# include <openssl/macros.h>
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
# define HEADER_ENGINE_H
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# include <openssl/opensslconf.h>
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_ENGINE
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_1_1_0
|
||||||
|
# include <openssl/bn.h>
|
||||||
|
# include <openssl/rsa.h>
|
||||||
|
# include <openssl/dsa.h>
|
||||||
|
# include <openssl/dh.h>
|
||||||
|
# include <openssl/ec.h>
|
||||||
|
# include <openssl/rand.h>
|
||||||
|
# include <openssl/ui.h>
|
||||||
|
# include <openssl/err.h>
|
||||||
|
# endif
|
||||||
|
# include <openssl/types.h>
|
||||||
|
# include <openssl/symhacks.h>
|
||||||
|
# include <openssl/x509.h>
|
||||||
|
# include <openssl/engineerr.h>
|
||||||
|
# ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* These flags are used to control combinations of algorithm (methods) by
|
||||||
|
* bitwise "OR"ing.
|
||||||
|
*/
|
||||||
|
# define ENGINE_METHOD_RSA (unsigned int)0x0001
|
||||||
|
# define ENGINE_METHOD_DSA (unsigned int)0x0002
|
||||||
|
# define ENGINE_METHOD_DH (unsigned int)0x0004
|
||||||
|
# define ENGINE_METHOD_RAND (unsigned int)0x0008
|
||||||
|
# define ENGINE_METHOD_CIPHERS (unsigned int)0x0040
|
||||||
|
# define ENGINE_METHOD_DIGESTS (unsigned int)0x0080
|
||||||
|
# define ENGINE_METHOD_PKEY_METHS (unsigned int)0x0200
|
||||||
|
# define ENGINE_METHOD_PKEY_ASN1_METHS (unsigned int)0x0400
|
||||||
|
# define ENGINE_METHOD_EC (unsigned int)0x0800
|
||||||
|
/* Obvious all-or-nothing cases. */
|
||||||
|
# define ENGINE_METHOD_ALL (unsigned int)0xFFFF
|
||||||
|
# define ENGINE_METHOD_NONE (unsigned int)0x0000
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This(ese) flag(s) controls behaviour of the ENGINE_TABLE mechanism used
|
||||||
|
* internally to control registration of ENGINE implementations, and can be
|
||||||
|
* set by ENGINE_set_table_flags(). The "NOINIT" flag prevents attempts to
|
||||||
|
* initialise registered ENGINEs if they are not already initialised.
|
||||||
|
*/
|
||||||
|
# define ENGINE_TABLE_FLAG_NOINIT (unsigned int)0x0001
|
||||||
|
|
||||||
|
/* ENGINE flags that can be set by ENGINE_set_flags(). */
|
||||||
|
/* Not used */
|
||||||
|
/* #define ENGINE_FLAGS_MALLOCED 0x0001 */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This flag is for ENGINEs that wish to handle the various 'CMD'-related
|
||||||
|
* control commands on their own. Without this flag, ENGINE_ctrl() handles
|
||||||
|
* these control commands on behalf of the ENGINE using their "cmd_defns"
|
||||||
|
* data.
|
||||||
|
*/
|
||||||
|
# define ENGINE_FLAGS_MANUAL_CMD_CTRL (int)0x0002
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This flag is for ENGINEs who return new duplicate structures when found
|
||||||
|
* via "ENGINE_by_id()". When an ENGINE must store state (eg. if
|
||||||
|
* ENGINE_ctrl() commands are called in sequence as part of some stateful
|
||||||
|
* process like key-generation setup and execution), it can set this flag -
|
||||||
|
* then each attempt to obtain the ENGINE will result in it being copied into
|
||||||
|
* a new structure. Normally, ENGINEs don't declare this flag so
|
||||||
|
* ENGINE_by_id() just increments the existing ENGINE's structural reference
|
||||||
|
* count.
|
||||||
|
*/
|
||||||
|
# define ENGINE_FLAGS_BY_ID_COPY (int)0x0004
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This flag is for an ENGINE that does not want its methods registered as
|
||||||
|
* part of ENGINE_register_all_complete() for example if the methods are not
|
||||||
|
* usable as default methods.
|
||||||
|
*/
|
||||||
|
|
||||||
|
# define ENGINE_FLAGS_NO_REGISTER_ALL (int)0x0008
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ENGINEs can support their own command types, and these flags are used in
|
||||||
|
* ENGINE_CTRL_GET_CMD_FLAGS to indicate to the caller what kind of input
|
||||||
|
* each command expects. Currently only numeric and string input is
|
||||||
|
* supported. If a control command supports none of the _NUMERIC, _STRING, or
|
||||||
|
* _NO_INPUT options, then it is regarded as an "internal" control command -
|
||||||
|
* and not for use in config setting situations. As such, they're not
|
||||||
|
* available to the ENGINE_ctrl_cmd_string() function, only raw ENGINE_ctrl()
|
||||||
|
* access. Changes to this list of 'command types' should be reflected
|
||||||
|
* carefully in ENGINE_cmd_is_executable() and ENGINE_ctrl_cmd_string().
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* accepts a 'long' input value (3rd parameter to ENGINE_ctrl) */
|
||||||
|
# define ENGINE_CMD_FLAG_NUMERIC (unsigned int)0x0001
|
||||||
|
/*
|
||||||
|
* accepts string input (cast from 'void*' to 'const char *', 4th parameter
|
||||||
|
* to ENGINE_ctrl)
|
||||||
|
*/
|
||||||
|
# define ENGINE_CMD_FLAG_STRING (unsigned int)0x0002
|
||||||
|
/*
|
||||||
|
* Indicates that the control command takes *no* input. Ie. the control
|
||||||
|
* command is unparameterised.
|
||||||
|
*/
|
||||||
|
# define ENGINE_CMD_FLAG_NO_INPUT (unsigned int)0x0004
|
||||||
|
/*
|
||||||
|
* Indicates that the control command is internal. This control command won't
|
||||||
|
* be shown in any output, and is only usable through the ENGINE_ctrl_cmd()
|
||||||
|
* function.
|
||||||
|
*/
|
||||||
|
# define ENGINE_CMD_FLAG_INTERNAL (unsigned int)0x0008
|
||||||
|
|
||||||
|
/*
|
||||||
|
* NB: These 3 control commands are deprecated and should not be used.
|
||||||
|
* ENGINEs relying on these commands should compile conditional support for
|
||||||
|
* compatibility (eg. if these symbols are defined) but should also migrate
|
||||||
|
* the same functionality to their own ENGINE-specific control functions that
|
||||||
|
* can be "discovered" by calling applications. The fact these control
|
||||||
|
* commands wouldn't be "executable" (ie. usable by text-based config)
|
||||||
|
* doesn't change the fact that application code can find and use them
|
||||||
|
* without requiring per-ENGINE hacking.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* These flags are used to tell the ctrl function what should be done. All
|
||||||
|
* command numbers are shared between all engines, even if some don't make
|
||||||
|
* sense to some engines. In such a case, they do nothing but return the
|
||||||
|
* error ENGINE_R_CTRL_COMMAND_NOT_IMPLEMENTED.
|
||||||
|
*/
|
||||||
|
# define ENGINE_CTRL_SET_LOGSTREAM 1
|
||||||
|
# define ENGINE_CTRL_SET_PASSWORD_CALLBACK 2
|
||||||
|
# define ENGINE_CTRL_HUP 3/* Close and reinitialise
|
||||||
|
* any handles/connections
|
||||||
|
* etc. */
|
||||||
|
# define ENGINE_CTRL_SET_USER_INTERFACE 4/* Alternative to callback */
|
||||||
|
# define ENGINE_CTRL_SET_CALLBACK_DATA 5/* User-specific data, used
|
||||||
|
* when calling the password
|
||||||
|
* callback and the user
|
||||||
|
* interface */
|
||||||
|
# define ENGINE_CTRL_LOAD_CONFIGURATION 6/* Load a configuration,
|
||||||
|
* given a string that
|
||||||
|
* represents a file name
|
||||||
|
* or so */
|
||||||
|
# define ENGINE_CTRL_LOAD_SECTION 7/* Load data from a given
|
||||||
|
* section in the already
|
||||||
|
* loaded configuration */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* These control commands allow an application to deal with an arbitrary
|
||||||
|
* engine in a dynamic way. Warn: Negative return values indicate errors FOR
|
||||||
|
* THESE COMMANDS because zero is used to indicate 'end-of-list'. Other
|
||||||
|
* commands, including ENGINE-specific command types, return zero for an
|
||||||
|
* error. An ENGINE can choose to implement these ctrl functions, and can
|
||||||
|
* internally manage things however it chooses - it does so by setting the
|
||||||
|
* ENGINE_FLAGS_MANUAL_CMD_CTRL flag (using ENGINE_set_flags()). Otherwise
|
||||||
|
* the ENGINE_ctrl() code handles this on the ENGINE's behalf using the
|
||||||
|
* cmd_defns data (set using ENGINE_set_cmd_defns()). This means an ENGINE's
|
||||||
|
* ctrl() handler need only implement its own commands - the above "meta"
|
||||||
|
* commands will be taken care of.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Returns non-zero if the supplied ENGINE has a ctrl() handler. If "not",
|
||||||
|
* then all the remaining control commands will return failure, so it is
|
||||||
|
* worth checking this first if the caller is trying to "discover" the
|
||||||
|
* engine's capabilities and doesn't want errors generated unnecessarily.
|
||||||
|
*/
|
||||||
|
# define ENGINE_CTRL_HAS_CTRL_FUNCTION 10
|
||||||
|
/*
|
||||||
|
* Returns a positive command number for the first command supported by the
|
||||||
|
* engine. Returns zero if no ctrl commands are supported.
|
||||||
|
*/
|
||||||
|
# define ENGINE_CTRL_GET_FIRST_CMD_TYPE 11
|
||||||
|
/*
|
||||||
|
* The 'long' argument specifies a command implemented by the engine, and the
|
||||||
|
* return value is the next command supported, or zero if there are no more.
|
||||||
|
*/
|
||||||
|
# define ENGINE_CTRL_GET_NEXT_CMD_TYPE 12
|
||||||
|
/*
|
||||||
|
* The 'void*' argument is a command name (cast from 'const char *'), and the
|
||||||
|
* return value is the command that corresponds to it.
|
||||||
|
*/
|
||||||
|
# define ENGINE_CTRL_GET_CMD_FROM_NAME 13
|
||||||
|
/*
|
||||||
|
* The next two allow a command to be converted into its corresponding string
|
||||||
|
* form. In each case, the 'long' argument supplies the command. In the
|
||||||
|
* NAME_LEN case, the return value is the length of the command name (not
|
||||||
|
* counting a trailing EOL). In the NAME case, the 'void*' argument must be a
|
||||||
|
* string buffer large enough, and it will be populated with the name of the
|
||||||
|
* command (WITH a trailing EOL).
|
||||||
|
*/
|
||||||
|
# define ENGINE_CTRL_GET_NAME_LEN_FROM_CMD 14
|
||||||
|
# define ENGINE_CTRL_GET_NAME_FROM_CMD 15
|
||||||
|
/* The next two are similar but give a "short description" of a command. */
|
||||||
|
# define ENGINE_CTRL_GET_DESC_LEN_FROM_CMD 16
|
||||||
|
# define ENGINE_CTRL_GET_DESC_FROM_CMD 17
|
||||||
|
/*
|
||||||
|
* With this command, the return value is the OR'd combination of
|
||||||
|
* ENGINE_CMD_FLAG_*** values that indicate what kind of input a given
|
||||||
|
* engine-specific ctrl command expects.
|
||||||
|
*/
|
||||||
|
# define ENGINE_CTRL_GET_CMD_FLAGS 18
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ENGINE implementations should start the numbering of their own control
|
||||||
|
* commands from this value. (ie. ENGINE_CMD_BASE, ENGINE_CMD_BASE + 1, etc).
|
||||||
|
*/
|
||||||
|
# define ENGINE_CMD_BASE 200
|
||||||
|
|
||||||
|
/*
|
||||||
|
* NB: These 2 nCipher "chil" control commands are deprecated, and their
|
||||||
|
* functionality is now available through ENGINE-specific control commands
|
||||||
|
* (exposed through the above-mentioned 'CMD'-handling). Code using these 2
|
||||||
|
* commands should be migrated to the more general command handling before
|
||||||
|
* these are removed.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Flags specific to the nCipher "chil" engine */
|
||||||
|
# define ENGINE_CTRL_CHIL_SET_FORKCHECK 100
|
||||||
|
/*
|
||||||
|
* Depending on the value of the (long)i argument, this sets or
|
||||||
|
* unsets the SimpleForkCheck flag in the CHIL API to enable or
|
||||||
|
* disable checking and workarounds for applications that fork().
|
||||||
|
*/
|
||||||
|
# define ENGINE_CTRL_CHIL_NO_LOCKING 101
|
||||||
|
/*
|
||||||
|
* This prevents the initialisation function from providing mutex
|
||||||
|
* callbacks to the nCipher library.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If an ENGINE supports its own specific control commands and wishes the
|
||||||
|
* framework to handle the above 'ENGINE_CMD_***'-manipulation commands on
|
||||||
|
* its behalf, it should supply a null-terminated array of ENGINE_CMD_DEFN
|
||||||
|
* entries to ENGINE_set_cmd_defns(). It should also implement a ctrl()
|
||||||
|
* handler that supports the stated commands (ie. the "cmd_num" entries as
|
||||||
|
* described by the array). NB: The array must be ordered in increasing order
|
||||||
|
* of cmd_num. "null-terminated" means that the last ENGINE_CMD_DEFN element
|
||||||
|
* has cmd_num set to zero and/or cmd_name set to NULL.
|
||||||
|
*/
|
||||||
|
typedef struct ENGINE_CMD_DEFN_st {
|
||||||
|
unsigned int cmd_num; /* The command number */
|
||||||
|
const char *cmd_name; /* The command name itself */
|
||||||
|
const char *cmd_desc; /* A short description of the command */
|
||||||
|
unsigned int cmd_flags; /* The input the command expects */
|
||||||
|
} ENGINE_CMD_DEFN;
|
||||||
|
|
||||||
|
/* Generic function pointer */
|
||||||
|
typedef int (*ENGINE_GEN_FUNC_PTR) (void);
|
||||||
|
/* Generic function pointer taking no arguments */
|
||||||
|
typedef int (*ENGINE_GEN_INT_FUNC_PTR) (ENGINE *);
|
||||||
|
/* Specific control function pointer */
|
||||||
|
typedef int (*ENGINE_CTRL_FUNC_PTR) (ENGINE *, int, long, void *,
|
||||||
|
void (*f) (void));
|
||||||
|
/* Generic load_key function pointer */
|
||||||
|
typedef EVP_PKEY *(*ENGINE_LOAD_KEY_PTR)(ENGINE *, const char *,
|
||||||
|
UI_METHOD *ui_method,
|
||||||
|
void *callback_data);
|
||||||
|
typedef int (*ENGINE_SSL_CLIENT_CERT_PTR) (ENGINE *, SSL *ssl,
|
||||||
|
STACK_OF(X509_NAME) *ca_dn,
|
||||||
|
X509 **pcert, EVP_PKEY **pkey,
|
||||||
|
STACK_OF(X509) **pother,
|
||||||
|
UI_METHOD *ui_method,
|
||||||
|
void *callback_data);
|
||||||
|
/*-
|
||||||
|
* These callback types are for an ENGINE's handler for cipher and digest logic.
|
||||||
|
* These handlers have these prototypes;
|
||||||
|
* int foo(ENGINE *e, const EVP_CIPHER **cipher, const int **nids, int nid);
|
||||||
|
* int foo(ENGINE *e, const EVP_MD **digest, const int **nids, int nid);
|
||||||
|
* Looking at how to implement these handlers in the case of cipher support, if
|
||||||
|
* the framework wants the EVP_CIPHER for 'nid', it will call;
|
||||||
|
* foo(e, &p_evp_cipher, NULL, nid); (return zero for failure)
|
||||||
|
* If the framework wants a list of supported 'nid's, it will call;
|
||||||
|
* foo(e, NULL, &p_nids, 0); (returns number of 'nids' or -1 for error)
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
* Returns to a pointer to the array of supported cipher 'nid's. If the
|
||||||
|
* second parameter is non-NULL it is set to the size of the returned array.
|
||||||
|
*/
|
||||||
|
typedef int (*ENGINE_CIPHERS_PTR) (ENGINE *, const EVP_CIPHER **,
|
||||||
|
const int **, int);
|
||||||
|
typedef int (*ENGINE_DIGESTS_PTR) (ENGINE *, const EVP_MD **, const int **,
|
||||||
|
int);
|
||||||
|
typedef int (*ENGINE_PKEY_METHS_PTR) (ENGINE *, EVP_PKEY_METHOD **,
|
||||||
|
const int **, int);
|
||||||
|
typedef int (*ENGINE_PKEY_ASN1_METHS_PTR) (ENGINE *, EVP_PKEY_ASN1_METHOD **,
|
||||||
|
const int **, int);
|
||||||
|
/*
|
||||||
|
* STRUCTURE functions ... all of these functions deal with pointers to
|
||||||
|
* ENGINE structures where the pointers have a "structural reference". This
|
||||||
|
* means that their reference is to allowed access to the structure but it
|
||||||
|
* does not imply that the structure is functional. To simply increment or
|
||||||
|
* decrement the structural reference count, use ENGINE_by_id and
|
||||||
|
* ENGINE_free. NB: This is not required when iterating using ENGINE_get_next
|
||||||
|
* as it will automatically decrement the structural reference count of the
|
||||||
|
* "current" ENGINE and increment the structural reference count of the
|
||||||
|
* ENGINE it returns (unless it is NULL).
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Get the first/last "ENGINE" type available. */
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
OSSL_DEPRECATEDIN_3_0 ENGINE *ENGINE_get_first(void);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 ENGINE *ENGINE_get_last(void);
|
||||||
|
# endif
|
||||||
|
/* Iterate to the next/previous "ENGINE" type (NULL = end of the list). */
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
OSSL_DEPRECATEDIN_3_0 ENGINE *ENGINE_get_next(ENGINE *e);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 ENGINE *ENGINE_get_prev(ENGINE *e);
|
||||||
|
# endif
|
||||||
|
/* Add another "ENGINE" type into the array. */
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int ENGINE_add(ENGINE *e);
|
||||||
|
# endif
|
||||||
|
/* Remove an existing "ENGINE" type from the array. */
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int ENGINE_remove(ENGINE *e);
|
||||||
|
# endif
|
||||||
|
/* Retrieve an engine from the list by its unique "id" value. */
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
OSSL_DEPRECATEDIN_3_0 ENGINE *ENGINE_by_id(const char *id);
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_1_1_0
|
||||||
|
# define ENGINE_load_openssl() \
|
||||||
|
OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_OPENSSL, NULL)
|
||||||
|
# define ENGINE_load_dynamic() \
|
||||||
|
OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_DYNAMIC, NULL)
|
||||||
|
# ifndef OPENSSL_NO_STATIC_ENGINE
|
||||||
|
# define ENGINE_load_padlock() \
|
||||||
|
OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_PADLOCK, NULL)
|
||||||
|
# define ENGINE_load_capi() \
|
||||||
|
OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_CAPI, NULL)
|
||||||
|
# define ENGINE_load_afalg() \
|
||||||
|
OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_AFALG, NULL)
|
||||||
|
# endif
|
||||||
|
# define ENGINE_load_cryptodev() \
|
||||||
|
OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_CRYPTODEV, NULL)
|
||||||
|
# define ENGINE_load_rdrand() \
|
||||||
|
OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_RDRAND, NULL)
|
||||||
|
# endif
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
OSSL_DEPRECATEDIN_3_0 void ENGINE_load_builtin_engines(void);
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Get and set global flags (ENGINE_TABLE_FLAG_***) for the implementation
|
||||||
|
* "registry" handling.
|
||||||
|
*/
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
OSSL_DEPRECATEDIN_3_0 unsigned int ENGINE_get_table_flags(void);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 void ENGINE_set_table_flags(unsigned int flags);
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/*- Manage registration of ENGINEs per "table". For each type, there are 3
|
||||||
|
* functions;
|
||||||
|
* ENGINE_register_***(e) - registers the implementation from 'e' (if it has one)
|
||||||
|
* ENGINE_unregister_***(e) - unregister the implementation from 'e'
|
||||||
|
* ENGINE_register_all_***() - call ENGINE_register_***() for each 'e' in the list
|
||||||
|
* Cleanup is automatically registered from each table when required.
|
||||||
|
*/
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int ENGINE_register_RSA(ENGINE *e);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 void ENGINE_unregister_RSA(ENGINE *e);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 void ENGINE_register_all_RSA(void);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int ENGINE_register_DSA(ENGINE *e);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 void ENGINE_unregister_DSA(ENGINE *e);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 void ENGINE_register_all_DSA(void);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int ENGINE_register_EC(ENGINE *e);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 void ENGINE_unregister_EC(ENGINE *e);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 void ENGINE_register_all_EC(void);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int ENGINE_register_DH(ENGINE *e);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 void ENGINE_unregister_DH(ENGINE *e);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 void ENGINE_register_all_DH(void);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int ENGINE_register_RAND(ENGINE *e);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 void ENGINE_unregister_RAND(ENGINE *e);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 void ENGINE_register_all_RAND(void);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int ENGINE_register_ciphers(ENGINE *e);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 void ENGINE_unregister_ciphers(ENGINE *e);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 void ENGINE_register_all_ciphers(void);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int ENGINE_register_digests(ENGINE *e);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 void ENGINE_unregister_digests(ENGINE *e);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 void ENGINE_register_all_digests(void);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int ENGINE_register_pkey_meths(ENGINE *e);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 void ENGINE_unregister_pkey_meths(ENGINE *e);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 void ENGINE_register_all_pkey_meths(void);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int ENGINE_register_pkey_asn1_meths(ENGINE *e);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 void ENGINE_unregister_pkey_asn1_meths(ENGINE *e);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 void ENGINE_register_all_pkey_asn1_meths(void);
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* These functions register all support from the above categories. Note, use
|
||||||
|
* of these functions can result in static linkage of code your application
|
||||||
|
* may not need. If you only need a subset of functionality, consider using
|
||||||
|
* more selective initialisation.
|
||||||
|
*/
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int ENGINE_register_complete(ENGINE *e);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int ENGINE_register_all_complete(void);
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Send parameterised control commands to the engine. The possibilities to
|
||||||
|
* send down an integer, a pointer to data or a function pointer are
|
||||||
|
* provided. Any of the parameters may or may not be NULL, depending on the
|
||||||
|
* command number. In actuality, this function only requires a structural
|
||||||
|
* (rather than functional) reference to an engine, but many control commands
|
||||||
|
* may require the engine be functional. The caller should be aware of trying
|
||||||
|
* commands that require an operational ENGINE, and only use functional
|
||||||
|
* references in such situations.
|
||||||
|
*/
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int ENGINE_ctrl(ENGINE *e, int cmd, long i, void *p,
|
||||||
|
void (*f) (void));
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This function tests if an ENGINE-specific command is usable as a
|
||||||
|
* "setting". Eg. in an application's config file that gets processed through
|
||||||
|
* ENGINE_ctrl_cmd_string(). If this returns zero, it is not available to
|
||||||
|
* ENGINE_ctrl_cmd_string(), only ENGINE_ctrl().
|
||||||
|
*/
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int ENGINE_cmd_is_executable(ENGINE *e, int cmd);
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This function works like ENGINE_ctrl() with the exception of taking a
|
||||||
|
* command name instead of a command number, and can handle optional
|
||||||
|
* commands. See the comment on ENGINE_ctrl_cmd_string() for an explanation
|
||||||
|
* on how to use the cmd_name and cmd_optional.
|
||||||
|
*/
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int ENGINE_ctrl_cmd(ENGINE *e, const char *cmd_name,
|
||||||
|
long i, void *p, void (*f) (void),
|
||||||
|
int cmd_optional);
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This function passes a command-name and argument to an ENGINE. The
|
||||||
|
* cmd_name is converted to a command number and the control command is
|
||||||
|
* called using 'arg' as an argument (unless the ENGINE doesn't support such
|
||||||
|
* a command, in which case no control command is called). The command is
|
||||||
|
* checked for input flags, and if necessary the argument will be converted
|
||||||
|
* to a numeric value. If cmd_optional is non-zero, then if the ENGINE
|
||||||
|
* doesn't support the given cmd_name the return value will be success
|
||||||
|
* anyway. This function is intended for applications to use so that users
|
||||||
|
* (or config files) can supply engine-specific config data to the ENGINE at
|
||||||
|
* run-time to control behaviour of specific engines. As such, it shouldn't
|
||||||
|
* be used for calling ENGINE_ctrl() functions that return data, deal with
|
||||||
|
* binary data, or that are otherwise supposed to be used directly through
|
||||||
|
* ENGINE_ctrl() in application code. Any "return" data from an ENGINE_ctrl()
|
||||||
|
* operation in this function will be lost - the return value is interpreted
|
||||||
|
* as failure if the return value is zero, success otherwise, and this
|
||||||
|
* function returns a boolean value as a result. In other words, vendors of
|
||||||
|
* 'ENGINE'-enabled devices should write ENGINE implementations with
|
||||||
|
* parameterisations that work in this scheme, so that compliant ENGINE-based
|
||||||
|
* applications can work consistently with the same configuration for the
|
||||||
|
* same ENGINE-enabled devices, across applications.
|
||||||
|
*/
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
int ENGINE_ctrl_cmd_string(ENGINE *e, const char *cmd_name, const char *arg,
|
||||||
|
int cmd_optional);
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* These functions are useful for manufacturing new ENGINE structures. They
|
||||||
|
* don't address reference counting at all - one uses them to populate an
|
||||||
|
* ENGINE structure with personalised implementations of things prior to
|
||||||
|
* using it directly or adding it to the builtin ENGINE list in OpenSSL.
|
||||||
|
* These are also here so that the ENGINE structure doesn't have to be
|
||||||
|
* exposed and break binary compatibility!
|
||||||
|
*/
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
OSSL_DEPRECATEDIN_3_0 ENGINE *ENGINE_new(void);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int ENGINE_free(ENGINE *e);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int ENGINE_up_ref(ENGINE *e);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int ENGINE_set_id(ENGINE *e, const char *id);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int ENGINE_set_name(ENGINE *e, const char *name);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int ENGINE_set_RSA(ENGINE *e, const RSA_METHOD *rsa_meth);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int ENGINE_set_DSA(ENGINE *e, const DSA_METHOD *dsa_meth);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int ENGINE_set_EC(ENGINE *e, const EC_KEY_METHOD *ecdsa_meth);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int ENGINE_set_DH(ENGINE *e, const DH_METHOD *dh_meth);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int ENGINE_set_RAND(ENGINE *e, const RAND_METHOD *rand_meth);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
int ENGINE_set_destroy_function(ENGINE *e,ENGINE_GEN_INT_FUNC_PTR destroy_f);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
int ENGINE_set_init_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR init_f);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
int ENGINE_set_finish_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR finish_f);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
int ENGINE_set_ctrl_function(ENGINE *e, ENGINE_CTRL_FUNC_PTR ctrl_f);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
int ENGINE_set_load_privkey_function(ENGINE *e, ENGINE_LOAD_KEY_PTR loadpriv_f);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
int ENGINE_set_load_pubkey_function(ENGINE *e, ENGINE_LOAD_KEY_PTR loadpub_f);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
int ENGINE_set_load_ssl_client_cert_function(ENGINE *e,
|
||||||
|
ENGINE_SSL_CLIENT_CERT_PTR loadssl_f);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
int ENGINE_set_ciphers(ENGINE *e, ENGINE_CIPHERS_PTR f);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
int ENGINE_set_digests(ENGINE *e, ENGINE_DIGESTS_PTR f);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
int ENGINE_set_pkey_meths(ENGINE *e, ENGINE_PKEY_METHS_PTR f);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
int ENGINE_set_pkey_asn1_meths(ENGINE *e, ENGINE_PKEY_ASN1_METHS_PTR f);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int ENGINE_set_flags(ENGINE *e, int flags);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int ENGINE_set_cmd_defns(ENGINE *e,
|
||||||
|
const ENGINE_CMD_DEFN *defns);
|
||||||
|
# endif
|
||||||
|
/* These functions allow control over any per-structure ENGINE data. */
|
||||||
|
# define ENGINE_get_ex_new_index(l, p, newf, dupf, freef) \
|
||||||
|
CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_ENGINE, l, p, newf, dupf, freef)
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int ENGINE_set_ex_data(ENGINE *e, int idx, void *arg);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 void *ENGINE_get_ex_data(const ENGINE *e, int idx);
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_1_1_0
|
||||||
|
/*
|
||||||
|
* This function previously cleaned up anything that needs it. Auto-deinit will
|
||||||
|
* now take care of it so it is no longer required to call this function.
|
||||||
|
*/
|
||||||
|
# define ENGINE_cleanup() while(0) continue
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* These return values from within the ENGINE structure. These can be useful
|
||||||
|
* with functional references as well as structural references - it depends
|
||||||
|
* which you obtained. Using the result for functional purposes if you only
|
||||||
|
* obtained a structural reference may be problematic!
|
||||||
|
*/
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
OSSL_DEPRECATEDIN_3_0 const char *ENGINE_get_id(const ENGINE *e);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 const char *ENGINE_get_name(const ENGINE *e);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 const RSA_METHOD *ENGINE_get_RSA(const ENGINE *e);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 const DSA_METHOD *ENGINE_get_DSA(const ENGINE *e);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 const EC_KEY_METHOD *ENGINE_get_EC(const ENGINE *e);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 const DH_METHOD *ENGINE_get_DH(const ENGINE *e);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 const RAND_METHOD *ENGINE_get_RAND(const ENGINE *e);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
ENGINE_GEN_INT_FUNC_PTR ENGINE_get_destroy_function(const ENGINE *e);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
ENGINE_GEN_INT_FUNC_PTR ENGINE_get_init_function(const ENGINE *e);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
ENGINE_GEN_INT_FUNC_PTR ENGINE_get_finish_function(const ENGINE *e);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
ENGINE_CTRL_FUNC_PTR ENGINE_get_ctrl_function(const ENGINE *e);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
ENGINE_LOAD_KEY_PTR ENGINE_get_load_privkey_function(const ENGINE *e);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
ENGINE_LOAD_KEY_PTR ENGINE_get_load_pubkey_function(const ENGINE *e);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
ENGINE_SSL_CLIENT_CERT_PTR ENGINE_get_ssl_client_cert_function(const ENGINE *e);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
ENGINE_CIPHERS_PTR ENGINE_get_ciphers(const ENGINE *e);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
ENGINE_DIGESTS_PTR ENGINE_get_digests(const ENGINE *e);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
ENGINE_PKEY_METHS_PTR ENGINE_get_pkey_meths(const ENGINE *e);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
ENGINE_PKEY_ASN1_METHS_PTR ENGINE_get_pkey_asn1_meths(const ENGINE *e);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
const EVP_CIPHER *ENGINE_get_cipher(ENGINE *e, int nid);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
const EVP_MD *ENGINE_get_digest(ENGINE *e, int nid);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
const EVP_PKEY_METHOD *ENGINE_get_pkey_meth(ENGINE *e, int nid);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
const EVP_PKEY_ASN1_METHOD *ENGINE_get_pkey_asn1_meth(ENGINE *e, int nid);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
const EVP_PKEY_ASN1_METHOD *ENGINE_get_pkey_asn1_meth_str(ENGINE *e,
|
||||||
|
const char *str,
|
||||||
|
int len);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
const EVP_PKEY_ASN1_METHOD *ENGINE_pkey_asn1_find_str(ENGINE **pe,
|
||||||
|
const char *str, int len);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
const ENGINE_CMD_DEFN *ENGINE_get_cmd_defns(const ENGINE *e);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int ENGINE_get_flags(const ENGINE *e);
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* FUNCTIONAL functions. These functions deal with ENGINE structures that
|
||||||
|
* have (or will) be initialised for use. Broadly speaking, the structural
|
||||||
|
* functions are useful for iterating the list of available engine types,
|
||||||
|
* creating new engine types, and other "list" operations. These functions
|
||||||
|
* actually deal with ENGINEs that are to be used. As such these functions
|
||||||
|
* can fail (if applicable) when particular engines are unavailable - eg. if
|
||||||
|
* a hardware accelerator is not attached or not functioning correctly. Each
|
||||||
|
* ENGINE has 2 reference counts; structural and functional. Every time a
|
||||||
|
* functional reference is obtained or released, a corresponding structural
|
||||||
|
* reference is automatically obtained or released too.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Initialise an engine type for use (or up its reference count if it's
|
||||||
|
* already in use). This will fail if the engine is not currently operational
|
||||||
|
* and cannot initialise.
|
||||||
|
*/
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int ENGINE_init(ENGINE *e);
|
||||||
|
# endif
|
||||||
|
/*
|
||||||
|
* Free a functional reference to an engine type. This does not require a
|
||||||
|
* corresponding call to ENGINE_free as it also releases a structural
|
||||||
|
* reference.
|
||||||
|
*/
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int ENGINE_finish(ENGINE *e);
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The following functions handle keys that are stored in some secondary
|
||||||
|
* location, handled by the engine. The storage may be on a card or
|
||||||
|
* whatever.
|
||||||
|
*/
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
EVP_PKEY *ENGINE_load_private_key(ENGINE *e, const char *key_id,
|
||||||
|
UI_METHOD *ui_method, void *callback_data);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
EVP_PKEY *ENGINE_load_public_key(ENGINE *e, const char *key_id,
|
||||||
|
UI_METHOD *ui_method, void *callback_data);
|
||||||
|
OSSL_DEPRECATEDIN_3_0
|
||||||
|
int ENGINE_load_ssl_client_cert(ENGINE *e, SSL *s, STACK_OF(X509_NAME) *ca_dn,
|
||||||
|
X509 **pcert, EVP_PKEY **ppkey,
|
||||||
|
STACK_OF(X509) **pother,
|
||||||
|
UI_METHOD *ui_method, void *callback_data);
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This returns a pointer for the current ENGINE structure that is (by
|
||||||
|
* default) performing any RSA operations. The value returned is an
|
||||||
|
* incremented reference, so it should be free'd (ENGINE_finish) before it is
|
||||||
|
* discarded.
|
||||||
|
*/
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
OSSL_DEPRECATEDIN_3_0 ENGINE *ENGINE_get_default_RSA(void);
|
||||||
|
# endif
|
||||||
|
/* Same for the other "methods" */
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
OSSL_DEPRECATEDIN_3_0 ENGINE *ENGINE_get_default_DSA(void);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 ENGINE *ENGINE_get_default_EC(void);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 ENGINE *ENGINE_get_default_DH(void);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 ENGINE *ENGINE_get_default_RAND(void);
|
||||||
|
# endif
|
||||||
|
/*
|
||||||
|
* These functions can be used to get a functional reference to perform
|
||||||
|
* ciphering or digesting corresponding to "nid".
|
||||||
|
*/
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
OSSL_DEPRECATEDIN_3_0 ENGINE *ENGINE_get_cipher_engine(int nid);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 ENGINE *ENGINE_get_digest_engine(int nid);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 ENGINE *ENGINE_get_pkey_meth_engine(int nid);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 ENGINE *ENGINE_get_pkey_asn1_meth_engine(int nid);
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This sets a new default ENGINE structure for performing RSA operations. If
|
||||||
|
* the result is non-zero (success) then the ENGINE structure will have had
|
||||||
|
* its reference count up'd so the caller should still free their own
|
||||||
|
* reference 'e'.
|
||||||
|
*/
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int ENGINE_set_default_RSA(ENGINE *e);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int ENGINE_set_default_string(ENGINE *e,
|
||||||
|
const char *def_list);
|
||||||
|
# endif
|
||||||
|
/* Same for the other "methods" */
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int ENGINE_set_default_DSA(ENGINE *e);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int ENGINE_set_default_EC(ENGINE *e);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int ENGINE_set_default_DH(ENGINE *e);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int ENGINE_set_default_RAND(ENGINE *e);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int ENGINE_set_default_ciphers(ENGINE *e);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int ENGINE_set_default_digests(ENGINE *e);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int ENGINE_set_default_pkey_meths(ENGINE *e);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int ENGINE_set_default_pkey_asn1_meths(ENGINE *e);
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The combination "set" - the flags are bitwise "OR"d from the
|
||||||
|
* ENGINE_METHOD_*** defines above. As with the "ENGINE_register_complete()"
|
||||||
|
* function, this function can result in unnecessary static linkage. If your
|
||||||
|
* application requires only specific functionality, consider using more
|
||||||
|
* selective functions.
|
||||||
|
*/
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||||
|
OSSL_DEPRECATEDIN_3_0 int ENGINE_set_default(ENGINE *e, unsigned int flags);
|
||||||
|
OSSL_DEPRECATEDIN_3_0 void ENGINE_add_conf_module(void);
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/* Deprecated functions ... */
|
||||||
|
/* int ENGINE_clear_defaults(void); */
|
||||||
|
|
||||||
|
/**************************/
|
||||||
|
/* DYNAMIC ENGINE SUPPORT */
|
||||||
|
/**************************/
|
||||||
|
|
||||||
|
/* Binary/behaviour compatibility levels */
|
||||||
|
# define OSSL_DYNAMIC_VERSION (unsigned long)0x00030000
|
||||||
|
/*
|
||||||
|
* Binary versions older than this are too old for us (whether we're a loader
|
||||||
|
* or a loadee)
|
||||||
|
*/
|
||||||
|
# define OSSL_DYNAMIC_OLDEST (unsigned long)0x00030000
|
||||||
|
|
||||||
|
/*
|
||||||
|
* When compiling an ENGINE entirely as an external shared library, loadable
|
||||||
|
* by the "dynamic" ENGINE, these types are needed. The 'dynamic_fns'
|
||||||
|
* structure type provides the calling application's (or library's) error
|
||||||
|
* functionality and memory management function pointers to the loaded
|
||||||
|
* library. These should be used/set in the loaded library code so that the
|
||||||
|
* loading application's 'state' will be used/changed in all operations. The
|
||||||
|
* 'static_state' pointer allows the loaded library to know if it shares the
|
||||||
|
* same static data as the calling application (or library), and thus whether
|
||||||
|
* these callbacks need to be set or not.
|
||||||
|
*/
|
||||||
|
typedef void *(*dyn_MEM_malloc_fn) (size_t, const char *, int);
|
||||||
|
typedef void *(*dyn_MEM_realloc_fn) (void *, size_t, const char *, int);
|
||||||
|
typedef void (*dyn_MEM_free_fn) (void *, const char *, int);
|
||||||
|
typedef struct st_dynamic_MEM_fns {
|
||||||
|
dyn_MEM_malloc_fn malloc_fn;
|
||||||
|
dyn_MEM_realloc_fn realloc_fn;
|
||||||
|
dyn_MEM_free_fn free_fn;
|
||||||
|
} dynamic_MEM_fns;
|
||||||
|
/*
|
||||||
|
* FIXME: Perhaps the memory and locking code (crypto.h) should declare and
|
||||||
|
* use these types so we (and any other dependent code) can simplify a bit??
|
||||||
|
*/
|
||||||
|
/* The top-level structure */
|
||||||
|
typedef struct st_dynamic_fns {
|
||||||
|
void *static_state;
|
||||||
|
dynamic_MEM_fns mem_fns;
|
||||||
|
} dynamic_fns;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The version checking function should be of this prototype. NB: The
|
||||||
|
* ossl_version value passed in is the OSSL_DYNAMIC_VERSION of the loading
|
||||||
|
* code. If this function returns zero, it indicates a (potential) version
|
||||||
|
* incompatibility and the loaded library doesn't believe it can proceed.
|
||||||
|
* Otherwise, the returned value is the (latest) version supported by the
|
||||||
|
* loading library. The loader may still decide that the loaded code's
|
||||||
|
* version is unsatisfactory and could veto the load. The function is
|
||||||
|
* expected to be implemented with the symbol name "v_check", and a default
|
||||||
|
* implementation can be fully instantiated with
|
||||||
|
* IMPLEMENT_DYNAMIC_CHECK_FN().
|
||||||
|
*/
|
||||||
|
typedef unsigned long (*dynamic_v_check_fn) (unsigned long ossl_version);
|
||||||
|
# define IMPLEMENT_DYNAMIC_CHECK_FN() \
|
||||||
|
OPENSSL_EXPORT unsigned long v_check(unsigned long v); \
|
||||||
|
OPENSSL_EXPORT unsigned long v_check(unsigned long v) { \
|
||||||
|
if (v >= OSSL_DYNAMIC_OLDEST) return OSSL_DYNAMIC_VERSION; \
|
||||||
|
return 0; }
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This function is passed the ENGINE structure to initialise with its own
|
||||||
|
* function and command settings. It should not adjust the structural or
|
||||||
|
* functional reference counts. If this function returns zero, (a) the load
|
||||||
|
* will be aborted, (b) the previous ENGINE state will be memcpy'd back onto
|
||||||
|
* the structure, and (c) the shared library will be unloaded. So
|
||||||
|
* implementations should do their own internal cleanup in failure
|
||||||
|
* circumstances otherwise they could leak. The 'id' parameter, if non-NULL,
|
||||||
|
* represents the ENGINE id that the loader is looking for. If this is NULL,
|
||||||
|
* the shared library can choose to return failure or to initialise a
|
||||||
|
* 'default' ENGINE. If non-NULL, the shared library must initialise only an
|
||||||
|
* ENGINE matching the passed 'id'. The function is expected to be
|
||||||
|
* implemented with the symbol name "bind_engine". A standard implementation
|
||||||
|
* can be instantiated with IMPLEMENT_DYNAMIC_BIND_FN(fn) where the parameter
|
||||||
|
* 'fn' is a callback function that populates the ENGINE structure and
|
||||||
|
* returns an int value (zero for failure). 'fn' should have prototype;
|
||||||
|
* [static] int fn(ENGINE *e, const char *id);
|
||||||
|
*/
|
||||||
|
typedef int (*dynamic_bind_engine) (ENGINE *e, const char *id,
|
||||||
|
const dynamic_fns *fns);
|
||||||
|
# define IMPLEMENT_DYNAMIC_BIND_FN(fn) \
|
||||||
|
OPENSSL_EXPORT \
|
||||||
|
int bind_engine(ENGINE *e, const char *id, const dynamic_fns *fns); \
|
||||||
|
OPENSSL_EXPORT \
|
||||||
|
int bind_engine(ENGINE *e, const char *id, const dynamic_fns *fns) { \
|
||||||
|
if (ENGINE_get_static_state() == fns->static_state) goto skip_cbs; \
|
||||||
|
CRYPTO_set_mem_functions(fns->mem_fns.malloc_fn, \
|
||||||
|
fns->mem_fns.realloc_fn, \
|
||||||
|
fns->mem_fns.free_fn); \
|
||||||
|
OPENSSL_init_crypto(OPENSSL_INIT_NO_ATEXIT, NULL); \
|
||||||
|
skip_cbs: \
|
||||||
|
if (!fn(e, id)) return 0; \
|
||||||
|
return 1; }
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If the loading application (or library) and the loaded ENGINE library
|
||||||
|
* share the same static data (eg. they're both dynamically linked to the
|
||||||
|
* same libcrypto.so) we need a way to avoid trying to set system callbacks -
|
||||||
|
* this would fail, and for the same reason that it's unnecessary to try. If
|
||||||
|
* the loaded ENGINE has (or gets from through the loader) its own copy of
|
||||||
|
* the libcrypto static data, we will need to set the callbacks. The easiest
|
||||||
|
* way to detect this is to have a function that returns a pointer to some
|
||||||
|
* static data and let the loading application and loaded ENGINE compare
|
||||||
|
* their respective values.
|
||||||
|
*/
|
||||||
|
void *ENGINE_get_static_state(void);
|
||||||
|
|
||||||
|
# if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__DragonFly__)
|
||||||
|
# ifndef OPENSSL_NO_DEPRECATED_1_1_0
|
||||||
|
OSSL_DEPRECATEDIN_1_1_0 void ENGINE_setup_bsd_cryptodev(void);
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
# endif /* OPENSSL_NO_ENGINE */
|
||||||
|
#endif /* OPENSSL_ENGINE_H */
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
/*
|
||||||
|
* Generated by util/mkerr.pl DO NOT EDIT
|
||||||
|
* Copyright 1995-2021 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef OPENSSL_ENGINEERR_H
|
||||||
|
# define OPENSSL_ENGINEERR_H
|
||||||
|
# pragma once
|
||||||
|
|
||||||
|
# include <openssl/opensslconf.h>
|
||||||
|
# include <openssl/symhacks.h>
|
||||||
|
# include <openssl/cryptoerr_legacy.h>
|
||||||
|
|
||||||
|
|
||||||
|
# ifndef OPENSSL_NO_ENGINE
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ENGINE reason codes.
|
||||||
|
*/
|
||||||
|
# define ENGINE_R_ALREADY_LOADED 100
|
||||||
|
# define ENGINE_R_ARGUMENT_IS_NOT_A_NUMBER 133
|
||||||
|
# define ENGINE_R_CMD_NOT_EXECUTABLE 134
|
||||||
|
# define ENGINE_R_COMMAND_TAKES_INPUT 135
|
||||||
|
# define ENGINE_R_COMMAND_TAKES_NO_INPUT 136
|
||||||
|
# define ENGINE_R_CONFLICTING_ENGINE_ID 103
|
||||||
|
# define ENGINE_R_CTRL_COMMAND_NOT_IMPLEMENTED 119
|
||||||
|
# define ENGINE_R_DSO_FAILURE 104
|
||||||
|
# define ENGINE_R_DSO_NOT_FOUND 132
|
||||||
|
# define ENGINE_R_ENGINES_SECTION_ERROR 148
|
||||||
|
# define ENGINE_R_ENGINE_CONFIGURATION_ERROR 102
|
||||||
|
# define ENGINE_R_ENGINE_IS_NOT_IN_LIST 105
|
||||||
|
# define ENGINE_R_ENGINE_SECTION_ERROR 149
|
||||||
|
# define ENGINE_R_FAILED_LOADING_PRIVATE_KEY 128
|
||||||
|
# define ENGINE_R_FAILED_LOADING_PUBLIC_KEY 129
|
||||||
|
# define ENGINE_R_FINISH_FAILED 106
|
||||||
|
# define ENGINE_R_ID_OR_NAME_MISSING 108
|
||||||
|
# define ENGINE_R_INIT_FAILED 109
|
||||||
|
# define ENGINE_R_INTERNAL_LIST_ERROR 110
|
||||||
|
# define ENGINE_R_INVALID_ARGUMENT 143
|
||||||
|
# define ENGINE_R_INVALID_CMD_NAME 137
|
||||||
|
# define ENGINE_R_INVALID_CMD_NUMBER 138
|
||||||
|
# define ENGINE_R_INVALID_INIT_VALUE 151
|
||||||
|
# define ENGINE_R_INVALID_STRING 150
|
||||||
|
# define ENGINE_R_NOT_INITIALISED 117
|
||||||
|
# define ENGINE_R_NOT_LOADED 112
|
||||||
|
# define ENGINE_R_NO_CONTROL_FUNCTION 120
|
||||||
|
# define ENGINE_R_NO_INDEX 144
|
||||||
|
# define ENGINE_R_NO_LOAD_FUNCTION 125
|
||||||
|
# define ENGINE_R_NO_REFERENCE 130
|
||||||
|
# define ENGINE_R_NO_SUCH_ENGINE 116
|
||||||
|
# define ENGINE_R_UNIMPLEMENTED_CIPHER 146
|
||||||
|
# define ENGINE_R_UNIMPLEMENTED_DIGEST 147
|
||||||
|
# define ENGINE_R_UNIMPLEMENTED_PUBLIC_KEY_METHOD 101
|
||||||
|
# define ENGINE_R_VERSION_INCOMPATIBILITY 145
|
||||||
|
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
Loaded 100 of 1134 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user