mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-22 09:12:13 -05:00
LibCrypto: Move hash constructors out of line
This commit is contained in:
parent
0fc02d4d00
commit
977af95b5b
Notes:
github-actions[bot]
2025-01-13 16:02:09 +00:00
Author: https://github.com/devgianlu Commit: https://github.com/LadybirdBrowser/ladybird/commit/977af95b5b5 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3234
9 changed files with 92 additions and 24 deletions
|
@ -30,6 +30,10 @@ set(SOURCES
|
|||
Curves/Ed448.cpp
|
||||
Curves/X25519.cpp
|
||||
Curves/X448.cpp
|
||||
Hash/BLAKE2b.cpp
|
||||
Hash/MD5.cpp
|
||||
Hash/SHA1.cpp
|
||||
Hash/SHA2.cpp
|
||||
NumberTheory/ModularFunctions.cpp
|
||||
PK/RSA.cpp
|
||||
PK/EC.cpp
|
||||
|
|
18
Libraries/LibCrypto/Hash/BLAKE2b.cpp
Normal file
18
Libraries/LibCrypto/Hash/BLAKE2b.cpp
Normal file
|
@ -0,0 +1,18 @@
|
|||
/*
|
||||
* Copyright (c) 2025, Altomani Gianluca <altomanigianluca@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibCrypto/Hash/BLAKE2b.h>
|
||||
|
||||
#include <openssl/evp.h>
|
||||
|
||||
namespace Crypto::Hash {
|
||||
|
||||
BLAKE2b::BLAKE2b(EVP_MD_CTX* context)
|
||||
: OpenSSLHashFunction(EVP_blake2b512(), context)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
|
@ -15,10 +15,7 @@ class BLAKE2b final : public OpenSSLHashFunction<BLAKE2b, 1024, 512> {
|
|||
AK_MAKE_NONCOPYABLE(BLAKE2b);
|
||||
|
||||
public:
|
||||
explicit BLAKE2b(EVP_MD_CTX* context)
|
||||
: OpenSSLHashFunction(EVP_blake2b512(), context)
|
||||
{
|
||||
}
|
||||
explicit BLAKE2b(EVP_MD_CTX* context);
|
||||
|
||||
virtual ByteString class_name() const override
|
||||
{
|
||||
|
|
18
Libraries/LibCrypto/Hash/MD5.cpp
Normal file
18
Libraries/LibCrypto/Hash/MD5.cpp
Normal file
|
@ -0,0 +1,18 @@
|
|||
/*
|
||||
* Copyright (c) 2025, Altomani Gianluca <altomanigianluca@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibCrypto/Hash/MD5.h>
|
||||
|
||||
#include <openssl/evp.h>
|
||||
|
||||
namespace Crypto::Hash {
|
||||
|
||||
MD5::MD5(EVP_MD_CTX* context)
|
||||
: OpenSSLHashFunction(EVP_md5(), context)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
|
@ -15,10 +15,7 @@ class MD5 final : public OpenSSLHashFunction<MD5, 512, 128> {
|
|||
AK_MAKE_NONCOPYABLE(MD5);
|
||||
|
||||
public:
|
||||
explicit MD5(EVP_MD_CTX* context)
|
||||
: OpenSSLHashFunction(EVP_md5(), context)
|
||||
{
|
||||
}
|
||||
explicit MD5(EVP_MD_CTX* context);
|
||||
|
||||
virtual ByteString class_name() const override
|
||||
{
|
||||
|
|
18
Libraries/LibCrypto/Hash/SHA1.cpp
Normal file
18
Libraries/LibCrypto/Hash/SHA1.cpp
Normal file
|
@ -0,0 +1,18 @@
|
|||
/*
|
||||
* Copyright (c) 2025, Altomani Gianluca <altomanigianluca@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibCrypto/Hash/SHA1.h>
|
||||
|
||||
#include <openssl/evp.h>
|
||||
|
||||
namespace Crypto::Hash {
|
||||
|
||||
SHA1::SHA1(EVP_MD_CTX* context)
|
||||
: OpenSSLHashFunction(EVP_sha1(), context)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
|
@ -15,10 +15,7 @@ class SHA1 final : public OpenSSLHashFunction<SHA1, 512, 160> {
|
|||
AK_MAKE_NONCOPYABLE(SHA1);
|
||||
|
||||
public:
|
||||
explicit SHA1(EVP_MD_CTX* context)
|
||||
: OpenSSLHashFunction(EVP_sha1(), context)
|
||||
{
|
||||
}
|
||||
explicit SHA1(EVP_MD_CTX* context);
|
||||
|
||||
virtual ByteString class_name() const override
|
||||
{
|
||||
|
|
28
Libraries/LibCrypto/Hash/SHA2.cpp
Normal file
28
Libraries/LibCrypto/Hash/SHA2.cpp
Normal file
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* Copyright (c) 2025, Altomani Gianluca <altomanigianluca@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibCrypto/Hash/SHA2.h>
|
||||
|
||||
#include <openssl/evp.h>
|
||||
|
||||
namespace Crypto::Hash {
|
||||
|
||||
SHA256::SHA256(EVP_MD_CTX* context)
|
||||
: OpenSSLHashFunction(EVP_sha256(), context)
|
||||
{
|
||||
}
|
||||
|
||||
SHA384::SHA384(EVP_MD_CTX* context)
|
||||
: OpenSSLHashFunction(EVP_sha384(), context)
|
||||
{
|
||||
}
|
||||
|
||||
SHA512::SHA512(EVP_MD_CTX* context)
|
||||
: OpenSSLHashFunction(EVP_sha512(), context)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
|
@ -15,10 +15,7 @@ class SHA256 final : public OpenSSLHashFunction<SHA256, 512, 256> {
|
|||
AK_MAKE_NONCOPYABLE(SHA256);
|
||||
|
||||
public:
|
||||
explicit SHA256(EVP_MD_CTX* context)
|
||||
: OpenSSLHashFunction(EVP_sha256(), context)
|
||||
{
|
||||
}
|
||||
explicit SHA256(EVP_MD_CTX* context);
|
||||
|
||||
virtual ByteString class_name() const override
|
||||
{
|
||||
|
@ -30,10 +27,7 @@ class SHA384 final : public OpenSSLHashFunction<SHA384, 1024, 384> {
|
|||
AK_MAKE_NONCOPYABLE(SHA384);
|
||||
|
||||
public:
|
||||
explicit SHA384(EVP_MD_CTX* context)
|
||||
: OpenSSLHashFunction(EVP_sha384(), context)
|
||||
{
|
||||
}
|
||||
explicit SHA384(EVP_MD_CTX* context);
|
||||
|
||||
virtual ByteString class_name() const override
|
||||
{
|
||||
|
@ -45,10 +39,7 @@ class SHA512 final : public OpenSSLHashFunction<SHA512, 1024, 512> {
|
|||
AK_MAKE_NONCOPYABLE(SHA512);
|
||||
|
||||
public:
|
||||
explicit SHA512(EVP_MD_CTX* context)
|
||||
: OpenSSLHashFunction(EVP_sha512(), context)
|
||||
{
|
||||
}
|
||||
explicit SHA512(EVP_MD_CTX* context);
|
||||
|
||||
virtual ByteString class_name() const override
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue