Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/chainparamsbase.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#include <memory>
#include <string>
#include <cstdint>

class ArgsManager;

Expand Down
1 change: 1 addition & 0 deletions src/node/interface_ui.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <functional>
#include <memory>
#include <string>
#include <cstdint>

class CBlockIndex;
enum class SynchronizationState;
Expand Down
2 changes: 1 addition & 1 deletion src/rpc/mnemonic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ static RPCHelpMan mnemonicrpc()
RPCResult{RPCResult::Type::ANY, "", ""},
RPCExamples{
HelpExampleCli("mnemonic", "\"new\" \"my pass phrase\" french 64 true") +
HelpExampleRpc("smsgpurge", "\"new\", \"my pass phrase\", french, 64, true")
HelpExampleRpc("mnemonic", "\"new\", \"my pass phrase\", french, 64, true")
},
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
{
Expand Down
2 changes: 1 addition & 1 deletion src/smsg/crypter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <stdint.h>


bool SecMsgCrypter::SetKey(const std::vector<uint8_t> &vchNewKey, const uint8_t *chNewIV)
bool SecMsgCrypter::SetKey(const std::vector<uint8_t, secure_allocator<unsigned char>> &vchNewKey, const uint8_t *chNewIV)
{
if (vchNewKey.size() != SMSG_CRYPTO_KEY_SIZE) {
return false;
Expand Down
2 changes: 1 addition & 1 deletion src/smsg/crypter.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class SecMsgCrypter
fKeySet = false;
}

bool SetKey(const std::vector<uint8_t> &vchNewKey, const uint8_t *chNewIV);
bool SetKey(const std::vector<uint8_t, secure_allocator<unsigned char>> &vchNewKey, const uint8_t *chNewIV);
bool SetKey(const uint8_t *chNewKey, const uint8_t *chNewIV);
bool Encrypt(const uint8_t *chPlaintext, uint32_t nPlain, std::vector<uint8_t> &vchCiphertext);
bool Decrypt(const uint8_t *chCiphertext, uint32_t nCipher, std::vector<uint8_t> &vchPlaintext);
Expand Down
13 changes: 13 additions & 0 deletions src/smsg/rpcsmessage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2596,8 +2596,21 @@ static RPCHelpMan smsgimport()
}

std::vector<uint8_t> vsmsg = ParseHex(str_msg.c_str());
if (vsmsg.size() < smsg::SMSG_HDR_LEN) {
throw JSONRPCError(RPC_INVALID_PARAMETER, "msg too short");
}

smsg::SecureMessage smsg(vsmsg.data());
smsg.pPayload = vsmsg.data() + smsg::SMSG_HDR_LEN;
if (smsg.nPayload < smsg::SMSG_MIN_CIPERTEXT_SIZE) {
throw JSONRPCError(RPC_INVALID_PARAMETER, "Smsg payload size too low");
}
if (smsg.nPayload > smsg::SMSG_MAX_MSG_WORST_PAID) {
throw JSONRPCError(RPC_INVALID_PARAMETER, "Smsg payload size too high");
}
if (smsg.nPayload != vsmsg.size() - smsg::SMSG_HDR_LEN) {
throw JSONRPCError(RPC_INVALID_PARAMETER, "Mismatched smsg payload size");
}

UniValue result(UniValue::VOBJ);
std::string str_error;
Expand Down
5 changes: 5 additions & 0 deletions src/smsg/securemessage.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ class SecureMessage
return version[0] == 3;
}

bool IsPurged() const
{
return version[0] == 0 && version[1] == 0;
}

void set(const uint8_t *data)
{
size_t ofs = 0;
Expand Down
Loading
Loading