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

Add openssl support in transport module with some enhancement and bug fix #4

Closed
wants to merge 5 commits into from

Conversation

csyJoy
Copy link
Contributor

@csyJoy csyJoy commented Sep 26, 2024

This pr contain three things:

  1. Fix bug in AutoEvidence which cause incomplete TEE detect.
  2. Add tls support using openssl in transport module.
  3. Create x509 certificate manually to pass openssl cert pre-verification.
  4. Add tls echo client and echo server exmpale.

…m dice

Only return Err after attempting all TEEs
feat(tls): add openssl transport module (WIP)

1. apply Builder patten while constructing TLS Client and Server.
2. implement `send` `shutdown` `receive` interface for TLS Client
and
Server.
3. implement `negotiation` interface for TLS Client and Server
with
default openssl verify callback.

TODO:
1. (maybe) use typestate pattern to staticly protect Client and
Server
building procedure.
2. support openssl error handling.
3. corner case check before calling bindgen openssl api.
4. unit test for Client and Server function.

fix(tls-client): use `OPENSSL_EX_DATA_IDX` define in `mod.rs`

fix(tls-init): add custom init function with missing options for
the `init` function in `openssl-sys`

feat(tls): use a more generic way to handle stream

Add GetFd trait, replace TcpStream with trait object impl GetFd

fix(tls): fix some bugs cause rust borrow checker error and FFI
call error

feat(tls): replace raw option number with bitflag

feat(tls): support P256

test(tls): add some unit tests

1. openssl init
2. use private key
3. use cert

fix(tls-client): fix incorrect SSL function call

feat(tls-init): only init once `ossl_init` by `sync::once`

fix(tls): implement default openssl verify callback correctly
using rats-rs APIs

use `CertVerifier` to verify cert instead of implementing it
manually

refactor(tls): code refactor (see full log)

1. expose some functions to pub or pub(crate)
2. refactor code in a more rust way
3. remove unused code
4. implement `with_tcp_steam` as its name implies
5. merge imports

feat(tls): support mutual client server

test(tls): remove duplicated init
…ication

The only difference between the current certificate content and
the previously generated Root certificate content is the addition
of Certificate Sign to the KeyUsage Extension.
TODO:
1. mutual client and server
2. more command options

feat(tls-example): add `attest_self` and `verify_peer` in tls example
1. add comment to `ossl_init` referring to rats-tls repository
2. inline `init` method of `Client` and `Server` to each
Builders' method, remove unused Option
3. remove `Arc<Mutex<Cell<>>` wrapper for openssl CRYPTO index
since it never change after initialized
4. move `GetFdDumpImpl` to test module as a stream mock
@imlk0 imlk0 closed this Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants