Hi,

thank you for pointing me.

I have tried it to implement it by a new template and new class
(inspired by modes.h):

class CTR_TPM_ModePolicy : public CTR_ModePolicy
{
protected:
        virtual void IncrementCounterBy256() { IncrementCounterByOne
(m_counterArray, 3); }
};

CRYPTOPP_DLL_TEMPLATE_CLASS
AdditiveCipherTemplate<AbstractPolicyHolder<AdditiveCipherAbstractPolicy,
CTR_TPM_ModePolicy> >;

template <class CIPHER>
struct CTR_TPM_Mode : public CipherModeDocumentation
{
        typedef CipherModeFinalTemplate_CipherHolder<CPP_TYPENAME
CIPHER::Encryption, ConcretePolicyHolder<Empty,
AdditiveCipherTemplate<AbstractPolicyHolder<AdditiveCipherAbstractPolicy,
CTR_TPM_ModePolicy> > > > Encryption;
        typedef Encryption Decryption;
};

and then I tried to create proper variable:

CTR_TPM_Mode<AES>::Encryption aes(key.data, key.size, iv.data,
iv.size);

Unfortunately linker (VC++ 8.0 Express) returned few errors:

"public: virtual void __thiscall
CryptoPP::AdditiveCipherTemplate<class
CryptoPP::AbstractPolicyHolder<struct
CryptoPP::AdditiveCipherAbstractPolicy,class
CryptoPP::CTR_TPM_ModePolicy> >::Resynchronize(unsigned char const
*,int)"
"protected: virtual void __thiscall
CryptoPP::AdditiveCipherTemplate<class
CryptoPP::AbstractPolicyHolder<struct
CryptoPP::AdditiveCipherAbstractPolicy,class
CryptoPP::CTR_TPM_ModePolicy> >::UncheckedSetKey(unsigned char const
*,unsigned int,class CryptoPP::NameValuePairs const &)"
"public: virtual void __thiscall
CryptoPP::AdditiveCipherTemplate<class
CryptoPP::AbstractPolicyHolder<struct
CryptoPP::AdditiveCipherAbstractPolicy,class
CryptoPP::CTR_TPM_ModePolicy> >::ProcessData(unsigned char *,unsigned
char const *,unsigned int)"
"public: virtual void __thiscall
CryptoPP::AdditiveCipherTemplate<class
CryptoPP::AbstractPolicyHolder<struct
CryptoPP::AdditiveCipherAbstractPolicy,class
CryptoPP::CTR_TPM_ModePolicy> >::Seek(unsigned __int64)"
"public: virtual void __thiscall
CryptoPP::AdditiveCipherTemplate<class
CryptoPP::AbstractPolicyHolder<struct
CryptoPP::AdditiveCipherAbstractPolicy,class
CryptoPP::CTR_TPM_ModePolicy> >::GenerateBlock(unsigned char
*,unsigned int)"

Do you know what could be origin of them?

Best regards,
Jan



On Jun 16, 7:52 pm, "Wei Dai" <[email protected]> wrote:
> Hi, take a look at GCM_Base::GCTR in gcm.h. It does what you want, but is a
> protected member of GCM_Base, so just copy its code.
>
> --------------------------------------------------
> From: "Jan" <[email protected]>
> Sent: Tuesday, June 16, 2009 2:40 AM
> To: "Crypto++ Users" <[email protected]>
> Subject: AES/CTR IV custom increment
>
>
>
> > Hello,
>
> > I am trying to implement AES in CTR mode but with the custom IV
> > increment. CryptoPP implementation increments IV over the whole vector
> > but I would like to have increment only over the lowest 4 bytes (with
> > modulo).
>
> > E.g. 00 .... AB FF FF FF FE -> 00 .... AB FF FF FF FF -> 00 .... AB 00
> > 00 00 00
>
> > Is there any easy way how to do it? Only solution which I currently
> > found is to increment IV by myself after each block and then call
> > Resynchronize and then encrypt another block.
>
> > Thank you for your help,
> > Jan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the "Crypto++ Users" 
Google Group.
To unsubscribe, send an email to [email protected].
More information about Crypto++ and this group is available at 
http://www.cryptopp.com.
-~----------~----~----~----~------~----~------~--~---

Reply via email to