Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a 'max_send_frag' option to configure maximum size of send fragments #3141

Closed

Conversation

FdaSilvaYY
Copy link
Contributor

@FdaSilvaYY FdaSilvaYY commented Apr 6, 2017

Checklist

  • documentation is added or updated
  • tests are added or updated

Noticed while working on #1008

@FdaSilvaYY FdaSilvaYY changed the title Add a 'max_send_frag' option to configure maximun size of send fragments Add a 'max_send_frag' option to configure maximum size of send fragments Apr 6, 2017
@FdaSilvaYY FdaSilvaYY force-pushed the add-max_send_fragment-to-apps branch from c058a9e to 88934fb Compare April 6, 2017 22:16
Copy link
Contributor

@richsalz richsalz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor nits.

apps/s_client.c Outdated
@@ -1432,6 +1442,11 @@ int s_client_main(int argc, char **argv)
goto end;
}

if (max_send_fragment > SSL3_RT_MAX_PLAIN_LENGTH) {
BIO_printf(bio_err, "Bad max send fragment size\n");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

plug put "%s: " and print prog.

apps/s_server.c Outdated
@@ -1543,6 +1556,11 @@ int s_server_main(int argc, char *argv[])
}
#endif

if (max_send_fragment > SSL3_RT_MAX_PLAIN_LENGTH) {
BIO_printf(bio_err, "Bad max send fragment size\n");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

output prog name here, too. I know it's not always done, but let's get in the habit of fixing these.

Copy link
Contributor Author

@FdaSilvaYY FdaSilvaYY Apr 7, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will fix some more in another PR ;)

=item B<-max_send_frag int>

The maximum size of data fragment to send. See
L<SSL_CTX_set_max_send_fragment(3)> for further information.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there's a SEE ALSO section, add a link there, too.

@FdaSilvaYY FdaSilvaYY force-pushed the add-max_send_fragment-to-apps branch from 88934fb to 5fb6f61 Compare April 7, 2017 07:02
=item B<-max_send_frag int>

The maximum size of data fragment to send.
See L<SSL_CTX_set_max_send_fragment(3)> for further information.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, SSL_CTX_set_max_send_fragment says that it "will only accept a value in the range 512 - SSL3_RT_MAX_PLAIN_LENGTH." This kind of suggests that one should check for it's return value and at least issue warning that attempt is failed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean as it stands now it only checks for upper limit.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checks added !

apps/s_server.c Outdated
@@ -1741,6 +1759,10 @@ int s_server_main(int argc, char *argv[])
if (async) {
SSL_CTX_set_mode(ctx, SSL_MODE_ASYNC);
}

if (max_send_fragment > 0)
SSL_CTX_set_max_send_fragment(ctx, max_send_fragment);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The returned value should be checked. 0 indicates failure... and really, that should also be done for the three calls below as well...

@FdaSilvaYY FdaSilvaYY force-pushed the add-max_send_fragment-to-apps branch 6 times, most recently from dad7fe6 to 7d81e34 Compare April 7, 2017 18:27
@dot-asm dot-asm added branch: master Merge to master branch approval: done This pull request has the required number of approvals labels Apr 7, 2017
@FdaSilvaYY FdaSilvaYY force-pushed the add-max_send_fragment-to-apps branch from 7d81e34 to ac71e51 Compare April 10, 2017 19:35
apps/s_client.c Outdated
goto end;
}

