Skip to content

Commit

Permalink
Update constness where applicable.
Browse files Browse the repository at this point in the history
  • Loading branch information
ni4 authored and ronaldtse committed Aug 24, 2024
1 parent 7cbf84b commit ee74c34
Show file tree
Hide file tree
Showing 8 changed files with 116 additions and 116 deletions.
2 changes: 1 addition & 1 deletion src/lib/crypto/exdsa_ecdhkem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ ecdh_kem_private_key_t::get_pubkey_encoded(rnp::RNG *rng) const
rnp_result_t
ecdh_kem_public_key_t::encapsulate(rnp::RNG * rng,
std::vector<uint8_t> &ciphertext,
std::vector<uint8_t> &symmetric_key)
std::vector<uint8_t> &symmetric_key) const
{
if (curve_ == PGP_CURVE_25519) {
Botan::Curve25519_PrivateKey eph_prv_key(*(rng->obj()));
Expand Down
2 changes: 1 addition & 1 deletion src/lib/crypto/exdsa_ecdhkem.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class ecdh_kem_public_key_t : public ec_key_t {

rnp_result_t encapsulate(rnp::RNG * rng,
std::vector<uint8_t> &ciphertext,
std::vector<uint8_t> &symmetric_key);
std::vector<uint8_t> &symmetric_key) const;

private:
Botan::ECDH_PublicKey botan_key_ecdh(rnp::RNG *rng) const;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/crypto/kyber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ pgp_kyber_private_key_t::botan_key() const
}

kyber_encap_result_t
pgp_kyber_public_key_t::encapsulate(rnp::RNG *rng)
pgp_kyber_public_key_t::encapsulate(rnp::RNG *rng) const
{
assert(is_initialized_);
auto decoded_kyber_pub = botan_key();
Expand Down
2 changes: 1 addition & 1 deletion src/lib/crypto/kyber.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class pgp_kyber_public_key_t {
kyber_parameter_e mode);
pgp_kyber_public_key_t(std::vector<uint8_t> const &key_encoded, kyber_parameter_e mode);
pgp_kyber_public_key_t() = default;
kyber_encap_result_t encapsulate(rnp::RNG *rng);
kyber_encap_result_t encapsulate(rnp::RNG *rng) const;

bool
operator==(const pgp_kyber_public_key_t &rhs) const
Expand Down
4 changes: 2 additions & 2 deletions src/lib/crypto/kyber_ecdh_composite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ rnp_result_t
pgp_kyber_ecdh_composite_private_key_t::decrypt(rnp::RNG * rng,
uint8_t * out,
size_t * out_len,
const pgp_kyber_ecdh_encrypted_t *enc)
const pgp_kyber_ecdh_encrypted_t *enc) const
{
initialized_or_throw();
rnp_result_t res;
Expand Down Expand Up @@ -495,7 +495,7 @@ rnp_result_t
pgp_kyber_ecdh_composite_public_key_t::encrypt(rnp::RNG * rng,
pgp_kyber_ecdh_encrypted_t *out,
const uint8_t * session_key,
size_t session_key_len)
size_t session_key_len) const
{
initialized_or_throw();

Expand Down
4 changes: 2 additions & 2 deletions src/lib/crypto/kyber_ecdh_composite.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class pgp_kyber_ecdh_composite_private_key_t : public pgp_kyber_ecdh_composite_k
rnp_result_t decrypt(rnp::RNG * rng,
uint8_t * out,
size_t * out_len,
const pgp_kyber_ecdh_encrypted_t *enc);
const pgp_kyber_ecdh_encrypted_t *enc) const;

bool is_valid(rnp::RNG *rng) const;
std::vector<uint8_t> get_encoded() const;
Expand Down Expand Up @@ -148,7 +148,7 @@ class pgp_kyber_ecdh_composite_public_key_t : public pgp_kyber_ecdh_composite_ke
rnp_result_t encrypt(rnp::RNG * rng,
pgp_kyber_ecdh_encrypted_t *out,
const uint8_t * in,
size_t in_len);
size_t in_len) const;

bool is_valid(rnp::RNG *rng) const;
std::vector<uint8_t> get_encoded() const;
Expand Down
Loading

0 comments on commit ee74c34

Please sign in to comment.