tlsv1_client.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. * TLSv1 client (RFC 2246)
  3. * Copyright (c) 2006-2007, Jouni Malinen <j@w1.fi>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License version 2 as
  7. * published by the Free Software Foundation.
  8. *
  9. * Alternatively, this software may be distributed under the terms of BSD
  10. * license.
  11. *
  12. * See README and COPYING for more details.
  13. */
  14. #ifndef TLSV1_CLIENT_H
  15. #define TLSV1_CLIENT_H
  16. #include "tlsv1_cred.h"
  17. struct tlsv1_client;
  18. int tlsv1_client_global_init(void);
  19. void tlsv1_client_global_deinit(void);
  20. struct tlsv1_client * tlsv1_client_init(void);
  21. void tlsv1_client_deinit(struct tlsv1_client *conn);
  22. int tlsv1_client_established(struct tlsv1_client *conn);
  23. int tlsv1_client_prf(struct tlsv1_client *conn, const char *label,
  24. int server_random_first, u8 *out, size_t out_len);
  25. u8 * tlsv1_client_handshake(struct tlsv1_client *conn,
  26. const u8 *in_data, size_t in_len,
  27. size_t *out_len, u8 **appl_data,
  28. size_t *appl_data_len);
  29. int tlsv1_client_encrypt(struct tlsv1_client *conn,
  30. const u8 *in_data, size_t in_len,
  31. u8 *out_data, size_t out_len);
  32. int tlsv1_client_decrypt(struct tlsv1_client *conn,
  33. const u8 *in_data, size_t in_len,
  34. u8 *out_data, size_t out_len);
  35. int tlsv1_client_get_cipher(struct tlsv1_client *conn, char *buf,
  36. size_t buflen);
  37. int tlsv1_client_shutdown(struct tlsv1_client *conn);
  38. int tlsv1_client_resumed(struct tlsv1_client *conn);
  39. int tlsv1_client_hello_ext(struct tlsv1_client *conn, int ext_type,
  40. const u8 *data, size_t data_len);
  41. int tlsv1_client_get_keys(struct tlsv1_client *conn, struct tls_keys *keys);
  42. int tlsv1_client_get_keyblock_size(struct tlsv1_client *conn);
  43. int tlsv1_client_set_cipher_list(struct tlsv1_client *conn, u8 *ciphers);
  44. int tlsv1_client_set_cred(struct tlsv1_client *conn,
  45. struct tlsv1_credentials *cred);
  46. typedef int (*tlsv1_client_session_ticket_cb)
  47. (void *ctx, const u8 *ticket, size_t len, const u8 *client_random,
  48. const u8 *server_random, u8 *master_secret);
  49. void tlsv1_client_set_session_ticket_cb(struct tlsv1_client *conn,
  50. tlsv1_client_session_ticket_cb cb,
  51. void *ctx);
  52. #endif /* TLSV1_CLIENT_H */