Skip to content

Commit bdf1d21

Browse files
committed
Get rid of strlen
1 parent ad09eed commit bdf1d21

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

lib/hpke/src/hybrid_kem.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,10 +215,10 @@ HybridKEM::c2pri_combiner(const bytes& ss_pq,
215215
const bytes& ss_t,
216216
const bytes& ct_t,
217217
const bytes& ek_t,
218-
const char* label) const
218+
const std::string& label) const
219219
{
220220
static const auto kdf = Digest::get<Digest::ID::SHA3_256>();
221-
const auto label_bytes = std::vector<uint8_t>(label, label + strlen(label));
221+
const auto label_bytes = from_ascii(label);
222222
return kdf.hash(ss_pq + ss_t + ct_t + ek_t + label_bytes);
223223
}
224224

lib/hpke/src/hybrid_kem.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
#include "group.h"
77
#include "mlkem.h"
88

9+
#include <string>
10+
911
namespace MLS_NAMESPACE::hpke {
1012

1113
struct HybridKEM : public KEM
@@ -63,7 +65,7 @@ struct HybridKEM : public KEM
6365
const bytes& ss_t,
6466
const bytes& ct_t,
6567
const bytes& ek_t,
66-
const char* label) const;
68+
const std::string& label) const;
6769

6870
HybridKEM(KEM::ID kem_id_in, const MLKEM& mlkem_in, const Group& group_in);
6971
friend HybridKEM make_hybrid_kem(KEM::ID kem_id_in,

0 commit comments

Comments
 (0)