Update custom TLS extension and supplemental data 'generate' callbacks to support...
[openssl.git] / ssl / ssltest.c
index 3755e06905549cbf486d9724f974589f872ef757..2af5710f90193eb861e028a20d978e9ad2459b8e 100644 (file)
@@ -489,7 +489,7 @@ static int verify_serverinfo()
 
 static int custom_ext_0_cli_first_cb(SSL *s, unsigned short ext_type,
                                     const unsigned char **out,
-                                    unsigned short *outlen, void *arg)
+                                     unsigned short *outlen, int *al, void *arg)
        {
        if (ext_type != CUSTOM_EXT_TYPE_0)
                custom_ext_error = 1;
@@ -507,7 +507,7 @@ static int custom_ext_0_cli_second_cb(SSL *s, unsigned short ext_type,
 
 static int custom_ext_1_cli_first_cb(SSL *s, unsigned short ext_type,
                                     const unsigned char **out,
-                                    unsigned short *outlen, void *arg)
+                                     unsigned short *outlen, int *al, void *arg)
        {
        if (ext_type != CUSTOM_EXT_TYPE_1)
                custom_ext_error = 1;
@@ -527,7 +527,7 @@ static int custom_ext_1_cli_second_cb(SSL *s, unsigned short ext_type,
 
 static int custom_ext_2_cli_first_cb(SSL *s, unsigned short ext_type,
                                     const unsigned char **out,
-                                    unsigned short *outlen, void *arg)
+                                     unsigned short *outlen, int *al, void *arg)
        {
        if (ext_type != CUSTOM_EXT_TYPE_2)
                custom_ext_error = 1;
@@ -550,7 +550,7 @@ static int custom_ext_2_cli_second_cb(SSL *s, unsigned short ext_type,
 
 static int custom_ext_3_cli_first_cb(SSL *s, unsigned short ext_type,
                                     const unsigned char **out,
-                                    unsigned short *outlen, void *arg)
+                                     unsigned short *outlen, int *al, void *arg)
        {
        if (ext_type != CUSTOM_EXT_TYPE_3)
                custom_ext_error = 1;
@@ -573,7 +573,7 @@ static int custom_ext_3_cli_second_cb(SSL *s, unsigned short ext_type,
        return 1;
        }
 
-
+//custom_ext_0_cli_first_cb returns -1 - the server won't receive a callback for this extension
 static int custom_ext_0_srv_first_cb(SSL *s, unsigned short ext_type,
                                     const unsigned char *in,
                                     unsigned short inlen, int *al,
@@ -583,12 +583,12 @@ static int custom_ext_0_srv_first_cb(SSL *s, unsigned short ext_type,
        return 0; /* Shouldn't be called */
        }
 
+//'generate' callbacks are always called, even if the 'receive' callback isn't called
 static int custom_ext_0_srv_second_cb(SSL *s, unsigned short ext_type,
                                      const unsigned char **out,
-                                     unsigned short *outlen, void *arg)
+                                      unsigned short *outlen, int *al, void *arg)
        {
-       custom_ext_error = 1;
-       return 0; /* Shouldn't be called */
+        return -1; /* Don't send an extension */
        }
 
 static int custom_ext_1_srv_first_cb(SSL *s, unsigned short ext_type,
@@ -608,7 +608,7 @@ static int custom_ext_1_srv_first_cb(SSL *s, unsigned short ext_type,
 
 static int custom_ext_1_srv_second_cb(SSL *s, unsigned short ext_type,
                                      const unsigned char **out,
-                                     unsigned short *outlen, void *arg)
+                                      unsigned short *outlen, int *al, void *arg)
        {
        return -1; /* Don't send an extension */
        }
@@ -630,7 +630,7 @@ static int custom_ext_2_srv_first_cb(SSL *s, unsigned short ext_type,
 
 static int custom_ext_2_srv_second_cb(SSL *s, unsigned short ext_type,
                                      const unsigned char **out,
-                                     unsigned short *outlen, void *arg)
+                                      unsigned short *outlen, int *al, void *arg)
        {
        *out = NULL;
        *outlen = 0;
@@ -654,7 +654,7 @@ static int custom_ext_3_srv_first_cb(SSL *s, unsigned short ext_type,
 
 static int custom_ext_3_srv_second_cb(SSL *s, unsigned short ext_type,
                                      const unsigned char **out,
-                                     unsigned short *outlen, void *arg)
+                                      unsigned short *outlen, int *al, void *arg)
        {
        *out = (const unsigned char*)custom_ext_srv_string;
        *outlen = strlen(custom_ext_srv_string);
@@ -663,7 +663,7 @@ static int custom_ext_3_srv_second_cb(SSL *s, unsigned short ext_type,
 
 static int supp_data_0_srv_first_cb(SSL *s, unsigned short supp_data_type,
                                    const unsigned char **out,
-                                   unsigned short *outlen, void *arg)
+                                    unsigned short *outlen, int *al, void *arg)
        {
        *out = (const unsigned char*)supp_data_0_string;
        *outlen = strlen(supp_data_0_string);
@@ -690,7 +690,7 @@ static int supp_data_0_srv_second_cb(SSL *s, unsigned short supp_data_type,
 
 static int supp_data_1_srv_first_cb(SSL *s, unsigned short supp_data_type,
                                    const unsigned char **out,
-                                   unsigned short *outlen, void *arg)
+                                    unsigned short *outlen, int *al, void *arg)
        {
        return -1;
        }
@@ -731,7 +731,7 @@ static int supp_data_0_cli_first_cb(SSL *s, unsigned short supp_data_type,
 
 static int supp_data_0_cli_second_cb(SSL *s, unsigned short supp_data_type,
                                     const unsigned char **out,
-                                    unsigned short *outlen, void *arg)
+                                     unsigned short *outlen, int *al, void *arg)
        {
        *out = (const unsigned char*)supp_data_0_string;
        *outlen = strlen(supp_data_0_string);
@@ -751,7 +751,7 @@ static int supp_data_1_cli_first_cb(SSL *s, unsigned short supp_data_type,
 
 static int supp_data_1_cli_second_cb(SSL *s, unsigned short supp_data_type,
                                     const unsigned char **out,
-                                    unsigned short *outlen, void *arg)
+                                     unsigned short *outlen, int *al, void *arg)
        {
        return -1;
        }