pwd2key.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. ---------------------------------------------------------------------------
  3. Copyright (c) 1998-2010, Brian Gladman, Worcester, UK. All rights reserved.
  4. The redistribution and use of this software (with or without changes)
  5. is allowed without the payment of fees or royalties provided that:
  6. source code distributions include the above copyright notice, this
  7. list of conditions and the following disclaimer;
  8. binary distributions include the above copyright notice, this list
  9. of conditions and the following disclaimer in their documentation.
  10. This software is provided 'as is' with no explicit or implied warranties
  11. in respect of its operation, including, but not limited to, correctness
  12. and fitness for purpose.
  13. ---------------------------------------------------------------------------
  14. Issue Date: 20/12/2007
  15. This is an implementation of RFC2898, which specifies key derivation from
  16. a password and a salt value.
  17. */
  18. #ifndef PWD2KEY_H
  19. #define PWD2KEY_H
  20. #if defined(__cplusplus)
  21. extern "C"
  22. {
  23. #endif
  24. void derive_key(
  25. const unsigned char pwd[], /* the PASSWORD, and */
  26. unsigned int pwd_len, /* its length */
  27. const unsigned char salt[], /* the SALT and its */
  28. unsigned int salt_len, /* length */
  29. unsigned int iter, /* the number of iterations */
  30. unsigned char key[], /* space for the output key */
  31. unsigned int key_len); /* and its required length */
  32. #if defined(__cplusplus)
  33. }
  34. #endif
  35. #endif