mirror of
https://github.com/shadps4-emu/ext-cryptopp.git
synced 2025-02-19 21:00:50 +00:00
Add Panama cipher AlgorithmProvider()
This commit is contained in:
parent
a6fadbad77
commit
03d78fb783
34
panama.cpp
34
panama.cpp
@ -17,6 +17,21 @@ NAMESPACE_BEGIN(CryptoPP)
|
||||
# pragma warning(disable: 4731)
|
||||
#endif
|
||||
|
||||
template <class B>
|
||||
std::string Panama<B>::AlgorithmProvider() const
|
||||
{
|
||||
#ifndef CRYPTOPP_DISABLE_PANAMA_ASM
|
||||
# if CRYPTOPP_SSSE3_ASM_AVAILABLE
|
||||
if(HasSSSE3())
|
||||
return "SSSE3";
|
||||
# elif CRYPTOPP_SSE2_ASM_AVAILABLE
|
||||
if(HasSSE2())
|
||||
return "SSE2";
|
||||
# endif
|
||||
#endif
|
||||
return "C++";
|
||||
}
|
||||
|
||||
template <class B>
|
||||
void Panama<B>::Reset()
|
||||
{
|
||||
@ -57,9 +72,7 @@ void CRYPTOPP_NOINLINE Panama_SSE2_Pull(size_t count, word32 *state, word32 *z,
|
||||
#endif
|
||||
#endif // #ifdef CRYPTOPP_GENERATE_X64_MASM
|
||||
|
||||
#if CRYPTOPP_BOOL_X32
|
||||
#define REG_loopEnd r8d
|
||||
#elif CRYPTOPP_BOOL_X86
|
||||
#if CRYPTOPP_BOOL_X86
|
||||
#define REG_loopEnd [esp]
|
||||
#elif defined(CRYPTOPP_GENERATE_X64_MASM)
|
||||
#define REG_loopEnd rdi
|
||||
@ -286,10 +299,7 @@ void CRYPTOPP_NOINLINE Panama_SSE2_Pull(size_t count, word32 *state, word32 *z,
|
||||
AS2( movdqa XMMWORD_PTR [AS_REG_2+1*16], xmm1)
|
||||
AS2( movdqa XMMWORD_PTR [AS_REG_2+0*16], xmm0)
|
||||
|
||||
#if CRYPTOPP_BOOL_X32
|
||||
AS2( add esp, 8)
|
||||
AS_POP_IF86( bp)
|
||||
#elif CRYPTOPP_BOOL_X86
|
||||
#if CRYPTOPP_BOOL_X86
|
||||
AS2( add esp, 4)
|
||||
AS_POP_IF86( bp)
|
||||
#endif
|
||||
@ -420,7 +430,7 @@ void Panama<B>::Iterate(size_t count, const word32 *p, byte *output, const byte
|
||||
m_state[17] = bstart;
|
||||
}
|
||||
|
||||
namespace Weak {
|
||||
NAMESPACE_BEGIN(Weak)
|
||||
template <class B>
|
||||
size_t PanamaHash<B>::HashMultipleBlocks(const word32 *input, size_t length)
|
||||
{
|
||||
@ -446,7 +456,7 @@ void PanamaHash<B>::TruncatedFinal(byte *hash, size_t size)
|
||||
|
||||
this->Restart(); // reinit for next use
|
||||
}
|
||||
}
|
||||
NAMESPACE_END
|
||||
|
||||
template <class B>
|
||||
void PanamaCipherPolicy<B>::CipherSetKey(const NameValuePairs ¶ms, const byte *key, size_t length)
|
||||
@ -485,6 +495,12 @@ void PanamaCipherPolicy<B>::CipherResynchronize(byte *keystreamBuffer, const byt
|
||||
this->Iterate(32);
|
||||
}
|
||||
|
||||
template <class B>
|
||||
std::string PanamaCipherPolicy<B>::AlgorithmProvider() const
|
||||
{
|
||||
return Panama<B>::AlgorithmProvider();
|
||||
}
|
||||
|
||||
template <class B>
|
||||
unsigned int PanamaCipherPolicy<B>::GetAlignment() const
|
||||
{
|
||||
|
2
panama.h
2
panama.h
@ -22,6 +22,7 @@ template <class B>
|
||||
class CRYPTOPP_NO_VTABLE Panama
|
||||
{
|
||||
public:
|
||||
std::string AlgorithmProvider() const;
|
||||
void Reset();
|
||||
void Iterate(size_t count, const word32 *p=NULLPTR, byte *output=NULLPTR, const byte *input=NULLPTR, KeystreamOperation operation=WRITE_KEYSTREAM);
|
||||
|
||||
@ -134,6 +135,7 @@ class PanamaCipherPolicy : public AdditiveCipherConcretePolicy<word32, 8>,
|
||||
protected Panama<B>
|
||||
{
|
||||
protected:
|
||||
std::string AlgorithmProvider() const;
|
||||
void CipherSetKey(const NameValuePairs ¶ms, const byte *key, size_t length);
|
||||
void OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount);
|
||||
bool CipherIsRandomAccess() const {return false;}
|
||||
|
Loading…
x
Reference in New Issue
Block a user