GCC Include Error OpenSSL

I'm trying to use openssl crypto lib in my application but i've some issues when I include OpenSSL headers.

First of all i'm tryong to reuse this code : http://wiki.openssl.org/index.php/EVP_Symmetric_Encryption_and_Decryption

In my crypto_file I've this code :

#include <openssl/conf.h>
#include <openssl/evp.h>
#include <openssl/err.h>

#include "global.h"
#include "api_openssl.h"

void init_ctx();

int private_encrypt(byte *plaintext, int plaintex_len, byte *key, byte* iv,byte *cipher)
{
    //TODO
    return 0;
}
int private_decrypt(byte *ciphertext, int ciphertex_len, byte *key, byte* iv,byte *plain)
{
    //TODO
    return 0;
}

void private_init()
{
      ERR_load_crypto_strings();
      OpenSSL_add_all_algorithms();
      OPENSSL_config(NULL);
}

void private_clean_up()
{
      EVP_cleanup();
      ERR_free_strings();
}

and when i wan't to compile thanks to this command:

gcc  -std=c99 -Wall -g -c -I inc -DSSL -o obj/api_openssl.o -c src/api_openssl.c

I have this result:

<command-line>:0:5: error: expected identifier or ‘(’ before numeric constant

For your information:

 cat /etc/*-release
 ->DISTRIB_ID=LinuxMint
 DISTRIB_RELEASE=16
 DISTRIB_CODENAME=petra
 DISTRIB_DESCRIPTION="Linux Mint 16 Petra"
 NAME="Ubuntu"
 VERSION="13.10, Saucy Salamander"
 ID=ubuntu
 ID_LIKE=debian
 PRETTY_NAME="Ubuntu 13.10"
 VERSION_ID="13.10"
 HOME_URL="http://www.ubuntu.com/"
 SUPPORT_URL="http://help.ubuntu.com/"
 BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"

And I've the package libssl-dev of default repository installed

I'm running out of solution.

Thank's for helping me !

Answers


The error you're seeing is coming from the -DSSL gcc option. Changing it to -D_SSL, or anything else really, prevents the error. I'm not sure, but this leads me to believe that SSL is either reserved somewhere or in conflict with something. Maybe someone else can comment on why this is.

That said, where is the SSL macro used? Are you able to change it?


Need Your Help

need to search an entire array not just one

c# arrays string visual-studio-2010 class

sorry for asking too much question but I have a problem when I'm comparing string to string in array it will only search for one instance of the array, for example the program allows you to add pa...

Creating Custom Elements in HTML

javascript jquery html css

I am trying to create my own HTML element. Now, before you mark this as a duplicate and downvote it, let me tell you that I am not doing it for styling. I have created my own styling tags, and even