From a85c4ce535c940bd2f48c34ab823fb3a8f5be0cc Mon Sep 17 00:00:00 2001 From: Jade Lovelace Date: Sun, 4 Aug 2024 22:03:35 -0700 Subject: tree-wide: automated migration to charptr_cast The lint did it :3 Change-Id: I2d9f276b01ebbf14101de4257ea13e44ff6fe0a0 --- src/libstore/crypto.cc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/libstore/crypto.cc') diff --git a/src/libstore/crypto.cc b/src/libstore/crypto.cc index e8ab15537..6f4a36735 100644 --- a/src/libstore/crypto.cc +++ b/src/libstore/crypto.cc @@ -1,3 +1,4 @@ +#include "charptr-cast.hh" #include "crypto.hh" #include "file-system.hh" #include "globals.hh" @@ -44,15 +45,15 @@ std::string SecretKey::signDetached(std::string_view data) const { unsigned char sig[crypto_sign_BYTES]; unsigned long long sigLen; - crypto_sign_detached(sig, &sigLen, reinterpret_cast(data.data()), data.size(), - reinterpret_cast(key.data())); + crypto_sign_detached(sig, &sigLen, charptr_cast(data.data()), data.size(), + charptr_cast(key.data())); return name + ":" + base64Encode(std::string(reinterpret_cast(sig), sigLen)); } PublicKey SecretKey::toPublicKey() const { unsigned char pk[crypto_sign_PUBLICKEYBYTES]; - crypto_sign_ed25519_sk_to_pk(pk, reinterpret_cast(key.data())); + crypto_sign_ed25519_sk_to_pk(pk, charptr_cast(key.data())); return PublicKey(name, std::string(reinterpret_cast(pk), crypto_sign_PUBLICKEYBYTES)); } @@ -85,9 +86,9 @@ bool verifyDetached(const std::string & data, const std::string & sig, if (sig2.size() != crypto_sign_BYTES) throw Error("signature is not valid"); - return crypto_sign_verify_detached(reinterpret_cast(sig2.data()), - reinterpret_cast(data.data()), data.size(), - reinterpret_cast(key->second.key.data())) == 0; + return crypto_sign_verify_detached(charptr_cast(sig2.data()), + charptr_cast(data.data()), data.size(), + charptr_cast(key->second.key.data())) == 0; } PublicKeys getDefaultPublicKeys() -- cgit v1.2.3