Skip to content

Commit

Permalink
clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
bifurcation committed Sep 12, 2023
1 parent f45798d commit 18735f9
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 24 deletions.
11 changes: 6 additions & 5 deletions lib/hpke/src/signature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,13 +285,14 @@ static const Signature&
sig_from_jwk(const std::string& jwk_json)
{
using KeyTypeAndCurve = std::tuple<std::string, std::string>;
static const auto alg_sig_map = std::map<KeyTypeAndCurve, const Signature&>{
static const auto alg_sig_map = std::map<KeyTypeAndCurve, const Signature&>
{
{ { "EC", "P-256" }, Signature::get<Signature::ID::P256_SHA256>() },
{ { "EC", "P-384" }, Signature::get<Signature::ID::P384_SHA384>() },
{ { "EC", "P-512" }, Signature::get<Signature::ID::P521_SHA512>() },
{ { "OKP", "Ed25519" }, Signature::get<Signature::ID::Ed25519>() },
{ { "EC", "P-384" }, Signature::get<Signature::ID::P384_SHA384>() },
{ { "EC", "P-512" }, Signature::get<Signature::ID::P521_SHA512>() },
{ { "OKP", "Ed25519" }, Signature::get<Signature::ID::Ed25519>() },
#if !defined(WITH_BORINGSSL)
{ { "OKP", "Ed448" }, Signature::get<Signature::ID::Ed448>() },
{ { "OKP", "Ed448" }, Signature::get<Signature::ID::Ed448>() },
#endif
// TODO(RLB): RSA
};
Expand Down
17 changes: 9 additions & 8 deletions lib/hpke/src/userinfo_vc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,18 @@ get_optional(const json& json_object, const std::string& field_name)
static const Signature&
signature_from_alg(const std::string& alg)
{
static const auto alg_sig_map = std::map<std::string, const Signature&>{
static const auto alg_sig_map = std::map<std::string, const Signature&>
{
{ "ES256", Signature::get<Signature::ID::P256_SHA256>() },
{ "ES384", Signature::get<Signature::ID::P384_SHA384>() },
{ "ES512", Signature::get<Signature::ID::P521_SHA512>() },
{ "Ed25519", Signature::get<Signature::ID::Ed25519>() },
{ "ES384", Signature::get<Signature::ID::P384_SHA384>() },
{ "ES512", Signature::get<Signature::ID::P521_SHA512>() },
{ "Ed25519", Signature::get<Signature::ID::Ed25519>() },
#if !defined(WITH_BORINGSSL)
{ "Ed448", Signature::get<Signature::ID::Ed448>() },
{ "Ed448", Signature::get<Signature::ID::Ed448>() },
#endif
{ "RS256", Signature::get<Signature::ID::RSA_SHA256>() },
{ "RS384", Signature::get<Signature::ID::RSA_SHA384>() },
{ "RS512", Signature::get<Signature::ID::RSA_SHA512>() },
{ "RS256", Signature::get<Signature::ID::RSA_SHA256>() },
{ "RS384", Signature::get<Signature::ID::RSA_SHA384>() },
{ "RS512", Signature::get<Signature::ID::RSA_SHA512>() },
};

return alg_sig_map.at(alg);
Expand Down
7 changes: 4 additions & 3 deletions lib/hpke/test/signature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,11 +273,12 @@ TEST_CASE("Signature Round-Trip")
TEST_CASE("Signature Key JWK Round-Trip")
{
ensure_fips_if_required();
const std::vector<Signature::ID> ids{
const std::vector<Signature::ID> ids
{
Signature::ID::P256_SHA256, Signature::ID::P384_SHA384,
Signature::ID::P521_SHA512, Signature::ID::Ed25519,
Signature::ID::P521_SHA512, Signature::ID::Ed25519,
#if !defined(WITH_BORINGSSL)
Signature::ID::Ed448,
Signature::ID::Ed448,
#endif
};

Expand Down
13 changes: 7 additions & 6 deletions lib/mls_vectors/test/mls_vectors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@

using namespace mls_vectors;

static const std::vector<MLS_NAMESPACE::CipherSuite> supported_suites{
static const std::vector<MLS_NAMESPACE::CipherSuite> supported_suites
{
{ MLS_NAMESPACE::CipherSuite::ID::X25519_AES128GCM_SHA256_Ed25519 },
{ MLS_NAMESPACE::CipherSuite::ID::P256_AES128GCM_SHA256_P256 },
{ MLS_NAMESPACE::CipherSuite::ID::X25519_CHACHA20POLY1305_SHA256_Ed25519 },
{ MLS_NAMESPACE::CipherSuite::ID::P521_AES256GCM_SHA512_P521 },
{ MLS_NAMESPACE::CipherSuite::ID::P256_AES128GCM_SHA256_P256 },
{ MLS_NAMESPACE::CipherSuite::ID::X25519_CHACHA20POLY1305_SHA256_Ed25519 },
{ MLS_NAMESPACE::CipherSuite::ID::P521_AES256GCM_SHA512_P521 },
#if !defined(WITH_BORINGSSL)
{ MLS_NAMESPACE::CipherSuite::ID::X448_AES256GCM_SHA512_Ed448 },
{ MLS_NAMESPACE::CipherSuite::ID::X448_CHACHA20POLY1305_SHA512_Ed448 },
{ MLS_NAMESPACE::CipherSuite::ID::X448_AES256GCM_SHA512_Ed448 },
{ MLS_NAMESPACE::CipherSuite::ID::X448_CHACHA20POLY1305_SHA512_Ed448 },
#endif
};

Expand Down
6 changes: 4 additions & 2 deletions test/session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,8 @@ TEST_CASE_FIXTURE(RunningSessionTest, "Full Session Life-Cycle")
// XXX(RLB) BoringSSL rejects the leaf certificate here with the following error
// code:
//
// error:0b00008b:X.509 certificate routines:OPENSSL_internal:INVALID_FIELD_FOR_VERSION
// error:0b00008b:X.509 certificate
// routines:OPENSSL_internal:INVALID_FIELD_FOR_VERSION
//
// I have disabled the test for now, but given that the BoringSSL maintainers
// know what they're doing, there's probably a legitimate issue here and we
Expand All @@ -237,7 +238,8 @@ TEST_CASE_FIXTURE(RunningSessionTest, "Full Session Life-Cycle")
// I think we generated these with Go!) So the solution appears to be
// regenerating with an explicit version field set to v3.
//
// [1] https://boringssl.googlesource.com/boringssl.git/+/dd86e75b24dcfd47d4ee6b3e4cdce907389335b2%5E%21/
// [1]
// https://boringssl.googlesource.com/boringssl.git/+/dd86e75b24dcfd47d4ee6b3e4cdce907389335b2%5E%21/
#if !defined(WITH_BORINGSSL)
TEST_CASE("Session with X509 Credential")
{
Expand Down

0 comments on commit 18735f9

Please sign in to comment.