HomeFreeBSD

Backport OpenSSL 1.1 support (and prerequisites) from libsrtp2.

Description

Backport OpenSSL 1.1 support (and prerequisites) from libsrtp2.

https://github.com/cisco/libsrtp/commit/84faa631a55235f6138cacda2e7f81980a43d13e

Refactor memory allocation for the symmetric ciphers context structures.

https://github.com/cisco/libsrtp/commit/5781341d99cd286a1f3d164e0576c2e837a444b7

Use the OpenSSL HMAC implementation, and thus also the OpenSSL EVP_sha1()
implementation.

Experiments show about a 1.5x speedup on Intel CPUs with AVX2.

https://github.com/cisco/libsrtp/commit/fb954450198c832c96b4191fcef3a1b9e2d15d8b

When building with OpenSSL, pass the AES_ICM key to the EVP context (and
thus, do AES key expansion) in srtp_cipher_init, not srtp_cipher_set_iv.

This means that AES key expansion is done once per key, rather than once
per packet, resulting in a 2-3x speedup for AES-128.

https://github.com/cisco/libsrtp/commit/1acba569915d8124b627a29dd5e3500332618eac

When building with OpenSSL, pass the AES_GCM key to the EVP context (and
thus, do AES key expansion) in srtp_cipher_init, not srtp_cipher_set_iv.

Improves AES_GCM performance 2x-3x.

https://github.com/cisco/libsrtp/commit/0b45423678ddc46d702f3a51614f20bfbd112ddd

Changes for OpenSSL 1.1.0 compatibility.

In OpenSSL 1.1.0, EVP_CIPHER_CTX, HMAC_CTX, and EVP_MD_CTX are opaque
types, and have to be allocated with *_new methods and deallocated with
*_free.

EVP_CIPHER_CTX_new/free is present in OpenSSL 1.0.1 and later, but
HMAC_CTX_new and EVP_MD_CTX_new are new in OpenSSL 1.1.0.

Use the _new unconditionally for ciphers, and conditionally use the old
or new APIs for HMAC and MD.

No noticible performance change for older OpenSSL.

PR: 228866

Details

Provenance
tijlAuthored on
Parents
rP472169: New port: x11-toolkits/wxgtk31: GUI toolkit (wxWidgets) with GTK+ bindings
Branches
Unknown
Tags
Unknown