Skip to content

Comments

Fix SSL_get_shared_ciphers()#6113

Closed
mattcaswell wants to merge 8 commits intoopenssl:masterfrom
mattcaswell:fix-shared-ciphers
Closed

Fix SSL_get_shared_ciphers()#6113
mattcaswell wants to merge 8 commits intoopenssl:masterfrom
mattcaswell:fix-shared-ciphers

Conversation

@mattcaswell
Copy link
Member

The function SSL_get_shared_ciphers() is supposed to return ciphers shared
by the client and the server. However it only ever returned the client
ciphers.

Fixes #5317

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

The function SSL_get_shared_ciphers() is supposed to return ciphers shared
by the client and the server. However it only ever returned the client
ciphers.

Fixes openssl#5317
The ciphers field in a session contains the stack of ciphers offered by
the client.
The max protocol version was only being set on the server side. It should
have been done on both the client and the server.
@mattcaswell mattcaswell added branch: master Applies to master branch branch: 1.1.1 Applies to OpenSSL_1_1_1-stable branch (EOL) labels Apr 27, 2018
@mattcaswell mattcaswell added this to the 1.1.1 milestone Apr 27, 2018
@richsalz
Copy link
Contributor

I prefer to not fix this in 1.1.1

@mattcaswell
Copy link
Member Author

Fixup commit pushed to address the travis failure.

I prefer to not fix this in 1.1.1

I disagree. I believe the intent of the function is clear, and it doesn't do what it is supposed to do - therefore this is a bug which should be fixed.

Do we need to have a vote?

@richsalz
Copy link
Contributor

I didn't force a vote, but I would like you to wait a few days to see what others think.

ssl/ssl_lib.c Outdated
@@ -2552,23 +2552,32 @@ int SSL_set_cipher_list(SSL *s, const char *str)
char *SSL_get_shared_ciphers(const SSL *s, char *buf, int len)
Copy link
Member

Choose a reason for hiding this comment

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

Could I ask that len be renamed to size? The reason is that there's a common pattern where len indicates that buf is an input buffer with len chars of content, while size indicates that buf is an output buffer with a maximum size. So size makes more sense, intuitively.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done. I also made the same change in the other two PRs (#6114 and #6115)

@mattcaswell
Copy link
Member Author

@richsalz - are you ok with me taking @levitte's approval?

@richsalz
Copy link
Contributor

richsalz commented May 2, 2018

Yes I am okay with it, thanks for asking.

@mspncp mspncp added the approval: done This pull request has the required number of approvals label May 2, 2018
@mattcaswell
Copy link
Member Author

Pushed. Thanks.

@mattcaswell mattcaswell closed this May 2, 2018
levitte pushed a commit that referenced this pull request May 2, 2018
The function SSL_get_shared_ciphers() is supposed to return ciphers shared
by the client and the server. However it only ever returned the client
ciphers.

Fixes #5317

Reviewed-by: Richard Levitte <[email protected]>
(Merged from #6113)
levitte pushed a commit that referenced this pull request May 2, 2018
The ciphers field in a session contains the stack of ciphers offered by
the client.

Reviewed-by: Richard Levitte <[email protected]>
(Merged from #6113)
levitte pushed a commit that referenced this pull request May 2, 2018
levitte pushed a commit that referenced this pull request May 2, 2018
The max protocol version was only being set on the server side. It should
have been done on both the client and the server.

Reviewed-by: Richard Levitte <[email protected]>
(Merged from #6113)
levitte pushed a commit that referenced this pull request May 2, 2018
Reviewed-by: Richard Levitte <[email protected]>
(Merged from #6113)
bob-beck pushed a commit to openbsd/src that referenced this pull request Jan 9, 2021
SSL_get_shared_ciphers() has been quite broken forever (see BUGS).
What's maybe even worse than those bugs is that it only ever returned
the string representing the client's ciphers which happen to fit into
buf. That's kind of odd, given its name.

This commit brings it in line with OpenSSL's version which changed
behavior almost three years ago.

reviewed and stupid bug caught by schwarze
ok beck inoguchi jsing

  commit a216df599a6076147c27acea6c976fb11f505b1a
  Author: Matt Caswell <[email protected]>
  Date:   Fri Apr 27 11:20:52 2018 +0100

    Fix SSL_get_shared_ciphers()

    The function SSL_get_shared_ciphers() is supposed to return
    ciphers shared by the client and the server. However it only
    ever returned the client ciphers.

    Fixes #5317

    Reviewed-by: Richard Levitte <[email protected]>
    (Merged from openssl/openssl#6113)
busterb pushed a commit to libressl/openbsd that referenced this pull request Feb 3, 2021
SSL_get_shared_ciphers() has been quite broken forever (see BUGS).
What's maybe even worse than those bugs is that it only ever returned
the string representing the client's ciphers which happen to fit into
buf. That's kind of odd, given its name.

This commit brings it in line with OpenSSL's version which changed
behavior almost three years ago.

reviewed and stupid bug caught by schwarze
ok beck inoguchi jsing

  commit a216df599a6076147c27acea6c976fb11f505b1a
  Author: Matt Caswell <[email protected]>
  Date:   Fri Apr 27 11:20:52 2018 +0100

    Fix SSL_get_shared_ciphers()

    The function SSL_get_shared_ciphers() is supposed to return
    ciphers shared by the client and the server. However it only
    ever returned the client ciphers.

    Fixes #5317

    Reviewed-by: Richard Levitte <[email protected]>
    (Merged from openssl/openssl#6113)
jcs pushed a commit to jcs/openbsd-src that referenced this pull request Mar 4, 2021
SSL_get_shared_ciphers() has been quite broken forever (see BUGS).
What's maybe even worse than those bugs is that it only ever returned
the string representing the client's ciphers which happen to fit into
buf. That's kind of odd, given its name.

This commit brings it in line with OpenSSL's version which changed
behavior almost three years ago.

reviewed and stupid bug caught by schwarze
ok beck inoguchi jsing

  commit a216df599a6076147c27acea6c976fb11f505b1a
  Author: Matt Caswell <[email protected]>
  Date:   Fri Apr 27 11:20:52 2018 +0100

    Fix SSL_get_shared_ciphers()

    The function SSL_get_shared_ciphers() is supposed to return
    ciphers shared by the client and the server. However it only
    ever returned the client ciphers.

    Fixes #5317

    Reviewed-by: Richard Levitte <[email protected]>
    (Merged from openssl/openssl#6113)
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 Applies to master branch branch: 1.1.1 Applies to OpenSSL_1_1_1-stable branch (EOL)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants