2
0

handshake.h 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /*
  2. * Copyright 2016-2021 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 ctx_data_st {
  13. unsigned char *npn_protocols;
  14. size_t npn_protocols_len;
  15. unsigned char *alpn_protocols;
  16. size_t alpn_protocols_len;
  17. char *srp_user;
  18. char *srp_password;
  19. char *session_ticket_app_data;
  20. } CTX_DATA;
  21. typedef struct handshake_result {
  22. ssl_test_result_t result;
  23. /* These alerts are in the 2-byte format returned by the info_callback. */
  24. /* (Latest) alert sent by the client; 0 if no alert. */
  25. int client_alert_sent;
  26. /* Number of fatal or close_notify alerts sent. */
  27. int client_num_fatal_alerts_sent;
  28. /* (Latest) alert received by the server; 0 if no alert. */
  29. int client_alert_received;
  30. /* (Latest) alert sent by the server; 0 if no alert. */
  31. int server_alert_sent;
  32. /* Number of fatal or close_notify alerts sent. */
  33. int server_num_fatal_alerts_sent;
  34. /* (Latest) alert received by the client; 0 if no alert. */
  35. int server_alert_received;
  36. /* Negotiated protocol. On success, these should always match. */
  37. int server_protocol;
  38. int client_protocol;
  39. /* Server connection */
  40. ssl_servername_t servername;
  41. /* Session ticket status */
  42. ssl_session_ticket_t session_ticket;
  43. int compression;
  44. /* Was this called on the second context? */
  45. int session_ticket_do_not_call;
  46. char *client_npn_negotiated;
  47. char *server_npn_negotiated;
  48. char *client_alpn_negotiated;
  49. char *server_alpn_negotiated;
  50. /* Was the handshake resumed? */
  51. int client_resumed;
  52. int server_resumed;
  53. /* Temporary key type */
  54. int tmp_key_type;
  55. /* server certificate key type */
  56. int server_cert_type;
  57. /* server signing hash */
  58. int server_sign_hash;
  59. /* server signature type */
  60. int server_sign_type;
  61. /* server CA names */
  62. STACK_OF(X509_NAME) *server_ca_names;
  63. /* client certificate key type */
  64. int client_cert_type;
  65. /* client signing hash */
  66. int client_sign_hash;
  67. /* client signature type */
  68. int client_sign_type;
  69. /* Client CA names */
  70. STACK_OF(X509_NAME) *client_ca_names;
  71. /* Session id status */
  72. ssl_session_id_t session_id;
  73. char *cipher;
  74. /* session ticket application data */
  75. char *result_session_ticket_app_data;
  76. } HANDSHAKE_RESULT;
  77. HANDSHAKE_RESULT *HANDSHAKE_RESULT_new(void);
  78. void HANDSHAKE_RESULT_free(HANDSHAKE_RESULT *result);
  79. /* Do a handshake and report some information about the result. */
  80. HANDSHAKE_RESULT *do_handshake(SSL_CTX *server_ctx, SSL_CTX *server2_ctx,
  81. SSL_CTX *client_ctx, SSL_CTX *resume_server_ctx,
  82. SSL_CTX *resume_client_ctx,
  83. const SSL_TEST_CTX *test_ctx);
  84. int configure_handshake_ctx_for_srp(SSL_CTX *server_ctx, SSL_CTX *server2_ctx,
  85. SSL_CTX *client_ctx,
  86. const SSL_TEST_EXTRA_CONF *extra,
  87. CTX_DATA *server_ctx_data,
  88. CTX_DATA *server2_ctx_data,
  89. CTX_DATA *client_ctx_data);
  90. #endif /* OSSL_TEST_HANDSHAKE_HELPER_H */