Skip to content

Commit

Permalink
Wire up fizz::DefaultFactory to compile time setting
Browse files Browse the repository at this point in the history
Summary:
`fizz::DefaultFactory` is intended to be a type alias to a compile time
configured instance of the Factory implementation. Several internal Fizz
components (e.g. such as HPKE) may need to create an instance of a Hasher
or an instance of a KeyExchange, so they use fizz::DefaultFactory().

Reviewed By: zalecodez

Differential Revision: D61241067

fbshipit-source-id: 382b39f5be465d2ef234e7d0432d0a53728cc802
  • Loading branch information
Mingtao Yang authored and facebook-github-bot committed Aug 19, 2024
1 parent 6a872c3 commit 2c5b748
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
3 changes: 3 additions & 0 deletions fizz/fizz-config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@
#cmakedefine01 FIZZ_HAVE_LIBAEGIS
#cmakedefine01 FIZZ_CERTIFICATE_USE_OPENSSL_CERT
#cmakedefine01 FIZZ_HAVE_OQS

#define FIZZ_DEFAULT_FACTORY_HEADER <fizz/protocol/MultiBackendFactory.h>
#define FIZZ_DEFAULT_FACTORY ::fizz::MultiBackendFactory
3 changes: 2 additions & 1 deletion fizz/protocol/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ cpp_library(
"DefaultFactory.h",
],
exported_deps = [
":multi_backend_factory",
":multi_backend_factory", #@manual
"//fizz:config",
],
)

Expand Down
9 changes: 4 additions & 5 deletions fizz/protocol/DefaultFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,16 @@

#pragma once

#include <fizz/protocol/MultiBackendFactory.h>
#include <fizz/fizz-config.h>

namespace fizz {

// TODO: This needs to be wired up from fizz-config.h
#include FIZZ_DEFAULT_FACTORY_HEADER

namespace fizz {
/**
* DefaultFactory is a type alias that points to a concrete, non-abstract
* Factory instance that can be used by various internal components of Fizz
* to get the "default compile time configured" Factory.
*/
using DefaultFactory = ::fizz::MultiBackendFactory;
using DefaultFactory = FIZZ_DEFAULT_FACTORY;

} // namespace fizz

0 comments on commit 2c5b748

Please sign in to comment.