Skip to content

Commit

Permalink
ech: Remove fizz::ech::getRecordDigest
Browse files Browse the repository at this point in the history
Summary:
Nothing uses this function, and this function puts a dependency on a concrete
backend (OpenSSL).

Reviewed By: zalecodez

Differential Revision: D62219043

fbshipit-source-id: 9f2fe44571e3e9ebcf586c0a1b69f52921cdb68d
  • Loading branch information
Mingtao Yang authored and facebook-github-bot committed Sep 5, 2024
1 parent 5fd2ea6 commit 0b91393
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 36 deletions.
1 change: 0 additions & 1 deletion fizz/protocol/ech/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ cpp_library(
"Encryption.h",
],
deps = [
"//fizz/backend:openssl",
"//fizz/crypto/hpke:utils",
"//fizz/protocol:protocol",
"//fizz/record:record",
Expand Down
31 changes: 0 additions & 31 deletions fizz/protocol/ech/Encryption.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include <fizz/protocol/ech/Encryption.h>
#include "fizz/record/Types.h"

#include <fizz/backend/openssl/OpenSSL.h>
#include <fizz/crypto/hpke/Utils.h>
#include <fizz/protocol/Protocol.h>
#include <fizz/protocol/ech/ECHExtensions.h>
Expand Down Expand Up @@ -208,36 +207,6 @@ static hpke::SetupParam getSetupParam(
0};
}

std::unique_ptr<folly::IOBuf> getRecordDigest(
const ECHConfig& echConfig,
hpke::KDFId id) {
switch (id) {
case hpke::KDFId::Sha256: {
std::array<uint8_t, fizz::Sha256::HashLen> recordDigest;
fizz::openssl::Hasher<Sha256>::hash(
*encode(echConfig),
folly::MutableByteRange(recordDigest.data(), recordDigest.size()));
return folly::IOBuf::copyBuffer(recordDigest);
}
case hpke::KDFId::Sha384: {
std::array<uint8_t, fizz::Sha384::HashLen> recordDigest;
fizz::openssl::Hasher<Sha384>::hash(
*encode(echConfig),
folly::MutableByteRange(recordDigest.data(), recordDigest.size()));
return folly::IOBuf::copyBuffer(recordDigest);
}
case hpke::KDFId::Sha512: {
std::array<uint8_t, fizz::Sha512::HashLen> recordDigest;
fizz::openssl::Hasher<Sha512>::hash(
*encode(echConfig),
folly::MutableByteRange(recordDigest.data(), recordDigest.size()));
return folly::IOBuf::copyBuffer(recordDigest);
}
default:
throw std::runtime_error("kdf: not implemented");
}
}

hpke::SetupResult constructHpkeSetupResult(
std::unique_ptr<KeyExchange> kex,
const SupportedECHConfig& supportedConfig) {
Expand Down
4 changes: 0 additions & 4 deletions fizz/protocol/ech/Encryption.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,6 @@ std::unique_ptr<hpke::HpkeContext> setupDecryptionContext(
std::unique_ptr<KeyExchange> kex,
uint64_t seqNum);

std::unique_ptr<folly::IOBuf> getRecordDigest(
const ECHConfig& echConfig,
hpke::KDFId id);

std::vector<Extension> substituteOuterExtensions(
std::vector<Extension>&& innerExt,
const std::vector<Extension>& outerExt);
Expand Down

0 comments on commit 0b91393

Please sign in to comment.