unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* gnutls-protocol-version<
@ 2019-09-03 12:13 Robert Pluim
  2019-09-03 13:02 ` gnutls-protocol-version< Paul Eggert
  0 siblings, 1 reply; 3+ messages in thread
From: Robert Pluim @ 2019-09-03 12:13 UTC (permalink / raw)
  To: emacs-devel

Hi,

since in some cases nsm has to behave differently depending on what
version of TLS was negotiated for a connection, it needs to be
possible to compare TLS protocol versions. I was thinking of adding
something like:

    gnutls-protocol-version< is a built-in function in ‘C source code’.

    (gnutls-protocol-version< V1 V2)

    Return t if TLS protocol version V1 is lower than V2.

    V1 and V2 are TLS protocol version names in the form used by GnuTLS,
    e.g. "TLS1.3".

I donʼt think we need the '>' version, and for equality you can just
use 'string-equal'.

Thoughts?

Robert



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: gnutls-protocol-version<
  2019-09-03 12:13 gnutls-protocol-version< Robert Pluim
@ 2019-09-03 13:02 ` Paul Eggert
  2019-09-03 14:37   ` gnutls-protocol-version< Robert Pluim
  0 siblings, 1 reply; 3+ messages in thread
From: Paul Eggert @ 2019-09-03 13:02 UTC (permalink / raw)
  To: Robert Pluim; +Cc: emacs-devel

Robert Pluim wrote:

>      (gnutls-protocol-version< V1 V2)
> 
>      Return t if TLS protocol version V1 is lower than V2.

Alternatively you could get the TLS protocol version as a string, and use 
string-version-lessp; that might be simpler.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: gnutls-protocol-version<
  2019-09-03 13:02 ` gnutls-protocol-version< Paul Eggert
@ 2019-09-03 14:37   ` Robert Pluim
  0 siblings, 0 replies; 3+ messages in thread
From: Robert Pluim @ 2019-09-03 14:37 UTC (permalink / raw)
  To: Paul Eggert; +Cc: emacs-devel

>>>>> On Tue, 3 Sep 2019 06:02:45 -0700, Paul Eggert <eggert@cs.ucla.edu> said:

    Paul> Robert Pluim wrote:
    >> (gnutls-protocol-version< V1 V2)
    >> Return t if TLS protocol version V1 is lower than V2.

    Paul> Alternatively you could get the TLS protocol version as a
    Paul> string, and

Thatʼs already available via gnutls-peer-status

    Paul> use string-version-lessp; that might be simpler.

That works, although it does assume that TLS version strings won't do
anything silly in the future like change prefix (they have done in the
past from SSL -> TLS, but S<T so thatʼs OK).

One nit is this:

(string-version-lessp "TLS1.3" nil) => t

which is somewhat surprising, but doesnʼt matter for my use case.

Robert



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-09-03 14:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-03 12:13 gnutls-protocol-version< Robert Pluim
2019-09-03 13:02 ` gnutls-protocol-version< Paul Eggert
2019-09-03 14:37   ` gnutls-protocol-version< Robert Pluim

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).