summaryrefslogtreecommitdiff
path: root/Source/Core/Common/Crypto/ec.cpp
diff options
context:
space:
mode:
authorLéo Lam <leo@innovatetechnologi.es>2018-05-27 14:17:28 +0200
committerGitHub <noreply@github.com>2018-05-27 14:17:28 +0200
commit3798127cf7c0ed59c01d857668e3ce4e90cf259b (patch)
tree82ef5f2295ffe0823118dfd56e8289d962fb0d61 /Source/Core/Common/Crypto/ec.cpp
parent5de2f960a1179fe32de4f93721faa5734497f949 (diff)
parentbea1e38c674485d5df6a4266f9bb54e46d39d9e6 (diff)
Merge pull request #6926 from leoetlino/hardcoded-numbers
IOSC: Remove some hardcoded offsets and magic numbers
Diffstat (limited to 'Source/Core/Common/Crypto/ec.cpp')
-rw-r--r--Source/Core/Common/Crypto/ec.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/Source/Core/Common/Crypto/ec.cpp b/Source/Core/Common/Crypto/ec.cpp
index b9a0ca6491..9a57300f89 100644
--- a/Source/Core/Common/Crypto/ec.cpp
+++ b/Source/Core/Common/Crypto/ec.cpp
@@ -241,7 +241,7 @@ static void silly_random(u8* rndArea, u8 count)
}
}
-std::array<u8, 60> Sign(const u8* key, const u8* hash)
+Signature Sign(const u8* key, const u8* hash)
{
u8 e[30]{};
memcpy(e + 10, hash, 20);
@@ -272,7 +272,7 @@ std::array<u8, 60> Sign(const u8* key, const u8* hash)
bn_inv(minv, m, ec_N, sizeof(minv));
bn_mul(s.data.data(), minv, kk, ec_N, 30);
- std::array<u8, 60> signature;
+ Signature signature;
std::copy(r.data.cbegin(), r.data.cend(), signature.begin());
std::copy(s.data.cbegin(), s.data.cend(), signature.begin() + 30);
return signature;
@@ -300,10 +300,10 @@ bool VerifySignature(const u8* public_key, const u8* signature, const u8* hash)
return (bn_compare(rx.data(), R, 30) == 0);
}
-std::array<u8, 60> PrivToPub(const u8* key)
+PublicKey PrivToPub(const u8* key)
{
const Point data = key * ec_G;
- std::array<u8, 60> result;
+ PublicKey result;
std::copy_n(data.Data(), result.size(), result.begin());
return result;
}