aria.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #include <contrib/libs/openssl/redef.h>
  2. /*
  3. * Copyright 2006-2018 The OpenSSL Project Authors. All Rights Reserved.
  4. * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
  5. *
  6. * Licensed under the OpenSSL license (the "License"). You may not use
  7. * this file except in compliance with the License. You can obtain a copy
  8. * in the file LICENSE in the source distribution or at
  9. * https://www.openssl.org/source/license.html
  10. */
  11. /* Copyright (c) 2017 National Security Research Institute. All rights reserved. */
  12. #ifndef OSSL_CRYPTO_ARIA_H
  13. # define OSSL_CRYPTO_ARIA_H
  14. # include <openssl/opensslconf.h>
  15. # ifdef OPENSSL_NO_ARIA
  16. # error ARIA is disabled.
  17. # endif
  18. # define ARIA_ENCRYPT 1
  19. # define ARIA_DECRYPT 0
  20. # define ARIA_BLOCK_SIZE 16 /* Size of each encryption/decryption block */
  21. # define ARIA_MAX_KEYS 17 /* Number of keys needed in the worst case */
  22. typedef union {
  23. unsigned char c[ARIA_BLOCK_SIZE];
  24. unsigned int u[ARIA_BLOCK_SIZE / sizeof(unsigned int)];
  25. } ARIA_u128;
  26. typedef unsigned char ARIA_c128[ARIA_BLOCK_SIZE];
  27. struct aria_key_st {
  28. ARIA_u128 rd_key[ARIA_MAX_KEYS];
  29. unsigned int rounds;
  30. };
  31. typedef struct aria_key_st ARIA_KEY;
  32. int aria_set_encrypt_key(const unsigned char *userKey, const int bits,
  33. ARIA_KEY *key);
  34. int aria_set_decrypt_key(const unsigned char *userKey, const int bits,
  35. ARIA_KEY *key);
  36. void aria_encrypt(const unsigned char *in, unsigned char *out,
  37. const ARIA_KEY *key);
  38. #endif