aes_ecb.c 871 B

1234567891011121314151617181920212223242526272829303132
  1. /*
  2. * Copyright 2002-2020 The OpenSSL Project Authors. All Rights Reserved.
  3. *
  4. * Licensed under the Apache License 2.0 (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. #include <assert.h>
  10. /*
  11. * AES_encrypt/AES_decrypt are deprecated - but we need to use them to implement
  12. * AES_ecb_encrypt
  13. */
  14. #include "internal/deprecated.h"
  15. #include <openssl/aes.h>
  16. #include "aes_local.h"
  17. void AES_ecb_encrypt(const unsigned char *in, unsigned char *out,
  18. const AES_KEY *key, const int enc)
  19. {
  20. assert(in && out && key);
  21. assert((AES_ENCRYPT == enc) || (AES_DECRYPT == enc));
  22. if (AES_ENCRYPT == enc)
  23. AES_encrypt(in, out, key);
  24. else
  25. AES_decrypt(in, out, key);
  26. }