Compare commits
356 commits
Author | SHA1 | Date | |
---|---|---|---|
|
b849e23536 | ||
|
0ab4e2f750 | ||
|
2316a45a45 | ||
|
0a6c22a9b8 | ||
|
8adf064a04 | ||
|
7fe00f4247 | ||
|
5eae02068d | ||
|
5d429cedbb | ||
|
3c85322067 | ||
|
9fb902bdf6 | ||
|
262cb7a4b5 | ||
|
104fade420 | ||
|
bcf8c30ce0 | ||
|
c2413fca4d | ||
|
5028aca372 | ||
|
311f9c5c2a | ||
|
32ca1a09da | ||
|
bba1324145 | ||
|
ff655292fb | ||
|
2558bd1b9b | ||
|
95d0944b9f | ||
|
68ac884d47 | ||
|
e2f3996843 | ||
|
57ade250af | ||
|
c3e0f262d1 | ||
|
b9911d0db7 | ||
|
d1b780c7be | ||
|
1711cced3e | ||
|
63e6693255 | ||
|
9b8d191bb1 | ||
|
6db2b8c66d | ||
|
47a08ccbd4 | ||
|
7fc78129f4 | ||
|
c4504fd3ff | ||
|
e4799ff8c4 | ||
|
f680924585 | ||
|
b0d222768a | ||
|
4303c43db7 | ||
|
3b3e6d2bfc | ||
|
7061f13b24 | ||
|
5175636d36 | ||
|
570032484f | ||
|
9c37fc1a5f | ||
|
105023bd87 | ||
|
8a9669f130 | ||
|
e5bd230fb0 | ||
|
e3d47e588a | ||
|
f4a5abeed9 | ||
|
a7e38d2b00 | ||
|
84ba396ed3 | ||
|
6683280a37 | ||
|
1edf680464 | ||
|
4df090469a | ||
|
3c63f58532 | ||
|
64c8171e13 | ||
|
b6175bd408 | ||
|
b44bd19c53 | ||
|
536bc59abb | ||
|
70d5da1e2a | ||
|
90d4d79828 | ||
|
ccc9be2d4d | ||
|
3341c4a670 | ||
|
bcb9df9cdf | ||
|
2eef9d22e6 | ||
|
5e35346f17 | ||
|
bb53ee9567 | ||
|
9934a856dd | ||
|
24904c5083 | ||
|
6ce4663a31 | ||
|
fbf74d3baa | ||
|
b540181990 | ||
|
02a6b15e6b | ||
|
b34aa10bf8 | ||
|
e0ddbc2f28 | ||
|
ed2024285d | ||
|
ae2120eb96 | ||
|
3ceb2257e5 | ||
|
624efde7e4 | ||
|
50009fef6f | ||
|
dde937e197 | ||
|
07a480b37a | ||
|
9f5bccec30 | ||
|
ade52bf81e | ||
|
71c766a3b2 | ||
|
eef66aee9a | ||
|
e245eb1eb5 | ||
|
e08fc81397 | ||
|
9f9032ae36 | ||
|
063a16fcd6 | ||
|
0db4151492 | ||
|
e44d7a553f | ||
|
53a2de98de | ||
|
2deaaeef28 | ||
|
1f9e16f63e | ||
|
87fe69c27c | ||
|
2d1eeda188 | ||
|
5c06d40358 | ||
|
31e193756d | ||
|
5aa744db84 | ||
|
0ad82dad80 | ||
|
99c36ed2f2 | ||
|
44878e583a | ||
|
0723a85ab3 | ||
|
d8dae365f6 | ||
|
bccb86a401 | ||
|
592e743349 | ||
|
fb6161e9ac | ||
|
787277d282 | ||
|
540ee69773 | ||
|
0d2c87fe4e | ||
|
2460de9713 | ||
|
0d32f42d26 | ||
|
277497684e | ||
|
f4a83e516c | ||
|
d2eb1ed9a5 | ||
|
a3ec5846df | ||
|
b6047899a8 | ||
|
3516070b6e | ||
|
56ec87e00e | ||
|
fe0b896665 | ||
|
e4721417e6 | ||
|
45f5b3b648 | ||
|
3123102211 | ||
|
c6141ffbc7 | ||
|
c0e92d06a5 | ||
|
274b2682d6 | ||
|
171d661b84 | ||
|
5cea8da664 | ||
|
44dd52d08f | ||
|
70648d006d | ||
|
43e6a9e9ee | ||
|
0599c1710b | ||
|
abf218a9cd | ||
|
55f4f9aaeb | ||
|
82b7e1dbcb | ||
|
e8f8b0f8e5 | ||
|
7566d4fbab | ||
|
3a0d385119 | ||
|
a465afa83d | ||
|
185e90c40f | ||
|
e29c2d0260 | ||
|
acf6425ae9 | ||
|
5e8d49de0f | ||
|
1f9456a462 | ||
|
a7d8285c3a | ||
|
5f1dc4b851 | ||
|
b1c22949c5 | ||
|
29be175743 | ||
|
b6c5ba264b | ||
|
8e7e3c2b11 | ||
|
0e7df129d8 | ||
|
50709cbd21 | ||
|
fd6e8d8c5c | ||
|
2e7496130c | ||
|
9666ab5797 | ||
|
4c08ac7873 | ||
|
5435ec7545 | ||
|
8764d50179 | ||
|
62cdb8dc94 | ||
|
9918a1092f | ||
|
7d89511fda | ||
|
795b6d13d1 | ||
|
8328b6f657 | ||
|
9994e591bd | ||
|
b27a38e55e | ||
|
f6d747a5a0 | ||
|
b7da7574d1 | ||
|
dbad9585cd | ||
|
2d7a97bb94 | ||
|
da19da0360 | ||
|
ee7361ee2e | ||
|
6e3e09bed4 | ||
|
86762d2b40 | ||
|
ef12c5af99 | ||
|
933404b1dd | ||
|
ccec49e444 | ||
|
e5f1bf81f7 | ||
|
0e627f4f68 | ||
|
d33f7d2bf5 | ||
|
e07a019615 | ||
|
34ca3012e6 | ||
|
62634ca2da | ||
|
846c96e8d5 | ||
|
63775723c1 | ||
|
2f7d3e655a | ||
|
b19634d7e4 | ||
|
a92967a7c1 | ||
|
8915b88de5 | ||
|
7bca81464b | ||
|
b974ece24f | ||
|
b1c8e6ad59 | ||
|
64f7185e3a | ||
|
807cc9afc3 | ||
|
0adf306dd4 | ||
|
db0f602e86 | ||
|
17ec47f5c0 | ||
|
cf831d9cd3 | ||
|
5e3c633f74 | ||
|
4e4b27b6ab | ||
|
c0c9590904 | ||
|
24c9577e39 | ||
|
59ee0cfe88 | ||
|
1977b9b764 | ||
|
6f9d1fc14c | ||
|
8ac59ae2be | ||
|
46db37e06c | ||
|
9d1207b339 | ||
|
6e730cfad1 | ||
|
199b3345a0 | ||
|
b7f504b8a4 | ||
|
1b459b0560 | ||
|
40803a4dc1 | ||
|
6f22570648 | ||
|
8203547cfc | ||
|
dad160209e | ||
|
8faaaec710 | ||
|
012fba617d | ||
|
9ca495229b | ||
|
e63f624d3a | ||
|
e1dd413266 | ||
|
b9ef09dd58 | ||
|
990333e7ec | ||
|
ec9582f3f2 | ||
|
ea65386e15 | ||
|
a0fd4ad23f | ||
|
b6d7a95028 | ||
|
1d8f3cee62 | ||
|
5ba6e21967 | ||
|
52f7f6e6cf | ||
|
9fd5ec673b | ||
|
e905b3c963 | ||
|
f12370c348 | ||
|
b727e2a67a | ||
|
8e87319925 | ||
|
1ab29b1ab0 | ||
|
52d55e34e6 | ||
|
c79360f58b | ||
|
8057c826bc | ||
|
6f6138c500 | ||
|
903a18db1d | ||
|
0731f3f1a9 | ||
|
37047a39f9 | ||
|
91d0cbe892 | ||
|
b66431bc29 | ||
|
0e18b14087 | ||
|
31bd413166 | ||
|
95a6fce2b4 | ||
|
0b5472f9fb | ||
|
5280d28505 | ||
|
67a9898a99 | ||
|
fe8815f80f | ||
|
3a21fdc304 | ||
|
83d723eb79 | ||
|
6e771607c0 | ||
|
e73b220104 | ||
|
5c1fc43610 | ||
|
cfbd7e3bf5 | ||
|
c8ca1cfa3c | ||
|
5cfbb0a423 | ||
|
900ec143a8 | ||
|
7bda3d0f74 | ||
|
7650786fb5 | ||
|
ca60d08621 | ||
|
b34218c8c2 | ||
|
b14a59629c | ||
|
0914bf8cf0 | ||
|
7bdca83de3 | ||
|
846f03504e | ||
|
01e8fd0b07 | ||
|
7f301c44b7 | ||
|
51a25fdec9 | ||
|
2b681c37ac | ||
|
cb4ebfdbd2 | ||
|
206c85222c | ||
|
18071e038e | ||
|
39f7ce15ad | ||
|
e39b42bbd3 | ||
|
607d8f72e8 | ||
|
c483f75fb4 | ||
|
81f0175251 | ||
|
f753519729 | ||
|
f39693f97e | ||
|
f83ae0e39e | ||
|
521d371b5d | ||
|
b23d551d00 | ||
|
1b20cc6075 | ||
|
2043e12ac2 | ||
|
9461bc948f | ||
|
9740ab8bd6 | ||
|
6947a6b1d4 | ||
|
4da8036222 | ||
|
e6b4006c70 | ||
|
8f5f7f1baa | ||
|
573d3eea87 | ||
|
eb84eec0f4 | ||
|
d7a31088ba | ||
|
a028e04ab9 | ||
|
a0520536df | ||
|
af137fd5d3 | ||
|
f7bc9f01c9 | ||
|
e4ce1ffd85 | ||
|
2384b49156 | ||
|
f5e71f64ed | ||
|
927ef22cf8 | ||
|
b6eaec1278 | ||
|
c7d1eb71da | ||
|
7d41d267a3 | ||
|
0ead65ad2d | ||
|
8c5481a3d5 | ||
|
741258051e | ||
|
0f4fc8635b | ||
|
d02d3f72fe | ||
|
710b69fc75 | ||
|
4fae382ffd | ||
|
68b94a3188 | ||
|
8e04f83232 | ||
|
cc9fd9f8ce | ||
|
1e8fcf1344 | ||
|
809c8305b1 | ||
|
652c7e8f37 | ||
|
beebca98fe | ||
|
ce67abc32f | ||
|
52cc482521 | ||
|
5eacad444d | ||
|
e8155cbbeb | ||
|
663376e385 | ||
|
3c590994db | ||
|
14c8564893 | ||
|
91a37f8868 | ||
|
1a2ff884b3 | ||
|
0298719be0 | ||
|
d0746da5e2 | ||
|
5b1cf33b1b | ||
|
54a1bbd016 | ||
|
455cd5551b | ||
|
b3e1783658 | ||
|
906c83af83 | ||
|
f9900cc6fb | ||
|
8e20187d8c | ||
|
28dac7ff0e | ||
|
e385b3d377 | ||
|
7e5c68c553 | ||
|
39ad7bc741 | ||
|
c2f9aab068 | ||
|
7e105343e2 | ||
|
fe2215df00 | ||
|
640bbaabbf | ||
|
da2965cb4e | ||
|
94ba242c33 | ||
|
debd5a5c5e | ||
|
98bbb84a63 | ||
|
9d908a11ed | ||
|
4d599e2f9f | ||
|
d3b33e5512 | ||
|
c8487cc395 | ||
|
0b3b5f6174 |
531 changed files with 55172 additions and 79485 deletions
75
.clang-format
Normal file
75
.clang-format
Normal file
|
@ -0,0 +1,75 @@
|
|||
---
|
||||
BasedOnStyle: LLVM
|
||||
BreakBeforeBraces: Stroustrup
|
||||
IndentWidth: 4
|
||||
TabWidth: 4
|
||||
AlignAfterOpenBracket: AlwaysBreak
|
||||
AlignConsecutiveMacros: 'true'
|
||||
AlignConsecutiveAssignments: 'false'
|
||||
AlignConsecutiveDeclarations: 'false'
|
||||
AlignEscapedNewlines: Right
|
||||
AlignOperands: 'true'
|
||||
AlignTrailingComments: 'true'
|
||||
AllowAllArgumentsOnNextLine: 'false'
|
||||
AllowAllConstructorInitializersOnNextLine: 'false'
|
||||
AllowAllParametersOfDeclarationOnNextLine: 'false'
|
||||
AllowShortBlocksOnASingleLine: 'true'
|
||||
AllowShortCaseLabelsOnASingleLine: 'false'
|
||||
AllowShortFunctionsOnASingleLine: None
|
||||
AllowShortIfStatementsOnASingleLine: Never
|
||||
AlwaysBreakAfterReturnType: None
|
||||
BinPackArguments: 'false'
|
||||
BinPackParameters: 'false'
|
||||
BreakBeforeBinaryOperators: NonAssignment
|
||||
BreakBeforeTernaryOperators: 'true'
|
||||
BreakConstructorInitializers: BeforeComma
|
||||
BreakInheritanceList: BeforeComma
|
||||
CompactNamespaces: 'false'
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: 'true'
|
||||
ConstructorInitializerIndentWidth: '4'
|
||||
ContinuationIndentWidth: '4'
|
||||
Cpp11BracedListStyle: 'false'
|
||||
FixNamespaceComments: 'true'
|
||||
IncludeBlocks: Regroup
|
||||
IndentCaseLabels: 'true'
|
||||
IndentPPDirectives: None
|
||||
IndentWrappedFunctionNames: 'false'
|
||||
KeepEmptyLinesAtTheStartOfBlocks: 'false'
|
||||
MaxEmptyLinesToKeep: '1'
|
||||
NamespaceIndentation: None
|
||||
PointerAlignment: Left
|
||||
ReflowComments: 'true'
|
||||
SortIncludes: 'true'
|
||||
SortUsingDeclarations: 'true'
|
||||
SpaceAfterCStyleCast: 'false'
|
||||
SpaceAfterLogicalNot: 'true'
|
||||
SpaceAfterTemplateKeyword: 'true'
|
||||
SpaceBeforeAssignmentOperators: 'true'
|
||||
SpaceBeforeCpp11BracedList: 'true'
|
||||
SpaceBeforeCtorInitializerColon: 'true'
|
||||
SpaceBeforeInheritanceColon: 'true'
|
||||
SpaceBeforeParens: ControlStatements
|
||||
SpaceBeforeRangeBasedForLoopColon: 'true'
|
||||
SpaceInEmptyParentheses: 'false'
|
||||
SpacesBeforeTrailingComments: '3'
|
||||
SpacesInAngles: 'false'
|
||||
SpacesInCStyleCastParentheses: 'false'
|
||||
SpacesInContainerLiterals: 'true'
|
||||
SpacesInParentheses: 'false'
|
||||
SpacesInSquareBrackets: 'false'
|
||||
UseTab: 'Never'
|
||||
|
||||
---
|
||||
Language: Cpp
|
||||
Standard: Cpp03
|
||||
ColumnLimit: '240'
|
||||
---
|
||||
Language: ObjC
|
||||
ColumnLimit: '240'
|
||||
---
|
||||
Language: Java
|
||||
ColumnLimit: '240'
|
||||
---
|
||||
Language: CSharp
|
||||
ColumnLimit: '240'
|
||||
...
|
6
.clangd
Normal file
6
.clangd
Normal file
|
@ -0,0 +1,6 @@
|
|||
CompileFlags:
|
||||
Add:
|
||||
- "-std=c++17"
|
||||
- "-I../ext"
|
||||
- "-I../ext/prometheus-cpp-lite-1.0/core/include"
|
||||
- "-I../ext/prometheus-cpp-lite-1.0/simpleapi/include"
|
127
.gitignore
vendored
Executable file → Normal file
127
.gitignore
vendored
Executable file → Normal file
|
@ -1,19 +1,56 @@
|
|||
# Main binaries created in *nix builds
|
||||
/zerotier-one
|
||||
/zerotier-idtool
|
||||
/zerotier-cli
|
||||
/zerotier-selftest
|
||||
/zerotier
|
||||
/nltest
|
||||
|
||||
# OS-created garbage files from various platforms
|
||||
build/
|
||||
/version.h
|
||||
.DS_Store
|
||||
.Trashes
|
||||
*.swp
|
||||
._*
|
||||
*~
|
||||
*~.nib
|
||||
.Apple*
|
||||
Thumbs.db
|
||||
@eaDir
|
||||
._*
|
||||
DerivedData/
|
||||
*.pbxuser
|
||||
*.mode1v3
|
||||
*.mode2v3
|
||||
*.perspectivev3
|
||||
!default.pbxuser
|
||||
!default.mode1v3
|
||||
!default.mode2v3
|
||||
!default.perspectivev3
|
||||
*.xccheckout
|
||||
xcuserdata/
|
||||
.vscode
|
||||
__pycache__
|
||||
attic/world/*.c25519
|
||||
attic/world/mkworld
|
||||
*.log
|
||||
*.opensdf
|
||||
*.user
|
||||
*.cache
|
||||
*.obj
|
||||
*.tlog
|
||||
*.pid
|
||||
*.pkg
|
||||
*.o
|
||||
*.o-*
|
||||
*.core
|
||||
*.deb
|
||||
*.rpm
|
||||
*.autosave
|
||||
*.tmp
|
||||
.depend
|
||||
node_modules
|
||||
debian/files
|
||||
debian/zerotier-one
|
||||
debian/zerotier-one*.debhelper
|
||||
debian/*.log
|
||||
debian/zerotier-one.substvars
|
||||
root/identity.*
|
||||
root/config.*
|
||||
/ext/installfiles/windows/chocolatey/zerotier-one/*.nupkg
|
||||
/go/zerotier
|
||||
|
||||
# Windows build droppings
|
||||
/windows/ZeroTierOne.sdf
|
||||
/windows/ZeroTierOne.v11.suo
|
||||
/windows/x64
|
||||
|
@ -32,7 +69,7 @@ Thumbs.db
|
|||
/ext/installfiles/windows/ZeroTier One-SetupFiles
|
||||
/ext/installfiles/windows/Prerequisites
|
||||
/ext/installfiles/windows/*-cache
|
||||
/ZeroTier One.msi
|
||||
/*.msi
|
||||
/windows/.vs
|
||||
*.vcxproj.backup
|
||||
/windows/TapDriver6/Win7Debug
|
||||
|
@ -43,47 +80,6 @@ enc_temp_folder
|
|||
/windows/copyutil/bin
|
||||
/windows/copyutil/obj
|
||||
|
||||
# *nix/Mac build droppings
|
||||
/build-*
|
||||
/ZeroTierOneInstaller-*
|
||||
/examples/docker/zerotier-one
|
||||
/examples/docker/test-*.env
|
||||
/world/mkworld
|
||||
/world/*.c25519
|
||||
zt1-src.tar.gz
|
||||
/MacEthernetTapAgent
|
||||
|
||||
# Miscellaneous temporaries, build files, etc.
|
||||
*.log
|
||||
*.opensdf
|
||||
*.user
|
||||
*.cache
|
||||
*.obj
|
||||
*.tlog
|
||||
*.pid
|
||||
*.pkg
|
||||
*.o
|
||||
/*.a
|
||||
*.dylib
|
||||
*.so
|
||||
*.so.*
|
||||
*.o-*
|
||||
*.core
|
||||
*.deb
|
||||
*.rpm
|
||||
*.autosave
|
||||
*.tmp
|
||||
.depend
|
||||
node_modules
|
||||
zt1_update_*
|
||||
debian/files
|
||||
debian/zerotier-one
|
||||
debian/zerotier-one*.debhelper
|
||||
debian/*.log
|
||||
debian/zerotier-one.substvars
|
||||
root-watcher/config.json
|
||||
|
||||
# Java/Android/JNI build droppings
|
||||
java/obj/
|
||||
java/libs/
|
||||
java/bin/
|
||||
|
@ -95,28 +91,3 @@ java/build_win32/
|
|||
windows/WinUI/obj/
|
||||
windows/WinUI/bin/
|
||||
windows/ZeroTierOne/Debug/
|
||||
/ext/installfiles/windows/chocolatey/zerotier-one/*.nupkg
|
||||
|
||||
# Miscellaneous mac/Xcode droppings
|
||||
.DS_Store
|
||||
.Trashes
|
||||
*.swp
|
||||
*~.nib
|
||||
DerivedData/
|
||||
build/
|
||||
*.pbxuser
|
||||
*.mode1v3
|
||||
*.mode2v3
|
||||
*.perspectivev3
|
||||
!default.pbxuser
|
||||
!default.mode1v3
|
||||
!default.mode2v3
|
||||
!default.perspectivev3
|
||||
*.xccheckout
|
||||
xcuserdata/
|
||||
ext/librethinkdbxx/build
|
||||
.vscode
|
||||
__pycache__
|
||||
*~
|
||||
attic/world/*.c25519
|
||||
attic/world/mkworld
|
||||
|
|
3
.idea/.gitignore
generated
vendored
Normal file
3
.idea/.gitignore
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
|
||||
# Default ignored files
|
||||
/workspace.xml
|
9
.idea/ZeroTierOne.iml
generated
Normal file
9
.idea/ZeroTierOne.iml
generated
Normal file
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="WEB_MODULE" version="4">
|
||||
<component name="Go" enabled="true" />
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
5
.idea/codeStyles/codeStyleConfig.xml
generated
Normal file
5
.idea/codeStyles/codeStyleConfig.xml
generated
Normal file
|
@ -0,0 +1,5 @@
|
|||
<component name="ProjectCodeStyleConfiguration">
|
||||
<state>
|
||||
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
|
||||
</state>
|
||||
</component>
|
11
.idea/dictionaries/api.xml
generated
Normal file
11
.idea/dictionaries/api.xml
generated
Normal file
|
@ -0,0 +1,11 @@
|
|||
<component name="ProjectDictionaryState">
|
||||
<dictionary name="api">
|
||||
<words>
|
||||
<w>apisocket</w>
|
||||
<w>nwid</w>
|
||||
<w>secrand</w>
|
||||
<w>sockaddr</w>
|
||||
<w>unmarshals</w>
|
||||
</words>
|
||||
</dictionary>
|
||||
</component>
|
10
.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
10
.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
|
@ -0,0 +1,10 @@
|
|||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="SpellCheckingInspection" enabled="false" level="TYPO" enabled_by_default="false">
|
||||
<option name="processCode" value="true" />
|
||||
<option name="processLiterals" value="true" />
|
||||
<option name="processComments" value="true" />
|
||||
</inspection_tool>
|
||||
</profile>
|
||||
</component>
|
6
.idea/misc.xml
generated
Normal file
6
.idea/misc.xml
generated
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="JavaScriptSettings">
|
||||
<option name="languageLevel" value="ES6" />
|
||||
</component>
|
||||
</project>
|
8
.idea/modules.xml
generated
Normal file
8
.idea/modules.xml
generated
Normal file
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/ZeroTierOne.iml" filepath="$PROJECT_DIR$/.idea/ZeroTierOne.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
6
.idea/vcs.xml
generated
Normal file
6
.idea/vcs.xml
generated
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
29
.idea/watcherTasks.xml
generated
Normal file
29
.idea/watcherTasks.xml
generated
Normal file
|
@ -0,0 +1,29 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectTasksOptions">
|
||||
<TaskOptions isEnabled="true">
|
||||
<option name="arguments" value="fmt $FilePath$" />
|
||||
<option name="checkSyntaxErrors" value="true" />
|
||||
<option name="description" />
|
||||
<option name="exitCodeBehavior" value="ERROR" />
|
||||
<option name="fileExtension" value="go" />
|
||||
<option name="immediateSync" value="false" />
|
||||
<option name="name" value="go fmt" />
|
||||
<option name="output" value="$FilePath$" />
|
||||
<option name="outputFilters">
|
||||
<array />
|
||||
</option>
|
||||
<option name="outputFromStdout" value="false" />
|
||||
<option name="program" value="$GoExecPath$" />
|
||||
<option name="runOnExternalChanges" value="false" />
|
||||
<option name="scopeName" value="Project Files" />
|
||||
<option name="trackOnlyRoot" value="true" />
|
||||
<option name="workingDir" value="$ProjectFileDir$" />
|
||||
<envs>
|
||||
<env name="GOROOT" value="$GOROOT$" />
|
||||
<env name="GOPATH" value="$GOPATH$" />
|
||||
<env name="PATH" value="$GoBinDirs$" />
|
||||
</envs>
|
||||
</TaskOptions>
|
||||
</component>
|
||||
</project>
|
12
AUTHORS.md
12
AUTHORS.md
|
@ -36,12 +36,6 @@ ZeroTier includes the following third party code, either in ext/ or incorporated
|
|||
* Home page: http://code.google.com/p/lz4/
|
||||
* License grant: BSD 2-clause
|
||||
|
||||
* http-parser by Joyent, Inc. (many authors)
|
||||
|
||||
* Files: ext/http-parser/*
|
||||
* Home page: https://github.com/joyent/http-parser/
|
||||
* License grant: MIT/Expat
|
||||
|
||||
* C++11 json (nlohmann/json) by Niels Lohmann
|
||||
|
||||
* Files: ext/json/*
|
||||
|
@ -62,12 +56,6 @@ ZeroTier includes the following third party code, either in ext/ or incorporated
|
|||
* License grant: public domain
|
||||
* ZeroTier Modifications: slight cryptographically-irrelevant modifications for inclusion into ZeroTier core
|
||||
|
||||
* MiniUPNPC and libnatpmp by Thomas Bernard
|
||||
|
||||
* Files: ext/libnatpmp/* ext/miniupnpc/*
|
||||
* Home page: http://miniupnp.free.fr/
|
||||
* License grant: BSD attribution no-endorsement
|
||||
|
||||
* cpp-httplib by yhirose
|
||||
|
||||
* Files: ext/cpp-httplib/*
|
||||
|
|
203
CMakeLists.txt
203
CMakeLists.txt
|
@ -1,12 +1,199 @@
|
|||
# CMake build script for libzerotiercore.a
|
||||
cmake_minimum_required (VERSION 3.10)
|
||||
|
||||
cmake_minimum_required (VERSION 2.8)
|
||||
project (zerotiercore)
|
||||
if(${CMAKE_VERSION} VERSION_LESS 3.15)
|
||||
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
|
||||
else()
|
||||
cmake_policy(VERSION 3.15)
|
||||
endif()
|
||||
|
||||
set (PROJ_DIR ${PROJECT_SOURCE_DIR})
|
||||
set (ZT_DEFS -std=c++11)
|
||||
if(WIN32)
|
||||
# If building on Windows, set minimum target to Windows 7
|
||||
set(CMAKE_SYSTEM_VERSION "7" CACHE STRING INTERNAL FORCE)
|
||||
endif(WIN32)
|
||||
|
||||
file(GLOB core_src_glob ${PROJ_DIR}/node/*.cpp)
|
||||
add_library(zerotiercore STATIC ${core_src_glob})
|
||||
set(ZEROTIER_ONE_VERSION_MAJOR 2 CACHE INTERNAL "")
|
||||
set(ZEROTIER_ONE_VERSION_MINOR 0 CACHE INTERNAL "")
|
||||
set(ZEROTIER_ONE_VERSION_REVISION 0 CACHE INTERNAL "")
|
||||
set(ZEROTIER_ONE_VERSION_BUILD 0 CACHE INTERNAL "")
|
||||
|
||||
target_compile_options(zerotiercore PRIVATE ${ZT_DEFS})
|
||||
set(default_build_type "Release")
|
||||
if(EXISTS "${CMAKE_SOURCE_DIR}/.git")
|
||||
set(default_build_type "Debug")
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
||||
message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
|
||||
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE
|
||||
STRING "Choose the type of build." FORCE)
|
||||
# Set the possible values of build type for cmake-gui
|
||||
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
|
||||
"Debug" "Release" "MinSizeRel" "RelWithDebInfo")
|
||||
endif()
|
||||
|
||||
option(BUILD_CENTRAL_CONTROLLER "Build ZeroTier Central Controller" OFF)
|
||||
option(ZT_TRACE "Trace Messages" OFF)
|
||||
option(ZT_DEBUG_TRACE "Debug Trace Messages" OFF)
|
||||
|
||||
if (BUILD_CENTRAL_CONTROLLER)
|
||||
find_package(PostgreSQL REQUIRED)
|
||||
set(ENABLE_SSL_SUPPORT OFF)
|
||||
set(BUILD_SHARED_LIBS OFF)
|
||||
set(BUILD_EXAMPLES OFF)
|
||||
set(BUILD_TOOLS OFF)
|
||||
set(BUILD_TESTS OFF)
|
||||
set(BUILD_API_DOCS OFF)
|
||||
add_subdirectory("ext/librabbitmq")
|
||||
endif(BUILD_CENTRAL_CONTROLLER)
|
||||
|
||||
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.9" CACHE STRING "Minimum OS X Deployment Version")
|
||||
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
add_definitions(-DZT_TRACE)
|
||||
endif(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
|
||||
project(zerotier
|
||||
DESCRIPTION "ZeroTier Network Hypervisor"
|
||||
LANGUAGES CXX C)
|
||||
|
||||
if(WIN32)
|
||||
add_definitions(-DNOMINMAX)
|
||||
else(WIN32)
|
||||
if(APPLE)
|
||||
|
||||
message("Setting macOS Compiler Flags ${CMAKE_BUILD_TYPE}")
|
||||
add_compile_options(
|
||||
-Wall
|
||||
-Wno-deprecated
|
||||
-mmacosx-version-min=10.9
|
||||
$<$<CONFIG:Debug>:-g>
|
||||
$<$<CONFIG:DEBUG>:-O0>
|
||||
$<$<CONFIG:RELEASE>:-Ofast>
|
||||
$<$<CONFIG:RELEASE>:-fPIE>
|
||||
$<$<CONFIG:RELEASE>:-flto>
|
||||
$<$<CONFIG:RELWITHDEBINFO>:-Ofast>
|
||||
$<$<CONFIG:RELWITHDEBINFO>:-fPIE>
|
||||
$<$<CONFIG:RELWITHDEBINFO>:-g>
|
||||
)
|
||||
add_link_options(
|
||||
-mmacosx-version-min=10.9
|
||||
$<$<CONFIG:RELEASE>:-flto>
|
||||
)
|
||||
|
||||
elseif (
|
||||
CMAKE_SYSTEM_NAME MATCHES "Linux" OR
|
||||
CMAKE_SYSTEM_NAME MATCHES "FreeBSD" OR
|
||||
CMAKE_SYSTEM_NAME MATCHES "OpenBSD" OR
|
||||
CMAKE_SYSTEM_NAME MATCHES "NetBSD"
|
||||
)
|
||||
|
||||
message("Setting Linux/BSD Compiler Flags (${CMAKE_BUILD_TYPE})")
|
||||
add_compile_options(
|
||||
-Wall
|
||||
-Wno-deprecated
|
||||
$<$<CONFIG:Debug>:-g>
|
||||
$<$<CONFIG:DEBUG>:-O0>
|
||||
$<$<CONFIG:RELEASE>:-O3>
|
||||
$<$<CONFIG:RELEASE>:-fPIE>
|
||||
$<$<CONFIG:RELWITHDEBINFO>:-O3>
|
||||
$<$<CONFIG:RELWITHDEBINFO>:-fPIE>
|
||||
$<$<CONFIG:RELWITHDEBINFO>:-g>
|
||||
)
|
||||
|
||||
endif(APPLE)
|
||||
endif(WIN32)
|
||||
|
||||
if (
|
||||
CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64" OR
|
||||
CMAKE_SYSTEM_PROCESSOR MATCHES "amd64" OR
|
||||
CMAKE_SYSTEM_PROCESSOR MATCHES "i386" OR
|
||||
CMAKE_SYSTEM_PROCESSOR MATCHES "i486" OR
|
||||
CMAKE_SYSTEM_PROCESSOR MATCHES "i586" OR
|
||||
CMAKE_SYSTEM_PROCESSOR MATCHES "i686"
|
||||
)
|
||||
message("Adding SSE and AES-NI flags for processor ${CMAKE_SYSTEM_PROCESSOR}")
|
||||
add_compile_options(
|
||||
-maes
|
||||
-mmmx
|
||||
-mrdrnd
|
||||
-mpclmul
|
||||
-msse
|
||||
-msse2
|
||||
-msse3
|
||||
-msse4.1
|
||||
)
|
||||
endif()
|
||||
|
||||
if(ZT_TRACE)
|
||||
add_definitions(-DZT_TRACE)
|
||||
endif()
|
||||
if(ZT_DEBUG_TRACE)
|
||||
add_definitions(-DZT_DEBUG_TRACE)
|
||||
endif()
|
||||
|
||||
add_subdirectory(node)
|
||||
add_subdirectory(controller)
|
||||
add_subdirectory(osdep)
|
||||
add_subdirectory(go/native)
|
||||
|
||||
#if(WIN32)
|
||||
# add_subdirectory("windows/WinUI")
|
||||
# add_subdirectory("windows/copyutil")
|
||||
# add_definitions(-DNOMINMAX)
|
||||
#endif(WIN32)
|
||||
|
||||
set(
|
||||
zt_osdep
|
||||
zt_core
|
||||
zt_controller
|
||||
zt_go_native
|
||||
)
|
||||
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/version.h.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/version.h
|
||||
)
|
||||
|
||||
#set(src
|
||||
# one.cpp
|
||||
# "ext/http-parser/http_parser.c"
|
||||
#)
|
||||
#set(headers
|
||||
# "ext/http-parser/http_parser.h"
|
||||
#)
|
||||
|
||||
if(WIN32)
|
||||
set(libs ${libs} wsock32 ws2_32 rpcrt4 iphlpapi)
|
||||
else(WIN32)
|
||||
set(libs ${libs} pthread)
|
||||
endif(WIN32)
|
||||
|
||||
#if(WIN32)
|
||||
# set(libs ${libs} wsock32 ws2_32 rpcrt4 iphlpapi)
|
||||
# set(src
|
||||
# ${src}
|
||||
# "windows/ZeroTierOne/ServiceBase.cpp"
|
||||
# "windows/ZeroTierOne/ServiceInstaller.cpp"
|
||||
# "windows/ZeroTierOne/ZeroTierOneService.cpp"
|
||||
# "windows/ZeroTierOne/ZeroTierOne.rc"
|
||||
# )
|
||||
# set(headers
|
||||
# ${headers}
|
||||
# "windows/ZeroTierOne/ServiceBase.h"
|
||||
# "windows/ZeroTierOne/ServiceInstaller.h"
|
||||
# "windows/ZeroTierOne/ZeroTierOneService.h"
|
||||
# )
|
||||
#else(WIN32)
|
||||
# set(libs ${libs} pthread resolv)
|
||||
#endif(WIN32)
|
||||
|
||||
#if(BUILD_CENTRAL_CONTROLLER)
|
||||
# set(libs ${libs} rabbitmq-static ${PostgreSQL_LIBRARIES})
|
||||
#endif(BUILD_CENTRAL_CONTROLLER)
|
||||
|
||||
#add_executable(${PROJECT_NAME} ${src} ${headers})
|
||||
#target_link_libraries(${PROJECT_NAME} ${libs})
|
||||
#target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_BINARY_DIR})
|
||||
|
||||
add_executable(zerotier-selftest selftest.cpp)
|
||||
target_link_libraries(zerotier-selftest ${libs} zt_core zt_osdep)
|
||||
target_compile_features(zerotier-selftest PUBLIC cxx_std_11)
|
||||
|
|
8
Jenkinsfile
vendored
8
Jenkinsfile
vendored
|
@ -14,7 +14,13 @@ parallel 'centos7': {
|
|||
checkout scm
|
||||
|
||||
stage('Build Centos 7') {
|
||||
sh 'make -f make-linux.mk'
|
||||
sh '''. /opt/rh/devtoolset-8/enable
|
||||
rm -rf build/
|
||||
mkdir build && cd build
|
||||
cmake ..
|
||||
make -j4
|
||||
./zerotier-selftest
|
||||
'''
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
|
|
36
Makefile
36
Makefile
|
@ -1,28 +1,20 @@
|
|||
# Common makefile -- loads make rules for each platform
|
||||
|
||||
OSTYPE=$(shell uname -s)
|
||||
BUILDDIR := build
|
||||
|
||||
ifeq ($(OSTYPE),Darwin)
|
||||
include make-mac.mk
|
||||
endif
|
||||
.PHONY: all
|
||||
|
||||
ifeq ($(OSTYPE),Linux)
|
||||
include make-linux.mk
|
||||
endif
|
||||
all: setup
|
||||
cd ${BUILDDIR} && $(MAKE) -j$(shell getconf _NPROCESSORS_ONLN)
|
||||
|
||||
ifeq ($(OSTYPE),FreeBSD)
|
||||
CC=clang
|
||||
CXX=clang++
|
||||
ZT_BUILD_PLATFORM=7
|
||||
include make-bsd.mk
|
||||
endif
|
||||
ifeq ($(OSTYPE),OpenBSD)
|
||||
CC=egcc
|
||||
CXX=eg++
|
||||
ZT_BUILD_PLATFORM=9
|
||||
include make-bsd.mk
|
||||
endif
|
||||
setup:
|
||||
mkdir -p ${BUILDDIR} && cd ${BUILDDIR} && cmake .. -DCMAKE_BUILD_TYPE=Release
|
||||
|
||||
ifeq ($(OSTYPE),NetBSD)
|
||||
include make-netbsd.mk
|
||||
endif
|
||||
debug:
|
||||
mkdir -p ${BUILDDIR} && cd ${BUILDDIR} && cmake .. -DCMAKE_BUILD_TYPE=Debug && $(MAKE)
|
||||
|
||||
clean:
|
||||
rm -rf ${BUILDDIR}
|
||||
|
||||
distclean:
|
||||
rm -rf ${BUILDDIR}
|
||||
|
|
|
@ -54,6 +54,12 @@
|
|||
#include "Phy.hpp"
|
||||
#include "OSUtils.hpp"
|
||||
|
||||
#if (defined(__amd64) || defined(__amd64__) || defined(__x86_64) || defined(__x86_64__) || defined(__AMD64) || defined(__AMD64__))
|
||||
#define ZT_UDP_DESIRED_BUF_SIZE 1048576
|
||||
#else
|
||||
#define ZT_UDP_DESIRED_BUF_SIZE 131072
|
||||
#endif
|
||||
|
||||
// Period between refreshes of bindings
|
||||
#define ZT_BINDER_REFRESH_PERIOD 30000
|
||||
|
|
@ -48,6 +48,7 @@
|
|||
#include <sys/un.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/ip6.h>
|
||||
#include <netinet/tcp.h>
|
||||
|
||||
#if defined(__linux__) || defined(linux) || defined(__LINUX__) || defined(__linux)
|
14
attic/PortMapper-libnatpmp.c
Normal file
14
attic/PortMapper-libnatpmp.c
Normal file
|
@ -0,0 +1,14 @@
|
|||
#define ENABLE_STRNATPMPERR
|
||||
#define _BSD_SOURCE
|
||||
#define _DEFAULT_SOURCE
|
||||
#define _XOPEN_SOURCE 600
|
||||
|
||||
#ifdef __APPLE__
|
||||
#ifndef _DARWIN_C_SOURCE
|
||||
#define _DARWIN_C_SOURCE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "../ext/libnatpmp/getgateway.c"
|
||||
#include "../ext/libnatpmp/wingettimeofday.c"
|
||||
#include "../ext/libnatpmp/natpmp.c"
|
41
attic/PortMapper-miniupnpc.c
Normal file
41
attic/PortMapper-miniupnpc.c
Normal file
|
@ -0,0 +1,41 @@
|
|||
#define MINIUPNP_STATICLIB
|
||||
#define MINIUPNPC_SET_SOCKET_TIMEOUT
|
||||
#define MINIUPNPC_GET_SRC_ADDR
|
||||
#define _BSD_SOURCE
|
||||
#define _DEFAULT_SOURCE
|
||||
#define _XOPEN_SOURCE 600
|
||||
#define MINIUPNPC_VERSION_STRING "2.0"
|
||||
#define UPNP_VERSION_STRING "UPnP/1.1"
|
||||
|
||||
#ifdef __LINUX__
|
||||
#define OS_STRING "Linux"
|
||||
#endif
|
||||
#ifdef __APPLE__
|
||||
#define OS_STRING "Darwin"
|
||||
#endif
|
||||
#ifdef __WINDOWS__
|
||||
#define OS_STRING "Windows"
|
||||
#endif
|
||||
#ifndef OS_STRING
|
||||
#define OS_STRING "ZeroTier"
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
#ifndef _DARWIN_C_SOURCE
|
||||
#define _DARWIN_C_SOURCE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "../ext/miniupnpc/connecthostport.c"
|
||||
#include "../ext/miniupnpc/igd_desc_parse.c"
|
||||
#include "../ext/miniupnpc/minisoap.c"
|
||||
#include "../ext/miniupnpc/miniupnpc.c"
|
||||
#include "../ext/miniupnpc/miniwget.c"
|
||||
#include "../ext/miniupnpc/minixml.c"
|
||||
#include "../ext/miniupnpc/portlistingparse.c"
|
||||
#include "../ext/miniupnpc/receivedata.c"
|
||||
#include "../ext/miniupnpc/upnpcommands.c"
|
||||
#include "../ext/miniupnpc/upnpdev.c"
|
||||
#include "../ext/miniupnpc/upnperrors.c"
|
||||
#include "../ext/miniupnpc/upnpreplyparse.c"
|
||||
#include "../ext/miniupnpc/minissdpc.c"
|
|
@ -11,8 +11,6 @@
|
|||
*/
|
||||
/****/
|
||||
|
||||
#ifdef ZT_USE_MINIUPNPC
|
||||
|
||||
// Uncomment to dump debug messages
|
||||
//#define ZT_PORTMAPPER_TRACE 1
|
||||
|
||||
|
@ -112,7 +110,7 @@ public:
|
|||
mode = 1;
|
||||
closenatpmp(&natpmp);
|
||||
#ifdef ZT_PORTMAPPER_TRACE
|
||||
PM_TRACE("PortMapper: NAT-PMP: init failed, switching to UPnP mode" ZT_EOL_S);
|
||||
PM_TRACE("PortMapper: NAT-PMP: init failed, switching to UPnP mode" ZT_EOL_S);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
@ -135,7 +133,7 @@ public:
|
|||
publicAddress = InetAddress((uint32_t)response.pnu.publicaddress.addr.s_addr,0);
|
||||
} else {
|
||||
#ifdef ZT_PORTMAPPER_TRACE
|
||||
PM_TRACE("PortMapper: NAT-PMP: request for external address failed, aborting..." ZT_EOL_S);
|
||||
PM_TRACE("PortMapper: NAT-PMP: request for external address failed, aborting..." ZT_EOL_S);
|
||||
#endif
|
||||
closenatpmp(&natpmp);
|
||||
break;
|
||||
|
@ -157,8 +155,8 @@ public:
|
|||
if (r == 0) {
|
||||
publicAddress.setPort(response.pnu.newportmapping.mappedpublicport);
|
||||
#ifdef ZT_PORTMAPPER_TRACE
|
||||
char paddr[128];
|
||||
PM_TRACE("PortMapper: NAT-PMP: mapped %u to %s" ZT_EOL_S,(unsigned int)localPort,publicAddress.toString(paddr));
|
||||
char paddr[128];
|
||||
PM_TRACE("PortMapper: NAT-PMP: mapped %u to %s" ZT_EOL_S,(unsigned int)localPort,publicAddress.toString(paddr));
|
||||
#endif
|
||||
Mutex::Lock sl(surface_l);
|
||||
surface.clear();
|
||||
|
@ -175,7 +173,7 @@ public:
|
|||
if (!natPmpSuccess) {
|
||||
mode = 1;
|
||||
#ifdef ZT_PORTMAPPER_TRACE
|
||||
PM_TRACE("PortMapper: NAT-PMP: request failed, switching to UPnP mode" ZT_EOL_S);
|
||||
PM_TRACE("PortMapper: NAT-PMP: request failed, switching to UPnP mode" ZT_EOL_S);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -200,7 +198,7 @@ public:
|
|||
{
|
||||
UPNPDev *dev = devlist;
|
||||
while (dev) {
|
||||
PM_TRACE("PortMapper: found UPnP device at URL '%s': %s" ZT_EOL_S,dev->descURL,dev->st);
|
||||
PM_TRACE("PortMapper: found UPnP device at URL '%s': %s" ZT_EOL_S,dev->descURL,dev->st);
|
||||
dev = dev->pNext;
|
||||
}
|
||||
}
|
||||
|
@ -214,11 +212,11 @@ public:
|
|||
|
||||
if ((UPNP_GetValidIGD(devlist,&urls,&data,lanaddr,sizeof(lanaddr)))&&(lanaddr[0])) {
|
||||
#ifdef ZT_PORTMAPPER_TRACE
|
||||
PM_TRACE("PortMapper: UPnP: my LAN IP address: %s" ZT_EOL_S,lanaddr);
|
||||
PM_TRACE("PortMapper: UPnP: my LAN IP address: %s" ZT_EOL_S,lanaddr);
|
||||
#endif
|
||||
if ((UPNP_GetExternalIPAddress(urls.controlURL,data.first.servicetype,externalip) == UPNPCOMMAND_SUCCESS)&&(externalip[0])) {
|
||||
#ifdef ZT_PORTMAPPER_TRACE
|
||||
PM_TRACE("PortMapper: UPnP: my external IP address: %s" ZT_EOL_S,externalip);
|
||||
PM_TRACE("PortMapper: UPnP: my external IP address: %s" ZT_EOL_S,externalip);
|
||||
#endif
|
||||
|
||||
for(int tries=0;tries<60;++tries) {
|
||||
|
@ -244,7 +242,7 @@ public:
|
|||
memset(haveLeaseDuration,0,sizeof(haveLeaseDuration));
|
||||
if ((UPNP_GetSpecificPortMappingEntry(urls.controlURL,data.first.servicetype,outport,"UDP",(const char *)0,haveIntClient,haveIntPort,haveDesc,haveEnabled,haveLeaseDuration) == UPNPCOMMAND_SUCCESS)&&(uniqueName == haveDesc)) {
|
||||
#ifdef ZT_PORTMAPPER_TRACE
|
||||
PM_TRACE("PortMapper: UPnP: reusing previously reserved external port: %s" ZT_EOL_S,outport);
|
||||
PM_TRACE("PortMapper: UPnP: reusing previously reserved external port: %s" ZT_EOL_S,outport);
|
||||
#endif
|
||||
Mutex::Lock sl(surface_l);
|
||||
surface.clear();
|
||||
|
@ -259,7 +257,7 @@ public:
|
|||
int mapResult = 0;
|
||||
if ((mapResult = UPNP_AddPortMapping(urls.controlURL,data.first.servicetype,outport,inport,lanaddr,uniqueName.c_str(),"UDP",(const char *)0,"0")) == UPNPCOMMAND_SUCCESS) {
|
||||
#ifdef ZT_PORTMAPPER_TRACE
|
||||
PM_TRACE("PortMapper: UPnP: reserved external port: %s" ZT_EOL_S,outport);
|
||||
PM_TRACE("PortMapper: UPnP: reserved external port: %s" ZT_EOL_S,outport);
|
||||
#endif
|
||||
Mutex::Lock sl(surface_l);
|
||||
surface.clear();
|
||||
|
@ -269,7 +267,7 @@ public:
|
|||
break;
|
||||
} else {
|
||||
#ifdef ZT_PORTMAPPER_TRACE
|
||||
PM_TRACE("PortMapper: UPnP: UPNP_AddPortMapping(%s) failed: %d" ZT_EOL_S,outport,mapResult);
|
||||
PM_TRACE("PortMapper: UPnP: UPNP_AddPortMapping(%s) failed: %d" ZT_EOL_S,outport,mapResult);
|
||||
#endif
|
||||
Thread::sleep(1000);
|
||||
}
|
||||
|
@ -278,13 +276,13 @@ public:
|
|||
} else {
|
||||
mode = 0;
|
||||
#ifdef ZT_PORTMAPPER_TRACE
|
||||
PM_TRACE("PortMapper: UPnP: UPNP_GetExternalIPAddress failed, returning to NAT-PMP mode" ZT_EOL_S);
|
||||
PM_TRACE("PortMapper: UPnP: UPNP_GetExternalIPAddress failed, returning to NAT-PMP mode" ZT_EOL_S);
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
mode = 0;
|
||||
#ifdef ZT_PORTMAPPER_TRACE
|
||||
PM_TRACE("PortMapper: UPnP: UPNP_GetValidIGD failed, returning to NAT-PMP mode" ZT_EOL_S);
|
||||
PM_TRACE("PortMapper: UPnP: UPNP_GetValidIGD failed, returning to NAT-PMP mode" ZT_EOL_S);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -293,14 +291,14 @@ public:
|
|||
} else {
|
||||
mode = 0;
|
||||
#ifdef ZT_PORTMAPPER_TRACE
|
||||
PM_TRACE("PortMapper: upnpDiscover failed, returning to NAT-PMP mode: %d" ZT_EOL_S,upnpError);
|
||||
PM_TRACE("PortMapper: upnpDiscover failed, returning to NAT-PMP mode: %d" ZT_EOL_S,upnpError);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
#ifdef ZT_PORTMAPPER_TRACE
|
||||
PM_TRACE("UPNPClient: rescanning in %d ms" ZT_EOL_S,ZT_PORTMAPPER_REFRESH_DELAY);
|
||||
PM_TRACE("UPNPClient: rescanning in %d ms" ZT_EOL_S,ZT_PORTMAPPER_REFRESH_DELAY);
|
||||
#endif
|
||||
Thread::sleep(ZT_PORTMAPPER_REFRESH_DELAY);
|
||||
}
|
||||
|
@ -334,5 +332,3 @@ std::vector<InetAddress> PortMapper::get() const
|
|||
}
|
||||
|
||||
} // namespace ZeroTier
|
||||
|
||||
#endif // ZT_USE_MINIUPNPC
|
|
@ -11,8 +11,6 @@
|
|||
*/
|
||||
/****/
|
||||
|
||||
#ifdef ZT_USE_MINIUPNPC
|
||||
|
||||
#ifndef ZT_PORTMAPPER_HPP
|
||||
#define ZT_PORTMAPPER_HPP
|
||||
|
||||
|
@ -26,7 +24,7 @@
|
|||
/**
|
||||
* How frequently should we refresh our UPNP/NAT-PnP/whatever state?
|
||||
*/
|
||||
#define ZT_PORTMAPPER_REFRESH_DELAY 300000
|
||||
#define ZT_PORTMAPPER_REFRESH_DELAY 120000
|
||||
|
||||
namespace ZeroTier {
|
||||
|
||||
|
@ -62,5 +60,3 @@ private:
|
|||
} // namespace ZeroTier
|
||||
|
||||
#endif
|
||||
|
||||
#endif // ZT_USE_MINIUPNPC
|
182
attic/Root.hpp
Normal file
182
attic/Root.hpp
Normal file
|
@ -0,0 +1,182 @@
|
|||
/*
|
||||
* Copyright (c)2019 ZeroTier, Inc.
|
||||
*
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file in the project's root directory.
|
||||
*
|
||||
* Change Date: 2023-01-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2.0 of the Apache License.
|
||||
*/
|
||||
/****/
|
||||
|
||||
#ifndef ZT_ROOT_HPP
|
||||
#define ZT_ROOT_HPP
|
||||
|
||||
#include "Constants.hpp"
|
||||
#include "Str.hpp"
|
||||
#include "ECC384.hpp"
|
||||
#include "Locator.hpp"
|
||||
#include "InetAddress.hpp"
|
||||
#include "Utils.hpp"
|
||||
#include "Identity.hpp"
|
||||
#include "Mutex.hpp"
|
||||
|
||||
namespace ZeroTier {
|
||||
|
||||
/**
|
||||
* A root entry pointing to a node capable of global identity lookup and indirect transit
|
||||
*
|
||||
* Root entries point to DNS records that contain TXT entries that decode to Locator objects
|
||||
* pointing to actual root nodes. A default root identity and static addresses can also be
|
||||
* provided as fallback if DNS is not available.
|
||||
*
|
||||
* Note that root identities can change if DNS returns a different result, but that DNS entries
|
||||
* are authenticated using their own signature scheme. This allows a root DNS name to serve
|
||||
* up different roots based on factors like location or relative load of different roots.
|
||||
*
|
||||
* It's also possible to create a root with no DNS and no DNS validator public key. This root
|
||||
* will be a static entry pointing to a single root identity and set of physical addresses.
|
||||
*/
|
||||
class Root
|
||||
{
|
||||
public:
|
||||
ZT_ALWAYS_INLINE Root() : _dnsPublicKeySize(0) {}
|
||||
|
||||
/**
|
||||
* Create a new root entry
|
||||
*
|
||||
* @param dn DNS name
|
||||
* @param dnspk DNS public key for record validation
|
||||
* @param dnspksize Size of DNS public key (currently always the size of a NIST P-384 point compressed public key)
|
||||
* @param dflId Default identity if DNS is not available
|
||||
* @param dflAddrs Default IP addresses if DNS is not available
|
||||
*/
|
||||
template<typename S>
|
||||
ZT_ALWAYS_INLINE Root(S dn,const uint8_t *const dnspk,const unsigned int dnspksize,const Identity &dflId,const std::vector<InetAddress> &dflAddrs) :
|
||||
_defaultIdentity(dflId),
|
||||
_defaultAddresses(dflAddrs),
|
||||
_dnsName(dn),
|
||||
_dnsPublicKeySize(dnspksize)
|
||||
{
|
||||
if (dnspksize != 0) {
|
||||
if (dnspksize > sizeof(_dnsPublicKey))
|
||||
throw ZT_EXCEPTION_INVALID_ARGUMENT;
|
||||
memcpy(_dnsPublicKey,dnspk,dnspksize);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Current identity (either default or latest locator)
|
||||
*/
|
||||
ZT_ALWAYS_INLINE const Identity id() const
|
||||
{
|
||||
if (_lastFetchedLocator.id())
|
||||
return _lastFetchedLocator.id();
|
||||
return _defaultIdentity;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id Identity to check
|
||||
* @return True if identity equals this root's current identity
|
||||
*/
|
||||
ZT_ALWAYS_INLINE bool is(const Identity &id) const
|
||||
{
|
||||
return ((_lastFetchedLocator.id()) ? (id == _lastFetchedLocator.id()) : (id == _defaultIdentity));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Current ZeroTier address (either default or latest locator)
|
||||
*/
|
||||
ZT_ALWAYS_INLINE const Address address() const
|
||||
{
|
||||
if (_lastFetchedLocator.id())
|
||||
return _lastFetchedLocator.id().address();
|
||||
return _defaultIdentity.address();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return DNS name for this root or empty string if static entry with no DNS
|
||||
*/
|
||||
ZT_ALWAYS_INLINE const Str dnsName() const { return _dnsName; }
|
||||
|
||||
/**
|
||||
* @return Latest locator or NIL locator object if none
|
||||
*/
|
||||
ZT_ALWAYS_INLINE Locator locator() const { return _lastFetchedLocator; }
|
||||
|
||||
/**
|
||||
* @return Timestamp of latest retrieved locator or 0 if none
|
||||
*/
|
||||
ZT_ALWAYS_INLINE int64_t locatorTimestamp() const { return _lastFetchedLocator.timestamp(); }
|
||||
|
||||
/**
|
||||
* Update locator, returning true if new locator is valid and newer than existing
|
||||
*/
|
||||
ZT_ALWAYS_INLINE bool updateLocator(const Locator &loc)
|
||||
{
|
||||
if (!loc.verify())
|
||||
return false;
|
||||
if ((loc.phy().size() > 0)&&(loc.timestamp() > _lastFetchedLocator.timestamp())) {
|
||||
_lastFetchedLocator = loc;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update this root's locator from a series of TXT records
|
||||
*/
|
||||
template<typename I>
|
||||
ZT_ALWAYS_INLINE bool updateLocatorFromTxt(I start,I end)
|
||||
{
|
||||
try {
|
||||
if (_dnsPublicKeySize != ZT_ECC384_PUBLIC_KEY_SIZE)
|
||||
return false;
|
||||
Locator loc;
|
||||
if (!loc.decodeTxtRecords(start,end,_dnsPublicKey)) // also does verify()
|
||||
return false;
|
||||
if ((loc.phy().size() > 0)&&(loc.timestamp() > _lastFetchedLocator.timestamp())) {
|
||||
_lastFetchedLocator = loc;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
} catch ( ... ) {}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Pick a random physical IP for this root with the given address family
|
||||
*
|
||||
* @param addressFamily AF_INET or AF_INET6
|
||||
* @return Address or InetAddress::NIL if no addresses exist for the given family
|
||||
*/
|
||||
ZT_ALWAYS_INLINE const InetAddress &pickPhysical(const int addressFamily) const
|
||||
{
|
||||
std::vector<const InetAddress *> pickList;
|
||||
const std::vector<InetAddress> *const av = (_lastFetchedLocator) ? &(_lastFetchedLocator.phy()) : &_defaultAddresses;
|
||||
for(std::vector<InetAddress>::const_iterator i(av->begin());i!=av->end();++i) {
|
||||
if (addressFamily == (int)i->ss_family) {
|
||||
pickList.push_back(&(*i));
|
||||
}
|
||||
}
|
||||
if (pickList.size() == 1)
|
||||
return *pickList[0];
|
||||
else if (pickList.size() > 1)
|
||||
return *pickList[(unsigned long)Utils::random() % (unsigned long)pickList.size()];
|
||||
return InetAddress::NIL;
|
||||
}
|
||||
|
||||
private:
|
||||
Identity _defaultIdentity;
|
||||
std::vector<InetAddress> _defaultAddresses;
|
||||
Str _dnsName;
|
||||
Locator _lastFetchedLocator;
|
||||
unsigned int _dnsPublicKeySize;
|
||||
uint8_t _dnsPublicKey[ZT_ECC384_PUBLIC_KEY_SIZE];
|
||||
};
|
||||
|
||||
} // namespace ZeroTier
|
||||
|
||||
#endif
|
30
attic/listaddrinfo.go
Normal file
30
attic/listaddrinfo.go
Normal file
|
@ -0,0 +1,30 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net"
|
||||
)
|
||||
|
||||
func main() {
|
||||
ifs, err := net.Interfaces()
|
||||
if err != nil {
|
||||
fmt.Printf("Error: %s\n", err.Error())
|
||||
return
|
||||
}
|
||||
for _, i := range ifs {
|
||||
fmt.Printf("name: %s\n", i.Name)
|
||||
fmt.Printf("hwaddr: %s\n", i.HardwareAddr.String())
|
||||
fmt.Printf("index: %d\n", i.Index)
|
||||
fmt.Printf("addrs:\n")
|
||||
addrs, _ := i.Addrs()
|
||||
for _, a := range addrs {
|
||||
fmt.Printf(" %s\n", a.String())
|
||||
}
|
||||
fmt.Printf("multicast:\n")
|
||||
mc, _ := i.MulticastAddrs()
|
||||
for _, m := range mc {
|
||||
fmt.Printf(" %s\n", m.String())
|
||||
}
|
||||
fmt.Printf("\n")
|
||||
}
|
||||
}
|
|
@ -60,14 +60,14 @@ endif
|
|||
# Debug mode -- dump trace output, build binary with -g
|
||||
ifeq ($(ZT_DEBUG),1)
|
||||
ZT_TRACE=1
|
||||
CFLAGS+=-Wall -g $(INCLUDES) $(DEFS)
|
||||
CFLAGS+=-Wall -g -maes -mpclmul $(INCLUDES) $(DEFS)
|
||||
STRIP=echo
|
||||
# The following line enables optimization for the crypto code, since
|
||||
# C25519 in particular is almost UNUSABLE in heavy testing without it.
|
||||
node/Salsa20.o node/SHA512.o node/C25519.o node/Poly1305.o: CFLAGS = -Wall -O2 -g $(INCLUDES) $(DEFS)
|
||||
node/Salsa20.o node/SHA512.o node/C25519.o node/Poly1305.o node/AES.o: CFLAGS = -Wall -O2 -g -maes -mpclmul $(INCLUDES) $(DEFS)
|
||||
else
|
||||
CFLAGS?=-Ofast -fstack-protector-strong
|
||||
CFLAGS+=$(ARCH_FLAGS) -Wall -flto -fPIE -mmacosx-version-min=10.7 -DNDEBUG -Wno-unused-private-field $(INCLUDES) $(DEFS)
|
||||
CFLAGS+=$(ARCH_FLAGS) -Wall -flto -fPIE -maes -msse -msse2 -msse3 -mpclmul -mmacosx-version-min=10.9 -DNDEBUG -Wno-unused-private-field $(INCLUDES) $(DEFS)
|
||||
STRIP=strip
|
||||
endif
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
CORE_OBJS=\
|
||||
node/AES.o \
|
||||
node/C25519.o \
|
||||
node/Capability.o \
|
||||
node/CertificateOfMembership.o \
|
||||
node/CertificateOfOwnership.o \
|
||||
node/Credential.o \
|
||||
node/ECC384.o \
|
||||
node/Identity.o \
|
||||
node/IncomingPacket.o \
|
||||
node/InetAddress.o \
|
||||
|
@ -16,13 +16,10 @@ CORE_OBJS=\
|
|||
node/Path.o \
|
||||
node/Peer.o \
|
||||
node/Poly1305.o \
|
||||
node/Revocation.o \
|
||||
node/Salsa20.o \
|
||||
node/SelfAwareness.o \
|
||||
node/SHA512.o \
|
||||
node/Switch.o \
|
||||
node/Tag.o \
|
||||
node/Topology.o \
|
||||
node/Trace.o \
|
||||
node/Utils.o
|
||||
|
|
@ -66,7 +66,6 @@
|
|||
#include "node/Utils.hpp"
|
||||
#include "node/NetworkController.hpp"
|
||||
#include "node/Buffer.hpp"
|
||||
#include "node/World.hpp"
|
||||
|
||||
#include "osdep/OSUtils.hpp"
|
||||
#include "osdep/Http.hpp"
|
||||
|
@ -95,10 +94,9 @@ static OneService *volatile zt1Service = (OneService *)0;
|
|||
static void cliPrintHelp(const char *pn,FILE *out)
|
||||
{
|
||||
fprintf(out,
|
||||
"%s version %d.%d.%d build %d (platform %d arch %d)" ZT_EOL_S,
|
||||
"%s version %d.%d.%d build %d" ZT_EOL_S,
|
||||
PROGRAM_NAME,
|
||||
ZEROTIER_ONE_VERSION_MAJOR, ZEROTIER_ONE_VERSION_MINOR, ZEROTIER_ONE_VERSION_REVISION, ZEROTIER_ONE_VERSION_BUILD,
|
||||
ZT_BUILD_PLATFORM, ZT_BUILD_ARCHITECTURE);
|
||||
ZEROTIER_ONE_VERSION_MAJOR, ZEROTIER_ONE_VERSION_MINOR, ZEROTIER_ONE_VERSION_REVISION, ZEROTIER_ONE_VERSION_BUILD);
|
||||
fprintf(out,
|
||||
COPYRIGHT_NOTICE ZT_EOL_S
|
||||
LICENSE_GRANT ZT_EOL_S);
|
||||
|
@ -119,9 +117,6 @@ static void cliPrintHelp(const char *pn,FILE *out)
|
|||
fprintf(out," leave <network> - Leave a network" ZT_EOL_S);
|
||||
fprintf(out," set <network> <setting> - Set a network setting" ZT_EOL_S);
|
||||
fprintf(out," get <network> <setting> - Get a network setting" ZT_EOL_S);
|
||||
fprintf(out," listmoons - List moons (federated root sets)" ZT_EOL_S);
|
||||
fprintf(out," orbit <world ID> <seed> - Join a moon via any member root" ZT_EOL_S);
|
||||
fprintf(out," deorbit <world ID> - Leave a moon" ZT_EOL_S);
|
||||
fprintf(out,ZT_EOL_S"Available settings:" ZT_EOL_S);
|
||||
fprintf(out," Settings to use with [get/set] may include property names from " ZT_EOL_S);
|
||||
fprintf(out," the JSON output of \"zerotier-cli -j listnetworks\". Additionally, " ZT_EOL_S);
|
||||
|
@ -576,80 +571,6 @@ static int cli(int argc,char **argv)
|
|||
printf("%u %s %s" ZT_EOL_S,scode,command.c_str(),responseBody.c_str());
|
||||
return 1;
|
||||
}
|
||||
} else if (command == "listmoons") {
|
||||
const unsigned int scode = Http::GET(1024 * 1024 * 16,60000,(const struct sockaddr *)&addr,"/moon",requestHeaders,responseHeaders,responseBody);
|
||||
|
||||
if (scode == 0) {
|
||||
printf("Error connecting to the ZeroTier service: %s\n\nPlease check that the service is running and that TCP port 9993 can be contacted via 127.0.0.1." ZT_EOL_S, responseBody.c_str());
|
||||
return 1;
|
||||
}
|
||||
|
||||
nlohmann::json j;
|
||||
try {
|
||||
j = OSUtils::jsonParse(responseBody);
|
||||
} catch (std::exception &exc) {
|
||||
printf("%u %s invalid JSON response (%s)" ZT_EOL_S,scode,command.c_str(),exc.what());
|
||||
return 1;
|
||||
} catch ( ... ) {
|
||||
printf("%u %s invalid JSON response (unknown exception)" ZT_EOL_S,scode,command.c_str());
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (scode == 200) {
|
||||
printf("%s" ZT_EOL_S,OSUtils::jsonDump(j).c_str());
|
||||
return 0;
|
||||
} else {
|
||||
printf("%u %s %s" ZT_EOL_S,scode,command.c_str(),responseBody.c_str());
|
||||
return 1;
|
||||
}
|
||||
} else if (command == "orbit") {
|
||||
const uint64_t worldId = Utils::hexStrToU64(arg1.c_str());
|
||||
const uint64_t seed = Utils::hexStrToU64(arg2.c_str());
|
||||
if ((worldId)&&(seed)) {
|
||||
char jsons[1024];
|
||||
OSUtils::ztsnprintf(jsons,sizeof(jsons),"{\"seed\":\"%s\"}",arg2.c_str());
|
||||
char cl[128];
|
||||
OSUtils::ztsnprintf(cl,sizeof(cl),"%u",(unsigned int)strlen(jsons));
|
||||
requestHeaders["Content-Type"] = "application/json";
|
||||
requestHeaders["Content-Length"] = cl;
|
||||
unsigned int scode = Http::POST(
|
||||
1024 * 1024 * 16,
|
||||
60000,
|
||||
(const struct sockaddr *)&addr,
|
||||
(std::string("/moon/") + arg1).c_str(),
|
||||
requestHeaders,
|
||||
jsons,
|
||||
(unsigned long)strlen(jsons),
|
||||
responseHeaders,
|
||||
responseBody);
|
||||
if (scode == 200) {
|
||||
printf("200 orbit OK" ZT_EOL_S);
|
||||
return 0;
|
||||
} else {
|
||||
printf("%u %s %s" ZT_EOL_S,scode,command.c_str(),responseBody.c_str());
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
} else if (command == "deorbit") {
|
||||
unsigned int scode = Http::DEL(
|
||||
1024 * 1024 * 16,
|
||||
60000,
|
||||
(const struct sockaddr *)&addr,
|
||||
(std::string("/moon/") + arg1).c_str(),
|
||||
requestHeaders,
|
||||
responseHeaders,
|
||||
responseBody);
|
||||
if (scode == 200) {
|
||||
if (json) {
|
||||
printf("%s",cliFixJsonCRs(responseBody).c_str());
|
||||
} else {
|
||||
printf("200 deorbit OK" ZT_EOL_S);
|
||||
}
|
||||
return 0;
|
||||
} else {
|
||||
printf("%u %s %s" ZT_EOL_S,scode,command.c_str(),responseBody.c_str());
|
||||
return 1;
|
||||
}
|
||||
} else if (command == "set") {
|
||||
if (arg1.length() != 16) {
|
||||
fprintf(stderr,"invalid format: must be a 16-digit (network) ID\n");
|
||||
|
@ -812,8 +733,6 @@ static void idtoolPrintHelp(FILE *out,const char *pn)
|
|||
fprintf(out," getpublic <identity.secret>" ZT_EOL_S);
|
||||
fprintf(out," sign <identity.secret> <file>" ZT_EOL_S);
|
||||
fprintf(out," verify <identity.secret/public> <file> <signature>" ZT_EOL_S);
|
||||
fprintf(out," initmoon <identity.public of first seed>" ZT_EOL_S);
|
||||
fprintf(out," genmoon <moon json>" ZT_EOL_S);
|
||||
}
|
||||
|
||||
static Identity getIdFromArg(char *arg)
|
||||
|
@ -855,7 +774,7 @@ static int idtool(int argc,char **argv)
|
|||
|
||||
Identity id;
|
||||
for(;;) {
|
||||
id.generate();
|
||||
id.generate(Identity::C25519);
|
||||
if ((id.address().toInt() >> (40 - vanityBits)) == vanity) {
|
||||
if (vanityBits > 0) {
|
||||
fprintf(stderr,"vanity address: found %.10llx !\n",(unsigned long long)id.address().toInt());
|
||||
|
@ -933,9 +852,10 @@ static int idtool(int argc,char **argv)
|
|||
fprintf(stderr,"%s is not readable" ZT_EOL_S,argv[3]);
|
||||
return 1;
|
||||
}
|
||||
C25519::Signature signature = id.sign(inf.data(),(unsigned int)inf.length());
|
||||
char hexbuf[1024];
|
||||
printf("%s",Utils::hex(signature.data,ZT_C25519_SIGNATURE_LEN,hexbuf));
|
||||
uint8_t signature[ZT_SIGNATURE_BUFFER_SIZE];
|
||||
const unsigned int siglen = id.sign(inf.data(),(unsigned int)inf.length(),signature,sizeof(signature));
|
||||
char hexbuf[256];
|
||||
printf("%s",Utils::hex(signature,siglen,hexbuf));
|
||||
} else if (!strcmp(argv[1],"verify")) {
|
||||
if (argc < 5) {
|
||||
idtoolPrintHelp(stdout,argv[0]);
|
||||
|
@ -973,94 +893,6 @@ static int idtool(int argc,char **argv)
|
|||
return 1;
|
||||
}
|
||||
}
|
||||
} else if (!strcmp(argv[1],"initmoon")) {
|
||||
if (argc < 3) {
|
||||
idtoolPrintHelp(stdout,argv[0]);
|
||||
} else {
|
||||
const Identity id = getIdFromArg(argv[2]);
|
||||
if (!id) {
|
||||
fprintf(stderr,"%s is not a valid identity" ZT_EOL_S,argv[2]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
C25519::Pair kp(C25519::generate());
|
||||
|
||||
char idtmp[4096];
|
||||
nlohmann::json mj;
|
||||
mj["objtype"] = "world";
|
||||
mj["worldType"] = "moon";
|
||||
mj["updatesMustBeSignedBy"] = mj["signingKey"] = Utils::hex(kp.pub.data,ZT_C25519_PUBLIC_KEY_LEN,idtmp);
|
||||
mj["signingKey_SECRET"] = Utils::hex(kp.priv.data,ZT_C25519_PRIVATE_KEY_LEN,idtmp);
|
||||
mj["id"] = id.address().toString(idtmp);
|
||||
nlohmann::json seedj;
|
||||
seedj["identity"] = id.toString(false,idtmp);
|
||||
seedj["stableEndpoints"] = nlohmann::json::array();
|
||||
(mj["roots"] = nlohmann::json::array()).push_back(seedj);
|
||||
std::string mjd(OSUtils::jsonDump(mj));
|
||||
|
||||
printf("%s" ZT_EOL_S,mjd.c_str());
|
||||
}
|
||||
} else if (!strcmp(argv[1],"genmoon")) {
|
||||
if (argc < 3) {
|
||||
idtoolPrintHelp(stdout,argv[0]);
|
||||
} else {
|
||||
std::string buf;
|
||||
if (!OSUtils::readFile(argv[2],buf)) {
|
||||
fprintf(stderr,"cannot read %s" ZT_EOL_S,argv[2]);
|
||||
return 1;
|
||||
}
|
||||
nlohmann::json mj(OSUtils::jsonParse(buf));
|
||||
|
||||
const uint64_t id = Utils::hexStrToU64(OSUtils::jsonString(mj["id"],"0").c_str());
|
||||
if (!id) {
|
||||
fprintf(stderr,"ID in %s is invalid" ZT_EOL_S,argv[2]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
World::Type t;
|
||||
if (mj["worldType"] == "moon") {
|
||||
t = World::TYPE_MOON;
|
||||
} else if (mj["worldType"] == "planet") {
|
||||
t = World::TYPE_PLANET;
|
||||
} else {
|
||||
fprintf(stderr,"invalid worldType" ZT_EOL_S);
|
||||
return 1;
|
||||
}
|
||||
|
||||
C25519::Pair signingKey;
|
||||
C25519::Public updatesMustBeSignedBy;
|
||||
Utils::unhex(OSUtils::jsonString(mj["signingKey"],"").c_str(),signingKey.pub.data,ZT_C25519_PUBLIC_KEY_LEN);
|
||||
Utils::unhex(OSUtils::jsonString(mj["signingKey_SECRET"],"").c_str(),signingKey.priv.data,ZT_C25519_PRIVATE_KEY_LEN);
|
||||
Utils::unhex(OSUtils::jsonString(mj["updatesMustBeSignedBy"],"").c_str(),updatesMustBeSignedBy.data,ZT_C25519_PUBLIC_KEY_LEN);
|
||||
|
||||
std::vector<World::Root> roots;
|
||||
nlohmann::json &rootsj = mj["roots"];
|
||||
if (rootsj.is_array()) {
|
||||
for(unsigned long i=0;i<(unsigned long)rootsj.size();++i) {
|
||||
nlohmann::json &r = rootsj[i];
|
||||
if (r.is_object()) {
|
||||
roots.push_back(World::Root());
|
||||
roots.back().identity = Identity(OSUtils::jsonString(r["identity"],"").c_str());
|
||||
nlohmann::json &stableEndpointsj = r["stableEndpoints"];
|
||||
if (stableEndpointsj.is_array()) {
|
||||
for(unsigned long k=0;k<(unsigned long)stableEndpointsj.size();++k)
|
||||
roots.back().stableEndpoints.push_back(InetAddress(OSUtils::jsonString(stableEndpointsj[k],"").c_str()));
|
||||
std::sort(roots.back().stableEndpoints.begin(),roots.back().stableEndpoints.end());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
std::sort(roots.begin(),roots.end());
|
||||
|
||||
const int64_t now = OSUtils::now();
|
||||
World w(World::make(t,id,now,updatesMustBeSignedBy,roots,signingKey));
|
||||
Buffer<ZT_WORLD_MAX_SERIALIZED_LENGTH> wbuf;
|
||||
w.serialize(wbuf);
|
||||
char fn[128];
|
||||
OSUtils::ztsnprintf(fn,sizeof(fn),"%.16llx.moon",w.id());
|
||||
OSUtils::writeFile(fn,wbuf.data(),wbuf.size());
|
||||
printf("wrote %s (signed world with timestamp %llu)" ZT_EOL_S,fn,(unsigned long long)now);
|
||||
}
|
||||
} else {
|
||||
idtoolPrintHelp(stdout,argv[0]);
|
||||
return 1;
|
17
attic/service/CMakeLists.txt
Normal file
17
attic/service/CMakeLists.txt
Normal file
|
@ -0,0 +1,17 @@
|
|||
cmake_minimum_required(VERSION 2.8)
|
||||
project(zt_service)
|
||||
|
||||
if(WIN32)
|
||||
add_definitions(-DNOMINMAX)
|
||||
endif(WIN32)
|
||||
|
||||
set(src
|
||||
OneService.cpp
|
||||
)
|
||||
|
||||
set(headers
|
||||
OneService.hpp
|
||||
)
|
||||
|
||||
add_library(${PROJECT_NAME} STATIC ${src} ${headers})
|
||||
target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_11)
|
File diff suppressed because it is too large
Load diff
|
@ -1,7 +0,0 @@
|
|||
World Definitions and Generator Code
|
||||
======
|
||||
|
||||
This little bit of code is used to generate world updates. Ordinary users probably will never need this unless they want to test or experiment.
|
||||
|
||||
See mkworld.cpp for documentation. To build from this directory use 'source ./build.sh'.
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
c++ -std=c++11 -I../.. -I.. -g -o mkworld ../../node/C25519.cpp ../../node/Salsa20.cpp ../../node/SHA512.cpp ../../node/Identity.cpp ../../node/Utils.cpp ../../node/InetAddress.cpp ../../osdep/OSUtils.cpp mkworld.cpp -lm
|
|
@ -1,173 +0,0 @@
|
|||
/*
|
||||
* ZeroTier One - Network Virtualization Everywhere
|
||||
* Copyright (C) 2011-2016 ZeroTier, Inc. https://www.zerotier.com/
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This utility makes the World from the configuration specified below.
|
||||
* It probably won't be much use to anyone outside ZeroTier, Inc. except
|
||||
* for testing and experimentation purposes.
|
||||
*
|
||||
* If you want to make your own World you must edit this file.
|
||||
*
|
||||
* When run, it expects two files in the current directory:
|
||||
*
|
||||
* previous.c25519 - key pair to sign this world (key from previous world)
|
||||
* current.c25519 - key pair whose public key should be embedded in this world
|
||||
*
|
||||
* If these files do not exist, they are both created with the same key pair
|
||||
* and a self-signed initial World is born.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
|
||||
#include <node/Constants.hpp>
|
||||
#include <node/World.hpp>
|
||||
#include <node/C25519.hpp>
|
||||
#include <node/Identity.hpp>
|
||||
#include <node/InetAddress.hpp>
|
||||
#include <osdep/OSUtils.hpp>
|
||||
|
||||
using namespace ZeroTier;
|
||||
|
||||
int main(int argc,char **argv)
|
||||
{
|
||||
std::string previous,current;
|
||||
if ((!OSUtils::readFile("previous.c25519",previous))||(!OSUtils::readFile("current.c25519",current))) {
|
||||
C25519::Pair np(C25519::generate());
|
||||
previous = std::string();
|
||||
previous.append((const char *)np.pub.data,ZT_C25519_PUBLIC_KEY_LEN);
|
||||
previous.append((const char *)np.priv.data,ZT_C25519_PRIVATE_KEY_LEN);
|
||||
current = previous;
|
||||
OSUtils::writeFile("previous.c25519",previous);
|
||||
OSUtils::writeFile("current.c25519",current);
|
||||
fprintf(stderr,"INFO: created initial world keys: previous.c25519 and current.c25519 (both initially the same)" ZT_EOL_S);
|
||||
}
|
||||
|
||||
if ((previous.length() != (ZT_C25519_PUBLIC_KEY_LEN + ZT_C25519_PRIVATE_KEY_LEN))||(current.length() != (ZT_C25519_PUBLIC_KEY_LEN + ZT_C25519_PRIVATE_KEY_LEN))) {
|
||||
fprintf(stderr,"FATAL: previous.c25519 or current.c25519 empty or invalid" ZT_EOL_S);
|
||||
return 1;
|
||||
}
|
||||
C25519::Pair previousKP;
|
||||
memcpy(previousKP.pub.data,previous.data(),ZT_C25519_PUBLIC_KEY_LEN);
|
||||
memcpy(previousKP.priv.data,previous.data() + ZT_C25519_PUBLIC_KEY_LEN,ZT_C25519_PRIVATE_KEY_LEN);
|
||||
C25519::Pair currentKP;
|
||||
memcpy(currentKP.pub.data,current.data(),ZT_C25519_PUBLIC_KEY_LEN);
|
||||
memcpy(currentKP.priv.data,current.data() + ZT_C25519_PUBLIC_KEY_LEN,ZT_C25519_PRIVATE_KEY_LEN);
|
||||
|
||||
// =========================================================================
|
||||
// EDIT BELOW HERE
|
||||
|
||||
std::vector<World::Root> roots;
|
||||
|
||||
const uint64_t id = ZT_WORLD_ID_EARTH;
|
||||
const uint64_t ts = 1567191349589ULL; // August 30th, 2019
|
||||
|
||||
// Los Angeles
|
||||
roots.push_back(World::Root());
|
||||
roots.back().identity = Identity("3a46f1bf30:0:76e66fab33e28549a62ee2064d1843273c2c300ba45c3f20bef02dbad225723bb59a9bb4b13535730961aeecf5a163ace477cceb0727025b99ac14a5166a09a3");
|
||||
roots.back().stableEndpoints.push_back(InetAddress("185.180.13.82/9993"));
|
||||
roots.back().stableEndpoints.push_back(InetAddress("2a02:6ea0:c815::/9993"));
|
||||
|
||||
// Miami
|
||||
roots.push_back(World::Root());
|
||||
roots.back().identity = Identity("de8950a8b2:0:1b3ada8251b91b6b6fa6535b8c7e2460918f4f729abdec97d3c7f3796868fb02f0de0b0ee554b2d59fc3524743eebfcf5315e790ed6d92db5bd10c28c09b40ef");
|
||||
roots.back().stableEndpoints.push_back(InetAddress("207.246.73.245/443"));
|
||||
roots.back().stableEndpoints.push_back(InetAddress("2001:19f0:9002:5cb:ec4:7aff:fe8f:69d9/443"));
|
||||
|
||||
// Tokyo
|
||||
roots.push_back(World::Root());
|
||||
roots.back().identity = Identity("34e0a5e174:0:93efb50934788f856d5cfb9ca5be88e85b40965586b75befac900df77352c145a1ba7007569d37c77bfe52c0999f3bdc67a47a4a6000b720a883ce47aa2fb7f8");
|
||||
roots.back().stableEndpoints.push_back(InetAddress("147.75.92.2/443"));
|
||||
roots.back().stableEndpoints.push_back(InetAddress("2604:1380:3000:7100::1/443"));
|
||||
|
||||
// Amsterdam
|
||||
roots.push_back(World::Root());
|
||||
roots.back().identity = Identity("992fcf1db7:0:206ed59350b31916f749a1f85dffb3a8787dcbf83b8c6e9448d4e3ea0e3369301be716c3609344a9d1533850fb4460c50af43322bcfc8e13d3301a1f1003ceb6");
|
||||
roots.back().stableEndpoints.push_back(InetAddress("195.181.173.159/443"));
|
||||
roots.back().stableEndpoints.push_back(InetAddress("2a02:6ea0:c024::/443"));
|
||||
|
||||
// Alice
|
||||
//roots.push_back(World::Root());
|
||||
//roots.back().identity = Identity("9d219039f3:0:01f0922a98e3b34ebcbff333269dc265d7a020aab69d72be4d4acc9c8c9294785771256cd1d942a90d1bd1d2dca3ea84ef7d85afe6611fb43ff0b74126d90a6e");
|
||||
//roots.back().stableEndpoints.push_back(InetAddress("188.166.94.177/9993")); // Amsterdam
|
||||
//roots.back().stableEndpoints.push_back(InetAddress("2a03:b0c0:2:d0::7d:1/9993")); // Amsterdam
|
||||
//roots.back().stableEndpoints.push_back(InetAddress("154.66.197.33/9993")); // Johannesburg
|
||||
//roots.back().stableEndpoints.push_back(InetAddress("2c0f:f850:154:197::33/9993")); // Johannesburg
|
||||
//roots.back().stableEndpoints.push_back(InetAddress("159.203.97.171/9993")); // New York
|
||||
//roots.back().stableEndpoints.push_back(InetAddress("2604:a880:800:a1::54:6001/9993")); // New York
|
||||
//roots.back().stableEndpoints.push_back(InetAddress("131.255.6.16/9993")); // Buenos Aires
|
||||
//roots.back().stableEndpoints.push_back(InetAddress("2803:eb80:0:e::2/9993")); // Buenos Aires
|
||||
//roots.back().stableEndpoints.push_back(InetAddress("107.170.197.14/9993")); // San Francisco
|
||||
//roots.back().stableEndpoints.push_back(InetAddress("2604:a880:1:20::200:e001/9993")); // San Francisco
|
||||
//roots.back().stableEndpoints.push_back(InetAddress("128.199.197.217/9993")); // Singapore
|
||||
//roots.back().stableEndpoints.push_back(InetAddress("2400:6180:0:d0::b7:4001/9993")); // Singapore
|
||||
|
||||
// Bob
|
||||
//roots.push_back(World::Root());
|
||||
//roots.back().identity = Identity("8841408a2e:0:bb1d31f2c323e264e9e64172c1a74f77899555ed10751cd56e86405cde118d02dffe555d462ccf6a85b5631c12350c8d5dc409ba10b9025d0f445cf449d92b1c");
|
||||
//roots.back().stableEndpoints.push_back(InetAddress("45.32.198.130/9993")); // Dallas
|
||||
//roots.back().stableEndpoints.push_back(InetAddress("2001:19f0:6400:81c3:5400:00ff:fe18:1d61/9993")); // Dallas
|
||||
//roots.back().stableEndpoints.push_back(InetAddress("46.101.160.249/9993")); // Frankfurt
|
||||
//roots.back().stableEndpoints.push_back(InetAddress("2a03:b0c0:3:d0::6a:3001/9993")); // Frankfurt
|
||||
//roots.back().stableEndpoints.push_back(InetAddress("107.191.46.210/9993")); // Paris
|
||||
//roots.back().stableEndpoints.push_back(InetAddress("2001:19f0:6800:83a4::64/9993")); // Paris
|
||||
//roots.back().stableEndpoints.push_back(InetAddress("45.32.246.179/9993")); // Sydney
|
||||
//roots.back().stableEndpoints.push_back(InetAddress("2001:19f0:5800:8bf8:5400:ff:fe15:b39a/9993")); // Sydney
|
||||
//roots.back().stableEndpoints.push_back(InetAddress("45.32.248.87/9993")); // Tokyo
|
||||
//roots.back().stableEndpoints.push_back(InetAddress("2001:19f0:7000:9bc9:5400:00ff:fe15:c4f5/9993")); // Tokyo
|
||||
//roots.back().stableEndpoints.push_back(InetAddress("159.203.2.154/9993")); // Toronto
|
||||
//roots.back().stableEndpoints.push_back(InetAddress("2604:a880:cad:d0::26:7001/9993")); // Toronto
|
||||
|
||||
// END WORLD DEFINITION
|
||||
// =========================================================================
|
||||
|
||||
fprintf(stderr,"INFO: generating and signing id==%llu ts==%llu" ZT_EOL_S,(unsigned long long)id,(unsigned long long)ts);
|
||||
|
||||
World nw = World::make(World::TYPE_PLANET,id,ts,currentKP.pub,roots,previousKP);
|
||||
|
||||
Buffer<ZT_WORLD_MAX_SERIALIZED_LENGTH> outtmp;
|
||||
nw.serialize(outtmp,false);
|
||||
World testw;
|
||||
testw.deserialize(outtmp,0);
|
||||
if (testw != nw) {
|
||||
fprintf(stderr,"FATAL: serialization test failed!" ZT_EOL_S);
|
||||
return 1;
|
||||
}
|
||||
|
||||
OSUtils::writeFile("world.bin",std::string((const char *)outtmp.data(),outtmp.size()));
|
||||
fprintf(stderr,"INFO: world.bin written with %u bytes of binary world data." ZT_EOL_S,outtmp.size());
|
||||
|
||||
fprintf(stdout,ZT_EOL_S);
|
||||
fprintf(stdout,"#define ZT_DEFAULT_WORLD_LENGTH %u" ZT_EOL_S,outtmp.size());
|
||||
fprintf(stdout,"static const unsigned char ZT_DEFAULT_WORLD[ZT_DEFAULT_WORLD_LENGTH] = {");
|
||||
for(unsigned int i=0;i<outtmp.size();++i) {
|
||||
const unsigned char *d = (const unsigned char *)outtmp.data();
|
||||
if (i > 0)
|
||||
fprintf(stdout,",");
|
||||
fprintf(stdout,"0x%.2x",(unsigned int)d[i]);
|
||||
}
|
||||
fprintf(stdout,"};" ZT_EOL_S);
|
||||
|
||||
return 0;
|
||||
}
|
Binary file not shown.
|
@ -1,3 +0,0 @@
|
|||
|
||||
#define ZT_DEFAULT_WORLD_LENGTH 732
|
||||
static const unsigned char ZT_DEFAULT_WORLD[ZT_DEFAULT_WORLD_LENGTH] = {0x01,0x00,0x00,0x00,0x00,0x08,0xea,0xc9,0x0a,0x00,0x00,0x01,0x6b,0xd4,0x16,0x08,0xc1,0xb8,0xb3,0x88,0xa4,0x69,0x22,0x14,0x91,0xaa,0x9a,0xcd,0x66,0xcc,0x76,0x4c,0xde,0xfd,0x56,0x03,0x9f,0x10,0x67,0xae,0x15,0xe6,0x9c,0x6f,0xb4,0x2d,0x7b,0x55,0x33,0x0e,0x3f,0xda,0xac,0x52,0x9c,0x07,0x92,0xfd,0x73,0x40,0xa6,0xaa,0x21,0xab,0xa8,0xa4,0x89,0xfd,0xae,0xa4,0x4a,0x39,0xbf,0x2d,0x00,0x65,0x9a,0xc9,0xc8,0x18,0xeb,0x16,0x93,0xf4,0xe5,0xbd,0x20,0xda,0x10,0xad,0xc7,0x05,0xf4,0x99,0xfe,0x04,0x08,0x9b,0xe0,0x9e,0x77,0x1d,0x9f,0x47,0x16,0xaa,0x92,0x4f,0x10,0x16,0x3d,0xc7,0xec,0xd3,0x90,0x9e,0xd1,0x74,0xfc,0xb3,0xb5,0x07,0x9c,0x4d,0x95,0xc5,0x17,0x8b,0x3d,0x0b,0x60,0x76,0xe8,0x51,0xbb,0xb6,0x3d,0x74,0xb5,0x21,0x83,0x7b,0x95,0x1d,0x02,0x9b,0xcd,0xaf,0x5c,0x3e,0x96,0xdf,0x37,0x2c,0x56,0x6d,0xfa,0x75,0x0f,0xda,0x55,0x85,0x13,0xf4,0x76,0x1a,0x66,0x4d,0x3b,0x8d,0xcf,0x12,0xc9,0x34,0xb9,0x0d,0x61,0x03,0x3a,0x46,0xf1,0xbf,0x30,0x00,0x76,0xe6,0x6f,0xab,0x33,0xe2,0x85,0x49,0xa6,0x2e,0xe2,0x06,0x4d,0x18,0x43,0x27,0x3c,0x2c,0x30,0x0b,0xa4,0x5c,0x3f,0x20,0xbe,0xf0,0x2d,0xba,0xd2,0x25,0x72,0x3b,0xb5,0x9a,0x9b,0xb4,0xb1,0x35,0x35,0x73,0x09,0x61,0xae,0xec,0xf5,0xa1,0x63,0xac,0xe4,0x77,0xcc,0xeb,0x07,0x27,0x02,0x5b,0x99,0xac,0x14,0xa5,0x16,0x6a,0x09,0xa3,0x00,0x02,0x04,0xb9,0xb4,0x0d,0x52,0x27,0x09,0x06,0x2a,0x02,0x6e,0xa0,0xc8,0x15,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x27,0x09,0x9d,0x21,0x90,0x39,0xf3,0x00,0x01,0xf0,0x92,0x2a,0x98,0xe3,0xb3,0x4e,0xbc,0xbf,0xf3,0x33,0x26,0x9d,0xc2,0x65,0xd7,0xa0,0x20,0xaa,0xb6,0x9d,0x72,0xbe,0x4d,0x4a,0xcc,0x9c,0x8c,0x92,0x94,0x78,0x57,0x71,0x25,0x6c,0xd1,0xd9,0x42,0xa9,0x0d,0x1b,0xd1,0xd2,0xdc,0xa3,0xea,0x84,0xef,0x7d,0x85,0xaf,0xe6,0x61,0x1f,0xb4,0x3f,0xf0,0xb7,0x41,0x26,0xd9,0x0a,0x6e,0x00,0x0c,0x04,0xbc,0xa6,0x5e,0xb1,0x27,0x09,0x06,0x2a,0x03,0xb0,0xc0,0x00,0x02,0x00,0xd0,0x00,0x00,0x00,0x00,0x00,0x7d,0x00,0x01,0x27,0x09,0x04,0x9a,0x42,0xc5,0x21,0x27,0x09,0x06,0x2c,0x0f,0xf8,0x50,0x01,0x54,0x01,0x97,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x33,0x27,0x09,0x04,0x9f,0xcb,0x61,0xab,0x27,0x09,0x06,0x26,0x04,0xa8,0x80,0x08,0x00,0x00,0xa1,0x00,0x00,0x00,0x00,0x00,0x54,0x60,0x01,0x27,0x09,0x04,0x83,0xff,0x06,0x10,0x27,0x09,0x06,0x28,0x03,0xeb,0x80,0x00,0x00,0x00,0x0e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x27,0x09,0x04,0x6b,0xaa,0xc5,0x0e,0x27,0x09,0x06,0x26,0x04,0xa8,0x80,0x00,0x01,0x00,0x20,0x00,0x00,0x00,0x00,0x02,0x00,0xe0,0x01,0x27,0x09,0x04,0x80,0xc7,0xc5,0xd9,0x27,0x09,0x06,0x24,0x00,0x61,0x80,0x00,0x00,0x00,0xd0,0x00,0x00,0x00,0x00,0x00,0xb7,0x40,0x01,0x27,0x09,0x88,0x41,0x40,0x8a,0x2e,0x00,0xbb,0x1d,0x31,0xf2,0xc3,0x23,0xe2,0x64,0xe9,0xe6,0x41,0x72,0xc1,0xa7,0x4f,0x77,0x89,0x95,0x55,0xed,0x10,0x75,0x1c,0xd5,0x6e,0x86,0x40,0x5c,0xde,0x11,0x8d,0x02,0xdf,0xfe,0x55,0x5d,0x46,0x2c,0xcf,0x6a,0x85,0xb5,0x63,0x1c,0x12,0x35,0x0c,0x8d,0x5d,0xc4,0x09,0xba,0x10,0xb9,0x02,0x5d,0x0f,0x44,0x5c,0xf4,0x49,0xd9,0x2b,0x1c,0x00,0x0c,0x04,0x2d,0x20,0xc6,0x82,0x27,0x09,0x06,0x20,0x01,0x19,0xf0,0x64,0x00,0x81,0xc3,0x54,0x00,0x00,0xff,0xfe,0x18,0x1d,0x61,0x27,0x09,0x04,0x2e,0x65,0xa0,0xf9,0x27,0x09,0x06,0x2a,0x03,0xb0,0xc0,0x00,0x03,0x00,0xd0,0x00,0x00,0x00,0x00,0x00,0x6a,0x30,0x01,0x27,0x09,0x04,0x6b,0xbf,0x2e,0xd2,0x27,0x09,0x06,0x20,0x01,0x19,0xf0,0x68,0x00,0x83,0xa4,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x64,0x27,0x09,0x04,0x2d,0x20,0xf6,0xb3,0x27,0x09,0x06,0x20,0x01,0x19,0xf0,0x58,0x00,0x8b,0xf8,0x54,0x00,0x00,0xff,0xfe,0x15,0xb3,0x9a,0x27,0x09,0x04,0x2d,0x20,0xf8,0x57,0x27,0x09,0x06,0x20,0x01,0x19,0xf0,0x70,0x00,0x9b,0xc9,0x54,0x00,0x00,0xff,0xfe,0x15,0xc4,0xf5,0x27,0x09,0x04,0x9f,0xcb,0x02,0x9a,0x27,0x09,0x06,0x26,0x04,0xa8,0x80,0x0c,0xad,0x00,0xd0,0x00,0x00,0x00,0x00,0x00,0x26,0x70,0x01,0x27,0x09};
|
36
controller/CMakeLists.txt
Normal file
36
controller/CMakeLists.txt
Normal file
|
@ -0,0 +1,36 @@
|
|||
cmake_minimum_required(VERSION 2.8)
|
||||
project(zt_controller)
|
||||
|
||||
if(WIN32)
|
||||
add_definitions(-DNOMINMAX)
|
||||
endif(WIN32)
|
||||
|
||||
set(ctl_src
|
||||
DB.cpp
|
||||
DBMirrorSet.cpp
|
||||
EmbeddedNetworkController.cpp
|
||||
FileDB.cpp
|
||||
LFDB.cpp
|
||||
RabbitMQ.cpp
|
||||
)
|
||||
|
||||
set(ctl_hdr
|
||||
DB.hpp
|
||||
DBMirrorSet.hpp
|
||||
EmbeddedNetworkController.hpp
|
||||
FileDB.hpp
|
||||
LFDB.hpp
|
||||
RabbitMQ.hpp
|
||||
)
|
||||
|
||||
if(BUILD_CENTRAL_CONTROLLER)
|
||||
add_definitions(-DZT_CONTROLLER_USE_LIBPQ)
|
||||
include_directories("../ext/librabbitmq/librabbitmq" ${PostgreSQL_INCLUDE_DIRS})
|
||||
|
||||
set(ctl_src ${ctl_src} PostgreSQL.cpp)
|
||||
set(ctl_hdr ${ctl_hdr} PostgreSQL.hpp)
|
||||
endif(BUILD_CENTRAL_CONTROLLER)
|
||||
|
||||
add_library(${PROJECT_NAME} STATIC ${ctl_src} ${ctl_hdr})
|
||||
target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_11)
|
||||
|
|
@ -36,7 +36,7 @@ DBMirrorSet::DBMirrorSet(DB::ChangeListener *listener) :
|
|||
}
|
||||
|
||||
for(auto db=dbs.begin();db!=dbs.end();++db) {
|
||||
(*db)->each([this,&dbs,&db](uint64_t networkId,const nlohmann::json &network,uint64_t memberId,const nlohmann::json &member) {
|
||||
(*db)->each([&dbs,&db](uint64_t networkId,const nlohmann::json &network,uint64_t memberId,const nlohmann::json &member) {
|
||||
try {
|
||||
if (network.is_object()) {
|
||||
if (memberId == 0) {
|
||||
|
|
|
@ -29,8 +29,14 @@
|
|||
#include <thread>
|
||||
#include <memory>
|
||||
|
||||
#include "../node/Constants.hpp"
|
||||
#include "../node/Node.hpp"
|
||||
#include "../node/CertificateOfMembership.hpp"
|
||||
#include "../node/NetworkConfig.hpp"
|
||||
#include "../node/Dictionary.hpp"
|
||||
#include "../node/MAC.hpp"
|
||||
|
||||
#include "../include/ZeroTierOne.h"
|
||||
#include "../version.h"
|
||||
|
||||
#include "EmbeddedNetworkController.hpp"
|
||||
#include "LFDB.hpp"
|
||||
|
@ -39,12 +45,6 @@
|
|||
#include "PostgreSQL.hpp"
|
||||
#endif
|
||||
|
||||
#include "../node/Node.hpp"
|
||||
#include "../node/CertificateOfMembership.hpp"
|
||||
#include "../node/NetworkConfig.hpp"
|
||||
#include "../node/Dictionary.hpp"
|
||||
#include "../node/MAC.hpp"
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
// API version reported via JSON control plane
|
||||
|
@ -548,8 +548,6 @@ void EmbeddedNetworkController::request(
|
|||
|
||||
unsigned int EmbeddedNetworkController::handleControlPlaneHttpGET(
|
||||
const std::vector<std::string> &path,
|
||||
const std::map<std::string,std::string> &urlArgs,
|
||||
const std::map<std::string,std::string> &headers,
|
||||
const std::string &body,
|
||||
std::string &responseBody,
|
||||
std::string &responseContentType)
|
||||
|
@ -645,8 +643,6 @@ unsigned int EmbeddedNetworkController::handleControlPlaneHttpGET(
|
|||
|
||||
unsigned int EmbeddedNetworkController::handleControlPlaneHttpPOST(
|
||||
const std::vector<std::string> &path,
|
||||
const std::map<std::string,std::string> &urlArgs,
|
||||
const std::map<std::string,std::string> &headers,
|
||||
const std::string &body,
|
||||
std::string &responseBody,
|
||||
std::string &responseContentType)
|
||||
|
@ -1055,8 +1051,6 @@ unsigned int EmbeddedNetworkController::handleControlPlaneHttpPOST(
|
|||
|
||||
unsigned int EmbeddedNetworkController::handleControlPlaneHttpDELETE(
|
||||
const std::vector<std::string> &path,
|
||||
const std::map<std::string,std::string> &urlArgs,
|
||||
const std::map<std::string,std::string> &headers,
|
||||
const std::string &body,
|
||||
std::string &responseBody,
|
||||
std::string &responseContentType)
|
||||
|
@ -1113,56 +1107,6 @@ unsigned int EmbeddedNetworkController::handleControlPlaneHttpDELETE(
|
|||
return 404;
|
||||
}
|
||||
|
||||
void EmbeddedNetworkController::handleRemoteTrace(const ZT_RemoteTrace &rt)
|
||||
{
|
||||
static volatile unsigned long idCounter = 0;
|
||||
char id[128],tmp[128];
|
||||
std::string k,v;
|
||||
|
||||
try {
|
||||
// Convert Dictionary into JSON object
|
||||
json d;
|
||||
char *saveptr = (char *)0;
|
||||
for(char *l=Utils::stok(rt.data,"\n",&saveptr);(l);l=Utils::stok((char *)0,"\n",&saveptr)) {
|
||||
char *eq = strchr(l,'=');
|
||||
if (eq > l) {
|
||||
k.assign(l,(unsigned long)(eq - l));
|
||||
v.clear();
|
||||
++eq;
|
||||
while (*eq) {
|
||||
if (*eq == '\\') {
|
||||
++eq;
|
||||
if (*eq) {
|
||||
switch(*eq) {
|
||||
case 'r': v.push_back('\r'); break;
|
||||
case 'n': v.push_back('\n'); break;
|
||||
case '0': v.push_back((char)0); break;
|
||||
case 'e': v.push_back('='); break;
|
||||
default: v.push_back(*eq); break;
|
||||
}
|
||||
++eq;
|
||||
}
|
||||
} else {
|
||||
v.push_back(*(eq++));
|
||||
}
|
||||
}
|
||||
if ((k.length() > 0)&&(v.length() > 0))
|
||||
d[k] = v;
|
||||
}
|
||||
}
|
||||
|
||||
const int64_t now = OSUtils::now();
|
||||
OSUtils::ztsnprintf(id,sizeof(id),"%.10llx-%.16llx-%.10llx-%.4x",_signingId.address().toInt(),now,rt.origin,(unsigned int)(idCounter++ & 0xffff));
|
||||
d["id"] = id;
|
||||
d["objtype"] = "trace";
|
||||
d["ts"] = now;
|
||||
d["nodeId"] = Utils::hex10(rt.origin,tmp);
|
||||
_db.save(d,true);
|
||||
} catch ( ... ) {
|
||||
// drop invalid trace messages if an error occurs
|
||||
}
|
||||
}
|
||||
|
||||
void EmbeddedNetworkController::onNetworkUpdate(const void *db,uint64_t networkId,const nlohmann::json &network)
|
||||
{
|
||||
// Send an update to all members of the network that are online
|
||||
|
@ -1188,7 +1132,7 @@ void EmbeddedNetworkController::onNetworkMemberUpdate(const void *db,uint64_t ne
|
|||
void EmbeddedNetworkController::onNetworkMemberDeauthorize(const void *db,uint64_t networkId,uint64_t memberId)
|
||||
{
|
||||
const int64_t now = OSUtils::now();
|
||||
Revocation rev((uint32_t)_node->prng(),networkId,0,now,ZT_REVOCATION_FLAG_FAST_PROPAGATE,Address(memberId),Revocation::CREDENTIAL_TYPE_COM);
|
||||
Revocation rev((uint32_t)Utils::random(),networkId,0,now,ZT_REVOCATION_FLAG_FAST_PROPAGATE,Address(memberId),Revocation::CREDENTIAL_TYPE_COM);
|
||||
rev.sign(_signingId);
|
||||
{
|
||||
std::lock_guard<std::mutex> l(_memberStatus_l);
|
||||
|
@ -1704,7 +1648,7 @@ void EmbeddedNetworkController::_request(
|
|||
|
||||
DB::cleanMember(member);
|
||||
_db.save(member,true);
|
||||
_sender->ncSendConfig(nwid,requestPacketId,identity.address(),*(nc.get()),metaData.getUI(ZT_NETWORKCONFIG_REQUEST_METADATA_KEY_VERSION,0) < 6);
|
||||
_sender->ncSendConfig(nwid,requestPacketId,identity.address(),*(nc.get()),false);
|
||||
}
|
||||
|
||||
void EmbeddedNetworkController::_startThreads()
|
||||
|
|
|
@ -51,6 +51,7 @@ class EmbeddedNetworkController : public NetworkController,public DB::ChangeList
|
|||
public:
|
||||
/**
|
||||
* @param node Parent node
|
||||
* @param ztPath ZeroTier base path
|
||||
* @param dbPath Database path (file path or database credentials)
|
||||
*/
|
||||
EmbeddedNetworkController(Node *node,const char *ztPath,const char *dbPath, int listenPort, MQConfig *mqc = NULL);
|
||||
|
@ -67,28 +68,20 @@ public:
|
|||
|
||||
unsigned int handleControlPlaneHttpGET(
|
||||
const std::vector<std::string> &path,
|
||||
const std::map<std::string,std::string> &urlArgs,
|
||||
const std::map<std::string,std::string> &headers,
|
||||
const std::string &body,
|
||||
std::string &responseBody,
|
||||
std::string &responseContentType);
|
||||
unsigned int handleControlPlaneHttpPOST(
|
||||
const std::vector<std::string> &path,
|
||||
const std::map<std::string,std::string> &urlArgs,
|
||||
const std::map<std::string,std::string> &headers,
|
||||
const std::string &body,
|
||||
std::string &responseBody,
|
||||
std::string &responseContentType);
|
||||
unsigned int handleControlPlaneHttpDELETE(
|
||||
const std::vector<std::string> &path,
|
||||
const std::map<std::string,std::string> &urlArgs,
|
||||
const std::map<std::string,std::string> &headers,
|
||||
const std::string &body,
|
||||
std::string &responseBody,
|
||||
std::string &responseContentType);
|
||||
|
||||
void handleRemoteTrace(const ZT_RemoteTrace &rt);
|
||||
|
||||
virtual void onNetworkUpdate(const void *db,uint64_t networkId,const nlohmann::json &network);
|
||||
virtual void onNetworkMemberUpdate(const void *db,uint64_t networkId,uint64_t memberId,const nlohmann::json &member);
|
||||
virtual void onNetworkMemberDeauthorize(const void *db,uint64_t networkId,uint64_t memberId);
|
||||
|
|
|
@ -20,13 +20,11 @@ FileDB::FileDB(const char *path) :
|
|||
DB(),
|
||||
_path(path),
|
||||
_networksPath(_path + ZT_PATH_SEPARATOR_S + "network"),
|
||||
_tracePath(_path + ZT_PATH_SEPARATOR_S + "trace"),
|
||||
_running(true)
|
||||
{
|
||||
OSUtils::mkdir(_path.c_str());
|
||||
OSUtils::lockDownFile(_path.c_str(),true);
|
||||
OSUtils::mkdir(_networksPath.c_str());
|
||||
OSUtils::mkdir(_tracePath.c_str());
|
||||
|
||||
std::vector<std::string> networks(OSUtils::listDirectory(_networksPath.c_str(),false));
|
||||
std::string buf;
|
||||
|
|
|
@ -35,7 +35,6 @@ public:
|
|||
protected:
|
||||
std::string _path;
|
||||
std::string _networksPath;
|
||||
std::string _tracePath;
|
||||
std::thread _onlineUpdateThread;
|
||||
std::map< uint64_t,std::map<uint64_t,std::map<int64_t,InetAddress> > > _online;
|
||||
std::mutex _online_l;
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
ARM NEON (32-bit) ASM implementation of Salsa20/12
|
||||
======
|
||||
|
||||
This is from [supercop](http://bench.cr.yp.to/supercop.html) and was originally written by Daniel J. Bernstein. Code is in the public domain like the rest of Salsa20. It's much faster than the naive implementation.
|
||||
|
||||
It's included automatically in 32-bit Linux ARM builds. It likely will not work on 64-bit ARM, so it'll need to be ported at least. That will unfortunately keep it out of mobile versions for now since those are all going 64-bit.
|
|
@ -1,25 +0,0 @@
|
|||
#ifndef ZT_SALSA2012_ARM32NEON_ASM
|
||||
#define ZT_SALSA2012_ARM32NEON_ASM
|
||||
|
||||
#if defined(__linux__) || defined(linux) || defined(__LINUX__) || defined(__linux)
|
||||
#include <sys/auxv.h>
|
||||
#include <asm/hwcap.h>
|
||||
#define zt_arm_has_neon() ((getauxval(AT_HWCAP) & HWCAP_NEON) != 0)
|
||||
#elif defined(__ARM_NEON__) || defined(__ARM_NEON)
|
||||
#define zt_arm_has_neon() (true)
|
||||
#else
|
||||
#define zt_arm_has_neon() (false)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// ciphertext buffer, message/NULL, length, nonce (8 bytes), key (32 bytes)
|
||||
extern int zt_salsa2012_armneon3_xor(unsigned char *c,const unsigned char *m,unsigned long long len,const unsigned char *n,const unsigned char *k);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,77 +0,0 @@
|
|||
#ifndef __CURL_CURLVER_H
|
||||
#define __CURL_CURLVER_H
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at https://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/* This header file contains nothing but libcurl version info, generated by
|
||||
a script at release-time. This was made its own header file in 7.11.2 */
|
||||
|
||||
/* This is the global package copyright */
|
||||
#define LIBCURL_COPYRIGHT "1996 - 2017 Daniel Stenberg, <daniel@haxx.se>."
|
||||
|
||||
/* This is the version number of the libcurl package from which this header
|
||||
file origins: */
|
||||
#define LIBCURL_VERSION "7.58.0"
|
||||
|
||||
/* The numeric version number is also available "in parts" by using these
|
||||
defines: */
|
||||
#define LIBCURL_VERSION_MAJOR 7
|
||||
#define LIBCURL_VERSION_MINOR 58
|
||||
#define LIBCURL_VERSION_PATCH 0
|
||||
|
||||
/* This is the numeric version of the libcurl version number, meant for easier
|
||||
parsing and comparions by programs. The LIBCURL_VERSION_NUM define will
|
||||
always follow this syntax:
|
||||
|
||||
0xXXYYZZ
|
||||
|
||||
Where XX, YY and ZZ are the main version, release and patch numbers in
|
||||
hexadecimal (using 8 bits each). All three numbers are always represented
|
||||
using two digits. 1.2 would appear as "0x010200" while version 9.11.7
|
||||
appears as "0x090b07".
|
||||
|
||||
This 6-digit (24 bits) hexadecimal number does not show pre-release number,
|
||||
and it is always a greater number in a more recent release. It makes
|
||||
comparisons with greater than and less than work.
|
||||
|
||||
Note: This define is the full hex number and _does not_ use the
|
||||
CURL_VERSION_BITS() macro since curl's own configure script greps for it
|
||||
and needs it to contain the full number.
|
||||
*/
|
||||
#define LIBCURL_VERSION_NUM 0x073a00
|
||||
|
||||
/*
|
||||
* This is the date and time when the full source package was created. The
|
||||
* timestamp is not stored in git, as the timestamp is properly set in the
|
||||
* tarballs by the maketgz script.
|
||||
*
|
||||
* The format of the date follows this template:
|
||||
*
|
||||
* "2007-11-23"
|
||||
*/
|
||||
#define LIBCURL_TIMESTAMP "2018-01-24"
|
||||
|
||||
#define CURL_VERSION_BITS(x,y,z) ((x)<<16|(y)<<8|z)
|
||||
#define CURL_AT_LEAST_VERSION(x,y,z) \
|
||||
(LIBCURL_VERSION_NUM >= CURL_VERSION_BITS(x, y, z))
|
||||
|
||||
#endif /* __CURL_CURLVER_H */
|
|
@ -1,102 +0,0 @@
|
|||
#ifndef __CURL_EASY_H
|
||||
#define __CURL_EASY_H
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at https://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
***************************************************************************/
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
CURL_EXTERN CURL *curl_easy_init(void);
|
||||
CURL_EXTERN CURLcode curl_easy_setopt(CURL *curl, CURLoption option, ...);
|
||||
CURL_EXTERN CURLcode curl_easy_perform(CURL *curl);
|
||||
CURL_EXTERN void curl_easy_cleanup(CURL *curl);
|
||||
|
||||
/*
|
||||
* NAME curl_easy_getinfo()
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* Request internal information from the curl session with this function. The
|
||||
* third argument MUST be a pointer to a long, a pointer to a char * or a
|
||||
* pointer to a double (as the documentation describes elsewhere). The data
|
||||
* pointed to will be filled in accordingly and can be relied upon only if the
|
||||
* function returns CURLE_OK. This function is intended to get used *AFTER* a
|
||||
* performed transfer, all results from this function are undefined until the
|
||||
* transfer is completed.
|
||||
*/
|
||||
CURL_EXTERN CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ...);
|
||||
|
||||
|
||||
/*
|
||||
* NAME curl_easy_duphandle()
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* Creates a new curl session handle with the same options set for the handle
|
||||
* passed in. Duplicating a handle could only be a matter of cloning data and
|
||||
* options, internal state info and things like persistent connections cannot
|
||||
* be transferred. It is useful in multithreaded applications when you can run
|
||||
* curl_easy_duphandle() for each new thread to avoid a series of identical
|
||||
* curl_easy_setopt() invokes in every thread.
|
||||
*/
|
||||
CURL_EXTERN CURL *curl_easy_duphandle(CURL *curl);
|
||||
|
||||
/*
|
||||
* NAME curl_easy_reset()
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* Re-initializes a CURL handle to the default values. This puts back the
|
||||
* handle to the same state as it was in when it was just created.
|
||||
*
|
||||
* It does keep: live connections, the Session ID cache, the DNS cache and the
|
||||
* cookies.
|
||||
*/
|
||||
CURL_EXTERN void curl_easy_reset(CURL *curl);
|
||||
|
||||
/*
|
||||
* NAME curl_easy_recv()
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* Receives data from the connected socket. Use after successful
|
||||
* curl_easy_perform() with CURLOPT_CONNECT_ONLY option.
|
||||
*/
|
||||
CURL_EXTERN CURLcode curl_easy_recv(CURL *curl, void *buffer, size_t buflen,
|
||||
size_t *n);
|
||||
|
||||
/*
|
||||
* NAME curl_easy_send()
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* Sends data over the connected socket. Use after successful
|
||||
* curl_easy_perform() with CURLOPT_CONNECT_ONLY option.
|
||||
*/
|
||||
CURL_EXTERN CURLcode curl_easy_send(CURL *curl, const void *buffer,
|
||||
size_t buflen, size_t *n);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -1,50 +0,0 @@
|
|||
#ifndef __CURL_MPRINTF_H
|
||||
#define __CURL_MPRINTF_H
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at https://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h> /* needed for FILE */
|
||||
#include "curl.h" /* for CURL_EXTERN */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
CURL_EXTERN int curl_mprintf(const char *format, ...);
|
||||
CURL_EXTERN int curl_mfprintf(FILE *fd, const char *format, ...);
|
||||
CURL_EXTERN int curl_msprintf(char *buffer, const char *format, ...);
|
||||
CURL_EXTERN int curl_msnprintf(char *buffer, size_t maxlength,
|
||||
const char *format, ...);
|
||||
CURL_EXTERN int curl_mvprintf(const char *format, va_list args);
|
||||
CURL_EXTERN int curl_mvfprintf(FILE *fd, const char *format, va_list args);
|
||||
CURL_EXTERN int curl_mvsprintf(char *buffer, const char *format, va_list args);
|
||||
CURL_EXTERN int curl_mvsnprintf(char *buffer, size_t maxlength,
|
||||
const char *format, va_list args);
|
||||
CURL_EXTERN char *curl_maprintf(const char *format, ...);
|
||||
CURL_EXTERN char *curl_mvaprintf(const char *format, va_list args);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __CURL_MPRINTF_H */
|
|
@ -1,439 +0,0 @@
|
|||
#ifndef __CURL_MULTI_H
|
||||
#define __CURL_MULTI_H
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at https://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
***************************************************************************/
|
||||
/*
|
||||
This is an "external" header file. Don't give away any internals here!
|
||||
|
||||
GOALS
|
||||
|
||||
o Enable a "pull" interface. The application that uses libcurl decides where
|
||||
and when to ask libcurl to get/send data.
|
||||
|
||||
o Enable multiple simultaneous transfers in the same thread without making it
|
||||
complicated for the application.
|
||||
|
||||
o Enable the application to select() on its own file descriptors and curl's
|
||||
file descriptors simultaneous easily.
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
* This header file should not really need to include "curl.h" since curl.h
|
||||
* itself includes this file and we expect user applications to do #include
|
||||
* <curl/curl.h> without the need for especially including multi.h.
|
||||
*
|
||||
* For some reason we added this include here at one point, and rather than to
|
||||
* break existing (wrongly written) libcurl applications, we leave it as-is
|
||||
* but with this warning attached.
|
||||
*/
|
||||
#include "curl.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(BUILDING_LIBCURL) || defined(CURL_STRICTER)
|
||||
typedef struct Curl_multi CURLM;
|
||||
#else
|
||||
typedef void CURLM;
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
CURLM_CALL_MULTI_PERFORM = -1, /* please call curl_multi_perform() or
|
||||
curl_multi_socket*() soon */
|
||||
CURLM_OK,
|
||||
CURLM_BAD_HANDLE, /* the passed-in handle is not a valid CURLM handle */
|
||||
CURLM_BAD_EASY_HANDLE, /* an easy handle was not good/valid */
|
||||
CURLM_OUT_OF_MEMORY, /* if you ever get this, you're in deep sh*t */
|
||||
CURLM_INTERNAL_ERROR, /* this is a libcurl bug */
|
||||
CURLM_BAD_SOCKET, /* the passed in socket argument did not match */
|
||||
CURLM_UNKNOWN_OPTION, /* curl_multi_setopt() with unsupported option */
|
||||
CURLM_ADDED_ALREADY, /* an easy handle already added to a multi handle was
|
||||
attempted to get added - again */
|
||||
CURLM_LAST
|
||||
} CURLMcode;
|
||||
|
||||
/* just to make code nicer when using curl_multi_socket() you can now check
|
||||
for CURLM_CALL_MULTI_SOCKET too in the same style it works for
|
||||
curl_multi_perform() and CURLM_CALL_MULTI_PERFORM */
|
||||
#define CURLM_CALL_MULTI_SOCKET CURLM_CALL_MULTI_PERFORM
|
||||
|
||||
/* bitmask bits for CURLMOPT_PIPELINING */
|
||||
#define CURLPIPE_NOTHING 0L
|
||||
#define CURLPIPE_HTTP1 1L
|
||||
#define CURLPIPE_MULTIPLEX 2L
|
||||
|
||||
typedef enum {
|
||||
CURLMSG_NONE, /* first, not used */
|
||||
CURLMSG_DONE, /* This easy handle has completed. 'result' contains
|
||||
the CURLcode of the transfer */
|
||||
CURLMSG_LAST /* last, not used */
|
||||
} CURLMSG;
|
||||
|
||||
struct CURLMsg {
|
||||
CURLMSG msg; /* what this message means */
|
||||
CURL *easy_handle; /* the handle it concerns */
|
||||
union {
|
||||
void *whatever; /* message-specific data */
|
||||
CURLcode result; /* return code for transfer */
|
||||
} data;
|
||||
};
|
||||
typedef struct CURLMsg CURLMsg;
|
||||
|
||||
/* Based on poll(2) structure and values.
|
||||
* We don't use pollfd and POLL* constants explicitly
|
||||
* to cover platforms without poll(). */
|
||||
#define CURL_WAIT_POLLIN 0x0001
|
||||
#define CURL_WAIT_POLLPRI 0x0002
|
||||
#define CURL_WAIT_POLLOUT 0x0004
|
||||
|
||||
struct curl_waitfd {
|
||||
curl_socket_t fd;
|
||||
short events;
|
||||
short revents; /* not supported yet */
|
||||
};
|
||||
|
||||
/*
|
||||
* Name: curl_multi_init()
|
||||
*
|
||||
* Desc: inititalize multi-style curl usage
|
||||
*
|
||||
* Returns: a new CURLM handle to use in all 'curl_multi' functions.
|
||||
*/
|
||||
CURL_EXTERN CURLM *curl_multi_init(void);
|
||||
|
||||
/*
|
||||
* Name: curl_multi_add_handle()
|
||||
*
|
||||
* Desc: add a standard curl handle to the multi stack
|
||||
*
|
||||
* Returns: CURLMcode type, general multi error code.
|
||||
*/
|
||||
CURL_EXTERN CURLMcode curl_multi_add_handle(CURLM *multi_handle,
|
||||
CURL *curl_handle);
|
||||
|
||||
/*
|
||||
* Name: curl_multi_remove_handle()
|
||||
*
|
||||
* Desc: removes a curl handle from the multi stack again
|
||||
*
|
||||
* Returns: CURLMcode type, general multi error code.
|
||||
*/
|
||||
CURL_EXTERN CURLMcode curl_multi_remove_handle(CURLM *multi_handle,
|
||||
CURL *curl_handle);
|
||||
|
||||
/*
|
||||
* Name: curl_multi_fdset()
|
||||
*
|
||||
* Desc: Ask curl for its fd_set sets. The app can use these to select() or
|
||||
* poll() on. We want curl_multi_perform() called as soon as one of
|
||||
* them are ready.
|
||||
*
|
||||
* Returns: CURLMcode type, general multi error code.
|
||||
*/
|
||||
CURL_EXTERN CURLMcode curl_multi_fdset(CURLM *multi_handle,
|
||||
fd_set *read_fd_set,
|
||||
fd_set *write_fd_set,
|
||||
fd_set *exc_fd_set,
|
||||
int *max_fd);
|
||||
|
||||
/*
|
||||
* Name: curl_multi_wait()
|
||||
*
|
||||
* Desc: Poll on all fds within a CURLM set as well as any
|
||||
* additional fds passed to the function.
|
||||
*
|
||||
* Returns: CURLMcode type, general multi error code.
|
||||
*/
|
||||
CURL_EXTERN CURLMcode curl_multi_wait(CURLM *multi_handle,
|
||||
struct curl_waitfd extra_fds[],
|
||||
unsigned int extra_nfds,
|
||||
int timeout_ms,
|
||||
int *ret);
|
||||
|
||||
/*
|
||||
* Name: curl_multi_perform()
|
||||
*
|
||||
* Desc: When the app thinks there's data available for curl it calls this
|
||||
* function to read/write whatever there is right now. This returns
|
||||
* as soon as the reads and writes are done. This function does not
|
||||
* require that there actually is data available for reading or that
|
||||
* data can be written, it can be called just in case. It returns
|
||||
* the number of handles that still transfer data in the second
|
||||
* argument's integer-pointer.
|
||||
*
|
||||
* Returns: CURLMcode type, general multi error code. *NOTE* that this only
|
||||
* returns errors etc regarding the whole multi stack. There might
|
||||
* still have occurred problems on invidual transfers even when this
|
||||
* returns OK.
|
||||
*/
|
||||
CURL_EXTERN CURLMcode curl_multi_perform(CURLM *multi_handle,
|
||||
int *running_handles);
|
||||
|
||||
/*
|
||||
* Name: curl_multi_cleanup()
|
||||
*
|
||||
* Desc: Cleans up and removes a whole multi stack. It does not free or
|
||||
* touch any individual easy handles in any way. We need to define
|
||||
* in what state those handles will be if this function is called
|
||||
* in the middle of a transfer.
|
||||
*
|
||||
* Returns: CURLMcode type, general multi error code.
|
||||
*/
|
||||
CURL_EXTERN CURLMcode curl_multi_cleanup(CURLM *multi_handle);
|
||||
|
||||
/*
|
||||
* Name: curl_multi_info_read()
|
||||
*
|
||||
* Desc: Ask the multi handle if there's any messages/informationals from
|
||||
* the individual transfers. Messages include informationals such as
|
||||
* error code from the transfer or just the fact that a transfer is
|
||||
* completed. More details on these should be written down as well.
|
||||
*
|
||||
* Repeated calls to this function will return a new struct each
|
||||
* time, until a special "end of msgs" struct is returned as a signal
|
||||
* that there is no more to get at this point.
|
||||
*
|
||||
* The data the returned pointer points to will not survive calling
|
||||
* curl_multi_cleanup().
|
||||
*
|
||||
* The 'CURLMsg' struct is meant to be very simple and only contain
|
||||
* very basic information. If more involved information is wanted,
|
||||
* we will provide the particular "transfer handle" in that struct
|
||||
* and that should/could/would be used in subsequent
|
||||
* curl_easy_getinfo() calls (or similar). The point being that we
|
||||
* must never expose complex structs to applications, as then we'll
|
||||
* undoubtably get backwards compatibility problems in the future.
|
||||
*
|
||||
* Returns: A pointer to a filled-in struct, or NULL if it failed or ran out
|
||||
* of structs. It also writes the number of messages left in the
|
||||
* queue (after this read) in the integer the second argument points
|
||||
* to.
|
||||
*/
|
||||
CURL_EXTERN CURLMsg *curl_multi_info_read(CURLM *multi_handle,
|
||||
int *msgs_in_queue);
|
||||
|
||||
/*
|
||||
* Name: curl_multi_strerror()
|
||||
*
|
||||
* Desc: The curl_multi_strerror function may be used to turn a CURLMcode
|
||||
* value into the equivalent human readable error string. This is
|
||||
* useful for printing meaningful error messages.
|
||||
*
|
||||
* Returns: A pointer to a zero-terminated error message.
|
||||
*/
|
||||
CURL_EXTERN const char *curl_multi_strerror(CURLMcode);
|
||||
|
||||
/*
|
||||
* Name: curl_multi_socket() and
|
||||
* curl_multi_socket_all()
|
||||
*
|
||||
* Desc: An alternative version of curl_multi_perform() that allows the
|
||||
* application to pass in one of the file descriptors that have been
|
||||
* detected to have "action" on them and let libcurl perform.
|
||||
* See man page for details.
|
||||
*/
|
||||
#define CURL_POLL_NONE 0
|
||||
#define CURL_POLL_IN 1
|
||||
#define CURL_POLL_OUT 2
|
||||
#define CURL_POLL_INOUT 3
|
||||
#define CURL_POLL_REMOVE 4
|
||||
|
||||
#define CURL_SOCKET_TIMEOUT CURL_SOCKET_BAD
|
||||
|
||||
#define CURL_CSELECT_IN 0x01
|
||||
#define CURL_CSELECT_OUT 0x02
|
||||
#define CURL_CSELECT_ERR 0x04
|
||||
|
||||
typedef int (*curl_socket_callback)(CURL *easy, /* easy handle */
|
||||
curl_socket_t s, /* socket */
|
||||
int what, /* see above */
|
||||
void *userp, /* private callback
|
||||
pointer */
|
||||
void *socketp); /* private socket
|
||||
pointer */
|
||||
/*
|
||||
* Name: curl_multi_timer_callback
|
||||
*
|
||||
* Desc: Called by libcurl whenever the library detects a change in the
|
||||
* maximum number of milliseconds the app is allowed to wait before
|
||||
* curl_multi_socket() or curl_multi_perform() must be called
|
||||
* (to allow libcurl's timed events to take place).
|
||||
*
|
||||
* Returns: The callback should return zero.
|
||||
*/
|
||||
typedef int (*curl_multi_timer_callback)(CURLM *multi, /* multi handle */
|
||||
long timeout_ms, /* see above */
|
||||
void *userp); /* private callback
|
||||
pointer */
|
||||
|
||||
CURL_EXTERN CURLMcode curl_multi_socket(CURLM *multi_handle, curl_socket_t s,
|
||||
int *running_handles);
|
||||
|
||||
CURL_EXTERN CURLMcode curl_multi_socket_action(CURLM *multi_handle,
|
||||
curl_socket_t s,
|
||||
int ev_bitmask,
|
||||
int *running_handles);
|
||||
|
||||
CURL_EXTERN CURLMcode curl_multi_socket_all(CURLM *multi_handle,
|
||||
int *running_handles);
|
||||
|
||||
#ifndef CURL_ALLOW_OLD_MULTI_SOCKET
|
||||
/* This macro below was added in 7.16.3 to push users who recompile to use
|
||||
the new curl_multi_socket_action() instead of the old curl_multi_socket()
|
||||
*/
|
||||
#define curl_multi_socket(x,y,z) curl_multi_socket_action(x,y,0,z)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Name: curl_multi_timeout()
|
||||
*
|
||||
* Desc: Returns the maximum number of milliseconds the app is allowed to
|
||||
* wait before curl_multi_socket() or curl_multi_perform() must be
|
||||
* called (to allow libcurl's timed events to take place).
|
||||
*
|
||||
* Returns: CURLM error code.
|
||||
*/
|
||||
CURL_EXTERN CURLMcode curl_multi_timeout(CURLM *multi_handle,
|
||||
long *milliseconds);
|
||||
|
||||
#undef CINIT /* re-using the same name as in curl.h */
|
||||
|
||||
#ifdef CURL_ISOCPP
|
||||
#define CINIT(name,type,num) CURLMOPT_ ## name = CURLOPTTYPE_ ## type + num
|
||||
#else
|
||||
/* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */
|
||||
#define LONG CURLOPTTYPE_LONG
|
||||
#define OBJECTPOINT CURLOPTTYPE_OBJECTPOINT
|
||||
#define FUNCTIONPOINT CURLOPTTYPE_FUNCTIONPOINT
|
||||
#define OFF_T CURLOPTTYPE_OFF_T
|
||||
#define CINIT(name,type,number) CURLMOPT_/**/name = type + number
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
/* This is the socket callback function pointer */
|
||||
CINIT(SOCKETFUNCTION, FUNCTIONPOINT, 1),
|
||||
|
||||
/* This is the argument passed to the socket callback */
|
||||
CINIT(SOCKETDATA, OBJECTPOINT, 2),
|
||||
|
||||
/* set to 1 to enable pipelining for this multi handle */
|
||||
CINIT(PIPELINING, LONG, 3),
|
||||
|
||||
/* This is the timer callback function pointer */
|
||||
CINIT(TIMERFUNCTION, FUNCTIONPOINT, 4),
|
||||
|
||||
/* This is the argument passed to the timer callback */
|
||||
CINIT(TIMERDATA, OBJECTPOINT, 5),
|
||||
|
||||
/* maximum number of entries in the connection cache */
|
||||
CINIT(MAXCONNECTS, LONG, 6),
|
||||
|
||||
/* maximum number of (pipelining) connections to one host */
|
||||
CINIT(MAX_HOST_CONNECTIONS, LONG, 7),
|
||||
|
||||
/* maximum number of requests in a pipeline */
|
||||
CINIT(MAX_PIPELINE_LENGTH, LONG, 8),
|
||||
|
||||
/* a connection with a content-length longer than this
|
||||
will not be considered for pipelining */
|
||||
CINIT(CONTENT_LENGTH_PENALTY_SIZE, OFF_T, 9),
|
||||
|
||||
/* a connection with a chunk length longer than this
|
||||
will not be considered for pipelining */
|
||||
CINIT(CHUNK_LENGTH_PENALTY_SIZE, OFF_T, 10),
|
||||
|
||||
/* a list of site names(+port) that are blacklisted from
|
||||
pipelining */
|
||||
CINIT(PIPELINING_SITE_BL, OBJECTPOINT, 11),
|
||||
|
||||
/* a list of server types that are blacklisted from
|
||||
pipelining */
|
||||
CINIT(PIPELINING_SERVER_BL, OBJECTPOINT, 12),
|
||||
|
||||
/* maximum number of open connections in total */
|
||||
CINIT(MAX_TOTAL_CONNECTIONS, LONG, 13),
|
||||
|
||||
/* This is the server push callback function pointer */
|
||||
CINIT(PUSHFUNCTION, FUNCTIONPOINT, 14),
|
||||
|
||||
/* This is the argument passed to the server push callback */
|
||||
CINIT(PUSHDATA, OBJECTPOINT, 15),
|
||||
|
||||
CURLMOPT_LASTENTRY /* the last unused */
|
||||
} CURLMoption;
|
||||
|
||||
|
||||
/*
|
||||
* Name: curl_multi_setopt()
|
||||
*
|
||||
* Desc: Sets options for the multi handle.
|
||||
*
|
||||
* Returns: CURLM error code.
|
||||
*/
|
||||
CURL_EXTERN CURLMcode curl_multi_setopt(CURLM *multi_handle,
|
||||
CURLMoption option, ...);
|
||||
|
||||
|
||||
/*
|
||||
* Name: curl_multi_assign()
|
||||
*
|
||||
* Desc: This function sets an association in the multi handle between the
|
||||
* given socket and a private pointer of the application. This is
|
||||
* (only) useful for curl_multi_socket uses.
|
||||
*
|
||||
* Returns: CURLM error code.
|
||||
*/
|
||||
CURL_EXTERN CURLMcode curl_multi_assign(CURLM *multi_handle,
|
||||
curl_socket_t sockfd, void *sockp);
|
||||
|
||||
|
||||
/*
|
||||
* Name: curl_push_callback
|
||||
*
|
||||
* Desc: This callback gets called when a new stream is being pushed by the
|
||||
* server. It approves or denies the new stream.
|
||||
*
|
||||
* Returns: CURL_PUSH_OK or CURL_PUSH_DENY.
|
||||
*/
|
||||
#define CURL_PUSH_OK 0
|
||||
#define CURL_PUSH_DENY 1
|
||||
|
||||
struct curl_pushheaders; /* forward declaration only */
|
||||
|
||||
CURL_EXTERN char *curl_pushheader_bynum(struct curl_pushheaders *h,
|
||||
size_t num);
|
||||
CURL_EXTERN char *curl_pushheader_byname(struct curl_pushheaders *h,
|
||||
const char *name);
|
||||
|
||||
typedef int (*curl_push_callback)(CURL *parent,
|
||||
CURL *easy,
|
||||
size_t num_headers,
|
||||
struct curl_pushheaders *headers,
|
||||
void *userp);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* end of extern "C" */
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -1,33 +0,0 @@
|
|||
#ifndef __STDC_HEADERS_H
|
||||
#define __STDC_HEADERS_H
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at https://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
size_t fread(void *, size_t, size_t, FILE *);
|
||||
size_t fwrite(const void *, size_t, size_t, FILE *);
|
||||
|
||||
int strcasecmp(const char *, const char *);
|
||||
int strncasecmp(const char *, const char *, size_t);
|
||||
|
||||
#endif /* __STDC_HEADERS_H */
|
|
@ -1,473 +0,0 @@
|
|||
#ifndef __CURL_SYSTEM_H
|
||||
#define __CURL_SYSTEM_H
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at https://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/*
|
||||
* Try to keep one section per platform, compiler and architecture, otherwise,
|
||||
* if an existing section is reused for a different one and later on the
|
||||
* original is adjusted, probably the piggybacking one can be adversely
|
||||
* changed.
|
||||
*
|
||||
* In order to differentiate between platforms/compilers/architectures use
|
||||
* only compiler built in predefined preprocessor symbols.
|
||||
*
|
||||
* curl_off_t
|
||||
* ----------
|
||||
*
|
||||
* For any given platform/compiler curl_off_t must be typedef'ed to a 64-bit
|
||||
* wide signed integral data type. The width of this data type must remain
|
||||
* constant and independent of any possible large file support settings.
|
||||
*
|
||||
* As an exception to the above, curl_off_t shall be typedef'ed to a 32-bit
|
||||
* wide signed integral data type if there is no 64-bit type.
|
||||
*
|
||||
* As a general rule, curl_off_t shall not be mapped to off_t. This rule shall
|
||||
* only be violated if off_t is the only 64-bit data type available and the
|
||||
* size of off_t is independent of large file support settings. Keep your
|
||||
* build on the safe side avoiding an off_t gating. If you have a 64-bit
|
||||
* off_t then take for sure that another 64-bit data type exists, dig deeper
|
||||
* and you will find it.
|
||||
*
|
||||
*/
|
||||
|
||||
#if defined(__DJGPP__) || defined(__GO32__)
|
||||
# if defined(__DJGPP__) && (__DJGPP__ > 1)
|
||||
# define CURL_TYPEOF_CURL_OFF_T long long
|
||||
# define CURL_FORMAT_CURL_OFF_T "lld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "llu"
|
||||
# define CURL_SUFFIX_CURL_OFF_T LL
|
||||
# define CURL_SUFFIX_CURL_OFF_TU ULL
|
||||
# else
|
||||
# define CURL_TYPEOF_CURL_OFF_T long
|
||||
# define CURL_FORMAT_CURL_OFF_T "ld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "lu"
|
||||
# define CURL_SUFFIX_CURL_OFF_T L
|
||||
# define CURL_SUFFIX_CURL_OFF_TU UL
|
||||
# endif
|
||||
# define CURL_TYPEOF_CURL_SOCKLEN_T int
|
||||
|
||||
#elif defined(__SALFORDC__)
|
||||
# define CURL_TYPEOF_CURL_OFF_T long
|
||||
# define CURL_FORMAT_CURL_OFF_T "ld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "lu"
|
||||
# define CURL_SUFFIX_CURL_OFF_T L
|
||||
# define CURL_SUFFIX_CURL_OFF_TU UL
|
||||
# define CURL_TYPEOF_CURL_SOCKLEN_T int
|
||||
|
||||
#elif defined(__BORLANDC__)
|
||||
# if (__BORLANDC__ < 0x520)
|
||||
# define CURL_TYPEOF_CURL_OFF_T long
|
||||
# define CURL_FORMAT_CURL_OFF_T "ld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "lu"
|
||||
# define CURL_SUFFIX_CURL_OFF_T L
|
||||
# define CURL_SUFFIX_CURL_OFF_TU UL
|
||||
# else
|
||||
# define CURL_TYPEOF_CURL_OFF_T __int64
|
||||
# define CURL_FORMAT_CURL_OFF_T "I64d"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "I64u"
|
||||
# define CURL_SUFFIX_CURL_OFF_T i64
|
||||
# define CURL_SUFFIX_CURL_OFF_TU ui64
|
||||
# endif
|
||||
# define CURL_TYPEOF_CURL_SOCKLEN_T int
|
||||
|
||||
#elif defined(__TURBOC__)
|
||||
# define CURL_TYPEOF_CURL_OFF_T long
|
||||
# define CURL_FORMAT_CURL_OFF_T "ld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "lu"
|
||||
# define CURL_SUFFIX_CURL_OFF_T L
|
||||
# define CURL_SUFFIX_CURL_OFF_TU UL
|
||||
# define CURL_TYPEOF_CURL_SOCKLEN_T int
|
||||
|
||||
#elif defined(__WATCOMC__)
|
||||
# if defined(__386__)
|
||||
# define CURL_TYPEOF_CURL_OFF_T __int64
|
||||
# define CURL_FORMAT_CURL_OFF_T "I64d"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "I64u"
|
||||
# define CURL_SUFFIX_CURL_OFF_T i64
|
||||
# define CURL_SUFFIX_CURL_OFF_TU ui64
|
||||
# else
|
||||
# define CURL_TYPEOF_CURL_OFF_T long
|
||||
# define CURL_FORMAT_CURL_OFF_T "ld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "lu"
|
||||
# define CURL_SUFFIX_CURL_OFF_T L
|
||||
# define CURL_SUFFIX_CURL_OFF_TU UL
|
||||
# endif
|
||||
# define CURL_TYPEOF_CURL_SOCKLEN_T int
|
||||
|
||||
#elif defined(__POCC__)
|
||||
# if (__POCC__ < 280)
|
||||
# define CURL_TYPEOF_CURL_OFF_T long
|
||||
# define CURL_FORMAT_CURL_OFF_T "ld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "lu"
|
||||
# define CURL_SUFFIX_CURL_OFF_T L
|
||||
# define CURL_SUFFIX_CURL_OFF_TU UL
|
||||
# elif defined(_MSC_VER)
|
||||
# define CURL_TYPEOF_CURL_OFF_T __int64
|
||||
# define CURL_FORMAT_CURL_OFF_T "I64d"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "I64u"
|
||||
# define CURL_SUFFIX_CURL_OFF_T i64
|
||||
# define CURL_SUFFIX_CURL_OFF_TU ui64
|
||||
# else
|
||||
# define CURL_TYPEOF_CURL_OFF_T long long
|
||||
# define CURL_FORMAT_CURL_OFF_T "lld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "llu"
|
||||
# define CURL_SUFFIX_CURL_OFF_T LL
|
||||
# define CURL_SUFFIX_CURL_OFF_TU ULL
|
||||
# endif
|
||||
# define CURL_TYPEOF_CURL_SOCKLEN_T int
|
||||
|
||||
#elif defined(__LCC__)
|
||||
# define CURL_TYPEOF_CURL_OFF_T long
|
||||
# define CURL_FORMAT_CURL_OFF_T "ld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "lu"
|
||||
# define CURL_SUFFIX_CURL_OFF_T L
|
||||
# define CURL_SUFFIX_CURL_OFF_TU UL
|
||||
# define CURL_TYPEOF_CURL_SOCKLEN_T int
|
||||
|
||||
#elif defined(__SYMBIAN32__)
|
||||
# if defined(__EABI__) /* Treat all ARM compilers equally */
|
||||
# define CURL_TYPEOF_CURL_OFF_T long long
|
||||
# define CURL_FORMAT_CURL_OFF_T "lld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "llu"
|
||||
# define CURL_SUFFIX_CURL_OFF_T LL
|
||||
# define CURL_SUFFIX_CURL_OFF_TU ULL
|
||||
# elif defined(__CW32__)
|
||||
# pragma longlong on
|
||||
# define CURL_TYPEOF_CURL_OFF_T long long
|
||||
# define CURL_FORMAT_CURL_OFF_T "lld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "llu"
|
||||
# define CURL_SUFFIX_CURL_OFF_T LL
|
||||
# define CURL_SUFFIX_CURL_OFF_TU ULL
|
||||
# elif defined(__VC32__)
|
||||
# define CURL_TYPEOF_CURL_OFF_T __int64
|
||||
# define CURL_FORMAT_CURL_OFF_T "lld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "llu"
|
||||
# define CURL_SUFFIX_CURL_OFF_T LL
|
||||
# define CURL_SUFFIX_CURL_OFF_TU ULL
|
||||
# endif
|
||||
# define CURL_TYPEOF_CURL_SOCKLEN_T unsigned int
|
||||
|
||||
#elif defined(__MWERKS__)
|
||||
# define CURL_TYPEOF_CURL_OFF_T long long
|
||||
# define CURL_FORMAT_CURL_OFF_T "lld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "llu"
|
||||
# define CURL_SUFFIX_CURL_OFF_T LL
|
||||
# define CURL_SUFFIX_CURL_OFF_TU ULL
|
||||
# define CURL_TYPEOF_CURL_SOCKLEN_T int
|
||||
|
||||
#elif defined(_WIN32_WCE)
|
||||
# define CURL_TYPEOF_CURL_OFF_T __int64
|
||||
# define CURL_FORMAT_CURL_OFF_T "I64d"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "I64u"
|
||||
# define CURL_SUFFIX_CURL_OFF_T i64
|
||||
# define CURL_SUFFIX_CURL_OFF_TU ui64
|
||||
# define CURL_TYPEOF_CURL_SOCKLEN_T int
|
||||
|
||||
#elif defined(__MINGW32__)
|
||||
# define CURL_TYPEOF_CURL_OFF_T long long
|
||||
# define CURL_FORMAT_CURL_OFF_T "I64d"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "I64u"
|
||||
# define CURL_SUFFIX_CURL_OFF_T LL
|
||||
# define CURL_SUFFIX_CURL_OFF_TU ULL
|
||||
# define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
|
||||
# define CURL_PULL_SYS_TYPES_H 1
|
||||
# define CURL_PULL_WS2TCPIP_H 1
|
||||
|
||||
#elif defined(__VMS)
|
||||
# if defined(__VAX)
|
||||
# define CURL_TYPEOF_CURL_OFF_T long
|
||||
# define CURL_FORMAT_CURL_OFF_T "ld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "lu"
|
||||
# define CURL_SUFFIX_CURL_OFF_T L
|
||||
# define CURL_SUFFIX_CURL_OFF_TU UL
|
||||
# else
|
||||
# define CURL_TYPEOF_CURL_OFF_T long long
|
||||
# define CURL_FORMAT_CURL_OFF_T "lld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "llu"
|
||||
# define CURL_SUFFIX_CURL_OFF_T LL
|
||||
# define CURL_SUFFIX_CURL_OFF_TU ULL
|
||||
# endif
|
||||
# define CURL_TYPEOF_CURL_SOCKLEN_T unsigned int
|
||||
|
||||
#elif defined(__OS400__)
|
||||
# if defined(__ILEC400__)
|
||||
# define CURL_TYPEOF_CURL_OFF_T long long
|
||||
# define CURL_FORMAT_CURL_OFF_T "lld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "llu"
|
||||
# define CURL_SUFFIX_CURL_OFF_T LL
|
||||
# define CURL_SUFFIX_CURL_OFF_TU ULL
|
||||
# define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
|
||||
# define CURL_PULL_SYS_TYPES_H 1
|
||||
# define CURL_PULL_SYS_SOCKET_H 1
|
||||
# endif
|
||||
|
||||
#elif defined(__MVS__)
|
||||
# if defined(__IBMC__) || defined(__IBMCPP__)
|
||||
# if defined(_ILP32)
|
||||
# elif defined(_LP64)
|
||||
# endif
|
||||
# if defined(_LONG_LONG)
|
||||
# define CURL_TYPEOF_CURL_OFF_T long long
|
||||
# define CURL_FORMAT_CURL_OFF_T "lld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "llu"
|
||||
# define CURL_SUFFIX_CURL_OFF_T LL
|
||||
# define CURL_SUFFIX_CURL_OFF_TU ULL
|
||||
# elif defined(_LP64)
|
||||
# define CURL_TYPEOF_CURL_OFF_T long
|
||||
# define CURL_FORMAT_CURL_OFF_T "ld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "lu"
|
||||
# define CURL_SUFFIX_CURL_OFF_T L
|
||||
# define CURL_SUFFIX_CURL_OFF_TU UL
|
||||
# else
|
||||
# define CURL_TYPEOF_CURL_OFF_T long
|
||||
# define CURL_FORMAT_CURL_OFF_T "ld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "lu"
|
||||
# define CURL_SUFFIX_CURL_OFF_T L
|
||||
# define CURL_SUFFIX_CURL_OFF_TU UL
|
||||
# endif
|
||||
# define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
|
||||
# define CURL_PULL_SYS_TYPES_H 1
|
||||
# define CURL_PULL_SYS_SOCKET_H 1
|
||||
# endif
|
||||
|
||||
#elif defined(__370__)
|
||||
# if defined(__IBMC__) || defined(__IBMCPP__)
|
||||
# if defined(_ILP32)
|
||||
# elif defined(_LP64)
|
||||
# endif
|
||||
# if defined(_LONG_LONG)
|
||||
# define CURL_TYPEOF_CURL_OFF_T long long
|
||||
# define CURL_FORMAT_CURL_OFF_T "lld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "llu"
|
||||
# define CURL_SUFFIX_CURL_OFF_T LL
|
||||
# define CURL_SUFFIX_CURL_OFF_TU ULL
|
||||
# elif defined(_LP64)
|
||||
# define CURL_TYPEOF_CURL_OFF_T long
|
||||
# define CURL_FORMAT_CURL_OFF_T "ld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "lu"
|
||||
# define CURL_SUFFIX_CURL_OFF_T L
|
||||
# define CURL_SUFFIX_CURL_OFF_TU UL
|
||||
# else
|
||||
# define CURL_TYPEOF_CURL_OFF_T long
|
||||
# define CURL_FORMAT_CURL_OFF_T "ld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "lu"
|
||||
# define CURL_SUFFIX_CURL_OFF_T L
|
||||
# define CURL_SUFFIX_CURL_OFF_TU UL
|
||||
# endif
|
||||
# define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
|
||||
# define CURL_PULL_SYS_TYPES_H 1
|
||||
# define CURL_PULL_SYS_SOCKET_H 1
|
||||
# endif
|
||||
|
||||
#elif defined(TPF)
|
||||
# define CURL_TYPEOF_CURL_OFF_T long
|
||||
# define CURL_FORMAT_CURL_OFF_T "ld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "lu"
|
||||
# define CURL_SUFFIX_CURL_OFF_T L
|
||||
# define CURL_SUFFIX_CURL_OFF_TU UL
|
||||
# define CURL_TYPEOF_CURL_SOCKLEN_T int
|
||||
|
||||
#elif defined(__TINYC__) /* also known as tcc */
|
||||
|
||||
# define CURL_TYPEOF_CURL_OFF_T long long
|
||||
# define CURL_FORMAT_CURL_OFF_T "lld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "llu"
|
||||
# define CURL_SUFFIX_CURL_OFF_T LL
|
||||
# define CURL_SUFFIX_CURL_OFF_TU ULL
|
||||
# define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
|
||||
# define CURL_PULL_SYS_TYPES_H 1
|
||||
# define CURL_PULL_SYS_SOCKET_H 1
|
||||
|
||||
#elif defined(__SUNPRO_C) /* Oracle Solaris Studio */
|
||||
# if !defined(__LP64) && (defined(__ILP32) || \
|
||||
defined(__i386) || defined(__sparcv8))
|
||||
# define CURL_TYPEOF_CURL_OFF_T long long
|
||||
# define CURL_FORMAT_CURL_OFF_T "lld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "llu"
|
||||
# define CURL_SUFFIX_CURL_OFF_T LL
|
||||
# define CURL_SUFFIX_CURL_OFF_TU ULL
|
||||
# elif defined(__LP64) || \
|
||||
defined(__amd64) || defined(__sparcv9)
|
||||
# define CURL_TYPEOF_CURL_OFF_T long
|
||||
# define CURL_FORMAT_CURL_OFF_T "ld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "lu"
|
||||
# define CURL_SUFFIX_CURL_OFF_T L
|
||||
# define CURL_SUFFIX_CURL_OFF_TU UL
|
||||
# endif
|
||||
# define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
|
||||
# define CURL_PULL_SYS_TYPES_H 1
|
||||
# define CURL_PULL_SYS_SOCKET_H 1
|
||||
|
||||
/* ===================================== */
|
||||
/* KEEP MSVC THE PENULTIMATE ENTRY */
|
||||
/* ===================================== */
|
||||
|
||||
#elif defined(_MSC_VER)
|
||||
# if (_MSC_VER >= 900) && (_INTEGRAL_MAX_BITS >= 64)
|
||||
# define CURL_TYPEOF_CURL_OFF_T __int64
|
||||
# define CURL_FORMAT_CURL_OFF_T "I64d"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "I64u"
|
||||
# define CURL_SUFFIX_CURL_OFF_T i64
|
||||
# define CURL_SUFFIX_CURL_OFF_TU ui64
|
||||
# else
|
||||
# define CURL_TYPEOF_CURL_OFF_T long
|
||||
# define CURL_FORMAT_CURL_OFF_T "ld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "lu"
|
||||
# define CURL_SUFFIX_CURL_OFF_T L
|
||||
# define CURL_SUFFIX_CURL_OFF_TU UL
|
||||
# endif
|
||||
# define CURL_TYPEOF_CURL_SOCKLEN_T int
|
||||
|
||||
/* ===================================== */
|
||||
/* KEEP GENERIC GCC THE LAST ENTRY */
|
||||
/* ===================================== */
|
||||
|
||||
#elif defined(__GNUC__)
|
||||
# if !defined(__LP64__) && \
|
||||
(defined(__ILP32__) || defined(__i386__) || defined(__hppa__) || \
|
||||
defined(__ppc__) || defined(__powerpc__) || defined(__arm__) || \
|
||||
defined(__sparc__) || defined(__mips__) || defined(__sh__) || \
|
||||
defined(__XTENSA__) || \
|
||||
(defined(__SIZEOF_LONG__) && __SIZEOF_LONG__ == 4) || \
|
||||
(defined(__LONG_MAX__) && __LONG_MAX__ == 2147483647L))
|
||||
# define CURL_TYPEOF_CURL_OFF_T long long
|
||||
# define CURL_FORMAT_CURL_OFF_T "lld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "llu"
|
||||
# define CURL_SUFFIX_CURL_OFF_T LL
|
||||
# define CURL_SUFFIX_CURL_OFF_TU ULL
|
||||
# elif defined(__LP64__) || \
|
||||
defined(__x86_64__) || defined(__ppc64__) || defined(__sparc64__) || \
|
||||
(defined(__SIZEOF_LONG__) && __SIZEOF_LONG__ == 8) || \
|
||||
(defined(__LONG_MAX__) && __LONG_MAX__ == 9223372036854775807L)
|
||||
# define CURL_TYPEOF_CURL_OFF_T long
|
||||
# define CURL_FORMAT_CURL_OFF_T "ld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "lu"
|
||||
# define CURL_SUFFIX_CURL_OFF_T L
|
||||
# define CURL_SUFFIX_CURL_OFF_TU UL
|
||||
# endif
|
||||
# define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
|
||||
# define CURL_PULL_SYS_TYPES_H 1
|
||||
# define CURL_PULL_SYS_SOCKET_H 1
|
||||
|
||||
#else
|
||||
/* generic "safe guess" on old 32 bit style */
|
||||
# define CURL_TYPEOF_CURL_OFF_T long
|
||||
# define CURL_FORMAT_CURL_OFF_T "ld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "lu"
|
||||
# define CURL_SUFFIX_CURL_OFF_T L
|
||||
# define CURL_SUFFIX_CURL_OFF_TU UL
|
||||
# define CURL_TYPEOF_CURL_SOCKLEN_T int
|
||||
#endif
|
||||
|
||||
#ifdef _AIX
|
||||
/* AIX needs <sys/poll.h> */
|
||||
#define CURL_PULL_SYS_POLL_H
|
||||
#endif
|
||||
|
||||
|
||||
/* CURL_PULL_WS2TCPIP_H is defined above when inclusion of header file */
|
||||
/* ws2tcpip.h is required here to properly make type definitions below. */
|
||||
#ifdef CURL_PULL_WS2TCPIP_H
|
||||
# include <winsock2.h>
|
||||
# include <windows.h>
|
||||
# include <ws2tcpip.h>
|
||||
#endif
|
||||
|
||||
/* CURL_PULL_SYS_TYPES_H is defined above when inclusion of header file */
|
||||
/* sys/types.h is required here to properly make type definitions below. */
|
||||
#ifdef CURL_PULL_SYS_TYPES_H
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
|
||||
/* CURL_PULL_SYS_SOCKET_H is defined above when inclusion of header file */
|
||||
/* sys/socket.h is required here to properly make type definitions below. */
|
||||
#ifdef CURL_PULL_SYS_SOCKET_H
|
||||
# include <sys/socket.h>
|
||||
#endif
|
||||
|
||||
/* CURL_PULL_SYS_POLL_H is defined above when inclusion of header file */
|
||||
/* sys/poll.h is required here to properly make type definitions below. */
|
||||
#ifdef CURL_PULL_SYS_POLL_H
|
||||
# include <sys/poll.h>
|
||||
#endif
|
||||
|
||||
/* Data type definition of curl_socklen_t. */
|
||||
#ifdef CURL_TYPEOF_CURL_SOCKLEN_T
|
||||
typedef CURL_TYPEOF_CURL_SOCKLEN_T curl_socklen_t;
|
||||
#endif
|
||||
|
||||
/* Data type definition of curl_off_t. */
|
||||
|
||||
#ifdef CURL_TYPEOF_CURL_OFF_T
|
||||
typedef CURL_TYPEOF_CURL_OFF_T curl_off_t;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* CURL_ISOCPP and CURL_OFF_T_C definitions are done here in order to allow
|
||||
* these to be visible and exported by the external libcurl interface API,
|
||||
* while also making them visible to the library internals, simply including
|
||||
* curl_setup.h, without actually needing to include curl.h internally.
|
||||
* If some day this section would grow big enough, all this should be moved
|
||||
* to its own header file.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Figure out if we can use the ## preprocessor operator, which is supported
|
||||
* by ISO/ANSI C and C++. Some compilers support it without setting __STDC__
|
||||
* or __cplusplus so we need to carefully check for them too.
|
||||
*/
|
||||
|
||||
#if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) || \
|
||||
defined(__HP_aCC) || defined(__BORLANDC__) || defined(__LCC__) || \
|
||||
defined(__POCC__) || defined(__SALFORDC__) || defined(__HIGHC__) || \
|
||||
defined(__ILEC400__)
|
||||
/* This compiler is believed to have an ISO compatible preprocessor */
|
||||
#define CURL_ISOCPP
|
||||
#else
|
||||
/* This compiler is believed NOT to have an ISO compatible preprocessor */
|
||||
#undef CURL_ISOCPP
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Macros for minimum-width signed and unsigned curl_off_t integer constants.
|
||||
*/
|
||||
|
||||
#if defined(__BORLANDC__) && (__BORLANDC__ == 0x0551)
|
||||
# define __CURL_OFF_T_C_HLPR2(x) x
|
||||
# define __CURL_OFF_T_C_HLPR1(x) __CURL_OFF_T_C_HLPR2(x)
|
||||
# define CURL_OFF_T_C(Val) __CURL_OFF_T_C_HLPR1(Val) ## \
|
||||
__CURL_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_T)
|
||||
# define CURL_OFF_TU_C(Val) __CURL_OFF_T_C_HLPR1(Val) ## \
|
||||
__CURL_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_TU)
|
||||
#else
|
||||
# ifdef CURL_ISOCPP
|
||||
# define __CURL_OFF_T_C_HLPR2(Val,Suffix) Val ## Suffix
|
||||
# else
|
||||
# define __CURL_OFF_T_C_HLPR2(Val,Suffix) Val/**/Suffix
|
||||
# endif
|
||||
# define __CURL_OFF_T_C_HLPR1(Val,Suffix) __CURL_OFF_T_C_HLPR2(Val,Suffix)
|
||||
# define CURL_OFF_T_C(Val) __CURL_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_T)
|
||||
# define CURL_OFF_TU_C(Val) __CURL_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_TU)
|
||||
#endif
|
||||
|
||||
#endif /* __CURL_SYSTEM_H */
|
|
@ -1,683 +0,0 @@
|
|||
#ifndef __CURL_TYPECHECK_GCC_H
|
||||
#define __CURL_TYPECHECK_GCC_H
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at https://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/* wraps curl_easy_setopt() with typechecking */
|
||||
|
||||
/* To add a new kind of warning, add an
|
||||
* if(_curl_is_sometype_option(_curl_opt))
|
||||
* if(!_curl_is_sometype(value))
|
||||
* _curl_easy_setopt_err_sometype();
|
||||
* block and define _curl_is_sometype_option, _curl_is_sometype and
|
||||
* _curl_easy_setopt_err_sometype below
|
||||
*
|
||||
* NOTE: We use two nested 'if' statements here instead of the && operator, in
|
||||
* order to work around gcc bug #32061. It affects only gcc 4.3.x/4.4.x
|
||||
* when compiling with -Wlogical-op.
|
||||
*
|
||||
* To add an option that uses the same type as an existing option, you'll just
|
||||
* need to extend the appropriate _curl_*_option macro
|
||||
*/
|
||||
#define curl_easy_setopt(handle, option, value) \
|
||||
__extension__ ({ \
|
||||
__typeof__(option) _curl_opt = option; \
|
||||
if(__builtin_constant_p(_curl_opt)) { \
|
||||
if(_curl_is_long_option(_curl_opt)) \
|
||||
if(!_curl_is_long(value)) \
|
||||
_curl_easy_setopt_err_long(); \
|
||||
if(_curl_is_off_t_option(_curl_opt)) \
|
||||
if(!_curl_is_off_t(value)) \
|
||||
_curl_easy_setopt_err_curl_off_t(); \
|
||||
if(_curl_is_string_option(_curl_opt)) \
|
||||
if(!_curl_is_string(value)) \
|
||||
_curl_easy_setopt_err_string(); \
|
||||
if(_curl_is_write_cb_option(_curl_opt)) \
|
||||
if(!_curl_is_write_cb(value)) \
|
||||
_curl_easy_setopt_err_write_callback(); \
|
||||
if((_curl_opt) == CURLOPT_READFUNCTION) \
|
||||
if(!_curl_is_read_cb(value)) \
|
||||
_curl_easy_setopt_err_read_cb(); \
|
||||
if((_curl_opt) == CURLOPT_IOCTLFUNCTION) \
|
||||
if(!_curl_is_ioctl_cb(value)) \
|
||||
_curl_easy_setopt_err_ioctl_cb(); \
|
||||
if((_curl_opt) == CURLOPT_SOCKOPTFUNCTION) \
|
||||
if(!_curl_is_sockopt_cb(value)) \
|
||||
_curl_easy_setopt_err_sockopt_cb(); \
|
||||
if((_curl_opt) == CURLOPT_OPENSOCKETFUNCTION) \
|
||||
if(!_curl_is_opensocket_cb(value)) \
|
||||
_curl_easy_setopt_err_opensocket_cb(); \
|
||||
if((_curl_opt) == CURLOPT_PROGRESSFUNCTION) \
|
||||
if(!_curl_is_progress_cb(value)) \
|
||||
_curl_easy_setopt_err_progress_cb(); \
|
||||
if((_curl_opt) == CURLOPT_DEBUGFUNCTION) \
|
||||
if(!_curl_is_debug_cb(value)) \
|
||||
_curl_easy_setopt_err_debug_cb(); \
|
||||
if((_curl_opt) == CURLOPT_SSL_CTX_FUNCTION) \
|
||||
if(!_curl_is_ssl_ctx_cb(value)) \
|
||||
_curl_easy_setopt_err_ssl_ctx_cb(); \
|
||||
if(_curl_is_conv_cb_option(_curl_opt)) \
|
||||
if(!_curl_is_conv_cb(value)) \
|
||||
_curl_easy_setopt_err_conv_cb(); \
|
||||
if((_curl_opt) == CURLOPT_SEEKFUNCTION) \
|
||||
if(!_curl_is_seek_cb(value)) \
|
||||
_curl_easy_setopt_err_seek_cb(); \
|
||||
if(_curl_is_cb_data_option(_curl_opt)) \
|
||||
if(!_curl_is_cb_data(value)) \
|
||||
_curl_easy_setopt_err_cb_data(); \
|
||||
if((_curl_opt) == CURLOPT_ERRORBUFFER) \
|
||||
if(!_curl_is_error_buffer(value)) \
|
||||
_curl_easy_setopt_err_error_buffer(); \
|
||||
if((_curl_opt) == CURLOPT_STDERR) \
|
||||
if(!_curl_is_FILE(value)) \
|
||||
_curl_easy_setopt_err_FILE(); \
|
||||
if(_curl_is_postfields_option(_curl_opt)) \
|
||||
if(!_curl_is_postfields(value)) \
|
||||
_curl_easy_setopt_err_postfields(); \
|
||||
if((_curl_opt) == CURLOPT_HTTPPOST) \
|
||||
if(!_curl_is_arr((value), struct curl_httppost)) \
|
||||
_curl_easy_setopt_err_curl_httpost(); \
|
||||
if((_curl_opt) == CURLOPT_MIMEPOST) \
|
||||
if(!_curl_is_ptr((value), curl_mime)) \
|
||||
_curl_easy_setopt_err_curl_mimepost(); \
|
||||
if(_curl_is_slist_option(_curl_opt)) \
|
||||
if(!_curl_is_arr((value), struct curl_slist)) \
|
||||
_curl_easy_setopt_err_curl_slist(); \
|
||||
if((_curl_opt) == CURLOPT_SHARE) \
|
||||
if(!_curl_is_ptr((value), CURLSH)) \
|
||||
_curl_easy_setopt_err_CURLSH(); \
|
||||
} \
|
||||
curl_easy_setopt(handle, _curl_opt, value); \
|
||||
})
|
||||
|
||||
/* wraps curl_easy_getinfo() with typechecking */
|
||||
/* FIXME: don't allow const pointers */
|
||||
#define curl_easy_getinfo(handle, info, arg) \
|
||||
__extension__ ({ \
|
||||
__typeof__(info) _curl_info = info; \
|
||||
if(__builtin_constant_p(_curl_info)) { \
|
||||
if(_curl_is_string_info(_curl_info)) \
|
||||
if(!_curl_is_arr((arg), char *)) \
|
||||
_curl_easy_getinfo_err_string(); \
|
||||
if(_curl_is_long_info(_curl_info)) \
|
||||
if(!_curl_is_arr((arg), long)) \
|
||||
_curl_easy_getinfo_err_long(); \
|
||||
if(_curl_is_double_info(_curl_info)) \
|
||||
if(!_curl_is_arr((arg), double)) \
|
||||
_curl_easy_getinfo_err_double(); \
|
||||
if(_curl_is_slist_info(_curl_info)) \
|
||||
if(!_curl_is_arr((arg), struct curl_slist *)) \
|
||||
_curl_easy_getinfo_err_curl_slist(); \
|
||||
if(_curl_is_tlssessioninfo_info(_curl_info)) \
|
||||
if(!_curl_is_arr((arg), struct curl_tlssessioninfo *)) \
|
||||
_curl_easy_getinfo_err_curl_tlssesssioninfo(); \
|
||||
if(_curl_is_certinfo_info(_curl_info)) \
|
||||
if(!_curl_is_arr((arg), struct curl_certinfo *)) \
|
||||
_curl_easy_getinfo_err_curl_certinfo(); \
|
||||
if(_curl_is_socket_info(_curl_info)) \
|
||||
if(!_curl_is_arr((arg), curl_socket_t)) \
|
||||
_curl_easy_getinfo_err_curl_socket(); \
|
||||
if(_curl_is_off_t_info(_curl_info)) \
|
||||
if(!_curl_is_arr((arg), curl_off_t)) \
|
||||
_curl_easy_getinfo_err_curl_off_t(); \
|
||||
} \
|
||||
curl_easy_getinfo(handle, _curl_info, arg); \
|
||||
})
|
||||
|
||||
/* TODO: typechecking for curl_share_setopt() and curl_multi_setopt(),
|
||||
* for now just make sure that the functions are called with three
|
||||
* arguments
|
||||
*/
|
||||
#define curl_share_setopt(share,opt,param) curl_share_setopt(share,opt,param)
|
||||
#define curl_multi_setopt(handle,opt,param) curl_multi_setopt(handle,opt,param)
|
||||
|
||||
|
||||
/* the actual warnings, triggered by calling the _curl_easy_setopt_err*
|
||||
* functions */
|
||||
|
||||
/* To define a new warning, use _CURL_WARNING(identifier, "message") */
|
||||
#define _CURL_WARNING(id, message) \
|
||||
static void __attribute__((__warning__(message))) \
|
||||
__attribute__((__unused__)) __attribute__((__noinline__)) \
|
||||
id(void) { __asm__(""); }
|
||||
|
||||
_CURL_WARNING(_curl_easy_setopt_err_long,
|
||||
"curl_easy_setopt expects a long argument for this option")
|
||||
_CURL_WARNING(_curl_easy_setopt_err_curl_off_t,
|
||||
"curl_easy_setopt expects a curl_off_t argument for this option")
|
||||
_CURL_WARNING(_curl_easy_setopt_err_string,
|
||||
"curl_easy_setopt expects a "
|
||||
"string ('char *' or char[]) argument for this option"
|
||||
)
|
||||
_CURL_WARNING(_curl_easy_setopt_err_write_callback,
|
||||
"curl_easy_setopt expects a curl_write_callback argument for this option")
|
||||
_CURL_WARNING(_curl_easy_setopt_err_read_cb,
|
||||
"curl_easy_setopt expects a curl_read_callback argument for this option")
|
||||
_CURL_WARNING(_curl_easy_setopt_err_ioctl_cb,
|
||||
"curl_easy_setopt expects a curl_ioctl_callback argument for this option")
|
||||
_CURL_WARNING(_curl_easy_setopt_err_sockopt_cb,
|
||||
"curl_easy_setopt expects a curl_sockopt_callback argument for this option")
|
||||
_CURL_WARNING(_curl_easy_setopt_err_opensocket_cb,
|
||||
"curl_easy_setopt expects a "
|
||||
"curl_opensocket_callback argument for this option"
|
||||
)
|
||||
_CURL_WARNING(_curl_easy_setopt_err_progress_cb,
|
||||
"curl_easy_setopt expects a curl_progress_callback argument for this option")
|
||||
_CURL_WARNING(_curl_easy_setopt_err_debug_cb,
|
||||
"curl_easy_setopt expects a curl_debug_callback argument for this option")
|
||||
_CURL_WARNING(_curl_easy_setopt_err_ssl_ctx_cb,
|
||||
"curl_easy_setopt expects a curl_ssl_ctx_callback argument for this option")
|
||||
_CURL_WARNING(_curl_easy_setopt_err_conv_cb,
|
||||
"curl_easy_setopt expects a curl_conv_callback argument for this option")
|
||||
_CURL_WARNING(_curl_easy_setopt_err_seek_cb,
|
||||
"curl_easy_setopt expects a curl_seek_callback argument for this option")
|
||||
_CURL_WARNING(_curl_easy_setopt_err_cb_data,
|
||||
"curl_easy_setopt expects a "
|
||||
"private data pointer as argument for this option")
|
||||
_CURL_WARNING(_curl_easy_setopt_err_error_buffer,
|
||||
"curl_easy_setopt expects a "
|
||||
"char buffer of CURL_ERROR_SIZE as argument for this option")
|
||||
_CURL_WARNING(_curl_easy_setopt_err_FILE,
|
||||
"curl_easy_setopt expects a 'FILE *' argument for this option")
|
||||
_CURL_WARNING(_curl_easy_setopt_err_postfields,
|
||||
"curl_easy_setopt expects a 'void *' or 'char *' argument for this option")
|
||||
_CURL_WARNING(_curl_easy_setopt_err_curl_httpost,
|
||||
"curl_easy_setopt expects a 'struct curl_httppost *' "
|
||||
"argument for this option")
|
||||
_CURL_WARNING(_curl_easy_setopt_err_curl_mimepost,
|
||||
"curl_easy_setopt expects a 'curl_mime *' "
|
||||
"argument for this option")
|
||||
_CURL_WARNING(_curl_easy_setopt_err_curl_slist,
|
||||
"curl_easy_setopt expects a 'struct curl_slist *' argument for this option")
|
||||
_CURL_WARNING(_curl_easy_setopt_err_CURLSH,
|
||||
"curl_easy_setopt expects a CURLSH* argument for this option")
|
||||
|
||||
_CURL_WARNING(_curl_easy_getinfo_err_string,
|
||||
"curl_easy_getinfo expects a pointer to 'char *' for this info")
|
||||
_CURL_WARNING(_curl_easy_getinfo_err_long,
|
||||
"curl_easy_getinfo expects a pointer to long for this info")
|
||||
_CURL_WARNING(_curl_easy_getinfo_err_double,
|
||||
"curl_easy_getinfo expects a pointer to double for this info")
|
||||
_CURL_WARNING(_curl_easy_getinfo_err_curl_slist,
|
||||
"curl_easy_getinfo expects a pointer to 'struct curl_slist *' for this info")
|
||||
_CURL_WARNING(_curl_easy_getinfo_err_curl_tlssesssioninfo,
|
||||
"curl_easy_getinfo expects a pointer to "
|
||||
"'struct curl_tlssessioninfo *' for this info")
|
||||
_CURL_WARNING(_curl_easy_getinfo_err_curl_certinfo,
|
||||
"curl_easy_getinfo expects a pointer to "
|
||||
"'struct curl_certinfo *' for this info")
|
||||
_CURL_WARNING(_curl_easy_getinfo_err_curl_socket,
|
||||
"curl_easy_getinfo expects a pointer to curl_socket_t for this info")
|
||||
_CURL_WARNING(_curl_easy_getinfo_err_curl_off_t,
|
||||
"curl_easy_getinfo expects a pointer to curl_off_t for this info")
|
||||
|
||||
/* groups of curl_easy_setops options that take the same type of argument */
|
||||
|
||||
/* To add a new option to one of the groups, just add
|
||||
* (option) == CURLOPT_SOMETHING
|
||||
* to the or-expression. If the option takes a long or curl_off_t, you don't
|
||||
* have to do anything
|
||||
*/
|
||||
|
||||
/* evaluates to true if option takes a long argument */
|
||||
#define _curl_is_long_option(option) \
|
||||
(0 < (option) && (option) < CURLOPTTYPE_OBJECTPOINT)
|
||||
|
||||
#define _curl_is_off_t_option(option) \
|
||||
((option) > CURLOPTTYPE_OFF_T)
|
||||
|
||||
/* evaluates to true if option takes a char* argument */
|
||||
#define _curl_is_string_option(option) \
|
||||
((option) == CURLOPT_ABSTRACT_UNIX_SOCKET || \
|
||||
(option) == CURLOPT_ACCEPT_ENCODING || \
|
||||
(option) == CURLOPT_CAINFO || \
|
||||
(option) == CURLOPT_CAPATH || \
|
||||
(option) == CURLOPT_COOKIE || \
|
||||
(option) == CURLOPT_COOKIEFILE || \
|
||||
(option) == CURLOPT_COOKIEJAR || \
|
||||
(option) == CURLOPT_COOKIELIST || \
|
||||
(option) == CURLOPT_CRLFILE || \
|
||||
(option) == CURLOPT_CUSTOMREQUEST || \
|
||||
(option) == CURLOPT_DEFAULT_PROTOCOL || \
|
||||
(option) == CURLOPT_DNS_INTERFACE || \
|
||||
(option) == CURLOPT_DNS_LOCAL_IP4 || \
|
||||
(option) == CURLOPT_DNS_LOCAL_IP6 || \
|
||||
(option) == CURLOPT_DNS_SERVERS || \
|
||||
(option) == CURLOPT_EGDSOCKET || \
|
||||
(option) == CURLOPT_FTPPORT || \
|
||||
(option) == CURLOPT_FTP_ACCOUNT || \
|
||||
(option) == CURLOPT_FTP_ALTERNATIVE_TO_USER || \
|
||||
(option) == CURLOPT_INTERFACE || \
|
||||
(option) == CURLOPT_ISSUERCERT || \
|
||||
(option) == CURLOPT_KEYPASSWD || \
|
||||
(option) == CURLOPT_KRBLEVEL || \
|
||||
(option) == CURLOPT_LOGIN_OPTIONS || \
|
||||
(option) == CURLOPT_MAIL_AUTH || \
|
||||
(option) == CURLOPT_MAIL_FROM || \
|
||||
(option) == CURLOPT_NETRC_FILE || \
|
||||
(option) == CURLOPT_NOPROXY || \
|
||||
(option) == CURLOPT_PASSWORD || \
|
||||
(option) == CURLOPT_PINNEDPUBLICKEY || \
|
||||
(option) == CURLOPT_PRE_PROXY || \
|
||||
(option) == CURLOPT_PROXY || \
|
||||
(option) == CURLOPT_PROXYPASSWORD || \
|
||||
(option) == CURLOPT_PROXYUSERNAME || \
|
||||
(option) == CURLOPT_PROXYUSERPWD || \
|
||||
(option) == CURLOPT_PROXY_CAINFO || \
|
||||
(option) == CURLOPT_PROXY_CAPATH || \
|
||||
(option) == CURLOPT_PROXY_CRLFILE || \
|
||||
(option) == CURLOPT_PROXY_KEYPASSWD || \
|
||||
(option) == CURLOPT_PROXY_PINNEDPUBLICKEY || \
|
||||
(option) == CURLOPT_PROXY_SERVICE_NAME || \
|
||||
(option) == CURLOPT_PROXY_SSLCERT || \
|
||||
(option) == CURLOPT_PROXY_SSLCERTTYPE || \
|
||||
(option) == CURLOPT_PROXY_SSLKEY || \
|
||||
(option) == CURLOPT_PROXY_SSLKEYTYPE || \
|
||||
(option) == CURLOPT_PROXY_SSL_CIPHER_LIST || \
|
||||
(option) == CURLOPT_PROXY_TLSAUTH_PASSWORD || \
|
||||
(option) == CURLOPT_PROXY_TLSAUTH_USERNAME || \
|
||||
(option) == CURLOPT_PROXY_TLSAUTH_TYPE || \
|
||||
(option) == CURLOPT_RANDOM_FILE || \
|
||||
(option) == CURLOPT_RANGE || \
|
||||
(option) == CURLOPT_REFERER || \
|
||||
(option) == CURLOPT_RTSP_SESSION_ID || \
|
||||
(option) == CURLOPT_RTSP_STREAM_URI || \
|
||||
(option) == CURLOPT_RTSP_TRANSPORT || \
|
||||
(option) == CURLOPT_SERVICE_NAME || \
|
||||
(option) == CURLOPT_SOCKS5_GSSAPI_SERVICE || \
|
||||
(option) == CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 || \
|
||||
(option) == CURLOPT_SSH_KNOWNHOSTS || \
|
||||
(option) == CURLOPT_SSH_PRIVATE_KEYFILE || \
|
||||
(option) == CURLOPT_SSH_PUBLIC_KEYFILE || \
|
||||
(option) == CURLOPT_SSLCERT || \
|
||||
(option) == CURLOPT_SSLCERTTYPE || \
|
||||
(option) == CURLOPT_SSLENGINE || \
|
||||
(option) == CURLOPT_SSLKEY || \
|
||||
(option) == CURLOPT_SSLKEYTYPE || \
|
||||
(option) == CURLOPT_SSL_CIPHER_LIST || \
|
||||
(option) == CURLOPT_TLSAUTH_PASSWORD || \
|
||||
(option) == CURLOPT_TLSAUTH_TYPE || \
|
||||
(option) == CURLOPT_TLSAUTH_USERNAME || \
|
||||
(option) == CURLOPT_UNIX_SOCKET_PATH || \
|
||||
(option) == CURLOPT_URL || \
|
||||
(option) == CURLOPT_USERAGENT || \
|
||||
(option) == CURLOPT_USERNAME || \
|
||||
(option) == CURLOPT_USERPWD || \
|
||||
(option) == CURLOPT_XOAUTH2_BEARER || \
|
||||
0)
|
||||
|
||||
/* evaluates to true if option takes a curl_write_callback argument */
|
||||
#define _curl_is_write_cb_option(option) \
|
||||
((option) == CURLOPT_HEADERFUNCTION || \
|
||||
(option) == CURLOPT_WRITEFUNCTION)
|
||||
|
||||
/* evaluates to true if option takes a curl_conv_callback argument */
|
||||
#define _curl_is_conv_cb_option(option) \
|
||||
((option) == CURLOPT_CONV_TO_NETWORK_FUNCTION || \
|
||||
(option) == CURLOPT_CONV_FROM_NETWORK_FUNCTION || \
|
||||
(option) == CURLOPT_CONV_FROM_UTF8_FUNCTION)
|
||||
|
||||
/* evaluates to true if option takes a data argument to pass to a callback */
|
||||
#define _curl_is_cb_data_option(option) \
|
||||
((option) == CURLOPT_CHUNK_DATA || \
|
||||
(option) == CURLOPT_CLOSESOCKETDATA || \
|
||||
(option) == CURLOPT_DEBUGDATA || \
|
||||
(option) == CURLOPT_FNMATCH_DATA || \
|
||||
(option) == CURLOPT_HEADERDATA || \
|
||||
(option) == CURLOPT_INTERLEAVEDATA || \
|
||||
(option) == CURLOPT_IOCTLDATA || \
|
||||
(option) == CURLOPT_OPENSOCKETDATA || \
|
||||
(option) == CURLOPT_PRIVATE || \
|
||||
(option) == CURLOPT_PROGRESSDATA || \
|
||||
(option) == CURLOPT_READDATA || \
|
||||
(option) == CURLOPT_SEEKDATA || \
|
||||
(option) == CURLOPT_SOCKOPTDATA || \
|
||||
(option) == CURLOPT_SSH_KEYDATA || \
|
||||
(option) == CURLOPT_SSL_CTX_DATA || \
|
||||
(option) == CURLOPT_WRITEDATA || \
|
||||
0)
|
||||
|
||||
/* evaluates to true if option takes a POST data argument (void* or char*) */
|
||||
#define _curl_is_postfields_option(option) \
|
||||
((option) == CURLOPT_POSTFIELDS || \
|
||||
(option) == CURLOPT_COPYPOSTFIELDS || \
|
||||
0)
|
||||
|
||||
/* evaluates to true if option takes a struct curl_slist * argument */
|
||||
#define _curl_is_slist_option(option) \
|
||||
((option) == CURLOPT_HTTP200ALIASES || \
|
||||
(option) == CURLOPT_HTTPHEADER || \
|
||||
(option) == CURLOPT_MAIL_RCPT || \
|
||||
(option) == CURLOPT_POSTQUOTE || \
|
||||
(option) == CURLOPT_PREQUOTE || \
|
||||
(option) == CURLOPT_PROXYHEADER || \
|
||||
(option) == CURLOPT_QUOTE || \
|
||||
(option) == CURLOPT_RESOLVE || \
|
||||
(option) == CURLOPT_TELNETOPTIONS || \
|
||||
0)
|
||||
|
||||
/* groups of curl_easy_getinfo infos that take the same type of argument */
|
||||
|
||||
/* evaluates to true if info expects a pointer to char * argument */
|
||||
#define _curl_is_string_info(info) \
|
||||
(CURLINFO_STRING < (info) && (info) < CURLINFO_LONG)
|
||||
|
||||
/* evaluates to true if info expects a pointer to long argument */
|
||||
#define _curl_is_long_info(info) \
|
||||
(CURLINFO_LONG < (info) && (info) < CURLINFO_DOUBLE)
|
||||
|
||||
/* evaluates to true if info expects a pointer to double argument */
|
||||
#define _curl_is_double_info(info) \
|
||||
(CURLINFO_DOUBLE < (info) && (info) < CURLINFO_SLIST)
|
||||
|
||||
/* true if info expects a pointer to struct curl_slist * argument */
|
||||
#define _curl_is_slist_info(info) \
|
||||
(((info) == CURLINFO_SSL_ENGINES) || ((info) == CURLINFO_COOKIELIST))
|
||||
|
||||
/* true if info expects a pointer to struct curl_tlssessioninfo * argument */
|
||||
#define _curl_is_tlssessioninfo_info(info) \
|
||||
(((info) == CURLINFO_TLS_SSL_PTR) || ((info) == CURLINFO_TLS_SESSION))
|
||||
|
||||
/* true if info expects a pointer to struct curl_certinfo * argument */
|
||||
#define _curl_is_certinfo_info(info) ((info) == CURLINFO_CERTINFO)
|
||||
|
||||
/* true if info expects a pointer to struct curl_socket_t argument */
|
||||
#define _curl_is_socket_info(info) \
|
||||
(CURLINFO_SOCKET < (info) && (info) < CURLINFO_OFF_T)
|
||||
|
||||
/* true if info expects a pointer to curl_off_t argument */
|
||||
#define _curl_is_off_t_info(info) \
|
||||
(CURLINFO_OFF_T < (info))
|
||||
|
||||
|
||||
/* typecheck helpers -- check whether given expression has requested type*/
|
||||
|
||||
/* For pointers, you can use the _curl_is_ptr/_curl_is_arr macros,
|
||||
* otherwise define a new macro. Search for __builtin_types_compatible_p
|
||||
* in the GCC manual.
|
||||
* NOTE: these macros MUST NOT EVALUATE their arguments! The argument is
|
||||
* the actual expression passed to the curl_easy_setopt macro. This
|
||||
* means that you can only apply the sizeof and __typeof__ operators, no
|
||||
* == or whatsoever.
|
||||
*/
|
||||
|
||||
/* XXX: should evaluate to true iff expr is a pointer */
|
||||
#define _curl_is_any_ptr(expr) \
|
||||
(sizeof(expr) == sizeof(void *))
|
||||
|
||||
/* evaluates to true if expr is NULL */
|
||||
/* XXX: must not evaluate expr, so this check is not accurate */
|
||||
#define _curl_is_NULL(expr) \
|
||||
(__builtin_types_compatible_p(__typeof__(expr), __typeof__(NULL)))
|
||||
|
||||
/* evaluates to true if expr is type*, const type* or NULL */
|
||||
#define _curl_is_ptr(expr, type) \
|
||||
(_curl_is_NULL(expr) || \
|
||||
__builtin_types_compatible_p(__typeof__(expr), type *) || \
|
||||
__builtin_types_compatible_p(__typeof__(expr), const type *))
|
||||
|
||||
/* evaluates to true if expr is one of type[], type*, NULL or const type* */
|
||||
#define _curl_is_arr(expr, type) \
|
||||
(_curl_is_ptr((expr), type) || \
|
||||
__builtin_types_compatible_p(__typeof__(expr), type []))
|
||||
|
||||
/* evaluates to true if expr is a string */
|
||||
#define _curl_is_string(expr) \
|
||||
(_curl_is_arr((expr), char) || \
|
||||
_curl_is_arr((expr), signed char) || \
|
||||
_curl_is_arr((expr), unsigned char))
|
||||
|
||||
/* evaluates to true if expr is a long (no matter the signedness)
|
||||
* XXX: for now, int is also accepted (and therefore short and char, which
|
||||
* are promoted to int when passed to a variadic function) */
|
||||
#define _curl_is_long(expr) \
|
||||
(__builtin_types_compatible_p(__typeof__(expr), long) || \
|
||||
__builtin_types_compatible_p(__typeof__(expr), signed long) || \
|
||||
__builtin_types_compatible_p(__typeof__(expr), unsigned long) || \
|
||||
__builtin_types_compatible_p(__typeof__(expr), int) || \
|
||||
__builtin_types_compatible_p(__typeof__(expr), signed int) || \
|
||||
__builtin_types_compatible_p(__typeof__(expr), unsigned int) || \
|
||||
__builtin_types_compatible_p(__typeof__(expr), short) || \
|
||||
__builtin_types_compatible_p(__typeof__(expr), signed short) || \
|
||||
__builtin_types_compatible_p(__typeof__(expr), unsigned short) || \
|
||||
__builtin_types_compatible_p(__typeof__(expr), char) || \
|
||||
__builtin_types_compatible_p(__typeof__(expr), signed char) || \
|
||||
__builtin_types_compatible_p(__typeof__(expr), unsigned char))
|
||||
|
||||
/* evaluates to true if expr is of type curl_off_t */
|
||||
#define _curl_is_off_t(expr) \
|
||||
(__builtin_types_compatible_p(__typeof__(expr), curl_off_t))
|
||||
|
||||
/* evaluates to true if expr is abuffer suitable for CURLOPT_ERRORBUFFER */
|
||||
/* XXX: also check size of an char[] array? */
|
||||
#define _curl_is_error_buffer(expr) \
|
||||
(_curl_is_NULL(expr) || \
|
||||
__builtin_types_compatible_p(__typeof__(expr), char *) || \
|
||||
__builtin_types_compatible_p(__typeof__(expr), char[]))
|
||||
|
||||
/* evaluates to true if expr is of type (const) void* or (const) FILE* */
|
||||
#if 0
|
||||
#define _curl_is_cb_data(expr) \
|
||||
(_curl_is_ptr((expr), void) || \
|
||||
_curl_is_ptr((expr), FILE))
|
||||
#else /* be less strict */
|
||||
#define _curl_is_cb_data(expr) \
|
||||
_curl_is_any_ptr(expr)
|
||||
#endif
|
||||
|
||||
/* evaluates to true if expr is of type FILE* */
|
||||
#define _curl_is_FILE(expr) \
|
||||
(_curl_is_NULL(expr) || \
|
||||
(__builtin_types_compatible_p(__typeof__(expr), FILE *)))
|
||||
|
||||
/* evaluates to true if expr can be passed as POST data (void* or char*) */
|
||||
#define _curl_is_postfields(expr) \
|
||||
(_curl_is_ptr((expr), void) || \
|
||||
_curl_is_arr((expr), char))
|
||||
|
||||
/* FIXME: the whole callback checking is messy...
|
||||
* The idea is to tolerate char vs. void and const vs. not const
|
||||
* pointers in arguments at least
|
||||
*/
|
||||
/* helper: __builtin_types_compatible_p distinguishes between functions and
|
||||
* function pointers, hide it */
|
||||
#define _curl_callback_compatible(func, type) \
|
||||
(__builtin_types_compatible_p(__typeof__(func), type) || \
|
||||
__builtin_types_compatible_p(__typeof__(func) *, type))
|
||||
|
||||
/* evaluates to true if expr is of type curl_read_callback or "similar" */
|
||||
#define _curl_is_read_cb(expr) \
|
||||
(_curl_is_NULL(expr) || \
|
||||
_curl_callback_compatible((expr), __typeof__(fread) *) || \
|
||||
_curl_callback_compatible((expr), curl_read_callback) || \
|
||||
_curl_callback_compatible((expr), _curl_read_callback1) || \
|
||||
_curl_callback_compatible((expr), _curl_read_callback2) || \
|
||||
_curl_callback_compatible((expr), _curl_read_callback3) || \
|
||||
_curl_callback_compatible((expr), _curl_read_callback4) || \
|
||||
_curl_callback_compatible((expr), _curl_read_callback5) || \
|
||||
_curl_callback_compatible((expr), _curl_read_callback6))
|
||||
typedef size_t (*_curl_read_callback1)(char *, size_t, size_t, void *);
|
||||
typedef size_t (*_curl_read_callback2)(char *, size_t, size_t, const void *);
|
||||
typedef size_t (*_curl_read_callback3)(char *, size_t, size_t, FILE *);
|
||||
typedef size_t (*_curl_read_callback4)(void *, size_t, size_t, void *);
|
||||
typedef size_t (*_curl_read_callback5)(void *, size_t, size_t, const void *);
|
||||
typedef size_t (*_curl_read_callback6)(void *, size_t, size_t, FILE *);
|
||||
|
||||
/* evaluates to true if expr is of type curl_write_callback or "similar" */
|
||||
#define _curl_is_write_cb(expr) \
|
||||
(_curl_is_read_cb(expr) || \
|
||||
_curl_callback_compatible((expr), __typeof__(fwrite) *) || \
|
||||
_curl_callback_compatible((expr), curl_write_callback) || \
|
||||
_curl_callback_compatible((expr), _curl_write_callback1) || \
|
||||
_curl_callback_compatible((expr), _curl_write_callback2) || \
|
||||
_curl_callback_compatible((expr), _curl_write_callback3) || \
|
||||
_curl_callback_compatible((expr), _curl_write_callback4) || \
|
||||
_curl_callback_compatible((expr), _curl_write_callback5) || \
|
||||
_curl_callback_compatible((expr), _curl_write_callback6))
|
||||
typedef size_t (*_curl_write_callback1)(const char *, size_t, size_t, void *);
|
||||
typedef size_t (*_curl_write_callback2)(const char *, size_t, size_t,
|
||||
const void *);
|
||||
typedef size_t (*_curl_write_callback3)(const char *, size_t, size_t, FILE *);
|
||||
typedef size_t (*_curl_write_callback4)(const void *, size_t, size_t, void *);
|
||||
typedef size_t (*_curl_write_callback5)(const void *, size_t, size_t,
|
||||
const void *);
|
||||
typedef size_t (*_curl_write_callback6)(const void *, size_t, size_t, FILE *);
|
||||
|
||||
/* evaluates to true if expr is of type curl_ioctl_callback or "similar" */
|
||||
#define _curl_is_ioctl_cb(expr) \
|
||||
(_curl_is_NULL(expr) || \
|
||||
_curl_callback_compatible((expr), curl_ioctl_callback) || \
|
||||
_curl_callback_compatible((expr), _curl_ioctl_callback1) || \
|
||||
_curl_callback_compatible((expr), _curl_ioctl_callback2) || \
|
||||
_curl_callback_compatible((expr), _curl_ioctl_callback3) || \
|
||||
_curl_callback_compatible((expr), _curl_ioctl_callback4))
|
||||
typedef curlioerr (*_curl_ioctl_callback1)(CURL *, int, void *);
|
||||
typedef curlioerr (*_curl_ioctl_callback2)(CURL *, int, const void *);
|
||||
typedef curlioerr (*_curl_ioctl_callback3)(CURL *, curliocmd, void *);
|
||||
typedef curlioerr (*_curl_ioctl_callback4)(CURL *, curliocmd, const void *);
|
||||
|
||||
/* evaluates to true if expr is of type curl_sockopt_callback or "similar" */
|
||||
#define _curl_is_sockopt_cb(expr) \
|
||||
(_curl_is_NULL(expr) || \
|
||||
_curl_callback_compatible((expr), curl_sockopt_callback) || \
|
||||
_curl_callback_compatible((expr), _curl_sockopt_callback1) || \
|
||||
_curl_callback_compatible((expr), _curl_sockopt_callback2))
|
||||
typedef int (*_curl_sockopt_callback1)(void *, curl_socket_t, curlsocktype);
|
||||
typedef int (*_curl_sockopt_callback2)(const void *, curl_socket_t,
|
||||
curlsocktype);
|
||||
|
||||
/* evaluates to true if expr is of type curl_opensocket_callback or
|
||||
"similar" */
|
||||
#define _curl_is_opensocket_cb(expr) \
|
||||
(_curl_is_NULL(expr) || \
|
||||
_curl_callback_compatible((expr), curl_opensocket_callback) || \
|
||||
_curl_callback_compatible((expr), _curl_opensocket_callback1) || \
|
||||
_curl_callback_compatible((expr), _curl_opensocket_callback2) || \
|
||||
_curl_callback_compatible((expr), _curl_opensocket_callback3) || \
|
||||
_curl_callback_compatible((expr), _curl_opensocket_callback4))
|
||||
typedef curl_socket_t (*_curl_opensocket_callback1)
|
||||
(void *, curlsocktype, struct curl_sockaddr *);
|
||||
typedef curl_socket_t (*_curl_opensocket_callback2)
|
||||
(void *, curlsocktype, const struct curl_sockaddr *);
|
||||
typedef curl_socket_t (*_curl_opensocket_callback3)
|
||||
(const void *, curlsocktype, struct curl_sockaddr *);
|
||||
typedef curl_socket_t (*_curl_opensocket_callback4)
|
||||
(const void *, curlsocktype, const struct curl_sockaddr *);
|
||||
|
||||
/* evaluates to true if expr is of type curl_progress_callback or "similar" */
|
||||
#define _curl_is_progress_cb(expr) \
|
||||
(_curl_is_NULL(expr) || \
|
||||
_curl_callback_compatible((expr), curl_progress_callback) || \
|
||||
_curl_callback_compatible((expr), _curl_progress_callback1) || \
|
||||
_curl_callback_compatible((expr), _curl_progress_callback2))
|
||||
typedef int (*_curl_progress_callback1)(void *,
|
||||
double, double, double, double);
|
||||
typedef int (*_curl_progress_callback2)(const void *,
|
||||
double, double, double, double);
|
||||
|
||||
/* evaluates to true if expr is of type curl_debug_callback or "similar" */
|
||||
#define _curl_is_debug_cb(expr) \
|
||||
(_curl_is_NULL(expr) || \
|
||||
_curl_callback_compatible((expr), curl_debug_callback) || \
|
||||
_curl_callback_compatible((expr), _curl_debug_callback1) || \
|
||||
_curl_callback_compatible((expr), _curl_debug_callback2) || \
|
||||
_curl_callback_compatible((expr), _curl_debug_callback3) || \
|
||||
_curl_callback_compatible((expr), _curl_debug_callback4) || \
|
||||
_curl_callback_compatible((expr), _curl_debug_callback5) || \
|
||||
_curl_callback_compatible((expr), _curl_debug_callback6) || \
|
||||
_curl_callback_compatible((expr), _curl_debug_callback7) || \
|
||||
_curl_callback_compatible((expr), _curl_debug_callback8))
|
||||
typedef int (*_curl_debug_callback1) (CURL *,
|
||||
curl_infotype, char *, size_t, void *);
|
||||
typedef int (*_curl_debug_callback2) (CURL *,
|
||||
curl_infotype, char *, size_t, const void *);
|
||||
typedef int (*_curl_debug_callback3) (CURL *,
|
||||
curl_infotype, const char *, size_t, void *);
|
||||
typedef int (*_curl_debug_callback4) (CURL *,
|
||||
curl_infotype, const char *, size_t, const void *);
|
||||
typedef int (*_curl_debug_callback5) (CURL *,
|
||||
curl_infotype, unsigned char *, size_t, void *);
|
||||
typedef int (*_curl_debug_callback6) (CURL *,
|
||||
curl_infotype, unsigned char *, size_t, const void *);
|
||||
typedef int (*_curl_debug_callback7) (CURL *,
|
||||
curl_infotype, const unsigned char *, size_t, void *);
|
||||
typedef int (*_curl_debug_callback8) (CURL *,
|
||||
curl_infotype, const unsigned char *, size_t, const void *);
|
||||
|
||||
/* evaluates to true if expr is of type curl_ssl_ctx_callback or "similar" */
|
||||
/* this is getting even messier... */
|
||||
#define _curl_is_ssl_ctx_cb(expr) \
|
||||
(_curl_is_NULL(expr) || \
|
||||
_curl_callback_compatible((expr), curl_ssl_ctx_callback) || \
|
||||
_curl_callback_compatible((expr), _curl_ssl_ctx_callback1) || \
|
||||
_curl_callback_compatible((expr), _curl_ssl_ctx_callback2) || \
|
||||
_curl_callback_compatible((expr), _curl_ssl_ctx_callback3) || \
|
||||
_curl_callback_compatible((expr), _curl_ssl_ctx_callback4) || \
|
||||
_curl_callback_compatible((expr), _curl_ssl_ctx_callback5) || \
|
||||
_curl_callback_compatible((expr), _curl_ssl_ctx_callback6) || \
|
||||
_curl_callback_compatible((expr), _curl_ssl_ctx_callback7) || \
|
||||
_curl_callback_compatible((expr), _curl_ssl_ctx_callback8))
|
||||
typedef CURLcode (*_curl_ssl_ctx_callback1)(CURL *, void *, void *);
|
||||
typedef CURLcode (*_curl_ssl_ctx_callback2)(CURL *, void *, const void *);
|
||||
typedef CURLcode (*_curl_ssl_ctx_callback3)(CURL *, const void *, void *);
|
||||
typedef CURLcode (*_curl_ssl_ctx_callback4)(CURL *, const void *,
|
||||
const void *);
|
||||
#ifdef HEADER_SSL_H
|
||||
/* hack: if we included OpenSSL's ssl.h, we know about SSL_CTX
|
||||
* this will of course break if we're included before OpenSSL headers...
|
||||
*/
|
||||
typedef CURLcode (*_curl_ssl_ctx_callback5)(CURL *, SSL_CTX, void *);
|
||||
typedef CURLcode (*_curl_ssl_ctx_callback6)(CURL *, SSL_CTX, const void *);
|
||||
typedef CURLcode (*_curl_ssl_ctx_callback7)(CURL *, const SSL_CTX, void *);
|
||||
typedef CURLcode (*_curl_ssl_ctx_callback8)(CURL *, const SSL_CTX,
|
||||
const void *);
|
||||
#else
|
||||
typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback5;
|
||||
typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback6;
|
||||
typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback7;
|
||||
typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback8;
|
||||
#endif
|
||||
|
||||
/* evaluates to true if expr is of type curl_conv_callback or "similar" */
|
||||
#define _curl_is_conv_cb(expr) \
|
||||
(_curl_is_NULL(expr) || \
|
||||
_curl_callback_compatible((expr), curl_conv_callback) || \
|
||||
_curl_callback_compatible((expr), _curl_conv_callback1) || \
|
||||
_curl_callback_compatible((expr), _curl_conv_callback2) || \
|
||||
_curl_callback_compatible((expr), _curl_conv_callback3) || \
|
||||
_curl_callback_compatible((expr), _curl_conv_callback4))
|
||||
typedef CURLcode (*_curl_conv_callback1)(char *, size_t length);
|
||||
typedef CURLcode (*_curl_conv_callback2)(const char *, size_t length);
|
||||
typedef CURLcode (*_curl_conv_callback3)(void *, size_t length);
|
||||
typedef CURLcode (*_curl_conv_callback4)(const void *, size_t length);
|
||||
|
||||
/* evaluates to true if expr is of type curl_seek_callback or "similar" */
|
||||
#define _curl_is_seek_cb(expr) \
|
||||
(_curl_is_NULL(expr) || \
|
||||
_curl_callback_compatible((expr), curl_seek_callback) || \
|
||||
_curl_callback_compatible((expr), _curl_seek_callback1) || \
|
||||
_curl_callback_compatible((expr), _curl_seek_callback2))
|
||||
typedef CURLcode (*_curl_seek_callback1)(void *, curl_off_t, int);
|
||||
typedef CURLcode (*_curl_seek_callback2)(const void *, curl_off_t, int);
|
||||
|
||||
|
||||
#endif /* __CURL_TYPECHECK_GCC_H */
|
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load diff
|
@ -1,77 +0,0 @@
|
|||
#ifndef __CURL_CURLVER_H
|
||||
#define __CURL_CURLVER_H
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at https://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/* This header file contains nothing but libcurl version info, generated by
|
||||
a script at release-time. This was made its own header file in 7.11.2 */
|
||||
|
||||
/* This is the global package copyright */
|
||||
#define LIBCURL_COPYRIGHT "1996 - 2017 Daniel Stenberg, <daniel@haxx.se>."
|
||||
|
||||
/* This is the version number of the libcurl package from which this header
|
||||
file origins: */
|
||||
#define LIBCURL_VERSION "7.58.0"
|
||||
|
||||
/* The numeric version number is also available "in parts" by using these
|
||||
defines: */
|
||||
#define LIBCURL_VERSION_MAJOR 7
|
||||
#define LIBCURL_VERSION_MINOR 58
|
||||
#define LIBCURL_VERSION_PATCH 0
|
||||
|
||||
/* This is the numeric version of the libcurl version number, meant for easier
|
||||
parsing and comparions by programs. The LIBCURL_VERSION_NUM define will
|
||||
always follow this syntax:
|
||||
|
||||
0xXXYYZZ
|
||||
|
||||
Where XX, YY and ZZ are the main version, release and patch numbers in
|
||||
hexadecimal (using 8 bits each). All three numbers are always represented
|
||||
using two digits. 1.2 would appear as "0x010200" while version 9.11.7
|
||||
appears as "0x090b07".
|
||||
|
||||
This 6-digit (24 bits) hexadecimal number does not show pre-release number,
|
||||
and it is always a greater number in a more recent release. It makes
|
||||
comparisons with greater than and less than work.
|
||||
|
||||
Note: This define is the full hex number and _does not_ use the
|
||||
CURL_VERSION_BITS() macro since curl's own configure script greps for it
|
||||
and needs it to contain the full number.
|
||||
*/
|
||||
#define LIBCURL_VERSION_NUM 0x073a00
|
||||
|
||||
/*
|
||||
* This is the date and time when the full source package was created. The
|
||||
* timestamp is not stored in git, as the timestamp is properly set in the
|
||||
* tarballs by the maketgz script.
|
||||
*
|
||||
* The format of the date follows this template:
|
||||
*
|
||||
* "2007-11-23"
|
||||
*/
|
||||
#define LIBCURL_TIMESTAMP "2018-01-24"
|
||||
|
||||
#define CURL_VERSION_BITS(x,y,z) ((x)<<16|(y)<<8|z)
|
||||
#define CURL_AT_LEAST_VERSION(x,y,z) \
|
||||
(LIBCURL_VERSION_NUM >= CURL_VERSION_BITS(x, y, z))
|
||||
|
||||
#endif /* __CURL_CURLVER_H */
|
|
@ -1,102 +0,0 @@
|
|||
#ifndef __CURL_EASY_H
|
||||
#define __CURL_EASY_H
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at https://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
***************************************************************************/
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
CURL_EXTERN CURL *curl_easy_init(void);
|
||||
CURL_EXTERN CURLcode curl_easy_setopt(CURL *curl, CURLoption option, ...);
|
||||
CURL_EXTERN CURLcode curl_easy_perform(CURL *curl);
|
||||
CURL_EXTERN void curl_easy_cleanup(CURL *curl);
|
||||
|
||||
/*
|
||||
* NAME curl_easy_getinfo()
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* Request internal information from the curl session with this function. The
|
||||
* third argument MUST be a pointer to a long, a pointer to a char * or a
|
||||
* pointer to a double (as the documentation describes elsewhere). The data
|
||||
* pointed to will be filled in accordingly and can be relied upon only if the
|
||||
* function returns CURLE_OK. This function is intended to get used *AFTER* a
|
||||
* performed transfer, all results from this function are undefined until the
|
||||
* transfer is completed.
|
||||
*/
|
||||
CURL_EXTERN CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ...);
|
||||
|
||||
|
||||
/*
|
||||
* NAME curl_easy_duphandle()
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* Creates a new curl session handle with the same options set for the handle
|
||||
* passed in. Duplicating a handle could only be a matter of cloning data and
|
||||
* options, internal state info and things like persistent connections cannot
|
||||
* be transferred. It is useful in multithreaded applications when you can run
|
||||
* curl_easy_duphandle() for each new thread to avoid a series of identical
|
||||
* curl_easy_setopt() invokes in every thread.
|
||||
*/
|
||||
CURL_EXTERN CURL *curl_easy_duphandle(CURL *curl);
|
||||
|
||||
/*
|
||||
* NAME curl_easy_reset()
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* Re-initializes a CURL handle to the default values. This puts back the
|
||||
* handle to the same state as it was in when it was just created.
|
||||
*
|
||||
* It does keep: live connections, the Session ID cache, the DNS cache and the
|
||||
* cookies.
|
||||
*/
|
||||
CURL_EXTERN void curl_easy_reset(CURL *curl);
|
||||
|
||||
/*
|
||||
* NAME curl_easy_recv()
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* Receives data from the connected socket. Use after successful
|
||||
* curl_easy_perform() with CURLOPT_CONNECT_ONLY option.
|
||||
*/
|
||||
CURL_EXTERN CURLcode curl_easy_recv(CURL *curl, void *buffer, size_t buflen,
|
||||
size_t *n);
|
||||
|
||||
/*
|
||||
* NAME curl_easy_send()
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* Sends data over the connected socket. Use after successful
|
||||
* curl_easy_perform() with CURLOPT_CONNECT_ONLY option.
|
||||
*/
|
||||
CURL_EXTERN CURLcode curl_easy_send(CURL *curl, const void *buffer,
|
||||
size_t buflen, size_t *n);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -1,50 +0,0 @@
|
|||
#ifndef __CURL_MPRINTF_H
|
||||
#define __CURL_MPRINTF_H
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at https://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h> /* needed for FILE */
|
||||
#include "curl.h" /* for CURL_EXTERN */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
CURL_EXTERN int curl_mprintf(const char *format, ...);
|
||||
CURL_EXTERN int curl_mfprintf(FILE *fd, const char *format, ...);
|
||||
CURL_EXTERN int curl_msprintf(char *buffer, const char *format, ...);
|
||||
CURL_EXTERN int curl_msnprintf(char *buffer, size_t maxlength,
|
||||
const char *format, ...);
|
||||
CURL_EXTERN int curl_mvprintf(const char *format, va_list args);
|
||||
CURL_EXTERN int curl_mvfprintf(FILE *fd, const char *format, va_list args);
|
||||
CURL_EXTERN int curl_mvsprintf(char *buffer, const char *format, va_list args);
|
||||
CURL_EXTERN int curl_mvsnprintf(char *buffer, size_t maxlength,
|
||||
const char *format, va_list args);
|
||||
CURL_EXTERN char *curl_maprintf(const char *format, ...);
|
||||
CURL_EXTERN char *curl_mvaprintf(const char *format, va_list args);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __CURL_MPRINTF_H */
|
|
@ -1,439 +0,0 @@
|
|||
#ifndef __CURL_MULTI_H
|
||||
#define __CURL_MULTI_H
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at https://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
***************************************************************************/
|
||||
/*
|
||||
This is an "external" header file. Don't give away any internals here!
|
||||
|
||||
GOALS
|
||||
|
||||
o Enable a "pull" interface. The application that uses libcurl decides where
|
||||
and when to ask libcurl to get/send data.
|
||||
|
||||
o Enable multiple simultaneous transfers in the same thread without making it
|
||||
complicated for the application.
|
||||
|
||||
o Enable the application to select() on its own file descriptors and curl's
|
||||
file descriptors simultaneous easily.
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
* This header file should not really need to include "curl.h" since curl.h
|
||||
* itself includes this file and we expect user applications to do #include
|
||||
* <curl/curl.h> without the need for especially including multi.h.
|
||||
*
|
||||
* For some reason we added this include here at one point, and rather than to
|
||||
* break existing (wrongly written) libcurl applications, we leave it as-is
|
||||
* but with this warning attached.
|
||||
*/
|
||||
#include "curl.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(BUILDING_LIBCURL) || defined(CURL_STRICTER)
|
||||
typedef struct Curl_multi CURLM;
|
||||
#else
|
||||
typedef void CURLM;
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
CURLM_CALL_MULTI_PERFORM = -1, /* please call curl_multi_perform() or
|
||||
curl_multi_socket*() soon */
|
||||
CURLM_OK,
|
||||
CURLM_BAD_HANDLE, /* the passed-in handle is not a valid CURLM handle */
|
||||
CURLM_BAD_EASY_HANDLE, /* an easy handle was not good/valid */
|
||||
CURLM_OUT_OF_MEMORY, /* if you ever get this, you're in deep sh*t */
|
||||
CURLM_INTERNAL_ERROR, /* this is a libcurl bug */
|
||||
CURLM_BAD_SOCKET, /* the passed in socket argument did not match */
|
||||
CURLM_UNKNOWN_OPTION, /* curl_multi_setopt() with unsupported option */
|
||||
CURLM_ADDED_ALREADY, /* an easy handle already added to a multi handle was
|
||||
attempted to get added - again */
|
||||
CURLM_LAST
|
||||
} CURLMcode;
|
||||
|
||||
/* just to make code nicer when using curl_multi_socket() you can now check
|
||||
for CURLM_CALL_MULTI_SOCKET too in the same style it works for
|
||||
curl_multi_perform() and CURLM_CALL_MULTI_PERFORM */
|
||||
#define CURLM_CALL_MULTI_SOCKET CURLM_CALL_MULTI_PERFORM
|
||||
|
||||
/* bitmask bits for CURLMOPT_PIPELINING */
|
||||
#define CURLPIPE_NOTHING 0L
|
||||
#define CURLPIPE_HTTP1 1L
|
||||
#define CURLPIPE_MULTIPLEX 2L
|
||||
|
||||
typedef enum {
|
||||
CURLMSG_NONE, /* first, not used */
|
||||
CURLMSG_DONE, /* This easy handle has completed. 'result' contains
|
||||
the CURLcode of the transfer */
|
||||
CURLMSG_LAST /* last, not used */
|
||||
} CURLMSG;
|
||||
|
||||
struct CURLMsg {
|
||||
CURLMSG msg; /* what this message means */
|
||||
CURL *easy_handle; /* the handle it concerns */
|
||||
union {
|
||||
void *whatever; /* message-specific data */
|
||||
CURLcode result; /* return code for transfer */
|
||||
} data;
|
||||
};
|
||||
typedef struct CURLMsg CURLMsg;
|
||||
|
||||
/* Based on poll(2) structure and values.
|
||||
* We don't use pollfd and POLL* constants explicitly
|
||||
* to cover platforms without poll(). */
|
||||
#define CURL_WAIT_POLLIN 0x0001
|
||||
#define CURL_WAIT_POLLPRI 0x0002
|
||||
#define CURL_WAIT_POLLOUT 0x0004
|
||||
|
||||
struct curl_waitfd {
|
||||
curl_socket_t fd;
|
||||
short events;
|
||||
short revents; /* not supported yet */
|
||||
};
|
||||
|
||||
/*
|
||||
* Name: curl_multi_init()
|
||||
*
|
||||
* Desc: inititalize multi-style curl usage
|
||||
*
|
||||
* Returns: a new CURLM handle to use in all 'curl_multi' functions.
|
||||
*/
|
||||
CURL_EXTERN CURLM *curl_multi_init(void);
|
||||
|
||||
/*
|
||||
* Name: curl_multi_add_handle()
|
||||
*
|
||||
* Desc: add a standard curl handle to the multi stack
|
||||
*
|
||||
* Returns: CURLMcode type, general multi error code.
|
||||
*/
|
||||
CURL_EXTERN CURLMcode curl_multi_add_handle(CURLM *multi_handle,
|
||||
CURL *curl_handle);
|
||||
|
||||
/*
|
||||
* Name: curl_multi_remove_handle()
|
||||
*
|
||||
* Desc: removes a curl handle from the multi stack again
|
||||
*
|
||||
* Returns: CURLMcode type, general multi error code.
|
||||
*/
|
||||
CURL_EXTERN CURLMcode curl_multi_remove_handle(CURLM *multi_handle,
|
||||
CURL *curl_handle);
|
||||
|
||||
/*
|
||||
* Name: curl_multi_fdset()
|
||||
*
|
||||
* Desc: Ask curl for its fd_set sets. The app can use these to select() or
|
||||
* poll() on. We want curl_multi_perform() called as soon as one of
|
||||
* them are ready.
|
||||
*
|
||||
* Returns: CURLMcode type, general multi error code.
|
||||
*/
|
||||
CURL_EXTERN CURLMcode curl_multi_fdset(CURLM *multi_handle,
|
||||
fd_set *read_fd_set,
|
||||
fd_set *write_fd_set,
|
||||
fd_set *exc_fd_set,
|
||||
int *max_fd);
|
||||
|
||||
/*
|
||||
* Name: curl_multi_wait()
|
||||
*
|
||||
* Desc: Poll on all fds within a CURLM set as well as any
|
||||
* additional fds passed to the function.
|
||||
*
|
||||
* Returns: CURLMcode type, general multi error code.
|
||||
*/
|
||||
CURL_EXTERN CURLMcode curl_multi_wait(CURLM *multi_handle,
|
||||
struct curl_waitfd extra_fds[],
|
||||
unsigned int extra_nfds,
|
||||
int timeout_ms,
|
||||
int *ret);
|
||||
|
||||
/*
|
||||
* Name: curl_multi_perform()
|
||||
*
|
||||
* Desc: When the app thinks there's data available for curl it calls this
|
||||
* function to read/write whatever there is right now. This returns
|
||||
* as soon as the reads and writes are done. This function does not
|
||||
* require that there actually is data available for reading or that
|
||||
* data can be written, it can be called just in case. It returns
|
||||
* the number of handles that still transfer data in the second
|
||||
* argument's integer-pointer.
|
||||
*
|
||||
* Returns: CURLMcode type, general multi error code. *NOTE* that this only
|
||||
* returns errors etc regarding the whole multi stack. There might
|
||||
* still have occurred problems on invidual transfers even when this
|
||||
* returns OK.
|
||||
*/
|
||||
CURL_EXTERN CURLMcode curl_multi_perform(CURLM *multi_handle,
|
||||
int *running_handles);
|
||||
|
||||
/*
|
||||
* Name: curl_multi_cleanup()
|
||||
*
|
||||
* Desc: Cleans up and removes a whole multi stack. It does not free or
|
||||
* touch any individual easy handles in any way. We need to define
|
||||
* in what state those handles will be if this function is called
|
||||
* in the middle of a transfer.
|
||||
*
|
||||
* Returns: CURLMcode type, general multi error code.
|
||||
*/
|
||||
CURL_EXTERN CURLMcode curl_multi_cleanup(CURLM *multi_handle);
|
||||
|
||||
/*
|
||||
* Name: curl_multi_info_read()
|
||||
*
|
||||
* Desc: Ask the multi handle if there's any messages/informationals from
|
||||
* the individual transfers. Messages include informationals such as
|
||||
* error code from the transfer or just the fact that a transfer is
|
||||
* completed. More details on these should be written down as well.
|
||||
*
|
||||
* Repeated calls to this function will return a new struct each
|
||||
* time, until a special "end of msgs" struct is returned as a signal
|
||||
* that there is no more to get at this point.
|
||||
*
|
||||
* The data the returned pointer points to will not survive calling
|
||||
* curl_multi_cleanup().
|
||||
*
|
||||
* The 'CURLMsg' struct is meant to be very simple and only contain
|
||||
* very basic information. If more involved information is wanted,
|
||||
* we will provide the particular "transfer handle" in that struct
|
||||
* and that should/could/would be used in subsequent
|
||||
* curl_easy_getinfo() calls (or similar). The point being that we
|
||||
* must never expose complex structs to applications, as then we'll
|
||||
* undoubtably get backwards compatibility problems in the future.
|
||||
*
|
||||
* Returns: A pointer to a filled-in struct, or NULL if it failed or ran out
|
||||
* of structs. It also writes the number of messages left in the
|
||||
* queue (after this read) in the integer the second argument points
|
||||
* to.
|
||||
*/
|
||||
CURL_EXTERN CURLMsg *curl_multi_info_read(CURLM *multi_handle,
|
||||
int *msgs_in_queue);
|
||||
|
||||
/*
|
||||
* Name: curl_multi_strerror()
|
||||
*
|
||||
* Desc: The curl_multi_strerror function may be used to turn a CURLMcode
|
||||
* value into the equivalent human readable error string. This is
|
||||
* useful for printing meaningful error messages.
|
||||
*
|
||||
* Returns: A pointer to a zero-terminated error message.
|
||||
*/
|
||||
CURL_EXTERN const char *curl_multi_strerror(CURLMcode);
|
||||
|
||||
/*
|
||||
* Name: curl_multi_socket() and
|
||||
* curl_multi_socket_all()
|
||||
*
|
||||
* Desc: An alternative version of curl_multi_perform() that allows the
|
||||
* application to pass in one of the file descriptors that have been
|
||||
* detected to have "action" on them and let libcurl perform.
|
||||
* See man page for details.
|
||||
*/
|
||||
#define CURL_POLL_NONE 0
|
||||
#define CURL_POLL_IN 1
|
||||
#define CURL_POLL_OUT 2
|
||||
#define CURL_POLL_INOUT 3
|
||||
#define CURL_POLL_REMOVE 4
|
||||
|
||||
#define CURL_SOCKET_TIMEOUT CURL_SOCKET_BAD
|
||||
|
||||
#define CURL_CSELECT_IN 0x01
|
||||
#define CURL_CSELECT_OUT 0x02
|
||||
#define CURL_CSELECT_ERR 0x04
|
||||
|
||||
typedef int (*curl_socket_callback)(CURL *easy, /* easy handle */
|
||||
curl_socket_t s, /* socket */
|
||||
int what, /* see above */
|
||||
void *userp, /* private callback
|
||||
pointer */
|
||||
void *socketp); /* private socket
|
||||
pointer */
|
||||
/*
|
||||
* Name: curl_multi_timer_callback
|
||||
*
|
||||
* Desc: Called by libcurl whenever the library detects a change in the
|
||||
* maximum number of milliseconds the app is allowed to wait before
|
||||
* curl_multi_socket() or curl_multi_perform() must be called
|
||||
* (to allow libcurl's timed events to take place).
|
||||
*
|
||||
* Returns: The callback should return zero.
|
||||
*/
|
||||
typedef int (*curl_multi_timer_callback)(CURLM *multi, /* multi handle */
|
||||
long timeout_ms, /* see above */
|
||||
void *userp); /* private callback
|
||||
pointer */
|
||||
|
||||
CURL_EXTERN CURLMcode curl_multi_socket(CURLM *multi_handle, curl_socket_t s,
|
||||
int *running_handles);
|
||||
|
||||
CURL_EXTERN CURLMcode curl_multi_socket_action(CURLM *multi_handle,
|
||||
curl_socket_t s,
|
||||
int ev_bitmask,
|
||||
int *running_handles);
|
||||
|
||||
CURL_EXTERN CURLMcode curl_multi_socket_all(CURLM *multi_handle,
|
||||
int *running_handles);
|
||||
|
||||
#ifndef CURL_ALLOW_OLD_MULTI_SOCKET
|
||||
/* This macro below was added in 7.16.3 to push users who recompile to use
|
||||
the new curl_multi_socket_action() instead of the old curl_multi_socket()
|
||||
*/
|
||||
#define curl_multi_socket(x,y,z) curl_multi_socket_action(x,y,0,z)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Name: curl_multi_timeout()
|
||||
*
|
||||
* Desc: Returns the maximum number of milliseconds the app is allowed to
|
||||
* wait before curl_multi_socket() or curl_multi_perform() must be
|
||||
* called (to allow libcurl's timed events to take place).
|
||||
*
|
||||
* Returns: CURLM error code.
|
||||
*/
|
||||
CURL_EXTERN CURLMcode curl_multi_timeout(CURLM *multi_handle,
|
||||
long *milliseconds);
|
||||
|
||||
#undef CINIT /* re-using the same name as in curl.h */
|
||||
|
||||
#ifdef CURL_ISOCPP
|
||||
#define CINIT(name,type,num) CURLMOPT_ ## name = CURLOPTTYPE_ ## type + num
|
||||
#else
|
||||
/* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */
|
||||
#define LONG CURLOPTTYPE_LONG
|
||||
#define OBJECTPOINT CURLOPTTYPE_OBJECTPOINT
|
||||
#define FUNCTIONPOINT CURLOPTTYPE_FUNCTIONPOINT
|
||||
#define OFF_T CURLOPTTYPE_OFF_T
|
||||
#define CINIT(name,type,number) CURLMOPT_/**/name = type + number
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
/* This is the socket callback function pointer */
|
||||
CINIT(SOCKETFUNCTION, FUNCTIONPOINT, 1),
|
||||
|
||||
/* This is the argument passed to the socket callback */
|
||||
CINIT(SOCKETDATA, OBJECTPOINT, 2),
|
||||
|
||||
/* set to 1 to enable pipelining for this multi handle */
|
||||
CINIT(PIPELINING, LONG, 3),
|
||||
|
||||
/* This is the timer callback function pointer */
|
||||
CINIT(TIMERFUNCTION, FUNCTIONPOINT, 4),
|
||||
|
||||
/* This is the argument passed to the timer callback */
|
||||
CINIT(TIMERDATA, OBJECTPOINT, 5),
|
||||
|
||||
/* maximum number of entries in the connection cache */
|
||||
CINIT(MAXCONNECTS, LONG, 6),
|
||||
|
||||
/* maximum number of (pipelining) connections to one host */
|
||||
CINIT(MAX_HOST_CONNECTIONS, LONG, 7),
|
||||
|
||||
/* maximum number of requests in a pipeline */
|
||||
CINIT(MAX_PIPELINE_LENGTH, LONG, 8),
|
||||
|
||||
/* a connection with a content-length longer than this
|
||||
will not be considered for pipelining */
|
||||
CINIT(CONTENT_LENGTH_PENALTY_SIZE, OFF_T, 9),
|
||||
|
||||
/* a connection with a chunk length longer than this
|
||||
will not be considered for pipelining */
|
||||
CINIT(CHUNK_LENGTH_PENALTY_SIZE, OFF_T, 10),
|
||||
|
||||
/* a list of site names(+port) that are blacklisted from
|
||||
pipelining */
|
||||
CINIT(PIPELINING_SITE_BL, OBJECTPOINT, 11),
|
||||
|
||||
/* a list of server types that are blacklisted from
|
||||
pipelining */
|
||||
CINIT(PIPELINING_SERVER_BL, OBJECTPOINT, 12),
|
||||
|
||||
/* maximum number of open connections in total */
|
||||
CINIT(MAX_TOTAL_CONNECTIONS, LONG, 13),
|
||||
|
||||
/* This is the server push callback function pointer */
|
||||
CINIT(PUSHFUNCTION, FUNCTIONPOINT, 14),
|
||||
|
||||
/* This is the argument passed to the server push callback */
|
||||
CINIT(PUSHDATA, OBJECTPOINT, 15),
|
||||
|
||||
CURLMOPT_LASTENTRY /* the last unused */
|
||||
} CURLMoption;
|
||||
|
||||
|
||||
/*
|
||||
* Name: curl_multi_setopt()
|
||||
*
|
||||
* Desc: Sets options for the multi handle.
|
||||
*
|
||||
* Returns: CURLM error code.
|
||||
*/
|
||||
CURL_EXTERN CURLMcode curl_multi_setopt(CURLM *multi_handle,
|
||||
CURLMoption option, ...);
|
||||
|
||||
|
||||
/*
|
||||
* Name: curl_multi_assign()
|
||||
*
|
||||
* Desc: This function sets an association in the multi handle between the
|
||||
* given socket and a private pointer of the application. This is
|
||||
* (only) useful for curl_multi_socket uses.
|
||||
*
|
||||
* Returns: CURLM error code.
|
||||
*/
|
||||
CURL_EXTERN CURLMcode curl_multi_assign(CURLM *multi_handle,
|
||||
curl_socket_t sockfd, void *sockp);
|
||||
|
||||
|
||||
/*
|
||||
* Name: curl_push_callback
|
||||
*
|
||||
* Desc: This callback gets called when a new stream is being pushed by the
|
||||
* server. It approves or denies the new stream.
|
||||
*
|
||||
* Returns: CURL_PUSH_OK or CURL_PUSH_DENY.
|
||||
*/
|
||||
#define CURL_PUSH_OK 0
|
||||
#define CURL_PUSH_DENY 1
|
||||
|
||||
struct curl_pushheaders; /* forward declaration only */
|
||||
|
||||
CURL_EXTERN char *curl_pushheader_bynum(struct curl_pushheaders *h,
|
||||
size_t num);
|
||||
CURL_EXTERN char *curl_pushheader_byname(struct curl_pushheaders *h,
|
||||
const char *name);
|
||||
|
||||
typedef int (*curl_push_callback)(CURL *parent,
|
||||
CURL *easy,
|
||||
size_t num_headers,
|
||||
struct curl_pushheaders *headers,
|
||||
void *userp);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* end of extern "C" */
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -1,33 +0,0 @@
|
|||
#ifndef __STDC_HEADERS_H
|
||||
#define __STDC_HEADERS_H
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at https://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
size_t fread(void *, size_t, size_t, FILE *);
|
||||
size_t fwrite(const void *, size_t, size_t, FILE *);
|
||||
|
||||
int strcasecmp(const char *, const char *);
|
||||
int strncasecmp(const char *, const char *, size_t);
|
||||
|
||||
#endif /* __STDC_HEADERS_H */
|
|
@ -1,473 +0,0 @@
|
|||
#ifndef __CURL_SYSTEM_H
|
||||
#define __CURL_SYSTEM_H
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at https://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/*
|
||||
* Try to keep one section per platform, compiler and architecture, otherwise,
|
||||
* if an existing section is reused for a different one and later on the
|
||||
* original is adjusted, probably the piggybacking one can be adversely
|
||||
* changed.
|
||||
*
|
||||
* In order to differentiate between platforms/compilers/architectures use
|
||||
* only compiler built in predefined preprocessor symbols.
|
||||
*
|
||||
* curl_off_t
|
||||
* ----------
|
||||
*
|
||||
* For any given platform/compiler curl_off_t must be typedef'ed to a 64-bit
|
||||
* wide signed integral data type. The width of this data type must remain
|
||||
* constant and independent of any possible large file support settings.
|
||||
*
|
||||
* As an exception to the above, curl_off_t shall be typedef'ed to a 32-bit
|
||||
* wide signed integral data type if there is no 64-bit type.
|
||||
*
|
||||
* As a general rule, curl_off_t shall not be mapped to off_t. This rule shall
|
||||
* only be violated if off_t is the only 64-bit data type available and the
|
||||
* size of off_t is independent of large file support settings. Keep your
|
||||
* build on the safe side avoiding an off_t gating. If you have a 64-bit
|
||||
* off_t then take for sure that another 64-bit data type exists, dig deeper
|
||||
* and you will find it.
|
||||
*
|
||||
*/
|
||||
|
||||
#if defined(__DJGPP__) || defined(__GO32__)
|
||||
# if defined(__DJGPP__) && (__DJGPP__ > 1)
|
||||
# define CURL_TYPEOF_CURL_OFF_T long long
|
||||
# define CURL_FORMAT_CURL_OFF_T "lld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "llu"
|
||||
# define CURL_SUFFIX_CURL_OFF_T LL
|
||||
# define CURL_SUFFIX_CURL_OFF_TU ULL
|
||||
# else
|
||||
# define CURL_TYPEOF_CURL_OFF_T long
|
||||
# define CURL_FORMAT_CURL_OFF_T "ld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "lu"
|
||||
# define CURL_SUFFIX_CURL_OFF_T L
|
||||
# define CURL_SUFFIX_CURL_OFF_TU UL
|
||||
# endif
|
||||
# define CURL_TYPEOF_CURL_SOCKLEN_T int
|
||||
|
||||
#elif defined(__SALFORDC__)
|
||||
# define CURL_TYPEOF_CURL_OFF_T long
|
||||
# define CURL_FORMAT_CURL_OFF_T "ld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "lu"
|
||||
# define CURL_SUFFIX_CURL_OFF_T L
|
||||
# define CURL_SUFFIX_CURL_OFF_TU UL
|
||||
# define CURL_TYPEOF_CURL_SOCKLEN_T int
|
||||
|
||||
#elif defined(__BORLANDC__)
|
||||
# if (__BORLANDC__ < 0x520)
|
||||
# define CURL_TYPEOF_CURL_OFF_T long
|
||||
# define CURL_FORMAT_CURL_OFF_T "ld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "lu"
|
||||
# define CURL_SUFFIX_CURL_OFF_T L
|
||||
# define CURL_SUFFIX_CURL_OFF_TU UL
|
||||
# else
|
||||
# define CURL_TYPEOF_CURL_OFF_T __int64
|
||||
# define CURL_FORMAT_CURL_OFF_T "I64d"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "I64u"
|
||||
# define CURL_SUFFIX_CURL_OFF_T i64
|
||||
# define CURL_SUFFIX_CURL_OFF_TU ui64
|
||||
# endif
|
||||
# define CURL_TYPEOF_CURL_SOCKLEN_T int
|
||||
|
||||
#elif defined(__TURBOC__)
|
||||
# define CURL_TYPEOF_CURL_OFF_T long
|
||||
# define CURL_FORMAT_CURL_OFF_T "ld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "lu"
|
||||
# define CURL_SUFFIX_CURL_OFF_T L
|
||||
# define CURL_SUFFIX_CURL_OFF_TU UL
|
||||
# define CURL_TYPEOF_CURL_SOCKLEN_T int
|
||||
|
||||
#elif defined(__WATCOMC__)
|
||||
# if defined(__386__)
|
||||
# define CURL_TYPEOF_CURL_OFF_T __int64
|
||||
# define CURL_FORMAT_CURL_OFF_T "I64d"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "I64u"
|
||||
# define CURL_SUFFIX_CURL_OFF_T i64
|
||||
# define CURL_SUFFIX_CURL_OFF_TU ui64
|
||||
# else
|
||||
# define CURL_TYPEOF_CURL_OFF_T long
|
||||
# define CURL_FORMAT_CURL_OFF_T "ld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "lu"
|
||||
# define CURL_SUFFIX_CURL_OFF_T L
|
||||
# define CURL_SUFFIX_CURL_OFF_TU UL
|
||||
# endif
|
||||
# define CURL_TYPEOF_CURL_SOCKLEN_T int
|
||||
|
||||
#elif defined(__POCC__)
|
||||
# if (__POCC__ < 280)
|
||||
# define CURL_TYPEOF_CURL_OFF_T long
|
||||
# define CURL_FORMAT_CURL_OFF_T "ld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "lu"
|
||||
# define CURL_SUFFIX_CURL_OFF_T L
|
||||
# define CURL_SUFFIX_CURL_OFF_TU UL
|
||||
# elif defined(_MSC_VER)
|
||||
# define CURL_TYPEOF_CURL_OFF_T __int64
|
||||
# define CURL_FORMAT_CURL_OFF_T "I64d"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "I64u"
|
||||
# define CURL_SUFFIX_CURL_OFF_T i64
|
||||
# define CURL_SUFFIX_CURL_OFF_TU ui64
|
||||
# else
|
||||
# define CURL_TYPEOF_CURL_OFF_T long long
|
||||
# define CURL_FORMAT_CURL_OFF_T "lld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "llu"
|
||||
# define CURL_SUFFIX_CURL_OFF_T LL
|
||||
# define CURL_SUFFIX_CURL_OFF_TU ULL
|
||||
# endif
|
||||
# define CURL_TYPEOF_CURL_SOCKLEN_T int
|
||||
|
||||
#elif defined(__LCC__)
|
||||
# define CURL_TYPEOF_CURL_OFF_T long
|
||||
# define CURL_FORMAT_CURL_OFF_T "ld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "lu"
|
||||
# define CURL_SUFFIX_CURL_OFF_T L
|
||||
# define CURL_SUFFIX_CURL_OFF_TU UL
|
||||
# define CURL_TYPEOF_CURL_SOCKLEN_T int
|
||||
|
||||
#elif defined(__SYMBIAN32__)
|
||||
# if defined(__EABI__) /* Treat all ARM compilers equally */
|
||||
# define CURL_TYPEOF_CURL_OFF_T long long
|
||||
# define CURL_FORMAT_CURL_OFF_T "lld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "llu"
|
||||
# define CURL_SUFFIX_CURL_OFF_T LL
|
||||
# define CURL_SUFFIX_CURL_OFF_TU ULL
|
||||
# elif defined(__CW32__)
|
||||
# pragma longlong on
|
||||
# define CURL_TYPEOF_CURL_OFF_T long long
|
||||
# define CURL_FORMAT_CURL_OFF_T "lld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "llu"
|
||||
# define CURL_SUFFIX_CURL_OFF_T LL
|
||||
# define CURL_SUFFIX_CURL_OFF_TU ULL
|
||||
# elif defined(__VC32__)
|
||||
# define CURL_TYPEOF_CURL_OFF_T __int64
|
||||
# define CURL_FORMAT_CURL_OFF_T "lld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "llu"
|
||||
# define CURL_SUFFIX_CURL_OFF_T LL
|
||||
# define CURL_SUFFIX_CURL_OFF_TU ULL
|
||||
# endif
|
||||
# define CURL_TYPEOF_CURL_SOCKLEN_T unsigned int
|
||||
|
||||
#elif defined(__MWERKS__)
|
||||
# define CURL_TYPEOF_CURL_OFF_T long long
|
||||
# define CURL_FORMAT_CURL_OFF_T "lld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "llu"
|
||||
# define CURL_SUFFIX_CURL_OFF_T LL
|
||||
# define CURL_SUFFIX_CURL_OFF_TU ULL
|
||||
# define CURL_TYPEOF_CURL_SOCKLEN_T int
|
||||
|
||||
#elif defined(_WIN32_WCE)
|
||||
# define CURL_TYPEOF_CURL_OFF_T __int64
|
||||
# define CURL_FORMAT_CURL_OFF_T "I64d"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "I64u"
|
||||
# define CURL_SUFFIX_CURL_OFF_T i64
|
||||
# define CURL_SUFFIX_CURL_OFF_TU ui64
|
||||
# define CURL_TYPEOF_CURL_SOCKLEN_T int
|
||||
|
||||
#elif defined(__MINGW32__)
|
||||
# define CURL_TYPEOF_CURL_OFF_T long long
|
||||
# define CURL_FORMAT_CURL_OFF_T "I64d"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "I64u"
|
||||
# define CURL_SUFFIX_CURL_OFF_T LL
|
||||
# define CURL_SUFFIX_CURL_OFF_TU ULL
|
||||
# define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
|
||||
# define CURL_PULL_SYS_TYPES_H 1
|
||||
# define CURL_PULL_WS2TCPIP_H 1
|
||||
|
||||
#elif defined(__VMS)
|
||||
# if defined(__VAX)
|
||||
# define CURL_TYPEOF_CURL_OFF_T long
|
||||
# define CURL_FORMAT_CURL_OFF_T "ld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "lu"
|
||||
# define CURL_SUFFIX_CURL_OFF_T L
|
||||
# define CURL_SUFFIX_CURL_OFF_TU UL
|
||||
# else
|
||||
# define CURL_TYPEOF_CURL_OFF_T long long
|
||||
# define CURL_FORMAT_CURL_OFF_T "lld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "llu"
|
||||
# define CURL_SUFFIX_CURL_OFF_T LL
|
||||
# define CURL_SUFFIX_CURL_OFF_TU ULL
|
||||
# endif
|
||||
# define CURL_TYPEOF_CURL_SOCKLEN_T unsigned int
|
||||
|
||||
#elif defined(__OS400__)
|
||||
# if defined(__ILEC400__)
|
||||
# define CURL_TYPEOF_CURL_OFF_T long long
|
||||
# define CURL_FORMAT_CURL_OFF_T "lld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "llu"
|
||||
# define CURL_SUFFIX_CURL_OFF_T LL
|
||||
# define CURL_SUFFIX_CURL_OFF_TU ULL
|
||||
# define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
|
||||
# define CURL_PULL_SYS_TYPES_H 1
|
||||
# define CURL_PULL_SYS_SOCKET_H 1
|
||||
# endif
|
||||
|
||||
#elif defined(__MVS__)
|
||||
# if defined(__IBMC__) || defined(__IBMCPP__)
|
||||
# if defined(_ILP32)
|
||||
# elif defined(_LP64)
|
||||
# endif
|
||||
# if defined(_LONG_LONG)
|
||||
# define CURL_TYPEOF_CURL_OFF_T long long
|
||||
# define CURL_FORMAT_CURL_OFF_T "lld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "llu"
|
||||
# define CURL_SUFFIX_CURL_OFF_T LL
|
||||
# define CURL_SUFFIX_CURL_OFF_TU ULL
|
||||
# elif defined(_LP64)
|
||||
# define CURL_TYPEOF_CURL_OFF_T long
|
||||
# define CURL_FORMAT_CURL_OFF_T "ld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "lu"
|
||||
# define CURL_SUFFIX_CURL_OFF_T L
|
||||
# define CURL_SUFFIX_CURL_OFF_TU UL
|
||||
# else
|
||||
# define CURL_TYPEOF_CURL_OFF_T long
|
||||
# define CURL_FORMAT_CURL_OFF_T "ld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "lu"
|
||||
# define CURL_SUFFIX_CURL_OFF_T L
|
||||
# define CURL_SUFFIX_CURL_OFF_TU UL
|
||||
# endif
|
||||
# define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
|
||||
# define CURL_PULL_SYS_TYPES_H 1
|
||||
# define CURL_PULL_SYS_SOCKET_H 1
|
||||
# endif
|
||||
|
||||
#elif defined(__370__)
|
||||
# if defined(__IBMC__) || defined(__IBMCPP__)
|
||||
# if defined(_ILP32)
|
||||
# elif defined(_LP64)
|
||||
# endif
|
||||
# if defined(_LONG_LONG)
|
||||
# define CURL_TYPEOF_CURL_OFF_T long long
|
||||
# define CURL_FORMAT_CURL_OFF_T "lld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "llu"
|
||||
# define CURL_SUFFIX_CURL_OFF_T LL
|
||||
# define CURL_SUFFIX_CURL_OFF_TU ULL
|
||||
# elif defined(_LP64)
|
||||
# define CURL_TYPEOF_CURL_OFF_T long
|
||||
# define CURL_FORMAT_CURL_OFF_T "ld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "lu"
|
||||
# define CURL_SUFFIX_CURL_OFF_T L
|
||||
# define CURL_SUFFIX_CURL_OFF_TU UL
|
||||
# else
|
||||
# define CURL_TYPEOF_CURL_OFF_T long
|
||||
# define CURL_FORMAT_CURL_OFF_T "ld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "lu"
|
||||
# define CURL_SUFFIX_CURL_OFF_T L
|
||||
# define CURL_SUFFIX_CURL_OFF_TU UL
|
||||
# endif
|
||||
# define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
|
||||
# define CURL_PULL_SYS_TYPES_H 1
|
||||
# define CURL_PULL_SYS_SOCKET_H 1
|
||||
# endif
|
||||
|
||||
#elif defined(TPF)
|
||||
# define CURL_TYPEOF_CURL_OFF_T long
|
||||
# define CURL_FORMAT_CURL_OFF_T "ld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "lu"
|
||||
# define CURL_SUFFIX_CURL_OFF_T L
|
||||
# define CURL_SUFFIX_CURL_OFF_TU UL
|
||||
# define CURL_TYPEOF_CURL_SOCKLEN_T int
|
||||
|
||||
#elif defined(__TINYC__) /* also known as tcc */
|
||||
|
||||
# define CURL_TYPEOF_CURL_OFF_T long long
|
||||
# define CURL_FORMAT_CURL_OFF_T "lld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "llu"
|
||||
# define CURL_SUFFIX_CURL_OFF_T LL
|
||||
# define CURL_SUFFIX_CURL_OFF_TU ULL
|
||||
# define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
|
||||
# define CURL_PULL_SYS_TYPES_H 1
|
||||
# define CURL_PULL_SYS_SOCKET_H 1
|
||||
|
||||
#elif defined(__SUNPRO_C) /* Oracle Solaris Studio */
|
||||
# if !defined(__LP64) && (defined(__ILP32) || \
|
||||
defined(__i386) || defined(__sparcv8))
|
||||
# define CURL_TYPEOF_CURL_OFF_T long long
|
||||
# define CURL_FORMAT_CURL_OFF_T "lld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "llu"
|
||||
# define CURL_SUFFIX_CURL_OFF_T LL
|
||||
# define CURL_SUFFIX_CURL_OFF_TU ULL
|
||||
# elif defined(__LP64) || \
|
||||
defined(__amd64) || defined(__sparcv9)
|
||||
# define CURL_TYPEOF_CURL_OFF_T long
|
||||
# define CURL_FORMAT_CURL_OFF_T "ld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "lu"
|
||||
# define CURL_SUFFIX_CURL_OFF_T L
|
||||
# define CURL_SUFFIX_CURL_OFF_TU UL
|
||||
# endif
|
||||
# define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
|
||||
# define CURL_PULL_SYS_TYPES_H 1
|
||||
# define CURL_PULL_SYS_SOCKET_H 1
|
||||
|
||||
/* ===================================== */
|
||||
/* KEEP MSVC THE PENULTIMATE ENTRY */
|
||||
/* ===================================== */
|
||||
|
||||
#elif defined(_MSC_VER)
|
||||
# if (_MSC_VER >= 900) && (_INTEGRAL_MAX_BITS >= 64)
|
||||
# define CURL_TYPEOF_CURL_OFF_T __int64
|
||||
# define CURL_FORMAT_CURL_OFF_T "I64d"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "I64u"
|
||||
# define CURL_SUFFIX_CURL_OFF_T i64
|
||||
# define CURL_SUFFIX_CURL_OFF_TU ui64
|
||||
# else
|
||||
# define CURL_TYPEOF_CURL_OFF_T long
|
||||
# define CURL_FORMAT_CURL_OFF_T "ld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "lu"
|
||||
# define CURL_SUFFIX_CURL_OFF_T L
|
||||
# define CURL_SUFFIX_CURL_OFF_TU UL
|
||||
# endif
|
||||
# define CURL_TYPEOF_CURL_SOCKLEN_T int
|
||||
|
||||
/* ===================================== */
|
||||
/* KEEP GENERIC GCC THE LAST ENTRY */
|
||||
/* ===================================== */
|
||||
|
||||
#elif defined(__GNUC__)
|
||||
# if !defined(__LP64__) && \
|
||||
(defined(__ILP32__) || defined(__i386__) || defined(__hppa__) || \
|
||||
defined(__ppc__) || defined(__powerpc__) || defined(__arm__) || \
|
||||
defined(__sparc__) || defined(__mips__) || defined(__sh__) || \
|
||||
defined(__XTENSA__) || \
|
||||
(defined(__SIZEOF_LONG__) && __SIZEOF_LONG__ == 4) || \
|
||||
(defined(__LONG_MAX__) && __LONG_MAX__ == 2147483647L))
|
||||
# define CURL_TYPEOF_CURL_OFF_T long long
|
||||
# define CURL_FORMAT_CURL_OFF_T "lld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "llu"
|
||||
# define CURL_SUFFIX_CURL_OFF_T LL
|
||||
# define CURL_SUFFIX_CURL_OFF_TU ULL
|
||||
# elif defined(__LP64__) || \
|
||||
defined(__x86_64__) || defined(__ppc64__) || defined(__sparc64__) || \
|
||||
(defined(__SIZEOF_LONG__) && __SIZEOF_LONG__ == 8) || \
|
||||
(defined(__LONG_MAX__) && __LONG_MAX__ == 9223372036854775807L)
|
||||
# define CURL_TYPEOF_CURL_OFF_T long
|
||||
# define CURL_FORMAT_CURL_OFF_T "ld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "lu"
|
||||
# define CURL_SUFFIX_CURL_OFF_T L
|
||||
# define CURL_SUFFIX_CURL_OFF_TU UL
|
||||
# endif
|
||||
# define CURL_TYPEOF_CURL_SOCKLEN_T socklen_t
|
||||
# define CURL_PULL_SYS_TYPES_H 1
|
||||
# define CURL_PULL_SYS_SOCKET_H 1
|
||||
|
||||
#else
|
||||
/* generic "safe guess" on old 32 bit style */
|
||||
# define CURL_TYPEOF_CURL_OFF_T long
|
||||
# define CURL_FORMAT_CURL_OFF_T "ld"
|
||||
# define CURL_FORMAT_CURL_OFF_TU "lu"
|
||||
# define CURL_SUFFIX_CURL_OFF_T L
|
||||
# define CURL_SUFFIX_CURL_OFF_TU UL
|
||||
# define CURL_TYPEOF_CURL_SOCKLEN_T int
|
||||
#endif
|
||||
|
||||
#ifdef _AIX
|
||||
/* AIX needs <sys/poll.h> */
|
||||
#define CURL_PULL_SYS_POLL_H
|
||||
#endif
|
||||
|
||||
|
||||
/* CURL_PULL_WS2TCPIP_H is defined above when inclusion of header file */
|
||||
/* ws2tcpip.h is required here to properly make type definitions below. */
|
||||
#ifdef CURL_PULL_WS2TCPIP_H
|
||||
# include <winsock2.h>
|
||||
# include <windows.h>
|
||||
# include <ws2tcpip.h>
|
||||
#endif
|
||||
|
||||
/* CURL_PULL_SYS_TYPES_H is defined above when inclusion of header file */
|
||||
/* sys/types.h is required here to properly make type definitions below. */
|
||||
#ifdef CURL_PULL_SYS_TYPES_H
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
|
||||
/* CURL_PULL_SYS_SOCKET_H is defined above when inclusion of header file */
|
||||
/* sys/socket.h is required here to properly make type definitions below. */
|
||||
#ifdef CURL_PULL_SYS_SOCKET_H
|
||||
# include <sys/socket.h>
|
||||
#endif
|
||||
|
||||
/* CURL_PULL_SYS_POLL_H is defined above when inclusion of header file */
|
||||
/* sys/poll.h is required here to properly make type definitions below. */
|
||||
#ifdef CURL_PULL_SYS_POLL_H
|
||||
# include <sys/poll.h>
|
||||
#endif
|
||||
|
||||
/* Data type definition of curl_socklen_t. */
|
||||
#ifdef CURL_TYPEOF_CURL_SOCKLEN_T
|
||||
typedef CURL_TYPEOF_CURL_SOCKLEN_T curl_socklen_t;
|
||||
#endif
|
||||
|
||||
/* Data type definition of curl_off_t. */
|
||||
|
||||
#ifdef CURL_TYPEOF_CURL_OFF_T
|
||||
typedef CURL_TYPEOF_CURL_OFF_T curl_off_t;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* CURL_ISOCPP and CURL_OFF_T_C definitions are done here in order to allow
|
||||
* these to be visible and exported by the external libcurl interface API,
|
||||
* while also making them visible to the library internals, simply including
|
||||
* curl_setup.h, without actually needing to include curl.h internally.
|
||||
* If some day this section would grow big enough, all this should be moved
|
||||
* to its own header file.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Figure out if we can use the ## preprocessor operator, which is supported
|
||||
* by ISO/ANSI C and C++. Some compilers support it without setting __STDC__
|
||||
* or __cplusplus so we need to carefully check for them too.
|
||||
*/
|
||||
|
||||
#if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) || \
|
||||
defined(__HP_aCC) || defined(__BORLANDC__) || defined(__LCC__) || \
|
||||
defined(__POCC__) || defined(__SALFORDC__) || defined(__HIGHC__) || \
|
||||
defined(__ILEC400__)
|
||||
/* This compiler is believed to have an ISO compatible preprocessor */
|
||||
#define CURL_ISOCPP
|
||||
#else
|
||||
/* This compiler is believed NOT to have an ISO compatible preprocessor */
|
||||
#undef CURL_ISOCPP
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Macros for minimum-width signed and unsigned curl_off_t integer constants.
|
||||
*/
|
||||
|
||||
#if defined(__BORLANDC__) && (__BORLANDC__ == 0x0551)
|
||||
# define __CURL_OFF_T_C_HLPR2(x) x
|
||||
# define __CURL_OFF_T_C_HLPR1(x) __CURL_OFF_T_C_HLPR2(x)
|
||||
# define CURL_OFF_T_C(Val) __CURL_OFF_T_C_HLPR1(Val) ## \
|
||||
__CURL_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_T)
|
||||
# define CURL_OFF_TU_C(Val) __CURL_OFF_T_C_HLPR1(Val) ## \
|
||||
__CURL_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_TU)
|
||||
#else
|
||||
# ifdef CURL_ISOCPP
|
||||
# define __CURL_OFF_T_C_HLPR2(Val,Suffix) Val ## Suffix
|
||||
# else
|
||||
# define __CURL_OFF_T_C_HLPR2(Val,Suffix) Val/**/Suffix
|
||||
# endif
|
||||
# define __CURL_OFF_T_C_HLPR1(Val,Suffix) __CURL_OFF_T_C_HLPR2(Val,Suffix)
|
||||
# define CURL_OFF_T_C(Val) __CURL_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_T)
|
||||
# define CURL_OFF_TU_C(Val) __CURL_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_TU)
|
||||
#endif
|
||||
|
||||
#endif /* __CURL_SYSTEM_H */
|
|
@ -1,683 +0,0 @@
|
|||
#ifndef __CURL_TYPECHECK_GCC_H
|
||||
#define __CURL_TYPECHECK_GCC_H
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at https://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
/* wraps curl_easy_setopt() with typechecking */
|
||||
|
||||
/* To add a new kind of warning, add an
|
||||
* if(_curl_is_sometype_option(_curl_opt))
|
||||
* if(!_curl_is_sometype(value))
|
||||
* _curl_easy_setopt_err_sometype();
|
||||
* block and define _curl_is_sometype_option, _curl_is_sometype and
|
||||
* _curl_easy_setopt_err_sometype below
|
||||
*
|
||||
* NOTE: We use two nested 'if' statements here instead of the && operator, in
|
||||
* order to work around gcc bug #32061. It affects only gcc 4.3.x/4.4.x
|
||||
* when compiling with -Wlogical-op.
|
||||
*
|
||||
* To add an option that uses the same type as an existing option, you'll just
|
||||
* need to extend the appropriate _curl_*_option macro
|
||||
*/
|
||||
#define curl_easy_setopt(handle, option, value) \
|
||||
__extension__ ({ \
|
||||
__typeof__(option) _curl_opt = option; \
|
||||
if(__builtin_constant_p(_curl_opt)) { \
|
||||
if(_curl_is_long_option(_curl_opt)) \
|
||||
if(!_curl_is_long(value)) \
|
||||
_curl_easy_setopt_err_long(); \
|
||||
if(_curl_is_off_t_option(_curl_opt)) \
|
||||
if(!_curl_is_off_t(value)) \
|
||||
_curl_easy_setopt_err_curl_off_t(); \
|
||||
if(_curl_is_string_option(_curl_opt)) \
|
||||
if(!_curl_is_string(value)) \
|
||||
_curl_easy_setopt_err_string(); \
|
||||
if(_curl_is_write_cb_option(_curl_opt)) \
|
||||
if(!_curl_is_write_cb(value)) \
|
||||
_curl_easy_setopt_err_write_callback(); \
|
||||
if((_curl_opt) == CURLOPT_READFUNCTION) \
|
||||
if(!_curl_is_read_cb(value)) \
|
||||
_curl_easy_setopt_err_read_cb(); \
|
||||
if((_curl_opt) == CURLOPT_IOCTLFUNCTION) \
|
||||
if(!_curl_is_ioctl_cb(value)) \
|
||||
_curl_easy_setopt_err_ioctl_cb(); \
|
||||
if((_curl_opt) == CURLOPT_SOCKOPTFUNCTION) \
|
||||
if(!_curl_is_sockopt_cb(value)) \
|
||||
_curl_easy_setopt_err_sockopt_cb(); \
|
||||
if((_curl_opt) == CURLOPT_OPENSOCKETFUNCTION) \
|
||||
if(!_curl_is_opensocket_cb(value)) \
|
||||
_curl_easy_setopt_err_opensocket_cb(); \
|
||||
if((_curl_opt) == CURLOPT_PROGRESSFUNCTION) \
|
||||
if(!_curl_is_progress_cb(value)) \
|
||||
_curl_easy_setopt_err_progress_cb(); \
|
||||
if((_curl_opt) == CURLOPT_DEBUGFUNCTION) \
|
||||
if(!_curl_is_debug_cb(value)) \
|
||||
_curl_easy_setopt_err_debug_cb(); \
|
||||
if((_curl_opt) == CURLOPT_SSL_CTX_FUNCTION) \
|
||||
if(!_curl_is_ssl_ctx_cb(value)) \
|
||||
_curl_easy_setopt_err_ssl_ctx_cb(); \
|
||||
if(_curl_is_conv_cb_option(_curl_opt)) \
|
||||
if(!_curl_is_conv_cb(value)) \
|
||||
_curl_easy_setopt_err_conv_cb(); \
|
||||
if((_curl_opt) == CURLOPT_SEEKFUNCTION) \
|
||||
if(!_curl_is_seek_cb(value)) \
|
||||
_curl_easy_setopt_err_seek_cb(); \
|
||||
if(_curl_is_cb_data_option(_curl_opt)) \
|
||||
if(!_curl_is_cb_data(value)) \
|
||||
_curl_easy_setopt_err_cb_data(); \
|
||||
if((_curl_opt) == CURLOPT_ERRORBUFFER) \
|
||||
if(!_curl_is_error_buffer(value)) \
|
||||
_curl_easy_setopt_err_error_buffer(); \
|
||||
if((_curl_opt) == CURLOPT_STDERR) \
|
||||
if(!_curl_is_FILE(value)) \
|
||||
_curl_easy_setopt_err_FILE(); \
|
||||
if(_curl_is_postfields_option(_curl_opt)) \
|
||||
if(!_curl_is_postfields(value)) \
|
||||
_curl_easy_setopt_err_postfields(); \
|
||||
if((_curl_opt) == CURLOPT_HTTPPOST) \
|
||||
if(!_curl_is_arr((value), struct curl_httppost)) \
|
||||
_curl_easy_setopt_err_curl_httpost(); \
|
||||
if((_curl_opt) == CURLOPT_MIMEPOST) \
|
||||
if(!_curl_is_ptr((value), curl_mime)) \
|
||||
_curl_easy_setopt_err_curl_mimepost(); \
|
||||
if(_curl_is_slist_option(_curl_opt)) \
|
||||
if(!_curl_is_arr((value), struct curl_slist)) \
|
||||
_curl_easy_setopt_err_curl_slist(); \
|
||||
if((_curl_opt) == CURLOPT_SHARE) \
|
||||
if(!_curl_is_ptr((value), CURLSH)) \
|
||||
_curl_easy_setopt_err_CURLSH(); \
|
||||
} \
|
||||
curl_easy_setopt(handle, _curl_opt, value); \
|
||||
})
|
||||
|
||||
/* wraps curl_easy_getinfo() with typechecking */
|
||||
/* FIXME: don't allow const pointers */
|
||||
#define curl_easy_getinfo(handle, info, arg) \
|
||||
__extension__ ({ \
|
||||
__typeof__(info) _curl_info = info; \
|
||||
if(__builtin_constant_p(_curl_info)) { \
|
||||
if(_curl_is_string_info(_curl_info)) \
|
||||
if(!_curl_is_arr((arg), char *)) \
|
||||
_curl_easy_getinfo_err_string(); \
|
||||
if(_curl_is_long_info(_curl_info)) \
|
||||
if(!_curl_is_arr((arg), long)) \
|
||||
_curl_easy_getinfo_err_long(); \
|
||||
if(_curl_is_double_info(_curl_info)) \
|
||||
if(!_curl_is_arr((arg), double)) \
|
||||
_curl_easy_getinfo_err_double(); \
|
||||
if(_curl_is_slist_info(_curl_info)) \
|
||||
if(!_curl_is_arr((arg), struct curl_slist *)) \
|
||||
_curl_easy_getinfo_err_curl_slist(); \
|
||||
if(_curl_is_tlssessioninfo_info(_curl_info)) \
|
||||
if(!_curl_is_arr((arg), struct curl_tlssessioninfo *)) \
|
||||
_curl_easy_getinfo_err_curl_tlssesssioninfo(); \
|
||||
if(_curl_is_certinfo_info(_curl_info)) \
|
||||
if(!_curl_is_arr((arg), struct curl_certinfo *)) \
|
||||
_curl_easy_getinfo_err_curl_certinfo(); \
|
||||
if(_curl_is_socket_info(_curl_info)) \
|
||||
if(!_curl_is_arr((arg), curl_socket_t)) \
|
||||
_curl_easy_getinfo_err_curl_socket(); \
|
||||
if(_curl_is_off_t_info(_curl_info)) \
|
||||
if(!_curl_is_arr((arg), curl_off_t)) \
|
||||
_curl_easy_getinfo_err_curl_off_t(); \
|
||||
} \
|
||||
curl_easy_getinfo(handle, _curl_info, arg); \
|
||||
})
|
||||
|
||||
/* TODO: typechecking for curl_share_setopt() and curl_multi_setopt(),
|
||||
* for now just make sure that the functions are called with three
|
||||
* arguments
|
||||
*/
|
||||
#define curl_share_setopt(share,opt,param) curl_share_setopt(share,opt,param)
|
||||
#define curl_multi_setopt(handle,opt,param) curl_multi_setopt(handle,opt,param)
|
||||
|
||||
|
||||
/* the actual warnings, triggered by calling the _curl_easy_setopt_err*
|
||||
* functions */
|
||||
|
||||
/* To define a new warning, use _CURL_WARNING(identifier, "message") */
|
||||
#define _CURL_WARNING(id, message) \
|
||||
static void __attribute__((__warning__(message))) \
|
||||
__attribute__((__unused__)) __attribute__((__noinline__)) \
|
||||
id(void) { __asm__(""); }
|
||||
|
||||
_CURL_WARNING(_curl_easy_setopt_err_long,
|
||||
"curl_easy_setopt expects a long argument for this option")
|
||||
_CURL_WARNING(_curl_easy_setopt_err_curl_off_t,
|
||||
"curl_easy_setopt expects a curl_off_t argument for this option")
|
||||
_CURL_WARNING(_curl_easy_setopt_err_string,
|
||||
"curl_easy_setopt expects a "
|
||||
"string ('char *' or char[]) argument for this option"
|
||||
)
|
||||
_CURL_WARNING(_curl_easy_setopt_err_write_callback,
|
||||
"curl_easy_setopt expects a curl_write_callback argument for this option")
|
||||
_CURL_WARNING(_curl_easy_setopt_err_read_cb,
|
||||
"curl_easy_setopt expects a curl_read_callback argument for this option")
|
||||
_CURL_WARNING(_curl_easy_setopt_err_ioctl_cb,
|
||||
"curl_easy_setopt expects a curl_ioctl_callback argument for this option")
|
||||
_CURL_WARNING(_curl_easy_setopt_err_sockopt_cb,
|
||||
"curl_easy_setopt expects a curl_sockopt_callback argument for this option")
|
||||
_CURL_WARNING(_curl_easy_setopt_err_opensocket_cb,
|
||||
"curl_easy_setopt expects a "
|
||||
"curl_opensocket_callback argument for this option"
|
||||
)
|
||||
_CURL_WARNING(_curl_easy_setopt_err_progress_cb,
|
||||
"curl_easy_setopt expects a curl_progress_callback argument for this option")
|
||||
_CURL_WARNING(_curl_easy_setopt_err_debug_cb,
|
||||
"curl_easy_setopt expects a curl_debug_callback argument for this option")
|
||||
_CURL_WARNING(_curl_easy_setopt_err_ssl_ctx_cb,
|
||||
"curl_easy_setopt expects a curl_ssl_ctx_callback argument for this option")
|
||||
_CURL_WARNING(_curl_easy_setopt_err_conv_cb,
|
||||
"curl_easy_setopt expects a curl_conv_callback argument for this option")
|
||||
_CURL_WARNING(_curl_easy_setopt_err_seek_cb,
|
||||
"curl_easy_setopt expects a curl_seek_callback argument for this option")
|
||||
_CURL_WARNING(_curl_easy_setopt_err_cb_data,
|
||||
"curl_easy_setopt expects a "
|
||||
"private data pointer as argument for this option")
|
||||
_CURL_WARNING(_curl_easy_setopt_err_error_buffer,
|
||||
"curl_easy_setopt expects a "
|
||||
"char buffer of CURL_ERROR_SIZE as argument for this option")
|
||||
_CURL_WARNING(_curl_easy_setopt_err_FILE,
|
||||
"curl_easy_setopt expects a 'FILE *' argument for this option")
|
||||
_CURL_WARNING(_curl_easy_setopt_err_postfields,
|
||||
"curl_easy_setopt expects a 'void *' or 'char *' argument for this option")
|
||||
_CURL_WARNING(_curl_easy_setopt_err_curl_httpost,
|
||||
"curl_easy_setopt expects a 'struct curl_httppost *' "
|
||||
"argument for this option")
|
||||
_CURL_WARNING(_curl_easy_setopt_err_curl_mimepost,
|
||||
"curl_easy_setopt expects a 'curl_mime *' "
|
||||
"argument for this option")
|
||||
_CURL_WARNING(_curl_easy_setopt_err_curl_slist,
|
||||
"curl_easy_setopt expects a 'struct curl_slist *' argument for this option")
|
||||
_CURL_WARNING(_curl_easy_setopt_err_CURLSH,
|
||||
"curl_easy_setopt expects a CURLSH* argument for this option")
|
||||
|
||||
_CURL_WARNING(_curl_easy_getinfo_err_string,
|
||||
"curl_easy_getinfo expects a pointer to 'char *' for this info")
|
||||
_CURL_WARNING(_curl_easy_getinfo_err_long,
|
||||
"curl_easy_getinfo expects a pointer to long for this info")
|
||||
_CURL_WARNING(_curl_easy_getinfo_err_double,
|
||||
"curl_easy_getinfo expects a pointer to double for this info")
|
||||
_CURL_WARNING(_curl_easy_getinfo_err_curl_slist,
|
||||
"curl_easy_getinfo expects a pointer to 'struct curl_slist *' for this info")
|
||||
_CURL_WARNING(_curl_easy_getinfo_err_curl_tlssesssioninfo,
|
||||
"curl_easy_getinfo expects a pointer to "
|
||||
"'struct curl_tlssessioninfo *' for this info")
|
||||
_CURL_WARNING(_curl_easy_getinfo_err_curl_certinfo,
|
||||
"curl_easy_getinfo expects a pointer to "
|
||||
"'struct curl_certinfo *' for this info")
|
||||
_CURL_WARNING(_curl_easy_getinfo_err_curl_socket,
|
||||
"curl_easy_getinfo expects a pointer to curl_socket_t for this info")
|
||||
_CURL_WARNING(_curl_easy_getinfo_err_curl_off_t,
|
||||
"curl_easy_getinfo expects a pointer to curl_off_t for this info")
|
||||
|
||||
/* groups of curl_easy_setops options that take the same type of argument */
|
||||
|
||||
/* To add a new option to one of the groups, just add
|
||||
* (option) == CURLOPT_SOMETHING
|
||||
* to the or-expression. If the option takes a long or curl_off_t, you don't
|
||||
* have to do anything
|
||||
*/
|
||||
|
||||
/* evaluates to true if option takes a long argument */
|
||||
#define _curl_is_long_option(option) \
|
||||
(0 < (option) && (option) < CURLOPTTYPE_OBJECTPOINT)
|
||||
|
||||
#define _curl_is_off_t_option(option) \
|
||||
((option) > CURLOPTTYPE_OFF_T)
|
||||
|
||||
/* evaluates to true if option takes a char* argument */
|
||||
#define _curl_is_string_option(option) \
|
||||
((option) == CURLOPT_ABSTRACT_UNIX_SOCKET || \
|
||||
(option) == CURLOPT_ACCEPT_ENCODING || \
|
||||
(option) == CURLOPT_CAINFO || \
|
||||
(option) == CURLOPT_CAPATH || \
|
||||
(option) == CURLOPT_COOKIE || \
|
||||
(option) == CURLOPT_COOKIEFILE || \
|
||||
(option) == CURLOPT_COOKIEJAR || \
|
||||
(option) == CURLOPT_COOKIELIST || \
|
||||
(option) == CURLOPT_CRLFILE || \
|
||||
(option) == CURLOPT_CUSTOMREQUEST || \
|
||||
(option) == CURLOPT_DEFAULT_PROTOCOL || \
|
||||
(option) == CURLOPT_DNS_INTERFACE || \
|
||||
(option) == CURLOPT_DNS_LOCAL_IP4 || \
|
||||
(option) == CURLOPT_DNS_LOCAL_IP6 || \
|
||||
(option) == CURLOPT_DNS_SERVERS || \
|
||||
(option) == CURLOPT_EGDSOCKET || \
|
||||
(option) == CURLOPT_FTPPORT || \
|
||||
(option) == CURLOPT_FTP_ACCOUNT || \
|
||||
(option) == CURLOPT_FTP_ALTERNATIVE_TO_USER || \
|
||||
(option) == CURLOPT_INTERFACE || \
|
||||
(option) == CURLOPT_ISSUERCERT || \
|
||||
(option) == CURLOPT_KEYPASSWD || \
|
||||
(option) == CURLOPT_KRBLEVEL || \
|
||||
(option) == CURLOPT_LOGIN_OPTIONS || \
|
||||
(option) == CURLOPT_MAIL_AUTH || \
|
||||
(option) == CURLOPT_MAIL_FROM || \
|
||||
(option) == CURLOPT_NETRC_FILE || \
|
||||
(option) == CURLOPT_NOPROXY || \
|
||||
(option) == CURLOPT_PASSWORD || \
|
||||
(option) == CURLOPT_PINNEDPUBLICKEY || \
|
||||
(option) == CURLOPT_PRE_PROXY || \
|
||||
(option) == CURLOPT_PROXY || \
|
||||
(option) == CURLOPT_PROXYPASSWORD || \
|
||||
(option) == CURLOPT_PROXYUSERNAME || \
|
||||
(option) == CURLOPT_PROXYUSERPWD || \
|
||||
(option) == CURLOPT_PROXY_CAINFO || \
|
||||
(option) == CURLOPT_PROXY_CAPATH || \
|
||||
(option) == CURLOPT_PROXY_CRLFILE || \
|
||||
(option) == CURLOPT_PROXY_KEYPASSWD || \
|
||||
(option) == CURLOPT_PROXY_PINNEDPUBLICKEY || \
|
||||
(option) == CURLOPT_PROXY_SERVICE_NAME || \
|
||||
(option) == CURLOPT_PROXY_SSLCERT || \
|
||||
(option) == CURLOPT_PROXY_SSLCERTTYPE || \
|
||||
(option) == CURLOPT_PROXY_SSLKEY || \
|
||||
(option) == CURLOPT_PROXY_SSLKEYTYPE || \
|
||||
(option) == CURLOPT_PROXY_SSL_CIPHER_LIST || \
|
||||
(option) == CURLOPT_PROXY_TLSAUTH_PASSWORD || \
|
||||
(option) == CURLOPT_PROXY_TLSAUTH_USERNAME || \
|
||||
(option) == CURLOPT_PROXY_TLSAUTH_TYPE || \
|
||||
(option) == CURLOPT_RANDOM_FILE || \
|
||||
(option) == CURLOPT_RANGE || \
|
||||
(option) == CURLOPT_REFERER || \
|
||||
(option) == CURLOPT_RTSP_SESSION_ID || \
|
||||
(option) == CURLOPT_RTSP_STREAM_URI || \
|
||||
(option) == CURLOPT_RTSP_TRANSPORT || \
|
||||
(option) == CURLOPT_SERVICE_NAME || \
|
||||
(option) == CURLOPT_SOCKS5_GSSAPI_SERVICE || \
|
||||
(option) == CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 || \
|
||||
(option) == CURLOPT_SSH_KNOWNHOSTS || \
|
||||
(option) == CURLOPT_SSH_PRIVATE_KEYFILE || \
|
||||
(option) == CURLOPT_SSH_PUBLIC_KEYFILE || \
|
||||
(option) == CURLOPT_SSLCERT || \
|
||||
(option) == CURLOPT_SSLCERTTYPE || \
|
||||
(option) == CURLOPT_SSLENGINE || \
|
||||
(option) == CURLOPT_SSLKEY || \
|
||||
(option) == CURLOPT_SSLKEYTYPE || \
|
||||
(option) == CURLOPT_SSL_CIPHER_LIST || \
|
||||
(option) == CURLOPT_TLSAUTH_PASSWORD || \
|
||||
(option) == CURLOPT_TLSAUTH_TYPE || \
|
||||
(option) == CURLOPT_TLSAUTH_USERNAME || \
|
||||
(option) == CURLOPT_UNIX_SOCKET_PATH || \
|
||||
(option) == CURLOPT_URL || \
|
||||
(option) == CURLOPT_USERAGENT || \
|
||||
(option) == CURLOPT_USERNAME || \
|
||||
(option) == CURLOPT_USERPWD || \
|
||||
(option) == CURLOPT_XOAUTH2_BEARER || \
|
||||
0)
|
||||
|
||||
/* evaluates to true if option takes a curl_write_callback argument */
|
||||
#define _curl_is_write_cb_option(option) \
|
||||
((option) == CURLOPT_HEADERFUNCTION || \
|
||||
(option) == CURLOPT_WRITEFUNCTION)
|
||||
|
||||
/* evaluates to true if option takes a curl_conv_callback argument */
|
||||
#define _curl_is_conv_cb_option(option) \
|
||||
((option) == CURLOPT_CONV_TO_NETWORK_FUNCTION || \
|
||||
(option) == CURLOPT_CONV_FROM_NETWORK_FUNCTION || \
|
||||
(option) == CURLOPT_CONV_FROM_UTF8_FUNCTION)
|
||||
|
||||
/* evaluates to true if option takes a data argument to pass to a callback */
|
||||
#define _curl_is_cb_data_option(option) \
|
||||
((option) == CURLOPT_CHUNK_DATA || \
|
||||
(option) == CURLOPT_CLOSESOCKETDATA || \
|
||||
(option) == CURLOPT_DEBUGDATA || \
|
||||
(option) == CURLOPT_FNMATCH_DATA || \
|
||||
(option) == CURLOPT_HEADERDATA || \
|
||||
(option) == CURLOPT_INTERLEAVEDATA || \
|
||||
(option) == CURLOPT_IOCTLDATA || \
|
||||
(option) == CURLOPT_OPENSOCKETDATA || \
|
||||
(option) == CURLOPT_PRIVATE || \
|
||||
(option) == CURLOPT_PROGRESSDATA || \
|
||||
(option) == CURLOPT_READDATA || \
|
||||
(option) == CURLOPT_SEEKDATA || \
|
||||
(option) == CURLOPT_SOCKOPTDATA || \
|
||||
(option) == CURLOPT_SSH_KEYDATA || \
|
||||
(option) == CURLOPT_SSL_CTX_DATA || \
|
||||
(option) == CURLOPT_WRITEDATA || \
|
||||
0)
|
||||
|
||||
/* evaluates to true if option takes a POST data argument (void* or char*) */
|
||||
#define _curl_is_postfields_option(option) \
|
||||
((option) == CURLOPT_POSTFIELDS || \
|
||||
(option) == CURLOPT_COPYPOSTFIELDS || \
|
||||
0)
|
||||
|
||||
/* evaluates to true if option takes a struct curl_slist * argument */
|
||||
#define _curl_is_slist_option(option) \
|
||||
((option) == CURLOPT_HTTP200ALIASES || \
|
||||
(option) == CURLOPT_HTTPHEADER || \
|
||||
(option) == CURLOPT_MAIL_RCPT || \
|
||||
(option) == CURLOPT_POSTQUOTE || \
|
||||
(option) == CURLOPT_PREQUOTE || \
|
||||
(option) == CURLOPT_PROXYHEADER || \
|
||||
(option) == CURLOPT_QUOTE || \
|
||||
(option) == CURLOPT_RESOLVE || \
|
||||
(option) == CURLOPT_TELNETOPTIONS || \
|
||||
0)
|
||||
|
||||
/* groups of curl_easy_getinfo infos that take the same type of argument */
|
||||
|
||||
/* evaluates to true if info expects a pointer to char * argument */
|
||||
#define _curl_is_string_info(info) \
|
||||
(CURLINFO_STRING < (info) && (info) < CURLINFO_LONG)
|
||||
|
||||
/* evaluates to true if info expects a pointer to long argument */
|
||||
#define _curl_is_long_info(info) \
|
||||
(CURLINFO_LONG < (info) && (info) < CURLINFO_DOUBLE)
|
||||
|
||||
/* evaluates to true if info expects a pointer to double argument */
|
||||
#define _curl_is_double_info(info) \
|
||||
(CURLINFO_DOUBLE < (info) && (info) < CURLINFO_SLIST)
|
||||
|
||||
/* true if info expects a pointer to struct curl_slist * argument */
|
||||
#define _curl_is_slist_info(info) \
|
||||
(((info) == CURLINFO_SSL_ENGINES) || ((info) == CURLINFO_COOKIELIST))
|
||||
|
||||
/* true if info expects a pointer to struct curl_tlssessioninfo * argument */
|
||||
#define _curl_is_tlssessioninfo_info(info) \
|
||||
(((info) == CURLINFO_TLS_SSL_PTR) || ((info) == CURLINFO_TLS_SESSION))
|
||||
|
||||
/* true if info expects a pointer to struct curl_certinfo * argument */
|
||||
#define _curl_is_certinfo_info(info) ((info) == CURLINFO_CERTINFO)
|
||||
|
||||
/* true if info expects a pointer to struct curl_socket_t argument */
|
||||
#define _curl_is_socket_info(info) \
|
||||
(CURLINFO_SOCKET < (info) && (info) < CURLINFO_OFF_T)
|
||||
|
||||
/* true if info expects a pointer to curl_off_t argument */
|
||||
#define _curl_is_off_t_info(info) \
|
||||
(CURLINFO_OFF_T < (info))
|
||||
|
||||
|
||||
/* typecheck helpers -- check whether given expression has requested type*/
|
||||
|
||||
/* For pointers, you can use the _curl_is_ptr/_curl_is_arr macros,
|
||||
* otherwise define a new macro. Search for __builtin_types_compatible_p
|
||||
* in the GCC manual.
|
||||
* NOTE: these macros MUST NOT EVALUATE their arguments! The argument is
|
||||
* the actual expression passed to the curl_easy_setopt macro. This
|
||||
* means that you can only apply the sizeof and __typeof__ operators, no
|
||||
* == or whatsoever.
|
||||
*/
|
||||
|
||||
/* XXX: should evaluate to true iff expr is a pointer */
|
||||
#define _curl_is_any_ptr(expr) \
|
||||
(sizeof(expr) == sizeof(void *))
|
||||
|
||||
/* evaluates to true if expr is NULL */
|
||||
/* XXX: must not evaluate expr, so this check is not accurate */
|
||||
#define _curl_is_NULL(expr) \
|
||||
(__builtin_types_compatible_p(__typeof__(expr), __typeof__(NULL)))
|
||||
|
||||
/* evaluates to true if expr is type*, const type* or NULL */
|
||||
#define _curl_is_ptr(expr, type) \
|
||||
(_curl_is_NULL(expr) || \
|
||||
__builtin_types_compatible_p(__typeof__(expr), type *) || \
|
||||
__builtin_types_compatible_p(__typeof__(expr), const type *))
|
||||
|
||||
/* evaluates to true if expr is one of type[], type*, NULL or const type* */
|
||||
#define _curl_is_arr(expr, type) \
|
||||
(_curl_is_ptr((expr), type) || \
|
||||
__builtin_types_compatible_p(__typeof__(expr), type []))
|
||||
|
||||
/* evaluates to true if expr is a string */
|
||||
#define _curl_is_string(expr) \
|
||||
(_curl_is_arr((expr), char) || \
|
||||
_curl_is_arr((expr), signed char) || \
|
||||
_curl_is_arr((expr), unsigned char))
|
||||
|
||||
/* evaluates to true if expr is a long (no matter the signedness)
|
||||
* XXX: for now, int is also accepted (and therefore short and char, which
|
||||
* are promoted to int when passed to a variadic function) */
|
||||
#define _curl_is_long(expr) \
|
||||
(__builtin_types_compatible_p(__typeof__(expr), long) || \
|
||||
__builtin_types_compatible_p(__typeof__(expr), signed long) || \
|
||||
__builtin_types_compatible_p(__typeof__(expr), unsigned long) || \
|
||||
__builtin_types_compatible_p(__typeof__(expr), int) || \
|
||||
__builtin_types_compatible_p(__typeof__(expr), signed int) || \
|
||||
__builtin_types_compatible_p(__typeof__(expr), unsigned int) || \
|
||||
__builtin_types_compatible_p(__typeof__(expr), short) || \
|
||||
__builtin_types_compatible_p(__typeof__(expr), signed short) || \
|
||||
__builtin_types_compatible_p(__typeof__(expr), unsigned short) || \
|
||||
__builtin_types_compatible_p(__typeof__(expr), char) || \
|
||||
__builtin_types_compatible_p(__typeof__(expr), signed char) || \
|
||||
__builtin_types_compatible_p(__typeof__(expr), unsigned char))
|
||||
|
||||
/* evaluates to true if expr is of type curl_off_t */
|
||||
#define _curl_is_off_t(expr) \
|
||||
(__builtin_types_compatible_p(__typeof__(expr), curl_off_t))
|
||||
|
||||
/* evaluates to true if expr is abuffer suitable for CURLOPT_ERRORBUFFER */
|
||||
/* XXX: also check size of an char[] array? */
|
||||
#define _curl_is_error_buffer(expr) \
|
||||
(_curl_is_NULL(expr) || \
|
||||
__builtin_types_compatible_p(__typeof__(expr), char *) || \
|
||||
__builtin_types_compatible_p(__typeof__(expr), char[]))
|
||||
|
||||
/* evaluates to true if expr is of type (const) void* or (const) FILE* */
|
||||
#if 0
|
||||
#define _curl_is_cb_data(expr) \
|
||||
(_curl_is_ptr((expr), void) || \
|
||||
_curl_is_ptr((expr), FILE))
|
||||
#else /* be less strict */
|
||||
#define _curl_is_cb_data(expr) \
|
||||
_curl_is_any_ptr(expr)
|
||||
#endif
|
||||
|
||||
/* evaluates to true if expr is of type FILE* */
|
||||
#define _curl_is_FILE(expr) \
|
||||
(_curl_is_NULL(expr) || \
|
||||
(__builtin_types_compatible_p(__typeof__(expr), FILE *)))
|
||||
|
||||
/* evaluates to true if expr can be passed as POST data (void* or char*) */
|
||||
#define _curl_is_postfields(expr) \
|
||||
(_curl_is_ptr((expr), void) || \
|
||||
_curl_is_arr((expr), char))
|
||||
|
||||
/* FIXME: the whole callback checking is messy...
|
||||
* The idea is to tolerate char vs. void and const vs. not const
|
||||
* pointers in arguments at least
|
||||
*/
|
||||
/* helper: __builtin_types_compatible_p distinguishes between functions and
|
||||
* function pointers, hide it */
|
||||
#define _curl_callback_compatible(func, type) \
|
||||
(__builtin_types_compatible_p(__typeof__(func), type) || \
|
||||
__builtin_types_compatible_p(__typeof__(func) *, type))
|
||||
|
||||
/* evaluates to true if expr is of type curl_read_callback or "similar" */
|
||||
#define _curl_is_read_cb(expr) \
|
||||
(_curl_is_NULL(expr) || \
|
||||
_curl_callback_compatible((expr), __typeof__(fread) *) || \
|
||||
_curl_callback_compatible((expr), curl_read_callback) || \
|
||||
_curl_callback_compatible((expr), _curl_read_callback1) || \
|
||||
_curl_callback_compatible((expr), _curl_read_callback2) || \
|
||||
_curl_callback_compatible((expr), _curl_read_callback3) || \
|
||||
_curl_callback_compatible((expr), _curl_read_callback4) || \
|
||||
_curl_callback_compatible((expr), _curl_read_callback5) || \
|
||||
_curl_callback_compatible((expr), _curl_read_callback6))
|
||||
typedef size_t (*_curl_read_callback1)(char *, size_t, size_t, void *);
|
||||
typedef size_t (*_curl_read_callback2)(char *, size_t, size_t, const void *);
|
||||
typedef size_t (*_curl_read_callback3)(char *, size_t, size_t, FILE *);
|
||||
typedef size_t (*_curl_read_callback4)(void *, size_t, size_t, void *);
|
||||
typedef size_t (*_curl_read_callback5)(void *, size_t, size_t, const void *);
|
||||
typedef size_t (*_curl_read_callback6)(void *, size_t, size_t, FILE *);
|
||||
|
||||
/* evaluates to true if expr is of type curl_write_callback or "similar" */
|
||||
#define _curl_is_write_cb(expr) \
|
||||
(_curl_is_read_cb(expr) || \
|
||||
_curl_callback_compatible((expr), __typeof__(fwrite) *) || \
|
||||
_curl_callback_compatible((expr), curl_write_callback) || \
|
||||
_curl_callback_compatible((expr), _curl_write_callback1) || \
|
||||
_curl_callback_compatible((expr), _curl_write_callback2) || \
|
||||
_curl_callback_compatible((expr), _curl_write_callback3) || \
|
||||
_curl_callback_compatible((expr), _curl_write_callback4) || \
|
||||
_curl_callback_compatible((expr), _curl_write_callback5) || \
|
||||
_curl_callback_compatible((expr), _curl_write_callback6))
|
||||
typedef size_t (*_curl_write_callback1)(const char *, size_t, size_t, void *);
|
||||
typedef size_t (*_curl_write_callback2)(const char *, size_t, size_t,
|
||||
const void *);
|
||||
typedef size_t (*_curl_write_callback3)(const char *, size_t, size_t, FILE *);
|
||||
typedef size_t (*_curl_write_callback4)(const void *, size_t, size_t, void *);
|
||||
typedef size_t (*_curl_write_callback5)(const void *, size_t, size_t,
|
||||
const void *);
|
||||
typedef size_t (*_curl_write_callback6)(const void *, size_t, size_t, FILE *);
|
||||
|
||||
/* evaluates to true if expr is of type curl_ioctl_callback or "similar" */
|
||||
#define _curl_is_ioctl_cb(expr) \
|
||||
(_curl_is_NULL(expr) || \
|
||||
_curl_callback_compatible((expr), curl_ioctl_callback) || \
|
||||
_curl_callback_compatible((expr), _curl_ioctl_callback1) || \
|
||||
_curl_callback_compatible((expr), _curl_ioctl_callback2) || \
|
||||
_curl_callback_compatible((expr), _curl_ioctl_callback3) || \
|
||||
_curl_callback_compatible((expr), _curl_ioctl_callback4))
|
||||
typedef curlioerr (*_curl_ioctl_callback1)(CURL *, int, void *);
|
||||
typedef curlioerr (*_curl_ioctl_callback2)(CURL *, int, const void *);
|
||||
typedef curlioerr (*_curl_ioctl_callback3)(CURL *, curliocmd, void *);
|
||||
typedef curlioerr (*_curl_ioctl_callback4)(CURL *, curliocmd, const void *);
|
||||
|
||||
/* evaluates to true if expr is of type curl_sockopt_callback or "similar" */
|
||||
#define _curl_is_sockopt_cb(expr) \
|
||||
(_curl_is_NULL(expr) || \
|
||||
_curl_callback_compatible((expr), curl_sockopt_callback) || \
|
||||
_curl_callback_compatible((expr), _curl_sockopt_callback1) || \
|
||||
_curl_callback_compatible((expr), _curl_sockopt_callback2))
|
||||
typedef int (*_curl_sockopt_callback1)(void *, curl_socket_t, curlsocktype);
|
||||
typedef int (*_curl_sockopt_callback2)(const void *, curl_socket_t,
|
||||
curlsocktype);
|
||||
|
||||
/* evaluates to true if expr is of type curl_opensocket_callback or
|
||||
"similar" */
|
||||
#define _curl_is_opensocket_cb(expr) \
|
||||
(_curl_is_NULL(expr) || \
|
||||
_curl_callback_compatible((expr), curl_opensocket_callback) || \
|
||||
_curl_callback_compatible((expr), _curl_opensocket_callback1) || \
|
||||
_curl_callback_compatible((expr), _curl_opensocket_callback2) || \
|
||||
_curl_callback_compatible((expr), _curl_opensocket_callback3) || \
|
||||
_curl_callback_compatible((expr), _curl_opensocket_callback4))
|
||||
typedef curl_socket_t (*_curl_opensocket_callback1)
|
||||
(void *, curlsocktype, struct curl_sockaddr *);
|
||||
typedef curl_socket_t (*_curl_opensocket_callback2)
|
||||
(void *, curlsocktype, const struct curl_sockaddr *);
|
||||
typedef curl_socket_t (*_curl_opensocket_callback3)
|
||||
(const void *, curlsocktype, struct curl_sockaddr *);
|
||||
typedef curl_socket_t (*_curl_opensocket_callback4)
|
||||
(const void *, curlsocktype, const struct curl_sockaddr *);
|
||||
|
||||
/* evaluates to true if expr is of type curl_progress_callback or "similar" */
|
||||
#define _curl_is_progress_cb(expr) \
|
||||
(_curl_is_NULL(expr) || \
|
||||
_curl_callback_compatible((expr), curl_progress_callback) || \
|
||||
_curl_callback_compatible((expr), _curl_progress_callback1) || \
|
||||
_curl_callback_compatible((expr), _curl_progress_callback2))
|
||||
typedef int (*_curl_progress_callback1)(void *,
|
||||
double, double, double, double);
|
||||
typedef int (*_curl_progress_callback2)(const void *,
|
||||
double, double, double, double);
|
||||
|
||||
/* evaluates to true if expr is of type curl_debug_callback or "similar" */
|
||||
#define _curl_is_debug_cb(expr) \
|
||||
(_curl_is_NULL(expr) || \
|
||||
_curl_callback_compatible((expr), curl_debug_callback) || \
|
||||
_curl_callback_compatible((expr), _curl_debug_callback1) || \
|
||||
_curl_callback_compatible((expr), _curl_debug_callback2) || \
|
||||
_curl_callback_compatible((expr), _curl_debug_callback3) || \
|
||||
_curl_callback_compatible((expr), _curl_debug_callback4) || \
|
||||
_curl_callback_compatible((expr), _curl_debug_callback5) || \
|
||||
_curl_callback_compatible((expr), _curl_debug_callback6) || \
|
||||
_curl_callback_compatible((expr), _curl_debug_callback7) || \
|
||||
_curl_callback_compatible((expr), _curl_debug_callback8))
|
||||
typedef int (*_curl_debug_callback1) (CURL *,
|
||||
curl_infotype, char *, size_t, void *);
|
||||
typedef int (*_curl_debug_callback2) (CURL *,
|
||||
curl_infotype, char *, size_t, const void *);
|
||||
typedef int (*_curl_debug_callback3) (CURL *,
|
||||
curl_infotype, const char *, size_t, void *);
|
||||
typedef int (*_curl_debug_callback4) (CURL *,
|
||||
curl_infotype, const char *, size_t, const void *);
|
||||
typedef int (*_curl_debug_callback5) (CURL *,
|
||||
curl_infotype, unsigned char *, size_t, void *);
|
||||
typedef int (*_curl_debug_callback6) (CURL *,
|
||||
curl_infotype, unsigned char *, size_t, const void *);
|
||||
typedef int (*_curl_debug_callback7) (CURL *,
|
||||
curl_infotype, const unsigned char *, size_t, void *);
|
||||
typedef int (*_curl_debug_callback8) (CURL *,
|
||||
curl_infotype, const unsigned char *, size_t, const void *);
|
||||
|
||||
/* evaluates to true if expr is of type curl_ssl_ctx_callback or "similar" */
|
||||
/* this is getting even messier... */
|
||||
#define _curl_is_ssl_ctx_cb(expr) \
|
||||
(_curl_is_NULL(expr) || \
|
||||
_curl_callback_compatible((expr), curl_ssl_ctx_callback) || \
|
||||
_curl_callback_compatible((expr), _curl_ssl_ctx_callback1) || \
|
||||
_curl_callback_compatible((expr), _curl_ssl_ctx_callback2) || \
|
||||
_curl_callback_compatible((expr), _curl_ssl_ctx_callback3) || \
|
||||
_curl_callback_compatible((expr), _curl_ssl_ctx_callback4) || \
|
||||
_curl_callback_compatible((expr), _curl_ssl_ctx_callback5) || \
|
||||
_curl_callback_compatible((expr), _curl_ssl_ctx_callback6) || \
|
||||
_curl_callback_compatible((expr), _curl_ssl_ctx_callback7) || \
|
||||
_curl_callback_compatible((expr), _curl_ssl_ctx_callback8))
|
||||
typedef CURLcode (*_curl_ssl_ctx_callback1)(CURL *, void *, void *);
|
||||
typedef CURLcode (*_curl_ssl_ctx_callback2)(CURL *, void *, const void *);
|
||||
typedef CURLcode (*_curl_ssl_ctx_callback3)(CURL *, const void *, void *);
|
||||
typedef CURLcode (*_curl_ssl_ctx_callback4)(CURL *, const void *,
|
||||
const void *);
|
||||
#ifdef HEADER_SSL_H
|
||||
/* hack: if we included OpenSSL's ssl.h, we know about SSL_CTX
|
||||
* this will of course break if we're included before OpenSSL headers...
|
||||
*/
|
||||
typedef CURLcode (*_curl_ssl_ctx_callback5)(CURL *, SSL_CTX, void *);
|
||||
typedef CURLcode (*_curl_ssl_ctx_callback6)(CURL *, SSL_CTX, const void *);
|
||||
typedef CURLcode (*_curl_ssl_ctx_callback7)(CURL *, const SSL_CTX, void *);
|
||||
typedef CURLcode (*_curl_ssl_ctx_callback8)(CURL *, const SSL_CTX,
|
||||
const void *);
|
||||
#else
|
||||
typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback5;
|
||||
typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback6;
|
||||
typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback7;
|
||||
typedef _curl_ssl_ctx_callback1 _curl_ssl_ctx_callback8;
|
||||
#endif
|
||||
|
||||
/* evaluates to true if expr is of type curl_conv_callback or "similar" */
|
||||
#define _curl_is_conv_cb(expr) \
|
||||
(_curl_is_NULL(expr) || \
|
||||
_curl_callback_compatible((expr), curl_conv_callback) || \
|
||||
_curl_callback_compatible((expr), _curl_conv_callback1) || \
|
||||
_curl_callback_compatible((expr), _curl_conv_callback2) || \
|
||||
_curl_callback_compatible((expr), _curl_conv_callback3) || \
|
||||
_curl_callback_compatible((expr), _curl_conv_callback4))
|
||||
typedef CURLcode (*_curl_conv_callback1)(char *, size_t length);
|
||||
typedef CURLcode (*_curl_conv_callback2)(const char *, size_t length);
|
||||
typedef CURLcode (*_curl_conv_callback3)(void *, size_t length);
|
||||
typedef CURLcode (*_curl_conv_callback4)(const void *, size_t length);
|
||||
|
||||
/* evaluates to true if expr is of type curl_seek_callback or "similar" */
|
||||
#define _curl_is_seek_cb(expr) \
|
||||
(_curl_is_NULL(expr) || \
|
||||
_curl_callback_compatible((expr), curl_seek_callback) || \
|
||||
_curl_callback_compatible((expr), _curl_seek_callback1) || \
|
||||
_curl_callback_compatible((expr), _curl_seek_callback2))
|
||||
typedef CURLcode (*_curl_seek_callback1)(void *, curl_off_t, int);
|
||||
typedef CURLcode (*_curl_seek_callback2)(const void *, curl_off_t, int);
|
||||
|
||||
|
||||
#endif /* __CURL_TYPECHECK_GCC_H */
|
Binary file not shown.
Binary file not shown.
|
@ -1,94 +0,0 @@
|
|||
#include "crypto_sign.h"
|
||||
|
||||
#include "crypto_verify_32.h"
|
||||
#include "crypto_hash_sha512.h"
|
||||
#include "randombytes.h"
|
||||
|
||||
#include "ge25519.h"
|
||||
#include "hram.h"
|
||||
|
||||
#define MAXBATCH 64
|
||||
|
||||
int crypto_sign_open_batch(
|
||||
unsigned char* const m[],unsigned long long mlen[],
|
||||
unsigned char* const sm[],const unsigned long long smlen[],
|
||||
unsigned char* const pk[],
|
||||
unsigned long long num
|
||||
)
|
||||
{
|
||||
int ret = 0;
|
||||
unsigned long long i, j;
|
||||
shortsc25519 r[MAXBATCH];
|
||||
sc25519 scalars[2*MAXBATCH+1];
|
||||
ge25519 points[2*MAXBATCH+1];
|
||||
unsigned char hram[crypto_hash_sha512_BYTES];
|
||||
unsigned long long batchsize;
|
||||
|
||||
for (i = 0;i < num;++i) mlen[i] = -1;
|
||||
|
||||
while (num >= 3) {
|
||||
batchsize = num;
|
||||
if (batchsize > MAXBATCH) batchsize = MAXBATCH;
|
||||
|
||||
for (i = 0;i < batchsize;++i)
|
||||
if (smlen[i] < 64) goto fallback;
|
||||
|
||||
randombytes((unsigned char*)r,sizeof(shortsc25519) * batchsize);
|
||||
|
||||
/* Computing scalars[0] = ((r1s1 + r2s2 + ...)) */
|
||||
for(i=0;i<batchsize;i++)
|
||||
{
|
||||
sc25519_from32bytes(&scalars[i], sm[i]+32);
|
||||
sc25519_mul_shortsc(&scalars[i], &scalars[i], &r[i]);
|
||||
}
|
||||
for(i=1;i<batchsize;i++)
|
||||
sc25519_add(&scalars[0], &scalars[0], &scalars[i]);
|
||||
|
||||
/* Computing scalars[1] ... scalars[batchsize] as r[i]*H(R[i],A[i],m[i]) */
|
||||
for(i=0;i<batchsize;i++)
|
||||
{
|
||||
get_hram(hram, sm[i], pk[i], m[i], smlen[i]);
|
||||
sc25519_from64bytes(&scalars[i+1],hram);
|
||||
sc25519_mul_shortsc(&scalars[i+1],&scalars[i+1],&r[i]);
|
||||
}
|
||||
/* Setting scalars[batchsize+1] ... scalars[2*batchsize] to r[i] */
|
||||
for(i=0;i<batchsize;i++)
|
||||
sc25519_from_shortsc(&scalars[batchsize+i+1],&r[i]);
|
||||
|
||||
/* Computing points */
|
||||
points[0] = ge25519_base;
|
||||
|
||||
for(i=0;i<batchsize;i++)
|
||||
if (ge25519_unpackneg_vartime(&points[i+1], pk[i])) goto fallback;
|
||||
for(i=0;i<batchsize;i++)
|
||||
if (ge25519_unpackneg_vartime(&points[batchsize+i+1], sm[i])) goto fallback;
|
||||
|
||||
ge25519_multi_scalarmult_vartime(points, points, scalars, 2*batchsize+1);
|
||||
|
||||
if (ge25519_isneutral_vartime(points)) {
|
||||
for(i=0;i<batchsize;i++)
|
||||
{
|
||||
for(j=0;j<smlen[i]-64;j++)
|
||||
m[i][j] = sm[i][j + 64];
|
||||
mlen[i] = smlen[i]-64;
|
||||
}
|
||||
} else {
|
||||
fallback:
|
||||
|
||||
for (i = 0;i < batchsize;++i)
|
||||
ret |= crypto_sign_open(m[i], &mlen[i], sm[i], smlen[i], pk[i]);
|
||||
}
|
||||
|
||||
m += batchsize;
|
||||
mlen += batchsize;
|
||||
sm += batchsize;
|
||||
smlen += batchsize;
|
||||
pk += batchsize;
|
||||
num -= batchsize;
|
||||
}
|
||||
|
||||
for (i = 0;i < num;++i)
|
||||
ret |= crypto_sign_open(m[i], &mlen[i], sm[i], smlen[i], pk[i]);
|
||||
|
||||
return ret;
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -1,39 +0,0 @@
|
|||
.data
|
||||
|
||||
.globl crypto_sign_ed25519_amd64_64_121666
|
||||
.globl crypto_sign_ed25519_amd64_64_MU0
|
||||
.globl crypto_sign_ed25519_amd64_64_MU1
|
||||
.globl crypto_sign_ed25519_amd64_64_MU2
|
||||
.globl crypto_sign_ed25519_amd64_64_MU3
|
||||
.globl crypto_sign_ed25519_amd64_64_MU4
|
||||
.globl crypto_sign_ed25519_amd64_64_ORDER0
|
||||
.globl crypto_sign_ed25519_amd64_64_ORDER1
|
||||
.globl crypto_sign_ed25519_amd64_64_ORDER2
|
||||
.globl crypto_sign_ed25519_amd64_64_ORDER3
|
||||
.globl crypto_sign_ed25519_amd64_64_EC2D0
|
||||
.globl crypto_sign_ed25519_amd64_64_EC2D1
|
||||
.globl crypto_sign_ed25519_amd64_64_EC2D2
|
||||
.globl crypto_sign_ed25519_amd64_64_EC2D3
|
||||
.globl crypto_sign_ed25519_amd64_64_38
|
||||
|
||||
.p2align 4
|
||||
|
||||
crypto_sign_ed25519_amd64_64_121666: .quad 121666
|
||||
|
||||
crypto_sign_ed25519_amd64_64_MU0: .quad 0xED9CE5A30A2C131B
|
||||
crypto_sign_ed25519_amd64_64_MU1: .quad 0x2106215D086329A7
|
||||
crypto_sign_ed25519_amd64_64_MU2: .quad 0xFFFFFFFFFFFFFFEB
|
||||
crypto_sign_ed25519_amd64_64_MU3: .quad 0xFFFFFFFFFFFFFFFF
|
||||
crypto_sign_ed25519_amd64_64_MU4: .quad 0x000000000000000F
|
||||
|
||||
crypto_sign_ed25519_amd64_64_ORDER0: .quad 0x5812631A5CF5D3ED
|
||||
crypto_sign_ed25519_amd64_64_ORDER1: .quad 0x14DEF9DEA2F79CD6
|
||||
crypto_sign_ed25519_amd64_64_ORDER2: .quad 0x0000000000000000
|
||||
crypto_sign_ed25519_amd64_64_ORDER3: .quad 0x1000000000000000
|
||||
|
||||
crypto_sign_ed25519_amd64_64_EC2D0: .quad 0xEBD69B9426B2F146
|
||||
crypto_sign_ed25519_amd64_64_EC2D1: .quad 0x00E0149A8283B156
|
||||
crypto_sign_ed25519_amd64_64_EC2D2: .quad 0x198E80F2EEF3D130
|
||||
crypto_sign_ed25519_amd64_64_EC2D3: .quad 0xA406D9DC56DFFCE7
|
||||
|
||||
crypto_sign_ed25519_amd64_64_38: .quad 38
|
|
@ -1,64 +0,0 @@
|
|||
#ifndef FE25519_H
|
||||
#define FE25519_H
|
||||
|
||||
#define fe25519 crypto_sign_ed25519_amd64_64_fe25519
|
||||
#define fe25519_freeze crypto_sign_ed25519_amd64_64_fe25519_freeze
|
||||
#define fe25519_unpack crypto_sign_ed25519_amd64_64_fe25519_unpack
|
||||
#define fe25519_pack crypto_sign_ed25519_amd64_64_fe25519_pack
|
||||
#define fe25519_iszero_vartime crypto_sign_ed25519_amd64_64_fe25519_iszero_vartime
|
||||
#define fe25519_iseq_vartime crypto_sign_ed25519_amd64_64_fe25519_iseq_vartime
|
||||
#define fe25519_cmov crypto_sign_ed25519_amd64_64_fe25519_cmov
|
||||
#define fe25519_setint crypto_sign_ed25519_amd64_64_fe25519_setint
|
||||
#define fe25519_neg crypto_sign_ed25519_amd64_64_fe25519_neg
|
||||
#define fe25519_getparity crypto_sign_ed25519_amd64_64_fe25519_getparity
|
||||
#define fe25519_add crypto_sign_ed25519_amd64_64_fe25519_add
|
||||
#define fe25519_sub crypto_sign_ed25519_amd64_64_fe25519_sub
|
||||
#define fe25519_mul crypto_sign_ed25519_amd64_64_fe25519_mul
|
||||
#define fe25519_mul121666 crypto_sign_ed25519_amd64_64_fe25519_mul121666
|
||||
#define fe25519_square crypto_sign_ed25519_amd64_64_fe25519_square
|
||||
#define fe25519_invert crypto_sign_ed25519_amd64_64_fe25519_invert
|
||||
#define fe25519_pow2523 crypto_sign_ed25519_amd64_64_fe25519_pow2523
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned long long v[4];
|
||||
}
|
||||
fe25519;
|
||||
|
||||
void fe25519_freeze(fe25519 *r);
|
||||
|
||||
void fe25519_unpack(fe25519 *r, const unsigned char x[32]);
|
||||
|
||||
void fe25519_pack(unsigned char r[32], const fe25519 *x);
|
||||
|
||||
void fe25519_cmov(fe25519 *r, const fe25519 *x, unsigned char b);
|
||||
|
||||
void fe25519_cswap(fe25519 *r, fe25519 *x, unsigned char b);
|
||||
|
||||
void fe25519_setint(fe25519 *r, unsigned int v);
|
||||
|
||||
void fe25519_neg(fe25519 *r, const fe25519 *x);
|
||||
|
||||
unsigned char fe25519_getparity(const fe25519 *x);
|
||||
|
||||
int fe25519_iszero_vartime(const fe25519 *x);
|
||||
|
||||
int fe25519_iseq_vartime(const fe25519 *x, const fe25519 *y);
|
||||
|
||||
void fe25519_add(fe25519 *r, const fe25519 *x, const fe25519 *y);
|
||||
|
||||
void fe25519_sub(fe25519 *r, const fe25519 *x, const fe25519 *y);
|
||||
|
||||
void fe25519_mul(fe25519 *r, const fe25519 *x, const fe25519 *y);
|
||||
|
||||
void fe25519_mul121666(fe25519 *r, const fe25519 *x);
|
||||
|
||||
void fe25519_square(fe25519 *r, const fe25519 *x);
|
||||
|
||||
void fe25519_pow(fe25519 *r, const fe25519 *x, const unsigned char *e);
|
||||
|
||||
void fe25519_invert(fe25519 *r, const fe25519 *x);
|
||||
|
||||
void fe25519_pow2523(fe25519 *r, const fe25519 *x);
|
||||
|
||||
#endif
|
|
@ -1,189 +0,0 @@
|
|||
|
||||
# qhasm: int64 rp
|
||||
|
||||
# qhasm: int64 xp
|
||||
|
||||
# qhasm: int64 yp
|
||||
|
||||
# qhasm: input rp
|
||||
|
||||
# qhasm: input xp
|
||||
|
||||
# qhasm: input yp
|
||||
|
||||
# qhasm: int64 r0
|
||||
|
||||
# qhasm: int64 r1
|
||||
|
||||
# qhasm: int64 r2
|
||||
|
||||
# qhasm: int64 r3
|
||||
|
||||
# qhasm: int64 addt0
|
||||
|
||||
# qhasm: int64 addt1
|
||||
|
||||
# qhasm: int64 caller1
|
||||
|
||||
# qhasm: int64 caller2
|
||||
|
||||
# qhasm: int64 caller3
|
||||
|
||||
# qhasm: int64 caller4
|
||||
|
||||
# qhasm: int64 caller5
|
||||
|
||||
# qhasm: int64 caller6
|
||||
|
||||
# qhasm: int64 caller7
|
||||
|
||||
# qhasm: caller caller1
|
||||
|
||||
# qhasm: caller caller2
|
||||
|
||||
# qhasm: caller caller3
|
||||
|
||||
# qhasm: caller caller4
|
||||
|
||||
# qhasm: caller caller5
|
||||
|
||||
# qhasm: caller caller6
|
||||
|
||||
# qhasm: caller caller7
|
||||
|
||||
# qhasm: stack64 caller1_stack
|
||||
|
||||
# qhasm: stack64 caller2_stack
|
||||
|
||||
# qhasm: stack64 caller3_stack
|
||||
|
||||
# qhasm: stack64 caller4_stack
|
||||
|
||||
# qhasm: stack64 caller5_stack
|
||||
|
||||
# qhasm: stack64 caller6_stack
|
||||
|
||||
# qhasm: stack64 caller7_stack
|
||||
|
||||
# qhasm: enter crypto_sign_ed25519_amd64_64_fe25519_add
|
||||
.text
|
||||
.p2align 5
|
||||
.globl _crypto_sign_ed25519_amd64_64_fe25519_add
|
||||
.globl crypto_sign_ed25519_amd64_64_fe25519_add
|
||||
_crypto_sign_ed25519_amd64_64_fe25519_add:
|
||||
crypto_sign_ed25519_amd64_64_fe25519_add:
|
||||
mov %rsp,%r11
|
||||
and $31,%r11
|
||||
add $0,%r11
|
||||
sub %r11,%rsp
|
||||
|
||||
# qhasm: r0 = *(uint64 *)(xp + 0)
|
||||
# asm 1: movq 0(<xp=int64#2),>r0=int64#4
|
||||
# asm 2: movq 0(<xp=%rsi),>r0=%rcx
|
||||
movq 0(%rsi),%rcx
|
||||
|
||||
# qhasm: r1 = *(uint64 *)(xp + 8)
|
||||
# asm 1: movq 8(<xp=int64#2),>r1=int64#5
|
||||
# asm 2: movq 8(<xp=%rsi),>r1=%r8
|
||||
movq 8(%rsi),%r8
|
||||
|
||||
# qhasm: r2 = *(uint64 *)(xp + 16)
|
||||
# asm 1: movq 16(<xp=int64#2),>r2=int64#6
|
||||
# asm 2: movq 16(<xp=%rsi),>r2=%r9
|
||||
movq 16(%rsi),%r9
|
||||
|
||||
# qhasm: r3 = *(uint64 *)(xp + 24)
|
||||
# asm 1: movq 24(<xp=int64#2),>r3=int64#2
|
||||
# asm 2: movq 24(<xp=%rsi),>r3=%rsi
|
||||
movq 24(%rsi),%rsi
|
||||
|
||||
# qhasm: carry? r0 += *(uint64 *)(yp + 0)
|
||||
# asm 1: addq 0(<yp=int64#3),<r0=int64#4
|
||||
# asm 2: addq 0(<yp=%rdx),<r0=%rcx
|
||||
addq 0(%rdx),%rcx
|
||||
|
||||
# qhasm: carry? r1 += *(uint64 *)(yp + 8) + carry
|
||||
# asm 1: adcq 8(<yp=int64#3),<r1=int64#5
|
||||
# asm 2: adcq 8(<yp=%rdx),<r1=%r8
|
||||
adcq 8(%rdx),%r8
|
||||
|
||||
# qhasm: carry? r2 += *(uint64 *)(yp + 16) + carry
|
||||
# asm 1: adcq 16(<yp=int64#3),<r2=int64#6
|
||||
# asm 2: adcq 16(<yp=%rdx),<r2=%r9
|
||||
adcq 16(%rdx),%r9
|
||||
|
||||
# qhasm: carry? r3 += *(uint64 *)(yp + 24) + carry
|
||||
# asm 1: adcq 24(<yp=int64#3),<r3=int64#2
|
||||
# asm 2: adcq 24(<yp=%rdx),<r3=%rsi
|
||||
adcq 24(%rdx),%rsi
|
||||
|
||||
# qhasm: addt0 = 0
|
||||
# asm 1: mov $0,>addt0=int64#3
|
||||
# asm 2: mov $0,>addt0=%rdx
|
||||
mov $0,%rdx
|
||||
|
||||
# qhasm: addt1 = 38
|
||||
# asm 1: mov $38,>addt1=int64#7
|
||||
# asm 2: mov $38,>addt1=%rax
|
||||
mov $38,%rax
|
||||
|
||||
# qhasm: addt1 = addt0 if !carry
|
||||
# asm 1: cmovae <addt0=int64#3,<addt1=int64#7
|
||||
# asm 2: cmovae <addt0=%rdx,<addt1=%rax
|
||||
cmovae %rdx,%rax
|
||||
|
||||
# qhasm: carry? r0 += addt1
|
||||
# asm 1: add <addt1=int64#7,<r0=int64#4
|
||||
# asm 2: add <addt1=%rax,<r0=%rcx
|
||||
add %rax,%rcx
|
||||
|
||||
# qhasm: carry? r1 += addt0 + carry
|
||||
# asm 1: adc <addt0=int64#3,<r1=int64#5
|
||||
# asm 2: adc <addt0=%rdx,<r1=%r8
|
||||
adc %rdx,%r8
|
||||
|
||||
# qhasm: carry? r2 += addt0 + carry
|
||||
# asm 1: adc <addt0=int64#3,<r2=int64#6
|
||||
# asm 2: adc <addt0=%rdx,<r2=%r9
|
||||
adc %rdx,%r9
|
||||
|
||||
# qhasm: carry? r3 += addt0 + carry
|
||||
# asm 1: adc <addt0=int64#3,<r3=int64#2
|
||||
# asm 2: adc <addt0=%rdx,<r3=%rsi
|
||||
adc %rdx,%rsi
|
||||
|
||||
# qhasm: addt0 = addt1 if carry
|
||||
# asm 1: cmovc <addt1=int64#7,<addt0=int64#3
|
||||
# asm 2: cmovc <addt1=%rax,<addt0=%rdx
|
||||
cmovc %rax,%rdx
|
||||
|
||||
# qhasm: r0 += addt0
|
||||
# asm 1: add <addt0=int64#3,<r0=int64#4
|
||||
# asm 2: add <addt0=%rdx,<r0=%rcx
|
||||
add %rdx,%rcx
|
||||
|
||||
# qhasm: *(uint64 *)(rp + 0) = r0
|
||||
# asm 1: movq <r0=int64#4,0(<rp=int64#1)
|
||||
# asm 2: movq <r0=%rcx,0(<rp=%rdi)
|
||||
movq %rcx,0(%rdi)
|
||||
|
||||
# qhasm: *(uint64 *)(rp + 8) = r1
|
||||
# asm 1: movq <r1=int64#5,8(<rp=int64#1)
|
||||
# asm 2: movq <r1=%r8,8(<rp=%rdi)
|
||||
movq %r8,8(%rdi)
|
||||
|
||||
# qhasm: *(uint64 *)(rp + 16) = r2
|
||||
# asm 1: movq <r2=int64#6,16(<rp=int64#1)
|
||||
# asm 2: movq <r2=%r9,16(<rp=%rdi)
|
||||
movq %r9,16(%rdi)
|
||||
|
||||
# qhasm: *(uint64 *)(rp + 24) = r3
|
||||
# asm 1: movq <r3=int64#2,24(<rp=int64#1)
|
||||
# asm 2: movq <r3=%rsi,24(<rp=%rdi)
|
||||
movq %rsi,24(%rdi)
|
||||
|
||||
# qhasm: leave
|
||||
add %r11,%rsp
|
||||
mov %rdi,%rax
|
||||
mov %rsi,%rdx
|
||||
ret
|
|
@ -1,322 +0,0 @@
|
|||
|
||||
# qhasm: int64 rp
|
||||
|
||||
# qhasm: input rp
|
||||
|
||||
# qhasm: int64 r0
|
||||
|
||||
# qhasm: int64 r1
|
||||
|
||||
# qhasm: int64 r2
|
||||
|
||||
# qhasm: int64 r3
|
||||
|
||||
# qhasm: int64 t0
|
||||
|
||||
# qhasm: int64 t1
|
||||
|
||||
# qhasm: int64 t2
|
||||
|
||||
# qhasm: int64 t3
|
||||
|
||||
# qhasm: int64 two63
|
||||
|
||||
# qhasm: int64 caller1
|
||||
|
||||
# qhasm: int64 caller2
|
||||
|
||||
# qhasm: int64 caller3
|
||||
|
||||
# qhasm: int64 caller4
|
||||
|
||||
# qhasm: int64 caller5
|
||||
|
||||
# qhasm: int64 caller6
|
||||
|
||||
# qhasm: int64 caller7
|
||||
|
||||
# qhasm: caller caller1
|
||||
|
||||
# qhasm: caller caller2
|
||||
|
||||
# qhasm: caller caller3
|
||||
|
||||
# qhasm: caller caller4
|
||||
|
||||
# qhasm: caller caller5
|
||||
|
||||
# qhasm: caller caller6
|
||||
|
||||
# qhasm: caller caller7
|
||||
|
||||
# qhasm: stack64 caller1_stack
|
||||
|
||||
# qhasm: stack64 caller2_stack
|
||||
|
||||
# qhasm: stack64 caller3_stack
|
||||
|
||||
# qhasm: stack64 caller4_stack
|
||||
|
||||
# qhasm: stack64 caller5_stack
|
||||
|
||||
# qhasm: stack64 caller6_stack
|
||||
|
||||
# qhasm: stack64 caller7_stack
|
||||
|
||||
# qhasm: enter crypto_sign_ed25519_amd64_64_fe25519_freeze
|
||||
.text
|
||||
.p2align 5
|
||||
.globl _crypto_sign_ed25519_amd64_64_fe25519_freeze
|
||||
.globl crypto_sign_ed25519_amd64_64_fe25519_freeze
|
||||
_crypto_sign_ed25519_amd64_64_fe25519_freeze:
|
||||
crypto_sign_ed25519_amd64_64_fe25519_freeze:
|
||||
mov %rsp,%r11
|
||||
and $31,%r11
|
||||
add $64,%r11
|
||||
sub %r11,%rsp
|
||||
|
||||
# qhasm: caller1_stack = caller1
|
||||
# asm 1: movq <caller1=int64#9,>caller1_stack=stack64#1
|
||||
# asm 2: movq <caller1=%r11,>caller1_stack=0(%rsp)
|
||||
movq %r11,0(%rsp)
|
||||
|
||||
# qhasm: caller2_stack = caller2
|
||||
# asm 1: movq <caller2=int64#10,>caller2_stack=stack64#2
|
||||
# asm 2: movq <caller2=%r12,>caller2_stack=8(%rsp)
|
||||
movq %r12,8(%rsp)
|
||||
|
||||
# qhasm: caller3_stack = caller3
|
||||
# asm 1: movq <caller3=int64#11,>caller3_stack=stack64#3
|
||||
# asm 2: movq <caller3=%r13,>caller3_stack=16(%rsp)
|
||||
movq %r13,16(%rsp)
|
||||
|
||||
# qhasm: caller4_stack = caller4
|
||||
# asm 1: movq <caller4=int64#12,>caller4_stack=stack64#4
|
||||
# asm 2: movq <caller4=%r14,>caller4_stack=24(%rsp)
|
||||
movq %r14,24(%rsp)
|
||||
|
||||
# qhasm: caller5_stack = caller5
|
||||
# asm 1: movq <caller5=int64#13,>caller5_stack=stack64#5
|
||||
# asm 2: movq <caller5=%r15,>caller5_stack=32(%rsp)
|
||||
movq %r15,32(%rsp)
|
||||
|
||||
# qhasm: caller6_stack = caller6
|
||||
# asm 1: movq <caller6=int64#14,>caller6_stack=stack64#6
|
||||
# asm 2: movq <caller6=%rbx,>caller6_stack=40(%rsp)
|
||||
movq %rbx,40(%rsp)
|
||||
|
||||
# qhasm: caller7_stack = caller7
|
||||
# asm 1: movq <caller7=int64#15,>caller7_stack=stack64#7
|
||||
# asm 2: movq <caller7=%rbp,>caller7_stack=48(%rsp)
|
||||
movq %rbp,48(%rsp)
|
||||
|
||||
# qhasm: r0 = *(uint64 *) (rp + 0)
|
||||
# asm 1: movq 0(<rp=int64#1),>r0=int64#2
|
||||
# asm 2: movq 0(<rp=%rdi),>r0=%rsi
|
||||
movq 0(%rdi),%rsi
|
||||
|
||||
# qhasm: r1 = *(uint64 *) (rp + 8)
|
||||
# asm 1: movq 8(<rp=int64#1),>r1=int64#3
|
||||
# asm 2: movq 8(<rp=%rdi),>r1=%rdx
|
||||
movq 8(%rdi),%rdx
|
||||
|
||||
# qhasm: r2 = *(uint64 *) (rp + 16)
|
||||
# asm 1: movq 16(<rp=int64#1),>r2=int64#4
|
||||
# asm 2: movq 16(<rp=%rdi),>r2=%rcx
|
||||
movq 16(%rdi),%rcx
|
||||
|
||||
# qhasm: r3 = *(uint64 *) (rp + 24)
|
||||
# asm 1: movq 24(<rp=int64#1),>r3=int64#5
|
||||
# asm 2: movq 24(<rp=%rdi),>r3=%r8
|
||||
movq 24(%rdi),%r8
|
||||
|
||||
# qhasm: t0 = r0
|
||||
# asm 1: mov <r0=int64#2,>t0=int64#6
|
||||
# asm 2: mov <r0=%rsi,>t0=%r9
|
||||
mov %rsi,%r9
|
||||
|
||||
# qhasm: t1 = r1
|
||||
# asm 1: mov <r1=int64#3,>t1=int64#7
|
||||
# asm 2: mov <r1=%rdx,>t1=%rax
|
||||
mov %rdx,%rax
|
||||
|
||||
# qhasm: t2 = r2
|
||||
# asm 1: mov <r2=int64#4,>t2=int64#8
|
||||
# asm 2: mov <r2=%rcx,>t2=%r10
|
||||
mov %rcx,%r10
|
||||
|
||||
# qhasm: t3 = r3
|
||||
# asm 1: mov <r3=int64#5,>t3=int64#9
|
||||
# asm 2: mov <r3=%r8,>t3=%r11
|
||||
mov %r8,%r11
|
||||
|
||||
# qhasm: two63 = 1
|
||||
# asm 1: mov $1,>two63=int64#10
|
||||
# asm 2: mov $1,>two63=%r12
|
||||
mov $1,%r12
|
||||
|
||||
# qhasm: two63 <<= 63
|
||||
# asm 1: shl $63,<two63=int64#10
|
||||
# asm 2: shl $63,<two63=%r12
|
||||
shl $63,%r12
|
||||
|
||||
# qhasm: carry? t0 += 19
|
||||
# asm 1: add $19,<t0=int64#6
|
||||
# asm 2: add $19,<t0=%r9
|
||||
add $19,%r9
|
||||
|
||||
# qhasm: carry? t1 += 0 + carry
|
||||
# asm 1: adc $0,<t1=int64#7
|
||||
# asm 2: adc $0,<t1=%rax
|
||||
adc $0,%rax
|
||||
|
||||
# qhasm: carry? t2 += 0 + carry
|
||||
# asm 1: adc $0,<t2=int64#8
|
||||
# asm 2: adc $0,<t2=%r10
|
||||
adc $0,%r10
|
||||
|
||||
# qhasm: carry? t3 += two63 + carry
|
||||
# asm 1: adc <two63=int64#10,<t3=int64#9
|
||||
# asm 2: adc <two63=%r12,<t3=%r11
|
||||
adc %r12,%r11
|
||||
|
||||
# qhasm: r0 = t0 if carry
|
||||
# asm 1: cmovc <t0=int64#6,<r0=int64#2
|
||||
# asm 2: cmovc <t0=%r9,<r0=%rsi
|
||||
cmovc %r9,%rsi
|
||||
|
||||
# qhasm: r1 = t1 if carry
|
||||
# asm 1: cmovc <t1=int64#7,<r1=int64#3
|
||||
# asm 2: cmovc <t1=%rax,<r1=%rdx
|
||||
cmovc %rax,%rdx
|
||||
|
||||
# qhasm: r2 = t2 if carry
|
||||
# asm 1: cmovc <t2=int64#8,<r2=int64#4
|
||||
# asm 2: cmovc <t2=%r10,<r2=%rcx
|
||||
cmovc %r10,%rcx
|
||||
|
||||
# qhasm: r3 = t3 if carry
|
||||
# asm 1: cmovc <t3=int64#9,<r3=int64#5
|
||||
# asm 2: cmovc <t3=%r11,<r3=%r8
|
||||
cmovc %r11,%r8
|
||||
|
||||
# qhasm: t0 = r0
|
||||
# asm 1: mov <r0=int64#2,>t0=int64#6
|
||||
# asm 2: mov <r0=%rsi,>t0=%r9
|
||||
mov %rsi,%r9
|
||||
|
||||
# qhasm: t1 = r1
|
||||
# asm 1: mov <r1=int64#3,>t1=int64#7
|
||||
# asm 2: mov <r1=%rdx,>t1=%rax
|
||||
mov %rdx,%rax
|
||||
|
||||
# qhasm: t2 = r2
|
||||
# asm 1: mov <r2=int64#4,>t2=int64#8
|
||||
# asm 2: mov <r2=%rcx,>t2=%r10
|
||||
mov %rcx,%r10
|
||||
|
||||
# qhasm: t3 = r3
|
||||
# asm 1: mov <r3=int64#5,>t3=int64#9
|
||||
# asm 2: mov <r3=%r8,>t3=%r11
|
||||
mov %r8,%r11
|
||||
|
||||
# qhasm: carry? t0 += 19
|
||||
# asm 1: add $19,<t0=int64#6
|
||||
# asm 2: add $19,<t0=%r9
|
||||
add $19,%r9
|
||||
|
||||
# qhasm: carry? t1 += 0 + carry
|
||||
# asm 1: adc $0,<t1=int64#7
|
||||
# asm 2: adc $0,<t1=%rax
|
||||
adc $0,%rax
|
||||
|
||||
# qhasm: carry? t2 += 0 + carry
|
||||
# asm 1: adc $0,<t2=int64#8
|
||||
# asm 2: adc $0,<t2=%r10
|
||||
adc $0,%r10
|
||||
|
||||
# qhasm: carry? t3 += two63 + carry
|
||||
# asm 1: adc <two63=int64#10,<t3=int64#9
|
||||
# asm 2: adc <two63=%r12,<t3=%r11
|
||||
adc %r12,%r11
|
||||
|
||||
# qhasm: r0 = t0 if carry
|
||||
# asm 1: cmovc <t0=int64#6,<r0=int64#2
|
||||
# asm 2: cmovc <t0=%r9,<r0=%rsi
|
||||
cmovc %r9,%rsi
|
||||
|
||||
# qhasm: r1 = t1 if carry
|
||||
# asm 1: cmovc <t1=int64#7,<r1=int64#3
|
||||
# asm 2: cmovc <t1=%rax,<r1=%rdx
|
||||
cmovc %rax,%rdx
|
||||
|
||||
# qhasm: r2 = t2 if carry
|
||||
# asm 1: cmovc <t2=int64#8,<r2=int64#4
|
||||
# asm 2: cmovc <t2=%r10,<r2=%rcx
|
||||
cmovc %r10,%rcx
|
||||
|
||||
# qhasm: r3 = t3 if carry
|
||||
# asm 1: cmovc <t3=int64#9,<r3=int64#5
|
||||
# asm 2: cmovc <t3=%r11,<r3=%r8
|
||||
cmovc %r11,%r8
|
||||
|
||||
# qhasm: *(uint64 *)(rp + 0) = r0
|
||||
# asm 1: movq <r0=int64#2,0(<rp=int64#1)
|
||||
# asm 2: movq <r0=%rsi,0(<rp=%rdi)
|
||||
movq %rsi,0(%rdi)
|
||||
|
||||
# qhasm: *(uint64 *)(rp + 8) = r1
|
||||
# asm 1: movq <r1=int64#3,8(<rp=int64#1)
|
||||
# asm 2: movq <r1=%rdx,8(<rp=%rdi)
|
||||
movq %rdx,8(%rdi)
|
||||
|
||||
# qhasm: *(uint64 *)(rp + 16) = r2
|
||||
# asm 1: movq <r2=int64#4,16(<rp=int64#1)
|
||||
# asm 2: movq <r2=%rcx,16(<rp=%rdi)
|
||||
movq %rcx,16(%rdi)
|
||||
|
||||
# qhasm: *(uint64 *)(rp + 24) = r3
|
||||
# asm 1: movq <r3=int64#5,24(<rp=int64#1)
|
||||
# asm 2: movq <r3=%r8,24(<rp=%rdi)
|
||||
movq %r8,24(%rdi)
|
||||
|
||||
# qhasm: caller1 = caller1_stack
|
||||
# asm 1: movq <caller1_stack=stack64#1,>caller1=int64#9
|
||||
# asm 2: movq <caller1_stack=0(%rsp),>caller1=%r11
|
||||
movq 0(%rsp),%r11
|
||||
|
||||
# qhasm: caller2 = caller2_stack
|
||||
# asm 1: movq <caller2_stack=stack64#2,>caller2=int64#10
|
||||
# asm 2: movq <caller2_stack=8(%rsp),>caller2=%r12
|
||||
movq 8(%rsp),%r12
|
||||
|
||||
# qhasm: caller3 = caller3_stack
|
||||
# asm 1: movq <caller3_stack=stack64#3,>caller3=int64#11
|
||||
# asm 2: movq <caller3_stack=16(%rsp),>caller3=%r13
|
||||
movq 16(%rsp),%r13
|
||||
|
||||
# qhasm: caller4 = caller4_stack
|
||||
# asm 1: movq <caller4_stack=stack64#4,>caller4=int64#12
|
||||
# asm 2: movq <caller4_stack=24(%rsp),>caller4=%r14
|
||||
movq 24(%rsp),%r14
|
||||
|
||||
# qhasm: caller5 = caller5_stack
|
||||
# asm 1: movq <caller5_stack=stack64#5,>caller5=int64#13
|
||||
# asm 2: movq <caller5_stack=32(%rsp),>caller5=%r15
|
||||
movq 32(%rsp),%r15
|
||||
|
||||
# qhasm: caller6 = caller6_stack
|
||||
# asm 1: movq <caller6_stack=stack64#6,>caller6=int64#14
|
||||
# asm 2: movq <caller6_stack=40(%rsp),>caller6=%rbx
|
||||
movq 40(%rsp),%rbx
|
||||
|
||||
# qhasm: caller7 = caller7_stack
|
||||
# asm 1: movq <caller7_stack=stack64#7,>caller7=int64#15
|
||||
# asm 2: movq <caller7_stack=48(%rsp),>caller7=%rbp
|
||||
movq 48(%rsp),%rbp
|
||||
|
||||
# qhasm: leave
|
||||
add %r11,%rsp
|
||||
mov %rdi,%rax
|
||||
mov %rsi,%rdx
|
||||
ret
|
|
@ -1,8 +0,0 @@
|
|||
#include "fe25519.h"
|
||||
|
||||
unsigned char fe25519_getparity(const fe25519 *x)
|
||||
{
|
||||
fe25519 t = *x;
|
||||
fe25519_freeze(&t);
|
||||
return (unsigned char)t.v[0] & 1;
|
||||
}
|
|
@ -1,60 +0,0 @@
|
|||
#include "fe25519.h"
|
||||
|
||||
void fe25519_invert(fe25519 *r, const fe25519 *x)
|
||||
{
|
||||
fe25519 z2;
|
||||
fe25519 z9;
|
||||
fe25519 z11;
|
||||
fe25519 z2_5_0;
|
||||
fe25519 z2_10_0;
|
||||
fe25519 z2_20_0;
|
||||
fe25519 z2_50_0;
|
||||
fe25519 z2_100_0;
|
||||
fe25519 t;
|
||||
int i;
|
||||
|
||||
/* 2 */ fe25519_square(&z2,x);
|
||||
/* 4 */ fe25519_square(&t,&z2);
|
||||
/* 8 */ fe25519_square(&t,&t);
|
||||
/* 9 */ fe25519_mul(&z9,&t,x);
|
||||
/* 11 */ fe25519_mul(&z11,&z9,&z2);
|
||||
/* 22 */ fe25519_square(&t,&z11);
|
||||
/* 2^5 - 2^0 = 31 */ fe25519_mul(&z2_5_0,&t,&z9);
|
||||
|
||||
/* 2^6 - 2^1 */ fe25519_square(&t,&z2_5_0);
|
||||
/* 2^20 - 2^10 */ for (i = 1;i < 5;i++) { fe25519_square(&t,&t); }
|
||||
/* 2^10 - 2^0 */ fe25519_mul(&z2_10_0,&t,&z2_5_0);
|
||||
|
||||
/* 2^11 - 2^1 */ fe25519_square(&t,&z2_10_0);
|
||||
/* 2^20 - 2^10 */ for (i = 1;i < 10;i++) { fe25519_square(&t,&t); }
|
||||
/* 2^20 - 2^0 */ fe25519_mul(&z2_20_0,&t,&z2_10_0);
|
||||
|
||||
/* 2^21 - 2^1 */ fe25519_square(&t,&z2_20_0);
|
||||
/* 2^40 - 2^20 */ for (i = 1;i < 20;i++) { fe25519_square(&t,&t); }
|
||||
/* 2^40 - 2^0 */ fe25519_mul(&t,&t,&z2_20_0);
|
||||
|
||||
/* 2^41 - 2^1 */ fe25519_square(&t,&t);
|
||||
/* 2^50 - 2^10 */ for (i = 1;i < 10;i++) { fe25519_square(&t,&t); }
|
||||
/* 2^50 - 2^0 */ fe25519_mul(&z2_50_0,&t,&z2_10_0);
|
||||
|
||||
/* 2^51 - 2^1 */ fe25519_square(&t,&z2_50_0);
|
||||
/* 2^100 - 2^50 */ for (i = 1;i < 50;i++) { fe25519_square(&t,&t); }
|
||||
/* 2^100 - 2^0 */ fe25519_mul(&z2_100_0,&t,&z2_50_0);
|
||||
|
||||
/* 2^101 - 2^1 */ fe25519_square(&t,&z2_100_0);
|
||||
/* 2^200 - 2^100 */ for (i = 1;i < 100;i++) { fe25519_square(&t,&t); }
|
||||
/* 2^200 - 2^0 */ fe25519_mul(&t,&t,&z2_100_0);
|
||||
|
||||
/* 2^201 - 2^1 */ fe25519_square(&t,&t);
|
||||
/* 2^250 - 2^50 */ for (i = 1;i < 50;i++) { fe25519_square(&t,&t); }
|
||||
/* 2^250 - 2^0 */ fe25519_mul(&t,&t,&z2_50_0);
|
||||
|
||||
/* 2^251 - 2^1 */ fe25519_square(&t,&t);
|
||||
/* 2^252 - 2^2 */ fe25519_square(&t,&t);
|
||||
/* 2^253 - 2^3 */ fe25519_square(&t,&t);
|
||||
|
||||
/* 2^254 - 2^4 */ fe25519_square(&t,&t);
|
||||
|
||||
/* 2^255 - 2^5 */ fe25519_square(&t,&t);
|
||||
/* 2^255 - 21 */ fe25519_mul(r,&t,&z11);
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
#include "fe25519.h"
|
||||
|
||||
int fe25519_iseq_vartime(const fe25519 *x, const fe25519 *y)
|
||||
{
|
||||
fe25519 t1 = *x;
|
||||
fe25519 t2 = *y;
|
||||
fe25519_freeze(&t1);
|
||||
fe25519_freeze(&t2);
|
||||
if(t1.v[0] != t2.v[0]) return 0;
|
||||
if(t1.v[1] != t2.v[1]) return 0;
|
||||
if(t1.v[2] != t2.v[2]) return 0;
|
||||
if(t1.v[3] != t2.v[3]) return 0;
|
||||
return 1;
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
#include "fe25519.h"
|
||||
|
||||
int fe25519_iszero_vartime(const fe25519 *x)
|
||||
{
|
||||
fe25519 t = *x;
|
||||
fe25519_freeze(&t);
|
||||
if (t.v[0]) return 0;
|
||||
if (t.v[1]) return 0;
|
||||
if (t.v[2]) return 0;
|
||||
if (t.v[3]) return 0;
|
||||
return 1;
|
||||
}
|
|
@ -1,865 +0,0 @@
|
|||
|
||||
# qhasm: int64 rp
|
||||
|
||||
# qhasm: int64 xp
|
||||
|
||||
# qhasm: int64 yp
|
||||
|
||||
# qhasm: input rp
|
||||
|
||||
# qhasm: input xp
|
||||
|
||||
# qhasm: input yp
|
||||
|
||||
# qhasm: int64 r0
|
||||
|
||||
# qhasm: int64 r1
|
||||
|
||||
# qhasm: int64 r2
|
||||
|
||||
# qhasm: int64 r3
|
||||
|
||||
# qhasm: int64 caller1
|
||||
|
||||
# qhasm: int64 caller2
|
||||
|
||||
# qhasm: int64 caller3
|
||||
|
||||
# qhasm: int64 caller4
|
||||
|
||||
# qhasm: int64 caller5
|
||||
|
||||
# qhasm: int64 caller6
|
||||
|
||||
# qhasm: int64 caller7
|
||||
|
||||
# qhasm: caller caller1
|
||||
|
||||
# qhasm: caller caller2
|
||||
|
||||
# qhasm: caller caller3
|
||||
|
||||
# qhasm: caller caller4
|
||||
|
||||
# qhasm: caller caller5
|
||||
|
||||
# qhasm: caller caller6
|
||||
|
||||
# qhasm: caller caller7
|
||||
|
||||
# qhasm: stack64 caller1_stack
|
||||
|
||||
# qhasm: stack64 caller2_stack
|
||||
|
||||
# qhasm: stack64 caller3_stack
|
||||
|
||||
# qhasm: stack64 caller4_stack
|
||||
|
||||
# qhasm: stack64 caller5_stack
|
||||
|
||||
# qhasm: stack64 caller6_stack
|
||||
|
||||
# qhasm: stack64 caller7_stack
|
||||
|
||||
# qhasm: int64 mulr4
|
||||
|
||||
# qhasm: int64 mulr5
|
||||
|
||||
# qhasm: int64 mulr6
|
||||
|
||||
# qhasm: int64 mulr7
|
||||
|
||||
# qhasm: int64 mulr8
|
||||
|
||||
# qhasm: int64 mulrax
|
||||
|
||||
# qhasm: int64 mulrdx
|
||||
|
||||
# qhasm: int64 mulx0
|
||||
|
||||
# qhasm: int64 mulx1
|
||||
|
||||
# qhasm: int64 mulx2
|
||||
|
||||
# qhasm: int64 mulx3
|
||||
|
||||
# qhasm: int64 mulc
|
||||
|
||||
# qhasm: int64 mulzero
|
||||
|
||||
# qhasm: int64 muli38
|
||||
|
||||
# qhasm: enter crypto_sign_ed25519_amd64_64_fe25519_mul
|
||||
.text
|
||||
.p2align 5
|
||||
.globl _crypto_sign_ed25519_amd64_64_fe25519_mul
|
||||
.globl crypto_sign_ed25519_amd64_64_fe25519_mul
|
||||
_crypto_sign_ed25519_amd64_64_fe25519_mul:
|
||||
crypto_sign_ed25519_amd64_64_fe25519_mul:
|
||||
mov %rsp,%r11
|
||||
and $31,%r11
|
||||
add $64,%r11
|
||||
sub %r11,%rsp
|
||||
|
||||
# qhasm: caller1_stack = caller1
|
||||
# asm 1: movq <caller1=int64#9,>caller1_stack=stack64#1
|
||||
# asm 2: movq <caller1=%r11,>caller1_stack=0(%rsp)
|
||||
movq %r11,0(%rsp)
|
||||
|
||||
# qhasm: caller2_stack = caller2
|
||||
# asm 1: movq <caller2=int64#10,>caller2_stack=stack64#2
|
||||
# asm 2: movq <caller2=%r12,>caller2_stack=8(%rsp)
|
||||
movq %r12,8(%rsp)
|
||||
|
||||
# qhasm: caller3_stack = caller3
|
||||
# asm 1: movq <caller3=int64#11,>caller3_stack=stack64#3
|
||||
# asm 2: movq <caller3=%r13,>caller3_stack=16(%rsp)
|
||||
movq %r13,16(%rsp)
|
||||
|
||||
# qhasm: caller4_stack = caller4
|
||||
# asm 1: movq <caller4=int64#12,>caller4_stack=stack64#4
|
||||
# asm 2: movq <caller4=%r14,>caller4_stack=24(%rsp)
|
||||
movq %r14,24(%rsp)
|
||||
|
||||
# qhasm: caller5_stack = caller5
|
||||
# asm 1: movq <caller5=int64#13,>caller5_stack=stack64#5
|
||||
# asm 2: movq <caller5=%r15,>caller5_stack=32(%rsp)
|
||||
movq %r15,32(%rsp)
|
||||
|
||||
# qhasm: caller6_stack = caller6
|
||||
# asm 1: movq <caller6=int64#14,>caller6_stack=stack64#6
|
||||
# asm 2: movq <caller6=%rbx,>caller6_stack=40(%rsp)
|
||||
movq %rbx,40(%rsp)
|
||||
|
||||
# qhasm: caller7_stack = caller7
|
||||
# asm 1: movq <caller7=int64#15,>caller7_stack=stack64#7
|
||||
# asm 2: movq <caller7=%rbp,>caller7_stack=48(%rsp)
|
||||
movq %rbp,48(%rsp)
|
||||
|
||||
# qhasm: yp = yp
|
||||
# asm 1: mov <yp=int64#3,>yp=int64#4
|
||||
# asm 2: mov <yp=%rdx,>yp=%rcx
|
||||
mov %rdx,%rcx
|
||||
|
||||
# qhasm: mulr4 = 0
|
||||
# asm 1: mov $0,>mulr4=int64#5
|
||||
# asm 2: mov $0,>mulr4=%r8
|
||||
mov $0,%r8
|
||||
|
||||
# qhasm: mulr5 = 0
|
||||
# asm 1: mov $0,>mulr5=int64#6
|
||||
# asm 2: mov $0,>mulr5=%r9
|
||||
mov $0,%r9
|
||||
|
||||
# qhasm: mulr6 = 0
|
||||
# asm 1: mov $0,>mulr6=int64#8
|
||||
# asm 2: mov $0,>mulr6=%r10
|
||||
mov $0,%r10
|
||||
|
||||
# qhasm: mulr7 = 0
|
||||
# asm 1: mov $0,>mulr7=int64#9
|
||||
# asm 2: mov $0,>mulr7=%r11
|
||||
mov $0,%r11
|
||||
|
||||
# qhasm: mulx0 = *(uint64 *)(xp + 0)
|
||||
# asm 1: movq 0(<xp=int64#2),>mulx0=int64#10
|
||||
# asm 2: movq 0(<xp=%rsi),>mulx0=%r12
|
||||
movq 0(%rsi),%r12
|
||||
|
||||
# qhasm: mulrax = *(uint64 *)(yp + 0)
|
||||
# asm 1: movq 0(<yp=int64#4),>mulrax=int64#7
|
||||
# asm 2: movq 0(<yp=%rcx),>mulrax=%rax
|
||||
movq 0(%rcx),%rax
|
||||
|
||||
# qhasm: (uint128) mulrdx mulrax = mulrax * mulx0
|
||||
# asm 1: mul <mulx0=int64#10
|
||||
# asm 2: mul <mulx0=%r12
|
||||
mul %r12
|
||||
|
||||
# qhasm: r0 = mulrax
|
||||
# asm 1: mov <mulrax=int64#7,>r0=int64#11
|
||||
# asm 2: mov <mulrax=%rax,>r0=%r13
|
||||
mov %rax,%r13
|
||||
|
||||
# qhasm: r1 = mulrdx
|
||||
# asm 1: mov <mulrdx=int64#3,>r1=int64#12
|
||||
# asm 2: mov <mulrdx=%rdx,>r1=%r14
|
||||
mov %rdx,%r14
|
||||
|
||||
# qhasm: mulrax = *(uint64 *)(yp + 8)
|
||||
# asm 1: movq 8(<yp=int64#4),>mulrax=int64#7
|
||||
# asm 2: movq 8(<yp=%rcx),>mulrax=%rax
|
||||
movq 8(%rcx),%rax
|
||||
|
||||
# qhasm: (uint128) mulrdx mulrax = mulrax * mulx0
|
||||
# asm 1: mul <mulx0=int64#10
|
||||
# asm 2: mul <mulx0=%r12
|
||||
mul %r12
|
||||
|
||||
# qhasm: carry? r1 += mulrax
|
||||
# asm 1: add <mulrax=int64#7,<r1=int64#12
|
||||
# asm 2: add <mulrax=%rax,<r1=%r14
|
||||
add %rax,%r14
|
||||
|
||||
# qhasm: r2 = 0
|
||||
# asm 1: mov $0,>r2=int64#13
|
||||
# asm 2: mov $0,>r2=%r15
|
||||
mov $0,%r15
|
||||
|
||||
# qhasm: r2 += mulrdx + carry
|
||||
# asm 1: adc <mulrdx=int64#3,<r2=int64#13
|
||||
# asm 2: adc <mulrdx=%rdx,<r2=%r15
|
||||
adc %rdx,%r15
|
||||
|
||||
# qhasm: mulrax = *(uint64 *)(yp + 16)
|
||||
# asm 1: movq 16(<yp=int64#4),>mulrax=int64#7
|
||||
# asm 2: movq 16(<yp=%rcx),>mulrax=%rax
|
||||
movq 16(%rcx),%rax
|
||||
|
||||
# qhasm: (uint128) mulrdx mulrax = mulrax * mulx0
|
||||
# asm 1: mul <mulx0=int64#10
|
||||
# asm 2: mul <mulx0=%r12
|
||||
mul %r12
|
||||
|
||||
# qhasm: carry? r2 += mulrax
|
||||
# asm 1: add <mulrax=int64#7,<r2=int64#13
|
||||
# asm 2: add <mulrax=%rax,<r2=%r15
|
||||
add %rax,%r15
|
||||
|
||||
# qhasm: r3 = 0
|
||||
# asm 1: mov $0,>r3=int64#14
|
||||
# asm 2: mov $0,>r3=%rbx
|
||||
mov $0,%rbx
|
||||
|
||||
# qhasm: r3 += mulrdx + carry
|
||||
# asm 1: adc <mulrdx=int64#3,<r3=int64#14
|
||||
# asm 2: adc <mulrdx=%rdx,<r3=%rbx
|
||||
adc %rdx,%rbx
|
||||
|
||||
# qhasm: mulrax = *(uint64 *)(yp + 24)
|
||||
# asm 1: movq 24(<yp=int64#4),>mulrax=int64#7
|
||||
# asm 2: movq 24(<yp=%rcx),>mulrax=%rax
|
||||
movq 24(%rcx),%rax
|
||||
|
||||
# qhasm: (uint128) mulrdx mulrax = mulrax * mulx0
|
||||
# asm 1: mul <mulx0=int64#10
|
||||
# asm 2: mul <mulx0=%r12
|
||||
mul %r12
|
||||
|
||||
# qhasm: carry? r3 += mulrax
|
||||
# asm 1: add <mulrax=int64#7,<r3=int64#14
|
||||
# asm 2: add <mulrax=%rax,<r3=%rbx
|
||||
add %rax,%rbx
|
||||
|
||||
# qhasm: mulr4 += mulrdx + carry
|
||||
# asm 1: adc <mulrdx=int64#3,<mulr4=int64#5
|
||||
# asm 2: adc <mulrdx=%rdx,<mulr4=%r8
|
||||
adc %rdx,%r8
|
||||
|
||||
# qhasm: mulx1 = *(uint64 *)(xp + 8)
|
||||
# asm 1: movq 8(<xp=int64#2),>mulx1=int64#10
|
||||
# asm 2: movq 8(<xp=%rsi),>mulx1=%r12
|
||||
movq 8(%rsi),%r12
|
||||
|
||||
# qhasm: mulrax = *(uint64 *)(yp + 0)
|
||||
# asm 1: movq 0(<yp=int64#4),>mulrax=int64#7
|
||||
# asm 2: movq 0(<yp=%rcx),>mulrax=%rax
|
||||
movq 0(%rcx),%rax
|
||||
|
||||
# qhasm: (uint128) mulrdx mulrax = mulrax * mulx1
|
||||
# asm 1: mul <mulx1=int64#10
|
||||
# asm 2: mul <mulx1=%r12
|
||||
mul %r12
|
||||
|
||||
# qhasm: carry? r1 += mulrax
|
||||
# asm 1: add <mulrax=int64#7,<r1=int64#12
|
||||
# asm 2: add <mulrax=%rax,<r1=%r14
|
||||
add %rax,%r14
|
||||
|
||||
# qhasm: mulc = 0
|
||||
# asm 1: mov $0,>mulc=int64#15
|
||||
# asm 2: mov $0,>mulc=%rbp
|
||||
mov $0,%rbp
|
||||
|
||||
# qhasm: mulc += mulrdx + carry
|
||||
# asm 1: adc <mulrdx=int64#3,<mulc=int64#15
|
||||
# asm 2: adc <mulrdx=%rdx,<mulc=%rbp
|
||||
adc %rdx,%rbp
|
||||
|
||||
# qhasm: mulrax = *(uint64 *)(yp + 8)
|
||||
# asm 1: movq 8(<yp=int64#4),>mulrax=int64#7
|
||||
# asm 2: movq 8(<yp=%rcx),>mulrax=%rax
|
||||
movq 8(%rcx),%rax
|
||||
|
||||
# qhasm: (uint128) mulrdx mulrax = mulrax * mulx1
|
||||
# asm 1: mul <mulx1=int64#10
|
||||
# asm 2: mul <mulx1=%r12
|
||||
mul %r12
|
||||
|
||||
# qhasm: carry? r2 += mulrax
|
||||
# asm 1: add <mulrax=int64#7,<r2=int64#13
|
||||
# asm 2: add <mulrax=%rax,<r2=%r15
|
||||
add %rax,%r15
|
||||
|
||||
# qhasm: mulrdx += 0 + carry
|
||||
# asm 1: adc $0,<mulrdx=int64#3
|
||||
# asm 2: adc $0,<mulrdx=%rdx
|
||||
adc $0,%rdx
|
||||
|
||||
# qhasm: carry? r2 += mulc
|
||||
# asm 1: add <mulc=int64#15,<r2=int64#13
|
||||
# asm 2: add <mulc=%rbp,<r2=%r15
|
||||
add %rbp,%r15
|
||||
|
||||
# qhasm: mulc = 0
|
||||
# asm 1: mov $0,>mulc=int64#15
|
||||
# asm 2: mov $0,>mulc=%rbp
|
||||
mov $0,%rbp
|
||||
|
||||
# qhasm: mulc += mulrdx + carry
|
||||
# asm 1: adc <mulrdx=int64#3,<mulc=int64#15
|
||||
# asm 2: adc <mulrdx=%rdx,<mulc=%rbp
|
||||
adc %rdx,%rbp
|
||||
|
||||
# qhasm: mulrax = *(uint64 *)(yp + 16)
|
||||
# asm 1: movq 16(<yp=int64#4),>mulrax=int64#7
|
||||
# asm 2: movq 16(<yp=%rcx),>mulrax=%rax
|
||||
movq 16(%rcx),%rax
|
||||
|
||||
# qhasm: (uint128) mulrdx mulrax = mulrax * mulx1
|
||||
# asm 1: mul <mulx1=int64#10
|
||||
# asm 2: mul <mulx1=%r12
|
||||
mul %r12
|
||||
|
||||
# qhasm: carry? r3 += mulrax
|
||||
# asm 1: add <mulrax=int64#7,<r3=int64#14
|
||||
# asm 2: add <mulrax=%rax,<r3=%rbx
|
||||
add %rax,%rbx
|
||||
|
||||
# qhasm: mulrdx += 0 + carry
|
||||
# asm 1: adc $0,<mulrdx=int64#3
|
||||
# asm 2: adc $0,<mulrdx=%rdx
|
||||
adc $0,%rdx
|
||||
|
||||
# qhasm: carry? r3 += mulc
|
||||
# asm 1: add <mulc=int64#15,<r3=int64#14
|
||||
# asm 2: add <mulc=%rbp,<r3=%rbx
|
||||
add %rbp,%rbx
|
||||
|
||||
# qhasm: mulc = 0
|
||||
# asm 1: mov $0,>mulc=int64#15
|
||||
# asm 2: mov $0,>mulc=%rbp
|
||||
mov $0,%rbp
|
||||
|
||||
# qhasm: mulc += mulrdx + carry
|
||||
# asm 1: adc <mulrdx=int64#3,<mulc=int64#15
|
||||
# asm 2: adc <mulrdx=%rdx,<mulc=%rbp
|
||||
adc %rdx,%rbp
|
||||
|
||||
# qhasm: mulrax = *(uint64 *)(yp + 24)
|
||||
# asm 1: movq 24(<yp=int64#4),>mulrax=int64#7
|
||||
# asm 2: movq 24(<yp=%rcx),>mulrax=%rax
|
||||
movq 24(%rcx),%rax
|
||||
|
||||
# qhasm: (uint128) mulrdx mulrax = mulrax * mulx1
|
||||
# asm 1: mul <mulx1=int64#10
|
||||
# asm 2: mul <mulx1=%r12
|
||||
mul %r12
|
||||
|
||||
# qhasm: carry? mulr4 += mulrax
|
||||
# asm 1: add <mulrax=int64#7,<mulr4=int64#5
|
||||
# asm 2: add <mulrax=%rax,<mulr4=%r8
|
||||
add %rax,%r8
|
||||
|
||||
# qhasm: mulrdx += 0 + carry
|
||||
# asm 1: adc $0,<mulrdx=int64#3
|
||||
# asm 2: adc $0,<mulrdx=%rdx
|
||||
adc $0,%rdx
|
||||
|
||||
# qhasm: carry? mulr4 += mulc
|
||||
# asm 1: add <mulc=int64#15,<mulr4=int64#5
|
||||
# asm 2: add <mulc=%rbp,<mulr4=%r8
|
||||
add %rbp,%r8
|
||||
|
||||
# qhasm: mulr5 += mulrdx + carry
|
||||
# asm 1: adc <mulrdx=int64#3,<mulr5=int64#6
|
||||
# asm 2: adc <mulrdx=%rdx,<mulr5=%r9
|
||||
adc %rdx,%r9
|
||||
|
||||
# qhasm: mulx2 = *(uint64 *)(xp + 16)
|
||||
# asm 1: movq 16(<xp=int64#2),>mulx2=int64#10
|
||||
# asm 2: movq 16(<xp=%rsi),>mulx2=%r12
|
||||
movq 16(%rsi),%r12
|
||||
|
||||
# qhasm: mulrax = *(uint64 *)(yp + 0)
|
||||
# asm 1: movq 0(<yp=int64#4),>mulrax=int64#7
|
||||
# asm 2: movq 0(<yp=%rcx),>mulrax=%rax
|
||||
movq 0(%rcx),%rax
|
||||
|
||||
# qhasm: (uint128) mulrdx mulrax = mulrax * mulx2
|
||||
# asm 1: mul <mulx2=int64#10
|
||||
# asm 2: mul <mulx2=%r12
|
||||
mul %r12
|
||||
|
||||
# qhasm: carry? r2 += mulrax
|
||||
# asm 1: add <mulrax=int64#7,<r2=int64#13
|
||||
# asm 2: add <mulrax=%rax,<r2=%r15
|
||||
add %rax,%r15
|
||||
|
||||
# qhasm: mulc = 0
|
||||
# asm 1: mov $0,>mulc=int64#15
|
||||
# asm 2: mov $0,>mulc=%rbp
|
||||
mov $0,%rbp
|
||||
|
||||
# qhasm: mulc += mulrdx + carry
|
||||
# asm 1: adc <mulrdx=int64#3,<mulc=int64#15
|
||||
# asm 2: adc <mulrdx=%rdx,<mulc=%rbp
|
||||
adc %rdx,%rbp
|
||||
|
||||
# qhasm: mulrax = *(uint64 *)(yp + 8)
|
||||
# asm 1: movq 8(<yp=int64#4),>mulrax=int64#7
|
||||
# asm 2: movq 8(<yp=%rcx),>mulrax=%rax
|
||||
movq 8(%rcx),%rax
|
||||
|
||||
# qhasm: (uint128) mulrdx mulrax = mulrax * mulx2
|
||||
# asm 1: mul <mulx2=int64#10
|
||||
# asm 2: mul <mulx2=%r12
|
||||
mul %r12
|
||||
|
||||
# qhasm: carry? r3 += mulrax
|
||||
# asm 1: add <mulrax=int64#7,<r3=int64#14
|
||||
# asm 2: add <mulrax=%rax,<r3=%rbx
|
||||
add %rax,%rbx
|
||||
|
||||
# qhasm: mulrdx += 0 + carry
|
||||
# asm 1: adc $0,<mulrdx=int64#3
|
||||
# asm 2: adc $0,<mulrdx=%rdx
|
||||
adc $0,%rdx
|
||||
|
||||
# qhasm: carry? r3 += mulc
|
||||
# asm 1: add <mulc=int64#15,<r3=int64#14
|
||||
# asm 2: add <mulc=%rbp,<r3=%rbx
|
||||
add %rbp,%rbx
|
||||
|
||||
# qhasm: mulc = 0
|
||||
# asm 1: mov $0,>mulc=int64#15
|
||||
# asm 2: mov $0,>mulc=%rbp
|
||||
mov $0,%rbp
|
||||
|
||||
# qhasm: mulc += mulrdx + carry
|
||||
# asm 1: adc <mulrdx=int64#3,<mulc=int64#15
|
||||
# asm 2: adc <mulrdx=%rdx,<mulc=%rbp
|
||||
adc %rdx,%rbp
|
||||
|
||||
# qhasm: mulrax = *(uint64 *)(yp + 16)
|
||||
# asm 1: movq 16(<yp=int64#4),>mulrax=int64#7
|
||||
# asm 2: movq 16(<yp=%rcx),>mulrax=%rax
|
||||
movq 16(%rcx),%rax
|
||||
|
||||
# qhasm: (uint128) mulrdx mulrax = mulrax * mulx2
|
||||
# asm 1: mul <mulx2=int64#10
|
||||
# asm 2: mul <mulx2=%r12
|
||||
mul %r12
|
||||
|
||||
# qhasm: carry? mulr4 += mulrax
|
||||
# asm 1: add <mulrax=int64#7,<mulr4=int64#5
|
||||
# asm 2: add <mulrax=%rax,<mulr4=%r8
|
||||
add %rax,%r8
|
||||
|
||||
# qhasm: mulrdx += 0 + carry
|
||||
# asm 1: adc $0,<mulrdx=int64#3
|
||||
# asm 2: adc $0,<mulrdx=%rdx
|
||||
adc $0,%rdx
|
||||
|
||||
# qhasm: carry? mulr4 += mulc
|
||||
# asm 1: add <mulc=int64#15,<mulr4=int64#5
|
||||
# asm 2: add <mulc=%rbp,<mulr4=%r8
|
||||
add %rbp,%r8
|
||||
|
||||
# qhasm: mulc = 0
|
||||
# asm 1: mov $0,>mulc=int64#15
|
||||
# asm 2: mov $0,>mulc=%rbp
|
||||
mov $0,%rbp
|
||||
|
||||
# qhasm: mulc += mulrdx + carry
|
||||
# asm 1: adc <mulrdx=int64#3,<mulc=int64#15
|
||||
# asm 2: adc <mulrdx=%rdx,<mulc=%rbp
|
||||
adc %rdx,%rbp
|
||||
|
||||
# qhasm: mulrax = *(uint64 *)(yp + 24)
|
||||
# asm 1: movq 24(<yp=int64#4),>mulrax=int64#7
|
||||
# asm 2: movq 24(<yp=%rcx),>mulrax=%rax
|
||||
movq 24(%rcx),%rax
|
||||
|
||||
# qhasm: (uint128) mulrdx mulrax = mulrax * mulx2
|
||||
# asm 1: mul <mulx2=int64#10
|
||||
# asm 2: mul <mulx2=%r12
|
||||
mul %r12
|
||||
|
||||
# qhasm: carry? mulr5 += mulrax
|
||||
# asm 1: add <mulrax=int64#7,<mulr5=int64#6
|
||||
# asm 2: add <mulrax=%rax,<mulr5=%r9
|
||||
add %rax,%r9
|
||||
|
||||
# qhasm: mulrdx += 0 + carry
|
||||
# asm 1: adc $0,<mulrdx=int64#3
|
||||
# asm 2: adc $0,<mulrdx=%rdx
|
||||
adc $0,%rdx
|
||||
|
||||
# qhasm: carry? mulr5 += mulc
|
||||
# asm 1: add <mulc=int64#15,<mulr5=int64#6
|
||||
# asm 2: add <mulc=%rbp,<mulr5=%r9
|
||||
add %rbp,%r9
|
||||
|
||||
# qhasm: mulr6 += mulrdx + carry
|
||||
# asm 1: adc <mulrdx=int64#3,<mulr6=int64#8
|
||||
# asm 2: adc <mulrdx=%rdx,<mulr6=%r10
|
||||
adc %rdx,%r10
|
||||
|
||||
# qhasm: mulx3 = *(uint64 *)(xp + 24)
|
||||
# asm 1: movq 24(<xp=int64#2),>mulx3=int64#2
|
||||
# asm 2: movq 24(<xp=%rsi),>mulx3=%rsi
|
||||
movq 24(%rsi),%rsi
|
||||
|
||||
# qhasm: mulrax = *(uint64 *)(yp + 0)
|
||||
# asm 1: movq 0(<yp=int64#4),>mulrax=int64#7
|
||||
# asm 2: movq 0(<yp=%rcx),>mulrax=%rax
|
||||
movq 0(%rcx),%rax
|
||||
|
||||
# qhasm: (uint128) mulrdx mulrax = mulrax * mulx3
|
||||
# asm 1: mul <mulx3=int64#2
|
||||
# asm 2: mul <mulx3=%rsi
|
||||
mul %rsi
|
||||
|
||||
# qhasm: carry? r3 += mulrax
|
||||
# asm 1: add <mulrax=int64#7,<r3=int64#14
|
||||
# asm 2: add <mulrax=%rax,<r3=%rbx
|
||||
add %rax,%rbx
|
||||
|
||||
# qhasm: mulc = 0
|
||||
# asm 1: mov $0,>mulc=int64#10
|
||||
# asm 2: mov $0,>mulc=%r12
|
||||
mov $0,%r12
|
||||
|
||||
# qhasm: mulc += mulrdx + carry
|
||||
# asm 1: adc <mulrdx=int64#3,<mulc=int64#10
|
||||
# asm 2: adc <mulrdx=%rdx,<mulc=%r12
|
||||
adc %rdx,%r12
|
||||
|
||||
# qhasm: mulrax = *(uint64 *)(yp + 8)
|
||||
# asm 1: movq 8(<yp=int64#4),>mulrax=int64#7
|
||||
# asm 2: movq 8(<yp=%rcx),>mulrax=%rax
|
||||
movq 8(%rcx),%rax
|
||||
|
||||
# qhasm: (uint128) mulrdx mulrax = mulrax * mulx3
|
||||
# asm 1: mul <mulx3=int64#2
|
||||
# asm 2: mul <mulx3=%rsi
|
||||
mul %rsi
|
||||
|
||||
# qhasm: carry? mulr4 += mulrax
|
||||
# asm 1: add <mulrax=int64#7,<mulr4=int64#5
|
||||
# asm 2: add <mulrax=%rax,<mulr4=%r8
|
||||
add %rax,%r8
|
||||
|
||||
# qhasm: mulrdx += 0 + carry
|
||||
# asm 1: adc $0,<mulrdx=int64#3
|
||||
# asm 2: adc $0,<mulrdx=%rdx
|
||||
adc $0,%rdx
|
||||
|
||||
# qhasm: carry? mulr4 += mulc
|
||||
# asm 1: add <mulc=int64#10,<mulr4=int64#5
|
||||
# asm 2: add <mulc=%r12,<mulr4=%r8
|
||||
add %r12,%r8
|
||||
|
||||
# qhasm: mulc = 0
|
||||
# asm 1: mov $0,>mulc=int64#10
|
||||
# asm 2: mov $0,>mulc=%r12
|
||||
mov $0,%r12
|
||||
|
||||
# qhasm: mulc += mulrdx + carry
|
||||
# asm 1: adc <mulrdx=int64#3,<mulc=int64#10
|
||||
# asm 2: adc <mulrdx=%rdx,<mulc=%r12
|
||||
adc %rdx,%r12
|
||||
|
||||
# qhasm: mulrax = *(uint64 *)(yp + 16)
|
||||
# asm 1: movq 16(<yp=int64#4),>mulrax=int64#7
|
||||
# asm 2: movq 16(<yp=%rcx),>mulrax=%rax
|
||||
movq 16(%rcx),%rax
|
||||
|
||||
# qhasm: (uint128) mulrdx mulrax = mulrax * mulx3
|
||||
# asm 1: mul <mulx3=int64#2
|
||||
# asm 2: mul <mulx3=%rsi
|
||||
mul %rsi
|
||||
|
||||
# qhasm: carry? mulr5 += mulrax
|
||||
# asm 1: add <mulrax=int64#7,<mulr5=int64#6
|
||||
# asm 2: add <mulrax=%rax,<mulr5=%r9
|
||||
add %rax,%r9
|
||||
|
||||
# qhasm: mulrdx += 0 + carry
|
||||
# asm 1: adc $0,<mulrdx=int64#3
|
||||
# asm 2: adc $0,<mulrdx=%rdx
|
||||
adc $0,%rdx
|
||||
|
||||
# qhasm: carry? mulr5 += mulc
|
||||
# asm 1: add <mulc=int64#10,<mulr5=int64#6
|
||||
# asm 2: add <mulc=%r12,<mulr5=%r9
|
||||
add %r12,%r9
|
||||
|
||||
# qhasm: mulc = 0
|
||||
# asm 1: mov $0,>mulc=int64#10
|
||||
# asm 2: mov $0,>mulc=%r12
|
||||
mov $0,%r12
|
||||
|
||||
# qhasm: mulc += mulrdx + carry
|
||||
# asm 1: adc <mulrdx=int64#3,<mulc=int64#10
|
||||
# asm 2: adc <mulrdx=%rdx,<mulc=%r12
|
||||
adc %rdx,%r12
|
||||
|
||||
# qhasm: mulrax = *(uint64 *)(yp + 24)
|
||||
# asm 1: movq 24(<yp=int64#4),>mulrax=int64#7
|
||||
# asm 2: movq 24(<yp=%rcx),>mulrax=%rax
|
||||
movq 24(%rcx),%rax
|
||||
|
||||
# qhasm: (uint128) mulrdx mulrax = mulrax * mulx3
|
||||
# asm 1: mul <mulx3=int64#2
|
||||
# asm 2: mul <mulx3=%rsi
|
||||
mul %rsi
|
||||
|
||||
# qhasm: carry? mulr6 += mulrax
|
||||
# asm 1: add <mulrax=int64#7,<mulr6=int64#8
|
||||
# asm 2: add <mulrax=%rax,<mulr6=%r10
|
||||
add %rax,%r10
|
||||
|
||||
# qhasm: mulrdx += 0 + carry
|
||||
# asm 1: adc $0,<mulrdx=int64#3
|
||||
# asm 2: adc $0,<mulrdx=%rdx
|
||||
adc $0,%rdx
|
||||
|
||||
# qhasm: carry? mulr6 += mulc
|
||||
# asm 1: add <mulc=int64#10,<mulr6=int64#8
|
||||
# asm 2: add <mulc=%r12,<mulr6=%r10
|
||||
add %r12,%r10
|
||||
|
||||
# qhasm: mulr7 += mulrdx + carry
|
||||
# asm 1: adc <mulrdx=int64#3,<mulr7=int64#9
|
||||
# asm 2: adc <mulrdx=%rdx,<mulr7=%r11
|
||||
adc %rdx,%r11
|
||||
|
||||
# qhasm: mulrax = mulr4
|
||||
# asm 1: mov <mulr4=int64#5,>mulrax=int64#7
|
||||
# asm 2: mov <mulr4=%r8,>mulrax=%rax
|
||||
mov %r8,%rax
|
||||
|
||||
# qhasm: (uint128) mulrdx mulrax = mulrax * *(uint64 *)&crypto_sign_ed25519_amd64_64_38
|
||||
mulq crypto_sign_ed25519_amd64_64_38(%rip)
|
||||
|
||||
# qhasm: mulr4 = mulrax
|
||||
# asm 1: mov <mulrax=int64#7,>mulr4=int64#2
|
||||
# asm 2: mov <mulrax=%rax,>mulr4=%rsi
|
||||
mov %rax,%rsi
|
||||
|
||||
# qhasm: mulrax = mulr5
|
||||
# asm 1: mov <mulr5=int64#6,>mulrax=int64#7
|
||||
# asm 2: mov <mulr5=%r9,>mulrax=%rax
|
||||
mov %r9,%rax
|
||||
|
||||
# qhasm: mulr5 = mulrdx
|
||||
# asm 1: mov <mulrdx=int64#3,>mulr5=int64#4
|
||||
# asm 2: mov <mulrdx=%rdx,>mulr5=%rcx
|
||||
mov %rdx,%rcx
|
||||
|
||||
# qhasm: (uint128) mulrdx mulrax = mulrax * *(uint64 *)&crypto_sign_ed25519_amd64_64_38
|
||||
mulq crypto_sign_ed25519_amd64_64_38(%rip)
|
||||
|
||||
# qhasm: carry? mulr5 += mulrax
|
||||
# asm 1: add <mulrax=int64#7,<mulr5=int64#4
|
||||
# asm 2: add <mulrax=%rax,<mulr5=%rcx
|
||||
add %rax,%rcx
|
||||
|
||||
# qhasm: mulrax = mulr6
|
||||
# asm 1: mov <mulr6=int64#8,>mulrax=int64#7
|
||||
# asm 2: mov <mulr6=%r10,>mulrax=%rax
|
||||
mov %r10,%rax
|
||||
|
||||
# qhasm: mulr6 = 0
|
||||
# asm 1: mov $0,>mulr6=int64#5
|
||||
# asm 2: mov $0,>mulr6=%r8
|
||||
mov $0,%r8
|
||||
|
||||
# qhasm: mulr6 += mulrdx + carry
|
||||
# asm 1: adc <mulrdx=int64#3,<mulr6=int64#5
|
||||
# asm 2: adc <mulrdx=%rdx,<mulr6=%r8
|
||||
adc %rdx,%r8
|
||||
|
||||
# qhasm: (uint128) mulrdx mulrax = mulrax * *(uint64 *)&crypto_sign_ed25519_amd64_64_38
|
||||
mulq crypto_sign_ed25519_amd64_64_38(%rip)
|
||||
|
||||
# qhasm: carry? mulr6 += mulrax
|
||||
# asm 1: add <mulrax=int64#7,<mulr6=int64#5
|
||||
# asm 2: add <mulrax=%rax,<mulr6=%r8
|
||||
add %rax,%r8
|
||||
|
||||
# qhasm: mulrax = mulr7
|
||||
# asm 1: mov <mulr7=int64#9,>mulrax=int64#7
|
||||
# asm 2: mov <mulr7=%r11,>mulrax=%rax
|
||||
mov %r11,%rax
|
||||
|
||||
# qhasm: mulr7 = 0
|
||||
# asm 1: mov $0,>mulr7=int64#6
|
||||
# asm 2: mov $0,>mulr7=%r9
|
||||
mov $0,%r9
|
||||
|
||||
# qhasm: mulr7 += mulrdx + carry
|
||||
# asm 1: adc <mulrdx=int64#3,<mulr7=int64#6
|
||||
# asm 2: adc <mulrdx=%rdx,<mulr7=%r9
|
||||
adc %rdx,%r9
|
||||
|
||||
# qhasm: (uint128) mulrdx mulrax = mulrax * *(uint64 *)&crypto_sign_ed25519_amd64_64_38
|
||||
mulq crypto_sign_ed25519_amd64_64_38(%rip)
|
||||
|
||||
# qhasm: carry? mulr7 += mulrax
|
||||
# asm 1: add <mulrax=int64#7,<mulr7=int64#6
|
||||
# asm 2: add <mulrax=%rax,<mulr7=%r9
|
||||
add %rax,%r9
|
||||
|
||||
# qhasm: mulr8 = 0
|
||||
# asm 1: mov $0,>mulr8=int64#7
|
||||
# asm 2: mov $0,>mulr8=%rax
|
||||
mov $0,%rax
|
||||
|
||||
# qhasm: mulr8 += mulrdx + carry
|
||||
# asm 1: adc <mulrdx=int64#3,<mulr8=int64#7
|
||||
# asm 2: adc <mulrdx=%rdx,<mulr8=%rax
|
||||
adc %rdx,%rax
|
||||
|
||||
# qhasm: carry? r0 += mulr4
|
||||
# asm 1: add <mulr4=int64#2,<r0=int64#11
|
||||
# asm 2: add <mulr4=%rsi,<r0=%r13
|
||||
add %rsi,%r13
|
||||
|
||||
# qhasm: carry? r1 += mulr5 + carry
|
||||
# asm 1: adc <mulr5=int64#4,<r1=int64#12
|
||||
# asm 2: adc <mulr5=%rcx,<r1=%r14
|
||||
adc %rcx,%r14
|
||||
|
||||
# qhasm: carry? r2 += mulr6 + carry
|
||||
# asm 1: adc <mulr6=int64#5,<r2=int64#13
|
||||
# asm 2: adc <mulr6=%r8,<r2=%r15
|
||||
adc %r8,%r15
|
||||
|
||||
# qhasm: carry? r3 += mulr7 + carry
|
||||
# asm 1: adc <mulr7=int64#6,<r3=int64#14
|
||||
# asm 2: adc <mulr7=%r9,<r3=%rbx
|
||||
adc %r9,%rbx
|
||||
|
||||
# qhasm: mulzero = 0
|
||||
# asm 1: mov $0,>mulzero=int64#2
|
||||
# asm 2: mov $0,>mulzero=%rsi
|
||||
mov $0,%rsi
|
||||
|
||||
# qhasm: mulr8 += mulzero + carry
|
||||
# asm 1: adc <mulzero=int64#2,<mulr8=int64#7
|
||||
# asm 2: adc <mulzero=%rsi,<mulr8=%rax
|
||||
adc %rsi,%rax
|
||||
|
||||
# qhasm: mulr8 *= 38
|
||||
# asm 1: imulq $38,<mulr8=int64#7,>mulr8=int64#3
|
||||
# asm 2: imulq $38,<mulr8=%rax,>mulr8=%rdx
|
||||
imulq $38,%rax,%rdx
|
||||
|
||||
# qhasm: carry? r0 += mulr8
|
||||
# asm 1: add <mulr8=int64#3,<r0=int64#11
|
||||
# asm 2: add <mulr8=%rdx,<r0=%r13
|
||||
add %rdx,%r13
|
||||
|
||||
# qhasm: carry? r1 += mulzero + carry
|
||||
# asm 1: adc <mulzero=int64#2,<r1=int64#12
|
||||
# asm 2: adc <mulzero=%rsi,<r1=%r14
|
||||
adc %rsi,%r14
|
||||
|
||||
# qhasm: carry? r2 += mulzero + carry
|
||||
# asm 1: adc <mulzero=int64#2,<r2=int64#13
|
||||
# asm 2: adc <mulzero=%rsi,<r2=%r15
|
||||
adc %rsi,%r15
|
||||
|
||||
# qhasm: carry? r3 += mulzero + carry
|
||||
# asm 1: adc <mulzero=int64#2,<r3=int64#14
|
||||
# asm 2: adc <mulzero=%rsi,<r3=%rbx
|
||||
adc %rsi,%rbx
|
||||
|
||||
# qhasm: mulzero += mulzero + carry
|
||||
# asm 1: adc <mulzero=int64#2,<mulzero=int64#2
|
||||
# asm 2: adc <mulzero=%rsi,<mulzero=%rsi
|
||||
adc %rsi,%rsi
|
||||
|
||||
# qhasm: mulzero *= 38
|
||||
# asm 1: imulq $38,<mulzero=int64#2,>mulzero=int64#2
|
||||
# asm 2: imulq $38,<mulzero=%rsi,>mulzero=%rsi
|
||||
imulq $38,%rsi,%rsi
|
||||
|
||||
# qhasm: r0 += mulzero
|
||||
# asm 1: add <mulzero=int64#2,<r0=int64#11
|
||||
# asm 2: add <mulzero=%rsi,<r0=%r13
|
||||
add %rsi,%r13
|
||||
|
||||
# qhasm: *(uint64 *)(rp + 8) = r1
|
||||
# asm 1: movq <r1=int64#12,8(<rp=int64#1)
|
||||
# asm 2: movq <r1=%r14,8(<rp=%rdi)
|
||||
movq %r14,8(%rdi)
|
||||
|
||||
# qhasm: *(uint64 *)(rp + 16) = r2
|
||||
# asm 1: movq <r2=int64#13,16(<rp=int64#1)
|
||||
# asm 2: movq <r2=%r15,16(<rp=%rdi)
|
||||
movq %r15,16(%rdi)
|
||||
|
||||
# qhasm: *(uint64 *)(rp + 24) = r3
|
||||
# asm 1: movq <r3=int64#14,24(<rp=int64#1)
|
||||
# asm 2: movq <r3=%rbx,24(<rp=%rdi)
|
||||
movq %rbx,24(%rdi)
|
||||
|
||||
# qhasm: *(uint64 *)(rp + 0) = r0
|
||||
# asm 1: movq <r0=int64#11,0(<rp=int64#1)
|
||||
# asm 2: movq <r0=%r13,0(<rp=%rdi)
|
||||
movq %r13,0(%rdi)
|
||||
|
||||
# qhasm: caller1 = caller1_stack
|
||||
# asm 1: movq <caller1_stack=stack64#1,>caller1=int64#9
|
||||
# asm 2: movq <caller1_stack=0(%rsp),>caller1=%r11
|
||||
movq 0(%rsp),%r11
|
||||
|
||||
# qhasm: caller2 = caller2_stack
|
||||
# asm 1: movq <caller2_stack=stack64#2,>caller2=int64#10
|
||||
# asm 2: movq <caller2_stack=8(%rsp),>caller2=%r12
|
||||
movq 8(%rsp),%r12
|
||||
|
||||
# qhasm: caller3 = caller3_stack
|
||||
# asm 1: movq <caller3_stack=stack64#3,>caller3=int64#11
|
||||
# asm 2: movq <caller3_stack=16(%rsp),>caller3=%r13
|
||||
movq 16(%rsp),%r13
|
||||
|
||||
# qhasm: caller4 = caller4_stack
|
||||
# asm 1: movq <caller4_stack=stack64#4,>caller4=int64#12
|
||||
# asm 2: movq <caller4_stack=24(%rsp),>caller4=%r14
|
||||
movq 24(%rsp),%r14
|
||||
|
||||
# qhasm: caller5 = caller5_stack
|
||||
# asm 1: movq <caller5_stack=stack64#5,>caller5=int64#13
|
||||
# asm 2: movq <caller5_stack=32(%rsp),>caller5=%r15
|
||||
movq 32(%rsp),%r15
|
||||
|
||||
# qhasm: caller6 = caller6_stack
|
||||
# asm 1: movq <caller6_stack=stack64#6,>caller6=int64#14
|
||||
# asm 2: movq <caller6_stack=40(%rsp),>caller6=%rbx
|
||||
movq 40(%rsp),%rbx
|
||||
|
||||
# qhasm: caller7 = caller7_stack
|
||||
# asm 1: movq <caller7_stack=stack64#7,>caller7=int64#15
|
||||
# asm 2: movq <caller7_stack=48(%rsp),>caller7=%rbp
|
||||
movq 48(%rsp),%rbp
|
||||
|
||||
# qhasm: leave
|
||||
add %r11,%rsp
|
||||
mov %rdi,%rax
|
||||
mov %rsi,%rdx
|
||||
ret
|
|
@ -1,8 +0,0 @@
|
|||
#include "fe25519.h"
|
||||
|
||||
void fe25519_neg(fe25519 *r, const fe25519 *x)
|
||||
{
|
||||
fe25519 t;
|
||||
fe25519_setint(&t,0);
|
||||
fe25519_sub(r,&t,x);
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
#include "fe25519.h"
|
||||
|
||||
/* Assumes input x being reduced below 2^255 */
|
||||
void fe25519_pack(unsigned char r[32], const fe25519 *x)
|
||||
{
|
||||
int i;
|
||||
fe25519 t;
|
||||
t = *x;
|
||||
fe25519_freeze(&t);
|
||||
/* assuming little-endian */
|
||||
for(i=0;i<32;i++) r[i] = i[(unsigned char *)&t.v];
|
||||
}
|
||||
|
|
@ -1,55 +0,0 @@
|
|||
#include "fe25519.h"
|
||||
|
||||
void fe25519_pow2523(fe25519 *r, const fe25519 *x)
|
||||
{
|
||||
fe25519 z2;
|
||||
fe25519 z9;
|
||||
fe25519 z11;
|
||||
fe25519 z2_5_0;
|
||||
fe25519 z2_10_0;
|
||||
fe25519 z2_20_0;
|
||||
fe25519 z2_50_0;
|
||||
fe25519 z2_100_0;
|
||||
fe25519 t;
|
||||
int i;
|
||||
|
||||
/* 2 */ fe25519_square(&z2,x);
|
||||
/* 4 */ fe25519_square(&t,&z2);
|
||||
/* 8 */ fe25519_square(&t,&t);
|
||||
/* 9 */ fe25519_mul(&z9,&t,x);
|
||||
/* 11 */ fe25519_mul(&z11,&z9,&z2);
|
||||
/* 22 */ fe25519_square(&t,&z11);
|
||||
/* 2^5 - 2^0 = 31 */ fe25519_mul(&z2_5_0,&t,&z9);
|
||||
|
||||
/* 2^6 - 2^1 */ fe25519_square(&t,&z2_5_0);
|
||||
/* 2^10 - 2^5 */ for (i = 1;i < 5;i++) { fe25519_square(&t,&t); }
|
||||
/* 2^10 - 2^0 */ fe25519_mul(&z2_10_0,&t,&z2_5_0);
|
||||
|
||||
/* 2^11 - 2^1 */ fe25519_square(&t,&z2_10_0);
|
||||
/* 2^20 - 2^10 */ for (i = 1;i < 10;i++) { fe25519_square(&t,&t); }
|
||||
/* 2^20 - 2^0 */ fe25519_mul(&z2_20_0,&t,&z2_10_0);
|
||||
|
||||
/* 2^21 - 2^1 */ fe25519_square(&t,&z2_20_0);
|
||||
/* 2^40 - 2^20 */ for (i = 1;i < 20;i++) { fe25519_square(&t,&t); }
|
||||
/* 2^40 - 2^0 */ fe25519_mul(&t,&t,&z2_20_0);
|
||||
|
||||
/* 2^41 - 2^1 */ fe25519_square(&t,&t);
|
||||
/* 2^50 - 2^10 */ for (i = 1;i < 10;i++) { fe25519_square(&t,&t); }
|
||||
/* 2^50 - 2^0 */ fe25519_mul(&z2_50_0,&t,&z2_10_0);
|
||||
|
||||
/* 2^51 - 2^1 */ fe25519_square(&t,&z2_50_0);
|
||||
/* 2^100 - 2^50 */ for (i = 1;i < 50;i++) { fe25519_square(&t,&t); }
|
||||
/* 2^100 - 2^0 */ fe25519_mul(&z2_100_0,&t,&z2_50_0);
|
||||
|
||||
/* 2^101 - 2^1 */ fe25519_square(&t,&z2_100_0);
|
||||
/* 2^200 - 2^100 */ for (i = 1;i < 100;i++) { fe25519_square(&t,&t); }
|
||||
/* 2^200 - 2^0 */ fe25519_mul(&t,&t,&z2_100_0);
|
||||
|
||||
/* 2^201 - 2^1 */ fe25519_square(&t,&t);
|
||||
/* 2^250 - 2^50 */ for (i = 1;i < 50;i++) { fe25519_square(&t,&t); }
|
||||
/* 2^250 - 2^0 */ fe25519_mul(&t,&t,&z2_50_0);
|
||||
|
||||
/* 2^251 - 2^1 */ fe25519_square(&t,&t);
|
||||
/* 2^252 - 2^2 */ fe25519_square(&t,&t);
|
||||
/* 2^252 - 3 */ fe25519_mul(r,&t,x);
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
#include "fe25519.h"
|
||||
|
||||
void fe25519_setint(fe25519 *r, unsigned int v)
|
||||
{
|
||||
r->v[0] = v;
|
||||
r->v[1] = 0;
|
||||
r->v[2] = 0;
|
||||
r->v[3] = 0;
|
||||
}
|
|
@ -1,639 +0,0 @@
|
|||
|
||||
# qhasm: int64 rp
|
||||
|
||||
# qhasm: int64 xp
|
||||
|
||||
# qhasm: input rp
|
||||
|
||||
# qhasm: input xp
|
||||
|
||||
# qhasm: int64 r0
|
||||
|
||||
# qhasm: int64 r1
|
||||
|
||||
# qhasm: int64 r2
|
||||
|
||||
# qhasm: int64 r3
|
||||
|
||||
# qhasm: int64 caller1
|
||||
|
||||
# qhasm: int64 caller2
|
||||
|
||||
# qhasm: int64 caller3
|
||||
|
||||
# qhasm: int64 caller4
|
||||
|
||||
# qhasm: int64 caller5
|
||||
|
||||
# qhasm: int64 caller6
|
||||
|
||||
# qhasm: int64 caller7
|
||||
|
||||
# qhasm: caller caller1
|
||||
|
||||
# qhasm: caller caller2
|
||||
|
||||
# qhasm: caller caller3
|
||||
|
||||
# qhasm: caller caller4
|
||||
|
||||
# qhasm: caller caller5
|
||||
|
||||
# qhasm: caller caller6
|
||||
|
||||
# qhasm: caller caller7
|
||||
|
||||
# qhasm: stack64 caller1_stack
|
||||
|
||||
# qhasm: stack64 caller2_stack
|
||||
|
||||
# qhasm: stack64 caller3_stack
|
||||
|
||||
# qhasm: stack64 caller4_stack
|
||||
|
||||
# qhasm: stack64 caller5_stack
|
||||
|
||||
# qhasm: stack64 caller6_stack
|
||||
|
||||
# qhasm: stack64 caller7_stack
|
||||
|
||||
# qhasm: int64 squarer4
|
||||
|
||||
# qhasm: int64 squarer5
|
||||
|
||||
# qhasm: int64 squarer6
|
||||
|
||||
# qhasm: int64 squarer7
|
||||
|
||||
# qhasm: int64 squarer8
|
||||
|
||||
# qhasm: int64 squarerax
|
||||
|
||||
# qhasm: int64 squarerdx
|
||||
|
||||
# qhasm: int64 squaret1
|
||||
|
||||
# qhasm: int64 squaret2
|
||||
|
||||
# qhasm: int64 squaret3
|
||||
|
||||
# qhasm: int64 squarec
|
||||
|
||||
# qhasm: int64 squarezero
|
||||
|
||||
# qhasm: int64 squarei38
|
||||
|
||||
# qhasm: enter crypto_sign_ed25519_amd64_64_fe25519_square
|
||||
.text
|
||||
.p2align 5
|
||||
.globl _crypto_sign_ed25519_amd64_64_fe25519_square
|
||||
.globl crypto_sign_ed25519_amd64_64_fe25519_square
|
||||
_crypto_sign_ed25519_amd64_64_fe25519_square:
|
||||
crypto_sign_ed25519_amd64_64_fe25519_square:
|
||||
mov %rsp,%r11
|
||||
and $31,%r11
|
||||
add $64,%r11
|
||||
sub %r11,%rsp
|
||||
|
||||
# qhasm: caller1_stack = caller1
|
||||
# asm 1: movq <caller1=int64#9,>caller1_stack=stack64#1
|
||||
# asm 2: movq <caller1=%r11,>caller1_stack=0(%rsp)
|
||||
movq %r11,0(%rsp)
|
||||
|
||||
# qhasm: caller2_stack = caller2
|
||||
# asm 1: movq <caller2=int64#10,>caller2_stack=stack64#2
|
||||
# asm 2: movq <caller2=%r12,>caller2_stack=8(%rsp)
|
||||
movq %r12,8(%rsp)
|
||||
|
||||
# qhasm: caller3_stack = caller3
|
||||
# asm 1: movq <caller3=int64#11,>caller3_stack=stack64#3
|
||||
# asm 2: movq <caller3=%r13,>caller3_stack=16(%rsp)
|
||||
movq %r13,16(%rsp)
|
||||
|
||||
# qhasm: caller4_stack = caller4
|
||||
# asm 1: movq <caller4=int64#12,>caller4_stack=stack64#4
|
||||
# asm 2: movq <caller4=%r14,>caller4_stack=24(%rsp)
|
||||
movq %r14,24(%rsp)
|
||||
|
||||
# qhasm: caller5_stack = caller5
|
||||
# asm 1: movq <caller5=int64#13,>caller5_stack=stack64#5
|
||||
# asm 2: movq <caller5=%r15,>caller5_stack=32(%rsp)
|
||||
movq %r15,32(%rsp)
|
||||
|
||||
# qhasm: caller6_stack = caller6
|
||||
# asm 1: movq <caller6=int64#14,>caller6_stack=stack64#6
|
||||
# asm 2: movq <caller6=%rbx,>caller6_stack=40(%rsp)
|
||||
movq %rbx,40(%rsp)
|
||||
|
||||
# qhasm: caller7_stack = caller7
|
||||
# asm 1: movq <caller7=int64#15,>caller7_stack=stack64#7
|
||||
# asm 2: movq <caller7=%rbp,>caller7_stack=48(%rsp)
|
||||
movq %rbp,48(%rsp)
|
||||
|
||||
# qhasm: squarer7 = 0
|
||||
# asm 1: mov $0,>squarer7=int64#4
|
||||
# asm 2: mov $0,>squarer7=%rcx
|
||||
mov $0,%rcx
|
||||
|
||||
# qhasm: squarerax = *(uint64 *)(xp + 8)
|
||||
# asm 1: movq 8(<xp=int64#2),>squarerax=int64#7
|
||||
# asm 2: movq 8(<xp=%rsi),>squarerax=%rax
|
||||
movq 8(%rsi),%rax
|
||||
|
||||
# qhasm: (uint128) squarerdx squarerax = squarerax * *(uint64 *)(xp + 0)
|
||||
# asm 1: mulq 0(<xp=int64#2)
|
||||
# asm 2: mulq 0(<xp=%rsi)
|
||||
mulq 0(%rsi)
|
||||
|
||||
# qhasm: r1 = squarerax
|
||||
# asm 1: mov <squarerax=int64#7,>r1=int64#5
|
||||
# asm 2: mov <squarerax=%rax,>r1=%r8
|
||||
mov %rax,%r8
|
||||
|
||||
# qhasm: r2 = squarerdx
|
||||
# asm 1: mov <squarerdx=int64#3,>r2=int64#6
|
||||
# asm 2: mov <squarerdx=%rdx,>r2=%r9
|
||||
mov %rdx,%r9
|
||||
|
||||
# qhasm: squarerax = *(uint64 *)(xp + 16)
|
||||
# asm 1: movq 16(<xp=int64#2),>squarerax=int64#7
|
||||
# asm 2: movq 16(<xp=%rsi),>squarerax=%rax
|
||||
movq 16(%rsi),%rax
|
||||
|
||||
# qhasm: (uint128) squarerdx squarerax = squarerax * *(uint64 *)(xp + 8)
|
||||
# asm 1: mulq 8(<xp=int64#2)
|
||||
# asm 2: mulq 8(<xp=%rsi)
|
||||
mulq 8(%rsi)
|
||||
|
||||
# qhasm: r3 = squarerax
|
||||
# asm 1: mov <squarerax=int64#7,>r3=int64#8
|
||||
# asm 2: mov <squarerax=%rax,>r3=%r10
|
||||
mov %rax,%r10
|
||||
|
||||
# qhasm: squarer4 = squarerdx
|
||||
# asm 1: mov <squarerdx=int64#3,>squarer4=int64#9
|
||||
# asm 2: mov <squarerdx=%rdx,>squarer4=%r11
|
||||
mov %rdx,%r11
|
||||
|
||||
# qhasm: squarerax = *(uint64 *)(xp + 24)
|
||||
# asm 1: movq 24(<xp=int64#2),>squarerax=int64#7
|
||||
# asm 2: movq 24(<xp=%rsi),>squarerax=%rax
|
||||
movq 24(%rsi),%rax
|
||||
|
||||
# qhasm: (uint128) squarerdx squarerax = squarerax * *(uint64 *)(xp + 16)
|
||||
# asm 1: mulq 16(<xp=int64#2)
|
||||
# asm 2: mulq 16(<xp=%rsi)
|
||||
mulq 16(%rsi)
|
||||
|
||||
# qhasm: squarer5 = squarerax
|
||||
# asm 1: mov <squarerax=int64#7,>squarer5=int64#10
|
||||
# asm 2: mov <squarerax=%rax,>squarer5=%r12
|
||||
mov %rax,%r12
|
||||
|
||||
# qhasm: squarer6 = squarerdx
|
||||
# asm 1: mov <squarerdx=int64#3,>squarer6=int64#11
|
||||
# asm 2: mov <squarerdx=%rdx,>squarer6=%r13
|
||||
mov %rdx,%r13
|
||||
|
||||
# qhasm: squarerax = *(uint64 *)(xp + 16)
|
||||
# asm 1: movq 16(<xp=int64#2),>squarerax=int64#7
|
||||
# asm 2: movq 16(<xp=%rsi),>squarerax=%rax
|
||||
movq 16(%rsi),%rax
|
||||
|
||||
# qhasm: (uint128) squarerdx squarerax = squarerax * *(uint64 *)(xp + 0)
|
||||
# asm 1: mulq 0(<xp=int64#2)
|
||||
# asm 2: mulq 0(<xp=%rsi)
|
||||
mulq 0(%rsi)
|
||||
|
||||
# qhasm: carry? r2 += squarerax
|
||||
# asm 1: add <squarerax=int64#7,<r2=int64#6
|
||||
# asm 2: add <squarerax=%rax,<r2=%r9
|
||||
add %rax,%r9
|
||||
|
||||
# qhasm: carry? r3 += squarerdx + carry
|
||||
# asm 1: adc <squarerdx=int64#3,<r3=int64#8
|
||||
# asm 2: adc <squarerdx=%rdx,<r3=%r10
|
||||
adc %rdx,%r10
|
||||
|
||||
# qhasm: squarer4 += 0 + carry
|
||||
# asm 1: adc $0,<squarer4=int64#9
|
||||
# asm 2: adc $0,<squarer4=%r11
|
||||
adc $0,%r11
|
||||
|
||||
# qhasm: squarerax = *(uint64 *)(xp + 24)
|
||||
# asm 1: movq 24(<xp=int64#2),>squarerax=int64#7
|
||||
# asm 2: movq 24(<xp=%rsi),>squarerax=%rax
|
||||
movq 24(%rsi),%rax
|
||||
|
||||
# qhasm: (uint128) squarerdx squarerax = squarerax * *(uint64 *)(xp + 8)
|
||||
# asm 1: mulq 8(<xp=int64#2)
|
||||
# asm 2: mulq 8(<xp=%rsi)
|
||||
mulq 8(%rsi)
|
||||
|
||||
# qhasm: carry? squarer4 += squarerax
|
||||
# asm 1: add <squarerax=int64#7,<squarer4=int64#9
|
||||
# asm 2: add <squarerax=%rax,<squarer4=%r11
|
||||
add %rax,%r11
|
||||
|
||||
# qhasm: carry? squarer5 += squarerdx + carry
|
||||
# asm 1: adc <squarerdx=int64#3,<squarer5=int64#10
|
||||
# asm 2: adc <squarerdx=%rdx,<squarer5=%r12
|
||||
adc %rdx,%r12
|
||||
|
||||
# qhasm: squarer6 += 0 + carry
|
||||
# asm 1: adc $0,<squarer6=int64#11
|
||||
# asm 2: adc $0,<squarer6=%r13
|
||||
adc $0,%r13
|
||||
|
||||
# qhasm: squarerax = *(uint64 *)(xp + 24)
|
||||
# asm 1: movq 24(<xp=int64#2),>squarerax=int64#7
|
||||
# asm 2: movq 24(<xp=%rsi),>squarerax=%rax
|
||||
movq 24(%rsi),%rax
|
||||
|
||||
# qhasm: (uint128) squarerdx squarerax = squarerax * *(uint64 *)(xp + 0)
|
||||
# asm 1: mulq 0(<xp=int64#2)
|
||||
# asm 2: mulq 0(<xp=%rsi)
|
||||
mulq 0(%rsi)
|
||||
|
||||
# qhasm: carry? r3 += squarerax
|
||||
# asm 1: add <squarerax=int64#7,<r3=int64#8
|
||||
# asm 2: add <squarerax=%rax,<r3=%r10
|
||||
add %rax,%r10
|
||||
|
||||
# qhasm: carry? squarer4 += squarerdx + carry
|
||||
# asm 1: adc <squarerdx=int64#3,<squarer4=int64#9
|
||||
# asm 2: adc <squarerdx=%rdx,<squarer4=%r11
|
||||
adc %rdx,%r11
|
||||
|
||||
# qhasm: carry? squarer5 += 0 + carry
|
||||
# asm 1: adc $0,<squarer5=int64#10
|
||||
# asm 2: adc $0,<squarer5=%r12
|
||||
adc $0,%r12
|
||||
|
||||
# qhasm: carry? squarer6 += 0 + carry
|
||||
# asm 1: adc $0,<squarer6=int64#11
|
||||
# asm 2: adc $0,<squarer6=%r13
|
||||
adc $0,%r13
|
||||
|
||||
# qhasm: squarer7 += 0 + carry
|
||||
# asm 1: adc $0,<squarer7=int64#4
|
||||
# asm 2: adc $0,<squarer7=%rcx
|
||||
adc $0,%rcx
|
||||
|
||||
# qhasm: carry? r1 += r1
|
||||
# asm 1: add <r1=int64#5,<r1=int64#5
|
||||
# asm 2: add <r1=%r8,<r1=%r8
|
||||
add %r8,%r8
|
||||
|
||||
# qhasm: carry? r2 += r2 + carry
|
||||
# asm 1: adc <r2=int64#6,<r2=int64#6
|
||||
# asm 2: adc <r2=%r9,<r2=%r9
|
||||
adc %r9,%r9
|
||||
|
||||
# qhasm: carry? r3 += r3 + carry
|
||||
# asm 1: adc <r3=int64#8,<r3=int64#8
|
||||
# asm 2: adc <r3=%r10,<r3=%r10
|
||||
adc %r10,%r10
|
||||
|
||||
# qhasm: carry? squarer4 += squarer4 + carry
|
||||
# asm 1: adc <squarer4=int64#9,<squarer4=int64#9
|
||||
# asm 2: adc <squarer4=%r11,<squarer4=%r11
|
||||
adc %r11,%r11
|
||||
|
||||
# qhasm: carry? squarer5 += squarer5 + carry
|
||||
# asm 1: adc <squarer5=int64#10,<squarer5=int64#10
|
||||
# asm 2: adc <squarer5=%r12,<squarer5=%r12
|
||||
adc %r12,%r12
|
||||
|
||||
# qhasm: carry? squarer6 += squarer6 + carry
|
||||
# asm 1: adc <squarer6=int64#11,<squarer6=int64#11
|
||||
# asm 2: adc <squarer6=%r13,<squarer6=%r13
|
||||
adc %r13,%r13
|
||||
|
||||
# qhasm: squarer7 += squarer7 + carry
|
||||
# asm 1: adc <squarer7=int64#4,<squarer7=int64#4
|
||||
# asm 2: adc <squarer7=%rcx,<squarer7=%rcx
|
||||
adc %rcx,%rcx
|
||||
|
||||
# qhasm: squarerax = *(uint64 *)(xp + 0)
|
||||
# asm 1: movq 0(<xp=int64#2),>squarerax=int64#7
|
||||
# asm 2: movq 0(<xp=%rsi),>squarerax=%rax
|
||||
movq 0(%rsi),%rax
|
||||
|
||||
# qhasm: (uint128) squarerdx squarerax = squarerax * *(uint64 *)(xp + 0)
|
||||
# asm 1: mulq 0(<xp=int64#2)
|
||||
# asm 2: mulq 0(<xp=%rsi)
|
||||
mulq 0(%rsi)
|
||||
|
||||
# qhasm: r0 = squarerax
|
||||
# asm 1: mov <squarerax=int64#7,>r0=int64#12
|
||||
# asm 2: mov <squarerax=%rax,>r0=%r14
|
||||
mov %rax,%r14
|
||||
|
||||
# qhasm: squaret1 = squarerdx
|
||||
# asm 1: mov <squarerdx=int64#3,>squaret1=int64#13
|
||||
# asm 2: mov <squarerdx=%rdx,>squaret1=%r15
|
||||
mov %rdx,%r15
|
||||
|
||||
# qhasm: squarerax = *(uint64 *)(xp + 8)
|
||||
# asm 1: movq 8(<xp=int64#2),>squarerax=int64#7
|
||||
# asm 2: movq 8(<xp=%rsi),>squarerax=%rax
|
||||
movq 8(%rsi),%rax
|
||||
|
||||
# qhasm: (uint128) squarerdx squarerax = squarerax * *(uint64 *)(xp + 8)
|
||||
# asm 1: mulq 8(<xp=int64#2)
|
||||
# asm 2: mulq 8(<xp=%rsi)
|
||||
mulq 8(%rsi)
|
||||
|
||||
# qhasm: squaret2 = squarerax
|
||||
# asm 1: mov <squarerax=int64#7,>squaret2=int64#14
|
||||
# asm 2: mov <squarerax=%rax,>squaret2=%rbx
|
||||
mov %rax,%rbx
|
||||
|
||||
# qhasm: squaret3 = squarerdx
|
||||
# asm 1: mov <squarerdx=int64#3,>squaret3=int64#15
|
||||
# asm 2: mov <squarerdx=%rdx,>squaret3=%rbp
|
||||
mov %rdx,%rbp
|
||||
|
||||
# qhasm: squarerax = *(uint64 *)(xp + 16)
|
||||
# asm 1: movq 16(<xp=int64#2),>squarerax=int64#7
|
||||
# asm 2: movq 16(<xp=%rsi),>squarerax=%rax
|
||||
movq 16(%rsi),%rax
|
||||
|
||||
# qhasm: (uint128) squarerdx squarerax = squarerax * *(uint64 *)(xp + 16)
|
||||
# asm 1: mulq 16(<xp=int64#2)
|
||||
# asm 2: mulq 16(<xp=%rsi)
|
||||
mulq 16(%rsi)
|
||||
|
||||
# qhasm: carry? r1 += squaret1
|
||||
# asm 1: add <squaret1=int64#13,<r1=int64#5
|
||||
# asm 2: add <squaret1=%r15,<r1=%r8
|
||||
add %r15,%r8
|
||||
|
||||
# qhasm: carry? r2 += squaret2 + carry
|
||||
# asm 1: adc <squaret2=int64#14,<r2=int64#6
|
||||
# asm 2: adc <squaret2=%rbx,<r2=%r9
|
||||
adc %rbx,%r9
|
||||
|
||||
# qhasm: carry? r3 += squaret3 + carry
|
||||
# asm 1: adc <squaret3=int64#15,<r3=int64#8
|
||||
# asm 2: adc <squaret3=%rbp,<r3=%r10
|
||||
adc %rbp,%r10
|
||||
|
||||
# qhasm: carry? squarer4 += squarerax + carry
|
||||
# asm 1: adc <squarerax=int64#7,<squarer4=int64#9
|
||||
# asm 2: adc <squarerax=%rax,<squarer4=%r11
|
||||
adc %rax,%r11
|
||||
|
||||
# qhasm: carry? squarer5 += squarerdx + carry
|
||||
# asm 1: adc <squarerdx=int64#3,<squarer5=int64#10
|
||||
# asm 2: adc <squarerdx=%rdx,<squarer5=%r12
|
||||
adc %rdx,%r12
|
||||
|
||||
# qhasm: carry? squarer6 += 0 + carry
|
||||
# asm 1: adc $0,<squarer6=int64#11
|
||||
# asm 2: adc $0,<squarer6=%r13
|
||||
adc $0,%r13
|
||||
|
||||
# qhasm: squarer7 += 0 + carry
|
||||
# asm 1: adc $0,<squarer7=int64#4
|
||||
# asm 2: adc $0,<squarer7=%rcx
|
||||
adc $0,%rcx
|
||||
|
||||
# qhasm: squarerax = *(uint64 *)(xp + 24)
|
||||
# asm 1: movq 24(<xp=int64#2),>squarerax=int64#7
|
||||
# asm 2: movq 24(<xp=%rsi),>squarerax=%rax
|
||||
movq 24(%rsi),%rax
|
||||
|
||||
# qhasm: (uint128) squarerdx squarerax = squarerax * *(uint64 *)(xp + 24)
|
||||
# asm 1: mulq 24(<xp=int64#2)
|
||||
# asm 2: mulq 24(<xp=%rsi)
|
||||
mulq 24(%rsi)
|
||||
|
||||
# qhasm: carry? squarer6 += squarerax
|
||||
# asm 1: add <squarerax=int64#7,<squarer6=int64#11
|
||||
# asm 2: add <squarerax=%rax,<squarer6=%r13
|
||||
add %rax,%r13
|
||||
|
||||
# qhasm: squarer7 += squarerdx + carry
|
||||
# asm 1: adc <squarerdx=int64#3,<squarer7=int64#4
|
||||
# asm 2: adc <squarerdx=%rdx,<squarer7=%rcx
|
||||
adc %rdx,%rcx
|
||||
|
||||
# qhasm: squarerax = squarer4
|
||||
# asm 1: mov <squarer4=int64#9,>squarerax=int64#7
|
||||
# asm 2: mov <squarer4=%r11,>squarerax=%rax
|
||||
mov %r11,%rax
|
||||
|
||||
# qhasm: (uint128) squarerdx squarerax = squarerax * *(uint64 *)&crypto_sign_ed25519_amd64_64_38
|
||||
mulq crypto_sign_ed25519_amd64_64_38(%rip)
|
||||
|
||||
# qhasm: squarer4 = squarerax
|
||||
# asm 1: mov <squarerax=int64#7,>squarer4=int64#2
|
||||
# asm 2: mov <squarerax=%rax,>squarer4=%rsi
|
||||
mov %rax,%rsi
|
||||
|
||||
# qhasm: squarerax = squarer5
|
||||
# asm 1: mov <squarer5=int64#10,>squarerax=int64#7
|
||||
# asm 2: mov <squarer5=%r12,>squarerax=%rax
|
||||
mov %r12,%rax
|
||||
|
||||
# qhasm: squarer5 = squarerdx
|
||||
# asm 1: mov <squarerdx=int64#3,>squarer5=int64#9
|
||||
# asm 2: mov <squarerdx=%rdx,>squarer5=%r11
|
||||
mov %rdx,%r11
|
||||
|
||||
# qhasm: (uint128) squarerdx squarerax = squarerax * *(uint64 *)&crypto_sign_ed25519_amd64_64_38
|
||||
mulq crypto_sign_ed25519_amd64_64_38(%rip)
|
||||
|
||||
# qhasm: carry? squarer5 += squarerax
|
||||
# asm 1: add <squarerax=int64#7,<squarer5=int64#9
|
||||
# asm 2: add <squarerax=%rax,<squarer5=%r11
|
||||
add %rax,%r11
|
||||
|
||||
# qhasm: squarerax = squarer6
|
||||
# asm 1: mov <squarer6=int64#11,>squarerax=int64#7
|
||||
# asm 2: mov <squarer6=%r13,>squarerax=%rax
|
||||
mov %r13,%rax
|
||||
|
||||
# qhasm: squarer6 = 0
|
||||
# asm 1: mov $0,>squarer6=int64#10
|
||||
# asm 2: mov $0,>squarer6=%r12
|
||||
mov $0,%r12
|
||||
|
||||
# qhasm: squarer6 += squarerdx + carry
|
||||
# asm 1: adc <squarerdx=int64#3,<squarer6=int64#10
|
||||
# asm 2: adc <squarerdx=%rdx,<squarer6=%r12
|
||||
adc %rdx,%r12
|
||||
|
||||
# qhasm: (uint128) squarerdx squarerax = squarerax * *(uint64 *)&crypto_sign_ed25519_amd64_64_38
|
||||
mulq crypto_sign_ed25519_amd64_64_38(%rip)
|
||||
|
||||
# qhasm: carry? squarer6 += squarerax
|
||||
# asm 1: add <squarerax=int64#7,<squarer6=int64#10
|
||||
# asm 2: add <squarerax=%rax,<squarer6=%r12
|
||||
add %rax,%r12
|
||||
|
||||
# qhasm: squarerax = squarer7
|
||||
# asm 1: mov <squarer7=int64#4,>squarerax=int64#7
|
||||
# asm 2: mov <squarer7=%rcx,>squarerax=%rax
|
||||
mov %rcx,%rax
|
||||
|
||||
# qhasm: squarer7 = 0
|
||||
# asm 1: mov $0,>squarer7=int64#4
|
||||
# asm 2: mov $0,>squarer7=%rcx
|
||||
mov $0,%rcx
|
||||
|
||||
# qhasm: squarer7 += squarerdx + carry
|
||||
# asm 1: adc <squarerdx=int64#3,<squarer7=int64#4
|
||||
# asm 2: adc <squarerdx=%rdx,<squarer7=%rcx
|
||||
adc %rdx,%rcx
|
||||
|
||||
# qhasm: (uint128) squarerdx squarerax = squarerax * *(uint64 *)&crypto_sign_ed25519_amd64_64_38
|
||||
mulq crypto_sign_ed25519_amd64_64_38(%rip)
|
||||
|
||||
# qhasm: carry? squarer7 += squarerax
|
||||
# asm 1: add <squarerax=int64#7,<squarer7=int64#4
|
||||
# asm 2: add <squarerax=%rax,<squarer7=%rcx
|
||||
add %rax,%rcx
|
||||
|
||||
# qhasm: squarer8 = 0
|
||||
# asm 1: mov $0,>squarer8=int64#7
|
||||
# asm 2: mov $0,>squarer8=%rax
|
||||
mov $0,%rax
|
||||
|
||||
# qhasm: squarer8 += squarerdx + carry
|
||||
# asm 1: adc <squarerdx=int64#3,<squarer8=int64#7
|
||||
# asm 2: adc <squarerdx=%rdx,<squarer8=%rax
|
||||
adc %rdx,%rax
|
||||
|
||||
# qhasm: carry? r0 += squarer4
|
||||
# asm 1: add <squarer4=int64#2,<r0=int64#12
|
||||
# asm 2: add <squarer4=%rsi,<r0=%r14
|
||||
add %rsi,%r14
|
||||
|
||||
# qhasm: carry? r1 += squarer5 + carry
|
||||
# asm 1: adc <squarer5=int64#9,<r1=int64#5
|
||||
# asm 2: adc <squarer5=%r11,<r1=%r8
|
||||
adc %r11,%r8
|
||||
|
||||
# qhasm: carry? r2 += squarer6 + carry
|
||||
# asm 1: adc <squarer6=int64#10,<r2=int64#6
|
||||
# asm 2: adc <squarer6=%r12,<r2=%r9
|
||||
adc %r12,%r9
|
||||
|
||||
# qhasm: carry? r3 += squarer7 + carry
|
||||
# asm 1: adc <squarer7=int64#4,<r3=int64#8
|
||||
# asm 2: adc <squarer7=%rcx,<r3=%r10
|
||||
adc %rcx,%r10
|
||||
|
||||
# qhasm: squarezero = 0
|
||||
# asm 1: mov $0,>squarezero=int64#2
|
||||
# asm 2: mov $0,>squarezero=%rsi
|
||||
mov $0,%rsi
|
||||
|
||||
# qhasm: squarer8 += squarezero + carry
|
||||
# asm 1: adc <squarezero=int64#2,<squarer8=int64#7
|
||||
# asm 2: adc <squarezero=%rsi,<squarer8=%rax
|
||||
adc %rsi,%rax
|
||||
|
||||
# qhasm: squarer8 *= 38
|
||||
# asm 1: imulq $38,<squarer8=int64#7,>squarer8=int64#3
|
||||
# asm 2: imulq $38,<squarer8=%rax,>squarer8=%rdx
|
||||
imulq $38,%rax,%rdx
|
||||
|
||||
# qhasm: carry? r0 += squarer8
|
||||
# asm 1: add <squarer8=int64#3,<r0=int64#12
|
||||
# asm 2: add <squarer8=%rdx,<r0=%r14
|
||||
add %rdx,%r14
|
||||
|
||||
# qhasm: carry? r1 += squarezero + carry
|
||||
# asm 1: adc <squarezero=int64#2,<r1=int64#5
|
||||
# asm 2: adc <squarezero=%rsi,<r1=%r8
|
||||
adc %rsi,%r8
|
||||
|
||||
# qhasm: carry? r2 += squarezero + carry
|
||||
# asm 1: adc <squarezero=int64#2,<r2=int64#6
|
||||
# asm 2: adc <squarezero=%rsi,<r2=%r9
|
||||
adc %rsi,%r9
|
||||
|
||||
# qhasm: carry? r3 += squarezero + carry
|
||||
# asm 1: adc <squarezero=int64#2,<r3=int64#8
|
||||
# asm 2: adc <squarezero=%rsi,<r3=%r10
|
||||
adc %rsi,%r10
|
||||
|
||||
# qhasm: squarezero += squarezero + carry
|
||||
# asm 1: adc <squarezero=int64#2,<squarezero=int64#2
|
||||
# asm 2: adc <squarezero=%rsi,<squarezero=%rsi
|
||||
adc %rsi,%rsi
|
||||
|
||||
# qhasm: squarezero *= 38
|
||||
# asm 1: imulq $38,<squarezero=int64#2,>squarezero=int64#2
|
||||
# asm 2: imulq $38,<squarezero=%rsi,>squarezero=%rsi
|
||||
imulq $38,%rsi,%rsi
|
||||
|
||||
# qhasm: r0 += squarezero
|
||||
# asm 1: add <squarezero=int64#2,<r0=int64#12
|
||||
# asm 2: add <squarezero=%rsi,<r0=%r14
|
||||
add %rsi,%r14
|
||||
|
||||
# qhasm: *(uint64 *)(rp + 8) = r1
|
||||
# asm 1: movq <r1=int64#5,8(<rp=int64#1)
|
||||
# asm 2: movq <r1=%r8,8(<rp=%rdi)
|
||||
movq %r8,8(%rdi)
|
||||
|
||||
# qhasm: *(uint64 *)(rp + 16) = r2
|
||||
# asm 1: movq <r2=int64#6,16(<rp=int64#1)
|
||||
# asm 2: movq <r2=%r9,16(<rp=%rdi)
|
||||
movq %r9,16(%rdi)
|
||||
|
||||
# qhasm: *(uint64 *)(rp + 24) = r3
|
||||
# asm 1: movq <r3=int64#8,24(<rp=int64#1)
|
||||
# asm 2: movq <r3=%r10,24(<rp=%rdi)
|
||||
movq %r10,24(%rdi)
|
||||
|
||||
# qhasm: *(uint64 *)(rp + 0) = r0
|
||||
# asm 1: movq <r0=int64#12,0(<rp=int64#1)
|
||||
# asm 2: movq <r0=%r14,0(<rp=%rdi)
|
||||
movq %r14,0(%rdi)
|
||||
|
||||
# qhasm: caller1 = caller1_stack
|
||||
# asm 1: movq <caller1_stack=stack64#1,>caller1=int64#9
|
||||
# asm 2: movq <caller1_stack=0(%rsp),>caller1=%r11
|
||||
movq 0(%rsp),%r11
|
||||
|
||||
# qhasm: caller2 = caller2_stack
|
||||
# asm 1: movq <caller2_stack=stack64#2,>caller2=int64#10
|
||||
# asm 2: movq <caller2_stack=8(%rsp),>caller2=%r12
|
||||
movq 8(%rsp),%r12
|
||||
|
||||
# qhasm: caller3 = caller3_stack
|
||||
# asm 1: movq <caller3_stack=stack64#3,>caller3=int64#11
|
||||
# asm 2: movq <caller3_stack=16(%rsp),>caller3=%r13
|
||||
movq 16(%rsp),%r13
|
||||
|
||||
# qhasm: caller4 = caller4_stack
|
||||
# asm 1: movq <caller4_stack=stack64#4,>caller4=int64#12
|
||||
# asm 2: movq <caller4_stack=24(%rsp),>caller4=%r14
|
||||
movq 24(%rsp),%r14
|
||||
|
||||
# qhasm: caller5 = caller5_stack
|
||||
# asm 1: movq <caller5_stack=stack64#5,>caller5=int64#13
|
||||
# asm 2: movq <caller5_stack=32(%rsp),>caller5=%r15
|
||||
movq 32(%rsp),%r15
|
||||
|
||||
# qhasm: caller6 = caller6_stack
|
||||
# asm 1: movq <caller6_stack=stack64#6,>caller6=int64#14
|
||||
# asm 2: movq <caller6_stack=40(%rsp),>caller6=%rbx
|
||||
movq 40(%rsp),%rbx
|
||||
|
||||
# qhasm: caller7 = caller7_stack
|
||||
# asm 1: movq <caller7_stack=stack64#7,>caller7=int64#15
|
||||
# asm 2: movq <caller7_stack=48(%rsp),>caller7=%rbp
|
||||
movq 48(%rsp),%rbp
|
||||
|
||||
# qhasm: leave
|
||||
add %r11,%rsp
|
||||
mov %rdi,%rax
|
||||
mov %rsi,%rdx
|
||||
ret
|
|
@ -1,189 +0,0 @@
|
|||
|
||||
# qhasm: int64 rp
|
||||
|
||||
# qhasm: int64 xp
|
||||
|
||||
# qhasm: int64 yp
|
||||
|
||||
# qhasm: input rp
|
||||
|
||||
# qhasm: input xp
|
||||
|
||||
# qhasm: input yp
|
||||
|
||||
# qhasm: int64 r0
|
||||
|
||||
# qhasm: int64 r1
|
||||
|
||||
# qhasm: int64 r2
|
||||
|
||||
# qhasm: int64 r3
|
||||
|
||||
# qhasm: int64 subt0
|
||||
|
||||
# qhasm: int64 subt1
|
||||
|
||||
# qhasm: int64 caller1
|
||||
|
||||
# qhasm: int64 caller2
|
||||
|
||||
# qhasm: int64 caller3
|
||||
|
||||
# qhasm: int64 caller4
|
||||
|
||||
# qhasm: int64 caller5
|
||||
|
||||
# qhasm: int64 caller6
|
||||
|
||||
# qhasm: int64 caller7
|
||||
|
||||
# qhasm: caller caller1
|
||||
|
||||
# qhasm: caller caller2
|
||||
|
||||
# qhasm: caller caller3
|
||||
|
||||
# qhasm: caller caller4
|
||||
|
||||
# qhasm: caller caller5
|
||||
|
||||
# qhasm: caller caller6
|
||||
|
||||
# qhasm: caller caller7
|
||||
|
||||
# qhasm: stack64 caller1_stack
|
||||
|
||||
# qhasm: stack64 caller2_stack
|
||||
|
||||
# qhasm: stack64 caller3_stack
|
||||
|
||||
# qhasm: stack64 caller4_stack
|
||||
|
||||
# qhasm: stack64 caller5_stack
|
||||
|
||||
# qhasm: stack64 caller6_stack
|
||||
|
||||
# qhasm: stack64 caller7_stack
|
||||
|
||||
# qhasm: enter crypto_sign_ed25519_amd64_64_fe25519_sub
|
||||
.text
|
||||
.p2align 5
|
||||
.globl _crypto_sign_ed25519_amd64_64_fe25519_sub
|
||||
.globl crypto_sign_ed25519_amd64_64_fe25519_sub
|
||||
_crypto_sign_ed25519_amd64_64_fe25519_sub:
|
||||
crypto_sign_ed25519_amd64_64_fe25519_sub:
|
||||
mov %rsp,%r11
|
||||
and $31,%r11
|
||||
add $0,%r11
|
||||
sub %r11,%rsp
|
||||
|
||||
# qhasm: r0 = *(uint64 *)(xp + 0)
|
||||
# asm 1: movq 0(<xp=int64#2),>r0=int64#4
|
||||
# asm 2: movq 0(<xp=%rsi),>r0=%rcx
|
||||
movq 0(%rsi),%rcx
|
||||
|
||||
# qhasm: r1 = *(uint64 *)(xp + 8)
|
||||
# asm 1: movq 8(<xp=int64#2),>r1=int64#5
|
||||
# asm 2: movq 8(<xp=%rsi),>r1=%r8
|
||||
movq 8(%rsi),%r8
|
||||
|
||||
# qhasm: r2 = *(uint64 *)(xp + 16)
|
||||
# asm 1: movq 16(<xp=int64#2),>r2=int64#6
|
||||
# asm 2: movq 16(<xp=%rsi),>r2=%r9
|
||||
movq 16(%rsi),%r9
|
||||
|
||||
# qhasm: r3 = *(uint64 *)(xp + 24)
|
||||
# asm 1: movq 24(<xp=int64#2),>r3=int64#2
|
||||
# asm 2: movq 24(<xp=%rsi),>r3=%rsi
|
||||
movq 24(%rsi),%rsi
|
||||
|
||||
# qhasm: carry? r0 -= *(uint64 *)(yp + 0)
|
||||
# asm 1: subq 0(<yp=int64#3),<r0=int64#4
|
||||
# asm 2: subq 0(<yp=%rdx),<r0=%rcx
|
||||
subq 0(%rdx),%rcx
|
||||
|
||||
# qhasm: carry? r1 -= *(uint64 *)(yp + 8) - carry
|
||||
# asm 1: sbbq 8(<yp=int64#3),<r1=int64#5
|
||||
# asm 2: sbbq 8(<yp=%rdx),<r1=%r8
|
||||
sbbq 8(%rdx),%r8
|
||||
|
||||
# qhasm: carry? r2 -= *(uint64 *)(yp + 16) - carry
|
||||
# asm 1: sbbq 16(<yp=int64#3),<r2=int64#6
|
||||
# asm 2: sbbq 16(<yp=%rdx),<r2=%r9
|
||||
sbbq 16(%rdx),%r9
|
||||
|
||||
# qhasm: carry? r3 -= *(uint64 *)(yp + 24) - carry
|
||||
# asm 1: sbbq 24(<yp=int64#3),<r3=int64#2
|
||||
# asm 2: sbbq 24(<yp=%rdx),<r3=%rsi
|
||||
sbbq 24(%rdx),%rsi
|
||||
|
||||
# qhasm: subt0 = 0
|
||||
# asm 1: mov $0,>subt0=int64#3
|
||||
# asm 2: mov $0,>subt0=%rdx
|
||||
mov $0,%rdx
|
||||
|
||||
# qhasm: subt1 = 38
|
||||
# asm 1: mov $38,>subt1=int64#7
|
||||
# asm 2: mov $38,>subt1=%rax
|
||||
mov $38,%rax
|
||||
|
||||
# qhasm: subt1 = subt0 if !carry
|
||||
# asm 1: cmovae <subt0=int64#3,<subt1=int64#7
|
||||
# asm 2: cmovae <subt0=%rdx,<subt1=%rax
|
||||
cmovae %rdx,%rax
|
||||
|
||||
# qhasm: carry? r0 -= subt1
|
||||
# asm 1: sub <subt1=int64#7,<r0=int64#4
|
||||
# asm 2: sub <subt1=%rax,<r0=%rcx
|
||||
sub %rax,%rcx
|
||||
|
||||
# qhasm: carry? r1 -= subt0 - carry
|
||||
# asm 1: sbb <subt0=int64#3,<r1=int64#5
|
||||
# asm 2: sbb <subt0=%rdx,<r1=%r8
|
||||
sbb %rdx,%r8
|
||||
|
||||
# qhasm: carry? r2 -= subt0 - carry
|
||||
# asm 1: sbb <subt0=int64#3,<r2=int64#6
|
||||
# asm 2: sbb <subt0=%rdx,<r2=%r9
|
||||
sbb %rdx,%r9
|
||||
|
||||
# qhasm: carry? r3 -= subt0 - carry
|
||||
# asm 1: sbb <subt0=int64#3,<r3=int64#2
|
||||
# asm 2: sbb <subt0=%rdx,<r3=%rsi
|
||||
sbb %rdx,%rsi
|
||||
|
||||
# qhasm: subt0 = subt1 if carry
|
||||
# asm 1: cmovc <subt1=int64#7,<subt0=int64#3
|
||||
# asm 2: cmovc <subt1=%rax,<subt0=%rdx
|
||||
cmovc %rax,%rdx
|
||||
|
||||
# qhasm: r0 -= subt0
|
||||
# asm 1: sub <subt0=int64#3,<r0=int64#4
|
||||
# asm 2: sub <subt0=%rdx,<r0=%rcx
|
||||
sub %rdx,%rcx
|
||||
|
||||
# qhasm: *(uint64 *)(rp + 0) = r0
|
||||
# asm 1: movq <r0=int64#4,0(<rp=int64#1)
|
||||
# asm 2: movq <r0=%rcx,0(<rp=%rdi)
|
||||
movq %rcx,0(%rdi)
|
||||
|
||||
# qhasm: *(uint64 *)(rp + 8) = r1
|
||||
# asm 1: movq <r1=int64#5,8(<rp=int64#1)
|
||||
# asm 2: movq <r1=%r8,8(<rp=%rdi)
|
||||
movq %r8,8(%rdi)
|
||||
|
||||
# qhasm: *(uint64 *)(rp + 16) = r2
|
||||
# asm 1: movq <r2=int64#6,16(<rp=int64#1)
|
||||
# asm 2: movq <r2=%r9,16(<rp=%rdi)
|
||||
movq %r9,16(%rdi)
|
||||
|
||||
# qhasm: *(uint64 *)(rp + 24) = r3
|
||||
# asm 1: movq <r3=int64#2,24(<rp=int64#1)
|
||||
# asm 2: movq <r3=%rsi,24(<rp=%rdi)
|
||||
movq %rsi,24(%rdi)
|
||||
|
||||
# qhasm: leave
|
||||
add %r11,%rsp
|
||||
mov %rdi,%rax
|
||||
mov %rsi,%rdx
|
||||
ret
|
|
@ -1,11 +0,0 @@
|
|||
#include "fe25519.h"
|
||||
|
||||
void fe25519_unpack(fe25519 *r, const unsigned char x[32])
|
||||
{
|
||||
/* assuming little-endian */
|
||||
r->v[0] = *(unsigned long long *)x;
|
||||
r->v[1] = *(((unsigned long long *)x)+1);
|
||||
r->v[2] = *(((unsigned long long *)x)+2);
|
||||
r->v[3] = *(((unsigned long long *)x)+3);
|
||||
r->v[3] &= 0x7fffffffffffffffULL;
|
||||
}
|
|
@ -1,95 +0,0 @@
|
|||
#ifndef GE25519_H
|
||||
#define GE25519_H
|
||||
|
||||
#include "fe25519.h"
|
||||
#include "sc25519.h"
|
||||
|
||||
#define ge25519 crypto_sign_ed25519_amd64_64_ge25519
|
||||
#define ge25519_base crypto_sign_ed25519_amd64_64_ge25519_base
|
||||
#define ge25519_unpackneg_vartime crypto_sign_ed25519_amd64_64_unpackneg_vartime
|
||||
#define ge25519_pack crypto_sign_ed25519_amd64_64_pack
|
||||
#define ge25519_isneutral_vartime crypto_sign_ed25519_amd64_64_isneutral_vartime
|
||||
#define ge25519_add crypto_sign_ed25519_amd64_64_ge25519_add
|
||||
#define ge25519_double crypto_sign_ed25519_amd64_64_ge25519_double
|
||||
#define ge25519_double_scalarmult_vartime crypto_sign_ed25519_amd64_64_double_scalarmult_vartime
|
||||
#define ge25519_multi_scalarmult_vartime crypto_sign_ed25519_amd64_64_ge25519_multi_scalarmult_vartime
|
||||
#define ge25519_scalarmult_base crypto_sign_ed25519_amd64_64_scalarmult_base
|
||||
#define ge25519_p1p1_to_p2 crypto_sign_ed25519_amd64_64_ge25519_p1p1_to_p2
|
||||
#define ge25519_p1p1_to_p3 crypto_sign_ed25519_amd64_64_ge25519_p1p1_to_p3
|
||||
#define ge25519_add_p1p1 crypto_sign_ed25519_amd64_64_ge25519_add_p1p1
|
||||
#define ge25519_dbl_p1p1 crypto_sign_ed25519_amd64_64_ge25519_dbl_p1p1
|
||||
#define choose_t crypto_sign_ed25519_amd64_64_choose_t
|
||||
#define ge25519_nielsadd2 crypto_sign_ed25519_amd64_64_ge25519_nielsadd2
|
||||
#define ge25519_nielsadd_p1p1 crypto_sign_ed25519_amd64_64_ge25519_nielsadd_p1p1
|
||||
#define ge25519_pnielsadd_p1p1 crypto_sign_ed25519_amd64_64_ge25519_pnielsadd_p1p1
|
||||
|
||||
|
||||
#define ge25519_p3 ge25519
|
||||
|
||||
typedef struct
|
||||
{
|
||||
fe25519 x;
|
||||
fe25519 y;
|
||||
fe25519 z;
|
||||
fe25519 t;
|
||||
} ge25519;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
fe25519 x;
|
||||
fe25519 z;
|
||||
fe25519 y;
|
||||
fe25519 t;
|
||||
} ge25519_p1p1;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
fe25519 x;
|
||||
fe25519 y;
|
||||
fe25519 z;
|
||||
} ge25519_p2;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
fe25519 ysubx;
|
||||
fe25519 xaddy;
|
||||
fe25519 t2d;
|
||||
} ge25519_niels;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
fe25519 ysubx;
|
||||
fe25519 xaddy;
|
||||
fe25519 z;
|
||||
fe25519 t2d;
|
||||
} ge25519_pniels;
|
||||
|
||||
extern void ge25519_p1p1_to_p2(ge25519_p2 *r, const ge25519_p1p1 *p);
|
||||
extern void ge25519_p1p1_to_p3(ge25519_p3 *r, const ge25519_p1p1 *p);
|
||||
extern void ge25519_add_p1p1(ge25519_p1p1 *r, const ge25519_p3 *p, const ge25519_p3 *q);
|
||||
extern void ge25519_dbl_p1p1(ge25519_p1p1 *r, const ge25519_p2 *p);
|
||||
extern void choose_t(ge25519_niels *t, unsigned long long pos, signed long long b, const ge25519_niels *base_multiples);
|
||||
extern void ge25519_nielsadd2(ge25519_p3 *r, const ge25519_niels *q);
|
||||
extern void ge25519_nielsadd_p1p1(ge25519_p1p1 *r, const ge25519_p3 *p, const ge25519_niels *q);
|
||||
extern void ge25519_pnielsadd_p1p1(ge25519_p1p1 *r, const ge25519_p3 *p, const ge25519_pniels *q);
|
||||
|
||||
extern const ge25519 ge25519_base;
|
||||
|
||||
extern int ge25519_unpackneg_vartime(ge25519 *r, const unsigned char p[32]);
|
||||
|
||||
extern void ge25519_pack(unsigned char r[32], const ge25519 *p);
|
||||
|
||||
extern int ge25519_isneutral_vartime(const ge25519 *p);
|
||||
|
||||
extern void ge25519_add(ge25519 *r, const ge25519 *p, const ge25519 *q);
|
||||
|
||||
extern void ge25519_double(ge25519 *r, const ge25519 *p);
|
||||
|
||||
/* computes [s1]p1 + [s2]ge25519_base */
|
||||
extern void ge25519_double_scalarmult_vartime(ge25519 *r, const ge25519 *p1, const sc25519 *s1, const sc25519 *s2);
|
||||
|
||||
extern void ge25519_multi_scalarmult_vartime(ge25519 *r, ge25519 *p, sc25519 *s, const unsigned long long npoints);
|
||||
|
||||
extern void ge25519_scalarmult_base(ge25519 *r, const sc25519 *s);
|
||||
|
||||
#endif
|
|
@ -1,8 +0,0 @@
|
|||
#include "ge25519.h"
|
||||
|
||||
void ge25519_add(ge25519_p3 *r, const ge25519_p3 *p, const ge25519_p3 *q)
|
||||
{
|
||||
ge25519_p1p1 grp1p1;
|
||||
ge25519_add_p1p1(&grp1p1, p, q);
|
||||
ge25519_p1p1_to_p3(r, &grp1p1);
|
||||
}
|
File diff suppressed because it is too large
Load diff
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue