Skip to content

Commit 6df5dcb

Browse files
authored
Merge pull request #46 from Bilb/fix-cpp-check-vector
chore: make cppcheck happy in ed25519 sign
2 parents 95b9fe7 + 4f79933 commit 6df5dcb

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/ed25519.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,14 @@ std::vector<unsigned char> sign(
6363
throw std::invalid_argument{"Invalid ed25519_privkey: expected 32 or 64 bytes"};
6464
}
6565

66-
std::array<unsigned char, 64> sig;
66+
std::vector<unsigned char> sig;
67+
sig.resize(64);
68+
6769
if (0 != crypto_sign_ed25519_detached(
6870
sig.data(), nullptr, msg.data(), msg.size(), ed25519_privkey.data()))
6971
throw std::runtime_error{"Failed to sign; perhaps the secret key is invalid?"};
7072

71-
return {sig.data(), sig.data() + sig.size()};
73+
return sig;
7274
}
7375

7476
bool verify(

0 commit comments

Comments
 (0)