Difference between revisions of "Talk:OpenSSL 1.1.0 Changes"

From OpenSSLWiki
Jump to navigationJump to search
m (sign my edit)
 
(2 intermediate revisions by 2 users not shown)
Line 5: Line 5:
  
 
<tt>HMAC_CTX_reset</tt>, and <tt>EVP_MD_CTX_free</tt> are OpenSSL 1.1 APIs themselves so their use should be avoided in the <tt>#if</tt> section.
 
<tt>HMAC_CTX_reset</tt>, and <tt>EVP_MD_CTX_free</tt> are OpenSSL 1.1 APIs themselves so their use should be avoided in the <tt>#if</tt> section.
Also LibreSSL claims to be <tt>OPENSSL_VERSION_NUMBER 0x20000000L</tt>, but doesn't support the new OpenSSL 1.1.0 API yet.
 
  
 
Suggested example:
 
Suggested example:
Line 41: Line 40:
 
</code>
 
</code>
 
--[[User:Edwintorok|Edwintorok]] ([[User talk:Edwintorok|talk]]) 13:30, 23 September 2016 (UTC)
 
--[[User:Edwintorok|Edwintorok]] ([[User talk:Edwintorok|talk]]) 13:30, 23 September 2016 (UTC)
 +
 +
 +
== Please update the "No longer works" section ==
 +
 +
That section is ''seriously'' outdated.
 +
 +
--[[User:Levitte|Levitte]] ([[User talk:Levitte|talk]]) 06:51, 27 March 2020 (UTC)

Latest revision as of 06:51, 27 March 2020

Converting code to be compatible with both OpenSSL 1.0.x and 1.1.x[edit]

Small correction to the example at 1.1_API_Changes#Adding_forward-compatible_code_to_older_versions:

HMAC_CTX_reset, and EVP_MD_CTX_free are OpenSSL 1.1 APIs themselves so their use should be avoided in the #if section.

Suggested example:

#if (OPENSSL_VERSION_NUMBER < 0x10100000L) || defined (LIBRESSL_VERSION_NUMBER)
static HMAC_CTX *HMAC_CTX_new(void)
{
   HMAC_CTX *ctx = OPENSSL_malloc(sizeof(*ctx));
   if (ctx != NULL)
       HMAC_CTX_init(ctx);
   return ctx;
}

static void HMAC_CTX_free(HMAC_CTX *ctx)
{
   if (ctx != NULL) {
       HMAC_CTX_cleanup(ctx);
       OPENSSL_free(ctx);
   }
}
#endif

Similarly examples for other APIs that I encountered:

#if (OPENSSL_VERSION_NUMBER < 0x10100000L) || defined (LIBRESSL_VERSION_NUMBER)
#define EVP_MD_CTX_new EVP_MD_CTX_create
#define EVP_MD_CTX_free EVP_MD_CTX_destroy
#endif

#if (OPENSSL_VERSION_NUMBER < 0x10100000L) || defined(LIBRESSL_VERSION_NUMBER)
#define ASN1_STRING_get0_data(x) ASN1_STRING_data(x)
#endif

--Edwintorok (talk) 13:30, 23 September 2016 (UTC)


Please update the "No longer works" section[edit]

That section is seriously outdated.

--Levitte (talk) 06:51, 27 March 2020 (UTC)