handshake_helper.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*
  2. * Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved.
  3. *
  4. * Licensed under the Apache License 2.0 (the "License"). You may not use
  5. * this file except in compliance with the License. You can obtain a copy
  6. * in the file LICENSE in the source distribution or at
  7. * https://www.openssl.org/source/license.html
  8. */
  9. #ifndef OSSL_TEST_HANDSHAKE_HELPER_H
  10. #define OSSL_TEST_HANDSHAKE_HELPER_H
  11. #include "ssl_test_ctx.h"
  12. typedef struct handshake_result {
  13. ssl_test_result_t result;
  14. /* These alerts are in the 2-byte format returned by the info_callback. */
  15. /* (Latest) alert sent by the client; 0 if no alert. */
  16. int client_alert_sent;
  17. /* Number of fatal or close_notify alerts sent. */
  18. int client_num_fatal_alerts_sent;
  19. /* (Latest) alert received by the server; 0 if no alert. */
  20. int client_alert_received;
  21. /* (Latest) alert sent by the server; 0 if no alert. */
  22. int server_alert_sent;
  23. /* Number of fatal or close_notify alerts sent. */
  24. int server_num_fatal_alerts_sent;
  25. /* (Latest) alert received by the client; 0 if no alert. */
  26. int server_alert_received;
  27. /* Negotiated protocol. On success, these should always match. */
  28. int server_protocol;
  29. int client_protocol;
  30. /* Server connection */
  31. ssl_servername_t servername;
  32. /* Session ticket status */
  33. ssl_session_ticket_t session_ticket;
  34. int compression;
  35. /* Was this called on the second context? */
  36. int session_ticket_do_not_call;
  37. char *client_npn_negotiated;
  38. char *server_npn_negotiated;
  39. char *client_alpn_negotiated;
  40. char *server_alpn_negotiated;
  41. /* Was the handshake resumed? */
  42. int client_resumed;
  43. int server_resumed;
  44. /* Temporary key type */
  45. int tmp_key_type;
  46. /* server certificate key type */
  47. int server_cert_type;
  48. /* server signing hash */
  49. int server_sign_hash;
  50. /* server signature type */
  51. int server_sign_type;
  52. /* server CA names */
  53. STACK_OF(X509_NAME) *server_ca_names;
  54. /* client certificate key type */
  55. int client_cert_type;
  56. /* client signing hash */
  57. int client_sign_hash;
  58. /* client signature type */
  59. int client_sign_type;
  60. /* Client CA names */
  61. STACK_OF(X509_NAME) *client_ca_names;
  62. /* Session id status */
  63. ssl_session_id_t session_id;
  64. char *cipher;
  65. /* session ticket application data */
  66. char *result_session_ticket_app_data;
  67. } HANDSHAKE_RESULT;
  68. HANDSHAKE_RESULT *HANDSHAKE_RESULT_new(void);
  69. void HANDSHAKE_RESULT_free(HANDSHAKE_RESULT *result);
  70. /* Do a handshake and report some information about the result. */
  71. HANDSHAKE_RESULT *do_handshake(SSL_CTX *server_ctx, SSL_CTX *server2_ctx,
  72. SSL_CTX *client_ctx, SSL_CTX *resume_server_ctx,
  73. SSL_CTX *resume_client_ctx,
  74. const SSL_TEST_CTX *test_ctx);
  75. #endif /* OSSL_TEST_HANDSHAKE_HELPER_H */