]> git.ipfire.org Git - thirdparty/openssl.git/blame - providers/common/ciphers/cipher_aria.c
Fix Issue OSS-Fuzz: Branch on uninitialized memory (in ccm code).
[thirdparty/openssl.git] / providers / common / ciphers / cipher_aria.c
CommitLineData
e1178600
SL
1/*
2 * Copyright 2019 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 cipher modes ecb, cbc, ofb, cfb, ctr */
11
12#include "cipher_locl.h"
13
14static OSSL_OP_cipher_freectx_fn aria_freectx;
15static OSSL_OP_cipher_dupctx_fn aria_dupctx;
16
17static void aria_freectx(void *vctx)
18{
19 PROV_ARIA_CTX *ctx = (PROV_ARIA_CTX *)vctx;
20
21 OPENSSL_clear_free(ctx, sizeof(*ctx));
22}
23
24static void *aria_dupctx(void *ctx)
25{
26 PROV_ARIA_CTX *in = (PROV_ARIA_CTX *)ctx;
27 PROV_ARIA_CTX *ret = OPENSSL_malloc(sizeof(*ret));
28
29 if (ret == NULL) {
30 ERR_raise(ERR_LIB_PROV, ERR_R_MALLOC_FAILURE);
31 return NULL;
32 }
33 *ret = *in;
34
35 return ret;
36}
37
38/* aria256ecb_functions */
39IMPLEMENT_generic_cipher(aria, ARIA, ecb, ECB, 0, 256, 128, 0, block)
40/* aria192ecb_functions */
41IMPLEMENT_generic_cipher(aria, ARIA, ecb, ECB, 0, 192, 128, 0, block)
42/* aria128ecb_functions */
43IMPLEMENT_generic_cipher(aria, ARIA, ecb, ECB, 0, 128, 128, 0, block)
44/* aria256cbc_functions */
45IMPLEMENT_generic_cipher(aria, ARIA, cbc, CBC, 0, 256, 128, 128, block)
46/* aria192cbc_functions */
47IMPLEMENT_generic_cipher(aria, ARIA, cbc, CBC, 0, 192, 128, 128, block)
48/* aria128cbc_functions */
49IMPLEMENT_generic_cipher(aria, ARIA, cbc, CBC, 0, 128, 128, 128, block)
50/* aria256ofb_functions */
51IMPLEMENT_generic_cipher(aria, ARIA, ofb, OFB, 0, 256, 8, 128, stream)
52/* aria192ofb_functions */
53IMPLEMENT_generic_cipher(aria, ARIA, ofb, OFB, 0, 192, 8, 128, stream)
54/* aria128ofb_functions */
55IMPLEMENT_generic_cipher(aria, ARIA, ofb, OFB, 0, 128, 8, 128, stream)
56/* aria256cfb_functions */
57IMPLEMENT_generic_cipher(aria, ARIA, cfb, CFB, 0, 256, 8, 128, stream)
58/* aria192cfb_functions */
59IMPLEMENT_generic_cipher(aria, ARIA, cfb, CFB, 0, 192, 8, 128, stream)
60/* aria128cfb_functions */
61IMPLEMENT_generic_cipher(aria, ARIA, cfb, CFB, 0, 128, 8, 128, stream)
62/* aria256cfb1_functions */
63IMPLEMENT_generic_cipher(aria, ARIA, cfb1, CFB, 0, 256, 8, 128, stream)
64/* aria192cfb1_functions */
65IMPLEMENT_generic_cipher(aria, ARIA, cfb1, CFB, 0, 192, 8, 128, stream)
66/* aria128cfb1_functions */
67IMPLEMENT_generic_cipher(aria, ARIA, cfb1, CFB, 0, 128, 8, 128, stream)
68/* aria256cfb8_functions */
69IMPLEMENT_generic_cipher(aria, ARIA, cfb8, CFB, 0, 256, 8, 128, stream)
70/* aria192cfb8_functions */
71IMPLEMENT_generic_cipher(aria, ARIA, cfb8, CFB, 0, 192, 8, 128, stream)
72/* aria128cfb8_functions */
73IMPLEMENT_generic_cipher(aria, ARIA, cfb8, CFB, 0, 128, 8, 128, stream)
74/* aria256ctr_functions */
75IMPLEMENT_generic_cipher(aria, ARIA, ctr, CTR, 0, 256, 8, 128, stream)
76/* aria192ctr_functions */
77IMPLEMENT_generic_cipher(aria, ARIA, ctr, CTR, 0, 192, 8, 128, stream)
78/* aria128ctr_functions */
79IMPLEMENT_generic_cipher(aria, ARIA, ctr, CTR, 0, 128, 8, 128, stream)