mirror of
https://github.com/vacp2p/nim-ngtcp2.git
synced 2026-01-10 13:38:21 -05:00
Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1a2f84799c | ||
|
|
e0a9b3e8f5 | ||
|
|
b158eae7a2 | ||
|
|
eb8d03a585 | ||
|
|
cbbd6f2cea | ||
|
|
f215648e99 | ||
|
|
0fea0ccc60 | ||
|
|
d397b02d8c | ||
|
|
7b50e9721f | ||
|
|
2a473ad4c6 | ||
|
|
4ae842614f | ||
|
|
a042da0724 | ||
|
|
d61584c55d | ||
|
|
82dbdd4b06 |
16
.github/workflows/test.yml
vendored
16
.github/workflows/test.yml
vendored
@@ -25,11 +25,15 @@ jobs:
|
||||
cpu: i386
|
||||
- os: linux-gcc-14
|
||||
cpu: amd64
|
||||
- os: macos
|
||||
cpu: amd64
|
||||
- os: macos-14
|
||||
cpu: arm64
|
||||
- os: windows
|
||||
cpu: amd64
|
||||
nim:
|
||||
- ref: version-1-6
|
||||
memory_management: refc
|
||||
- ref: version-2-0
|
||||
memory_management: refc
|
||||
include:
|
||||
@@ -41,6 +45,10 @@ jobs:
|
||||
os: linux-gcc-14
|
||||
builder: ubuntu-24.04
|
||||
shell: bash
|
||||
- platform:
|
||||
os: macos
|
||||
builder: macos-13
|
||||
shell: bash
|
||||
- platform:
|
||||
os: macos-14
|
||||
builder: macos-14
|
||||
@@ -82,8 +90,15 @@ jobs:
|
||||
- name: Install deps
|
||||
if: ${{ steps.deps-cache.outputs.cache-hit != 'true' }}
|
||||
run: |
|
||||
TARGET_CPU=${{ matrix.platform.cpu }}
|
||||
nimble install
|
||||
|
||||
- name: Install multilib support
|
||||
if: ${{ matrix.platform.cpu == 'i386' && contains(matrix.platform.os, 'linux') }}
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y gcc-multilib g++-multilib
|
||||
|
||||
- name: Use gcc 14
|
||||
if : ${{ matrix.platform.os == 'linux-gcc-14'}}
|
||||
run: |
|
||||
@@ -104,5 +119,6 @@ jobs:
|
||||
nimble --version
|
||||
gcc --version
|
||||
|
||||
TARGET_CPU=${{ matrix.platform.cpu }}
|
||||
NIMFLAGS="${NIMFLAGS} --mm:${{ matrix.nim.memory_management }}"
|
||||
nimble test --styleCheck:off --verbose --debug
|
||||
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,2 +0,0 @@
|
||||
!libs/
|
||||
!libs/*
|
||||
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -4,6 +4,3 @@
|
||||
[submodule "libs/aws-lc"]
|
||||
path = libs/aws-lc
|
||||
url = https://github.com/aws/aws-lc
|
||||
[submodule "libs/boringssl"]
|
||||
path = libs/boringssl
|
||||
url = https://boringssl.googlesource.com/boringssl
|
||||
|
||||
5
CMakeLists.txt
Normal file
5
CMakeLists.txt
Normal file
@@ -0,0 +1,5 @@
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
|
||||
project(PrintArch NONE)
|
||||
|
||||
message(STATUS "CMAKE_SYSTEM_PROCESSOR = ${CMAKE_SYSTEM_PROCESSOR}")
|
||||
16
README.md
16
README.md
@@ -1,25 +1,23 @@
|
||||
# ngtcp2 for Nim
|
||||
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
|
||||
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)
|
||||
- run `generate_wrapper.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`
|
||||
```
|
||||
|
||||
309
boringssl.nim
309
boringssl.nim
@@ -1,309 +0,0 @@
|
||||
# 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: "-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"
|
||||
.}
|
||||
|
||||
# ----- 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".}
|
||||
55
build_libs.sh
Executable file
55
build_libs.sh
Executable file
@@ -0,0 +1,55 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
root=$(dirname "$0")
|
||||
sources=${root}/libs
|
||||
tmpdir=$(mktemp -d)
|
||||
|
||||
force_i386=false
|
||||
|
||||
# check args
|
||||
for arg in "$@"; do
|
||||
case "$arg" in
|
||||
--i386)
|
||||
force_i386=true
|
||||
;;
|
||||
*)
|
||||
echo "unknown arg: $arg" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
cmake_args=(
|
||||
-DCMAKE_BUILD_TYPE=Release
|
||||
-DBUILD_SHARED_LIBS=OFF
|
||||
-DBUILD_TESTING=OFF
|
||||
-DFIPS=OFF
|
||||
-DBUILD_TOOL=OFF
|
||||
-DDISABLE_GO=ON
|
||||
)
|
||||
|
||||
# optionally inject i386 toolchain
|
||||
if [ "$force_i386" = true ]; then
|
||||
toolchain_file=$(mktemp)
|
||||
cat > "$toolchain_file" <<EOF
|
||||
set(CMAKE_SYSTEM_NAME Linux)
|
||||
set(CMAKE_SYSTEM_PROCESSOR i386)
|
||||
set(CMAKE_C_FLAGS "\${CMAKE_C_FLAGS} -m32")
|
||||
set(CMAKE_CXX_FLAGS "\${CMAKE_CXX_FLAGS} -m32")
|
||||
EOF
|
||||
cmake_args+=("-DCMAKE_TOOLCHAIN_FILE=$toolchain_file")
|
||||
fi
|
||||
|
||||
# build aws-lc
|
||||
echo "TEST1"
|
||||
mkdir -p ./libs/aws-lc/build
|
||||
pushd ./libs/aws-lc/build
|
||||
echo "TEST4"
|
||||
cmake ../ "${cmake_args[@]}"
|
||||
echo "TEST2"
|
||||
make
|
||||
echo "TEST3"
|
||||
popd
|
||||
cp ./libs/aws-lc/build/ssl/libssl.a ./build/.
|
||||
cp ./libs/aws-lc/build/crypto/libcrypto.a ./build/.
|
||||
@@ -7,5 +7,9 @@ when not defined(windows):
|
||||
|
||||
--styleCheck:
|
||||
usages
|
||||
--styleCheck:
|
||||
error
|
||||
if (NimMajor, NimMinor) < (1, 6):
|
||||
--styleCheck:
|
||||
hint
|
||||
else:
|
||||
--styleCheck:
|
||||
error
|
||||
|
||||
79
extras.nim
79
extras.nim
@@ -1,80 +1 @@
|
||||
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"
|
||||
)
|
||||
|
||||
@@ -5,11 +5,10 @@ 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"
|
||||
path currentSourcePath.parentDir / "libs/ngtcp2/crypto/includes/"
|
||||
path currentSourcePath.parentDir / "libs/aws-lc/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"
|
||||
"openssl/ssl.h"
|
||||
|
||||
@@ -5,9 +5,7 @@ sources=${root}/libs
|
||||
rm -f ngtcp2.nim
|
||||
|
||||
# assemble list of C files to be compiled
|
||||
toCompile=(
|
||||
# "${sources}/path/to/file.c"
|
||||
)
|
||||
toCompile=()
|
||||
|
||||
for file in `ls "${sources}/ngtcp2/crypto"/*.c`; do
|
||||
toCompile+=("$file")
|
||||
@@ -19,6 +17,13 @@ for file in `ls "${sources}/ngtcp2/lib"/*.c`; do
|
||||
toCompile+=("$file")
|
||||
done
|
||||
|
||||
# build aws-lc
|
||||
tmpdir=$(mktemp -d)
|
||||
cmake -S ./libs/aws-lc -B "$tmpdir" -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTING=OFF -DFIPS=OFF -DBUILD_TOOL=OFF -DDISABLE_GO=ON
|
||||
cmake --build "$tmpdir" --target all
|
||||
cp "$tmpdir"/ssl/libssl.a ./build/.
|
||||
cp "$tmpdir"/crypto/libcrypto.a ./build/.
|
||||
|
||||
# futhark is required by generate_ngtcp2.nim
|
||||
nimble install futhark@0.15.0
|
||||
|
||||
Submodule libs/aws-lc updated: 8ca0b29b14...8b52781470
Submodule libs/boringssl deleted from 338f44af3c
Submodule libs/ngtcp2 updated: b6f2c756af...048cdfd0c2
111119
ngtcp2.nim
111119
ngtcp2.nim
File diff suppressed because it is too large
Load Diff
@@ -1,19 +1,33 @@
|
||||
packageName = "ngtcp2"
|
||||
version = "0.39.0"
|
||||
version = "0.37.0"
|
||||
author = "Status Research & Development GmbH"
|
||||
description = "Nim wrapper around the ngtcp2 library"
|
||||
license = "MIT"
|
||||
installDirs = @["libs", "build"]
|
||||
installFiles = @["ngtcp2.nim", "boringssl.nim"]
|
||||
installFiles = @["ngtcp2.nim"]
|
||||
|
||||
requires "nim >= 2.0.0"
|
||||
requires "nim >= 1.6.0"
|
||||
|
||||
template build() =
|
||||
when defined(windows):
|
||||
exec "./build_libs.sh"
|
||||
else:
|
||||
let targetCpu = getEnv("TARGET_CPU", hostCPU)
|
||||
if targetCpu == "i386":
|
||||
exec "./build_libs.sh --i386"
|
||||
else:
|
||||
exec "./build_libs.sh"
|
||||
|
||||
before install:
|
||||
build()
|
||||
|
||||
task format, "Format nim code using nph":
|
||||
exec "nimble install nph"
|
||||
exec "nph ."
|
||||
|
||||
task test, "Run tests":
|
||||
build()
|
||||
when defined(windows):
|
||||
exec "nim cpp -d:nimDebugDlOpen -r --threads:on tests/testNgtcp2.nim"
|
||||
exec "nim c -d:nimDebugDlOpen -r --threads:on tests/testNgtcp2.nim"
|
||||
else:
|
||||
exec "nim cpp -r --threads:on tests/testNgtcp2.nim"
|
||||
exec "nim c -r --threads:on tests/testNgtcp2.nim"
|
||||
|
||||
32
prelude.nim
32
prelude.nim
@@ -1,10 +1,21 @@
|
||||
import os
|
||||
import strformat, strutils
|
||||
import ./boringssl
|
||||
|
||||
# Socket definitions
|
||||
import nativesockets
|
||||
|
||||
when defined(windows):
|
||||
# TODO: test this
|
||||
{.push importc, cdecl, dynlib: "libcrypto.dll".}
|
||||
{.push importc, cdecl, dynlib: "libssl.dll".}
|
||||
else:
|
||||
const
|
||||
topLevelPath = currentSourcePath.parentDir()
|
||||
libsDir = topLevelPath.replace('\\', '/') & "/build/"
|
||||
|
||||
{.passl: libsDir & "/libssl.a".}
|
||||
{.passl: libsDir & "/libcrypto.a".}
|
||||
|
||||
{.passc: "-DNGTCP2_STATICLIB".}
|
||||
|
||||
when defined(windows):
|
||||
@@ -15,21 +26,16 @@ else:
|
||||
{.passc: "-DHAVE_UNISTD_H".}
|
||||
|
||||
const root = currentSourcePath.parentDir
|
||||
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"
|
||||
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 awsLcInclude = root / "libs" / "aws-lc" / "include"
|
||||
|
||||
{.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".}
|
||||
{.passc: fmt"-I{awsLcInclude}".}
|
||||
|
||||
@@ -12,25 +12,10 @@ test "default settings":
|
||||
)
|
||||
check transport_params.active_connection_id_limit > 0
|
||||
|
||||
test "AWS-LC bindings":
|
||||
test "boringssl_instantiation":
|
||||
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