]>
Commit | Line | Data |
---|---|---|
d42d0a4d | 1 | /* |
a28d06f3 | 2 | * Copyright 2006-2021 The OpenSSL Project Authors. All Rights Reserved. |
5aba2b6e | 3 | * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. |
d42d0a4d | 4 | * |
48f4ad77 | 5 | * Licensed under the Apache License 2.0 (the "License"). You may not use |
d42d0a4d P |
6 | * this file except in compliance with the License. You can obtain a copy |
7 | * in the file LICENSE in the source distribution or at | |
8 | * https://www.openssl.org/source/license.html | |
9 | */ | |
10 | ||
46f4e1be | 11 | /* Copyright (c) 2017 National Security Research Institute. All rights reserved. */ |
dc99b885 | 12 | |
ae4186b0 DMSP |
13 | #ifndef OSSL_CRYPTO_ARIA_H |
14 | # define OSSL_CRYPTO_ARIA_H | |
80ce21fe | 15 | # pragma once |
d42d0a4d P |
16 | |
17 | # include <openssl/opensslconf.h> | |
18 | ||
19 | # ifdef OPENSSL_NO_ARIA | |
20 | # error ARIA is disabled. | |
21 | # endif | |
22 | ||
d42d0a4d P |
23 | # define ARIA_ENCRYPT 1 |
24 | # define ARIA_DECRYPT 0 | |
25 | ||
46f4e1be | 26 | # define ARIA_BLOCK_SIZE 16 /* Size of each encryption/decryption block */ |
d42d0a4d P |
27 | # define ARIA_MAX_KEYS 17 /* Number of keys needed in the worst case */ |
28 | ||
dc99b885 | 29 | typedef union { |
30 | unsigned char c[ARIA_BLOCK_SIZE]; | |
31 | unsigned int u[ARIA_BLOCK_SIZE / sizeof(unsigned int)]; | |
32 | } ARIA_u128; | |
d42d0a4d | 33 | |
f83409a6 AP |
34 | typedef unsigned char ARIA_c128[ARIA_BLOCK_SIZE]; |
35 | ||
d42d0a4d | 36 | struct aria_key_st { |
d42d0a4d | 37 | ARIA_u128 rd_key[ARIA_MAX_KEYS]; |
dc99b885 | 38 | unsigned int rounds; |
d42d0a4d P |
39 | }; |
40 | typedef struct aria_key_st ARIA_KEY; | |
41 | ||
42 | ||
43 | int aria_set_encrypt_key(const unsigned char *userKey, const int bits, | |
44 | ARIA_KEY *key); | |
45 | int aria_set_decrypt_key(const unsigned char *userKey, const int bits, | |
46 | ARIA_KEY *key); | |
47 | ||
48 | void aria_encrypt(const unsigned char *in, unsigned char *out, | |
49 | const ARIA_KEY *key); | |
50 | ||
d42d0a4d | 51 | #endif |