Fix comments, add new test.
authorDr. Stephen Henson <steve@openssl.org>
Tue, 26 Aug 2014 00:20:26 +0000 (01:20 +0100)
committerDr. Stephen Henson <steve@openssl.org>
Thu, 28 Aug 2014 16:06:53 +0000 (17:06 +0100)
Fix comments in ssltest.c: return value of 0 now means extension is
omitted and add_cb is not called for servers if the corresponding
extension is absent in ClientHello.

Test add_cb is not called if extension is not received.
Reviewed-by: Emilia Käsper <emilia@openssl.org>
ssl/ssltest.c

index 4dd7c8b47adcbfe435095df3c9dc5301f7a077d6..bc13e4cb2b5c83ead41d6abb704d54361ee3e611 100644 (file)
@@ -636,20 +636,23 @@ static int custom_ext_3_cli_parse_cb(SSL *s, unsigned int ext_type,
        return 1;
        }
 
-/* custom_ext_0_cli_parse_cb returns -1 - the server won't receive a callback for this extension */
+/* custom_ext_0_cli_add_cb returns 0 - the server won't receive a callback for this extension */
 static int custom_ext_0_srv_parse_cb(SSL *s, unsigned int ext_type,
                                     const unsigned char *in,
                                     size_t inlen, int *al,
                                     void *arg)
        {
+       custom_ext_error = 1;
        return 1;
        }
 
-/* 'generate' callbacks are always called, even if the 'receive' callback isn't called */
+/* 'add' callbacks are only called if the 'parse' callback is called */
 static int custom_ext_0_srv_add_cb(SSL *s, unsigned int ext_type,
                                      const unsigned char **out,
                                      size_t *outlen, int *al, void *arg)
        {
+       /* Error: should not have been called */
+       custom_ext_error = 1;
         return 0; /* Don't send an extension */
        }