Skip to content

Commit 2f2bfb6

Browse files
committed
dont omit padding(21) extension
1 parent 5e789f1 commit 2f2bfb6

File tree

4 files changed

+24
-68
lines changed

4 files changed

+24
-68
lines changed

patches/openssl.OpenSSL_1_1_1-stable.patch

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ index 76d9fda4..a29114f2 100644
3131
# define TLSEXT_TYPE_session_ticket 35
3232

3333
diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c
34-
index 47adc321..da586733 100644
34+
index 47adc321..635b23b3 100644
3535
--- a/ssl/ssl_lib.c
3636
+++ b/ssl/ssl_lib.c
37-
@@ -5219,6 +5219,106 @@ int SSL_client_hello_get1_extensions_present(SSL *s, int **out, size_t *outlen)
37+
@@ -5219,6 +5219,95 @@ int SSL_client_hello_get1_extensions_present(SSL *s, int **out, size_t *outlen)
3838
return 0;
3939
}
4040

@@ -84,15 +84,8 @@ index 47adc321..da586733 100644
8484
+ num = 0;
8585
+ for (i = 0; i < s->clienthello->pre_proc_exts_len; i++) {
8686
+ ext = s->clienthello->pre_proc_exts + i;
87-
+ if (ext->present) {
88-
+ // Ingore padding due to padding is null where reuse the session_ticket.
89-
+ if (ext->type== TLSEXT_TYPE_padding) {
90-
+ // fprintf(stderr, "%d===%d\n",ext->type, TLSEXT_TYPE_padding);
91-
+ continue;
92-
+ }
93-
+
87+
+ if (ext->present)
9488
+ num++;
95-
+ }
9689
+ }
9790
+ *(uint16_t*)ptr = (uint16_t)num*2;
9891
+ ptr += 2;
@@ -101,10 +94,6 @@ index 47adc321..da586733 100644
10194
+ if (ext->present) {
10295
+ if (ext->received_order >= num)
10396
+ break;
104-
+ // Ingore padding due to padding is null where reuse the session_ticket.
105-
+ if (ext->type== TLSEXT_TYPE_padding) {
106-
+ continue;
107-
+ }
10897
+ if (ext->type== TLSEXT_TYPE_supported_groups)
10998
+ groups = &ext->data;
11099
+ if (ext->type== TLSEXT_TYPE_ec_point_formats)

patches/openssl.openssl-3.0.patch

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
diff --git a/include/openssl/ssl.h.in b/include/openssl/ssl.h.in
2-
index 105b4a4a..6c7eb464 100644
2+
index 105b4a4a3c..6c7eb4643a 100644
33
--- a/include/openssl/ssl.h.in
44
+++ b/include/openssl/ssl.h.in
55
@@ -1860,6 +1860,7 @@ size_t SSL_client_hello_get0_ciphers(SSL *s, const unsigned char **out);
@@ -11,7 +11,7 @@ index 105b4a4a..6c7eb464 100644
1111
const unsigned char **out, size_t *outlen);
1212

1313
diff --git a/include/openssl/tls1.h b/include/openssl/tls1.h
14-
index d6e9331f..b62b4e38 100644
14+
index d6e9331fa1..b62b4e380d 100644
1515
--- a/include/openssl/tls1.h
1616
+++ b/include/openssl/tls1.h
1717
@@ -134,6 +134,15 @@ extern "C" {
@@ -31,10 +31,10 @@ index d6e9331f..b62b4e38 100644
3131
# define TLSEXT_TYPE_session_ticket 35
3232

3333
diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c
34-
index 2c8479eb..07fe1eb7 100644
34+
index 2c8479eb5f..4c62687258 100644
3535
--- a/ssl/ssl_lib.c
3636
+++ b/ssl/ssl_lib.c
37-
@@ -5463,6 +5463,106 @@ int SSL_client_hello_get1_extensions_present(SSL *s, int **out, size_t *outlen)
37+
@@ -5463,6 +5463,95 @@ int SSL_client_hello_get1_extensions_present(SSL *s, int **out, size_t *outlen)
3838
return 0;
3939
}
4040

