mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2026-11-21 19:27:09 +01:00
Update libraries and make it build on windows.
Still gets some warnings because compilers have changed. But should work.
This commit is contained in:
1 parent
520a5eacc5
commit
f2b7499f85
3038 files changed
+251668
-273857
No files matched your search
+3
@@ -0,0 +1,3 @@
|
||||
add_executable(JWT-decode-fuzzer JWTDecode.cpp)
|
||||
target_link_libraries(JWT-decode-fuzzer PUBLIC Poco::JWT)
|
||||
set_target_properties(JWT-decode-fuzzer PROPERTIES LINK_FLAGS $ENV{LIB_FUZZING_ENGINE})
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
#include "Poco/JWT/Token.h"
|
||||
#include "Poco/JWT/Signer.h"
|
||||
|
||||
using namespace Poco;
|
||||
using namespace Poco::JWT;
|
||||
|
||||
extern "C" int LLVMFuzzerInitialize(int* argc, char*** argv)
|
||||
{
|
||||
Crypto::initializeCrypto();
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
|
||||
{
|
||||
const std::string input(reinterpret_cast<const char*>(data), size);
|
||||
|
||||
Signer signer;
|
||||
signer.addAllAlgorithms();
|
||||
signer.setHMACKey("secret");
|
||||
|
||||
try
|
||||
{
|
||||
// verify untrusted input
|
||||
Token token;
|
||||
token = signer.verify(input);
|
||||
}
|
||||
catch (const Exception&)
|
||||
{
|
||||
}
|
||||
|
||||
for (const auto& algorithm : signer.getAlgorithms())
|
||||
{
|
||||
try
|
||||
{
|
||||
// sign and verify again
|
||||
Token token(input);
|
||||
token.setAudience(token.getAudience());
|
||||
signer.sign(token, algorithm);
|
||||
token = signer.verify(token.toString());
|
||||
}
|
||||
catch (const Exception&)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in new issue
Block a user