Abhinav Gupta wrote:
Hi,

I am a newbie to the OpenSSL world. I am trying to use the Safenet SafeXcel 1141 card for encryption. I have been provided a patched version of the OpenSSL which has support for the card in the form of a 'safenet' engine. The card seems to work (the code for the engine support gets called) when I run the openssl tests at the command line with "-engine safenet" option as below:
$openssl speed -evp des -engine safenet -elapsed


However when I try to call des_ncbc_encrypt() from an application after initializing the engine as safenet as follows, the control never reaches the code for engine support, despite the being able to initialize the engine and setting safenet engine as the default cipher.

    ENGINE *cryptoEngine;
    const char *engineId = "safenet";
      //  ENGINE_load_builtin_engines();
      ENGINE_load_safenet();
      cryptoEngine = ENGINE_by_id(engineId);

      if (!cryptoEngine){
        cout<<"SafeNet Crypto Engine not found!"<<endl;
      }
      else{
        if(!ENGINE_init(cryptoEngine)){
          ENGINE_free(cryptoEngine);
          cout<<"SafeNet Crypto Engine not initialized"<<endl;
        }
        else{
          cout<<"SafeNet Crypto Engine Initialized"<<endl;
          if (!ENGINE_set_default_ciphers(cryptoEngine)){
            cout<<"Cipering using SafeNet not possible"<<endl;
          }

My questions are:
- Can one use the same openssl commands like des_ncbc_encrypt() to perform des encryption using the engine once it has been initialized or is there a separate set of functions for carrying out encryption using a specific engine?


- If the same functions can be used, then am I overlooking some aspect of engine initialization as the packets are not getting encrypted using the hardware accelarator?

- If there are different set of functions to be used for performing the des encryption using the engines, please provide me with some pointers, like functions/linkers etc.

try using the EVP cipher functions EVP_CipherInit_ex etc.

Nils
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to