Coverage Report

Created: 2025-06-13 06:58

/src/openssl31/providers/implementations/ciphers/cipher_aria_ccm.c
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
/* Dispatch functions for ARIA CCM mode */
11
12
#include "cipher_aria_ccm.h"
13
#include "prov/implementations.h"
14
#include "prov/providercommon.h"
15
16
static OSSL_FUNC_cipher_freectx_fn aria_ccm_freectx;
17
18
static void *aria_ccm_newctx(void *provctx, size_t keybits)
19
0
{
20
0
    PROV_ARIA_CCM_CTX *ctx;
21
22
0
    if (!ossl_prov_is_running())
23
0
        return NULL;
24
25
0
    ctx = OPENSSL_zalloc(sizeof(*ctx));
26
0
    if (ctx != NULL)
27
0
        ossl_ccm_initctx(&ctx->base, keybits, ossl_prov_aria_hw_ccm(keybits));
28
0
    return ctx;
29
0
}
30
31
static void *aria_ccm_dupctx(void *provctx)
32
0
{
33
0
    PROV_ARIA_CCM_CTX *ctx = provctx;
34
0
    PROV_ARIA_CCM_CTX *dctx = NULL;
35
36
0
    if (ctx == NULL)
37
0
        return NULL;
38
39
0
    dctx = OPENSSL_memdup(ctx, sizeof(*ctx));
40
0
    if (dctx != NULL && dctx->base.ccm_ctx.key != NULL)
41
0
        dctx->base.ccm_ctx.key = &dctx->ks.ks;
42
43
0
    return dctx;
44
0
}
45
46
static void aria_ccm_freectx(void *vctx)
47
0
{
48
0
    PROV_ARIA_CCM_CTX *ctx = (PROV_ARIA_CCM_CTX *)vctx;
49
50
0
    OPENSSL_clear_free(ctx,  sizeof(*ctx));
51
0
}
52
53
/* aria128ccm functions */
54
IMPLEMENT_aead_cipher(aria, ccm, CCM, AEAD_FLAGS, 128, 8, 96);
55
/* aria192ccm functions */
56
IMPLEMENT_aead_cipher(aria, ccm, CCM, AEAD_FLAGS, 192, 8, 96);
57
/* aria256ccm functions */
58
IMPLEMENT_aead_cipher(aria, ccm, CCM, AEAD_FLAGS, 256, 8, 96);
59