2
0

c_ecb.c 920 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. * Copyright 1995-2016 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. /*
  10. * CAST low level APIs are deprecated for public use, but still ok for
  11. * internal use.
  12. */
  13. #include "internal/deprecated.h"
  14. #include <openssl/cast.h>
  15. #include "cast_local.h"
  16. #include <openssl/opensslv.h>
  17. void CAST_ecb_encrypt(const unsigned char *in, unsigned char *out,
  18. const CAST_KEY *ks, int enc)
  19. {
  20. CAST_LONG l, d[2];
  21. n2l(in, l);
  22. d[0] = l;
  23. n2l(in, l);
  24. d[1] = l;
  25. if (enc)
  26. CAST_encrypt(d, ks);
  27. else
  28. CAST_decrypt(d, ks);
  29. l = d[0];
  30. l2n(l, out);
  31. l = d[1];
  32. l2n(l, out);
  33. l = d[0] = d[1] = 0;
  34. }