Adapt existing SERIALIZER implementations to the redesigned interface
[openssl.git] / providers / fips / self_test.h
1 /*
2  * Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.
3  *
4  * Licensed under the OpenSSL license (the "License").  You may not use
5  * this file except in compliance with the License.  You can obtain a copy
6  * in the file LICENSE in the source distribution or at
7  * https://www.openssl.org/source/license.html
8  */
9
10 #include <openssl/core_numbers.h>
11 #include <openssl/types.h>
12 #include <openssl/self_test.h>
13
14 typedef struct self_test_post_params_st {
15     /* FIPS module integrity check parameters */
16     const char *module_filename;            /* Module file to perform MAC on */
17     const char *module_checksum_data;       /* Expected module MAC integrity */
18
19     /* Used for KAT install indicator integrity check */
20     const char *indicator_version;          /* version - for future proofing */
21     const char *indicator_data;             /* data to perform MAC on */
22     const char *indicator_checksum_data;    /* Expected MAC integrity value */
23
24     /* BIO callbacks supplied to the FIPS provider */
25     OSSL_BIO_new_file_fn *bio_new_file_cb;
26     OSSL_BIO_new_membuf_fn *bio_new_buffer_cb;
27     OSSL_BIO_read_ex_fn *bio_read_ex_cb;
28     OSSL_BIO_free_fn *bio_free_cb;
29     OSSL_CALLBACK *event_cb;
30     void *event_cb_arg;
31     OPENSSL_CTX *libctx;
32
33 } SELF_TEST_POST_PARAMS;
34
35 typedef struct st_event_st
36 {
37     /* local state variables */
38     const char *phase;
39     const char *type;
40     const char *desc;
41     OSSL_CALLBACK *cb;
42
43     /* callback related variables used to pass the state back to the user */
44     OSSL_PARAM params[4];
45     void *cb_arg;
46
47 } OSSL_ST_EVENT;
48
49 int SELF_TEST_post(SELF_TEST_POST_PARAMS *st, int on_demand_test);
50 int SELF_TEST_kats(OSSL_ST_EVENT *event, OPENSSL_CTX *libctx);
51
52 void SELF_TEST_EVENT_init(OSSL_ST_EVENT *ev, OSSL_CALLBACK *cb, void *cbarg);
53 void SELF_TEST_EVENT_onbegin(OSSL_ST_EVENT *ev, const char *type,
54                              const char *desc);
55 void SELF_TEST_EVENT_onend(OSSL_ST_EVENT *ev, int ret);
56 void SELF_TEST_EVENT_oncorrupt_byte(OSSL_ST_EVENT *ev, unsigned char *bytes);