aria.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * Copyright 2006-2017 The OpenSSL Project Authors. All Rights Reserved.
  3. * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
  4. *
  5. * Licensed under the OpenSSL license (the "License"). You may not use
  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. /* Copyright (c) 2017 National Security Research Institute. All rights reserved. */
  11. #ifndef HEADER_ARIA_H
  12. # define HEADER_ARIA_H
  13. # include <openssl/opensslconf.h>
  14. # ifdef OPENSSL_NO_ARIA
  15. # error ARIA is disabled.
  16. # endif
  17. # define ARIA_ENCRYPT 1
  18. # define ARIA_DECRYPT 0
  19. # define ARIA_BLOCK_SIZE 16 /* Size of each encryption/decryption block */
  20. # define ARIA_MAX_KEYS 17 /* Number of keys needed in the worst case */
  21. # ifdef __cplusplus
  22. extern "C" {
  23. # endif
  24. typedef union {
  25. unsigned char c[ARIA_BLOCK_SIZE];
  26. unsigned int u[ARIA_BLOCK_SIZE / sizeof(unsigned int)];
  27. } ARIA_u128;
  28. typedef unsigned char ARIA_c128[ARIA_BLOCK_SIZE];
  29. struct aria_key_st {
  30. ARIA_u128 rd_key[ARIA_MAX_KEYS];
  31. unsigned int rounds;
  32. };
  33. typedef struct aria_key_st ARIA_KEY;
  34. int aria_set_encrypt_key(const unsigned char *userKey, const int bits,
  35. ARIA_KEY *key);
  36. int aria_set_decrypt_key(const unsigned char *userKey, const int bits,
  37. ARIA_KEY *key);
  38. void aria_encrypt(const unsigned char *in, unsigned char *out,
  39. const ARIA_KEY *key);
  40. # ifdef __cplusplus
  41. }
  42. # endif
  43. #endif