/src/openssl30/providers/implementations/include/prov/ciphercommon_aead.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * Copyright 2019-2024 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 | 6.33M | #define UNINITIALISED_SIZET ((size_t)-1) |
11 | | |
12 | | #define AEAD_FLAGS (PROV_CIPHER_FLAG_AEAD | PROV_CIPHER_FLAG_CUSTOM_IV) |
13 | | |
14 | | #define IMPLEMENT_aead_cipher(alg, lc, UCMODE, flags, kbits, blkbits, ivbits) \ |
15 | | static OSSL_FUNC_cipher_get_params_fn alg##_##kbits##_##lc##_get_params; \ |
16 | 248k | static int alg##_##kbits##_##lc##_get_params(OSSL_PARAM params[]) \ |
17 | 248k | { \ |
18 | 248k | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ |
19 | 248k | flags, kbits, blkbits, ivbits); \ |
20 | 248k | } \ cipher_aes_ccm.c:aes_128_ccm_get_params Line | Count | Source | 16 | 62.1k | static int alg##_##kbits##_##lc##_get_params(OSSL_PARAM params[]) \ | 17 | 62.1k | { \ | 18 | 62.1k | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 19 | 62.1k | flags, kbits, blkbits, ivbits); \ | 20 | 62.1k | } \ |
cipher_aes_ccm.c:aes_192_ccm_get_params Line | Count | Source | 16 | 25 | static int alg##_##kbits##_##lc##_get_params(OSSL_PARAM params[]) \ | 17 | 25 | { \ | 18 | 25 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 19 | 25 | flags, kbits, blkbits, ivbits); \ | 20 | 25 | } \ |
cipher_aes_ccm.c:aes_256_ccm_get_params Line | Count | Source | 16 | 62.1k | static int alg##_##kbits##_##lc##_get_params(OSSL_PARAM params[]) \ | 17 | 62.1k | { \ | 18 | 62.1k | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 19 | 62.1k | flags, kbits, blkbits, ivbits); \ | 20 | 62.1k | } \ |
cipher_aes_gcm.c:aes_128_gcm_get_params Line | Count | Source | 16 | 31.0k | static int alg##_##kbits##_##lc##_get_params(OSSL_PARAM params[]) \ | 17 | 31.0k | { \ | 18 | 31.0k | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 19 | 31.0k | flags, kbits, blkbits, ivbits); \ | 20 | 31.0k | } \ |
cipher_aes_gcm.c:aes_192_gcm_get_params Line | Count | Source | 16 | 25 | static int alg##_##kbits##_##lc##_get_params(OSSL_PARAM params[]) \ | 17 | 25 | { \ | 18 | 25 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 19 | 25 | flags, kbits, blkbits, ivbits); \ | 20 | 25 | } \ |
cipher_aes_gcm.c:aes_256_gcm_get_params Line | Count | Source | 16 | 31.0k | static int alg##_##kbits##_##lc##_get_params(OSSL_PARAM params[]) \ | 17 | 31.0k | { \ | 18 | 31.0k | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 19 | 31.0k | flags, kbits, blkbits, ivbits); \ | 20 | 31.0k | } \ |
cipher_aria_ccm.c:aria_128_ccm_get_params Line | Count | Source | 16 | 25 | static int alg##_##kbits##_##lc##_get_params(OSSL_PARAM params[]) \ | 17 | 25 | { \ | 18 | 25 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 19 | 25 | flags, kbits, blkbits, ivbits); \ | 20 | 25 | } \ |
cipher_aria_ccm.c:aria_192_ccm_get_params Line | Count | Source | 16 | 25 | static int alg##_##kbits##_##lc##_get_params(OSSL_PARAM params[]) \ | 17 | 25 | { \ | 18 | 25 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 19 | 25 | flags, kbits, blkbits, ivbits); \ | 20 | 25 | } \ |
cipher_aria_ccm.c:aria_256_ccm_get_params Line | Count | Source | 16 | 25 | static int alg##_##kbits##_##lc##_get_params(OSSL_PARAM params[]) \ | 17 | 25 | { \ | 18 | 25 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 19 | 25 | flags, kbits, blkbits, ivbits); \ | 20 | 25 | } \ |
cipher_aria_gcm.c:aria_128_gcm_get_params Line | Count | Source | 16 | 31.0k | static int alg##_##kbits##_##lc##_get_params(OSSL_PARAM params[]) \ | 17 | 31.0k | { \ | 18 | 31.0k | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 19 | 31.0k | flags, kbits, blkbits, ivbits); \ | 20 | 31.0k | } \ |
cipher_aria_gcm.c:aria_192_gcm_get_params Line | Count | Source | 16 | 25 | static int alg##_##kbits##_##lc##_get_params(OSSL_PARAM params[]) \ | 17 | 25 | { \ | 18 | 25 | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 19 | 25 | flags, kbits, blkbits, ivbits); \ | 20 | 25 | } \ |
cipher_aria_gcm.c:aria_256_gcm_get_params Line | Count | Source | 16 | 31.0k | static int alg##_##kbits##_##lc##_get_params(OSSL_PARAM params[]) \ | 17 | 31.0k | { \ | 18 | 31.0k | return ossl_cipher_generic_get_params(params, EVP_CIPH_##UCMODE##_MODE, \ | 19 | 31.0k | flags, kbits, blkbits, ivbits); \ | 20 | 31.0k | } \ |
|
21 | | static OSSL_FUNC_cipher_newctx_fn alg##kbits##lc##_newctx; \ |
22 | 226k | static void * alg##kbits##lc##_newctx(void *provctx) \ |
23 | 226k | { \ |
24 | 226k | return alg##_##lc##_newctx(provctx, kbits); \ |
25 | 226k | } \ cipher_aes_ccm.c:aes128ccm_newctx Line | Count | Source | 22 | 341 | static void * alg##kbits##lc##_newctx(void *provctx) \ | 23 | 341 | { \ | 24 | 341 | return alg##_##lc##_newctx(provctx, kbits); \ | 25 | 341 | } \ |
Unexecuted instantiation: cipher_aes_ccm.c:aes192ccm_newctx cipher_aes_ccm.c:aes256ccm_newctx Line | Count | Source | 22 | 216 | static void * alg##kbits##lc##_newctx(void *provctx) \ | 23 | 216 | { \ | 24 | 216 | return alg##_##lc##_newctx(provctx, kbits); \ | 25 | 216 | } \ |
cipher_aes_gcm.c:aes128gcm_newctx Line | Count | Source | 22 | 152k | static void * alg##kbits##lc##_newctx(void *provctx) \ | 23 | 152k | { \ | 24 | 152k | return alg##_##lc##_newctx(provctx, kbits); \ | 25 | 152k | } \ |
Unexecuted instantiation: cipher_aes_gcm.c:aes192gcm_newctx cipher_aes_gcm.c:aes256gcm_newctx Line | Count | Source | 22 | 72.6k | static void * alg##kbits##lc##_newctx(void *provctx) \ | 23 | 72.6k | { \ | 24 | 72.6k | return alg##_##lc##_newctx(provctx, kbits); \ | 25 | 72.6k | } \ |
Unexecuted instantiation: cipher_aria_ccm.c:aria128ccm_newctx Unexecuted instantiation: cipher_aria_ccm.c:aria192ccm_newctx Unexecuted instantiation: cipher_aria_ccm.c:aria256ccm_newctx cipher_aria_gcm.c:aria128gcm_newctx Line | Count | Source | 22 | 483 | static void * alg##kbits##lc##_newctx(void *provctx) \ | 23 | 483 | { \ | 24 | 483 | return alg##_##lc##_newctx(provctx, kbits); \ | 25 | 483 | } \ |
Unexecuted instantiation: cipher_aria_gcm.c:aria192gcm_newctx cipher_aria_gcm.c:aria256gcm_newctx Line | Count | Source | 22 | 382 | static void * alg##kbits##lc##_newctx(void *provctx) \ | 23 | 382 | { \ | 24 | 382 | return alg##_##lc##_newctx(provctx, kbits); \ | 25 | 382 | } \ |
|
26 | 0 | static void * alg##kbits##lc##_dupctx(void *src) \ |
27 | 0 | { \ |
28 | 0 | return alg##_##lc##_dupctx(src); \ |
29 | 0 | } \ Unexecuted instantiation: cipher_aes_ccm.c:aes128ccm_dupctx Unexecuted instantiation: cipher_aes_ccm.c:aes192ccm_dupctx Unexecuted instantiation: cipher_aes_ccm.c:aes256ccm_dupctx Unexecuted instantiation: cipher_aes_gcm.c:aes128gcm_dupctx Unexecuted instantiation: cipher_aes_gcm.c:aes192gcm_dupctx Unexecuted instantiation: cipher_aes_gcm.c:aes256gcm_dupctx Unexecuted instantiation: cipher_aria_ccm.c:aria128ccm_dupctx Unexecuted instantiation: cipher_aria_ccm.c:aria192ccm_dupctx Unexecuted instantiation: cipher_aria_ccm.c:aria256ccm_dupctx Unexecuted instantiation: cipher_aria_gcm.c:aria128gcm_dupctx Unexecuted instantiation: cipher_aria_gcm.c:aria192gcm_dupctx Unexecuted instantiation: cipher_aria_gcm.c:aria256gcm_dupctx |
30 | | const OSSL_DISPATCH ossl_##alg##kbits##lc##_functions[] = { \ |
31 | | { OSSL_FUNC_CIPHER_NEWCTX, (void (*)(void))alg##kbits##lc##_newctx }, \ |
32 | | { OSSL_FUNC_CIPHER_FREECTX, (void (*)(void))alg##_##lc##_freectx }, \ |
33 | | { OSSL_FUNC_CIPHER_DUPCTX, (void (*)(void))alg##kbits##lc##_dupctx }, \ |
34 | | { OSSL_FUNC_CIPHER_ENCRYPT_INIT, (void (*)(void))ossl_##lc##_einit }, \ |
35 | | { OSSL_FUNC_CIPHER_DECRYPT_INIT, (void (*)(void))ossl_##lc##_dinit }, \ |
36 | | { OSSL_FUNC_CIPHER_UPDATE, (void (*)(void))ossl_##lc##_stream_update }, \ |
37 | | { OSSL_FUNC_CIPHER_FINAL, (void (*)(void))ossl_##lc##_stream_final }, \ |
38 | | { OSSL_FUNC_CIPHER_CIPHER, (void (*)(void))ossl_##lc##_cipher }, \ |
39 | | { OSSL_FUNC_CIPHER_GET_PARAMS, \ |
40 | | (void (*)(void)) alg##_##kbits##_##lc##_get_params }, \ |
41 | | { OSSL_FUNC_CIPHER_GET_CTX_PARAMS, \ |
42 | | (void (*)(void)) ossl_##lc##_get_ctx_params }, \ |
43 | | { OSSL_FUNC_CIPHER_SET_CTX_PARAMS, \ |
44 | | (void (*)(void)) ossl_##lc##_set_ctx_params }, \ |
45 | | { OSSL_FUNC_CIPHER_GETTABLE_PARAMS, \ |
46 | | (void (*)(void))ossl_cipher_generic_gettable_params }, \ |
47 | | { OSSL_FUNC_CIPHER_GETTABLE_CTX_PARAMS, \ |
48 | | (void (*)(void))ossl_cipher_aead_gettable_ctx_params }, \ |
49 | | { OSSL_FUNC_CIPHER_SETTABLE_CTX_PARAMS, \ |
50 | | (void (*)(void))ossl_cipher_aead_settable_ctx_params }, \ |
51 | | { 0, NULL } \ |
52 | | } |