GCC包含错误OpenSSL

约翰沃克斯

我正在尝试在应用程序中使用openssl crypto lib,但是在包含OpenSSL标头时遇到了一些问题。

首先,我想重用此代码:http ://wiki.openssl.org/index.php/EVP_Symmetric_Encryption_and_Decryption

在我的crypto_file中,我有以下代码:

#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();
}

当我由于这个命令而不想编译时:

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

我有这个结果:

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

供你参考:

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

我已经安装了默认存储库的软件包libssl-dev

我的解决方案快用完了。

谢谢您的帮助!

肖内特

您看到的错误来自-DSSLgcc选项。将其更改为-D_SSL,或将其更改为其他任何内容,均可以防止该错误。我不确定,但是这使我相信它SSL要么保留在某个位置要么与某些内容冲突。也许其他人可以评论为什么会这样。

也就是说,SSL在哪里使用?你能改变吗?

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章