I use TextEdit and gcc on OS X 10.7 to make small terminal programs. I'm trying to learn how to program OpenSSL, but I'm having dramas compiling (due to the deprecated issue - more below). I've Googled and searched on SO but everything I read is either pre-2011 (when the issue seemed to appear), specific to iOS (I'm programming for OS X but trying to be platform independent) or talks about using XCode (which I don't - I prefer TextEdit).
Can anyone please point in the right direction of a simple, step-by-step process for how to install an OpenSSL program on OS X using gcc?
For the record, this is the exact steps I have taken:
OpenSSL installed via macports
'openssl version' returns "OpenSSL 1.0.1e 11 Feb 2013"
I'm trying to compile this file: http://saju.net.in/code/misc/openssl_aes.c.txt
I've renamed to 'aes.c' and I'm using 'gcc -o aes aes.c'
I've tried the following flags (for no result): -lcrypto, lssl, -Wno-error=deprecated-declarations
The specific output I get from gcc is the following:
Brads-MacBook-Air:Desktop brad$ gcc -o aes aes.c -lssl -lcrypto -Wno-error=deprecated-declarations
aes.c: In function ‘aes_init’:
aes.c:30: warning: ‘EVP_BytesToKey’ is deprecated (declared at /usr/include/openssl/evp.h:572)
aes.c:30: warning: ‘EVP_aes_256_cbc’ is deprecated (declared at /usr/include/openssl/evp.h:786)
aes.c:30: warning: ‘EVP_sha1’ is deprecated (declared at /usr/include/openssl/evp.h:666)
aes.c:36: warning: ‘EVP_CIPHER_CTX_init’ is deprecated (declared at /usr/include/openssl/evp.h:636)
aes.c:37: warning: ‘EVP_EncryptInit_ex’ is deprecated (declared at /usr/include/openssl/evp.h:581)
aes.c:37: warning: ‘EVP_aes_256_cbc’ is deprecated (declared at /usr/include/openssl/evp.h:786)
aes.c:38: warning: ‘EVP_CIPHER_CTX_init’ is deprecated (declared at /usr/include/openssl/evp.h:636)
aes.c:39: warning: ‘EVP_DecryptInit_ex’ is deprecated (declared at /usr/include/openssl/evp.h:590)
aes.c:39: warning: ‘EVP_aes_256_cbc’ is deprecated (declared at /usr/include/openssl/evp.h:786)
aes.c: In function ‘aes_encrypt’:
aes.c:51: error: ‘AES_BLOCK_SIZE’ undeclared (first use in this function)
aes.c:51: error: (Each undeclared identifier is reported only once
aes.c:51: error: for each function it appears in.)
aes.c:55: warning: ‘EVP_EncryptInit_ex’ is deprecated (declared at /usr/include/openssl/evp.h:581)
aes.c:59: warning: ‘EVP_EncryptUpdate’ is deprecated (declared at /usr/include/openssl/evp.h:583)
aes.c:62: warning: ‘EVP_EncryptFinal_ex’ is deprecated (declared at /usr/include/openssl/evp.h:584)
aes.c: In function ‘aes_decrypt’:
aes.c:75: error: ‘AES_BLOCK_SIZE’ undeclared (first use in this function)
aes.c:77: warning: ‘EVP_DecryptInit_ex’ is deprecated (declared at /usr/include/openssl/evp.h:590)
aes.c:78: warning: ‘EVP_DecryptUpdate’ is deprecated (declared at /usr/include/openssl/evp.h:592)
aes.c:79: warning: ‘EVP_DecryptFinal_ex’ is deprecated (declared at /usr/include/openssl/evp.h:594)
aes.c: In function ‘main’:
aes.c:136: warning: ‘EVP_CIPHER_CTX_cleanup’ is deprecated (declared at /usr/include/openssl/evp.h:637)
aes.c:137: warning: ‘EVP_CIPHER_CTX_cleanup’ is deprecated (declared at /usr/include/openssl/evp.h:637)