52 lines
1.3 KiB
C++
52 lines
1.3 KiB
C++
|
/***
|
||
|
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
||
|
|
||
|
File: TDES.cpp
|
||
|
Date: 2022-10-08
|
||
|
Author: Reece
|
||
|
***/
|
||
|
#include <Source/RuntimeInternal.hpp>
|
||
|
#include "../Crypto.hpp"
|
||
|
#include "TDES.hpp"
|
||
|
#include "../CBC/CBC.hpp"
|
||
|
|
||
|
namespace Aurora::Crypto::TDES
|
||
|
{
|
||
|
AUKN_SYM bool CBCEncrypt(const AuSPtr<CBC::ICBCContext> pContext,
|
||
|
const Memory::MemoryViewWrite &memoryView)
|
||
|
{
|
||
|
if (!pContext)
|
||
|
{
|
||
|
SysPushErrorArg();
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
if (!memoryView.ptr)
|
||
|
{
|
||
|
SysPushErrorArg();
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
return AuStaticCast<CBC::CBCContext>(pContext)->Encrypt(::Crypto::gDesCipher,
|
||
|
memoryView);
|
||
|
}
|
||
|
|
||
|
AUKN_SYM bool CBCDecrypt(const AuSPtr<CBC::ICBCContext> pContext,
|
||
|
const Memory::MemoryViewWrite &memoryView)
|
||
|
{
|
||
|
if (!pContext)
|
||
|
{
|
||
|
SysPushErrorArg();
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
if (!memoryView.ptr)
|
||
|
{
|
||
|
SysPushErrorArg();
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
return AuStaticCast<CBC::CBCContext>(pContext)->Decrypt(::Crypto::gDesCipher,
|
||
|
memoryView);
|
||
|
}
|
||
|
}
|