@@ -84,15 +84,8 @@ index 2c8479eb..07fe1eb7 100644
8484
+ num = 0;
8585
+ for (i = 0; i < s->clienthello->pre_proc_exts_len; i++) {
8686
+ ext = s->clienthello->pre_proc_exts + i;
87-
+ if (ext->present) {
88-
+ // Ingore padding due to padding is null where reuse the session_ticket.
89-
+ if (ext->type== TLSEXT_TYPE_padding) {
90-
+ // fprintf(stderr, "%d===%d\n",ext->type, TLSEXT_TYPE_padding);
91-
+ continue;
92-
+ }
93-
+
87+
+ if (ext->present)
9488
+ num++;
95-
+ }
9689
+ }
9790
+ *(uint16_t*)ptr = (uint16_t)num*2;
9891
+ ptr += 2;
@@ -101,10 +94,6 @@ index 2c8479eb..07fe1eb7 100644
10194
+ if (ext->present) {
10295
+ if (ext->received_order >= num)
10396
+ break;
104-
+ // Ingore padding due to padding is null where reuse the session_ticket.
105-
+ if (ext->type== TLSEXT_TYPE_padding) {
106-
+ continue;
107-
+ }
10897
+ if (ext->type== TLSEXT_TYPE_supported_groups)
10998
+ groups = &ext->data;
11099
+ if (ext->type== TLSEXT_TYPE_ec_point_formats)
@@ -142,7 +131,7 @@ index 2c8479eb..07fe1eb7 100644
142131
size_t *outlen)
143132
{
144133
diff --git a/ssl/ssl_local.h b/ssl/ssl_local.h
145-
index 5fb1feb8..99f1370e 100644
134+
index 5fb1feb801..99f1370ea3 100644
146135
--- a/ssl/ssl_local.h
147136
+++ b/ssl/ssl_local.h
148137
@@ -766,6 +766,10 @@ typedef enum tlsext_index_en {
@@ -157,7 +146,7 @@ index 5fb1feb8..99f1370e 100644
157146
TLSEXT_IDX_psk,
158147
/* Dummy index - must always be the last entry */
159148
diff --git a/ssl/statem/extensions.c b/ssl/statem/extensions.c
160-
index 1518ca7f..66a83bcb 100644
149+
index 1518ca7f4e..66a83bcb16 100644
161150
--- a/ssl/statem/extensions.c
162151
+++ b/ssl/statem/extensions.c
163152
@@ -370,6 +370,38 @@ static const EXTENSION_DEFINITION ext_defs[] = {

patches/openssl.openssl-3.1.patch

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
diff --git a/include/openssl/ssl.h.in b/include/openssl/ssl.h.in
2-
index f03f52fb..3140c3c5 100644
2+
index f03f52fbd8..3140c3c5c5 100644
33
--- a/include/openssl/ssl.h.in
44
+++ b/include/openssl/ssl.h.in
55
@@ -1863,6 +1863,7 @@ size_t SSL_client_hello_get0_ciphers(SSL *s, const unsigned char **out);
@@ -11,7 +11,7 @@ index f03f52fb..3140c3c5 100644
1111
const unsigned char **out, size_t *outlen);
1212

1313
diff --git a/include/openssl/tls1.h b/include/openssl/tls1.h
14-
index 793155e1..ef1f187b 100644
14+
index 793155e186..ef1f187b15 100644
1515
--- a/include/openssl/tls1.h
1616
+++ b/include/openssl/tls1.h
1717
@@ -134,6 +134,15 @@ extern "C" {
@@ -31,10 +31,10 @@ index 793155e1..ef1f187b 100644
3131
# define TLSEXT_TYPE_session_ticket 35
3232

3333
diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c
34-
index b5cc4af2..c64c500e 100644
34+
index b5cc4af2f0..578598e664 100644
3535
--- a/ssl/ssl_lib.c
3636
+++ b/ssl/ssl_lib.c
37-
@@ -5464,6 +5464,106 @@ int SSL_client_hello_get1_extensions_present(SSL *s, int **out, size_t *outlen)
37+
@@ -5464,6 +5464,95 @@ int SSL_client_hello_get1_extensions_present(SSL *s, int **out, size_t *outlen)
3838
return 0;
3939
}
4040

@@ -84,15 +84,8 @@ index b5cc4af2..c64c500e 100644
8484
+ num = 0;
8585
+ for (i = 0; i < s->clienthello->pre_proc_exts_len; i++) {
8686
+ ext = s->clienthello->pre_proc_exts + i;
87-
+ if (ext->present) {
88-
+ // Ingore padding due to padding is null where reuse the session_ticket.
89-
+ if (ext->type== TLSEXT_TYPE_padding) {
90-
+ // fprintf(stderr, "%d===%d\n",ext->type, TLSEXT_TYPE_padding);
91-
+ continue;
92-
+ }
93-
+
87+
+ if (ext->present)
9488
+ num++;
95-
+ }
9689
+ }
9790
+ *(uint16_t*)ptr = (uint16_t)num*2;
9891
+ ptr += 2;
@@ -101,10 +94,6 @@ index b5cc4af2..c64c500e 100644
10194
+ if (ext->present) {
10295
+ if (ext->received_order >= num)
10396
+ break;
104-
+ // Ingore padding due to padding is null where reuse the session_ticket.
105-
+ if (ext->type== TLSEXT_TYPE_padding) {
106-
+ continue;
107-
+ }
10897
+ if (ext->type== TLSEXT_TYPE_supported_groups)
10998
+ groups = &ext->data;
11099
+ if (ext->type== TLSEXT_TYPE_ec_point_formats)
@@ -142,7 +131,7 @@ index b5cc4af2..c64c500e 100644
142131
size_t *outlen)
143132
{
144133
diff --git a/ssl/ssl_local.h b/ssl/ssl_local.h
145-
index 845329a8..8fa0619f 100644
134+
index 845329a809..8fa0619feb 100644
146135
--- a/ssl/ssl_local.h
147136
+++ b/ssl/ssl_local.h
148137
@@ -766,6 +766,10 @@ typedef enum tlsext_index_en {
@@ -157,7 +146,7 @@ index 845329a8..8fa0619f 100644
157146
TLSEXT_IDX_psk,
158147
/* Dummy index - must always be the last entry */
159148
diff --git a/ssl/statem/extensions.c b/ssl/statem/extensions.c
160-
index e182b5ab..7d5adbf8 100644
149+
index e182b5abac..7d5adbf845 100644
161150
--- a/ssl/statem/extensions.c
162151
+++ b/ssl/statem/extensions.c
163152
@@ -369,6 +369,38 @@ static const EXTENSION_DEFINITION ext_defs[] = {

patches/openssl.openssl-3.2.patch

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
diff --git a/include/openssl/ssl.h.in b/include/openssl/ssl.h.in
2-
index 9f91039..81b9c51 100644
2+
index 9f91039f8a..81b9c51892 100644
33
--- a/include/openssl/ssl.h.in
44
+++ b/include/openssl/ssl.h.in
55
@@ -1894,6 +1894,7 @@ size_t SSL_client_hello_get0_ciphers(SSL *s, const unsigned char **out);
@@ -11,7 +11,7 @@ index 9f91039..81b9c51 100644
1111
size_t *num_exts);
1212
int SSL_client_hello_get0_ext(SSL *s, unsigned int type,
1313
diff --git a/include/openssl/tls1.h b/include/openssl/tls1.h
14-
index 7e3d1a7..ecee15e 100644
14+
index 7e3d1a725b..ecee15e29f 100644
1515
--- a/include/openssl/tls1.h
1616
+++ b/include/openssl/tls1.h
1717
@@ -142,6 +142,13 @@ extern "C" {
@@ -29,10 +29,10 @@ index 7e3d1a7..ecee15e 100644
2929
# define TLSEXT_TYPE_compress_certificate 27
3030

3131
diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c
32-
index 26cae27..9961509 100644
32+
index 26cae27dae..f5d1d8013a 100644
3333
--- a/ssl/ssl_lib.c
3434
+++ b/ssl/ssl_lib.c
35-
@@ -6572,6 +6572,110 @@ int SSL_client_hello_get1_extensions_present(SSL *s, int **out, size_t *outlen)
35+
@@ -6572,6 +6572,99 @@ int SSL_client_hello_get1_extensions_present(SSL *s, int **out, size_t *outlen)
3636
return 0;
3737
}
3838

@@ -86,15 +86,8 @@ index 26cae27..9961509 100644
8686
+ num = 0;
8787
+ for (i = 0; i < sc->clienthello->pre_proc_exts_len; i++) {
8888
+ ext = sc->clienthello->pre_proc_exts + i;
89-
+ if (ext->present) {
90-
+ // Ingore padding due to padding is null where reuse the session_ticket.
91-
+ if (ext->type== TLSEXT_TYPE_padding) {
92-
+ // fprintf(stderr, "%d===%d\n",ext->type, TLSEXT_TYPE_padding);
93-
+ continue;
94-
+ }
95-
+
89+
+ if (ext->present)
9690
+ num++;
97-
+ }
9891
+ }
9992
+ *(uint16_t*)ptr = (uint16_t)num*2;
10093
+ ptr += 2;
@@ -103,10 +96,6 @@ index 26cae27..9961509 100644
10396
+ if (ext->present) {
10497
+ if (ext->received_order >= num)
10598
+ break;
106-
+ // Ingore padding due to padding is null where reuse the session_ticket.
107-
+ if (ext->type== TLSEXT_TYPE_padding) {
108-
+ continue;
109-
+ }
11099
+ if (ext->type== TLSEXT_TYPE_supported_groups)
111100
+ groups = &ext->data;
112101
+ if (ext->type== TLSEXT_TYPE_ec_point_formats)
@@ -144,7 +133,7 @@ index 26cae27..9961509 100644
144133
{
145134
RAW_EXTENSION *ext;
146135
diff --git a/ssl/ssl_local.h b/ssl/ssl_local.h
147-
index 0d3acfb..01ceec6 100644
136+
index 0d3acfbe66..01ceec6897 100644
148137
--- a/ssl/ssl_local.h
149138
+++ b/ssl/ssl_local.h
150139
@@ -707,6 +707,9 @@ typedef enum tlsext_index_en {
@@ -158,7 +147,7 @@ index 0d3acfb..01ceec6 100644
158147
TLSEXT_IDX_psk,
159148
/* Dummy index - must always be the last entry */
160149
diff --git a/ssl/statem/extensions.c b/ssl/statem/extensions.c
161-
index 0a64ca2..9460207 100644
150+
index 0a64ca2246..9460207d1f 100644
162151
--- a/ssl/statem/extensions.c
163152
+++ b/ssl/statem/extensions.c
164153
@@ -411,6 +411,30 @@ static const EXTENSION_DEFINITION ext_defs[] = {

0 commit comments

Comments
 (0)