Hey Nathan,

I've never heard of Sosemanuk, have you tried something more common -
like AES OFB? Also why are you using a seperate decryption object,
stream ciphers just XOR so you can reuse the encryption one for
decryption. Could you tell me how to compile crypto++ using mingw? I
tried it a while ago and got several errors.

The following worked fine for me:

#define SYMMETRIC_KEYSIZE_BYTE 16

CryptoPP::OFB_Mode<CryptoPP::AES>::Encryption aesOfbEncrypt;

string iV(16, 13);

string key(16, 42);

string dataPlain(32, 0x42);

string dataEnc(32, 22);

string dataDec(32, 0);

// reset the whole crypto object

aesOfbEncrypt.SetKeyWithIV((byte*)key.data(), SYMMETRIC_KEYSIZE_BYTE,

(byte*)iV.data(), SYMMETRIC_KEYSIZE_BYTE);

aesOfbEncrypt.ProcessData((byte*)dataEnc.data(),
(byte*)dataPlain.data(), dataPlain.size());

// reset to back to iV as first OFB block

aesOfbEncrypt.Resynchronize((byte*)iV.data());

aesOfbEncrypt.ProcessData((byte*)dataDec.data(), (byte*)dataEnc.data(),
dataEnc.size());



Nathan Ridge wrote:
> Hello,
>
> I am trying to run a very simple stream cipher example, taken from the
> FAQ, but I am getting a segmentation fault.
>
> Here is the code:
>
> #include <sosemanuk.h>
> using CryptoPP::Sosemanuk;
>
> int main()
> {
>     byte plaintext[100], ciphertext[100],
> key[Sosemanuk::DEFAULT_KEYLENGTH], iv[Sosemanuk::IV_LENGTH];
>     // put data into key, iv, and plaintext here
>     // encrypt
>     Sosemanuk::Encryption enc(key, Sosemanuk::DEFAULT_KEYLENGTH, iv);
>     enc.ProcessData(ciphertext, plaintext, 100);
>     // now decrypt
>     Sosemanuk::Decryption dec(key, Sosemanuk::DEFAULT_KEYLENGTH, iv);
>     dec.ProcessData(plaintext, ciphertext, 100);
> }
>
> My compiler in MinGW g++ 4.5.0, OS is Windows XP 64-bit edition
> Service Pack 2.
> CryptoPP version is 5.6.0.
>
> gdb gives this strack trace:
>
> Program received signal SIGSEGV, Segmentation fault.
> #0 0x00409da8 in CryptoPP::SosemanukPolicy::OperateKeystream
> (this=0x46a190, operation=2293488,output=0x77bbcbb5 "ï≡ï╞ΦA╣",
> input=0x3f0000 "╚", iterationCount=0) at sosemanuk.cpp:605
> #1 0x003f23e0 in ?? ()
> Cannot access memory at address 0x50000065
>
> What am I doing wrong?
>
> Thanks,
>
> Nate.
>
>   

-- 
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