1=pod 2 3=head1 NAME 4 5OSSL_INDICATOR_set_callback, 6OSSL_INDICATOR_get_callback - specify a callback for FIPS indicators 7 8=head1 SYNOPSIS 9 10 #include <openssl/indicator.h> 11 12typedef int (OSSL_INDICATOR_CALLBACK)(const char *type, const char *desc, 13 const OSSL_PARAM params[]); 14 15 void OSSL_INDICATOR_set_callback(OSSL_LIB_CTX *libctx, 16 OSSL_INDICATOR_CALLBACK *cb); 17 void OSSL_INDICATOR_get_callback(OSSL_LIB_CTX *libctx, 18 OSSL_INDICATOR_CALLBACK **cb); 19 20=head1 DESCRIPTION 21 22OSSL_INDICATOR_set_callback() sets a user callback I<cb> associated with a 23I<libctx> that will be called when a non approved FIPS operation is detected. 24 25The user's callback may be triggered multiple times during an algorithm operation 26to indicate different approved mode checks have failed. 27 28Non approved operations may only occur if the user has deliberately chosen to do 29so (either by setting a global FIPS configuration option or via an option in an 30algorithm's operation context). 31 32The user's callback B<OSSL_INDICATOR_CALLBACK> I<type> and I<desc> 33contain the algorithm type and operation that is not approved. 34I<params> is not currently used. 35 36If the user callback returns 0, an error will occur in the caller. This can be 37used for testing purposes. 38 39=head1 RETURN VALUES 40 41OSSL_INDICATOR_get_callback() returns the callback that has been set via 42OSSL_INDICATOR_set_callback() for the given library context I<libctx>, or NULL 43if no callback is currently set. 44 45=head1 EXAMPLES 46 47A simple indicator callback to log non approved FIPS operations 48 49 static int indicator_cb(const char *type, const char *desc, 50 const OSSL_PARAM params[]) 51 { 52 if (type != NULL && desc != NULL) 53 fprintf(stdout, "%s %s is not approved\n", type, desc); 54end: 55 /* For Testing purposes you could return 0 here to cause an error */ 56 return 1; 57 } 58 59 OSSL_INDICATOR_set_callback(libctx, indicator_cb); 60 61 62=head1 SEE ALSO 63 64L<openssl-core.h(7)>, 65L<OSSL_PROVIDER-FIPS(7)> 66L<OSSL_LIB_CTX(3)> 67 68=head1 HISTORY 69 70The functions described here were added in OpenSSL 3.4. 71 72=head1 COPYRIGHT 73 74Copyright 2024 The OpenSSL Project Authors. All Rights Reserved. 75 76Licensed under the Apache License 2.0 (the "License"). You may not use 77this file except in compliance with the License. You can obtain a copy 78in the file LICENSE in the source distribution or at 79L<https://www.openssl.org/source/license.html>. 80 81=cut 82