[gnutls-devel] gnutls_priority_set() with 'empty' priority argument

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[gnutls-devel] gnutls_priority_set() with 'empty' priority argument

Tim Ruehsen
Hi,

Nikos, after your patch on the wget mailing list I checked wget2 code.

In short:
##########
static gnutls_priority_t
        _priority_cache;

if (priorities) /* priority string from somewhere */
        gnutls_priority_init(&_priority_cache, priorities, NULL);

/* ... later ... */
gnutls_priority_set(session, _priority_cache);
##########

So, by default we give an 'empty' gnutls_priority_t var to
gnutls_priority_set().

Q: is that correct resp. is that the same as
gnutls_set_default_priority(session) ?

If not, should we call
        gnutls_priority_init(&_priority_cache, "NORMAL", NULL);
when no 'priorities' string is given ?

Regards, Tim

_______________________________________________
Gnutls-devel mailing list
[hidden email]
http://lists.gnupg.org/mailman/listinfo/gnutls-devel

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [gnutls-devel] gnutls_priority_set() with 'empty' priority argument

Nikos Mavrogiannopoulos
On Tue, Dec 20, 2016 at 3:07 PM, Tim Ruehsen <[hidden email]> wrote:

> Hi,
>
> Nikos, after your patch on the wget mailing list I checked wget2 code.
>
> In short:
> ##########
> static gnutls_priority_t
>         _priority_cache;
>
> if (priorities) /* priority string from somewhere */
>         gnutls_priority_init(&_priority_cache, priorities, NULL);
>
> /* ... later ... */
> gnutls_priority_set(session, _priority_cache);
> ##########
>
> So, by default we give an 'empty' gnutls_priority_t var to
> gnutls_priority_set().
>
> Q: is that correct resp. is that the same as
> gnutls_set_default_priority(session) ?

I don't think so. The behavior is most likely undefined. Do you check
the error code of gnutls_priority_check()?

> If not, should we call
>         gnutls_priority_init(&_priority_cache, "NORMAL", NULL);
> when no 'priorities' string is given ?

To simulate the set_default() you can call:
gnutls_priority_init(&_priority_cache, NULL, NULL);

I realized that this is not clearly documented.

regards,
Nikos

_______________________________________________
Gnutls-devel mailing list
[hidden email]
http://lists.gnupg.org/mailman/listinfo/gnutls-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [gnutls-devel] gnutls_priority_set() with 'empty' priority argument

Tim Ruehsen
On Wednesday, December 21, 2016 7:50:52 AM CET Nikos Mavrogiannopoulos wrote:

> On Tue, Dec 20, 2016 at 3:07 PM, Tim Ruehsen <[hidden email]> wrote:
> > Hi,
> >
> > Nikos, after your patch on the wget mailing list I checked wget2 code.
> >
> > In short:
> > ##########
> > static gnutls_priority_t
> >
> >         _priority_cache;
> >
> > if (priorities) /* priority string from somewhere */
> >
> >         gnutls_priority_init(&_priority_cache, priorities, NULL);
> >
> > /* ... later ... */
> > gnutls_priority_set(session, _priority_cache);
> > ##########
> >
> > So, by default we give an 'empty' gnutls_priority_t var to
> > gnutls_priority_set().
> >
> > Q: is that correct resp. is that the same as
> > gnutls_set_default_priority(session) ?
>
> I don't think so. The behavior is most likely undefined. Do you check
> the error code of gnutls_priority_check()?
(gnutls_priority_set) I didn't but do now, no error.

> > If not, should we call
> >
> >         gnutls_priority_init(&_priority_cache, "NORMAL", NULL);
> >
> > when no 'priorities' string is given ?
>
> To simulate the set_default() you can call:
> gnutls_priority_init(&_priority_cache, NULL, NULL);

I took a look into the GnuTLS source, NULL is mapped to "NORMAL".
But this might change, depending on documentation.

Thanks for your answer, changed to code in wget2 slightly.

Regards, Tim

_______________________________________________
Gnutls-devel mailing list
[hidden email]
http://lists.gnupg.org/mailman/listinfo/gnutls-devel

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [gnutls-devel] gnutls_priority_set() with 'empty' priority argument

Nikos Mavrogiannopoulos
On Wed, 2016-12-21 at 12:46 +0100, Tim Ruehsen wrote:

> On Wednesday, December 21, 2016 7:50:52 AM CET Nikos
> Mavrogiannopoulos wrote:
> > On Tue, Dec 20, 2016 at 3:07 PM, Tim Ruehsen <[hidden email]>
> > wrote:
> > > Hi,
> > >
> > > Nikos, after your patch on the wget mailing list I checked wget2
> > > code.
> > >
> > > In short:
> > > ##########
> > > static gnutls_priority_t
> > >
> > >         _priority_cache;
> > >
> > > if (priorities) /* priority string from somewhere */
> > >
> > >         gnutls_priority_init(&_priority_cache, priorities, NULL);
> > >
> > > /* ... later ... */
> > > gnutls_priority_set(session, _priority_cache);
> > > ##########
> > >
> > > So, by default we give an 'empty' gnutls_priority_t var to
> > > gnutls_priority_set().
> > >
> > > Q: is that correct resp. is that the same as
> > > gnutls_set_default_priority(session) ?
> >
> > I don't think so. The behavior is most likely undefined. Do you
> > check
> > the error code of gnutls_priority_check()?
>
> (gnutls_priority_set) I didn't but do now, no error.
>
> > > If not, should we call
> > >
> > >         gnutls_priority_init(&_priority_cache, "NORMAL", NULL);
> > >
> > > when no 'priorities' string is given ?
> >
> > To simulate the set_default() you can call:
> > gnutls_priority_init(&_priority_cache, NULL, NULL);
>
> I took a look into the GnuTLS source, NULL is mapped to "NORMAL".
> But this might change, depending on documentation.

Right this is the default. In Fedora we patch that value to the system
default (taken on run-time from system-priority-file). I've just added
a configuration option to allow changing the default without patching
the source:
https://gitlab.com/gnutls/gnutls/merge_requests/198

regards,
Nikos


_______________________________________________
Gnutls-devel mailing list
[hidden email]
http://lists.gnupg.org/mailman/listinfo/gnutls-devel
Loading...