2
0

aria.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. * Copyright 2006-2021 The OpenSSL Project Authors. All Rights Reserved.
  3. * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
  4. *
  5. * Licensed under the Apache License 2.0 (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 OSSL_CRYPTO_ARIA_H
  12. # define OSSL_CRYPTO_ARIA_H
  13. # pragma once
  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 ossl_aria_set_encrypt_key(const unsigned char *userKey, const int bits,
  33. ARIA_KEY *key);
  34. int ossl_aria_set_decrypt_key(const unsigned char *userKey, const int bits,
  35. ARIA_KEY *key);
  36. void ossl_aria_encrypt(const unsigned char *in, unsigned char *out,
  37. const ARIA_KEY *key);
  38. #endif