On Monday, March 14, 2016 at 4:01:18 AM UTC-4, Jeffrey Walton wrote:
>
>
> I tried the following which I thought would work
>>
>>     salsa.SetKey(key, 32, MakeParameters(Name::IV(),iv)
>>             (Name::Rounds(), 12));
>>
>> my eclipse ide is complaining 
>>
>> Description    Resource    Path    Location    Type
>>   required from ‘CryptoPP::AlgorithmParameters 
>> CryptoPP::MakeParameters(const char*, const T&, bool) [with T = unsigned 
>> char [8]]’    salsa12        line 388, external location: 
>> /usr/include/crypto++/algparam.h    C/C++ Problem
>>
>> Description    Resource    Path    Location    Type
>>   required from ‘CryptoPP::AlgorithmParameters& 
>> CryptoPP::AlgorithmParameters::operator()(const char*, const T&, bool) 
>> [with T = unsigned char [8]]’    salsa12        line 354, external 
>> location: /usr/include/crypto++/algparam.h    C/C++ Problem
>>
>> any ideas?
>>
>
> You might try casting iv to a 'const byte*'. Maybe something like:
>
>     AlgorithmParameters params = MakeParameters(Name::IV(), (const 
> byte*)iv)
>                                                (Name::Rounds(),12);
>     salsa.SetKey(key, 32, params);
>

I was able to compile with the cast:

$ cat test.cxx
#include <iostream>
#include <string>
using namespace std;

#include "salsa.h"
#include "algparam.h"
#include "argnames.h"
using namespace CryptoPP;

// g++ -Wall -I . test.cxx ./libcryptopp.a -o test.exe
int main(int argc, char* argv[])
{
  byte key[32], iv[8];
  Salsa20::Encryption enc;

  AlgorithmParameters params = MakeParameters(Name::IV(), (const byte*)iv)
                                             (Name::Rounds(),12);
  enc.SetKey(key, 32, params);
  
  return 0;
}

$ g++ -Wall -I . test.cxx ./libcryptopp.a -o test.exe
$ ./test.exe
$

-- 
-- 
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.
--- 
You received this message because you are subscribed to the Google Groups 
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to