Skip to content

Commit

Permalink
Fizz command line testing for aegis
Browse files Browse the repository at this point in the history
Summary: - Update Fizz server and client command line testing to support negotiating aegis cipher

Reviewed By: AjanthanAsogamoorthy, mingtaoy

Differential Revision: D45495189

fbshipit-source-id: 4a5e3c81b3cc590625b179b3ad5f011650621f87
  • Loading branch information
Huilin Chen authored and facebook-github-bot committed May 19, 2023
1 parent e28fb59 commit 49ac348
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
11 changes: 11 additions & 0 deletions fizz/protocol/Factory.h
Expand Up @@ -8,6 +8,11 @@

#pragma once

#include <fizz/fizz-config.h>
#if FIZZ_HAS_AEGIS
#include <fizz/crypto/aead/AEGISCipher.h>
#endif

#include <fizz/crypto/RandomGenerator.h>
#include <fizz/crypto/aead/AESGCM128.h>
#include <fizz/crypto/aead/AESGCM256.h>
Expand Down Expand Up @@ -95,6 +100,12 @@ class Factory {
return OpenSSLEVPCipher::makeCipher<AESGCM256>();
case CipherSuite::TLS_AES_128_OCB_SHA256_EXPERIMENTAL:
return OpenSSLEVPCipher::makeCipher<AESOCB128>();
#if FIZZ_HAS_AEGIS
case CipherSuite::TLS_AEGIS_128L_SHA256_EXPERIMENTAL:
return AEGISCipher::make128L();
case CipherSuite::TLS_AEGIS_256_SHA384_EXPERIMENTAL:
return AEGISCipher::make256();
#endif
default:
throw std::runtime_error("aead: not implemented");
}
Expand Down
4 changes: 4 additions & 0 deletions fizz/protocol/OpenSSLFactory.h
Expand Up @@ -22,8 +22,10 @@ class OpenSSLFactory : public Factory {
case CipherSuite::TLS_CHACHA20_POLY1305_SHA256:
case CipherSuite::TLS_AES_128_GCM_SHA256:
case CipherSuite::TLS_AES_128_OCB_SHA256_EXPERIMENTAL:
case CipherSuite::TLS_AEGIS_128L_SHA256_EXPERIMENTAL:
return KeyDerivationImpl::make<Sha256>(getHkdfPrefix());
case CipherSuite::TLS_AES_256_GCM_SHA384:
case CipherSuite::TLS_AEGIS_256_SHA384_EXPERIMENTAL:
return KeyDerivationImpl::make<Sha384>(getHkdfPrefix());
default:
throw std::runtime_error("ks: not implemented");
Expand All @@ -36,8 +38,10 @@ class OpenSSLFactory : public Factory {
case CipherSuite::TLS_CHACHA20_POLY1305_SHA256:
case CipherSuite::TLS_AES_128_GCM_SHA256:
case CipherSuite::TLS_AES_128_OCB_SHA256_EXPERIMENTAL:
case CipherSuite::TLS_AEGIS_128L_SHA256_EXPERIMENTAL:
return std::make_unique<HandshakeContextImpl<Sha256>>(getHkdfPrefix());
case CipherSuite::TLS_AES_256_GCM_SHA384:
case CipherSuite::TLS_AEGIS_256_SHA384_EXPERIMENTAL:
return std::make_unique<HandshakeContextImpl<Sha384>>(getHkdfPrefix());
default:
throw std::runtime_error("hs: not implemented");
Expand Down
6 changes: 5 additions & 1 deletion fizz/util/Parse-inl.h
Expand Up @@ -18,7 +18,11 @@ inline CipherSuite parse(folly::StringPiece s) {
{"TLS_CHACHA20_POLY1305_SHA256",
CipherSuite::TLS_CHACHA20_POLY1305_SHA256},
{"TLS_AES_128_OCB_SHA256_EXPERIMENTAL",
CipherSuite::TLS_AES_128_OCB_SHA256_EXPERIMENTAL}};
CipherSuite::TLS_AES_128_OCB_SHA256_EXPERIMENTAL},
{"TLS_AEGIS_128L_SHA256_EXPERIMENTAL",
CipherSuite::TLS_AEGIS_128L_SHA256_EXPERIMENTAL},
{"TLS_AEGIS_256_SHA384_EXPERIMENTAL",
CipherSuite::TLS_AEGIS_256_SHA384_EXPERIMENTAL}};

auto location = stringToCiphers.find(s);
if (location != stringToCiphers.end()) {
Expand Down

0 comments on commit 49ac348

Please sign in to comment.