chap.c 602 B

12345678910111213141516171819202122232425262728
  1. /*
  2. * CHAP-MD5 (RFC 1994)
  3. * Copyright (c) 2007-2009, Jouni Malinen <j@w1.fi>
  4. *
  5. * This software may be distributed under the terms of the BSD license.
  6. * See README for more details.
  7. */
  8. #include "includes.h"
  9. #include "common.h"
  10. #include "crypto/crypto.h"
  11. #include "chap.h"
  12. int chap_md5(u8 id, const u8 *secret, size_t secret_len, const u8 *challenge,
  13. size_t challenge_len, u8 *response)
  14. {
  15. const u8 *addr[3];
  16. size_t len[3];
  17. addr[0] = &id;
  18. len[0] = 1;
  19. addr[1] = secret;
  20. len[1] = secret_len;
  21. addr[2] = challenge;
  22. len[2] = challenge_len;
  23. return md5_vector(3, addr, len, response);
  24. }