summaryrefslogtreecommitdiff
path: root/Libraries/LibCrypto/PK
diff options
context:
space:
mode:
authorasynts <asynts@gmail.com>2020-07-27 14:44:40 +0200
committerAndreas Kling <kling@serenityos.org>2020-07-27 19:58:09 +0200
commit4709b700bd91c181c9bfa157ad720036f7717b5a (patch)
treef0f03ad76a7e7c9552457b29a7904af46e987e42 /Libraries/LibCrypto/PK
parentabe925e4b08fca8eaac4d3e63508cbb9ff5c1733 (diff)
downloadserenity-4709b700bd91c181c9bfa157ad720036f7717b5a.zip
LibCrypto: Change [XXX]BigInteger::export_data() to use Span.
Diffstat (limited to 'Libraries/LibCrypto/PK')
-rw-r--r--Libraries/LibCrypto/PK/RSA.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/Libraries/LibCrypto/PK/RSA.cpp b/Libraries/LibCrypto/PK/RSA.cpp
index e7c8c26bfe..67a46c7e5d 100644
--- a/Libraries/LibCrypto/PK/RSA.cpp
+++ b/Libraries/LibCrypto/PK/RSA.cpp
@@ -125,7 +125,7 @@ void RSA::encrypt(const ByteBuffer& in, ByteBuffer& out)
return;
}
auto exp = NumberTheory::ModularPower(in_integer, m_public_key.public_exponent(), m_public_key.modulus());
- auto size = exp.export_data(out);
+ auto size = exp.export_data(out.span());
// FIXME: We should probably not do this...
if (size != out.size())
out = out.slice(out.size() - size, size);
@@ -137,7 +137,7 @@ void RSA::decrypt(const ByteBuffer& in, ByteBuffer& out)
auto in_integer = UnsignedBigInteger::import_data(in.data(), in.size());
auto exp = NumberTheory::ModularPower(in_integer, m_private_key.private_exponent(), m_private_key.modulus());
- auto size = exp.export_data(out);
+ auto size = exp.export_data(out.span());
auto align = m_private_key.length();
auto aligned_size = (size + align - 1) / align * align;
@@ -151,7 +151,7 @@ void RSA::sign(const ByteBuffer& in, ByteBuffer& out)
{
auto in_integer = UnsignedBigInteger::import_data(in.data(), in.size());
auto exp = NumberTheory::ModularPower(in_integer, m_private_key.private_exponent(), m_private_key.modulus());
- auto size = exp.export_data(out);
+ auto size = exp.export_data(out.span());
out = out.slice(out.size() - size, size);
}
@@ -159,7 +159,7 @@ void RSA::verify(const ByteBuffer& in, ByteBuffer& out)
{
auto in_integer = UnsignedBigInteger::import_data(in.data(), in.size());
auto exp = NumberTheory::ModularPower(in_integer, m_public_key.public_exponent(), m_public_key.modulus());
- auto size = exp.export_data(out);
+ auto size = exp.export_data(out.span());
out = out.slice(out.size() - size, size);
}