Don't break out of the custom extension callback loop - continue instead
authorScott Deboy <sdeboy@secondstryke.com>
Wed, 5 Feb 2014 02:48:59 +0000 (18:48 -0800)
committerScott Deboy <sdeboy@secondstryke.com>
Sun, 9 Feb 2014 00:19:30 +0000 (16:19 -0800)
The contract for custom extension callbacks has changed - all custom extension callbacks are triggered

ssl/ssltest.c
ssl/t1_lib.c

index da7979b49cc17388a65e61d80c2687be84bbed8a..47a8189bf7b1a606f73e81d49370b7bdde0f8e14 100644 (file)
@@ -501,8 +501,7 @@ static int custom_ext_0_cli_second_cb(SSL *s, unsigned short ext_type,
                                      unsigned short inlen, int *al,
                                      void *arg)
        {
-       custom_ext_error = 1; /* Shouldn't be called */
-       return 0;
+       return 1;
        }
 
 static int custom_ext_1_cli_first_cb(SSL *s, unsigned short ext_type,
@@ -521,8 +520,7 @@ static int custom_ext_1_cli_second_cb(SSL *s, unsigned short ext_type,
                                      unsigned short inlen, int *al,
                                      void *arg)
        {
-       custom_ext_error = 1; /* Shouldn't be called */
-       return 0;
+       return 1;
        }
 
 static int custom_ext_2_cli_first_cb(SSL *s, unsigned short ext_type,
@@ -579,8 +577,7 @@ static int custom_ext_0_srv_first_cb(SSL *s, unsigned short ext_type,
                                     unsigned short inlen, int *al,
                                     void *arg)
        {
-       custom_ext_error = 1;
-       return 0; /* Shouldn't be called */
+       return 1;
        }
 
 /* 'generate' callbacks are always called, even if the 'receive' callback isn't called */
index 61b22043d756738f5abbb6bf8e7eb828b8c4ba4b..bf96ae25c31583d1792390646962e67809893e2d 100644 (file)
@@ -1718,14 +1718,14 @@ unsigned char *ssl_add_serverhello_tlsext(SSL *s, unsigned char *p, unsigned cha
 
                /* NULL callback or -1 omits extension */
                if (!record->fn2)
-                       break;
+                       continue;
                cb_retval = record->fn2(s, record->ext_type,
                                                                &out, &outlen, al,
                                                                record->arg);
                if (cb_retval == 0)
                        return NULL; /* error */
                if (cb_retval == -1)
-                       break; /* skip this extension */
+                       continue; /* skip this extension */
                if (limit < ret + 4 + outlen)
                        return NULL;
                s2n(record->ext_type, ret);