if (max_pipelines > SSL_MAX_PIPELINES) {
BIO_printf(bio_err, "Bad max pipelines value\n");
BIO_printf(bio_err, "%s: too large max-pipelines value\n", prog);
goto end;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, all these checks are a bit over the top. What happens when the libssl code changes those ranges, will we have to keep track of that and update the values here as well? It should be enough that SSL_CTX_set_max_send_fragment(), SSL_CTX_set_split_send_fragment(), SSL_CTX_set_max_pipelines() and SSL_ friends return 0 when the given argument is out of range...

apps/s_client.c Outdated

if (max_send_fragment > 0
&& !SSL_CTX_set_max_send_fragment(ctx, max_send_fragment)) {
BIO_printf(bio_err, "%s: Error setting max send fragment size\n", prog);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest this:

    if (!SSL_CTX_set_max_send_fragment(ctx, max_send_fragment)) {
        BIO_printf(bio_err, "%s: Max send fragment size %u is out of permitted range\n",
                   prog, max_send_fragment);

apps/s_client.c Outdated

if (split_send_fragment > 0
&& !SSL_CTX_set_split_send_fragment(ctx, split_send_fragment)) {
BIO_printf(bio_err, "%s: Error setting split send fragment size\n", prog);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest this:

    if (!SSL_CTX_set_split_send_fragment(ctx, split_send_fragment)) {
        BIO_printf(bio_err, "%s: Split send fragment size %u is out of permitted range\n",
                   prog, split_send_fragment);

apps/s_client.c Outdated

if (max_pipelines > 0
&& !SSL_CTX_set_max_pipelines(ctx, max_pipelines)) {
BIO_printf(bio_err, "%s: Error setting max pipelines\n", prog);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest this:

    if (!SSL_CTX_set_max_pipelines(ctx, max_pipelines)) {
        BIO_printf(bio_err, "%s: Max pipelines %u is out of permitted range\n",
                   prog, max_pipelines);

apps/s_server.c Outdated
if (max_pipelines > SSL_MAX_PIPELINES) {
BIO_printf(bio_err, "Bad max pipelines value\n");
BIO_printf(bio_err, "%s:too large max-pipelines value\n", prog);
goto end;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment here as for s_client.c

apps/s_server.c Outdated
if (max_pipelines > 0
&& !SSL_CTX_set_max_pipelines(ctx, max_pipelines)) {
BIO_printf(bio_err, "%s: Error setting max pipelines value\n", prog);
goto end;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same suggestions here as in s_client.c

@levitte levitte removed the approval: done This pull request has the required number of approvals label Apr 12, 2017
@FdaSilvaYY FdaSilvaYY force-pushed the add-max_send_fragment-to-apps branch from ac71e51 to 645a971 Compare April 12, 2017 20:35
@FdaSilvaYY
Copy link
Contributor Author

@levitte : rebased and error message updated.

@levitte
Copy link
Member

levitte commented Apr 12, 2017

I think you misunderstood me. It wasn't just about the message, but also about all that unnecessary checking of values, which is done in SSL_CTX_set_max_send_fragment() et al anyway!

@FdaSilvaYY FdaSilvaYY force-pushed the add-max_send_fragment-to-apps branch from 645a971 to 00d2b4d Compare April 14, 2017 21:51
@FdaSilvaYY FdaSilvaYY force-pushed the add-max_send_fragment-to-apps branch from 00d2b4d to ec3798d Compare April 26, 2017 21:36
@FdaSilvaYY
Copy link
Contributor Author

@levitte : rebased on top of last master. It it OK ?

apps/s_client.c Outdated
@@ -1444,6 +1440,7 @@ int s_client_main(int argc, char **argv)
goto end;
}

<<<<<<< HEAD
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this line should go ;-)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gone ! ;)

@FdaSilvaYY FdaSilvaYY force-pushed the add-max_send_fragment-to-apps branch from ec3798d to 1c44fc7 Compare April 26, 2017 22:18
@levitte levitte added the approval: done This pull request has the required number of approvals label Apr 27, 2017
@FdaSilvaYY FdaSilvaYY force-pushed the add-max_send_fragment-to-apps branch from 1c44fc7 to b9593a3 Compare April 27, 2017 20:24
@FdaSilvaYY
Copy link
Contributor Author

Rebased and conflict fixed. Ready to merge .

levitte pushed a commit that referenced this pull request Apr 28, 2017
Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from #3141)
levitte pushed a commit that referenced this pull request Apr 28, 2017
Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from #3141)
levitte pushed a commit that referenced this pull request Apr 28, 2017
Remove hardcoded bound checkings.

Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from #3141)
@levitte
Copy link
Member

levitte commented Apr 28, 2017

Merged. 28e5ea8 to 36b2cfb

@levitte levitte closed this Apr 28, 2017
@richsalz
Copy link
Contributor

should the doc say that the RELEASE-BUFFERS flag is needed for this to actually reduce memory?

@FdaSilvaYY FdaSilvaYY deleted the add-max_send_fragment-to-apps branch May 2, 2017 20:17
FdaSilvaYY added a commit to FdaSilvaYY/openssl that referenced this pull request May 4, 2017
Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from openssl#3141)

cherry-pick from 28e5ea8
FdaSilvaYY added a commit to FdaSilvaYY/openssl that referenced this pull request May 4, 2017
Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from openssl#3141)

Cherry-oick from 6788785
FdaSilvaYY added a commit to FdaSilvaYY/openssl that referenced this pull request May 4, 2017
Remove hardcoded bound checkings.

Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from openssl#3141)

cherry-pick from 36b2cfb
FdaSilvaYY added a commit to FdaSilvaYY/openssl that referenced this pull request Jun 23, 2017
Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from openssl#3141)

cherry-pick from 28e5ea8
FdaSilvaYY added a commit to FdaSilvaYY/openssl that referenced this pull request Jun 23, 2017
Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from openssl#3141)

Cherry-oick from 6788785
FdaSilvaYY added a commit to FdaSilvaYY/openssl that referenced this pull request Jun 23, 2017
Remove hardcoded bound checkings.

Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from openssl#3141)

cherry-pick from 36b2cfb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approval: done This pull request has the required number of approvals branch: master Merge to master branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants