pwd2key.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. ---------------------------------------------------------------------------
  3. Copyright (c) 2002, Dr Brian Gladman, Worcester, UK. All rights reserved.
  4. LICENSE TERMS
  5. The free distribution and use of this software in both source and binary
  6. form is allowed (with or without changes) provided that:
  7. 1. distributions of this source code include the above copyright
  8. notice, this list of conditions and the following disclaimer;
  9. 2. distributions in binary form include the above copyright
  10. notice, this list of conditions and the following disclaimer
  11. in the documentation and/or other associated materials;
  12. 3. the copyright holder's name is not used to endorse products
  13. built using this software without specific written permission.
  14. ALTERNATIVELY, provided that this notice is retained in full, this product
  15. may be distributed under the terms of the GNU General Public License (GPL),
  16. in which case the provisions of the GPL apply INSTEAD OF those given above.
  17. DISCLAIMER
  18. This software is provided 'as is' with no explicit or implied warranties
  19. in respect of its properties, including, but not limited to, correctness
  20. and/or fitness for purpose.
  21. ---------------------------------------------------------------------------
  22. Issue Date: 26/08/2003
  23. This is an implementation of RFC2898, which specifies key derivation from
  24. a password and a salt value.
  25. */
  26. #ifndef PWD2KEY_H
  27. #define PWD2KEY_H
  28. #if defined(__cplusplus)
  29. extern "C"
  30. {
  31. #endif
  32. void derive_key(
  33. const unsigned char pwd[], /* the PASSWORD, and */
  34. unsigned int pwd_len, /* its length */
  35. const unsigned char salt[], /* the SALT and its */
  36. unsigned int salt_len, /* length */
  37. unsigned int iter, /* the number of iterations */
  38. unsigned char key[], /* space for the output key */
  39. unsigned int key_len); /* and its required length */
  40. #if defined(__cplusplus)
  41. }
  42. #endif
  43. #endif