gnutls_certifi...equest_function(3)

πŸ’– NAME πŸ’–

gnutls_certificate_set_ocsp_status_request_function β€” bestie, it's an API function, and it's giving "server side OCSP callback registration" ✨

This one lives in the gnutls manual, page gnutls_certifi...equest_function(3), and yes the name is a whole mouthful, we're gonna get through it together 🫢


🌸 SYNOPSIS 🌸

#include <gnutls/gnutls.h>

void
gnutls_certificate_set_ocsp_status_request_function(gnutls_certificate_credentials_t
sc, gnutls_status_request_ocsp_func ocsp_func, void * ptr);

okay so literally just three things go in and nothing comes back out (it's void, she's mysterious like that πŸ’…).


πŸŽ€ ARGUMENTS πŸŽ€

  • gnutls_certificate_credentials_t sc β€” this is a gnutls_certificate_credentials_t type. that's it, that's the vibe, it's the credentials object you're attaching this callback to πŸ’–
  • gnutls_status_request_ocsp_func ocsp_func β€” a function pointer to the OCSP status request callback. like, you're handing over a whole function, main character energy fr 🌟
  • void * ptr β€” an opaque pointer that gets passed to the callback function. opaque meaning don't overthink it, it's just your little secret payload 🎁

✨ DESCRIPTION ✨

okay so this function is for the server to register a callback that handles OCSP status requests coming from the client. the callback gets invoked when the client supplied a status-request OCSP extension. no extension, no callback, simple as that πŸ¦‹

the callback function prototype is, and I need you to look at this exactly:

typedef int (*gnutls_status_request_ocsp_func) (gnutls_session_t
session, void *ptr, gnutls_datum_t *ocsp_response);

so the callback will be invoked if the client requests an OCSP certificate status. and here's the important part bestie, the callback may return GNUTLS_E_NO_CERTIFICATE_STATUS if there's no recent OCSP response. that's a totally valid move, no shame πŸ’œ

if the callback returns GNUTLS_E_SUCCESS, then it's expected to have the ocsp_response field set with a valid (DER-encoded) OCSP response. and listen β€” the response must be a value allocated using gnutls_malloc(), and it will be deinitialized by the caller. so don't you dare free() it yourself, the caller handles that, we don't do double frees in this house πŸ™ˆ

and if you're like "but I want a different callback for each certificate", oh you can, it's possible to set a specific callback for each provided certificate using gnutls_certificate_set_ocsp_status_request_function2(). per-cert customization, we love to see it πŸ‘‘


⭐ SINCE ⭐

3.1.3 β€” vintage, but still iconic πŸ’…


😭 REPORTING BUGS 😭

found a bug? tell the gnutls girlies:


Copyright Β© 2001-2023 Free Software Foundation, Inc., and others.

Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved.


🌈 SEE ALSO 🌈

The full documentation for gnutls is maintained as a Texinfo manual. If the /usr/share/doc/gnutls/ directory does not contain the HTML form visit

https://www.gnutls.org/manual/


and that's the whole page bestie, no notes, you ate πŸ“ this was gnutls version 3.8.13, page gnutls_certifi...equest_function(3) β€” go register that callback, you got this πŸ’–βœ¨

πŸ“¦ where this page comes from