Skip to content

Commit

Permalink
wip: hacky external crypto provider PoC
Browse files Browse the repository at this point in the history
The "hacky"ness is mostly that I've only updated the `pkg-config` based
build infra.

The main changes:

* Unconditionally using the provider in `client.c` when using the
  `AWS_LC_RS` backend define.
* Unconditionally adding `pkg-config --libs rustls-post-qunatum-ffi` to
  the pkg config Makefile.

It's assumed the user will have built + installed
`rustls-post-quantum-ffi` to the relevant pkg-config/LD_LIBRARY_PATH
locations.

This is enough to demo that the system works :)
  • Loading branch information
cpu committed Jul 16, 2024
1 parent d29400b commit 5fa63c5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Makefile.pkg-config
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ target/%.o: tests/%.c tests/common.h | target
$(CC) -o $@ -c $< $(CFLAGS) $(shell pkg-config --cflags rustls)

target/client: target/client.o target/common.o
$(CC) -o $@ $^ $(LDFLAGS) $(shell pkg-config --libs rustls)
$(CC) -o $@ $^ $(LDFLAGS) $(shell pkg-config --libs rustls) $(shell pkg-config --libs rustls-post-quantum-ffi)

target/server: target/server.o target/common.o
$(CC) -o $@ $^ $(LDFLAGS) $(shell pkg-config --libs rustls)
Expand Down
4 changes: 3 additions & 1 deletion tests/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

/* rustls.h is autogenerated in the Makefile using cbindgen. */
#include "rustls.h"
#include "rustls-post-quantum-ffi.h"
#include "common.h"

/*
Expand Down Expand Up @@ -443,7 +444,8 @@ main(int argc, const char **argv)
#endif

#if defined(DEFINE_AWS_LC_RS)
default_provider = rustls_aws_lc_rs_crypto_provider();
default_provider = (const struct rustls_crypto_provider *)
rustls_post_quantum_ffi_crypto_provider();
#elif defined(DEFINE_RING)
default_provider = rustls_ring_crypto_provider();
#else
Expand Down

0 comments on commit 5fa63c5

Please sign in to comment.