SSL_GET_SSL_CTX(3SSL)
π¦ NAME π¦
SSL_get_SSL_CTX β okay so this is literally the function that tells you which SSL_CTX birthed your SSL π like it's giving "who's your parent" energy and honestly? iconic.
β¨ SYNOPSIS β¨
#include <openssl/ssl.h>
SSL_CTX *SSL_get_SSL_CTX(const SSL *ssl);
πΈ DESCRIPTION πΈ
bestie listen. SSL_get_SSL_CTX() hands you back a pointer to the SSL_CTX object β the exact one that your ssl was created from using SSL_new(3) π
that's it. that's the whole function. she's simple, she's direct, she ate π₯
π RETURN VALUES π
you get the pointer to the SSL_CTX object, slay π
but BIG WARNING okay, pay attention because this is the part people mess up π:
- this is an internal pointer β the reference count is not incremented. not even a little.
- the returned pointer should not be freed π« like do NOT touch it, do not
free()it, do not look at it funny. it's not yours. - if you need to keep the
SSL_CTXalive longer than theSSLobject itself, you gotta callSSL_CTX_up_ref(3)to bump that reference count up yourself π that's you doing the work. the function will not do it for you, no cap.
fr fr don't skip thatSSL_CTX_up_ref(3)if you're holding on past theSSL's lifetime. that's a use-after-free waiting to happen and we are NOT about that life π
π SEE ALSO π
π COPYRIGHT π
Copyright 2001-2026 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.
and that's the whole page, periodt π this was SSL_GET_SSL_CTX(3SSL) from the OpenSSL crew, version 4.0.3, dated 2026-09-29 β go get your SSL_CTX bestie, and remember to up_ref her if you're keeping her around π«Άβ¨π
π¦ where this page comes from
- ubuntu stonking: libssl-doc 4.0.3-1ubuntu1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms