Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BOUNTY] Explore OpenSSL support in the TLS security transport #7150

Open
Stebalien opened this issue Apr 13, 2020 · 7 comments
Open

[BOUNTY] Explore OpenSSL support in the TLS security transport #7150

Stebalien opened this issue Apr 13, 2020 · 7 comments
Labels
bounty Has bounty! See https://github.com/ipfs/devgrants/projects/1 epic kind/enhancement A net-new feature or improvement to an existing feature

Comments

@Stebalien
Copy link
Member

Stebalien commented Apr 13, 2020

The need in brief

Currently, the SECIO transport supports using OpenSSL for the RSA . This can significantly improve performance as OpenSSL is highly optimized.

Now that we're switching to TLS, it would be nice to explore OpenSSL support in go-libp2p-tls.

Deliverable

  1. A feature in go-libp2p-tls transport that enables OpenSSL support using go-openssl (behind an "openssl" build flag). See tls: support OpenSSL libp2p/go-libp2p#1539.
  2. Any additional unit tests needed to ensure that this feature actually works.
  3. Testground benchmarks comparing the OpenSSL implementation and the Go TLS implementation. Specifically, the benchmarks must compare:
    • Handshake latency.
    • Handshake throughput (how many handshakes can we complete in N second).
    • Connection latency (ping time).
    • Connection throughput.

Requirements

  • This feature must be interoperable with go-libp2p's and rust-libp2p's current TLS transports.
  • This feature must implement the libp2p TLS handshake as defined in the spec.

Non-requirement: While the described feature should be as fast as possible, it may not have higher overall throughput than go's built in TLS implementation, due to CGO overhead. If that turns out to be the case, but it looks like OpenSSL's handshake throughput is significantly higher than Go's, we may create an additional bounty to use OpenSSL for the handshake only.

Guidelines

  • Please use the IPFS Go Contributing Guidelines as your north star — adherence to these guidelines are crucial when it comes to awarding a potential bounty!
  • Please DO NOT bundle a general code refactor with the completion of this bounty!
@Stebalien Stebalien added kind/enhancement A net-new feature or improvement to an existing feature epic bounty Has bounty! See https://github.com/ipfs/devgrants/projects/1 labels Apr 13, 2020
@RubenKelevra
Copy link
Contributor

One might argue, that OpenSSL is quite a 'fat' library with a lot of code for compability reasons and without a good security record.

Libsodum might be a better alternative to look into. It's well maintained, actively developed by cryptographers, is portable but also highly optimized and is one order of magnitude smaller than OpenSSL.

It's also the reference implementation of Curve25519, ChaCha and Salsa20 - which we both probably ending up using anyway.

@Stebalien
Copy link
Member Author

OpenSSL has wide support on many platforms and has now received quite a bit of attention from the security community. Libsodium support would also be welcome but should be tackled independently.

@RubenKelevra
Copy link
Contributor

RubenKelevra commented Apr 21, 2020

I think the most compelling argument for using libsodium is, the ability to use salsa2012 (salsa with just 12 rounds instead of 20). This allows getting quite decent performance even on embedded systems - like routers.

Just a number off my head - A 74K MIPS32 with ~540 MHz does around 22 MBit/s with salsa2012 and umac - while aes128 with gcm does 4 MBit/s.

@Stebalien
Copy link
Member Author

@RubenKelevra please open a new issue for new feature requests.

@Geo25rey
Copy link

@Stebalien Just to confirm, a small amount of work if any is required on go-ipfs itself, but libp2p/go-libp2p-tls needs to be worked on? All I could imagine changing in go-ipfs is in the Makefile by adding the "openssl" tag.

@Stebalien
Copy link
Member Author

Nothing is required in go-ipfs, as far as I know. As long as building go-ipfs with GOTAGS=openssl causes TLS to use openssl internally, this is fixed.

@Geo25rey
Copy link

Alrighty. Here's a bit of a status update. I've taken over libp2p/go-libp2p-tls#67 and currently have a draft PR opened (libp2p/go-libp2p-tls#71) appending to @balajijinnah's work. Before that can get merged, libp2p/go-openssl#13 needs to get merged to conform to the libp2p spec. I'm also working on adding tests in libp2p/go-libp2p-tls#71, but it's hard to tell if tests fail due to not using TLS 1.3 or if there are bugs in the PR itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bounty Has bounty! See https://github.com/ipfs/devgrants/projects/1 epic kind/enhancement A net-new feature or improvement to an existing feature
Projects
None yet
Development

No branches or pull requests

3 participants