mirror of
https://github.com/vacp2p/nim-ngtcp2.git
synced 2026-01-09 13:08:07 -05:00
Compare commits
16 Commits
version-34
...
boringssl-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
798b49b304 | ||
|
|
791eb85914 | ||
|
|
14adc588ba | ||
|
|
50c9d44f76 | ||
|
|
6ca91ea115 | ||
|
|
9456daa178 | ||
|
|
eb04494047 | ||
|
|
525d9cfe25 | ||
|
|
95412ee90a | ||
|
|
98372a266e | ||
|
|
b9dbc3ad58 | ||
|
|
0a746cef2e | ||
|
|
0ce4b13b1b | ||
|
|
e7983b6a6e | ||
|
|
6834f4756b | ||
|
|
817de8ece8 |
133
.github/actions/install_nim/action.yml
vendored
Normal file
133
.github/actions/install_nim/action.yml
vendored
Normal file
@@ -0,0 +1,133 @@
|
||||
name: Install Nim
|
||||
inputs:
|
||||
os:
|
||||
description: "Operating system to build for"
|
||||
required: true
|
||||
cpu:
|
||||
description: "CPU to build for"
|
||||
default: "amd64"
|
||||
nim_ref:
|
||||
description: "Nim version"
|
||||
default: "version-1-6"
|
||||
shell:
|
||||
description: "Shell to run commands in"
|
||||
default: "bash --noprofile --norc -e -o pipefail"
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Install build dependencies (Linux i386)
|
||||
shell: ${{ inputs.shell }}
|
||||
if: inputs.os == 'Linux' && inputs.cpu == 'i386'
|
||||
run: |
|
||||
sudo dpkg --add-architecture i386
|
||||
sudo apt-get update -qq
|
||||
sudo DEBIAN_FRONTEND='noninteractive' apt-get install \
|
||||
--no-install-recommends -yq gcc-multilib g++-multilib \
|
||||
libssl-dev:i386
|
||||
mkdir -p external/bin
|
||||
cat << EOF > external/bin/gcc
|
||||
#!/bin/bash
|
||||
exec $(which gcc) -m32 "\$@"
|
||||
EOF
|
||||
cat << EOF > external/bin/g++
|
||||
#!/bin/bash
|
||||
exec $(which g++) -m32 "\$@"
|
||||
EOF
|
||||
chmod 755 external/bin/gcc external/bin/g++
|
||||
echo '${{ github.workspace }}/external/bin' >> $GITHUB_PATH
|
||||
|
||||
- name: MSYS2 (Windows i386)
|
||||
if: inputs.os == 'Windows' && inputs.cpu == 'i386'
|
||||
uses: msys2/setup-msys2@v2
|
||||
with:
|
||||
path-type: inherit
|
||||
msystem: MINGW32
|
||||
install: >-
|
||||
base-devel
|
||||
git
|
||||
mingw-w64-i686-toolchain
|
||||
|
||||
- name: MSYS2 (Windows amd64)
|
||||
if: inputs.os == 'Windows' && inputs.cpu == 'amd64'
|
||||
uses: msys2/setup-msys2@v2
|
||||
with:
|
||||
path-type: inherit
|
||||
install: >-
|
||||
base-devel
|
||||
git
|
||||
mingw-w64-x86_64-toolchain
|
||||
|
||||
- name: Restore Nim DLLs dependencies (Windows) from cache
|
||||
if: inputs.os == 'Windows'
|
||||
id: windows-dlls-cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: external/dlls
|
||||
key: 'dlls'
|
||||
|
||||
- name: Install DLL dependencies (Windows)
|
||||
shell: ${{ inputs.shell }}
|
||||
if: >
|
||||
steps.windows-dlls-cache.outputs.cache-hit != 'true' &&
|
||||
inputs.os == 'Windows'
|
||||
run: |
|
||||
mkdir external
|
||||
curl -L "https://nim-lang.org/download/windeps.zip" -o external/windeps.zip
|
||||
7z x external/windeps.zip -oexternal/dlls
|
||||
|
||||
- name: Path to cached dependencies (Windows)
|
||||
shell: ${{ inputs.shell }}
|
||||
if: >
|
||||
inputs.os == 'Windows'
|
||||
run: |
|
||||
echo '${{ github.workspace }}'"/external/dlls" >> $GITHUB_PATH
|
||||
|
||||
- name: Derive environment variables
|
||||
shell: ${{ inputs.shell }}
|
||||
run: |
|
||||
if [[ '${{ inputs.cpu }}' == 'amd64' ]]; then
|
||||
PLATFORM=x64
|
||||
elif [[ '${{ inputs.cpu }}' == 'arm64' ]]; then
|
||||
PLATFORM=arm64
|
||||
else
|
||||
PLATFORM=x86
|
||||
fi
|
||||
echo "PLATFORM=$PLATFORM" >> $GITHUB_ENV
|
||||
|
||||
ncpu=
|
||||
MAKE_CMD="make"
|
||||
case '${{ inputs.os }}' in
|
||||
'Linux')
|
||||
ncpu=$(nproc)
|
||||
;;
|
||||
'macOS')
|
||||
ncpu=$(sysctl -n hw.ncpu)
|
||||
;;
|
||||
'Windows')
|
||||
ncpu=$NUMBER_OF_PROCESSORS
|
||||
MAKE_CMD="mingw32-make"
|
||||
;;
|
||||
esac
|
||||
[[ -z "$ncpu" || $ncpu -le 0 ]] && ncpu=1
|
||||
echo "ncpu=$ncpu" >> $GITHUB_ENV
|
||||
echo "MAKE_CMD=${MAKE_CMD}" >> $GITHUB_ENV
|
||||
echo '${{ github.workspace }}/nim/bin' >> $GITHUB_PATH
|
||||
|
||||
- name: Restore Nim from cache
|
||||
id: nim-cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: '${{ github.workspace }}/nim'
|
||||
key: ${{ inputs.os }}-${{ inputs.cpu }}-nim-${{ inputs.nim_ref }}-cache-${{ env.cache_nonce }}
|
||||
|
||||
- name: Build Nim and Nimble
|
||||
shell: ${{ inputs.shell }}
|
||||
if: ${{ steps.nim-cache.outputs.cache-hit != 'true' }}
|
||||
run: |
|
||||
# We don't want partial matches of the cache restored
|
||||
rm -rf nim
|
||||
curl -O -L -s -S https://raw.githubusercontent.com/status-im/nimbus-build-system/master/scripts/build_nim.sh
|
||||
env MAKE="${MAKE_CMD} -j${ncpu}" ARCH_OVERRIDE=${PLATFORM} NIM_COMMIT=${{ inputs.nim_ref }} \
|
||||
QUICK_AND_DIRTY_COMPILER=1 QUICK_AND_DIRTY_NIMBLE=1 CC=gcc \
|
||||
bash build_nim.sh nim csources dist/nimble NimBinaries
|
||||
115
.github/workflows/test.yml
vendored
115
.github/workflows/test.yml
vendored
@@ -1,21 +1,108 @@
|
||||
name: CI
|
||||
name: Continuous Integration
|
||||
|
||||
on: [push, pull_request]
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
merge_group:
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ${{ matrix.os }}
|
||||
timeout-minutes: 90
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest, macOS-latest, windows-latest]
|
||||
platform:
|
||||
- os: linux
|
||||
cpu: amd64
|
||||
- os: linux
|
||||
cpu: i386
|
||||
- os: linux-gcc-14
|
||||
cpu: amd64
|
||||
- os: macos-14
|
||||
cpu: arm64
|
||||
- os: windows
|
||||
cpu: amd64
|
||||
nim:
|
||||
- ref: version-2-0
|
||||
memory_management: refc
|
||||
include:
|
||||
- platform:
|
||||
os: linux
|
||||
builder: ubuntu-22.04
|
||||
shell: bash
|
||||
- platform:
|
||||
os: linux-gcc-14
|
||||
builder: ubuntu-24.04
|
||||
shell: bash
|
||||
- platform:
|
||||
os: macos-14
|
||||
builder: macos-14
|
||||
shell: bash
|
||||
- platform:
|
||||
os: windows
|
||||
builder: windows-2022
|
||||
shell: msys2 {0}
|
||||
|
||||
defaults:
|
||||
run:
|
||||
shell: ${{ matrix.shell }}
|
||||
|
||||
name: "${{ matrix.platform.os }}-${{ matrix.platform.cpu }} (Nim ${{ matrix.nim.ref }})"
|
||||
runs-on: ${{ matrix.builder }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
- uses: iffy/install-nim@v5
|
||||
with:
|
||||
version: 1.6.20
|
||||
- name: Build
|
||||
run: nimble install -y
|
||||
- name: Test
|
||||
run: nimble test -y
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: Setup Nim
|
||||
uses: "./.github/actions/install_nim"
|
||||
with:
|
||||
os: ${{ matrix.platform.os }}
|
||||
cpu: ${{ matrix.platform.cpu }}
|
||||
shell: ${{ matrix.shell }}
|
||||
nim_ref: ${{ matrix.nim.ref }}
|
||||
|
||||
- name: Restore deps from cache
|
||||
id: deps-cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: nimbledeps
|
||||
# Using nim.ref as a simple way to differentiate between nimble using the "pkgs" or "pkgs2" directories.
|
||||
# The change happened on Nimble v0.14.0. Also forcing the deps to be reinstalled on each os and cpu.
|
||||
key: nimbledeps-${{ matrix.nim.ref }}-${{ matrix.builder }}-${{ matrix.platform.cpu }}-${{ hashFiles('.pinned') }} # hashFiles returns a different value on windows
|
||||
|
||||
- name: Install deps
|
||||
if: ${{ steps.deps-cache.outputs.cache-hit != 'true' }}
|
||||
run: |
|
||||
nimble install
|
||||
|
||||
- name: Use gcc 14
|
||||
if: ${{ matrix.platform.os == 'linux-gcc-14'}}
|
||||
run: |
|
||||
# Add GCC-14 to alternatives
|
||||
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 14
|
||||
|
||||
# Set GCC-14 as the default
|
||||
sudo update-alternatives --set gcc /usr/bin/gcc-14
|
||||
|
||||
- name: Install deps (windows)
|
||||
if: ${{ matrix.platform.os == 'windows'}}
|
||||
run: |
|
||||
pacman -S --noconfirm base-devel gcc
|
||||
|
||||
- name: Run tests
|
||||
run: |
|
||||
nim --version
|
||||
nimble --version
|
||||
gcc --version
|
||||
|
||||
NIMFLAGS="${NIMFLAGS} --mm:${{ matrix.nim.memory_management }}"
|
||||
nimble test --styleCheck:off --verbose --debug
|
||||
|
||||
15
.gitignore
vendored
15
.gitignore
vendored
@@ -1,13 +1,2 @@
|
||||
*
|
||||
!*/
|
||||
!*.*
|
||||
|
||||
# ignore all cmake build files, except version.h
|
||||
build/*
|
||||
!build/lib/
|
||||
build/lib/*
|
||||
!build/lib/includes/
|
||||
build/lib/includes/*
|
||||
!build/lib/includes/ngtcp2/
|
||||
build/lib/includes/ngtcp2/*
|
||||
!build/lib/includes/ngtcp2/version.h
|
||||
!libs/
|
||||
!libs/*
|
||||
9
.gitmodules
vendored
9
.gitmodules
vendored
@@ -1,3 +1,6 @@
|
||||
[submodule "sources"]
|
||||
path = sources
|
||||
url = https://github.com/ngtcp2/ngtcp2.git
|
||||
[submodule "libs/ngtcp2"]
|
||||
path = libs/ngtcp2
|
||||
url = https://github.com/ngtcp2/ngtcp2
|
||||
[submodule "libs/boringssl"]
|
||||
path = libs/boringssl
|
||||
url = https://boringssl.googlesource.com/boringssl
|
||||
|
||||
201
LICENSE-APACHEv2
Normal file
201
LICENSE-APACHEv2
Normal file
@@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright 2018 Status Research & Development GmbH
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
25
LICENSE-MIT
Normal file
25
LICENSE-MIT
Normal file
@@ -0,0 +1,25 @@
|
||||
nim-ngtcp2 is licensed under the MIT License
|
||||
Copyright (c) 2025 Status Research & Development GmbH
|
||||
-----------------------------------------------------
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2018 Status Research & Development GmbH
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
25
README.md
Normal file
25
README.md
Normal file
@@ -0,0 +1,25 @@
|
||||
# ngtcp2 for Nim
|
||||
|
||||
[](https://opensource.org/licenses/MIT)
|
||||
[](https://opensource.org/licenses/Apache-2.0)
|
||||

|
||||
<img src="https://img.shields.io/badge/nim-%3E%3D1.2.0-orange.svg?style=flat-square" />
|
||||
|
||||
Wrapper around the [ngtcp2](https://github.com/ngtcp2/ngtcp2) C library for
|
||||
[Nim](https://nim-lang.org/).
|
||||
|
||||
## Updating to a newer version
|
||||
|
||||
Follow these steps when updating the wrapper to a newer version of ngtcp2:
|
||||
|
||||
- update the git submodule in `libs/` to point to the new version
|
||||
- `git submodule update --init --recursive`
|
||||
- run `build.sh` (requires Nim, CMake and clang to be installed)
|
||||
- increase the `version` property in the `ngtcp2.nimble` file
|
||||
- commit the changes
|
||||
|
||||
### Enabling QuicTLS
|
||||
|
||||
```
|
||||
`-d:ngtcp2_enable_quictls`
|
||||
```
|
||||
15
Readme.md
15
Readme.md
@@ -1,15 +0,0 @@
|
||||
ngtcp2 for Nim
|
||||
==============
|
||||
|
||||
Wrapper around the [ngtcp2](https://github.com/ngtcp2/ngtcp2) C library for
|
||||
[Nim](https://nim-lang.org/).
|
||||
|
||||
Updating to a newer version
|
||||
---------------------------
|
||||
|
||||
Follow these steps when updating the wrapper to a newer version of ngtcp2:
|
||||
|
||||
1. update the git submodule in `sources/` to point to the new version
|
||||
2. run `build.sh` (requires Nim and CMake to be installed)
|
||||
3. update the version in `ngtcp2.nimble`
|
||||
4. commit the changes
|
||||
431
boringssl.nim
Normal file
431
boringssl.nim
Normal file
@@ -0,0 +1,431 @@
|
||||
# libcrypto + libssl sources without cmake, no-asm, no fips, no tests, tools
|
||||
# TODO: look into use assembly files for perf
|
||||
|
||||
# ----- toolchain + includes -----
|
||||
{.passc: "-DBORINGSSL_IMPLEMENTATION -DOPENSSL_NO_ASM -DS2N_BN_HIDE_SYMBOLS".}
|
||||
{.
|
||||
localPassC:
|
||||
"-fno-common -fvisibility=hidden -fno-strict-aliasing -Werror -Wformat=2 -Wsign-compare -Wwrite-strings -Wvla -Wshadow -Wtype-limits -Wmissing-field-initializers -ffunction-sections -fdata-sections -fno-exceptions -fno-rtti"
|
||||
.}
|
||||
{.passc: "-I./libs/boringssl/include".}
|
||||
|
||||
when not defined(release):
|
||||
{.localPassC: "-DNDEBUG".}
|
||||
|
||||
# link stdc++/pthread as needed
|
||||
when defined(macosx):
|
||||
{.localPassC: "-lc++".}
|
||||
elif defined(linux):
|
||||
{.localPassC: "-D_XOPEN_SOURCE=700".}
|
||||
{.localPassC: "-lstdc++".}
|
||||
elif defined(windows):
|
||||
{.
|
||||
localPassC:
|
||||
"-D_HAS_EXCEPTIONS=0 -DWIN32_LEAN_AND_MEAN -DNOMINMAX -D_CRT_SECURE_NO_WARNINGS"
|
||||
.}
|
||||
|
||||
const BORINGSS_USE_ASM {.booldefine.}: bool = true
|
||||
|
||||
when BORINGSS_USE_ASM:
|
||||
when not defined(windows):
|
||||
{.compile: "./libs/boringssl/crypto/curve25519/asm/x25519-asm-arm.S".}
|
||||
{.compile: "./libs/boringssl/crypto/hrss/asm/poly_rq_mul.S".}
|
||||
{.compile: "./libs/boringssl/crypto/poly1305/poly1305_arm_asm.S".}
|
||||
{.compile: "./libs/boringssl/gen/crypto/aes128gcmsiv-x86_64-apple.S".}
|
||||
{.compile: "./libs/boringssl/gen/crypto/aes128gcmsiv-x86_64-linux.S".}
|
||||
{.compile: "./libs/boringssl/gen/crypto/chacha-armv4-linux.S".}
|
||||
{.compile: "./libs/boringssl/gen/crypto/chacha-armv8-apple.S".}
|
||||
{.compile: "./libs/boringssl/gen/crypto/chacha-armv8-linux.S".}
|
||||
{.compile: "./libs/boringssl/gen/crypto/chacha-armv8-win.S".}
|
||||
{.compile: "./libs/boringssl/gen/crypto/chacha-x86-apple.S".}
|
||||
{.compile: "./libs/boringssl/gen/crypto/chacha-x86-linux.S".}
|
||||
{.compile: "./libs/boringssl/gen/crypto/chacha-x86_64-apple.S".}
|
||||
{.compile: "./libs/boringssl/gen/crypto/chacha-x86_64-linux.S".}
|
||||
{.compile: "./libs/boringssl/gen/crypto/chacha20_poly1305_armv8-apple.S".}
|
||||
{.compile: "./libs/boringssl/gen/crypto/chacha20_poly1305_armv8-linux.S".}
|
||||
{.compile: "./libs/boringssl/gen/crypto/chacha20_poly1305_armv8-win.S".}
|
||||
{.compile: "./libs/boringssl/gen/crypto/chacha20_poly1305_x86_64-apple.S".}
|
||||
{.compile: "./libs/boringssl/gen/crypto/chacha20_poly1305_x86_64-linux.S".}
|
||||
{.compile: "./libs/boringssl/gen/crypto/md5-586-apple.S".}
|
||||
{.compile: "./libs/boringssl/gen/crypto/md5-586-linux.S".}
|
||||
{.compile: "./libs/boringssl/gen/crypto/md5-x86_64-apple.S".}
|
||||
{.compile: "./libs/boringssl/gen/crypto/md5-x86_64-linux.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/aes-gcm-avx2-x86_64-apple.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/aes-gcm-avx2-x86_64-linux.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/aes-gcm-avx512-x86_64-apple.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/aes-gcm-avx512-x86_64-linux.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/aesni-gcm-x86_64-apple.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/aesni-gcm-x86_64-linux.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/aesni-x86-apple.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/aesni-x86_64-apple.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/aesni-x86_64-linux.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/aesv8-armv7-linux.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/aesv8-armv8-apple.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/aesv8-armv8-linux.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/aesv8-armv8-win.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/aesv8-gcm-armv8-apple.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/aesv8-gcm-armv8-linux.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/aesv8-gcm-armv8-win.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/armv4-mont-linux.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/armv8-mont-apple.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/armv8-mont-linux.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/armv8-mont-win.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/bn-586-apple.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/bn-586-linux.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/bn-armv8-apple.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/bn-armv8-linux.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/bn-armv8-win.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/bsaes-armv7-linux.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/co-586-apple.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/co-586-linux.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/ghash-armv4-linux.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/ghash-neon-armv8-apple.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/ghash-neon-armv8-linux.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/ghash-neon-armv8-win.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/ghash-ssse3-x86-apple.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/ghash-ssse3-x86_64-apple.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/ghash-ssse3-x86_64-linux.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/ghash-x86-apple.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/ghash-x86_64-apple.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/ghash-x86_64-linux.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/ghashv8-armv7-linux.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/ghashv8-armv8-apple.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/ghashv8-armv8-linux.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/ghashv8-armv8-win.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/p256-armv8-asm-apple.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/p256-armv8-asm-linux.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/p256-armv8-asm-win.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/p256-x86_64-asm-apple.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/p256-x86_64-asm-linux.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/p256_beeu-armv8-asm-apple.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/p256_beeu-armv8-asm-linux.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/p256_beeu-armv8-asm-win.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/p256_beeu-x86_64-asm-apple.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/p256_beeu-x86_64-asm-linux.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/rdrand-x86_64-apple.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/rdrand-x86_64-linux.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/rsaz-avx2-apple.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/rsaz-avx2-linux.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/sha1-586-apple.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/sha1-586-linux.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/sha1-armv4-large-linux.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/sha1-armv8-apple.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/sha1-armv8-linux.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/sha1-armv8-win.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/sha1-x86_64-apple.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/sha1-x86_64-linux.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/sha256-586-apple.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/sha256-586-linux.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/sha256-armv4-linux.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/sha256-armv8-apple.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/sha256-armv8-linux.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/sha256-armv8-win.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/sha256-x86_64-apple.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/sha256-x86_64-linux.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/sha512-586-apple.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/sha512-586-linux.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/sha512-armv4-linux.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/sha512-armv8-apple.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/sha512-armv8-linux.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/sha512-armv8-win.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/sha512-x86_64-apple.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/sha512-x86_64-linux.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/vpaes-armv7-linux.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/vpaes-armv8-apple.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/vpaes-armv8-linux.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/vpaes-armv8-win.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/vpaes-x86-apple.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/vpaes-x86_64-apple.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/vpaes-x86_64-linux.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/x86-mont-apple.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/x86_64-mont-apple.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/x86_64-mont-linux.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/x86_64-mont5-apple.S".}
|
||||
{.compile: "./libs/boringssl/gen/bcm/x86_64-mont5-linux.S".}
|
||||
|
||||
# ----- generated sources -----
|
||||
{.compile: "./libs/boringssl/crypto/fipsmodule/bcm.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/aes/aes.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/asn1/a_bitstr.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/asn1/a_bool.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/asn1/a_d2i_fp.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/asn1/a_dup.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/asn1/a_gentm.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/asn1/a_i2d_fp.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/asn1/a_int.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/asn1/a_mbstr.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/asn1/a_object.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/asn1/a_octet.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/asn1/a_strex.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/asn1/a_strnid.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/asn1/a_time.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/asn1/a_type.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/asn1/a_utctm.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/asn1/asn1_lib.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/asn1/asn1_par.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/asn1/asn_pack.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/asn1/f_int.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/asn1/f_string.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/asn1/posix_time.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/asn1/tasn_dec.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/asn1/tasn_enc.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/asn1/tasn_fre.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/asn1/tasn_new.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/asn1/tasn_typ.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/asn1/tasn_utl.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/base64/base64.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/bio/bio.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/bio/bio_mem.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/bio/connect.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/bio/errno.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/bio/fd.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/bio/file.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/bio/hexdump.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/bio/pair.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/bio/printf.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/bio/socket.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/bio/socket_helper.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/blake2/blake2.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/bn/bn_asn1.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/bn/convert.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/bn/div.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/bn/exponentiation.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/bn/sqrt.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/buf/buf.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/bytestring/asn1_compat.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/bytestring/ber.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/bytestring/cbb.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/bytestring/cbs.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/bytestring/unicode.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/chacha/chacha.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/cipher/derive_key.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/cipher/e_aesctrhmac.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/cipher/e_aeseax.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/cipher/e_aesgcmsiv.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/cipher/e_chacha20poly1305.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/cipher/e_des.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/cipher/e_null.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/cipher/e_rc2.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/cipher/e_rc4.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/cipher/e_tls.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/cipher/get_cipher.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/cipher/tls_cbc.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/cms/cms.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/conf/conf.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/cpu_aarch64_apple.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/cpu_aarch64_fuchsia.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/cpu_aarch64_linux.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/cpu_aarch64_openbsd.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/cpu_aarch64_sysreg.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/cpu_aarch64_win.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/cpu_arm_freebsd.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/cpu_arm_linux.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/cpu_intel.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/crypto.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/curve25519/curve25519.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/curve25519/curve25519_64_adx.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/curve25519/spake25519.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/des/des.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/dh/dh_asn1.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/dh/params.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/digest/digest_extra.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/dsa/dsa.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/dsa/dsa_asn1.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/ec/ec_asn1.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/ec/ec_derive.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/ec/hash_to_curve.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/ecdh/ecdh.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/ecdsa/ecdsa_asn1.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/ecdsa/ecdsa_p1363.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/engine/engine.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/err/err.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/evp/evp.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/evp/evp_asn1.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/evp/evp_ctx.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/evp/p_dh.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/evp/p_dh_asn1.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/evp/p_dsa_asn1.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/evp/p_ec.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/evp/p_ec_asn1.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/evp/p_ed25519.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/evp/p_ed25519_asn1.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/evp/p_hkdf.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/evp/p_rsa.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/evp/p_rsa_asn1.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/evp/p_x25519.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/evp/p_x25519_asn1.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/evp/pbkdf.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/evp/print.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/evp/scrypt.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/evp/sign.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/ex_data.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/fipsmodule/fips_shared_support.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/fuzzer_mode.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/hpke/hpke.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/hrss/hrss.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/kyber/kyber.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/lhash/lhash.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/md4/md4.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/md5/md5.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/mem.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/mldsa/mldsa.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/mlkem/mlkem.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/obj/obj.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/obj/obj_xref.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/pem/pem_all.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/pem/pem_info.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/pem/pem_lib.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/pem/pem_oth.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/pem/pem_pk8.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/pem/pem_pkey.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/pem/pem_x509.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/pem/pem_xaux.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/pkcs7/pkcs7.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/pkcs7/pkcs7_x509.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/pkcs8/p5_pbev2.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/pkcs8/pkcs8.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/pkcs8/pkcs8_x509.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/poly1305/poly1305.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/poly1305/poly1305_arm.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/poly1305/poly1305_vec.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/pool/pool.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/rand/deterministic.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/rand/fork_detect.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/rand/forkunsafe.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/rand/getentropy.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/rand/ios.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/rand/passive.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/rand/rand.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/rand/trusty.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/rand/urandom.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/rand/windows.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/rc4/rc4.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/refcount.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/rsa/rsa_asn1.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/rsa/rsa_crypt.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/rsa/rsa_extra.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/rsa/rsa_print.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/sha/sha1.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/sha/sha256.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/sha/sha512.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/siphash/siphash.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/slhdsa/slhdsa.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/spake2plus/spake2plus.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/stack/stack.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/thread.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/thread_none.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/thread_pthread.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/thread_win.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/trust_token/pmbtoken.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/trust_token/trust_token.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/trust_token/voprf.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/x509/a_digest.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/x509/a_sign.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/x509/a_verify.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/x509/algorithm.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/x509/asn1_gen.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/x509/by_dir.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/x509/by_file.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/x509/i2d_pr.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/x509/name_print.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/x509/policy.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/x509/rsa_pss.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/x509/t_crl.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/x509/t_req.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/x509/t_x509.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/x509/t_x509a.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/x509/v3_akey.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/x509/v3_akeya.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/x509/v3_alt.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/x509/v3_bcons.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/x509/v3_bitst.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/x509/v3_conf.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/x509/v3_cpols.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/x509/v3_crld.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/x509/v3_enum.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/x509/v3_extku.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/x509/v3_genn.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/x509/v3_ia5.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/x509/v3_info.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/x509/v3_int.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/x509/v3_lib.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/x509/v3_ncons.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/x509/v3_ocsp.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/x509/v3_pcons.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/x509/v3_pmaps.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/x509/v3_prn.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/x509/v3_purp.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/x509/v3_skey.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/x509/v3_utl.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/x509/x509.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/x509/x509_att.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/x509/x509_cmp.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/x509/x509_d2.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/x509/x509_def.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/x509/x509_ext.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/x509/x509_lu.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/x509/x509_obj.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/x509/x509_req.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/x509/x509_set.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/x509/x509_trs.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/x509/x509_txt.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/x509/x509_v3.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/x509/x509_vfy.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/x509/x509_vpm.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/x509/x509cset.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/x509/x509name.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/x509/x509rset.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/x509/x509spki.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/x509/x_algor.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/x509/x_all.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/x509/x_attrib.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/x509/x_crl.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/x509/x_exten.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/x509/x_name.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/x509/x_pubkey.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/x509/x_req.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/x509/x_sig.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/x509/x_spki.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/x509/x_x509.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/x509/x_x509a.cc".}
|
||||
{.compile: "./libs/boringssl/crypto/xwing/xwing.cc".}
|
||||
{.compile: "./libs/boringssl/gen/crypto//err_data.cc".}
|
||||
{.compile: "./libs/boringssl/ssl/bio_ssl.cc".}
|
||||
{.compile: "./libs/boringssl/ssl/d1_both.cc".}
|
||||
{.compile: "./libs/boringssl/ssl/d1_lib.cc".}
|
||||
{.compile: "./libs/boringssl/ssl/d1_pkt.cc".}
|
||||
{.compile: "./libs/boringssl/ssl/d1_srtp.cc".}
|
||||
{.compile: "./libs/boringssl/ssl/dtls_method.cc".}
|
||||
{.compile: "./libs/boringssl/ssl/dtls_record.cc".}
|
||||
{.compile: "./libs/boringssl/ssl/encrypted_client_hello.cc".}
|
||||
{.compile: "./libs/boringssl/ssl/extensions.cc".}
|
||||
{.compile: "./libs/boringssl/ssl/handoff.cc".}
|
||||
{.compile: "./libs/boringssl/ssl/handshake.cc".}
|
||||
{.compile: "./libs/boringssl/ssl/handshake_client.cc".}
|
||||
{.compile: "./libs/boringssl/ssl/handshake_server.cc".}
|
||||
{.compile: "./libs/boringssl/ssl/s3_both.cc".}
|
||||
{.compile: "./libs/boringssl/ssl/s3_lib.cc".}
|
||||
{.compile: "./libs/boringssl/ssl/s3_pkt.cc".}
|
||||
{.compile: "./libs/boringssl/ssl/ssl_aead_ctx.cc".}
|
||||
{.compile: "./libs/boringssl/ssl/ssl_asn1.cc".}
|
||||
{.compile: "./libs/boringssl/ssl/ssl_buffer.cc".}
|
||||
{.compile: "./libs/boringssl/ssl/ssl_cert.cc".}
|
||||
{.compile: "./libs/boringssl/ssl/ssl_cipher.cc".}
|
||||
{.compile: "./libs/boringssl/ssl/ssl_credential.cc".}
|
||||
{.compile: "./libs/boringssl/ssl/ssl_file.cc".}
|
||||
{.compile: "./libs/boringssl/ssl/ssl_key_share.cc".}
|
||||
{.compile: "./libs/boringssl/ssl/ssl_lib.cc".}
|
||||
{.compile: "./libs/boringssl/ssl/ssl_privkey.cc".}
|
||||
{.compile: "./libs/boringssl/ssl/ssl_session.cc".}
|
||||
{.compile: "./libs/boringssl/ssl/ssl_stat.cc".}
|
||||
{.compile: "./libs/boringssl/ssl/ssl_transcript.cc".}
|
||||
{.compile: "./libs/boringssl/ssl/ssl_versions.cc".}
|
||||
{.compile: "./libs/boringssl/ssl/ssl_x509.cc".}
|
||||
{.compile: "./libs/boringssl/ssl/t1_enc.cc".}
|
||||
{.compile: "./libs/boringssl/ssl/tls13_both.cc".}
|
||||
{.compile: "./libs/boringssl/ssl/tls13_client.cc".}
|
||||
{.compile: "./libs/boringssl/ssl/tls13_enc.cc".}
|
||||
{.compile: "./libs/boringssl/ssl/tls13_server.cc".}
|
||||
{.compile: "./libs/boringssl/ssl/tls_method.cc".}
|
||||
{.compile: "./libs/boringssl/ssl/tls_record.cc".}
|
||||
{.compile: "./libs/boringssl/decrepit/x509/x509_decrepit.cc".}
|
||||
63
build.sh
63
build.sh
@@ -1,35 +1,44 @@
|
||||
#!/bin/bash
|
||||
root=$(dirname "$0")
|
||||
sources=${root}/libs
|
||||
|
||||
# install nimterop, if not already installed
|
||||
if ! [ -x "$(command -v toast)" ]; then
|
||||
nimble install -y nimterop@2532ce0
|
||||
fi
|
||||
|
||||
# run cmake on ngtcp2 sources
|
||||
cmake -S "${root}/sources" -B "${root}/build"
|
||||
|
||||
# add prelude
|
||||
cat "${root}/prelude.nim" > "${root}/ngtcp2.nim"
|
||||
|
||||
# dividing line
|
||||
echo >> "${root}/ngtcp2.nim"
|
||||
rm -f ngtcp2.nim
|
||||
|
||||
# assemble list of C files to be compiled
|
||||
for file in `ls "${root}/sources/lib"/*.c`; do
|
||||
compile="${compile} --compile=${file}"
|
||||
toCompile=(
|
||||
# "${sources}/path/to/file.c"
|
||||
)
|
||||
|
||||
for file in `ls "${sources}/ngtcp2/crypto"/*.c`; do
|
||||
toCompile+=("$file")
|
||||
done
|
||||
for file in `ls "${sources}/ngtcp2/crypto/boringssl"/*.c`; do
|
||||
toCompile+=("$file")
|
||||
done
|
||||
for file in `ls "${sources}/ngtcp2/lib"/*.c`; do
|
||||
toCompile+=("$file")
|
||||
done
|
||||
|
||||
# generate nim wrapper with nimterop
|
||||
toast \
|
||||
$compile \
|
||||
--pnim \
|
||||
--preprocess \
|
||||
--noHeader \
|
||||
--defines=NGTCP2_STATICLIB \
|
||||
--replace=sockaddr=SockAddr,SockAddr_storage=Sockaddr_storage,socklen_t=SockLen \
|
||||
--includeDirs="${root}/sources/lib/includes" \
|
||||
--includeDirs="${root}/build/lib/includes" \
|
||||
"${root}/sources/lib/includes/ngtcp2/ngtcp2.h" >> "${root}/ngtcp2.nim"
|
||||
# futhark is required by generate_ngtcp2.nim
|
||||
nimble install futhark@0.15.0
|
||||
|
||||
sed -i 's/\bpassC\b/passc/g' ngtcp2.nim
|
||||
nim c --maxLoopIterationsVM:100000000 generate_ngtcp2.nim
|
||||
|
||||
cat "${root}/prelude.nim" > ngtcp2.nim
|
||||
|
||||
echo >> ngtcp2.nim # linebreak
|
||||
|
||||
for file in "${toCompile[@]}"; do
|
||||
echo "{.compile: \"$file\".}" >> ngtcp2.nim
|
||||
done
|
||||
|
||||
# removes absolute path prefix from comments "Generated based on"
|
||||
sed -i 's/Generated based on.*\/nim-ngtcp2\/libs\//Generated based on \/nim-ngtcp2\/libs\//g' tmp_ngtcp2.nim
|
||||
|
||||
cat tmp_ngtcp2.nim >> ngtcp2.nim
|
||||
|
||||
echo >> ngtcp2.nim # linebreak
|
||||
|
||||
cat "${root}/extras.nim" >> ngtcp2.nim
|
||||
|
||||
rm -f tmp_ngtcp2.nim
|
||||
|
||||
37
build/lib/includes/wincompat.h
Normal file
37
build/lib/includes/wincompat.h
Normal file
@@ -0,0 +1,37 @@
|
||||
#ifndef WINCOMPAT_H
|
||||
#define WINCOMPAT_H
|
||||
|
||||
#include <stdint.h>
|
||||
#define ssize_t int
|
||||
#include <Winsock2.h>
|
||||
#include <ws2tcpip.h>
|
||||
#include <malloc.h>
|
||||
|
||||
#ifndef gettimeofday
|
||||
#define gettimeofday wintimeofday
|
||||
|
||||
#ifndef __attribute__
|
||||
#define __attribute__(X)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
struct tzone {
|
||||
int tz_minuteswest; /* minutes west of Greenwich */
|
||||
int tz_dsttime; /* type of DST correction */
|
||||
};
|
||||
|
||||
int wintimeofday(struct timeval *tv, struct tzone *tz);
|
||||
|
||||
#ifndef strcasecmp
|
||||
#define strcasecmp _stricmp
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* WINCOMPAT_H */
|
||||
16
config.nims
16
config.nims
@@ -1,5 +1,11 @@
|
||||
--styleCheck:usages
|
||||
if (NimMajor, NimMinor) < (1, 6):
|
||||
--styleCheck:hint
|
||||
else:
|
||||
--styleCheck:error
|
||||
when not defined(windows):
|
||||
# use the C++ linker profile because it's a C++ library
|
||||
when defined(macosx):
|
||||
switch("clang.linkerexe", "clang++")
|
||||
else:
|
||||
switch("gcc.linkerexe", "g++")
|
||||
|
||||
--styleCheck:
|
||||
usages
|
||||
--styleCheck:
|
||||
error
|
||||
|
||||
67
diff1
Normal file
67
diff1
Normal file
@@ -0,0 +1,67 @@
|
||||
diff --git a/crypto/x509/x509name.cc b/crypto/x509/x509name.cc
|
||||
index 72c88834b..97966b518 100644
|
||||
--- a/crypto/x509/x509name.cc
|
||||
+++ b/crypto/x509/x509name.cc
|
||||
@@ -21,7 +21,7 @@
|
||||
#include <openssl/obj.h>
|
||||
#include <openssl/stack.h>
|
||||
#include <openssl/x509.h>
|
||||
-
|
||||
+#include <iostream>
|
||||
#include "../internal.h"
|
||||
#include "internal.h"
|
||||
|
||||
@@ -182,12 +182,17 @@ int X509_NAME_add_entry_by_NID(X509_NAME *name, int nid, int type,
|
||||
int X509_NAME_add_entry_by_txt(X509_NAME *name, const char *field, int type,
|
||||
const unsigned char *bytes, ossl_ssize_t len,
|
||||
int loc, int set) {
|
||||
- X509_NAME_ENTRY *ne =
|
||||
+ std::cout << "HERE" << std::endl;
|
||||
+
|
||||
+ X509_NAME_ENTRY *ne =
|
||||
X509_NAME_ENTRY_create_by_txt(NULL, field, type, bytes, len);
|
||||
if (!ne) {
|
||||
+ std::cout << "FAIL1" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
int ret = X509_NAME_add_entry(name, ne, loc, set);
|
||||
+ std::cout << "THE RET2: " << ret << std::endl;
|
||||
+
|
||||
X509_NAME_ENTRY_free(ne);
|
||||
return ret;
|
||||
}
|
||||
@@ -197,11 +202,13 @@ int X509_NAME_add_entry_by_txt(X509_NAME *name, const char *field, int type,
|
||||
int X509_NAME_add_entry(X509_NAME *name, const X509_NAME_ENTRY *entry, int loc,
|
||||
int set) {
|
||||
if (name == nullptr) {
|
||||
+ std::cout << "FAIL3" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
if (name->entries == nullptr) {
|
||||
name->entries = sk_X509_NAME_ENTRY_new_null();
|
||||
if (name->entries == nullptr) {
|
||||
+ std::cout << "FAIL4" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -238,10 +245,12 @@ int X509_NAME_add_entry(X509_NAME *name, const X509_NAME_ENTRY *entry, int loc,
|
||||
|
||||
bssl::UniquePtr<X509_NAME_ENTRY> new_entry(X509_NAME_ENTRY_dup(entry));
|
||||
if (new_entry == nullptr) {
|
||||
+ std::cout << "FAIL5" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
new_entry->set = set;
|
||||
if (!sk_X509_NAME_ENTRY_insert(sk, new_entry.get(), loc)) {
|
||||
+ std::cout << "FAIL6" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
new_entry.release(); // |sk| took ownership.
|
||||
@@ -263,6 +272,7 @@ X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_txt(X509_NAME_ENTRY **ne,
|
||||
|
||||
obj = OBJ_txt2obj(field, 0);
|
||||
if (obj == NULL) {
|
||||
+ std::cout << "FAIL2" << std::endl;
|
||||
OPENSSL_PUT_ERROR(X509, X509_R_INVALID_FIELD_NAME);
|
||||
ERR_add_error_data(2, "name=", field);
|
||||
return NULL;
|
||||
80
extras.nim
Normal file
80
extras.nim
Normal file
@@ -0,0 +1,80 @@
|
||||
when defined(ngtcp2_enable_quictls):
|
||||
# OpenSSL/QuicTLS crypto support
|
||||
# OpenSSL/QuicTLS type definitions
|
||||
type
|
||||
SSL_CTX* = pointer
|
||||
OSSL_ENCRYPTION_LEVEL* = enum
|
||||
OSSL_ENCRYPTION_LEVEL_INITIAL = 0
|
||||
OSSL_ENCRYPTION_LEVEL_EARLY_DATA = 1
|
||||
OSSL_ENCRYPTION_LEVEL_HANDSHAKE = 2
|
||||
OSSL_ENCRYPTION_LEVEL_APPLICATION = 3
|
||||
|
||||
# ngtcp2_crypto_quictls error constants
|
||||
const
|
||||
NGTCP2_CRYPTO_QUICTLS_ERR_TLS_WANT_X509_LOOKUP* = -10001
|
||||
NGTCP2_CRYPTO_QUICTLS_ERR_TLS_WANT_CLIENT_HELLO_CB* = -10002
|
||||
|
||||
# ngtcp2_crypto_quictls function bindings
|
||||
when not declared(ngtcp2_crypto_quictls_init):
|
||||
proc ngtcp2_crypto_quictls_init*(): cint {.
|
||||
cdecl, importc: "ngtcp2_crypto_quictls_init"
|
||||
.}
|
||||
|
||||
else:
|
||||
static:
|
||||
hint(
|
||||
"Declaration of " & "ngtcp2_crypto_quictls_init" &
|
||||
" already exists, not redeclaring"
|
||||
)
|
||||
|
||||
when not declared(ngtcp2_crypto_quictls_from_ossl_encryption_level):
|
||||
proc ngtcp2_crypto_quictls_from_ossl_encryption_level*(
|
||||
ossl_level: OSSL_ENCRYPTION_LEVEL
|
||||
): ngtcp2_encryption_level_553648745 {.
|
||||
cdecl, importc: "ngtcp2_crypto_quictls_from_ossl_encryption_level"
|
||||
.}
|
||||
|
||||
else:
|
||||
static:
|
||||
hint(
|
||||
"Declaration of " & "ngtcp2_crypto_quictls_from_ossl_encryption_level" &
|
||||
" already exists, not redeclaring"
|
||||
)
|
||||
|
||||
when not declared(ngtcp2_crypto_quictls_from_ngtcp2_encryption_level):
|
||||
proc ngtcp2_crypto_quictls_from_ngtcp2_encryption_level*(
|
||||
encryption_level: ngtcp2_encryption_level_553648745
|
||||
): OSSL_ENCRYPTION_LEVEL {.
|
||||
cdecl, importc: "ngtcp2_crypto_quictls_from_ngtcp2_encryption_level"
|
||||
.}
|
||||
|
||||
else:
|
||||
static:
|
||||
hint(
|
||||
"Declaration of " & "ngtcp2_crypto_quictls_from_ngtcp2_encryption_level" &
|
||||
" already exists, not redeclaring"
|
||||
)
|
||||
|
||||
when not declared(ngtcp2_crypto_quictls_configure_server_context):
|
||||
proc ngtcp2_crypto_quictls_configure_server_context*(
|
||||
ssl_ctx: SSL_CTX
|
||||
): cint {.cdecl, importc: "ngtcp2_crypto_quictls_configure_server_context".}
|
||||
|
||||
else:
|
||||
static:
|
||||
hint(
|
||||
"Declaration of " & "ngtcp2_crypto_quictls_configure_server_context" &
|
||||
" already exists, not redeclaring"
|
||||
)
|
||||
|
||||
when not declared(ngtcp2_crypto_quictls_configure_client_context):
|
||||
proc ngtcp2_crypto_quictls_configure_client_context*(
|
||||
ssl_ctx: SSL_CTX
|
||||
): cint {.cdecl, importc: "ngtcp2_crypto_quictls_configure_client_context".}
|
||||
|
||||
else:
|
||||
static:
|
||||
hint(
|
||||
"Declaration of " & "ngtcp2_crypto_quictls_configure_client_context" &
|
||||
" already exists, not redeclaring"
|
||||
)
|
||||
15
generate_ngtcp2.nim
Normal file
15
generate_ngtcp2.nim
Normal file
@@ -0,0 +1,15 @@
|
||||
import futhark
|
||||
from os import parentDir, `/`
|
||||
|
||||
importc:
|
||||
outputPath currentSourcePath.parentDir / "tmp_ngtcp2.nim"
|
||||
path currentSourcePath.parentDir / "libs/ngtcp2/lib/includes"
|
||||
path currentSourcePath.parentDir / "build/lib/includes"
|
||||
path currentSourcePath.parentDir / "libs/ngtcp2/crypto/includes"
|
||||
path currentSourcePath.parentDir / "libs/boringssl/include"
|
||||
rename FILE, CFile # Rename `FILE` that STB uses to `CFile` which is the Nim equivalent
|
||||
"ngtcp2/ngtcp2.h"
|
||||
"ngtcp2/ngtcp2_crypto.h"
|
||||
"ngtcp2/ngtcp2_crypto_boringssl.h"
|
||||
"openssl/rand.h"
|
||||
"openssl/asn1.h"
|
||||
1
libs/boringssl
Submodule
1
libs/boringssl
Submodule
Submodule libs/boringssl added at db1a845616
1
libs/ngtcp2
Submodule
1
libs/ngtcp2
Submodule
Submodule libs/ngtcp2 added at b6f2c756af
77900
ngtcp2.nim
77900
ngtcp2.nim
File diff suppressed because it is too large
Load Diff
@@ -1,9 +1,19 @@
|
||||
packageName = "ngtcp2"
|
||||
version = "0.33.0"
|
||||
version = "0.39.0"
|
||||
author = "Status Research & Development GmbH"
|
||||
description = "Nim wrapper around the ngtcp2 library"
|
||||
license = "MIT"
|
||||
installDirs = @["sources", "build"]
|
||||
installFiles = @["ngtcp2.nim"]
|
||||
installDirs = @["libs", "build"]
|
||||
installFiles = @["ngtcp2.nim", "boringssl.nim"]
|
||||
|
||||
requires "nim >= 1.6.0"
|
||||
requires "nim >= 2.0.0"
|
||||
|
||||
task format, "Format nim code using nph":
|
||||
exec "nimble install nph"
|
||||
exec "nph ."
|
||||
|
||||
task test, "Run tests":
|
||||
when defined(windows):
|
||||
exec "nim cpp -d:nimDebugDlOpen -r --threads:on tests/testNgtcp2.nim"
|
||||
else:
|
||||
exec "nim cpp -r --threads:on tests/testNgtcp2.nim"
|
||||
|
||||
32
prelude.nim
32
prelude.nim
@@ -1,17 +1,37 @@
|
||||
import os
|
||||
import strformat
|
||||
import strformat, strutils
|
||||
import ./boringssl
|
||||
|
||||
# Socket definitions
|
||||
import nativesockets
|
||||
|
||||
type ptrdiff_t* {.importc: "ptrdiff_t", header: "<stddef.h>".} = int
|
||||
|
||||
{.passc: "-DNGTCP2_STATICLIB".}
|
||||
|
||||
when defined(windows):
|
||||
{.passl: "-lws2_32".}
|
||||
{.passc: "-D_WINDOWS".}
|
||||
{.passc: "-D__CRT__NO_INLINE".}
|
||||
else:
|
||||
{.passC: "-DHAVE_UNISTD_H".}
|
||||
{.passc: "-DHAVE_UNISTD_H".}
|
||||
|
||||
# C include directories
|
||||
const root = currentSourcePath.parentDir
|
||||
const sourceInclude = root/"sources"/"lib"/"includes"
|
||||
const buildInclude = root/"build"/"lib"/"includes"
|
||||
const libIncludes = root / "build/lib/includes"
|
||||
const ngtcp2Crypto = root / "libs/ngtcp2/crypto"
|
||||
const ngtcp2CryptoIncludes = root / "libs/ngtcp2/crypto/includes"
|
||||
const ngtcp2Lib = root / "libs/ngtcp2/lib"
|
||||
const ngtcp2LibIncludes = root / "libs/ngtcp2/lib/includes"
|
||||
const boringsslInclude = root / "libs/boringssl/include"
|
||||
|
||||
{.passc: fmt"-I{sourceInclude} -I{buildInclude}".}
|
||||
{.passc: fmt"-I{libIncludes}".}
|
||||
{.passc: fmt"-I{ngtcp2Crypto}".}
|
||||
{.passc: fmt"-I{ngtcp2CryptoIncludes}".}
|
||||
{.passc: fmt"-I{ngtcp2Lib}".}
|
||||
{.passc: fmt"-I{ngtcp2LibIncludes}".}
|
||||
{.passc: fmt"-I{boringsslInclude}".}
|
||||
|
||||
when defined(ngtcp2_enable_quictls):
|
||||
# QuicTLS/OpenSSL crypto support
|
||||
{.passc: "-DNGTCP2_CRYPTO_QUICTLS".}
|
||||
{.passc: "-I/usr/include/openssl".}
|
||||
|
||||
1
sources
1
sources
Submodule sources deleted from 5f8bd54ad7
@@ -7,5 +7,30 @@ test "default settings":
|
||||
check settings.max_tx_udp_payload_size > 0
|
||||
|
||||
var transport_params: ngtcp2_transport_params
|
||||
ngtcp2_transport_params_default_versioned(NGTCP2_TRANSPORT_PARAMS_V1, addr transport_params)
|
||||
ngtcp2_transport_params_default_versioned(
|
||||
NGTCP2_TRANSPORT_PARAMS_V1, addr transport_params
|
||||
)
|
||||
check transport_params.active_connection_id_limit > 0
|
||||
|
||||
test "BoringSSL bindings":
|
||||
let
|
||||
clientMethod = TLS_client_method()
|
||||
ssl_ctx = SSL_CTX_new(clientMethod)
|
||||
ssl = SSL_new(ssl_ctx)
|
||||
|
||||
check ssl != nil
|
||||
|
||||
when defined(ngtcp2_enable_quictls):
|
||||
test "QuicTLS bindings":
|
||||
# Test error constants
|
||||
check NGTCP2_CRYPTO_QUICTLS_ERR_TLS_WANT_X509_LOOKUP == -10001
|
||||
check NGTCP2_CRYPTO_QUICTLS_ERR_TLS_WANT_CLIENT_HELLO_CB == -10002
|
||||
|
||||
# Test OSSL_ENCRYPTION_LEVEL enum values
|
||||
check ord(OSSL_ENCRYPTION_LEVEL_INITIAL) == 0
|
||||
check ord(OSSL_ENCRYPTION_LEVEL_EARLY_DATA) == 1
|
||||
check ord(OSSL_ENCRYPTION_LEVEL_HANDSHAKE) == 2
|
||||
check ord(OSSL_ENCRYPTION_LEVEL_APPLICATION) == 3
|
||||
|
||||
# Test that SSL_CTX type is properly defined as pointer
|
||||
check sizeof(SSL_CTX) == sizeof(pointer)
|
||||
|
||||
Reference in New Issue
Block a user