You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

blowfish.h 2.1 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. #ifndef OPENSSL_BLOWFISH_H
  10. #define OPENSSL_BLOWFISH_H
  11. #pragma once
  12. #include <openssl/macros.h>
  13. #ifndef OPENSSL_NO_DEPRECATED_3_0
  14. #define HEADER_BLOWFISH_H
  15. #endif
  16. #include <openssl/opensslconf.h>
  17. #ifndef OPENSSL_NO_BF
  18. #include <openssl/e_os2.h>
  19. #ifdef __cplusplus
  20. extern "C"
  21. {
  22. #endif
  23. #define BF_BLOCK 8
  24. #ifndef OPENSSL_NO_DEPRECATED_3_0
  25. #define BF_ENCRYPT 1
  26. #define BF_DECRYPT 0
  27. /*-
  28. * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  29. * ! BF_LONG has to be at least 32 bits wide. !
  30. * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  31. */
  32. #define BF_LONG unsigned int
  33. #define BF_ROUNDS 16
  34. typedef struct bf_key_st
  35. {
  36. BF_LONG P[BF_ROUNDS + 2];
  37. BF_LONG S[4 * 256];
  38. } BF_KEY;
  39. #endif /* OPENSSL_NO_DEPRECATED_3_0 */
  40. #ifndef OPENSSL_NO_DEPRECATED_3_0
  41. OSSL_DEPRECATEDIN_3_0 void BF_set_key(BF_KEY* key, int len, const unsigned char* data);
  42. OSSL_DEPRECATEDIN_3_0 void BF_encrypt(BF_LONG* data, const BF_KEY* key);
  43. OSSL_DEPRECATEDIN_3_0 void BF_decrypt(BF_LONG* data, const BF_KEY* key);
  44. OSSL_DEPRECATEDIN_3_0 void BF_ecb_encrypt(const unsigned char* in, unsigned char* out, const BF_KEY* key, int enc);
  45. OSSL_DEPRECATEDIN_3_0 void BF_cbc_encrypt(const unsigned char* in, unsigned char* out, long length, const BF_KEY* schedule, unsigned char* ivec, int enc);
  46. OSSL_DEPRECATEDIN_3_0 void BF_cfb64_encrypt(const unsigned char* in, unsigned char* out, long length, const BF_KEY* schedule, unsigned char* ivec, int* num, int enc);
  47. OSSL_DEPRECATEDIN_3_0 void BF_ofb64_encrypt(const unsigned char* in, unsigned char* out, long length, const BF_KEY* schedule, unsigned char* ivec, int* num);
  48. OSSL_DEPRECATEDIN_3_0 const char* BF_options(void);
  49. #endif
  50. #ifdef __cplusplus
  51. }
  52. #endif
  53. #endif
  54. #endif