我在OS X 10.7上使用TextEdit和gcc來製作小型終端程序。我正試圖學習如何編程OpenSSL,但我正在編譯劇集(由於不推薦使用的問題 - 更多)。我搜索了谷歌搜索,但我所讀的一切都是在2011年之前(當問題出現時),特定於iOS(我正在爲OS X編程,但嘗試獨立於平臺)或談論使用XCode(我不 - 我更喜歡TextEdit)。在OS X上使用gcc的OpenSSL 10.7
任何人都可以請指出一個簡單的,一步一步的過程如何在OS X上使用gcc安裝OpenSSL程序的正確方向?
根據記錄,這是我所採取的具體步驟:通過MacPorts的
'OpenSSL的版本' 安裝
OpenSSL的返回 「的OpenSSL 1.0.1e 2013年2月11日」
我已經改名爲'aes.c',我使用'g立方厘米-o AES aes.c」
我嘗試了以下標誌(有結果):-lcrypto,lssl,-Wno誤差=棄用-聲明
的具體輸出I從GCC得到的是以下幾點:
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)
通常情況下,你會避免使用Apple 0.9.8版本的OpenSSL。它缺少TLS 1.1和1.2,缺乏完全支持EC等。要在OS X上構建OpenSSL,請參閱OpenSSL wiki上的[編譯和安裝](https://wiki.openssl.org/index.php/Compilation_and_Installation)。 。我編寫了OS X指令,所以我知道它們的工作原理。 – jww