1 | /*
|
---|
2 | * Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.
|
---|
3 | *
|
---|
4 | * Licensed under the Apache License 2.0 (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 | #ifndef OPENSSL_SELF_TEST_H
|
---|
11 | # define OPENSSL_SELF_TEST_H
|
---|
12 | # pragma once
|
---|
13 |
|
---|
14 | # include <openssl/core.h> /* OSSL_CALLBACK */
|
---|
15 |
|
---|
16 | # ifdef __cplusplus
|
---|
17 | extern "C" {
|
---|
18 | # endif
|
---|
19 |
|
---|
20 | /* The test event phases */
|
---|
21 | # define OSSL_SELF_TEST_PHASE_NONE "None"
|
---|
22 | # define OSSL_SELF_TEST_PHASE_START "Start"
|
---|
23 | # define OSSL_SELF_TEST_PHASE_CORRUPT "Corrupt"
|
---|
24 | # define OSSL_SELF_TEST_PHASE_PASS "Pass"
|
---|
25 | # define OSSL_SELF_TEST_PHASE_FAIL "Fail"
|
---|
26 |
|
---|
27 | /* Test event categories */
|
---|
28 | # define OSSL_SELF_TEST_TYPE_NONE "None"
|
---|
29 | # define OSSL_SELF_TEST_TYPE_MODULE_INTEGRITY "Module_Integrity"
|
---|
30 | # define OSSL_SELF_TEST_TYPE_INSTALL_INTEGRITY "Install_Integrity"
|
---|
31 | # define OSSL_SELF_TEST_TYPE_CRNG "Continuous_RNG_Test"
|
---|
32 | # define OSSL_SELF_TEST_TYPE_PCT "Conditional_PCT"
|
---|
33 | # define OSSL_SELF_TEST_TYPE_PCT_KAT "Conditional_KAT"
|
---|
34 | # define OSSL_SELF_TEST_TYPE_KAT_INTEGRITY "KAT_Integrity"
|
---|
35 | # define OSSL_SELF_TEST_TYPE_KAT_CIPHER "KAT_Cipher"
|
---|
36 | # define OSSL_SELF_TEST_TYPE_KAT_ASYM_CIPHER "KAT_AsymmetricCipher"
|
---|
37 | # define OSSL_SELF_TEST_TYPE_KAT_DIGEST "KAT_Digest"
|
---|
38 | # define OSSL_SELF_TEST_TYPE_KAT_SIGNATURE "KAT_Signature"
|
---|
39 | # define OSSL_SELF_TEST_TYPE_PCT_SIGNATURE "PCT_Signature"
|
---|
40 | # define OSSL_SELF_TEST_TYPE_KAT_KDF "KAT_KDF"
|
---|
41 | # define OSSL_SELF_TEST_TYPE_KAT_KA "KAT_KA"
|
---|
42 | # define OSSL_SELF_TEST_TYPE_DRBG "DRBG"
|
---|
43 |
|
---|
44 | /* Test event sub categories */
|
---|
45 | # define OSSL_SELF_TEST_DESC_NONE "None"
|
---|
46 | # define OSSL_SELF_TEST_DESC_INTEGRITY_HMAC "HMAC"
|
---|
47 | # define OSSL_SELF_TEST_DESC_PCT_RSA_PKCS1 "RSA"
|
---|
48 | # define OSSL_SELF_TEST_DESC_PCT_ECDSA "ECDSA"
|
---|
49 | # define OSSL_SELF_TEST_DESC_PCT_DSA "DSA"
|
---|
50 | # define OSSL_SELF_TEST_DESC_CIPHER_AES_GCM "AES_GCM"
|
---|
51 | # define OSSL_SELF_TEST_DESC_CIPHER_AES_ECB "AES_ECB_Decrypt"
|
---|
52 | # define OSSL_SELF_TEST_DESC_CIPHER_TDES "TDES"
|
---|
53 | # define OSSL_SELF_TEST_DESC_ASYM_RSA_ENC "RSA_Encrypt"
|
---|
54 | # define OSSL_SELF_TEST_DESC_ASYM_RSA_DEC "RSA_Decrypt"
|
---|
55 | # define OSSL_SELF_TEST_DESC_MD_SHA1 "SHA1"
|
---|
56 | # define OSSL_SELF_TEST_DESC_MD_SHA2 "SHA2"
|
---|
57 | # define OSSL_SELF_TEST_DESC_MD_SHA3 "SHA3"
|
---|
58 | # define OSSL_SELF_TEST_DESC_SIGN_DSA "DSA"
|
---|
59 | # define OSSL_SELF_TEST_DESC_SIGN_RSA "RSA"
|
---|
60 | # define OSSL_SELF_TEST_DESC_SIGN_ECDSA "ECDSA"
|
---|
61 | # define OSSL_SELF_TEST_DESC_DRBG_CTR "CTR"
|
---|
62 | # define OSSL_SELF_TEST_DESC_DRBG_HASH "HASH"
|
---|
63 | # define OSSL_SELF_TEST_DESC_DRBG_HMAC "HMAC"
|
---|
64 | # define OSSL_SELF_TEST_DESC_KA_DH "DH"
|
---|
65 | # define OSSL_SELF_TEST_DESC_KA_ECDH "ECDH"
|
---|
66 | # define OSSL_SELF_TEST_DESC_KDF_HKDF "HKDF"
|
---|
67 | # define OSSL_SELF_TEST_DESC_KDF_SSKDF "SSKDF"
|
---|
68 | # define OSSL_SELF_TEST_DESC_KDF_X963KDF "X963KDF"
|
---|
69 | # define OSSL_SELF_TEST_DESC_KDF_X942KDF "X942KDF"
|
---|
70 | # define OSSL_SELF_TEST_DESC_KDF_PBKDF2 "PBKDF2"
|
---|
71 | # define OSSL_SELF_TEST_DESC_KDF_SSHKDF "SSHKDF"
|
---|
72 | # define OSSL_SELF_TEST_DESC_KDF_TLS12_PRF "TLS12_PRF"
|
---|
73 | # define OSSL_SELF_TEST_DESC_KDF_KBKDF "KBKDF"
|
---|
74 | # define OSSL_SELF_TEST_DESC_KDF_TLS13_EXTRACT "TLS13_KDF_EXTRACT"
|
---|
75 | # define OSSL_SELF_TEST_DESC_KDF_TLS13_EXPAND "TLS13_KDF_EXPAND"
|
---|
76 | # define OSSL_SELF_TEST_DESC_RNG "RNG"
|
---|
77 |
|
---|
78 | void OSSL_SELF_TEST_set_callback(OSSL_LIB_CTX *libctx, OSSL_CALLBACK *cb,
|
---|
79 | void *cbarg);
|
---|
80 | void OSSL_SELF_TEST_get_callback(OSSL_LIB_CTX *libctx, OSSL_CALLBACK **cb,
|
---|
81 | void **cbarg);
|
---|
82 |
|
---|
83 | OSSL_SELF_TEST *OSSL_SELF_TEST_new(OSSL_CALLBACK *cb, void *cbarg);
|
---|
84 | void OSSL_SELF_TEST_free(OSSL_SELF_TEST *st);
|
---|
85 |
|
---|
86 | void OSSL_SELF_TEST_onbegin(OSSL_SELF_TEST *st, const char *type,
|
---|
87 | const char *desc);
|
---|
88 | int OSSL_SELF_TEST_oncorrupt_byte(OSSL_SELF_TEST *st, unsigned char *bytes);
|
---|
89 | void OSSL_SELF_TEST_onend(OSSL_SELF_TEST *st, int ret);
|
---|
90 |
|
---|
91 | # ifdef __cplusplus
|
---|
92 | }
|
---|
93 | # endif
|
---|
94 | #endif /* OPENSSL_SELF_TEST_H */
|
---|