challenge.h 576 B

1234567891011121314151617181920212223
  1. #ifndef CHALLENGE_H
  2. #define CHALLENGE_H 1
  3. #include <stdint.h>
  4. /** challenge_t: This structure contains the pseudo-random challenge used for
  5. * authentication.
  6. */
  7. typedef struct challenge_t {
  8. /** tv_sec as returned by gettimeofday */
  9. uint32_t sec;
  10. /** tv_usec as returned by gettimeofday + random value */
  11. uint32_t usec_rnd;
  12. /** random values */
  13. uint32_t random[6];
  14. } __attribute__ ((packed)) challenge_t;
  15. challenge_t* generate_challenge(void);
  16. void generate_response(challenge_t *challenge);
  17. int validate_challenge(challenge_t *local, challenge_t *remote);
  18. #endif