2
0

rc5_ecb.c 933 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. * Copyright 1995-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. /*
  10. * RC5 low level APIs are deprecated for public use, but still ok for internal
  11. * use.
  12. */
  13. #include "internal/deprecated.h"
  14. #include <openssl/rc5.h>
  15. #include "rc5_local.h"
  16. #include <openssl/opensslv.h>
  17. void RC5_32_ecb_encrypt(const unsigned char *in, unsigned char *out,
  18. RC5_32_KEY *ks, int encrypt)
  19. {
  20. unsigned long l, d[2];
  21. c2l(in, l);
  22. d[0] = l;
  23. c2l(in, l);
  24. d[1] = l;
  25. if (encrypt)
  26. RC5_32_encrypt(d, ks);
  27. else
  28. RC5_32_decrypt(d, ks);
  29. l = d[0];
  30. l2c(l, out);
  31. l = d[1];
  32. l2c(l, out);
  33. l = d[0] = d[1] = 0;
  34. }