4d37189ae4521c1d7a38152ad72f745e3d0524eb
[openssl.git] / crypto / include / internal / aria.h
1 /*
2  * Copyright 2006-2017 The OpenSSL Project Authors. All Rights Reserved.
3  *
4  * Licensed under the OpenSSL license (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 /* ====================================================================
11  * Copyright (c) 2017 Oracle and/or its affiliates.  All rights reserved.
12  */
13
14 #ifndef HEADER_ARIA_H
15 # define HEADER_ARIA_H
16
17 # include <openssl/opensslconf.h>
18
19 # ifdef OPENSSL_NO_ARIA
20 #  error ARIA is disabled.
21 # endif
22
23 # include <stddef.h>
24
25 # define ARIA_ENCRYPT     1
26 # define ARIA_DECRYPT     0
27
28 # define ARIA_BLOCK_SIZE    16  /* Size of each encryption/decription block */
29 # define ARIA_MAX_KEYS      17  /* Number of keys needed in the worst case  */
30
31 # ifdef  __cplusplus
32 extern "C" {
33 # endif
34
35 typedef unsigned char ARIA_u128[ARIA_BLOCK_SIZE];
36
37 struct aria_key_st {
38     unsigned int rounds;
39     ARIA_u128 rd_key[ARIA_MAX_KEYS];
40 };
41 typedef struct aria_key_st ARIA_KEY;
42
43
44 int aria_set_encrypt_key(const unsigned char *userKey, const int bits,
45                          ARIA_KEY *key);
46 int aria_set_decrypt_key(const unsigned char *userKey, const int bits,
47                          ARIA_KEY *key);
48
49 void aria_encrypt(const unsigned char *in, unsigned char *out,
50                   const ARIA_KEY *key);
51
52 # ifdef  __cplusplus
53 }
54 # endif
55
56 #endif