From ametzler at bebt.de Tue Sep 2 20:07:51 2014 From: ametzler at bebt.de (Andreas Metzler) Date: Tue, 2 Sep 2014 20:07:51 +0200 Subject: [gnutls-devel] broken OCSP response parser with some CAs Message-ID: <20140902180751.GC26285@downhill.g.la> Hello, this is . I have not much to add, except for the fact that it still applies to 3.3.7. ----- Forwarded message from Alessandro Ghedini ----- From: Alessandro Ghedini Subject: Bug#759161: libgnutls-deb0-28: broken OCSP response parser with some CAs Package: libgnutls-deb0-28 Version: 3.3.6-2 Severity: normal Hi, I've been playing with gnutls OCSP support but I noticed that it fails to parse many apparently valid OCSP responses. E.g. using gnutls-cli with the --ocsp option: % gnutls-cli --ocsp facebook.com 443 [...] importing response: ASN1 parser: Error in DER parsing. I noticed that many of the rejected OCSP responses come from either digicert.com or GlobalSign (e.g. other than facebook.com, try also cloudflare.com, wikipedia.org, github.com, bitbucket.org, imgur.com, ...). Note that openssl works with them just fine. Other CAs work fine (e.g. try yahoo.com, namecheap.com, shipit.ubuntu.com, ...). Cheers -- System Information: Debian Release: jessie/sid APT prefers unstable APT policy: (500, 'unstable'), (1, 'experimental') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 3.14-2-amd64 (SMP w/4 CPU cores) Locale: LANG=it_IT.UTF-8, LC_CTYPE=it_IT.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages libgnutls-deb0-28 depends on: ii libc6 2.19-9 ii libgmp10 2:6.0.0+dfsg-6 ii libhogweed2 2.7.1-3 ii libnettle4 2.7.1-3 ii libp11-kit0 0.20.3-2 ii libtasn1-6 4.1-1 ii multiarch-support 2.19-9 ii zlib1g 1:1.2.8.dfsg-2 libgnutls-deb0-28 recommends no packages. Versions of packages libgnutls-deb0-28 suggests: ii gnutls-bin 3.3.6-2 ----- End forwarded message ----- From jyhjeff at gmail.com Thu Sep 4 06:31:02 2014 From: jyhjeff at gmail.com (Jeff Lee) Date: Thu, 4 Sep 2014 12:31:02 +0800 Subject: [gnutls-devel] _gnutls_vasprintf needs to update INOUT variable strp prior return Message-ID: Hi, As the subject, please review the implementation of _gnutls_vasprintf for systems without the suport of vasprintf. Best Regards, -------------- next part -------------- An HTML attachment was scrubbed... URL: From nmav at gnutls.org Thu Sep 4 10:29:20 2014 From: nmav at gnutls.org (Nikos Mavrogiannopoulos) Date: Thu, 4 Sep 2014 10:29:20 +0200 Subject: [gnutls-devel] broken OCSP response parser with some CAs In-Reply-To: <20140902180751.GC26285@downhill.g.la> References: <20140902180751.GC26285@downhill.g.la> Message-ID: On Tue, Sep 2, 2014 at 8:07 PM, Andreas Metzler wrote: > Hello, > > this is . I have not much to add, > except for the fact that it still applies to 3.3.7. Thanks for reporting that. It seems like a regression in libtasn1 3.6. That should be fixed in http://git.savannah.gnu.org/cgit/libtasn1.git/commit/?id=9e832a6d5072263a1fea554c654e29ccf918e059 regards, Nikos From nmav at gnutls.org Thu Sep 4 14:00:40 2014 From: nmav at gnutls.org (Nikos Mavrogiannopoulos) Date: Thu, 4 Sep 2014 14:00:40 +0200 Subject: [gnutls-devel] _gnutls_vasprintf needs to update INOUT variable strp prior return In-Reply-To: References: Message-ID: On Thu, Sep 4, 2014 at 6:31 AM, Jeff Lee wrote: > Hi, > As the subject, please review the implementation of _gnutls_vasprintf for > systems without the suport of vasprintf. Thanks. Updated. regards, Nikos From ametzler at bebt.de Thu Sep 4 19:24:34 2014 From: ametzler at bebt.de (Andreas Metzler) Date: Thu, 4 Sep 2014 19:24:34 +0200 Subject: [gnutls-devel] broken OCSP response parser with some CAs In-Reply-To: References: <20140902180751.GC26285@downhill.g.la> Message-ID: <20140904172434.GB5602@downhill.g.la> On 2014-09-04 Nikos Mavrogiannopoulos wrote: > On Tue, Sep 2, 2014 at 8:07 PM, Andreas Metzler wrote: > > Hello, > > > > this is . I have not much to add, > > except for the fact that it still applies to 3.3.7. > Thanks for reporting that. It seems like a regression in libtasn1 3.6. > That should be fixed in > http://git.savannah.gnu.org/cgit/libtasn1.git/commit/?id=9e832a6d5072263a1fea554c654e29ccf918e059 Also works for me. Thank you! cu Andreas -- `What a good friend you are to him, Dr. Maturin. His other friends are so grateful to you.' `I sew his ears on from time to time, sure' From dbaryshkov at gmail.com Sat Sep 6 12:40:22 2014 From: dbaryshkov at gmail.com (Dmitry Eremin-Solenikov) Date: Sat, 6 Sep 2014 14:40:22 +0400 Subject: [gnutls-devel] GnuTLS test suite Message-ID: Hello, I have noticed several problems with GnuTLS test suite. First, mini-record-2 runs indefinitely. Is this an expected failure? Also I got two valgrind errors from hostname-check and from nul-in-x509-names tests (logs are in attachment). -- With best wishes Dmitry -------------- next part -------------- A non-text attachment was scrubbed... Name: hostname-check.log Type: text/x-log Size: 5509 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: nul-in-x509-names.log Type: text/x-log Size: 1107 bytes Desc: not available URL: From nmav at gnutls.org Sat Sep 6 13:36:25 2014 From: nmav at gnutls.org (Nikos Mavrogiannopoulos) Date: Sat, 06 Sep 2014 13:36:25 +0200 Subject: [gnutls-devel] GnuTLS test suite In-Reply-To: References: Message-ID: <1410003385.3910.2.camel@nomad.lan> On Sat, 2014-09-06 at 14:40 +0400, Dmitry Eremin-Solenikov wrote: > Hello, > > I have noticed several problems with GnuTLS test suite. > First, mini-record-2 runs indefinitely. Is this an expected failure? It should take quite long time when run under valgrind, but it shouldn't be indefinitely. > Also I got two valgrind errors from hostname-check and from > nul-in-x509-names tests (logs are in attachment). These are warnings due to the usage of IDNA. However, they should be silenced by this line of suppressions.valgrind. { libidn-strlen Memcheck:Addr4 fun:idna_to_ascii_4z fun:idna_to_ascii_8z fun:gnutls_x509_crt_check_hostname2 fun:doit fun:main } I'm wondering whether it is the addition crt_check_hostname that causes that issue. Would adding: { libidn-strlen Memcheck:Addr4 fun:idna_to_ascii_4z fun:idna_to_ascii_8z fun:gnutls_x509_crt_check_hostname2 fun:gnutls_x509_crt_check_hostname fun:doit fun:main } solve the issue you see? From INVALID.NOREPLY at gnu.org Sun Sep 7 12:22:40 2014 From: INVALID.NOREPLY at gnu.org (Nikos Mavrogiannopoulos) Date: Sun, 07 Sep 2014 10:22:40 +0000 Subject: [gnutls-devel] [sr #108634] Getter functions for gnutls_certificate_credentials_t In-Reply-To: <20140825-203439.sv707.32318@savannah.gnu.org> References: <20140818-164743.sv96363.52612@savannah.gnu.org> <20140825-203439.sv707.32318@savannah.gnu.org> Message-ID: <20140907-132239.sv707.3610@savannah.gnu.org> Follow-up Comment #2, sr #108634 (project gnutls): > For example, I want to verify a certificate, and if the > certificate is invalid because the issuer is not found (this I > can do with gnutls_certificate_verify_peers), I want to > re-validate it with different flags to see whether there are > other issues with the certificate (for example, expired). I have misread you message. Which function has that limitation and would you suggest to address that issue? > Or after I set the trusted certificates with > gnutls_certificate_set_x509_system_trust(), I want to present a > list of these certificates in a user interface, so it would be > good if I could obtain the list of trusted CAs from the > gnutls_certificate_credentials_t structure. That as I understand would be possible by a function that enumerates all certificates in a trust list. Is that correct? _______________________________________________________ Reply to this item at: _______________________________________________ Message sent via/by Savannah http://savannah.gnu.org/ From INVALID.NOREPLY at gnu.org Sun Sep 7 22:04:09 2014 From: INVALID.NOREPLY at gnu.org (Armin Burgmeier) Date: Sun, 07 Sep 2014 20:04:09 +0000 Subject: [gnutls-devel] [sr #108634] Getter functions for gnutls_certificate_credentials_t In-Reply-To: <20140907-132239.sv707.3610@savannah.gnu.org> References: <20140818-164743.sv96363.52612@savannah.gnu.org> <20140825-203439.sv707.32318@savannah.gnu.org> <20140907-132239.sv707.3610@savannah.gnu.org> Message-ID: <20140907-200409.sv96363.42296@savannah.gnu.org> Follow-up Comment #3, sr #108634 (project gnutls): > I have misread you message. Which function has that limitation and would you suggest to address that issue? All the certificate verification functions I think. The limitation is in the internal function "verify_crt" in x509/verify.c. If, for example, the verify result is GNUTLS_CERT_SIGNER_CONSTRAINTS_FAILURE or GNUTLS_CERT_SIGNER_NOT_FOUND, then the certificate is not checked for other problems, such as whether it is expired. Other errors, such as GNUTLS_CERT_SIGNATURE_FAILURE, do not stop the procedure and certificate checking continues. Whether this is supposed to be like this or not I don't know, so maybe it is a different issue from what I mentioned in the caption of this issue. > That as I understand would be possible by a function that enumerates all certificates in a trust list. Is that correct? In addition I would need to get the trust list from the gnutls_certificate_credentials_t structure, I think. It would also be nice to obtain the private key (gnutls_x509_privkey_t) and certificate(s) (gnutls_x509_crt_t) from that structure, not only the trust list. At the moment in my program I am storing gnutls_x509_privkey_t, gnutls_x509_crt_t (a client certificate), and the gnutls_certificate_credentials_t itself. I need both: The certificate I need to extract the common name to show in the user interface, and the credentials I need to set it with the GnuTLS session (gnutls_credentials_set). This basically means I need to store the key and certificate twice in my program: Once in my data own structures, and once in the gnutls_certificate_credentials_t structure. What I would like to do is to only keep the gnutls_certificate_credentials_t structure, and when I need to show the common name in the user interface, I would get the certificate from the gnutls_certificate_credentials_t, and then get the name from the certificate. Then I would only end up with the private key and certificate once in my program's memory. Is it clear? If you agree this would be good to have I can try to come up with a patch for it. _______________________________________________________ Reply to this item at: _______________________________________________ Message sent via/by Savannah http://savannah.gnu.org/ From nmav at gnu.org Mon Sep 8 11:23:07 2014 From: nmav at gnu.org (Nikos Mavrogiannopoulos) Date: Mon, 8 Sep 2014 11:23:07 +0200 Subject: [gnutls-devel] [sr #108634] Getter functions for gnutls_certificate_credentials_t In-Reply-To: <20140907-200409.sv96363.42296@savannah.gnu.org> References: <20140818-164743.sv96363.52612@savannah.gnu.org> <20140825-203439.sv707.32318@savannah.gnu.org> <20140907-132239.sv707.3610@savannah.gnu.org> <20140907-200409.sv96363.42296@savannah.gnu.org> Message-ID: On Sun, Sep 7, 2014 at 10:04 PM, Armin Burgmeier wrote: > Follow-up Comment #3, sr #108634 (project gnutls): >> I have misread you message. Which function has that limitation and would > you suggest to address that issue? > All the certificate verification functions I think. The limitation is in the > internal function "verify_crt" in x509/verify.c. If, for example, the verify > result is GNUTLS_CERT_SIGNER_CONSTRAINTS_FAILURE or > GNUTLS_CERT_SIGNER_NOT_FOUND, then the certificate is not checked for other > problems, such as whether it is expired. Other errors, such as > GNUTLS_CERT_SIGNATURE_FAILURE, do not stop the procedure and certificate > checking continues. Indeed, if the constraints fail it would not proceed to the verification itself. I don't know if that's useful to proceed. If you could make a description of your use-case it may help to figure out whether some changes should be done. >> That as I understand would be possible by a function that enumerates all > certificates in a trust list. Is that correct? > In addition I would need to get the trust list from the > gnutls_certificate_credentials_t structure, I think. It would also be nice to > obtain the private key (gnutls_x509_privkey_t) and certificate(s) > (gnutls_x509_crt_t) from that structure, not only the trust list. That would be indeed useful. The certificate_credentials_t functionality typically wraps over the functionality of trusted_list, so that would be ok. The data should be extracted from a trust list/credentials however in a way that don't assume much about the internal structure of it, in order to allow a revamp without affecting the API. A way for example to export the trusted CAs from the trusted list would be using an iterator similarly to gnutls_x509_crl_iter_crt_serial(). >From the certificate_credentials_t structure you could export the private key as a gnutls_privkey_t (and assume that this will be the format used internally by gnutls), but for the certificates, you only have gnutls_pubkey_t and a datum with the DER data held internally. I don't know if that would suffice. > What I would like to do is to only keep the gnutls_certificate_credentials_t > structure, and when I need to show the common name in the user interface, I > would get the certificate from the gnutls_certificate_credentials_t, and then > get the name from the certificate. Then I would only end up with the private > key and certificate once in my program's memory. That would be tricky as gnutls doesn't hold internally a gnutls_x509_crt_t. You could of course add functionality to get the DER encoding of the certificate from the credentials, decode it and get an x509_crt_t, but that you can already do with gnutls_certificate_get_ours(). I'm not sure I have a good suggestion for that case. regards, Nikos From armin at arbur.net Mon Sep 8 15:59:56 2014 From: armin at arbur.net (Armin Burgmeier) Date: Mon, 08 Sep 2014 09:59:56 -0400 Subject: [gnutls-devel] [sr #108634] Getter functions for gnutls_certificate_credentials_t In-Reply-To: References: <20140818-164743.sv96363.52612@savannah.gnu.org> <20140825-203439.sv707.32318@savannah.gnu.org> <20140907-132239.sv707.3610@savannah.gnu.org> <20140907-200409.sv96363.42296@savannah.gnu.org> Message-ID: <1410184796.1723.20.camel@waverley> On Mon, 2014-09-08 at 11:23 +0200, Nikos Mavrogiannopoulos wrote: > On Sun, Sep 7, 2014 at 10:04 PM, Armin Burgmeier > wrote: > > Follow-up Comment #3, sr #108634 (project gnutls): > >> I have misread you message. Which function has that limitation and would > > you suggest to address that issue? > > All the certificate verification functions I think. The limitation is in the > > internal function "verify_crt" in x509/verify.c. If, for example, the verify > > result is GNUTLS_CERT_SIGNER_CONSTRAINTS_FAILURE or > > GNUTLS_CERT_SIGNER_NOT_FOUND, then the certificate is not checked for other > > problems, such as whether it is expired. Other errors, such as > > GNUTLS_CERT_SIGNATURE_FAILURE, do not stop the procedure and certificate > > checking continues. > > Indeed, if the constraints fail it would not proceed to the > verification itself. I don't know if that's useful to proceed. If you > could make a description of your use-case it may help to figure out > whether some changes should be done. My use-case is the following. I'm verifying the certificate of a peer. If the certificate validates, I want to just go on with the connection. However, if the signer of the certificate is not in my trust list, I want to present a dialog to the user asking whether the certificate should be trusted, for example if it is a self-signed certificate. However, if the certificate is invalid beyond the signer not trusted error (signature failure, or expired), then I want to reject the connection without any user interaction. At the moment I am achieving this by verifying the certificate twice: Once "normally", and if that returns GNUTLS_CERT_SIGNER_NOT_FOUND, then I am verifying it again but this time I add the certificate's issuer (as sent by the peer) in the trust list artificially, so that the signer is always found and the certificate is checked for other flaws. In the end this is a bit like SSH-like trust-on-first-use... I understand there is actually a API in gnutls for something very similar, but from what I have seen this is on top of the "issuer trusted" check, and not replacing it. > >> That as I understand would be possible by a function that enumerates all > > certificates in a trust list. Is that correct? > > In addition I would need to get the trust list from the > > gnutls_certificate_credentials_t structure, I think. It would also be nice to > > obtain the private key (gnutls_x509_privkey_t) and certificate(s) > > (gnutls_x509_crt_t) from that structure, not only the trust list. > > That would be indeed useful. The certificate_credentials_t > functionality typically wraps over the functionality of trusted_list, > so that would be ok. > > The data should be extracted from a trust list/credentials however in > a way that don't assume much about the internal structure of it, in > order to allow a revamp without affecting the API. > A way for example to export the trusted CAs from the trusted list > would be using an iterator similarly to > gnutls_x509_crl_iter_crt_serial(). Okay, this sounds reasonable. > >From the certificate_credentials_t structure you could export the > private key as a gnutls_privkey_t (and assume that this will be the > format used internally by gnutls), but for the certificates, you only > have gnutls_pubkey_t and a datum with the DER data held internally. I > don't know if that would suffice. > > > What I would like to do is to only keep the gnutls_certificate_credentials_t > > structure, and when I need to show the common name in the user interface, I > > would get the certificate from the gnutls_certificate_credentials_t, and then > > get the name from the certificate. Then I would only end up with the private > > key and certificate once in my program's memory. > > That would be tricky as gnutls doesn't hold internally a > gnutls_x509_crt_t. You could of course add functionality to get the > DER encoding of the certificate from the credentials, decode it and > get an x509_crt_t, but that you can already do with > gnutls_certificate_get_ours(). I'm not sure I have a good suggestion > for that case. For my case, just exporting the DER-encoded data would be fine. Basically just like gnutls_certificate_get_ours(), but with a gnutls_certificate_credentials_t instead of a gnutls_session_t. In terms of API flexibility however, it might make sense to construct a new gnutls_x509_crt_t and return that, i.e. doing the DER-decoding inside gnutls, and documenting that the caller should gnutls_x509_crt_free() the result. In this case, the API would always return a newly constructed gnutls_x509_crt_t, but it is independent of the actual storage in the credentials structure, as long as what is stored can be converted to a gnutls_x509_crt_t. What do you think? Cheers, Armin From nmav at gnu.org Wed Sep 10 10:34:17 2014 From: nmav at gnu.org (Nikos Mavrogiannopoulos) Date: Wed, 10 Sep 2014 10:34:17 +0200 Subject: [gnutls-devel] [sr #108634] Getter functions for gnutls_certificate_credentials_t In-Reply-To: <1410184796.1723.20.camel@waverley> References: <20140818-164743.sv96363.52612@savannah.gnu.org> <20140825-203439.sv707.32318@savannah.gnu.org> <20140907-132239.sv707.3610@savannah.gnu.org> <20140907-200409.sv96363.42296@savannah.gnu.org> <1410184796.1723.20.camel@waverley> Message-ID: On Mon, Sep 8, 2014 at 3:59 PM, Armin Burgmeier wrote: >> Indeed, if the constraints fail it would not proceed to the >> verification itself. I don't know if that's useful to proceed. If you >> could make a description of your use-case it may help to figure out >> whether some changes should be done. > My use-case is the following. I'm verifying the certificate of a peer. > If the certificate validates, I want to just go on with the connection. > However, if the signer of the certificate is not in my trust list, I > want to present a dialog to the user asking whether the certificate > should be trusted, for example if it is a self-signed certificate. > However, if the certificate is invalid beyond the signer not trusted > error (signature failure, or expired), then I want to reject the > connection without any user interaction. > At the moment I am achieving this by verifying the certificate twice: > Once "normally", and if that returns GNUTLS_CERT_SIGNER_NOT_FOUND, then > I am verifying it again but this time I add the certificate's issuer (as > sent by the peer) in the trust list artificially, so that the signer is > always found and the certificate is checked for other flaws. Ok, so I understand you would prefer to get as many as possible flags from the verification process. However, I'm not really sure that you add any value from that additional check. In the end an attacker would simply need to put an arbitrary end-user certificate in the chain and you'll revert to trust on first use just the same. > In the end this is a bit like SSH-like trust-on-first-use... I > understand there is actually a API in gnutls for something very similar, > but from what I have seen this is on top of the "issuer trusted" check, > and not replacing it. It's up to you how to use that API. It can be used with PKIX authentication or entirely separate. >> > What I would like to do is to only keep the gnutls_certificate_credentials_t >> > structure, and when I need to show the common name in the user interface, I >> > would get the certificate from the gnutls_certificate_credentials_t, and then >> > get the name from the certificate. Then I would only end up with the private >> > key and certificate once in my program's memory. >> >> That would be tricky as gnutls doesn't hold internally a >> gnutls_x509_crt_t. You could of course add functionality to get the >> DER encoding of the certificate from the credentials, decode it and >> get an x509_crt_t, but that you can already do with >> gnutls_certificate_get_ours(). I'm not sure I have a good suggestion >> for that case. > > For my case, just exporting the DER-encoded data would be fine. > Basically just like gnutls_certificate_get_ours(), but with a > gnutls_certificate_credentials_t instead of a gnutls_session_t. > > In terms of API flexibility however, it might make sense to construct a > new gnutls_x509_crt_t and return that, i.e. doing the DER-decoding > inside gnutls, and documenting that the caller should > gnutls_x509_crt_free() the result. In this case, the API would always > return a newly constructed gnutls_x509_crt_t, but it is independent of > the actual storage in the credentials structure, as long as what is > stored can be converted to a gnutls_x509_crt_t. > What do you think? It seems ok, although there will be a discrepancy. The gnutls_privkey_t will not be released by the user, while the x509_crt_t should be released. Maybe for consistency it would make sense to generate it on the fly, cache in the structure, and deinitialize it when whole structure gets deinitialized. Such an API should allow flexibility on the exporting type of the certificate as well, since openpgp or raw public keys should be able to be exported as well (even if that functionality is not implemented initially). regards, Nikos From armin at arbur.net Wed Sep 10 17:15:39 2014 From: armin at arbur.net (Armin Burgmeier) Date: Wed, 10 Sep 2014 11:15:39 -0400 Subject: [gnutls-devel] [sr #108634] Getter functions for gnutls_certificate_credentials_t In-Reply-To: References: <20140818-164743.sv96363.52612@savannah.gnu.org> <20140825-203439.sv707.32318@savannah.gnu.org> <20140907-132239.sv707.3610@savannah.gnu.org> <20140907-200409.sv96363.42296@savannah.gnu.org> <1410184796.1723.20.camel@waverley> Message-ID: <1410362139.2056.24.camel@waverley> On Wed, 2014-09-10 at 10:34 +0200, Nikos Mavrogiannopoulos wrote: > On Mon, Sep 8, 2014 at 3:59 PM, Armin Burgmeier wrote: > > >> Indeed, if the constraints fail it would not proceed to the > >> verification itself. I don't know if that's useful to proceed. If you > >> could make a description of your use-case it may help to figure out > >> whether some changes should be done. > > My use-case is the following. I'm verifying the certificate of a peer. > > If the certificate validates, I want to just go on with the connection. > > However, if the signer of the certificate is not in my trust list, I > > want to present a dialog to the user asking whether the certificate > > should be trusted, for example if it is a self-signed certificate. > > However, if the certificate is invalid beyond the signer not trusted > > error (signature failure, or expired), then I want to reject the > > connection without any user interaction. > > At the moment I am achieving this by verifying the certificate twice: > > Once "normally", and if that returns GNUTLS_CERT_SIGNER_NOT_FOUND, then > > I am verifying it again but this time I add the certificate's issuer (as > > sent by the peer) in the trust list artificially, so that the signer is > > always found and the certificate is checked for other flaws. > > Ok, so I understand you would prefer to get as many as possible flags > from the verification process. > However, I'm not really sure that you add any value from that > additional check. In the end an attacker would simply need to put an > arbitrary end-user certificate in the chain and you'll revert to trust > on first use just the same. I agree. If I understand correctly, however, SSH is in exactly the same situation. The value from the additional check is that I don't have to bug my users with an extra dialog when the server has a certificate that is issued by a trusted CA. Only when that is not the case I resort to trust-on-first-use. Then yes, an attacker could present an arbitrary certificate; but if the user has connected to the server before already it will detect that the certificate is different from the previous connection attempt. The whole situation is obviously not bullet-proof; I'm basically aiming for a compromise between security and convenience -- don't want to force people to get a CA-issued certificate to use the application but still provide as much security as possible. > > In the end this is a bit like SSH-like trust-on-first-use... I > > understand there is actually a API in gnutls for something very similar, > > but from what I have seen this is on top of the "issuer trusted" check, > > and not replacing it. > > It's up to you how to use that API. It can be used with PKIX > authentication or entirely separate. > > >> > What I would like to do is to only keep the gnutls_certificate_credentials_t > >> > structure, and when I need to show the common name in the user interface, I > >> > would get the certificate from the gnutls_certificate_credentials_t, and then > >> > get the name from the certificate. Then I would only end up with the private > >> > key and certificate once in my program's memory. > >> > >> That would be tricky as gnutls doesn't hold internally a > >> gnutls_x509_crt_t. You could of course add functionality to get the > >> DER encoding of the certificate from the credentials, decode it and > >> get an x509_crt_t, but that you can already do with > >> gnutls_certificate_get_ours(). I'm not sure I have a good suggestion > >> for that case. > > > > For my case, just exporting the DER-encoded data would be fine. > > Basically just like gnutls_certificate_get_ours(), but with a > > gnutls_certificate_credentials_t instead of a gnutls_session_t. > > > > In terms of API flexibility however, it might make sense to construct a > > new gnutls_x509_crt_t and return that, i.e. doing the DER-decoding > > inside gnutls, and documenting that the caller should > > gnutls_x509_crt_free() the result. In this case, the API would always > > return a newly constructed gnutls_x509_crt_t, but it is independent of > > the actual storage in the credentials structure, as long as what is > > stored can be converted to a gnutls_x509_crt_t. > > What do you think? > > It seems ok, although there will be a discrepancy. The > gnutls_privkey_t will not be released by the user, while the > x509_crt_t should be released. We could instead return a copy of the gnutls_privkey_t, so that it has to be released as well by the user. This would then again give some flexibility in case the key storage inside the credentials structure changes at some point in the future. > Maybe for consistency it would make > sense to generate it on the fly, cache in the structure, and > deinitialize it when whole structure gets deinitialized. Such an API > should allow flexibility on the exporting type of the certificate as > well, since openpgp or raw public keys should be able to be exported > as well (even if that functionality is not implemented initially). In that case, the keys and certificates would then be stored twice in memory again (once they have been queried via the new API). That idea is not very appealing to me, but maybe it's just a matter of taste... either way should work for what I would need the new API for. What I don't understand is, how would returning a new certificate/private key not allow openpgp or raw keys to be exported? Cheers, Armin From nmav at gnu.org Wed Sep 10 17:50:02 2014 From: nmav at gnu.org (Nikos Mavrogiannopoulos) Date: Wed, 10 Sep 2014 17:50:02 +0200 Subject: [gnutls-devel] [sr #108634] Getter functions for gnutls_certificate_credentials_t In-Reply-To: <1410362139.2056.24.camel@waverley> References: <20140818-164743.sv96363.52612@savannah.gnu.org> <20140825-203439.sv707.32318@savannah.gnu.org> <20140907-132239.sv707.3610@savannah.gnu.org> <20140907-200409.sv96363.42296@savannah.gnu.org> <1410184796.1723.20.camel@waverley> <1410362139.2056.24.camel@waverley> Message-ID: On Wed, Sep 10, 2014 at 5:15 PM, Armin Burgmeier wrote: >> >> Indeed, if the constraints fail it would not proceed to the >> >> verification itself. I don't know if that's useful to proceed. If you >> >> could make a description of your use-case it may help to figure out >> >> whether some changes should be done. >> > My use-case is the following. I'm verifying the certificate of a peer. >> > If the certificate validates, I want to just go on with the connection. >> > However, if the signer of the certificate is not in my trust list, I >> > want to present a dialog to the user asking whether the certificate >> > should be trusted, for example if it is a self-signed certificate. >> > However, if the certificate is invalid beyond the signer not trusted >> > error (signature failure, or expired), then I want to reject the >> > connection without any user interaction. >> > At the moment I am achieving this by verifying the certificate twice: >> > Once "normally", and if that returns GNUTLS_CERT_SIGNER_NOT_FOUND, then >> > I am verifying it again but this time I add the certificate's issuer (as >> > sent by the peer) in the trust list artificially, so that the signer is >> > always found and the certificate is checked for other flaws. >> Ok, so I understand you would prefer to get as many as possible flags >> from the verification process. >> However, I'm not really sure that you add any value from that >> additional check. In the end an attacker would simply need to put an >> arbitrary end-user certificate in the chain and you'll revert to trust >> on first use just the same. > The value from the additional check is that I don't have to bug my users > with an extra dialog when the server has a certificate that is issued by > a trusted CA. Only when that is not the case I resort to > trust-on-first-use. Then yes, an attacker could present an arbitrary > certificate; but if the user has connected to the server before already > it will detect that the certificate is different from the previous > connection attempt. Ok, I understand. I believe a small modification of the verification functions would allow such usage. I don't have much time for such a change but that could be added in 3.4.0 todo list. >> > For my case, just exporting the DER-encoded data would be fine. >> > Basically just like gnutls_certificate_get_ours(), but with a >> > gnutls_certificate_credentials_t instead of a gnutls_session_t. >> > >> > In terms of API flexibility however, it might make sense to construct a >> > new gnutls_x509_crt_t and return that, i.e. doing the DER-decoding >> > inside gnutls, and documenting that the caller should >> > gnutls_x509_crt_free() the result. In this case, the API would always >> > return a newly constructed gnutls_x509_crt_t, but it is independent of >> > the actual storage in the credentials structure, as long as what is >> > stored can be converted to a gnutls_x509_crt_t. >> > What do you think? >> >> It seems ok, although there will be a discrepancy. The >> gnutls_privkey_t will not be released by the user, while the >> x509_crt_t should be released. > > We could instead return a copy of the gnutls_privkey_t, so that it has > to be released as well by the user. This would then again give some > flexibility in case the key storage inside the credentials structure > changes at some point in the future. That would be quite some work if gnutls_privkey_t is of type gnutls_pkcs11_privkey_t. There is no implementation of the copy process there yet, but is certainly doable. >> Maybe for consistency it would make >> sense to generate it on the fly, cache in the structure, and >> deinitialize it when whole structure gets deinitialized. Such an API >> should allow flexibility on the exporting type of the certificate as >> well, since openpgp or raw public keys should be able to be exported >> as well (even if that functionality is not implemented initially). > In that case, the keys and certificates would then be stored twice in > memory again (once they have been queried via the new API). That idea is > not very appealing to me, but maybe it's just a matter of taste... > either way should work for what I would need the new API for. I don't like the caching either much, but would go well with the static privkey_t. If both are allocated indeed that would be better. > What I don't understand is, how would returning a new > certificate/private key not allow openpgp or raw keys to be exported? I'm not sure I understand you. What I meant above, is that these keys should be able to be exported too. regards, Nikos From nmav at gnutls.org Thu Sep 11 22:56:14 2014 From: nmav at gnutls.org (Nikos Mavrogiannopoulos) Date: Thu, 11 Sep 2014 22:56:14 +0200 Subject: [gnutls-devel] Symbol versioning in gnutls broken -> crashes In-Reply-To: <20140524065807.GA2250@downhill.g.la> References: <20140524065807.GA2250@downhill.g.la> Message-ID: <1410468974.3121.3.camel@nomad.lan> On Sat, 2014-05-24 at 08:58 +0200, Andreas Metzler wrote: > Anyway, this causes hard crashes like in > or > . > > Fixing this in gnutls' source is pretty easy: In gnutls.map move the > contents of GNUTLS_1_4, GNUTLS_2_8, GNUTLS_2_10 and GNUTLS_2_12 to > GNUTLS_3_0_0. However it breaks the ABI, everything linking against > gnutls3 will need to be rebuilt after the change. Afaiu a soname bump > would therefore be the correct thing. Hi Andreas, I get back on that, as I noticed that now applications linked against gnutls in fedora wouldn't work in debian and vice-versa. While that may not be an issue in software compiled in debian for debian, it will be for any other software. For example I use a debian-based docker container to test the openconnect server, and that fails to execute the server if compiled in any other system. Closed source programs using gnutls will have the same issue. regards, Nikos From nmav at gnu.org Fri Sep 12 08:41:36 2014 From: nmav at gnu.org (Nikos Mavrogiannopoulos) Date: Fri, 12 Sep 2014 08:41:36 +0200 Subject: [gnutls-devel] [sr #108634] Getter functions for gnutls_certificate_credentials_t In-Reply-To: References: <20140818-164743.sv96363.52612@savannah.gnu.org> <20140825-203439.sv707.32318@savannah.gnu.org> <20140907-132239.sv707.3610@savannah.gnu.org> <20140907-200409.sv96363.42296@savannah.gnu.org> <1410184796.1723.20.camel@waverley> <1410362139.2056.24.camel@waverley> Message-ID: On Wed, Sep 10, 2014 at 5:50 PM, Nikos Mavrogiannopoulos wrote: >> The value from the additional check is that I don't have to bug my users >> with an extra dialog when the server has a certificate that is issued by >> a trusted CA. Only when that is not the case I resort to >> trust-on-first-use. Then yes, an attacker could present an arbitrary >> certificate; but if the user has connected to the server before already >> it will detect that the certificate is different from the previous >> connection attempt. > Ok, I understand. I believe a small modification of the verification > functions would allow such usage. I don't have much time for such a > change but that could be added in 3.4.0 todo list. I should have added here, that if there is a patch, I'd review it of course (and something like that would speed up the process). regards, Nikos From armin at arbur.net Fri Sep 12 17:10:21 2014 From: armin at arbur.net (Armin Burgmeier) Date: Fri, 12 Sep 2014 11:10:21 -0400 Subject: [gnutls-devel] [sr #108634] Getter functions for gnutls_certificate_credentials_t In-Reply-To: References: <20140818-164743.sv96363.52612@savannah.gnu.org> <20140825-203439.sv707.32318@savannah.gnu.org> <20140907-132239.sv707.3610@savannah.gnu.org> <20140907-200409.sv96363.42296@savannah.gnu.org> <1410184796.1723.20.camel@waverley> <1410362139.2056.24.camel@waverley> Message-ID: <1410534621.1339.7.camel@waverley> On Fri, 2014-09-12 at 08:41 +0200, Nikos Mavrogiannopoulos wrote: > On Wed, Sep 10, 2014 at 5:50 PM, Nikos Mavrogiannopoulos wrote: > >> The value from the additional check is that I don't have to bug my users > >> with an extra dialog when the server has a certificate that is issued by > >> a trusted CA. Only when that is not the case I resort to > >> trust-on-first-use. Then yes, an attacker could present an arbitrary > >> certificate; but if the user has connected to the server before already > >> it will detect that the certificate is different from the previous > >> connection attempt. > > Ok, I understand. I believe a small modification of the verification > > functions would allow such usage. I don't have much time for such a > > change but that could be added in 3.4.0 todo list. > > I should have added here, that if there is a patch, I'd review it of > course (and something like that would speed up the process). Yes, I'll try to come up with a patch. While trying to build from git master I noticed that in commit 469f8fb you added pkcs11x.c to lib/Makefile.am, however that file does not exist in the repository... did you maybe forget to git add it? Cheers, Armin From ametzler at bebt.de Fri Sep 12 18:22:27 2014 From: ametzler at bebt.de (Andreas Metzler) Date: Fri, 12 Sep 2014 18:22:27 +0200 Subject: [gnutls-devel] Symbol versioning in gnutls broken -> crashes In-Reply-To: <1410468974.3121.3.camel@nomad.lan> References: <20140524065807.GA2250@downhill.g.la> <1410468974.3121.3.camel@nomad.lan> Message-ID: <20140912162227.GA5709@downhill.g.la> On 2014-09-11 Nikos Mavrogiannopoulos wrote: > On Sat, 2014-05-24 at 08:58 +0200, Andreas Metzler wrote: >> Anyway, this causes hard crashes like in >> or >> . >> Fixing this in gnutls' source is pretty easy: In gnutls.map move the >> contents of GNUTLS_1_4, GNUTLS_2_8, GNUTLS_2_10 and GNUTLS_2_12 to >> GNUTLS_3_0_0. However it breaks the ABI, everything linking against >> gnutls3 will need to be rebuilt after the change. Afaiu a soname bump >> would therefore be the correct thing. > Hi Andreas, > I get back on that, as I noticed that now applications linked against > gnutls in fedora wouldn't work in debian and vice-versa. While that may > not be an issue in software compiled in debian for debian, it will be > for any other software. For example I use a debian-based docker > container to test the openconnect server, and that fails to execute the > server if compiled in any other system. Closed source programs using > gnutls will have the same issue. Hello, yes, that is exactly as expected. It sucks but afaict it could not be avoided. Fixing the symbol versioning breaks the ABI. The arguments for not breaking the ABI by changing the symbol-versioning in GnuTLS upstream *now* are are the same ones as in May. OTOH we in Debian needed to fix the symbol versioning because we care about partial upgrades. It will therefore continue to be broken until GnuTLS upstream bumps the symbol-versioning (and the soname) and Debian picks up this version. cu Andreas -- `What a good friend you are to him, Dr. Maturin. His other friends are so grateful to you.' `I sew his ears on from time to time, sure' From armin at arbur.net Fri Sep 12 20:16:06 2014 From: armin at arbur.net (Armin Burgmeier) Date: Fri, 12 Sep 2014 14:16:06 -0400 Subject: [gnutls-devel] [PATCH] Check for all error conditions when verifying a certificate Message-ID: <1410545766.1339.15.camel@waverley> This allows to check for all possible flaws with a certificate chain with a single call to gnutls_x509_crt_list_verify and friends. Signed-off-by: Armin Burgmeier --- lib/x509/verify.c | 164 ++++++++++++++++++++++++---------------------------- tests/test-chains.h | 13 +++-- 2 files changed, 82 insertions(+), 95 deletions(-) diff --git a/lib/x509/verify.c b/lib/x509/verify.c index 81b9b4d..26dfd19 100644 --- a/lib/x509/verify.c +++ b/lib/x509/verify.c @@ -572,7 +572,7 @@ verify_crt(gnutls_x509_crt_t cert, gnutls_datum_t cert_signature = { NULL, 0 }; gnutls_x509_crt_t issuer = NULL; int issuer_version, hash_algo; - bool result = 0; + bool result = 1; const mac_entry_st * me; unsigned int out = 0, usage; int sigalg, ret; @@ -581,13 +581,12 @@ verify_crt(gnutls_x509_crt_t cert, *output = 0; if (*max_path == 0) { - out = + out |= GNUTLS_CERT_SIGNER_CONSTRAINTS_FAILURE | GNUTLS_CERT_INVALID; - if (output) - *output |= out; gnutls_assert(); result = 0; + /* bail immediately, to avoid inconistency */ goto cleanup; } (*max_path)--; @@ -599,31 +598,26 @@ verify_crt(gnutls_x509_crt_t cert, * authorities. */ if (issuer == NULL) { - out = GNUTLS_CERT_SIGNER_NOT_FOUND | GNUTLS_CERT_INVALID; - if (output) - *output |= out; + out |= GNUTLS_CERT_SIGNER_NOT_FOUND | GNUTLS_CERT_INVALID; gnutls_assert(); result = 0; - goto cleanup; } if (_issuer != NULL) *_issuer = issuer; - if (nc != NULL) { + if (nc != NULL && issuer != NULL) { /* append the issuer's constraints */ ret = gnutls_x509_crt_get_name_constraints(issuer, nc, GNUTLS_NAME_CONSTRAINTS_FLAG_APPEND, NULL); if (ret < 0 && ret != GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE) { nc_fail: - out = + out |= GNUTLS_CERT_SIGNER_CONSTRAINTS_FAILURE | GNUTLS_CERT_INVALID; - if (output) - *output |= out; gnutls_assert(); result = 0; - goto cleanup; + goto nc_done; } /* only check name constraints in server certificates, not CAs */ @@ -659,26 +653,26 @@ verify_crt(gnutls_x509_crt_t cert, } } } + nc_done: + + if(issuer != NULL) + issuer_version = gnutls_x509_crt_get_version(issuer); + else + issuer_version = 0; - issuer_version = gnutls_x509_crt_get_version(issuer); if (issuer_version < 0) { gnutls_assert(); result = 0; - goto cleanup; - } - - if (!(flags & GNUTLS_VERIFY_DISABLE_CA_SIGN) && - ((flags & GNUTLS_VERIFY_DO_NOT_ALLOW_X509_V1_CA_CRT) - || issuer_version != 1)) { + } else if (issuer != NULL && + !(flags & GNUTLS_VERIFY_DISABLE_CA_SIGN) && + ((flags & GNUTLS_VERIFY_DO_NOT_ALLOW_X509_V1_CA_CRT) + || issuer_version != 1)) { if (check_if_ca(cert, issuer, max_path, flags) != 1) { gnutls_assert(); - out = + out |= GNUTLS_CERT_SIGNER_NOT_CA | GNUTLS_CERT_INVALID; - if (output) - *output |= out; result = 0; - goto cleanup; } ret = @@ -686,13 +680,10 @@ verify_crt(gnutls_x509_crt_t cert, if (ret >= 0) { if (!(usage & GNUTLS_KEY_KEY_CERT_SIGN)) { gnutls_assert(); - out = + out |= GNUTLS_CERT_SIGNER_CONSTRAINTS_FAILURE | GNUTLS_CERT_INVALID; - if (output) - *output |= out; result = 0; - goto cleanup; } } } @@ -703,7 +694,7 @@ verify_crt(gnutls_x509_crt_t cert, if (ret < 0) { result = 0; gnutls_assert(); - goto cleanup; + cert_signed_data.data = NULL; } ret = @@ -712,7 +703,7 @@ verify_crt(gnutls_x509_crt_t cert, if (ret < 0) { result = 0; gnutls_assert(); - goto cleanup; + cert_signature.data = NULL; } ret = @@ -721,75 +712,70 @@ verify_crt(gnutls_x509_crt_t cert, if (ret < 0) { result = 0; gnutls_assert(); - goto cleanup; } sigalg = ret; - if (is_level_acceptable(cert, issuer, sigalg, flags) == 0) { - gnutls_assert(); - out = - GNUTLS_CERT_INSECURE_ALGORITHM | - GNUTLS_CERT_INVALID; - if (output) - *output |= out; - result = 0; - goto cleanup; - } + if (sigalg >= 0 && + cert_signed_data.data != NULL && + cert_signature.data != NULL) { + if (issuer != NULL && + is_level_acceptable(cert, issuer, sigalg, flags) == 0) { + gnutls_assert(); + out |= + GNUTLS_CERT_INSECURE_ALGORITHM | + GNUTLS_CERT_INVALID; + result = 0; + } - /* If the certificate is not self signed check if the algorithms - * used are secure. If the certificate is self signed it doesn't - * really matter. - */ - if (gnutls_sign_is_secure(sigalg) == 0 && - is_broken_allowed(sigalg, flags) == 0 && - is_issuer(cert, cert) == 0) { - gnutls_assert(); - out = - GNUTLS_CERT_INSECURE_ALGORITHM | - GNUTLS_CERT_INVALID; - if (output) - *output |= out; - result = 0; - goto cleanup; - } + /* If the certificate is not self signed check if the algorithms + * used are secure. If the certificate is self signed it doesn't + * really matter. + */ + if (gnutls_sign_is_secure(sigalg) == 0 && + is_broken_allowed(sigalg, flags) == 0 && + is_issuer(cert, cert) == 0) { + gnutls_assert(); + out |= + GNUTLS_CERT_INSECURE_ALGORITHM | + GNUTLS_CERT_INVALID; + result = 0; + } - hash_algo = gnutls_sign_get_hash_algorithm(sigalg); - me = mac_to_entry(hash_algo); - if (me == NULL) { - gnutls_assert(); - result = 0; - goto cleanup; + hash_algo = gnutls_sign_get_hash_algorithm(sigalg); + me = mac_to_entry(hash_algo); + if (me == NULL) { + gnutls_assert(); + result = 0; + } else if (issuer != NULL) { + ret = + _gnutls_x509_verify_data(me, + &cert_signed_data, + &cert_signature, + issuer); + if (ret == GNUTLS_E_PK_SIG_VERIFY_FAILED) { + gnutls_assert(); + out |= + GNUTLS_CERT_INVALID | + GNUTLS_CERT_SIGNATURE_FAILURE; + /* error. ignore it */ + result = 0; + } else if (ret < 0) { + result = 0; + gnutls_assert(); + } + } } - ret = - _gnutls_x509_verify_data(me, - &cert_signed_data, &cert_signature, - issuer); - if (ret == GNUTLS_E_PK_SIG_VERIFY_FAILED) { - gnutls_assert(); - out |= GNUTLS_CERT_INVALID | GNUTLS_CERT_SIGNATURE_FAILURE; - /* error. ignore it */ - if (output) - *output |= out; - result = 0; - } else if (ret < 0) { - result = 0; - gnutls_assert(); - goto cleanup; - } else if (ret == 1) - result = 1; - /* Check activation/expiration times */ if (!(flags & GNUTLS_VERIFY_DISABLE_TIME_CHECKS)) { /* check the time of the issuer first */ - if (!(flags & GNUTLS_VERIFY_DISABLE_TRUSTED_TIME_CHECKS)) { + if (issuer != NULL && + !(flags & GNUTLS_VERIFY_DISABLE_TRUSTED_TIME_CHECKS)) { out |= check_time_status(issuer, now); if (out != 0) { gnutls_assert(); result = 0; - if (output) - *output |= out; } } @@ -797,12 +783,13 @@ verify_crt(gnutls_x509_crt_t cert, if (out != 0) { gnutls_assert(); result = 0; - if (output) - *output |= out; } } cleanup: + if (output) + *output |= out; + if (func) { if (result == 0) { out |= GNUTLS_CERT_INVALID; @@ -1414,7 +1401,6 @@ gnutls_x509_crl_verify(gnutls_x509_crl_t crl, *verify |= GNUTLS_CERT_SIGNER_NOT_FOUND | GNUTLS_CERT_INVALID; - return 0; } if (!(flags & GNUTLS_VERIFY_DISABLE_CA_SIGN)) { @@ -1424,7 +1410,6 @@ gnutls_x509_crl_verify(gnutls_x509_crl_t crl, *verify |= GNUTLS_CERT_SIGNER_NOT_CA | GNUTLS_CERT_INVALID; - return 0; } result = @@ -1436,7 +1421,6 @@ gnutls_x509_crl_verify(gnutls_x509_crl_t crl, *verify |= GNUTLS_CERT_SIGNER_CONSTRAINTS_FAILURE | GNUTLS_CERT_INVALID; - return 0; } } } @@ -1504,10 +1488,10 @@ gnutls_x509_crl_verify(gnutls_x509_crl_t crl, *verify |= GNUTLS_CERT_REVOCATION_DATA_SUPERSEDED; - cleanup: if (verify) *verify |= GNUTLS_CERT_INVALID; + cleanup: _gnutls_free_datum(&crl_signed_data); _gnutls_free_datum(&crl_signature); diff --git a/tests/test-chains.h b/tests/test-chains.h index 28974e1..ff9086f 100644 --- a/tests/test-chains.h +++ b/tests/test-chains.h @@ -1366,9 +1366,11 @@ static struct } chains[] = { { "CVE-2014-0092", cve_2014_0092_check, &cve_2014_0092_check[1], - 0, GNUTLS_CERT_SIGNER_NOT_CA | GNUTLS_CERT_INVALID }, + GNUTLS_VERIFY_DISABLE_TIME_CHECKS, + GNUTLS_CERT_SIGNER_NOT_CA | GNUTLS_CERT_INVALID }, { "CVE-2008-4989", cve_2008_4989_chain, &cve_2008_4989_chain[2], - 0, GNUTLS_CERT_SIGNER_NOT_FOUND | GNUTLS_CERT_INVALID }, + GNUTLS_VERIFY_DISABLE_TIME_CHECKS, + GNUTLS_CERT_SIGNER_NOT_FOUND | GNUTLS_CERT_INVALID }, { "amazon.com ok", verisign_com_chain_g5, &verisign_com_chain_g5[4], GNUTLS_VERIFY_DISABLE_TIME_CHECKS | GNUTLS_PROFILE_TO_VFLAGS(GNUTLS_PROFILE_LOW), 0 }, @@ -1404,9 +1406,10 @@ static struct GNUTLS_VERIFY_DISABLE_TIME_CHECKS, 0 }, { "rsa-md5 fail", mayfirst_chain, &mayfirst_chain[1], - 0, GNUTLS_CERT_INSECURE_ALGORITHM | GNUTLS_CERT_INVALID }, + GNUTLS_VERIFY_DISABLE_TIME_CHECKS, + GNUTLS_CERT_INSECURE_ALGORITHM | GNUTLS_CERT_INVALID }, { "rsa-md5 not ok", mayfirst_chain, &mayfirst_chain[1], - GNUTLS_VERIFY_ALLOW_SIGN_RSA_MD2, + GNUTLS_VERIFY_DISABLE_TIME_CHECKS | GNUTLS_VERIFY_ALLOW_SIGN_RSA_MD2, GNUTLS_CERT_INSECURE_ALGORITHM | GNUTLS_CERT_INVALID }, { "rsa-md5 not ok2", mayfirst_chain, &mayfirst_chain[1], GNUTLS_VERIFY_ALLOW_SIGN_RSA_MD5, @@ -1449,7 +1452,7 @@ static struct GNUTLS_VERIFY_ALLOW_SIGN_RSA_MD5, 0 }, { "cacertrsamd5 short-cut not ok", cacertrsamd5, &cacertrsamd5[0], GNUTLS_VERIFY_DO_NOT_ALLOW_SAME, - GNUTLS_CERT_SIGNER_NOT_FOUND | GNUTLS_CERT_INVALID }, + GNUTLS_CERT_SIGNER_NOT_FOUND | GNUTLS_CERT_INSECURE_ALGORITHM | GNUTLS_CERT_INVALID }, { "cacertrsamd5 short-cut ok", cacertrsamd5, &cacertrsamd5[1], 0, 0 }, { "ecc cert ok", ecc_cert, &ecc_cert[1], GNUTLS_PROFILE_TO_VFLAGS(GNUTLS_PROFILE_HIGH), 0 }, -- 2.1.0 From nmav at gnutls.org Fri Sep 12 20:36:17 2014 From: nmav at gnutls.org (Nikos Mavrogiannopoulos) Date: Fri, 12 Sep 2014 20:36:17 +0200 Subject: [gnutls-devel] Symbol versioning in gnutls broken -> crashes In-Reply-To: <20140912162227.GA5709@downhill.g.la> References: <20140524065807.GA2250@downhill.g.la> <1410468974.3121.3.camel@nomad.lan> <20140912162227.GA5709@downhill.g.la> Message-ID: <1410546977.11023.8.camel@nomad.lan> On Fri, 2014-09-12 at 18:22 +0200, Andreas Metzler wrote: > > Hi Andreas, > > I get back on that, as I noticed that now applications linked against > > gnutls in fedora wouldn't work in debian and vice-versa. While that may > > not be an issue in software compiled in debian for debian, it will be > > for any other software. For example I use a debian-based docker > > container to test the openconnect server, and that fails to execute the > > server if compiled in any other system. Closed source programs using > > gnutls will have the same issue. > Hello, > yes, that is exactly as expected. It sucks but afaict it could not be > avoided. Fixing the symbol versioning breaks the ABI. The arguments > for not breaking the ABI by changing the symbol-versioning in GnuTLS > upstream *now* are are the same ones as in May. > OTOH we in Debian needed to fix the symbol versioning because we > care about partial upgrades. > > It will therefore continue to be broken until GnuTLS upstream bumps > the symbol-versioning (and the soname) and Debian picks up this > version. Indeed, but the ABI in 3.x is fixed since years and will remain fixed for years too; there is no plan to change it. Why not change the ABI in the old releases as a work around? Having a different ABI in the latest release ensures that debian will remain binary incompatible with any software build with modern gnutls for the foreseeable future. regards, Nikos From armin at arbur.net Fri Sep 12 20:39:52 2014 From: armin at arbur.net (Armin Burgmeier) Date: Fri, 12 Sep 2014 14:39:52 -0400 Subject: [gnutls-devel] [PATCH] Check for all error conditions when verifying a certificate In-Reply-To: <1410545766.1339.15.camel@waverley> References: <1410545766.1339.15.camel@waverley> Message-ID: <1410547192.1339.22.camel@waverley> This is an attempt at a patch for what we discussed in the other email thread. I have made sure that the tests still pass (with minor modifications where additional failure reasons are now expected). Since this is in a quite sensitive part of the code it would be good to have this reviewed carefully... > @@ -1504,10 +1488,10 @@ gnutls_x509_crl_verify(gnutls_x509_crl_t crl, > *verify |= GNUTLS_CERT_REVOCATION_DATA_SUPERSEDED; > > > - cleanup: > if (verify) > *verify |= GNUTLS_CERT_INVALID; > > + cleanup: > _gnutls_free_datum(&crl_signed_data); > _gnutls_free_datum(&crl_signature); I have two comments to this hunk. 1) the question where to put the cleanup label is basically what should happen with the *verify output parameter when the function itself does not return GNUTLS_E_SUCCESS. Probably it does not matter because when the function does not run successfully, the verification output is of no good use anyway. 2) If I understand the code correctly, then the verify result will *always* have the GNUTLS_CERT_INVALID flag set, even for perfectly valid CRLs. I have the impression the check should read "if(verify && result ! = 0)" instead of just "if(verify)"... Is there a unit test for this function? Cheers, Armin From ametzler at bebt.de Sat Sep 13 08:04:41 2014 From: ametzler at bebt.de (Andreas Metzler) Date: Sat, 13 Sep 2014 08:04:41 +0200 Subject: [gnutls-devel] Symbol versioning in gnutls broken -> crashes In-Reply-To: <1410546977.11023.8.camel@nomad.lan> References: <20140524065807.GA2250@downhill.g.la> <1410468974.3121.3.camel@nomad.lan> <20140912162227.GA5709@downhill.g.la> <1410546977.11023.8.camel@nomad.lan> Message-ID: <20140913060441.GA2429@downhill.g.la> On 2014-09-12 Nikos Mavrogiannopoulos wrote: > On Fri, 2014-09-12 at 18:22 +0200, Andreas Metzler wrote: [Debian GnuTLS v3 package use a different ABI and soname than upstream] >> It will therefore continue to be broken until GnuTLS upstream bumps >> the symbol-versioning (and the soname) and Debian picks up this >> version. > Indeed, but the ABI in 3.x is fixed since years and will remain fixed > for years too; there is no plan to change it. Why not change the ABI in > the old releases as a work around? Having a different ABI in the latest > release ensures that debian will remain binary incompatible with any > software build with modern gnutls for the foreseeable future. Hello, GnuTLS 2.x is part of the current Debian stable release ("wheezy" aka 7.6). There is simply no way to retroactively change the gnutls ABI in wheezy and rebuild all packages in it. And because of partial upgrades GnuTLS 2.x in wheezy and GnuTLS 3.x in wheezy+1 (the soon to be frozen "jessie") will need to be co-installable without breaking each other. It is theorethically possible to do a transition and switch back to the upstream GnuTLS 3.x ABI for the next-next Debian release, but I doubt that it is really worth the trouble because of the timeframe. Debian jessie+1 will probably be released in 2017. The additional transition will also complicate things for Debian derivatives (like Ubuntu) who have a different release cycle. cu Andreas -- `What a good friend you are to him, Dr. Maturin. His other friends are so grateful to you.' `I sew his ears on from time to time, sure' From nmav at gnutls.org Sat Sep 13 09:44:26 2014 From: nmav at gnutls.org (Nikos Mavrogiannopoulos) Date: Sat, 13 Sep 2014 09:44:26 +0200 Subject: [gnutls-devel] [PATCH] Check for all error conditions when verifying a certificate In-Reply-To: <1410545766.1339.15.camel@waverley> References: <1410545766.1339.15.camel@waverley> Message-ID: <1410594266.2452.17.camel@nomad.lan> On Fri, 2014-09-12 at 14:16 -0400, Armin Burgmeier wrote: Thanks. Some comments inline. > - if (!(flags & GNUTLS_VERIFY_DISABLE_CA_SIGN) && > - ((flags & GNUTLS_VERIFY_DO_NOT_ALLOW_X509_V1_CA_CRT) > - || issuer_version != 1)) { > + } else if (issuer != NULL && > + !(flags & GNUTLS_VERIFY_DISABLE_CA_SIGN) && > + ((flags & GNUTLS_VERIFY_DO_NOT_ALLOW_X509_V1_CA_CRT) > + || issuer_version != 1)) { After this point wouldn't it make sense to have one large block with an if (issuer != NULL)? (or at least one that is interrupted at some point). I'm worried about the multiple checks for if not NULL, as it is easy to miss one. > if (func) { > if (result == 0) { > out |= GNUTLS_CERT_INVALID; > @@ -1414,7 +1401,6 @@ gnutls_x509_crl_verify(gnutls_x509_crl_t crl, > *verify |= > GNUTLS_CERT_SIGNER_NOT_FOUND | > GNUTLS_CERT_INVALID; > - return 0; > } > > if (!(flags & GNUTLS_VERIFY_DISABLE_CA_SIGN)) { > @@ -1424,7 +1410,6 @@ gnutls_x509_crl_verify(gnutls_x509_crl_t crl, > *verify |= > GNUTLS_CERT_SIGNER_NOT_CA | > GNUTLS_CERT_INVALID; > - return 0; > } Shouldn't the if (issuer != NULL) be repeated here as well? Even if gnutls_x509_crt_get_ca_status() doesn't crash, you'll most probably get a flag GNUTLS_CERT_SIGNER_NOT_CA, which is misleading as there is no signer there. regards, Nikos From nmav at gnutls.org Sat Sep 13 09:48:51 2014 From: nmav at gnutls.org (Nikos Mavrogiannopoulos) Date: Sat, 13 Sep 2014 09:48:51 +0200 Subject: [gnutls-devel] [PATCH] Check for all error conditions when verifying a certificate In-Reply-To: <1410547192.1339.22.camel@waverley> References: <1410545766.1339.15.camel@waverley> <1410547192.1339.22.camel@waverley> Message-ID: <1410594531.2452.20.camel@nomad.lan> On Fri, 2014-09-12 at 14:39 -0400, Armin Burgmeier wrote: > This is an attempt at a patch for what we discussed in the other email > thread. I have made sure that the tests still pass (with minor > modifications where additional failure reasons are now expected). Since > this is in a quite sensitive part of the code it would be good to have > this reviewed carefully... > > > @@ -1504,10 +1488,10 @@ gnutls_x509_crl_verify(gnutls_x509_crl_t crl, > > *verify |= GNUTLS_CERT_REVOCATION_DATA_SUPERSEDED; > > > > > > - cleanup: > > if (verify) > > *verify |= GNUTLS_CERT_INVALID; > > > > + cleanup: > > _gnutls_free_datum(&crl_signed_data); > > _gnutls_free_datum(&crl_signature); > > I have two comments to this hunk. > > 1) the question where to put the cleanup label is basically what should > happen with the *verify output parameter when the function itself does > not return GNUTLS_E_SUCCESS. Probably it does not matter because when > the function does not run successfully, the verification output is of no > good use anyway. > > 2) If I understand the code correctly, then the verify result will > *always* have the GNUTLS_CERT_INVALID flag set, even for perfectly valid > CRLs. I have the impression the check should read "if(verify && result ! > = 0)" instead of just "if(verify)"... Is there a unit test for this > function? That is indeed correct. The check should have been if (verify && *verify) ... It seems we need some unit tests for that one. regards, Nikos > > Cheers, > Armin > > > _______________________________________________ > Gnutls-devel mailing list > Gnutls-devel at lists.gnutls.org > http://lists.gnupg.org/mailman/listinfo/gnutls-devel From armin at arbur.net Sat Sep 13 17:45:51 2014 From: armin at arbur.net (Armin Burgmeier) Date: Sat, 13 Sep 2014 11:45:51 -0400 Subject: [gnutls-devel] [PATCH] Check for all error conditions when verifying a certificate In-Reply-To: <1410594266.2452.17.camel@nomad.lan> References: <1410545766.1339.15.camel@waverley> <1410594266.2452.17.camel@nomad.lan> Message-ID: <1410623151.1354.11.camel@waverley> Thanks for the comments. I'll send an updated patch shortly. Cheers, Armin On Sat, 2014-09-13 at 09:44 +0200, Nikos Mavrogiannopoulos wrote: > On Fri, 2014-09-12 at 14:16 -0400, Armin Burgmeier wrote: > > Thanks. Some comments inline. > > > - if (!(flags & GNUTLS_VERIFY_DISABLE_CA_SIGN) && > > - ((flags & GNUTLS_VERIFY_DO_NOT_ALLOW_X509_V1_CA_CRT) > > - || issuer_version != 1)) { > > + } else if (issuer != NULL && > > + !(flags & GNUTLS_VERIFY_DISABLE_CA_SIGN) && > > + ((flags & GNUTLS_VERIFY_DO_NOT_ALLOW_X509_V1_CA_CRT) > > + || issuer_version != 1)) { > > After this point wouldn't it make sense to have one large block with an > if (issuer != NULL)? (or at least one that is interrupted at some > point). I'm worried about the multiple checks for if not NULL, as it is > easy to miss one. My motivation mostly was to avoid too many levels of indentation, to maybe keep is easier to follow the logic of the code. But I don't have a strong opinion. I have changed it to use a large issuer != NULL block in the updated patch. > > if (func) { > > if (result == 0) { > > out |= GNUTLS_CERT_INVALID; > > @@ -1414,7 +1401,6 @@ gnutls_x509_crl_verify(gnutls_x509_crl_t crl, > > *verify |= > > GNUTLS_CERT_SIGNER_NOT_FOUND | > > GNUTLS_CERT_INVALID; > > - return 0; > > } > > > > if (!(flags & GNUTLS_VERIFY_DISABLE_CA_SIGN)) { > > @@ -1424,7 +1410,6 @@ gnutls_x509_crl_verify(gnutls_x509_crl_t crl, > > *verify |= > > GNUTLS_CERT_SIGNER_NOT_CA | > > GNUTLS_CERT_INVALID; > > - return 0; > > } > > Shouldn't the if (issuer != NULL) be repeated here as well? Even if > gnutls_x509_crt_get_ca_status() doesn't crash, you'll most probably get > a flag GNUTLS_CERT_SIGNER_NOT_CA, which is misleading as there is no > signer there. Agreed. I added the check there. From armin at arbur.net Sat Sep 13 17:46:42 2014 From: armin at arbur.net (Armin Burgmeier) Date: Sat, 13 Sep 2014 11:46:42 -0400 Subject: [gnutls-devel] [PATCH] Check for all error conditions when verifying a certificate Message-ID: <1410623202.1354.12.camel@waverley> This allows to check for all possible flaws with a certificate chain with a single call to gnutls_x509_crt_list_verify and friends. Signed-off-by: Armin Burgmeier --- lib/x509/verify.c | 393 +++++++++++++++++++++++++--------------------------- tests/test-chains.h | 13 +- 2 files changed, 194 insertions(+), 212 deletions(-) diff --git a/lib/x509/verify.c b/lib/x509/verify.c index 0302973..6c4ef5d 100644 --- a/lib/x509/verify.c +++ b/lib/x509/verify.c @@ -572,7 +572,7 @@ verify_crt(gnutls_x509_crt_t cert, gnutls_datum_t cert_signature = { NULL, 0 }; gnutls_x509_crt_t issuer = NULL; int issuer_version, hash_algo; - bool result = 0; + bool result = 1; const mac_entry_st * me; unsigned int out = 0, usage; int sigalg, ret; @@ -581,13 +581,12 @@ verify_crt(gnutls_x509_crt_t cert, *output = 0; if (*max_path == 0) { - out = + out |= GNUTLS_CERT_SIGNER_CONSTRAINTS_FAILURE | GNUTLS_CERT_INVALID; - if (output) - *output |= out; gnutls_assert(); result = 0; + /* bail immediately, to avoid inconistency */ goto cleanup; } (*max_path)--; @@ -595,115 +594,16 @@ verify_crt(gnutls_x509_crt_t cert, if (tcas_size >= 1) issuer = find_issuer(cert, trusted_cas, tcas_size); - /* issuer is not in trusted certificate - * authorities. - */ - if (issuer == NULL) { - out = GNUTLS_CERT_SIGNER_NOT_FOUND | GNUTLS_CERT_INVALID; - if (output) - *output |= out; - gnutls_assert(); - result = 0; - goto cleanup; - } - if (_issuer != NULL) *_issuer = issuer; - if (nc != NULL) { - /* append the issuer's constraints */ - ret = gnutls_x509_crt_get_name_constraints(issuer, nc, - GNUTLS_NAME_CONSTRAINTS_FLAG_APPEND, NULL); - if (ret < 0 && ret != GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE) { - nc_fail: - out = - GNUTLS_CERT_SIGNER_CONSTRAINTS_FAILURE | - GNUTLS_CERT_INVALID; - if (output) - *output |= out; - gnutls_assert(); - result = 0; - goto cleanup; - } - - /* only check name constraints in server certificates, not CAs */ - if (end_cert != 0) { - ret = gnutls_x509_name_constraints_check_crt(nc, GNUTLS_SAN_DNSNAME, cert); - if (ret == 0) { - gnutls_assert(); - goto nc_fail; - } - - ret = gnutls_x509_name_constraints_check_crt(nc, GNUTLS_SAN_RFC822NAME, cert); - if (ret == 0) { - gnutls_assert(); - goto nc_fail; - } - - ret = gnutls_x509_name_constraints_check_crt(nc, GNUTLS_SAN_DN, cert); - if (ret == 0) { - gnutls_assert(); - goto nc_fail; - } - - ret = gnutls_x509_name_constraints_check_crt(nc, GNUTLS_SAN_URI, cert); - if (ret == 0) { - gnutls_assert(); - goto nc_fail; - } - - ret = gnutls_x509_name_constraints_check_crt(nc, GNUTLS_SAN_IPADDRESS, cert); - if (ret == 0) { - gnutls_assert(); - goto nc_fail; - } - } - } - - issuer_version = gnutls_x509_crt_get_version(issuer); - if (issuer_version < 0) { - gnutls_assert(); - result = 0; - goto cleanup; - } - - if (!(flags & GNUTLS_VERIFY_DISABLE_CA_SIGN) && - ((flags & GNUTLS_VERIFY_DO_NOT_ALLOW_X509_V1_CA_CRT) - || issuer_version != 1)) { - if (check_if_ca(cert, issuer, max_path, flags) != 1) { - gnutls_assert(); - out = - GNUTLS_CERT_SIGNER_NOT_CA | - GNUTLS_CERT_INVALID; - if (output) - *output |= out; - result = 0; - goto cleanup; - } - - ret = - gnutls_x509_crt_get_key_usage(issuer, &usage, NULL); - if (ret >= 0) { - if (!(usage & GNUTLS_KEY_KEY_CERT_SIGN)) { - gnutls_assert(); - out = - GNUTLS_CERT_SIGNER_CONSTRAINTS_FAILURE - | GNUTLS_CERT_INVALID; - if (output) - *output |= out; - result = 0; - goto cleanup; - } - } - } - ret = _gnutls_x509_get_signed_data(cert->cert, &cert->der, "tbsCertificate", &cert_signed_data); if (ret < 0) { result = 0; gnutls_assert(); - goto cleanup; + cert_signed_data.data = NULL; } ret = @@ -712,7 +612,7 @@ verify_crt(gnutls_x509_crt_t cert, if (ret < 0) { result = 0; gnutls_assert(); - goto cleanup; + cert_signature.data = NULL; } ret = @@ -721,75 +621,156 @@ verify_crt(gnutls_x509_crt_t cert, if (ret < 0) { result = 0; gnutls_assert(); - goto cleanup; } sigalg = ret; - if (is_level_acceptable(cert, issuer, sigalg, flags) == 0) { - gnutls_assert(); - out = - GNUTLS_CERT_INSECURE_ALGORITHM | - GNUTLS_CERT_INVALID; - if (output) - *output |= out; - result = 0; - goto cleanup; - } - - /* If the certificate is not self signed check if the algorithms - * used are secure. If the certificate is self signed it doesn't - * really matter. + /* issuer is not in trusted certificate + * authorities. */ - if (gnutls_sign_is_secure(sigalg) == 0 && - is_broken_allowed(sigalg, flags) == 0 && - is_issuer(cert, cert) == 0) { + if (issuer == NULL) { + out |= GNUTLS_CERT_SIGNER_NOT_FOUND | GNUTLS_CERT_INVALID; gnutls_assert(); - out = - GNUTLS_CERT_INSECURE_ALGORITHM | - GNUTLS_CERT_INVALID; - if (output) - *output |= out; result = 0; - goto cleanup; - } + } else { + if (nc != NULL) { + /* append the issuer's constraints */ + ret = gnutls_x509_crt_get_name_constraints(issuer, nc, + GNUTLS_NAME_CONSTRAINTS_FLAG_APPEND, NULL); + if (ret < 0 && ret != GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE) { + nc_fail: + out |= + GNUTLS_CERT_SIGNER_CONSTRAINTS_FAILURE | + GNUTLS_CERT_INVALID; + gnutls_assert(); + result = 0; + goto nc_done; + } - hash_algo = gnutls_sign_get_hash_algorithm(sigalg); - me = mac_to_entry(hash_algo); - if (me == NULL) { - gnutls_assert(); - result = 0; - goto cleanup; + /* only check name constraints in server certificates, not CAs */ + if (end_cert != 0) { + ret = gnutls_x509_name_constraints_check_crt(nc, GNUTLS_SAN_DNSNAME, cert); + if (ret == 0) { + gnutls_assert(); + goto nc_fail; + } + + ret = gnutls_x509_name_constraints_check_crt(nc, GNUTLS_SAN_RFC822NAME, cert); + if (ret == 0) { + gnutls_assert(); + goto nc_fail; + } + + ret = gnutls_x509_name_constraints_check_crt(nc, GNUTLS_SAN_DN, cert); + if (ret == 0) { + gnutls_assert(); + goto nc_fail; + } + + ret = gnutls_x509_name_constraints_check_crt(nc, GNUTLS_SAN_URI, cert); + if (ret == 0) { + gnutls_assert(); + goto nc_fail; + } + + ret = gnutls_x509_name_constraints_check_crt(nc, GNUTLS_SAN_IPADDRESS, cert); + if (ret == 0) { + gnutls_assert(); + goto nc_fail; + } + } + } + nc_done: + + issuer_version = gnutls_x509_crt_get_version(issuer); + + if (issuer_version < 0) { + gnutls_assert(); + result = 0; + } else if (!(flags & GNUTLS_VERIFY_DISABLE_CA_SIGN) && + ((flags & GNUTLS_VERIFY_DO_NOT_ALLOW_X509_V1_CA_CRT) + || issuer_version != 1)) { + if (check_if_ca(cert, issuer, max_path, flags) != 1) { + gnutls_assert(); + out |= + GNUTLS_CERT_SIGNER_NOT_CA | + GNUTLS_CERT_INVALID; + result = 0; + } + + ret = + gnutls_x509_crt_get_key_usage(issuer, &usage, NULL); + if (ret >= 0) { + if (!(usage & GNUTLS_KEY_KEY_CERT_SIGN)) { + gnutls_assert(); + out |= + GNUTLS_CERT_SIGNER_CONSTRAINTS_FAILURE + | GNUTLS_CERT_INVALID; + result = 0; + } + } + } + + if (sigalg >= 0 && + is_level_acceptable(cert, issuer, sigalg, flags) == 0) { + gnutls_assert(); + out |= + GNUTLS_CERT_INSECURE_ALGORITHM | + GNUTLS_CERT_INVALID; + result = 0; + } + + hash_algo = gnutls_sign_get_hash_algorithm(sigalg); + me = mac_to_entry(hash_algo); + if (me == NULL) { + gnutls_assert(); + result = 0; + } else if (cert_signed_data.data != NULL && + cert_signature.data != NULL) { + ret = + _gnutls_x509_verify_data(me, + &cert_signed_data, + &cert_signature, + issuer); + if (ret == GNUTLS_E_PK_SIG_VERIFY_FAILED) { + gnutls_assert(); + out |= + GNUTLS_CERT_INVALID | + GNUTLS_CERT_SIGNATURE_FAILURE; + /* error. ignore it */ + result = 0; + } else if (ret < 0) { + result = 0; + gnutls_assert(); + } + } } - ret = - _gnutls_x509_verify_data(me, - &cert_signed_data, &cert_signature, - issuer); - if (ret == GNUTLS_E_PK_SIG_VERIFY_FAILED) { - gnutls_assert(); - out |= GNUTLS_CERT_INVALID | GNUTLS_CERT_SIGNATURE_FAILURE; - /* error. ignore it */ - if (output) - *output |= out; - result = 0; - } else if (ret < 0) { - result = 0; - gnutls_assert(); - goto cleanup; - } else if (ret == 1) - result = 1; + if (sigalg >= 0) { + /* If the certificate is not self signed check if the algorithms + * used are secure. If the certificate is self signed it doesn't + * really matter. + */ + if (gnutls_sign_is_secure(sigalg) == 0 && + is_broken_allowed(sigalg, flags) == 0 && + is_issuer(cert, cert) == 0) { + gnutls_assert(); + out |= + GNUTLS_CERT_INSECURE_ALGORITHM | + GNUTLS_CERT_INVALID; + result = 0; + } + } /* Check activation/expiration times */ if (!(flags & GNUTLS_VERIFY_DISABLE_TIME_CHECKS)) { /* check the time of the issuer first */ - if (!(flags & GNUTLS_VERIFY_DISABLE_TRUSTED_TIME_CHECKS)) { + if (issuer != NULL && + !(flags & GNUTLS_VERIFY_DISABLE_TRUSTED_TIME_CHECKS)) { out |= check_time_status(issuer, now); if (out != 0) { gnutls_assert(); result = 0; - if (output) - *output |= out; } } @@ -797,12 +778,13 @@ verify_crt(gnutls_x509_crt_t cert, if (out != 0) { gnutls_assert(); result = 0; - if (output) - *output |= out; } } cleanup: + if (output) + *output |= out; + if (func) { if (result == 0) { out |= GNUTLS_CERT_INVALID; @@ -1405,42 +1387,6 @@ gnutls_x509_crl_verify(gnutls_x509_crl_t crl, if (tcas_size >= 1) issuer = find_crl_issuer(crl, trusted_cas, tcas_size); - /* issuer is not in trusted certificate - * authorities. - */ - if (issuer == NULL) { - gnutls_assert(); - if (verify) - *verify |= - GNUTLS_CERT_SIGNER_NOT_FOUND | - GNUTLS_CERT_INVALID; - return 0; - } - - if (!(flags & GNUTLS_VERIFY_DISABLE_CA_SIGN)) { - if (gnutls_x509_crt_get_ca_status(issuer, NULL) != 1) { - gnutls_assert(); - if (verify) - *verify |= - GNUTLS_CERT_SIGNER_NOT_CA | - GNUTLS_CERT_INVALID; - return 0; - } - - result = - gnutls_x509_crt_get_key_usage(issuer, &usage, NULL); - if (result >= 0) { - if (!(usage & GNUTLS_KEY_CRL_SIGN)) { - gnutls_assert(); - if (verify) - *verify |= - GNUTLS_CERT_SIGNER_CONSTRAINTS_FAILURE - | GNUTLS_CERT_INVALID; - return 0; - } - } - } - result = _gnutls_x509_get_signed_data(crl->crl, &crl->der, "tbsCertList", &crl_signed_data); @@ -1473,21 +1419,54 @@ gnutls_x509_crl_verify(gnutls_x509_crl_t crl, hash_algo = gnutls_sign_get_hash_algorithm(result); - result = - _gnutls_x509_verify_data(mac_to_entry(hash_algo), - &crl_signed_data, &crl_signature, - issuer); - if (result == GNUTLS_E_PK_SIG_VERIFY_FAILED) { - gnutls_assert(); - /* error. ignore it */ - if (verify) - *verify |= GNUTLS_CERT_SIGNATURE_FAILURE; - result = 0; - } else if (result < 0) { + /* issuer is not in trusted certificate + * authorities. + */ + if (issuer == NULL) { gnutls_assert(); if (verify) - *verify |= GNUTLS_CERT_INVALID; - goto cleanup; + *verify |= + GNUTLS_CERT_SIGNER_NOT_FOUND | + GNUTLS_CERT_INVALID; + } else { + if (!(flags & GNUTLS_VERIFY_DISABLE_CA_SIGN)) { + if (gnutls_x509_crt_get_ca_status(issuer, NULL) != 1) { + gnutls_assert(); + if (verify) + *verify |= + GNUTLS_CERT_SIGNER_NOT_CA | + GNUTLS_CERT_INVALID; + } + + result = + gnutls_x509_crt_get_key_usage(issuer, &usage, NULL); + if (result >= 0) { + if (!(usage & GNUTLS_KEY_CRL_SIGN)) { + gnutls_assert(); + if (verify) + *verify |= + GNUTLS_CERT_SIGNER_CONSTRAINTS_FAILURE + | GNUTLS_CERT_INVALID; + } + } + } + + result = + _gnutls_x509_verify_data(mac_to_entry(hash_algo), + &crl_signed_data, &crl_signature, + issuer); + if (result == GNUTLS_E_PK_SIG_VERIFY_FAILED) { + gnutls_assert(); + /* error. ignore it */ + if (verify) + *verify |= GNUTLS_CERT_SIGNATURE_FAILURE; + result = 0; + } else if (result < 0) { + gnutls_assert(); + if (verify) + *verify |= GNUTLS_CERT_INVALID; + goto cleanup; + } } { diff --git a/tests/test-chains.h b/tests/test-chains.h index 28974e1..ff9086f 100644 --- a/tests/test-chains.h +++ b/tests/test-chains.h @@ -1366,9 +1366,11 @@ static struct } chains[] = { { "CVE-2014-0092", cve_2014_0092_check, &cve_2014_0092_check[1], - 0, GNUTLS_CERT_SIGNER_NOT_CA | GNUTLS_CERT_INVALID }, + GNUTLS_VERIFY_DISABLE_TIME_CHECKS, + GNUTLS_CERT_SIGNER_NOT_CA | GNUTLS_CERT_INVALID }, { "CVE-2008-4989", cve_2008_4989_chain, &cve_2008_4989_chain[2], - 0, GNUTLS_CERT_SIGNER_NOT_FOUND | GNUTLS_CERT_INVALID }, + GNUTLS_VERIFY_DISABLE_TIME_CHECKS, + GNUTLS_CERT_SIGNER_NOT_FOUND | GNUTLS_CERT_INVALID }, { "amazon.com ok", verisign_com_chain_g5, &verisign_com_chain_g5[4], GNUTLS_VERIFY_DISABLE_TIME_CHECKS | GNUTLS_PROFILE_TO_VFLAGS(GNUTLS_PROFILE_LOW), 0 }, @@ -1404,9 +1406,10 @@ static struct GNUTLS_VERIFY_DISABLE_TIME_CHECKS, 0 }, { "rsa-md5 fail", mayfirst_chain, &mayfirst_chain[1], - 0, GNUTLS_CERT_INSECURE_ALGORITHM | GNUTLS_CERT_INVALID }, + GNUTLS_VERIFY_DISABLE_TIME_CHECKS, + GNUTLS_CERT_INSECURE_ALGORITHM | GNUTLS_CERT_INVALID }, { "rsa-md5 not ok", mayfirst_chain, &mayfirst_chain[1], - GNUTLS_VERIFY_ALLOW_SIGN_RSA_MD2, + GNUTLS_VERIFY_DISABLE_TIME_CHECKS | GNUTLS_VERIFY_ALLOW_SIGN_RSA_MD2, GNUTLS_CERT_INSECURE_ALGORITHM | GNUTLS_CERT_INVALID }, { "rsa-md5 not ok2", mayfirst_chain, &mayfirst_chain[1], GNUTLS_VERIFY_ALLOW_SIGN_RSA_MD5, @@ -1449,7 +1452,7 @@ static struct GNUTLS_VERIFY_ALLOW_SIGN_RSA_MD5, 0 }, { "cacertrsamd5 short-cut not ok", cacertrsamd5, &cacertrsamd5[0], GNUTLS_VERIFY_DO_NOT_ALLOW_SAME, - GNUTLS_CERT_SIGNER_NOT_FOUND | GNUTLS_CERT_INVALID }, + GNUTLS_CERT_SIGNER_NOT_FOUND | GNUTLS_CERT_INSECURE_ALGORITHM | GNUTLS_CERT_INVALID }, { "cacertrsamd5 short-cut ok", cacertrsamd5, &cacertrsamd5[1], 0, 0 }, { "ecc cert ok", ecc_cert, &ecc_cert[1], GNUTLS_PROFILE_TO_VFLAGS(GNUTLS_PROFILE_HIGH), 0 }, -- 2.1.0 From nmav at gnu.org Mon Sep 15 09:43:10 2014 From: nmav at gnu.org (Nikos Mavrogiannopoulos) Date: Mon, 15 Sep 2014 09:43:10 +0200 Subject: [gnutls-devel] [sr #108634] Getter functions for gnutls_certificate_credentials_t In-Reply-To: <1410534621.1339.7.camel@waverley> References: <20140818-164743.sv96363.52612@savannah.gnu.org> <20140825-203439.sv707.32318@savannah.gnu.org> <20140907-132239.sv707.3610@savannah.gnu.org> <20140907-200409.sv96363.42296@savannah.gnu.org> <1410184796.1723.20.camel@waverley> <1410362139.2056.24.camel@waverley> <1410534621.1339.7.camel@waverley> Message-ID: On Fri, Sep 12, 2014 at 5:10 PM, Armin Burgmeier wrote: >> I should have added here, that if there is a patch, I'd review it of >> course (and something like that would speed up the process). > Yes, I'll try to come up with a patch. > While trying to build from git master I noticed that in commit 469f8fb > you added pkcs11x.c to lib/Makefile.am, however that file does not exist > in the repository... did you maybe forget to git add it? It depended on a patched p11-kit. I've now added some definitions to allow compilation with any version of p11-kit. If the problem persists let me know. regards, Nikos From nmav at gnutls.org Mon Sep 15 09:46:38 2014 From: nmav at gnutls.org (Nikos Mavrogiannopoulos) Date: Mon, 15 Sep 2014 09:46:38 +0200 Subject: [gnutls-devel] Symbol versioning in gnutls broken -> crashes In-Reply-To: <20140913060441.GA2429@downhill.g.la> References: <20140524065807.GA2250@downhill.g.la> <1410468974.3121.3.camel@nomad.lan> <20140912162227.GA5709@downhill.g.la> <1410546977.11023.8.camel@nomad.lan> <20140913060441.GA2429@downhill.g.la> Message-ID: On Sat, Sep 13, 2014 at 8:04 AM, Andreas Metzler wrote: > [Debian GnuTLS v3 package use a different ABI and soname than > upstream] >>> It will therefore continue to be broken until GnuTLS upstream bumps >>> the symbol-versioning (and the soname) and Debian picks up this >>> version. >> Indeed, but the ABI in 3.x is fixed since years and will remain fixed >> for years too; there is no plan to change it. Why not change the ABI in >> the old releases as a work around? Having a different ABI in the latest >> release ensures that debian will remain binary incompatible with any >> software build with modern gnutls for the foreseeable future. > It is theorethically possible to do a transition and switch back to the > upstream GnuTLS 3.x ABI for the next-next Debian release, but I doubt > that it is really worth the trouble because of the timeframe. Debian > jessie+1 will probably be released in 2017. The additional transition > will also complicate things for Debian derivatives (like Ubuntu) who > have a different release cycle. I'm wondering whether there is some way to transition to a new ABI without breaking the old one. I'll try to see whether the ld script allows such move. regards, Nikos From nmav at gnutls.org Mon Sep 15 15:49:05 2014 From: nmav at gnutls.org (Nikos Mavrogiannopoulos) Date: Mon, 15 Sep 2014 15:49:05 +0200 Subject: [gnutls-devel] Symbol versioning in gnutls broken -> crashes In-Reply-To: References: <20140524065807.GA2250@downhill.g.la> <1410468974.3121.3.camel@nomad.lan> <20140912162227.GA5709@downhill.g.la> <1410546977.11023.8.camel@nomad.lan> <20140913060441.GA2429@downhill.g.la> Message-ID: On Mon, Sep 15, 2014 at 9:46 AM, Nikos Mavrogiannopoulos wrote: > I'm wondering whether there is some way to transition to a new ABI > without breaking the old one. I'll try to see whether the ld script > allows such move. Ok, it seems that adding a new VERSION section with all the symbols in the beginning of libgnutls.map, makes the default symbols to be the new, but also exposes the old ones. So we can have a slow migration to a new ABI, in the 3.4.0 release. However, That is not really documented in [0], and I wonder whether we can rely on that. regards, Nikos [0]. https://sourceware.org/binutils/docs/ld/VERSION.html#VERSION From armin at arbur.net Mon Sep 15 16:57:01 2014 From: armin at arbur.net (Armin Burgmeier) Date: Mon, 15 Sep 2014 10:57:01 -0400 Subject: [gnutls-devel] [sr #108634] Getter functions for gnutls_certificate_credentials_t In-Reply-To: References: <20140818-164743.sv96363.52612@savannah.gnu.org> <20140825-203439.sv707.32318@savannah.gnu.org> <20140907-132239.sv707.3610@savannah.gnu.org> <20140907-200409.sv96363.42296@savannah.gnu.org> <1410184796.1723.20.camel@waverley> <1410362139.2056.24.camel@waverley> <1410534621.1339.7.camel@waverley> Message-ID: <1410793021.1347.12.camel@waverley> On Mon, 2014-09-15 at 09:43 +0200, Nikos Mavrogiannopoulos wrote: > On Fri, Sep 12, 2014 at 5:10 PM, Armin Burgmeier wrote: > >> I should have added here, that if there is a patch, I'd review it of > >> course (and something like that would speed up the process). > > Yes, I'll try to come up with a patch. > > While trying to build from git master I noticed that in commit 469f8fb > > you added pkcs11x.c to lib/Makefile.am, however that file does not exist > > in the repository... did you maybe forget to git add it? > > It depended on a patched p11-kit. I've now added some definitions to > allow compilation with any version of p11-kit. If the problem persists > let me know. Yep, it's working. Thanks! Armin From antoine.pierlot-garcin at scle.fr Tue Sep 16 10:22:46 2014 From: antoine.pierlot-garcin at scle.fr (antoine.pierlot-garcin at scle.fr) Date: Tue, 16 Sep 2014 10:22:46 +0200 Subject: [gnutls-devel] gnutls 3.1.26 build failures Message-ID: Hello, Recently I had to compile GnuTLS 3.1.26 for a win32 target (cross-compile from Debian unstable) and for a Debian stable target. I encountered two build failures, which I was able to resolve. Here some details and the patches, if by any chance you want to include them in a future 3.1.x release. ---- make[4]: Entering directory '/root/src/gnutls/gnutls-3.1.26/src' /bin/bash ../libtool --tag=CC --mode=compile i586-mingw32msvc-gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I.. -I./../gl -I./../gl -I./../lib/includes -I./../lib/includes -I./../libdane/includes -I./../extra/includes -I../src/libopts -I/root/src/gnutls/gnutls-3.1.26/../lib_win32/include -O2 -MT libcmd_srp_la-srptool-args.lo -MD -MP -MF .deps/libcmd_srp_la-srptool-args.Tpo -c -o libcmd_srp_la-srptool-args.lo `test -f 'srptool-args.c' || echo './'`srptool-args.c libtool: compile: i586-mingw32msvc-gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I.. -I./../gl -I./../gl -I./../lib/includes -I./../lib/includes -I./../libdane/includes -I./../extra/includes -I../src/libopts -I/root/src/gnutls/gnutls-3.1.26/../lib_win32/include -O2 -MT libcmd_srp_la-srptool-args.lo -MD -MP -MF .deps/libcmd_srp_la-srptool-args.Tpo -c srptool-args.c -DDLL_EXPORT -DPIC -o .libs/libcmd_srp_la-srptool-args.o In file included from srptool-args.c:43:0: srptool-args.h:61:3: error: #error option template version mismatches autoopts/options.h header # error option template version mismatches autoopts/options.h header ---- There is a mismatch between the generated options.h (autoopts from autogen 5.18.3, already in GnuTLS sources) and the embedded libopts at src/libopts which is obtained from autogen 5.18.2. I could not re-generate the headers with the embedded libopts, so I updated src/libopts to 5.18.3. I am not sure this is the right solution, so feel free to ignore the patch. ---- i586-mingw32msvc-gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I.. -I./../gl -I./../gl -I./../lib/includes -I./../lib/includes -I./../libdane/includes -I./../extra/includes -I../src/libopts -I/root/src/gnutls/gnutls-3.1.26/../lib_win32/include -O2 -MT cli.o -MD -MP -MF .deps/cli.Tpo -c -o cli.o cli.c cli.c: In function 'main': cli.c:844:20: error: storage size of 'new_action' isn't known struct sigaction new_action, old_action; ---- The mingw32 compiler does not define struct sigaction and sigaction() in . In cli.c, the uses are under #ifndef _WIN32 guards, but not the definition. The second patch fixes that. Antoine. -------------- next part -------------- A non-text attachment was scrubbed... Name: gnutls_fix_win32_cli_sigaction.patch Type: text/x-patch Size: 450 bytes Desc: gnutls_fix_win32_cli_sigaction.patch URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: gnutls_update_libopts_to_5.18.3.patch Type: text/x-patch Size: 78531 bytes Desc: gnutls_update_libopts_to_5.18.3.patch URL: From nmav at gnutls.org Tue Sep 16 13:08:09 2014 From: nmav at gnutls.org (Nikos Mavrogiannopoulos) Date: Tue, 16 Sep 2014 13:08:09 +0200 Subject: [gnutls-devel] gnutls 3.1.26 build failures In-Reply-To: References: Message-ID: On Tue, Sep 16, 2014 at 10:22 AM, wrote: > Hello, > Recently I had to compile GnuTLS 3.1.26 for a win32 target > (cross-compile from Debian unstable) and for a Debian stable target. I > encountered two build failures, which I was able to resolve. Here some > details and the patches, if by any chance you want to include them in a > future 3.1.x release. Thank you. I've updated libopts in the repository and applied the sigaction patch. regards, Nikos From nmav at gnutls.org Tue Sep 16 13:32:00 2014 From: nmav at gnutls.org (Nikos Mavrogiannopoulos) Date: Tue, 16 Sep 2014 13:32:00 +0200 Subject: [gnutls-devel] [PATCH] Check for all error conditions when verifying a certificate In-Reply-To: <1410623202.1354.12.camel@waverley> References: <1410623202.1354.12.camel@waverley> Message-ID: On Sat, Sep 13, 2014 at 5:46 PM, Armin Burgmeier wrote: > This allows to check for all possible flaws with a certificate chain with a > single call to gnutls_x509_crt_list_verify and friends. > + if (sigalg >= 0 && > + is_level_acceptable(cert, issuer, sigalg, flags) == 0) { > + gnutls_assert(); > + out |= > + GNUTLS_CERT_INSECURE_ALGORITHM | > + GNUTLS_CERT_INVALID; > + result = 0; > + } Hi, The security level check will not be performed if there is no issuer. That means if the issuer wasn't found you'll not know whether GNUTLS_CERT_INSECURE_ALGORITHM would have been set for the specified security level. Would that be acceptable? Also you added the "if (sigalg >= 0)"... Why is that needed? Isn't sigalg always positive at this point? > { > diff --git a/tests/test-chains.h b/tests/test-chains.h > index 28974e1..ff9086f 100644 > --- a/tests/test-chains.h > +++ b/tests/test-chains.h > @@ -1366,9 +1366,11 @@ static struct > } chains[] = > { > { "CVE-2014-0092", cve_2014_0092_check, &cve_2014_0092_check[1], > - 0, GNUTLS_CERT_SIGNER_NOT_CA | GNUTLS_CERT_INVALID }, > + GNUTLS_VERIFY_DISABLE_TIME_CHECKS, > + GNUTLS_CERT_SIGNER_NOT_CA | GNUTLS_CERT_INVALID }, > { "CVE-2008-4989", cve_2008_4989_chain, &cve_2008_4989_chain[2], > - 0, GNUTLS_CERT_SIGNER_NOT_FOUND | GNUTLS_CERT_INVALID }, > + GNUTLS_VERIFY_DISABLE_TIME_CHECKS, > + GNUTLS_CERT_SIGNER_NOT_FOUND | GNUTLS_CERT_INVALID }, Wouldn't here instead of adding GNUTLS_VERIFY_DISABLE_TIME_CHECKS, to add the GNUTLS_CERT_EXPIRED in the expected result? That way we can test that the results remain consistent from now on. Other than these, it looks reasonable. btw. would you like to send a DCO on the list (as in http://www.gnutls.org/devel.html) ? regards, Nikos From armin at arbur.net Tue Sep 16 19:57:09 2014 From: armin at arbur.net (Armin Burgmeier) Date: Tue, 16 Sep 2014 13:57:09 -0400 Subject: [gnutls-devel] [PATCH] Check for all error conditions when verifying a certificate In-Reply-To: References: <1410623202.1354.12.camel@waverley> Message-ID: <1410890229.1622.8.camel@waverley> On Tue, 2014-09-16 at 13:32 +0200, Nikos Mavrogiannopoulos wrote: > On Sat, Sep 13, 2014 at 5:46 PM, Armin Burgmeier wrote: > > This allows to check for all possible flaws with a certificate chain with a > > single call to gnutls_x509_crt_list_verify and friends. > > > + if (sigalg >= 0 && > > + is_level_acceptable(cert, issuer, sigalg, flags) == 0) { > > + gnutls_assert(); > > + out |= > > + GNUTLS_CERT_INSECURE_ALGORITHM | > > + GNUTLS_CERT_INVALID; > > + result = 0; > > + } > > Hi, > The security level check will not be performed if there is no issuer. > That means if the issuer wasn't found you'll not know whether > GNUTLS_CERT_INSECURE_ALGORITHM would have been set for the specified > security level. Would that be acceptable? For my own use case yes, but I agree that while we are at it we should consider this as well. I have changed the function so that it is allowed to be called with a NULL issuer. > Also you added the "if (sigalg >= 0)"... Why is that needed? Isn't > sigalg always positive at this point? It can be negative if _gnutls_x509_get_signature_algorithm returns an error code. > > { > > diff --git a/tests/test-chains.h b/tests/test-chains.h > > index 28974e1..ff9086f 100644 > > --- a/tests/test-chains.h > > +++ b/tests/test-chains.h > > @@ -1366,9 +1366,11 @@ static struct > > } chains[] = > > { > > { "CVE-2014-0092", cve_2014_0092_check, &cve_2014_0092_check[1], > > - 0, GNUTLS_CERT_SIGNER_NOT_CA | GNUTLS_CERT_INVALID }, > > + GNUTLS_VERIFY_DISABLE_TIME_CHECKS, > > + GNUTLS_CERT_SIGNER_NOT_CA | GNUTLS_CERT_INVALID }, > > { "CVE-2008-4989", cve_2008_4989_chain, &cve_2008_4989_chain[2], > > - 0, GNUTLS_CERT_SIGNER_NOT_FOUND | GNUTLS_CERT_INVALID }, > > + GNUTLS_VERIFY_DISABLE_TIME_CHECKS, > > + GNUTLS_CERT_SIGNER_NOT_FOUND | GNUTLS_CERT_INVALID }, > > Wouldn't here instead of adding GNUTLS_VERIFY_DISABLE_TIME_CHECKS, to > add the GNUTLS_CERT_EXPIRED in the expected result? That way we can > test that the results remain consistent from now on. I agree, that makes sense. > Other than these, it looks reasonable. btw. would you like to send a > DCO on the list (as in http://www.gnutls.org/devel.html) ? Yes, I'll do it. Will also work on a patch for the getter functions for gnutls_certificate_credentials_t that we discussed about. > regards, > Nikos Cheers, Armin From armin at arbur.net Tue Sep 16 19:58:46 2014 From: armin at arbur.net (Armin Burgmeier) Date: Tue, 16 Sep 2014 13:58:46 -0400 Subject: [gnutls-devel] DCO Message-ID: <1410890326.1622.9.camel@waverley> Hi, below the DCO for my contributions. Cheers, Armin Developer's Certificate of Origin 1.1 By making a contribution to this project, I certify that: (a) The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or (b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or (c) The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it. (d) I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved. From armin at arbur.net Tue Sep 16 20:02:24 2014 From: armin at arbur.net (Armin Burgmeier) Date: Tue, 16 Sep 2014 14:02:24 -0400 Subject: [gnutls-devel] [PATCH V3] Check for all error conditions when verifying a certificate Message-ID: <1410890544.1622.11.camel@waverley> This allows to check for all possible flaws with a certificate chain with a single call to gnutls_x509_crt_list_verify and friends. Signed-off-by: Armin Burgmeier --- lib/x509/verify.c | 463 +++++++++++++++++++++++++--------------------------- tests/test-chains.h | 13 +- 2 files changed, 232 insertions(+), 244 deletions(-) diff --git a/lib/x509/verify.c b/lib/x509/verify.c index e71832d..53de776 100644 --- a/lib/x509/verify.c +++ b/lib/x509/verify.c @@ -423,7 +423,7 @@ int is_broken_allowed(gnutls_sign_algorithm_t sig, unsigned int flags) * according to verification profile specified. * * @crt: a certificate - * @issuer: the certificates issuer + * @issuer: the certificates issuer (allowed to be NULL) * @sigalg: the signature algorithm used * @flags: the specified verification flags */ @@ -469,11 +469,6 @@ int hash; return gnutls_assert_val(0); } - if (gnutls_x509_crt_get_version(issuer) != 3) { - _gnutls_debug_log("SUITEB: certificate's issuer uses an unacceptable version number\n"); - return gnutls_assert_val(0); - } - if (sigalg != GNUTLS_SIGN_ECDSA_SHA256 && sigalg != GNUTLS_SIGN_ECDSA_SHA384) { _gnutls_debug_log("SUITEB: certificate is not signed using ECDSA-SHA256 or ECDSA-SHA384\n"); return gnutls_assert_val(0); @@ -498,38 +493,12 @@ int hash; curve = params.flags; gnutls_pk_params_release(¶ms); - ret = _gnutls_x509_crt_get_mpis(issuer, ¶ms); - if (ret < 0) { - _gnutls_debug_log("SUITEB: cannot read certificate params\n"); - return gnutls_assert_val(0); - } - - issuer_curve = params.flags; - gnutls_pk_params_release(¶ms); - - if (issuer_curve != GNUTLS_ECC_CURVE_SECP256R1 && - issuer_curve != GNUTLS_ECC_CURVE_SECP384R1) { - _gnutls_debug_log("SUITEB: certificate's issuer ECC params do not contain SECP256R1 or SECP384R1\n"); - return gnutls_assert_val(0); - } - if (curve != GNUTLS_ECC_CURVE_SECP256R1 && curve != GNUTLS_ECC_CURVE_SECP384R1) { _gnutls_debug_log("SUITEB: certificate's ECC params do not contain SECP256R1 or SECP384R1\n"); return gnutls_assert_val(0); } - if (issuer_curve < curve) { - _gnutls_debug_log("SUITEB: certificate's issuer ECC params are weaker than the certificate's\n"); - return gnutls_assert_val(0); - } - - if (sigalg == GNUTLS_SIGN_ECDSA_SHA256 && - issuer_curve == GNUTLS_ECC_CURVE_SECP384R1) { - _gnutls_debug_log("SUITEB: certificate is signed with ECDSA-SHA256 when using SECP384R1\n"); - return gnutls_assert_val(0); - } - if (profile == GNUTLS_PROFILE_SUITEB192) { if (curve != GNUTLS_ECC_CURVE_SECP384R1) { _gnutls_debug_log("SUITEB192: certificate does not use SECP384R1\n"); @@ -537,6 +506,39 @@ int hash; } } + if (issuer != NULL) { + if (gnutls_x509_crt_get_version(issuer) != 3) { + _gnutls_debug_log("SUITEB: certificate's issuer uses an unacceptable version number\n"); + return gnutls_assert_val(0); + } + + ret = _gnutls_x509_crt_get_mpis(issuer, ¶ms); + if (ret < 0) { + _gnutls_debug_log("SUITEB: cannot read certificate params\n"); + return gnutls_assert_val(0); + } + + issuer_curve = params.flags; + gnutls_pk_params_release(¶ms); + + if (issuer_curve != GNUTLS_ECC_CURVE_SECP256R1 && + issuer_curve != GNUTLS_ECC_CURVE_SECP384R1) { + _gnutls_debug_log("SUITEB: certificate's issuer ECC params do not contain SECP256R1 or SECP384R1\n"); + return gnutls_assert_val(0); + } + + if (issuer_curve < curve) { + _gnutls_debug_log("SUITEB: certificate's issuer ECC params are weaker than the certificate's\n"); + return gnutls_assert_val(0); + } + + if (sigalg == GNUTLS_SIGN_ECDSA_SHA256 && + issuer_curve == GNUTLS_ECC_CURVE_SECP384R1) { + _gnutls_debug_log("SUITEB: certificate is signed with ECDSA-SHA256 when using SECP384R1\n"); + return gnutls_assert_val(0); + } + } + break; } } @@ -572,7 +574,7 @@ verify_crt(gnutls_x509_crt_t cert, gnutls_datum_t cert_signature = { NULL, 0 }; gnutls_x509_crt_t issuer = NULL; int issuer_version, hash_algo; - bool result = 0; + bool result = 1; const mac_entry_st * me; unsigned int out = 0, usage; int sigalg, ret; @@ -581,13 +583,12 @@ verify_crt(gnutls_x509_crt_t cert, *output = 0; if (*max_path == 0) { - out = + out |= GNUTLS_CERT_SIGNER_CONSTRAINTS_FAILURE | GNUTLS_CERT_INVALID; - if (output) - *output |= out; gnutls_assert(); result = 0; + /* bail immediately, to avoid inconistency */ goto cleanup; } (*max_path)--; @@ -595,115 +596,16 @@ verify_crt(gnutls_x509_crt_t cert, if (tcas_size >= 1) issuer = find_issuer(cert, trusted_cas, tcas_size); - /* issuer is not in trusted certificate - * authorities. - */ - if (issuer == NULL) { - out = GNUTLS_CERT_SIGNER_NOT_FOUND | GNUTLS_CERT_INVALID; - if (output) - *output |= out; - gnutls_assert(); - result = 0; - goto cleanup; - } - if (_issuer != NULL) *_issuer = issuer; - if (nc != NULL) { - /* append the issuer's constraints */ - ret = gnutls_x509_crt_get_name_constraints(issuer, nc, - GNUTLS_NAME_CONSTRAINTS_FLAG_APPEND, NULL); - if (ret < 0 && ret != GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE) { - nc_fail: - out = - GNUTLS_CERT_SIGNER_CONSTRAINTS_FAILURE | - GNUTLS_CERT_INVALID; - if (output) - *output |= out; - gnutls_assert(); - result = 0; - goto cleanup; - } - - /* only check name constraints in server certificates, not CAs */ - if (end_cert != 0) { - ret = gnutls_x509_name_constraints_check_crt(nc, GNUTLS_SAN_DNSNAME, cert); - if (ret == 0) { - gnutls_assert(); - goto nc_fail; - } - - ret = gnutls_x509_name_constraints_check_crt(nc, GNUTLS_SAN_RFC822NAME, cert); - if (ret == 0) { - gnutls_assert(); - goto nc_fail; - } - - ret = gnutls_x509_name_constraints_check_crt(nc, GNUTLS_SAN_DN, cert); - if (ret == 0) { - gnutls_assert(); - goto nc_fail; - } - - ret = gnutls_x509_name_constraints_check_crt(nc, GNUTLS_SAN_URI, cert); - if (ret == 0) { - gnutls_assert(); - goto nc_fail; - } - - ret = gnutls_x509_name_constraints_check_crt(nc, GNUTLS_SAN_IPADDRESS, cert); - if (ret == 0) { - gnutls_assert(); - goto nc_fail; - } - } - } - - issuer_version = gnutls_x509_crt_get_version(issuer); - if (issuer_version < 0) { - gnutls_assert(); - result = 0; - goto cleanup; - } - - if (!(flags & GNUTLS_VERIFY_DISABLE_CA_SIGN) && - ((flags & GNUTLS_VERIFY_DO_NOT_ALLOW_X509_V1_CA_CRT) - || issuer_version != 1)) { - if (check_if_ca(cert, issuer, max_path, flags) != 1) { - gnutls_assert(); - out = - GNUTLS_CERT_SIGNER_NOT_CA | - GNUTLS_CERT_INVALID; - if (output) - *output |= out; - result = 0; - goto cleanup; - } - - ret = - gnutls_x509_crt_get_key_usage(issuer, &usage, NULL); - if (ret >= 0) { - if (!(usage & GNUTLS_KEY_KEY_CERT_SIGN)) { - gnutls_assert(); - out = - GNUTLS_CERT_SIGNER_CONSTRAINTS_FAILURE - | GNUTLS_CERT_INVALID; - if (output) - *output |= out; - result = 0; - goto cleanup; - } - } - } - ret = _gnutls_x509_get_signed_data(cert->cert, &cert->der, "tbsCertificate", &cert_signed_data); if (ret < 0) { result = 0; gnutls_assert(); - goto cleanup; + cert_signed_data.data = NULL; } ret = @@ -712,7 +614,7 @@ verify_crt(gnutls_x509_crt_t cert, if (ret < 0) { result = 0; gnutls_assert(); - goto cleanup; + cert_signature.data = NULL; } ret = @@ -721,75 +623,160 @@ verify_crt(gnutls_x509_crt_t cert, if (ret < 0) { result = 0; gnutls_assert(); - goto cleanup; } sigalg = ret; - if (is_level_acceptable(cert, issuer, sigalg, flags) == 0) { - gnutls_assert(); - out = - GNUTLS_CERT_INSECURE_ALGORITHM | - GNUTLS_CERT_INVALID; - if (output) - *output |= out; - result = 0; - goto cleanup; - } - - /* If the certificate is not self signed check if the algorithms - * used are secure. If the certificate is self signed it doesn't - * really matter. + /* issuer is not in trusted certificate + * authorities. */ - if (gnutls_sign_is_secure(sigalg) == 0 && - is_broken_allowed(sigalg, flags) == 0 && - is_issuer(cert, cert) == 0) { + if (issuer == NULL) { + out |= GNUTLS_CERT_SIGNER_NOT_FOUND | GNUTLS_CERT_INVALID; gnutls_assert(); - out = - GNUTLS_CERT_INSECURE_ALGORITHM | - GNUTLS_CERT_INVALID; - if (output) - *output |= out; result = 0; - goto cleanup; - } + } else { + if (nc != NULL) { + /* append the issuer's constraints */ + ret = gnutls_x509_crt_get_name_constraints(issuer, nc, + GNUTLS_NAME_CONSTRAINTS_FLAG_APPEND, NULL); + if (ret < 0 && ret != GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE) { + nc_fail: + out |= + GNUTLS_CERT_SIGNER_CONSTRAINTS_FAILURE | + GNUTLS_CERT_INVALID; + gnutls_assert(); + result = 0; + goto nc_done; + } - hash_algo = gnutls_sign_get_hash_algorithm(sigalg); - me = mac_to_entry(hash_algo); - if (me == NULL) { - gnutls_assert(); - result = 0; - goto cleanup; + /* only check name constraints in server certificates, not CAs */ + if (end_cert != 0) { + ret = gnutls_x509_name_constraints_check_crt(nc, GNUTLS_SAN_DNSNAME, cert); + if (ret == 0) { + gnutls_assert(); + goto nc_fail; + } + + ret = gnutls_x509_name_constraints_check_crt(nc, GNUTLS_SAN_RFC822NAME, cert); + if (ret == 0) { + gnutls_assert(); + goto nc_fail; + } + + ret = gnutls_x509_name_constraints_check_crt(nc, GNUTLS_SAN_DN, cert); + if (ret == 0) { + gnutls_assert(); + goto nc_fail; + } + + ret = gnutls_x509_name_constraints_check_crt(nc, GNUTLS_SAN_URI, cert); + if (ret == 0) { + gnutls_assert(); + goto nc_fail; + } + + ret = gnutls_x509_name_constraints_check_crt(nc, GNUTLS_SAN_IPADDRESS, cert); + if (ret == 0) { + gnutls_assert(); + goto nc_fail; + } + } + } + nc_done: + + issuer_version = gnutls_x509_crt_get_version(issuer); + + if (issuer_version < 0) { + gnutls_assert(); + result = 0; + } else if (!(flags & GNUTLS_VERIFY_DISABLE_CA_SIGN) && + ((flags & GNUTLS_VERIFY_DO_NOT_ALLOW_X509_V1_CA_CRT) + || issuer_version != 1)) { + if (check_if_ca(cert, issuer, max_path, flags) != 1) { + gnutls_assert(); + out |= + GNUTLS_CERT_SIGNER_NOT_CA | + GNUTLS_CERT_INVALID; + result = 0; + } + + ret = + gnutls_x509_crt_get_key_usage(issuer, &usage, NULL); + if (ret >= 0) { + if (!(usage & GNUTLS_KEY_KEY_CERT_SIGN)) { + gnutls_assert(); + out |= + GNUTLS_CERT_SIGNER_CONSTRAINTS_FAILURE + | GNUTLS_CERT_INVALID; + result = 0; + } + } + } + + if (sigalg >= 0) { + hash_algo = gnutls_sign_get_hash_algorithm(sigalg); + me = mac_to_entry(hash_algo); + } else { + me = NULL; + } + + if (me == NULL) { + gnutls_assert(); + result = 0; + } else if (cert_signed_data.data != NULL && + cert_signature.data != NULL) { + ret = + _gnutls_x509_verify_data(me, + &cert_signed_data, + &cert_signature, + issuer); + if (ret == GNUTLS_E_PK_SIG_VERIFY_FAILED) { + gnutls_assert(); + out |= + GNUTLS_CERT_INVALID | + GNUTLS_CERT_SIGNATURE_FAILURE; + /* error. ignore it */ + result = 0; + } else if (ret < 0) { + result = 0; + gnutls_assert(); + } + } } - ret = - _gnutls_x509_verify_data(me, - &cert_signed_data, &cert_signature, - issuer); - if (ret == GNUTLS_E_PK_SIG_VERIFY_FAILED) { - gnutls_assert(); - out |= GNUTLS_CERT_INVALID | GNUTLS_CERT_SIGNATURE_FAILURE; - /* error. ignore it */ - if (output) - *output |= out; - result = 0; - } else if (ret < 0) { - result = 0; - gnutls_assert(); - goto cleanup; - } else if (ret == 1) - result = 1; + if (sigalg >= 0) { + if (is_level_acceptable(cert, issuer, sigalg, flags) == 0) { + gnutls_assert(); + out |= + GNUTLS_CERT_INSECURE_ALGORITHM | + GNUTLS_CERT_INVALID; + result = 0; + } + + /* If the certificate is not self signed check if the algorithms + * used are secure. If the certificate is self signed it doesn't + * really matter. + */ + if (gnutls_sign_is_secure(sigalg) == 0 && + is_broken_allowed(sigalg, flags) == 0 && + is_issuer(cert, cert) == 0) { + gnutls_assert(); + out |= + GNUTLS_CERT_INSECURE_ALGORITHM | + GNUTLS_CERT_INVALID; + result = 0; + } + } /* Check activation/expiration times */ if (!(flags & GNUTLS_VERIFY_DISABLE_TIME_CHECKS)) { /* check the time of the issuer first */ - if (!(flags & GNUTLS_VERIFY_DISABLE_TRUSTED_TIME_CHECKS)) { + if (issuer != NULL && + !(flags & GNUTLS_VERIFY_DISABLE_TRUSTED_TIME_CHECKS)) { out |= check_time_status(issuer, now); if (out != 0) { gnutls_assert(); result = 0; - if (output) - *output |= out; } } @@ -797,12 +784,13 @@ verify_crt(gnutls_x509_crt_t cert, if (out != 0) { gnutls_assert(); result = 0; - if (output) - *output |= out; } } cleanup: + if (output) + *output |= out; + if (func) { if (result == 0) { out |= GNUTLS_CERT_INVALID; @@ -1407,42 +1395,6 @@ gnutls_x509_crl_verify(gnutls_x509_crl_t crl, if (tcas_size >= 1) issuer = find_crl_issuer(crl, trusted_cas, tcas_size); - /* issuer is not in trusted certificate - * authorities. - */ - if (issuer == NULL) { - gnutls_assert(); - if (verify) - *verify |= - GNUTLS_CERT_SIGNER_NOT_FOUND | - GNUTLS_CERT_INVALID; - return 0; - } - - if (!(flags & GNUTLS_VERIFY_DISABLE_CA_SIGN)) { - if (gnutls_x509_crt_get_ca_status(issuer, NULL) != 1) { - gnutls_assert(); - if (verify) - *verify |= - GNUTLS_CERT_SIGNER_NOT_CA | - GNUTLS_CERT_INVALID; - return 0; - } - - result = - gnutls_x509_crt_get_key_usage(issuer, &usage, NULL); - if (result >= 0) { - if (!(usage & GNUTLS_KEY_CRL_SIGN)) { - gnutls_assert(); - if (verify) - *verify |= - GNUTLS_CERT_SIGNER_CONSTRAINTS_FAILURE - | GNUTLS_CERT_INVALID; - return 0; - } - } - } - result = _gnutls_x509_get_signed_data(crl->crl, &crl->der, "tbsCertList", &crl_signed_data); @@ -1475,21 +1427,54 @@ gnutls_x509_crl_verify(gnutls_x509_crl_t crl, hash_algo = gnutls_sign_get_hash_algorithm(result); - result = - _gnutls_x509_verify_data(mac_to_entry(hash_algo), - &crl_signed_data, &crl_signature, - issuer); - if (result == GNUTLS_E_PK_SIG_VERIFY_FAILED) { - gnutls_assert(); - /* error. ignore it */ - if (verify) - *verify |= GNUTLS_CERT_SIGNATURE_FAILURE; - result = 0; - } else if (result < 0) { + /* issuer is not in trusted certificate + * authorities. + */ + if (issuer == NULL) { gnutls_assert(); if (verify) - *verify |= GNUTLS_CERT_INVALID; - goto cleanup; + *verify |= + GNUTLS_CERT_SIGNER_NOT_FOUND | + GNUTLS_CERT_INVALID; + } else { + if (!(flags & GNUTLS_VERIFY_DISABLE_CA_SIGN)) { + if (gnutls_x509_crt_get_ca_status(issuer, NULL) != 1) { + gnutls_assert(); + if (verify) + *verify |= + GNUTLS_CERT_SIGNER_NOT_CA | + GNUTLS_CERT_INVALID; + } + + result = + gnutls_x509_crt_get_key_usage(issuer, &usage, NULL); + if (result >= 0) { + if (!(usage & GNUTLS_KEY_CRL_SIGN)) { + gnutls_assert(); + if (verify) + *verify |= + GNUTLS_CERT_SIGNER_CONSTRAINTS_FAILURE + | GNUTLS_CERT_INVALID; + } + } + } + + result = + _gnutls_x509_verify_data(mac_to_entry(hash_algo), + &crl_signed_data, &crl_signature, + issuer); + if (result == GNUTLS_E_PK_SIG_VERIFY_FAILED) { + gnutls_assert(); + /* error. ignore it */ + if (verify) + *verify |= GNUTLS_CERT_SIGNATURE_FAILURE; + result = 0; + } else if (result < 0) { + gnutls_assert(); + if (verify) + *verify |= GNUTLS_CERT_INVALID; + goto cleanup; + } } { diff --git a/tests/test-chains.h b/tests/test-chains.h index 28974e1..8e250cd 100644 --- a/tests/test-chains.h +++ b/tests/test-chains.h @@ -1366,9 +1366,11 @@ static struct } chains[] = { { "CVE-2014-0092", cve_2014_0092_check, &cve_2014_0092_check[1], - 0, GNUTLS_CERT_SIGNER_NOT_CA | GNUTLS_CERT_INVALID }, + 0, + GNUTLS_CERT_SIGNER_NOT_CA | GNUTLS_CERT_NOT_ACTIVATED | GNUTLS_CERT_INVALID }, { "CVE-2008-4989", cve_2008_4989_chain, &cve_2008_4989_chain[2], - 0, GNUTLS_CERT_SIGNER_NOT_FOUND | GNUTLS_CERT_INVALID }, + 0, + GNUTLS_CERT_SIGNER_NOT_FOUND | GNUTLS_CERT_EXPIRED | GNUTLS_CERT_INVALID }, { "amazon.com ok", verisign_com_chain_g5, &verisign_com_chain_g5[4], GNUTLS_VERIFY_DISABLE_TIME_CHECKS | GNUTLS_PROFILE_TO_VFLAGS(GNUTLS_PROFILE_LOW), 0 }, @@ -1404,9 +1406,10 @@ static struct GNUTLS_VERIFY_DISABLE_TIME_CHECKS, 0 }, { "rsa-md5 fail", mayfirst_chain, &mayfirst_chain[1], - 0, GNUTLS_CERT_INSECURE_ALGORITHM | GNUTLS_CERT_INVALID }, + GNUTLS_VERIFY_DISABLE_TIME_CHECKS, + GNUTLS_CERT_INSECURE_ALGORITHM | GNUTLS_CERT_INVALID }, { "rsa-md5 not ok", mayfirst_chain, &mayfirst_chain[1], - GNUTLS_VERIFY_ALLOW_SIGN_RSA_MD2, + GNUTLS_VERIFY_DISABLE_TIME_CHECKS | GNUTLS_VERIFY_ALLOW_SIGN_RSA_MD2, GNUTLS_CERT_INSECURE_ALGORITHM | GNUTLS_CERT_INVALID }, { "rsa-md5 not ok2", mayfirst_chain, &mayfirst_chain[1], GNUTLS_VERIFY_ALLOW_SIGN_RSA_MD5, @@ -1449,7 +1452,7 @@ static struct GNUTLS_VERIFY_ALLOW_SIGN_RSA_MD5, 0 }, { "cacertrsamd5 short-cut not ok", cacertrsamd5, &cacertrsamd5[0], GNUTLS_VERIFY_DO_NOT_ALLOW_SAME, - GNUTLS_CERT_SIGNER_NOT_FOUND | GNUTLS_CERT_INVALID }, + GNUTLS_CERT_SIGNER_NOT_FOUND | GNUTLS_CERT_INSECURE_ALGORITHM | GNUTLS_CERT_INVALID }, { "cacertrsamd5 short-cut ok", cacertrsamd5, &cacertrsamd5[1], 0, 0 }, { "ecc cert ok", ecc_cert, &ecc_cert[1], GNUTLS_PROFILE_TO_VFLAGS(GNUTLS_PROFILE_HIGH), 0 }, -- 2.1.0 From dkg at fifthhorseman.net Wed Sep 17 00:31:42 2014 From: dkg at fifthhorseman.net (Daniel Kahn Gillmor) Date: Tue, 16 Sep 2014 18:31:42 -0400 Subject: [gnutls-devel] certtool --crq-info should show signing algorithm Message-ID: <5418BA4E.7090602@fifthhorseman.net> when looking at a human-readable representation of a certificate signing request (CSR), certtool --crq-info currently doesn't display the algorithm used for the self-signature of the CSR. (i.e. it doesn't indicate if it was RSAwithSHA1 or RSAwithSHA256, etc) It would occasionally be useful for people examining CSRs to see this information (i was just asked for it privately, and i think it would be useful too, e.g. when reviewing a CSR before submitting it to a CA). Does this seem reasonable? --dkg -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 949 bytes Desc: OpenPGP digital signature URL: From nmav at gnutls.org Wed Sep 17 10:08:17 2014 From: nmav at gnutls.org (Nikos Mavrogiannopoulos) Date: Wed, 17 Sep 2014 10:08:17 +0200 Subject: [gnutls-devel] certtool --crq-info should show signing algorithm In-Reply-To: <5418BA4E.7090602@fifthhorseman.net> References: <5418BA4E.7090602@fifthhorseman.net> Message-ID: On Wed, Sep 17, 2014 at 12:31 AM, Daniel Kahn Gillmor wrote: > when looking at a human-readable representation of a certificate signing > request (CSR), certtool --crq-info currently doesn't display the > algorithm used for the self-signature of the CSR. (i.e. it doesn't > indicate if it was RSAwithSHA1 or RSAwithSHA256, etc) > It would occasionally be useful for people examining CSRs to see this > information (i was just asked for it privately, and i think it would be > useful too, e.g. when reviewing a CSR before submitting it to a CA). > Does this seem reasonable? Hello Daniel, It certainly does. regards, Nikos From nmav at gnutls.org Wed Sep 17 13:12:08 2014 From: nmav at gnutls.org (Nikos Mavrogiannopoulos) Date: Wed, 17 Sep 2014 13:12:08 +0200 Subject: [gnutls-devel] [PATCH V3] Check for all error conditions when verifying a certificate In-Reply-To: <1410890544.1622.11.camel@waverley> References: <1410890544.1622.11.camel@waverley> Message-ID: On Tue, Sep 16, 2014 at 8:02 PM, Armin Burgmeier wrote: > This allows to check for all possible flaws with a certificate chain with a > single call to gnutls_x509_crt_list_verify and friends. I've noticed that this causes some discrepancies between pkcs11-chainverify and chainverify in the verification. That is not much of your concern of course as it is about the PKCS#11 module verification and I'll handle it, but it uncovered the following issue: The verification of a chain works like that: CA -> ICA1 -> ICA2 -> ENDCERT To prevent a DoS (e.g. by a server or client that sends a list of 1000 certificates) it starts like (see _gnutls_verify_crt_status()): 1. verify: CA -> CA1 if (fail return status) 2. verify: CA1 -> CA2 if (fail return status) 3. verify: CA2 -> ENDCERT if (fail return status) So with your patch you'll get the status up to the point of first failure. If the failure is in step 1 you'll get the full status for CA->CA1 verification, but no flag will apply on ENDCERT. In your case I think you verify against the scenario: CA -> ENDCERT, so you get some reasonable flags. I don't know how reasonable these would be if you are in a multiple CA scenario. Still it may make sense to do that (in that case I should document that correctly), and I'm not sure whether getting the flags of the 3 steps combined would offer much of an advantage as they refer to multiple certificates. What do you think of that? Is the current situation reasonable for your use case? regards, Nikos From armin at arbur.net Wed Sep 17 16:19:19 2014 From: armin at arbur.net (Armin Burgmeier) Date: Wed, 17 Sep 2014 10:19:19 -0400 Subject: [gnutls-devel] [PATCH V3] Check for all error conditions when verifying a certificate In-Reply-To: References: <1410890544.1622.11.camel@waverley> Message-ID: <1410963559.1336.11.camel@waverley> Hi Nikos, On Wed, 2014-09-17 at 13:12 +0200, Nikos Mavrogiannopoulos wrote: > On Tue, Sep 16, 2014 at 8:02 PM, Armin Burgmeier wrote: > > This allows to check for all possible flaws with a certificate chain with a > > single call to gnutls_x509_crt_list_verify and friends. > > I've noticed that this causes some discrepancies between > pkcs11-chainverify and chainverify in the verification. That is not > much of your concern of course as it is about the PKCS#11 module > verification and I'll handle it, Okay. > but it uncovered the following issue: > The verification of a chain works like that: > CA -> ICA1 -> ICA2 -> ENDCERT > > To prevent a DoS (e.g. by a server or client that sends a list of 1000 > certificates) it starts like (see _gnutls_verify_crt_status()): > 1. verify: CA -> CA1 > if (fail return status) > > 2. verify: CA1 -> CA2 > if (fail return status) > > 3. verify: CA2 -> ENDCERT > if (fail return status) > > So with your patch you'll get the status up to the point of first > failure. If the failure is in step 1 you'll get the full status for > CA->CA1 verification, but no flag will apply on ENDCERT. In your case > I think you verify against the scenario: CA -> ENDCERT, so you get > some reasonable flags. I don't know how reasonable these would be if > you are in a multiple CA scenario. Still it may make sense to do that > (in that case I should document that correctly), and I'm not sure > whether getting the flags of the 3 steps combined would offer much of > an advantage as they refer to multiple certificates. What do you think > of that? Is the current situation reasonable for your use case? Yes, I think it is reasonable. As you say in the scenario with intermediate CAs, the verification flags would be for multiple verifications combined, and therefore still lack some information. I think it is fine if it is documented that: a) the verification procedure stops if a failure has been found with one certificate in the chain. b) in that case all issues with that particular certificate are reported. c) the verification order starts from CA->CA1, then CA1->CA2, ..., then CAn -> ENDCERT d) if people need to know more details, they should run the verification for each certificate in the chain individually. Does it sound good to you? Cheers, Armin From nmav at gnutls.org Thu Sep 18 14:06:02 2014 From: nmav at gnutls.org (Nikos Mavrogiannopoulos) Date: Thu, 18 Sep 2014 14:06:02 +0200 Subject: [gnutls-devel] gnutls 3.2.18 Message-ID: <1411041962.22024.2.camel@nomad.lan> Hello, I've just released gnutls 3.2.18. This is a bugfix release on the current stable branch. * Version 3.2.18 (released 2014-09-18) ** libgnutls: Fixes in gnutls_x509_crt_set_dn() and friends to properly handle strings with embedded spaces and escaped commas. ** libgnutls: Corrected gnutls_x509_crl_verify() which would always report a CRL signature as invalid. Reported by Armin Burgmeier. ** libgnutls: Fixed issue with certificates being sanitized by gnutls prior to signature verification. That resulted to certain non-DER compliant modifications of valid certificates, being corrected by libtasn1's parser and restructured as the original. Issue found and reported by Antti Karjalainen and Matti Kamunen from Codenomicon. ** API and ABI modifications: No changes since last version. Getting the Software ==================== GnuTLS may be downloaded directly from . A list of GnuTLS mirrors can be found at . Here are the XZ and LZIP compressed sources: ftp://ftp.gnutls.org/gcrypt/gnutls/v3.2/gnutls-3.2.18.tar.xz ftp://ftp.gnutls.org/gcrypt/gnutls/v3.2/gnutls-3.2.18.tar.lz Here are OpenPGP detached signatures signed using key 0x96865171: ftp://ftp.gnutls.org/gcrypt/gnutls/v3.2/gnutls-3.2.18.tar.xz.sig ftp://ftp.gnutls.org/gcrypt/gnutls/v3.2/gnutls-3.2.18.tar.lz.sig Note that it has been signed with my openpgp key: pub 3104R/96865171 2008-05-04 [expires: 2028-04-29] uid Nikos Mavrogiannopoulos gnutls.org> uid Nikos Mavrogiannopoulos gmail.com> sub 2048R/9013B842 2008-05-04 [expires: 2018-05-02] sub 2048R/1404A91D 2008-05-04 [expires: 2018-05-02] regards, Nikos From nmav at gnutls.org Thu Sep 18 14:10:09 2014 From: nmav at gnutls.org (Nikos Mavrogiannopoulos) Date: Thu, 18 Sep 2014 14:10:09 +0200 Subject: [gnutls-devel] gnutls 3.3.8 Message-ID: <1411042209.22024.6.camel@nomad.lan> Hello, I've just released gnutls 3.3.8. This is a bug-fix release on the next-stable branch. An important aspect of this release is that it completes support for the p11-kit trust module, allowing gnutls to utilize attached extensions in the system CA certificates (e.g. to restrict a CA certificate to certain domain names, or for a specific scope). I'll provide details on that feature on a follow up e-mail. * Version 3.3.8 (released 2014-09-18) ** libgnutls: Updates in the name constraints checks. No name constraints will be checked for intermediate certificates. As our support for name constraints is limited to e-mail addresses in DNS names, it is pointless to check them on intermediate certificates. ** libgnutls: Fixed issues in PKCS #11 object listing. Previously multiple object listing would fail completely if a single object could not be exported. ** libgnutls: Improved the performance of PKCS #11 object listing/retrieving, by retrieving them in large batches. Report and suggestion by David Woodhouse. ** libgnutls: Fixed issue with certificates being sanitized by gnutls prior to signature verification. That resulted to certain non-DER compliant modifications of valid certificates, being corrected by libtasn1's parser and restructured as the original. Issue found and reported by Antti Karjalainen and Matti Kamunen from Codenomicon. ** libgnutls: Fixes in gnutls_x509_crt_set_dn() and friends to properly handle strings with embedded spaces and escaped commas. ** libgnutls: when comparing a CA certificate with the trusted list compare the name and key only instead of the whole certificate. That is to handle cases where a CA certificate was superceded by a different one with the same name and the same key. ** libgnutls: when verifying a certificate against a p11-kit trusted module, use the attached extensions in the module to override the CA's extensions (that requires p11-kit 0.20.7). ** libgnutls: In DTLS prevent sending zero-size fragments in certain cases of MTU split. Reported by Manuel P?gouri?-Gonnard. ** libgnutls: Added gnutls_x509_trust_list_verify_crt2() which allows verifying using a hostname and a purpose (extended key usage). That enhances PKCS #11 trust module verification, as it can now check the purpose when this function is used. ** libgnutls: Corrected gnutls_x509_crl_verify() which would always report a CRL signature as invalid. Reported by Armin Burgmeier. ** libgnutls: added option --disable-padlock to allow disabling the padlock CPU acceleration. ** p11tool: when listing tokens, list their type as well. ** p11tool: when listing objects from a trust module print any attached extensions on certificates. ** API and ABI modifications: gnutls_x509_crq_get_extension_by_oid2: Added gnutls_x509_crt_get_extension_by_oid2: Added gnutls_x509_trust_list_verify_crt2: Added gnutls_x509_ext_print: Added gnutls_x509_ext_deinit: Added gnutls_x509_othername_to_virtual: Added gnutls_pkcs11_obj_get_exts: Added Getting the Software ==================== GnuTLS may be downloaded directly from . A list of GnuTLS mirrors can be found at . Here are the XZ and LZIP compressed sources: ftp://ftp.gnutls.org/gcrypt/gnutls/v3.3/gnutls-3.3.8.tar.xz ftp://ftp.gnutls.org/gcrypt/gnutls/v3.3/gnutls-3.3.8.tar.lz Here are OpenPGP detached signatures signed using key 0x96865171: ftp://ftp.gnutls.org/gcrypt/gnutls/v3.3/gnutls-3.3.8.tar.xz.sig ftp://ftp.gnutls.org/gcrypt/gnutls/v3.3/gnutls-3.3.8.tar.lz.sig Note that it has been signed with my openpgp key: pub 3104R/96865171 2008-05-04 [expires: 2028-04-29] uid Nikos Mavrogiannopoulos gnutls.org> uid Nikos Mavrogiannopoulos gmail.com> sub 2048R/9013B842 2008-05-04 [expires: 2018-05-02] sub 2048R/1404A91D 2008-05-04 [expires: 2018-05-02] regards, Nikos From nmav at gnutls.org Thu Sep 18 10:53:46 2014 From: nmav at gnutls.org (Nikos Mavrogiannopoulos) Date: Thu, 18 Sep 2014 10:53:46 +0200 Subject: [gnutls-devel] [PATCH V3] Check for all error conditions when verifying a certificate In-Reply-To: <1410963559.1336.11.camel@waverley> References: <1410890544.1622.11.camel@waverley> <1410963559.1336.11.camel@waverley> Message-ID: On Wed, Sep 17, 2014 at 4:19 PM, Armin Burgmeier wrote: >> So with your patch you'll get the status up to the point of first >> failure. If the failure is in step 1 you'll get the full status for >> CA->CA1 verification, but no flag will apply on ENDCERT. In your case >> I think you verify against the scenario: CA -> ENDCERT, so you get >> some reasonable flags. I don't know how reasonable these would be if >> you are in a multiple CA scenario. Still it may make sense to do that >> (in that case I should document that correctly), and I'm not sure >> whether getting the flags of the 3 steps combined would offer much of >> an advantage as they refer to multiple certificates. What do you think >> of that? Is the current situation reasonable for your use case? > Yes, I think it is reasonable. As you say in the scenario with > intermediate CAs, the verification flags would be for multiple > verifications combined, and therefore still lack some information. I > think it is fine if it is documented that: > a) the verification procedure stops if a failure has been found with one > certificate in the chain. > b) in that case all issues with that particular certificate are > reported. > c) the verification order starts from CA->CA1, then CA1->CA2, ..., then > CAn -> ENDCERT > d) if people need to know more details, they should run the verification > for each certificate in the chain individually. I've applied the patch as well some documentation in master. The plan is to be included in the 3.4.0 branch. regards, Nikos From Ondrej.Caletka at cesnet.cz Thu Sep 18 09:48:04 2014 From: Ondrej.Caletka at cesnet.cz (=?UTF-8?B?T25kxZllaiBDYWxldGth?=) Date: Thu, 18 Sep 2014 09:48:04 +0200 Subject: [gnutls-devel] DANE: Verification failed for TLSA record with usage=0 Message-ID: <541A8E34.1090501@cesnet.cz> Hello, I've deployed TLSA records for www.cesnet.cz. I've used swede utility to constrain allowed CA and according to swede, the record is valid: $ ./swede verify www.cesnet.cz Received the following record for name _443._tcp.www.cesnet.cz.: Usage: 0 (CA Constraint) Selector: 0 (Certificate) Matching Type: 1 (SHA-256) Certificate for Association: 5c428b013b2e3f0d30abb5bebd92d066dc06dc223329eb0fc735609946cf8e1c This record is valid (well-formed). Attempting to verify the record with the TLS service... Got the following IP: 195.113.144.230 SUCCESS (Usage 0): A certificate in the certificate chain offered by the server matches the one mentioned in the TLSA record and is a CA certificate The matched certificate has Subject: /C=NL/O=TERENA/CN=TERENA SSL CA However, ehen trying to validate this TLSA record using danetool from GnuTLS 3.3.7, I get validation error: $ danetool --check www.cesnet.cz --proto tcp --port 443 Resolving 'www.cesnet.cz'... Obtaining certificate from '2001:718:1:101::4:443'... Querying DNS for www.cesnet.cz (tcp:443)... _443._tcp.www.cesnet.cz. IN TLSA ( 00 00 01 5c428b013b2e3f0d30abb5bebd92d066dc06dc223329eb0fc735609946cf8e1c ) Certificate usage: CA (00) Certificate type: X.509 (00) Contents: SHA2-256 hash (01) Data: 5c428b013b2e3f0d30abb5bebd92d066dc06dc223329eb0fc735609946cf8e1c Verification: Verification failed. CA constrains were violated. I believe this is a bug in GnuTLS. Other DANE implementations sees the TLSA record as valid. -- Best regards Ond?ej Caletka CESNET -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 5563 bytes Desc: Elektronicky podpis S/MIME URL: From armin at arbur.net Wed Sep 17 18:30:44 2014 From: armin at arbur.net (Armin Burgmeier) Date: Wed, 17 Sep 2014 12:30:44 -0400 Subject: [gnutls-devel] [PATCH 4/9] Add a function to obtain the trust list of a gnutls_certificate_credentials_t In-Reply-To: References: Message-ID: Signed-off-by: Armin Burgmeier --- lib/gnutls_x509.c | 18 ++++++++++++++++++ lib/includes/gnutls/x509.h | 3 +++ lib/libgnutls.map | 1 + 3 files changed, 22 insertions(+) diff --git a/lib/gnutls_x509.c b/lib/gnutls_x509.c index b102f4d..f57c6b9 100644 --- a/lib/gnutls_x509.c +++ b/lib/gnutls_x509.c @@ -1244,6 +1244,24 @@ gnutls_certificate_set_trust_list(gnutls_certificate_credentials_t res, res->tlist = tlist; } +/** + * gnutls_certificate_get_trust_list: + * @res: is a #gnutls_certificate_credentials_t structure. + * @tlist: Location where to store the trust list. + * + * Obtains the list of trusted certificates stored in @res and writes a + * pointer to it to the location @tlist. The pointer will point to memory + * internal to @res, and must not be deinitialized. It will be automatically + * deallocated when the @res structure is deinitialized. + * + * Since: 3.4.0 + */ +void +gnutls_certificate_get_trust_list(gnutls_certificate_credentials_t res, + gnutls_x509_trust_list_t *tlist) +{ + *tlist = res->tlist; +} /** * gnutls_certificate_set_x509_key_file: diff --git a/lib/includes/gnutls/x509.h b/lib/includes/gnutls/x509.h index d86b0ef..fd02f0c 100644 --- a/lib/includes/gnutls/x509.h +++ b/lib/includes/gnutls/x509.h @@ -1354,6 +1354,9 @@ gnutls_x509_trust_list_add_system_trust(gnutls_x509_trust_list_t void gnutls_certificate_set_trust_list (gnutls_certificate_credentials_t res, gnutls_x509_trust_list_t tlist, unsigned flags); +void gnutls_certificate_get_trust_list + (gnutls_certificate_credentials_t res, + gnutls_x509_trust_list_t *tlist); typedef struct gnutls_x509_ext_st { char *oid; diff --git a/lib/libgnutls.map b/lib/libgnutls.map index f3a0582..b1121d0 100644 --- a/lib/libgnutls.map +++ b/lib/libgnutls.map @@ -899,6 +899,7 @@ GNUTLS_3_1_0 { gnutls_alpn_set_protocols; gnutls_session_set_id; gnutls_certificate_set_trust_list; + gnutls_certificate_get_trust_list; gnutls_cipher_get_tag_size; gnutls_record_overhead_size; gnutls_handshake_set_hook_function; -- 2.1.0 From armin at arbur.net Thu Sep 18 00:59:29 2014 From: armin at arbur.net (Armin Burgmeier) Date: Wed, 17 Sep 2014 18:59:29 -0400 Subject: [gnutls-devel] [PATCH 7/9] Add functions to obtain X.509 keys and certificates from certificate credentials In-Reply-To: References: Message-ID: <5cdfe2388a105d4df6e0d501f67b77e4a9236b1a.1411060328.git.armin@arbur.net> Signed-off-by: Armin Burgmeier --- lib/gnutls_x509.c | 96 +++++++++++++++++++++++++++++++++++++++++ lib/includes/gnutls/gnutls.h.in | 8 ++++ lib/libgnutls.map | 2 + 3 files changed, 106 insertions(+) diff --git a/lib/gnutls_x509.c b/lib/gnutls_x509.c index f57c6b9..5b9ab1a 100644 --- a/lib/gnutls_x509.c +++ b/lib/gnutls_x509.c @@ -1138,6 +1138,102 @@ gnutls_certificate_set_x509_key(gnutls_certificate_credentials_t res, } /** + * gnutls_certificate_get_x509_key: + * @res: is a #gnutls_certificate_credentials_t structure. + * @index: The index of the key to obtain. + * @key: Location to store the key. + * + * Obtains a X.509 private key that has been stored in @res with one of + * gnutls_certificate_set_x509_key(), gnutls_certificate_set_key(), + * gnutls_certificate_set_x509_key_file(), + * gnutls_certificate_set_x509_key_file2(), + * gnutls_certificate_set_x509_key_mem(), or + * gnutls_certificate_set_x509_key_mem2(). The returned key must be deallocated + * with gnutls_x509_privkey_deinit() when no longer needed. + * + * If there is no key with the given index, + * %GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE is returned. If the key with the + * given index is not a X.509 key, %GNUTLS_E_INVALID_REQUEST is returned. + * + * Returns: %GNUTLS_E_SUCCESS (0) on success, or a negative error code. + * + * Since: 3.4.0 + */ +int +gnutls_certificate_get_x509_key(gnutls_certificate_credentials_t res, + int index, + gnutls_x509_privkey_t *key) +{ + if (index >= res->ncerts) { + gnutls_assert(); + return GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE; + } + + return gnutls_privkey_export_x509(res->pkey[index], key); +} + +/** + * gnutls_certificate_get_x509_crt: + * @res: is a #gnutls_certificate_credentials_t structure. + * @index: The index of the certificate list to obtain. + * @crt_list: Where to store the certificate list. + * @key: Will hold the number of certificates. + * + * Obtains a X.509 certificate list that has been stored in @res with one of + * gnutls_certificate_set_x509_key(), gnutls_certificate_set_key(), + * gnutls_certificate_set_x509_key_file(), + * gnutls_certificate_set_x509_key_file2(), + * gnutls_certificate_set_x509_key_mem(), or + * gnutls_certificate_set_x509_key_mem2(). Each certificate in the returned + * certificate list must be deallocated with gnutls_x509_crt_deinit(), and the + * list itself must be freed with gnutls_free(). + * + * If there is no certificate with the given index, + * %GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE is returned. If the certificate + * with the given index is not a X.509 certificate, %GNUTLS_E_INVALID_REQUEST + * is returned. + * + * Returns: %GNUTLS_E_SUCCESS (0) on success, or a negative error code. + * + * Since: 3.4.0 + */ +int +gnutls_certificate_get_x509_crt(gnutls_certificate_credentials_t res, + int index, + gnutls_x509_crt_t **crt_list, + int *crt_list_size) +{ + int ret, i; + + if (index >= res->ncerts) { + gnutls_assert(); + return GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE; + } + + *crt_list_size = res->certs[index].cert_list_length; + *crt_list = gnutls_malloc( + res->certs[index].cert_list_length * sizeof (gnutls_x509_crt_t)); + if (*crt_list == NULL) { + gnutls_assert(); + return GNUTLS_E_MEMORY_ERROR; + } + + for (i = 0; i < res->certs[index].cert_list_length; ++i) { + ret = gnutls_pcert_export_x509(&res->certs[index].cert_list[i], crt_list[i]); + if (ret < 0) { + while (i--) + gnutls_x509_crt_deinit(*crt_list[i]); + gnutls_free(*crt_list); + *crt_list = NULL; + + return gnutls_assert_val(ret); + } + } + + return 0; +} + +/** * gnutls_certificate_set_key: * @res: is a #gnutls_certificate_credentials_t structure. * @names: is an array of DNS name of the certificate (NULL if none) diff --git a/lib/includes/gnutls/gnutls.h.in b/lib/includes/gnutls/gnutls.h.in index 17ff8fc..b06381a 100644 --- a/lib/includes/gnutls/gnutls.h.in +++ b/lib/includes/gnutls/gnutls.h.in @@ -1429,6 +1429,14 @@ int gnutls_certificate_set_x509_crl(gnutls_certificate_credentials_t res, gnutls_x509_crl_t * crl_list, int crl_list_size); +int gnutls_certificate_get_x509_key(gnutls_certificate_credentials_t res, + int index, + gnutls_x509_privkey_t *key); +int gnutls_certificate_get_x509_crt(gnutls_certificate_credentials_t res, + int index, + gnutls_x509_crt_t **crt_list, + int *crt_list_size); + /* OCSP status request extension, RFC 6066 */ typedef int (*gnutls_status_request_ocsp_func) (gnutls_session_t session, void *ptr, gnutls_datum_t * ocsp_response); diff --git a/lib/libgnutls.map b/lib/libgnutls.map index b64ff13..0e21496 100644 --- a/lib/libgnutls.map +++ b/lib/libgnutls.map @@ -1013,6 +1013,8 @@ GNUTLS_3_1_0 { gnutls_openpgp_crt_check_hostname2; gnutls_certificate_verify_peers; gnutls_certificate_get_verify_flags; + gnutls_certificate_get_x509_key; + gnutls_certificate_get_x509_crt; gnutls_credentials_get; gnutls_x509_crl_iter_crt_serial; gnutls_x509_crl_iter_deinit; -- 2.1.0 From armin at arbur.net Wed Sep 17 18:31:19 2014 From: armin at arbur.net (Armin Burgmeier) Date: Wed, 17 Sep 2014 12:31:19 -0400 Subject: [gnutls-devel] [PATCH 1/9] Fix a documentation typo In-Reply-To: References: Message-ID: <3f8b5db51a40252d380b189d3e3f977a5e42dd93.1411060328.git.armin@arbur.net> Signed-off-by: Armin Burgmeier --- lib/gnutls_ui.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/gnutls_ui.c b/lib/gnutls_ui.c index dbee667..03610e8 100644 --- a/lib/gnutls_ui.c +++ b/lib/gnutls_ui.c @@ -484,7 +484,7 @@ const gnutls_datum_t *gnutls_certificate_get_ours(gnutls_session_t session) * In case of OpenPGP keys a single key will be returned in raw * format. * - * Returns: a pointer to a #gnutls_datum_t containing our + * Returns: a pointer to a #gnutls_datum_t containing the peer's * certificates, or %NULL in case of an error or if no certificate * was used. **/ -- 2.1.0 From armin at arbur.net Thu Sep 18 17:22:35 2014 From: armin at arbur.net (Armin Burgmeier) Date: Thu, 18 Sep 2014 11:22:35 -0400 Subject: [gnutls-devel] [PATCH 9/9] Add an interface to iterate the trusted CA certificates in a trust list In-Reply-To: References: Message-ID: Signed-off-by: Armin Burgmeier --- lib/includes/gnutls/x509.h | 9 +++++ lib/libgnutls.map | 2 ++ lib/x509/verify-high.c | 88 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 99 insertions(+) diff --git a/lib/includes/gnutls/x509.h b/lib/includes/gnutls/x509.h index fd02f0c..c30eca7 100644 --- a/lib/includes/gnutls/x509.h +++ b/lib/includes/gnutls/x509.h @@ -1234,6 +1234,7 @@ gnutls_x509_crt_get_extension_by_oid2(gnutls_x509_crt_t cert, unsigned int *critical); typedef struct gnutls_x509_trust_list_st *gnutls_x509_trust_list_t; +typedef struct gnutls_x509_trust_list_iter *gnutls_x509_trust_list_iter_t; int gnutls_x509_trust_list_init(gnutls_x509_trust_list_t * list, @@ -1275,6 +1276,14 @@ gnutls_x509_trust_list_add_crls(gnutls_x509_trust_list_t list, unsigned int flags, unsigned int verification_flags); + +int +gnutls_x509_trust_list_iter_get_ca(gnutls_x509_trust_list_t list, + gnutls_x509_trust_list_iter_t *iter, + gnutls_x509_crt_t *crt); + +void gnutls_x509_trust_list_iter_deinit(gnutls_x509_trust_list_iter_t iter); + typedef int gnutls_verify_output_function(gnutls_x509_crt_t cert, gnutls_x509_crt_t issuer, /* The issuer if verification failed * because of him. might be null. */ diff --git a/lib/libgnutls.map b/lib/libgnutls.map index 3a2263f..1d9aa36 100644 --- a/lib/libgnutls.map +++ b/lib/libgnutls.map @@ -788,6 +788,8 @@ GNUTLS_3_1_0 { gnutls_x509_trust_list_add_system_trust; gnutls_x509_trust_list_add_trust_file; gnutls_x509_trust_list_add_trust_mem; + gnutls_x509_trust_list_iter_get_ca; + gnutls_x509_trust_list_iter_deinit; gnutls_pkcs12_simple_parse; gnutls_privkey_import_openpgp_raw; gnutls_privkey_import_x509_raw; diff --git a/lib/x509/verify-high.c b/lib/x509/verify-high.c index 065920d..9b4ac8c 100644 --- a/lib/x509/verify-high.c +++ b/lib/x509/verify-high.c @@ -54,6 +54,11 @@ struct node_st { }; +struct gnutls_x509_trust_list_iter { + unsigned int node_index; + unsigned int ca_index; +}; + #define DEFAULT_SIZE 127 /** @@ -289,6 +294,89 @@ gnutls_x509_trust_list_add_cas(gnutls_x509_trust_list_t list, return i; } +/** + * gnutls_x509_trust_list_iter_get_ca: + * @list: The structure of the list + * @iter: A pointer to an iterator (initially the iterator should be %NULL) + * @crt: where the certificate will be copied + * + * This function obtains a certificate in the trust list and advances the + * iterator to the next certificate. The certificate returned in @crt must be + * deallocated with gnutls_x509_crt_deinit(). + * + * When past the last element is accessed %GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE + * is returned and the iterator is reset. + * + * After use, the iterator must be deinitialized usin + * gnutls_x509_trust_list_iter_deinit(). + * + * Returns: On success, %GNUTLS_E_SUCCESS (0) is returned, otherwise a + * negative error value. + * + * Since: 3.4.0 + **/ +int +gnutls_x509_trust_list_iter_get_ca(gnutls_x509_trust_list_t list, + gnutls_x509_trust_list_iter_t *iter, + gnutls_x509_crt_t *crt) +{ + int ret; + + /* advance to next entry */ + if (*iter == NULL) { + *iter = gnutls_malloc(sizeof (struct gnutls_x509_trust_list_iter)); + if (*iter == NULL) + return gnutls_assert_val(GNUTLS_E_MEMORY_ERROR); + + (*iter)->node_index = 0; + (*iter)->ca_index = 0; + } else { + ++(*iter)->ca_index; + } + + /* skip empty nodes */ + while ((*iter)->ca_index >= list->node[(*iter)->node_index].trusted_ca_size) { + ++(*iter)->node_index; + (*iter)->ca_index = 0; + + if ((*iter)->node_index >= list->size) { + gnutls_free(*iter); + *iter = NULL; + + *crt = NULL; + return gnutls_assert_val(GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE); + } + } + + ret = gnutls_x509_crt_init(crt); + if (ret < 0) + return gnutls_assert_val(ret); + + ret = _gnutls_x509_crt_cpy(*crt, list->node[(*iter)->node_index].trusted_cas[(*iter)->ca_index]); + if (ret < 0) { + gnutls_x509_crt_deinit(*crt); + return gnutls_assert_val(ret); + } + + return 0; +} + +/** + * gnutls_x509_trust_list_iter_deinit: + * @iter: The iterator structure to be deinitialized + * + * This function will deinitialize an iterator structure. + * + * Since: 3.4.0 + **/ +void gnutls_x509_trust_list_iter_deinit(gnutls_x509_trust_list_iter_t iter) +{ + if (!iter) + return; + + gnutls_free(iter); +} + static gnutls_x509_crt_t crt_cpy(gnutls_x509_crt_t src) { gnutls_x509_crt_t dst; -- 2.1.0 From armin at arbur.net Thu Sep 18 17:22:50 2014 From: armin at arbur.net (Armin Burgmeier) Date: Thu, 18 Sep 2014 11:22:50 -0400 Subject: [gnutls-devel] [PATCH 2/9] Memory leak fix on certificate copy failure In-Reply-To: References: Message-ID: Signed-off-by: Armin Burgmeier --- lib/x509/verify-high.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/x509/verify-high.c b/lib/x509/verify-high.c index e7faccc..065920d 100644 --- a/lib/x509/verify-high.c +++ b/lib/x509/verify-high.c @@ -302,6 +302,7 @@ int ret; ret = _gnutls_x509_crt_cpy(dst, src); if (ret < 0) { + gnutls_x509_crt_deinit(dst); gnutls_assert(); return NULL; } -- 2.1.0 From armin at arbur.net Thu Sep 18 16:13:55 2014 From: armin at arbur.net (Armin Burgmeier) Date: Thu, 18 Sep 2014 10:13:55 -0400 Subject: [gnutls-devel] [PATCH 8/9] Add getter functions for openpgp keys and certificates In-Reply-To: References: Message-ID: <16bf9a14ffd998451b0ea6c0b96bdc46635e6737.1411060328.git.armin@arbur.net> Signed-off-by: Armin Burgmeier --- lib/includes/gnutls/openpgp.h | 10 +++++ lib/libgnutls.map | 2 + lib/openpgp/gnutls_openpgp.c | 98 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 110 insertions(+) diff --git a/lib/includes/gnutls/openpgp.h b/lib/includes/gnutls/openpgp.h index 11958b3..b7b64ad 100644 --- a/lib/includes/gnutls/openpgp.h +++ b/lib/includes/gnutls/openpgp.h @@ -333,6 +333,16 @@ int gnutls_certificate_set_openpgp_key gnutls_openpgp_crt_t crt, gnutls_openpgp_privkey_t pkey); int +gnutls_certificate_get_openpgp_key(gnutls_certificate_credentials_t res, + int index, + gnutls_openpgp_privkey_t *key); +int +gnutls_certificate_get_openpgp_crt(gnutls_certificate_credentials_t res, + int index, + gnutls_openpgp_crt_t **crt_list, + int *crt_list_size); + +int gnutls_certificate_set_openpgp_key_file (gnutls_certificate_credentials_t res, const char *certfile, const char *keyfile, gnutls_openpgp_crt_fmt_t format); diff --git a/lib/libgnutls.map b/lib/libgnutls.map index 0e21496..3a2263f 100644 --- a/lib/libgnutls.map +++ b/lib/libgnutls.map @@ -1015,6 +1015,8 @@ GNUTLS_3_1_0 { gnutls_certificate_get_verify_flags; gnutls_certificate_get_x509_key; gnutls_certificate_get_x509_crt; + gnutls_certificate_get_openpgp_key; + gnutls_certificate_get_openpgp_crt; gnutls_credentials_get; gnutls_x509_crl_iter_crt_serial; gnutls_x509_crl_iter_deinit; diff --git a/lib/openpgp/gnutls_openpgp.c b/lib/openpgp/gnutls_openpgp.c index 7c05e1f..bbb101e 100644 --- a/lib/openpgp/gnutls_openpgp.c +++ b/lib/openpgp/gnutls_openpgp.c @@ -166,6 +166,104 @@ gnutls_certificate_set_openpgp_key(gnutls_certificate_credentials_t res, return ret; } +/** + * gnutls_certificate_get_openpgp_key: + * @res: is a #gnutls_certificate_credentials_t structure. + * @index: The index of the key to obtain. + * @key: Location to store the key. + * + * Obtains a OpenPGP private key that has been stored in @res with one of + * gnutls_certificate_set_openpgp_key(), + * gnutls_certificate_set_openpgp_key_file(), + * gnutls_certificate_set_openpgp_key_file2(), + * gnutls_certificate_set_openpgp_key_mem(), or + * gnutls_certificate_set_openpgp_key_mem2(). + * The returned key must be deallocated with gnutls_openpgp_privkey_deinit() + * when no longer needed. + * + * If there is no key with the given index, + * %GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE is returned. If the key with the + * given index is not a X.509 key, %GNUTLS_E_INVALID_REQUEST is returned. + * + * Returns: %GNUTLS_E_SUCCESS (0) on success, or a negative error code. + * + * Since: 3.4.0 + */ +int +gnutls_certificate_get_openpgp_key(gnutls_certificate_credentials_t res, + int index, + gnutls_openpgp_privkey_t *key) +{ + if (index >= res->ncerts) { + gnutls_assert(); + return GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE; + } + + return gnutls_privkey_export_openpgp(res->pkey[index], key); +} + +/** + * gnutls_certificate_get_openpgp_crt: + * @res: is a #gnutls_certificate_credentials_t structure. + * @index: The index of the certificate list to obtain. + * @crt_list: Where to store the certificate list. + * @key: Will hold the number of certificates. + * + * Obtains a X.509 certificate list that has been stored in @res with one of + * gnutls_certificate_set_openpgp_key(), + * gnutls_certificate_set_openpgp_key_file(), + * gnutls_certificate_set_openpgp_key_file2(), + * gnutls_certificate_set_openpgp_key_mem(), or + * gnutls_certificate_set_openpgp_key_mem2(). Each certificate in the + * returned certificate list must be deallocated with + * gnutls_openpgp_crt_deinit(), and the list itself must be freed with + * gnutls_free(). + * + * If there is no certificate with the given index, + * %GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE is returned. If the certificate + * with the given index is not a X.509 certificate, %GNUTLS_E_INVALID_REQUEST + * is returned. + * + * Returns: %GNUTLS_E_SUCCESS (0) on success, or a negative error code. + * + * Since: 3.4.0 + */ +int +gnutls_certificate_get_openpgp_crt(gnutls_certificate_credentials_t res, + int index, + gnutls_openpgp_crt_t **crt_list, + int *crt_list_size) +{ + int ret, i; + + if (index >= res->ncerts) { + gnutls_assert(); + return GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE; + } + + *crt_list_size = res->certs[index].cert_list_length; + *crt_list = gnutls_malloc( + res->certs[index].cert_list_length * sizeof (gnutls_openpgp_crt_t)); + if (*crt_list == NULL) { + gnutls_assert(); + return GNUTLS_E_MEMORY_ERROR; + } + + for (i = 0; i < res->certs[index].cert_list_length; ++i) { + ret = gnutls_pcert_export_openpgp(&res->certs[index].cert_list[i], crt_list[i]); + if (ret < 0) { + while (i--) + gnutls_openpgp_crt_deinit(*crt_list[i]); + gnutls_free(*crt_list); + *crt_list = NULL; + + return gnutls_assert_val(ret); + } + } + + return 0; +} + /*- * gnutls_openpgp_get_key: * @key: the destination context to save the key. -- 2.1.0 From armin at arbur.net Wed Sep 17 18:26:47 2014 From: armin at arbur.net (Armin Burgmeier) Date: Wed, 17 Sep 2014 12:26:47 -0400 Subject: [gnutls-devel] [PATCH 3/9] Add API to retrieve a X.509 or OpenPGP certificate from a gnutls_pcert_t In-Reply-To: References: Message-ID: <05bb9ee6dbff87eecfe32565f451848fc2d5be38.1411060328.git.armin@arbur.net> Signed-off-by: Armin Burgmeier --- lib/gnutls_pcert.c | 100 +++++++++++++++++++++++++++++++++++++++++ lib/includes/gnutls/abstract.h | 6 +++ lib/libgnutls.map | 3 ++ 3 files changed, 109 insertions(+) diff --git a/lib/gnutls_pcert.c b/lib/gnutls_pcert.c index 83fbfda..a0510f5 100644 --- a/lib/gnutls_pcert.c +++ b/lib/gnutls_pcert.c @@ -339,6 +339,106 @@ int gnutls_pcert_import_openpgp_raw(gnutls_pcert_st * pcert, #endif /** + * gnutls_pcert_get_type: + * @pcert: The pcert structure. + * + * Returns the certificate type of @pcert, one of X.509 or OpenPGP. + * + * Returns: The certificate type. + * + * Since: 3.4.0 + */ +gnutls_certificate_type_t +gnutls_pcert_get_type(gnutls_pcert_st * pcert) +{ + return pcert->type; +} + +/** + * gnutls_pcert_export_x509: + * @pcert: The pcert structure. + * @crt: An initialized #gnutls_x509_crt_t. + * + * Converts the given #gnutls_pcert_t structure into a #gnutls_x509_crt_t. + * This function only works if the type of @pcert is %GNUTLS_CRT_X509. + * When successful, the value written to @crt must be freed with + * gnutls_x509_crt_deinit() when no longer needed. + * + * Returns: On success, %GNUTLS_E_SUCCESS (0) is returned, otherwise a + * negative error value. + * + * Since: 3.4.0 + */ +int gnutls_pcert_export_x509(gnutls_pcert_st * pcert, + gnutls_x509_crt_t * crt) +{ + int ret; + + if (pcert->type != GNUTLS_CRT_X509) { + gnutls_assert(); + return GNUTLS_E_INVALID_REQUEST; + } + + ret = gnutls_x509_crt_init(crt); + if (ret < 0) + return gnutls_assert_val(ret); + + ret = gnutls_x509_crt_import(*crt, &pcert->cert, GNUTLS_X509_FMT_DER); + if (ret < 0) { + gnutls_x509_crt_deinit(*crt); + *crt = NULL; + + return gnutls_assert_val(ret); + } + + return 0; +} + +#ifdef ENABLE_OPENPGP + +/** + * gnutls_pcert_export_x509: + * @pcert: The pcert structure. + * @crt: An initialized #gnutls_openpgp_crt_t. + * + * Converts the given #gnutls_pcert_t structure into a #gnutls_openpgp_crt_t. + * This function only works if the type of @pcert is %GNUTLS_CRT_OPENPGP. + * When successful, the value written to @crt must be freed with + * gnutls_openpgp_crt_deinit() when no longer needed. + * + * Returns: On success, %GNUTLS_E_SUCCESS (0) is returned, otherwise a + * negative error value. + * + * Since: 3.4.0 + */ +int gnutls_pcert_export_openpgp(gnutls_pcert_st * pcert, + gnutls_openpgp_crt_t * crt) +{ + int ret; + + if (pcert->type != GNUTLS_CRT_OPENPGP) { + gnutls_assert(); + return GNUTLS_E_INVALID_REQUEST; + } + + ret = gnutls_openpgp_crt_init(crt); + if (ret < 0) + return gnutls_assert_val(ret); + + ret = gnutls_openpgp_crt_import(*crt, &pcert->cert, GNUTLS_OPENPGP_FMT_RAW); + if (ret < 0) { + gnutls_openpgp_crt_deinit(*crt); + *crt = NULL; + + return gnutls_assert_val(ret); + } + + return 0; +} + +#endif + +/** * gnutls_pcert_deinit: * @pcert: The structure to be deinitialized * diff --git a/lib/includes/gnutls/abstract.h b/lib/includes/gnutls/abstract.h index d9aa560..835fdb7 100644 --- a/lib/includes/gnutls/abstract.h +++ b/lib/includes/gnutls/abstract.h @@ -437,6 +437,9 @@ typedef struct gnutls_pcert_st { int gnutls_pcert_import_x509(gnutls_pcert_st * pcert, gnutls_x509_crt_t crt, unsigned int flags); +int gnutls_pcert_export_x509(gnutls_pcert_st * pcert, + gnutls_x509_crt_t * crt); + int gnutls_pcert_list_import_x509_raw(gnutls_pcert_st * pcerts, unsigned int *pcert_max, @@ -460,6 +463,9 @@ int gnutls_pcert_import_openpgp(gnutls_pcert_st * pcert, gnutls_openpgp_crt_t crt, unsigned int flags); +int gnutls_pcert_export_openpgp(gnutls_pcert_st * pcert, + gnutls_openpgp_crt_t * crt); + void gnutls_pcert_deinit(gnutls_pcert_st * pcert); /* For certificate credentials */ diff --git a/lib/libgnutls.map b/lib/libgnutls.map index eabf261..f3a0582 100644 --- a/lib/libgnutls.map +++ b/lib/libgnutls.map @@ -684,6 +684,9 @@ GNUTLS_3_0_0 { gnutls_pcert_import_x509_raw; gnutls_pcert_import_openpgp; gnutls_pcert_import_openpgp_raw; + gnutls_pcert_get_type; + gnutls_pcert_export_x509; + gnutls_pcert_export_openpgp; gnutls_pubkey_get_openpgp_key_id; gnutls_certificate_set_retrieve_function2; gnutls_x509_trust_list_get_issuer; -- 2.1.0 From armin at arbur.net Wed Sep 17 23:33:40 2014 From: armin at arbur.net (Armin Burgmeier) Date: Wed, 17 Sep 2014 17:33:40 -0400 Subject: [gnutls-devel] [PATCH 5/9] Add functions to export X.509 and OpenPGP private keys from the abstract type In-Reply-To: References: Message-ID: <8e7faab6a5727ca35887574daf1247a709ced168.1411060328.git.armin@arbur.net> Signed-off-by: Armin Burgmeier --- lib/gnutls_privkey.c | 126 +++++++++++++++++++++++++++++++++++++++++ lib/includes/gnutls/abstract.h | 5 ++ lib/libgnutls.map | 2 + 3 files changed, 133 insertions(+) diff --git a/lib/gnutls_privkey.c b/lib/gnutls_privkey.c index 647777e..6249155 100644 --- a/lib/gnutls_privkey.c +++ b/lib/gnutls_privkey.c @@ -416,6 +416,51 @@ int gnutls_privkey_import_pkcs11_url(gnutls_privkey_t key, const char *url) return ret; } +/* This is currently disabled because there is no routine to copy a + * PKCS#11 private key. */ +#if 0 +/** + * gnutls_privkey_export_pkcs11: + * @pkey: The private key + * @key: Location for the key to be exported. + * + * Converts the given abstract private key to a #gnutls_pkcs11_privkey_t + * structure. The key must be of type %GNUTLS_PRIVKEY_PKCS11. The key + * returned in @key must be deinitialized with + * gnutls_pkcs11_privkey_deinit(). + * + * Returns: On success, %GNUTLS_E_SUCCESS (0) is returned, otherwise a + * negative error value. + * + * Since: 3.4.0 + */ +int +gnutls_privkey_export_pkcs11(gnutls_privkey_t pkey, + gnutls_pkcs11_privkey_t *key) +{ + int ret; + + if (pkey->type != GNUTLS_PRIVKEY_PKCS11) { + gnutls_assert(); + return GNUTLS_E_INVALID_REQUEST; + } + + ret = gnutls_pkcs11_privkey_init(key); + if (ret < 0) + return gnutls_assert_val(ret); + + ret = _gnutls_pkcs11_privkey_cpy(*key, pkey->key.openpgp); /* TODO */ + if (ret < 0) { + gnutls_pkcs11_privkey_deinit(*key); + *key = NULL; + + return gnutls_assert_val(ret); + } + + return 0; +} +#endif + #endif /* ENABLE_PKCS11 */ /** @@ -563,6 +608,46 @@ gnutls_privkey_import_x509(gnutls_privkey_t pkey, } /** + * gnutls_privkey_export_x509: + * @pkey: The private key + * @key: Location for the key to be exported. + * + * Converts the given abstract private key to a #gnutls_x509_privkey_t + * structure. The key must be of type %GNUTLS_PRIVKEY_X509. The key returned + * in @key must be deinitialized with gnutls_x509_privkey_deinit(). + * + * Returns: On success, %GNUTLS_E_SUCCESS (0) is returned, otherwise a + * negative error value. + * + * Since: 3.4.0 + */ +int +gnutls_privkey_export_x509(gnutls_privkey_t pkey, + gnutls_x509_privkey_t *key) +{ + int ret; + + if (pkey->type != GNUTLS_PRIVKEY_X509) { + gnutls_assert(); + return GNUTLS_E_INVALID_REQUEST; + } + + ret = gnutls_x509_privkey_init(key); + if (ret < 0) + return gnutls_assert_val(ret); + + ret = gnutls_x509_privkey_cpy(*key, pkey->key.x509); + if (ret < 0) { + gnutls_x509_privkey_deinit(*key); + *key = NULL; + + return gnutls_assert_val(ret); + } + + return 0; +} + +/** * gnutls_privkey_generate: * @pkey: The private key * @algo: is one of the algorithms in #gnutls_pk_algorithm_t. @@ -736,6 +821,47 @@ int gnutls_privkey_import_openpgp_raw(gnutls_privkey_t pkey, return ret; } + +/** + * gnutls_privkey_export_openpgp: + * @pkey: The private key + * @key: Location for the key to be exported. + * + * Converts the given abstract private key to a #gnutls_openpgp_privkey_t + * structure. The key must be of type %GNUTLS_PRIVKEY_OPENPGP. The key + * returned in @key must be deinitialized with + * gnutls_openpgp_privkey_deinit(). + * + * Returns: On success, %GNUTLS_E_SUCCESS (0) is returned, otherwise a + * negative error value. + * + * Since: 3.4.0 + */ +int +gnutls_privkey_export_openpgp(gnutls_privkey_t pkey, + gnutls_openpgp_privkey_t *key) +{ + int ret; + + if (pkey->type != GNUTLS_PRIVKEY_OPENPGP) { + gnutls_assert(); + return GNUTLS_E_INVALID_REQUEST; + } + + ret = gnutls_openpgp_privkey_init(key); + if (ret < 0) + return gnutls_assert_val(ret); + + ret = _gnutls_openpgp_privkey_cpy(*key, pkey->key.openpgp); + if (ret < 0) { + gnutls_openpgp_privkey_deinit(*key); + *key = NULL; + + return gnutls_assert_val(ret); + } + + return 0; +} #endif /** diff --git a/lib/includes/gnutls/abstract.h b/lib/includes/gnutls/abstract.h index 835fdb7..8ec1321 100644 --- a/lib/includes/gnutls/abstract.h +++ b/lib/includes/gnutls/abstract.h @@ -284,6 +284,11 @@ int gnutls_privkey_import_openpgp(gnutls_privkey_t pkey, gnutls_openpgp_privkey_t key, unsigned int flags); +int gnutls_privkey_export_x509(gnutls_privkey_t pkey, + gnutls_x509_privkey_t * key); +int gnutls_privkey_export_openpgp(gnutls_privkey_t pkey, + gnutls_openpgp_privkey_t * key); + int gnutls_privkey_import_openpgp_raw(gnutls_privkey_t pkey, const gnutls_datum_t * data, gnutls_openpgp_crt_fmt_t diff --git a/lib/libgnutls.map b/lib/libgnutls.map index b1121d0..27b12ba 100644 --- a/lib/libgnutls.map +++ b/lib/libgnutls.map @@ -925,6 +925,8 @@ GNUTLS_3_1_0 { gnutls_x509_crl_get_raw_issuer_dn; gnutls_certificate_get_crt_raw; gnutls_privkey_generate; + gnutls_privkey_export_x509; + gnutls_privkey_export_openpgp; gnutls_fips140_mode_enabled; gnutls_record_check_corked; gnutls_pkcs11_crt_is_known; -- 2.1.0 From armin at arbur.net Thu Sep 18 19:12:08 2014 From: armin at arbur.net (Armin Burgmeier) Date: Thu, 18 Sep 2014 13:12:08 -0400 Subject: [gnutls-devel] [PATCH 0/9] Getter functions for gnutls_credentials_t Message-ID: Hi, this is a series of patches that adds additional API to obtain certificates, private keys and trusted CAs from a gnutls_certificate_credentials_t structure. This could for example be used to load the system CAs and then show those certificates in a user interface. This was originally requested here: https://savannah.gnu.org/support/index.php?108634 Most functions return copies of keys or certificates, so that the implementation remains flexible with respect to future changes. Cheers, Armin Armin Burgmeier (9): Fix a documentation typo Memory leak fix on certificate copy failure Add API to retrieve a X.509 or OpenPGP certificate from a gnutls_pcert_t Add a function to obtain the trust list of a gnutls_certificate_credentials_t Add functions to export X.509 and OpenPGP private keys from the abstract type Add gnutls_certificate_get_verify_flags Add functions to obtain X.509 keys and certificates from certificate credentials Add getter functions for openpgp keys and certificates Add an interface to iterate the trusted CA certificates in a trust list lib/gnutls_pcert.c | 100 +++++++++++++++++++++++++++++++ lib/gnutls_privkey.c | 126 ++++++++++++++++++++++++++++++++++++++++ lib/gnutls_ui.c | 19 +++++- lib/gnutls_x509.c | 114 ++++++++++++++++++++++++++++++++++++ lib/includes/gnutls/abstract.h | 11 ++++ lib/includes/gnutls/gnutls.h.in | 11 ++++ lib/includes/gnutls/openpgp.h | 10 ++++ lib/includes/gnutls/x509.h | 12 ++++ lib/libgnutls.map | 13 +++++ lib/openpgp/gnutls_openpgp.c | 98 +++++++++++++++++++++++++++++++ lib/x509/verify-high.c | 89 ++++++++++++++++++++++++++++ 11 files changed, 602 insertions(+), 1 deletion(-) -- 2.1.0 From armin at arbur.net Thu Sep 18 00:54:09 2014 From: armin at arbur.net (Armin Burgmeier) Date: Wed, 17 Sep 2014 18:54:09 -0400 Subject: [gnutls-devel] [PATCH 6/9] Add gnutls_certificate_get_verify_flags In-Reply-To: References: Message-ID: Signed-off-by: Armin Burgmeier --- lib/gnutls_ui.c | 17 +++++++++++++++++ lib/includes/gnutls/gnutls.h.in | 3 +++ lib/libgnutls.map | 1 + 3 files changed, 21 insertions(+) diff --git a/lib/gnutls_ui.c b/lib/gnutls_ui.c index 03610e8..283fe97 100644 --- a/lib/gnutls_ui.c +++ b/lib/gnutls_ui.c @@ -631,6 +631,23 @@ gnutls_certificate_set_verify_flags(gnutls_certificate_credentials_t } /** + * gnutls_certificate_get_verify_flags: + * @res: is a gnutls_certificate_credentials_t structure + * + * Returns the verification flags set with + * gnutls_certificate_set_verify_flags(). + * + * Returns: The certificate verification flags used by @res. + * + * Since: 3.4.0 + */ +unsigned int +gnutls_certificate_get_verify_flags(gnutls_certificate_credentials_t res) +{ + return res->verify_flags; +} + +/** * gnutls_certificate_set_verify_limits: * @res: is a gnutls_certificate_credentials structure * @max_bits: is the number of bits of an acceptable certificate (default 8200) diff --git a/lib/includes/gnutls/gnutls.h.in b/lib/includes/gnutls/gnutls.h.in index bad59e0..17ff8fc 100644 --- a/lib/includes/gnutls/gnutls.h.in +++ b/lib/includes/gnutls/gnutls.h.in @@ -1349,6 +1349,9 @@ void gnutls_certificate_set_verify_limits(gnutls_certificate_credentials_t res, unsigned int max_bits, unsigned int max_depth); +unsigned int +gnutls_certificate_get_verify_flags(gnutls_certificate_credentials_t); + int gnutls_certificate_set_x509_system_trust(gnutls_certificate_credentials_t cred); diff --git a/lib/libgnutls.map b/lib/libgnutls.map index 27b12ba..b64ff13 100644 --- a/lib/libgnutls.map +++ b/lib/libgnutls.map @@ -1012,6 +1012,7 @@ GNUTLS_3_1_0 { gnutls_x509_crt_check_hostname2; gnutls_openpgp_crt_check_hostname2; gnutls_certificate_verify_peers; + gnutls_certificate_get_verify_flags; gnutls_credentials_get; gnutls_x509_crl_iter_crt_serial; gnutls_x509_crl_iter_deinit; -- 2.1.0 From nmav at gnutls.org Thu Sep 18 19:32:36 2014 From: nmav at gnutls.org (Nikos Mavrogiannopoulos) Date: Thu, 18 Sep 2014 19:32:36 +0200 Subject: [gnutls-devel] DANE: Verification failed for TLSA record with usage=0 In-Reply-To: <541A8E34.1090501@cesnet.cz> References: <541A8E34.1090501@cesnet.cz> Message-ID: On Thu, Sep 18, 2014 at 9:48 AM, Ond?ej Caletka wrote: > Hello, > I've deployed TLSA records for www.cesnet.cz. I've used swede utility to > constrain allowed CA and according to swede, the record is valid: [...] > However, ehen trying to validate this TLSA record using danetool from > GnuTLS 3.3.7, I get validation error: > $ danetool --check www.cesnet.cz --proto tcp --port 443 > Resolving 'www.cesnet.cz'... > Obtaining certificate from '2001:718:1:101::4:443'... > Querying DNS for www.cesnet.cz (tcp:443)... > _443._tcp.www.cesnet.cz. IN TLSA ( 00 00 01 > 5c428b013b2e3f0d30abb5bebd92d066dc06dc223329eb0fc735609946cf8e1c ) > Certificate usage: CA (00) > Certificate type: X.509 (00) > Contents: SHA2-256 hash (01) > Data: > 5c428b013b2e3f0d30abb5bebd92d066dc06dc223329eb0fc735609946cf8e1c Hi, Danetool requires that if the CA type is used, the CA should be the immediate CA that signed your certificate. In your case the hash is not of the CA that signed your certificate but from the CA that signed your CA's certificate. That is an artificial danetool restriction that would make sense to lift. regards, Nikos From nmav at gnutls.org Thu Sep 18 20:00:33 2014 From: nmav at gnutls.org (Nikos Mavrogiannopoulos) Date: Thu, 18 Sep 2014 20:00:33 +0200 Subject: [gnutls-devel] gnutls 3.3.8 In-Reply-To: <1411042209.22024.6.camel@nomad.lan> References: <1411042209.22024.6.camel@nomad.lan> Message-ID: On Thu, Sep 18, 2014 at 2:10 PM, Nikos Mavrogiannopoulos wrote: > Hello, > I've just released gnutls 3.3.8. This is a bug-fix release on > the next-stable branch. An important aspect of this release is that it > completes support for the p11-kit trust module, allowing gnutls to > utilize attached extensions in the system CA certificates (e.g. to > restrict a CA certificate to certain domain names, or for a specific > scope). I'll provide details on that feature on a follow up e-mail. Ok. It seems I can now get back to that. P11-kit provides a trust module that itself provides a PKCS #11 API to verify certificates using some predefined trusted anchors. It provides a documented API that gnutls uses (and as far as I understand an undocumented API that NSS uses). In any case let's suppose you have p11-kit configured, say with --with-trust-paths=/usr/share/pki/ca-trust-source and you have the "normal" bundle of CAs there. Then a trust module needs to be marked as such using a .conf file (e.g., in /etc/pkcs11/modules) with the contents: ==== module: p11-kit-trust.so priority: 1 trust-policy: yes ==== I'll give an example of the possibility of adding restrictions to the a CAs in the bundle. E.g., let's change the scope of amazon.com's CA, to prevent it from signing TLS certificates. Before adding any restrictions let's ensure that connecting to our target site works. $ gnutls-cli --x509cafile "pkcs11:" www.amazon.com if it doesn't there is something wrong with the p11-kit setup. Then let's create /usr/share/pki/ca-trust-source/amazon.p11-kit with the following contents: [p11-kit-object-v1] class: x-certificate-extension label: "My label" # The full URL encoded DER SubjectPublicKeyInfo SEQUENCE public-key-info: "%30%82%01%22%30%0d%06%09%2a%86%48%86%f7%0d%01%01%01%05%00%03%82%01%0f%00%30%82%01%0a%02%82%01%01%00%af%24%08%08%29%7a%35%9e%60%0c%aa%e7%4b%3b%4e%dc%7c%bc%3c%45%1c%bb%2b%e0%fe%29%02%f9%57%08%a3%64%85%15%27%f5%f1%ad%c8%31%89%5d%22%e8%2a%aa%a6%42%b3%8f%f8%b9%55%b7%b1%b7%4b%b3%fe%8f%7e%07%57%ec%ef%43%db%66%62%15%61%cf%60%0d%a4%d8%de%f8%e0%c3%62%08%3d%54%13%eb%49%ca%59%54%85%26%e5%2b%8f%1b%9f%eb%f5%a1%91%c2%33%49%d8%43%63%6a%52%4b%d2%8f%e8%70%51%4d%d1%89%69%7b%c7%70%f6%b3%dc%12%74%db%7b%5d%4b%56%d3%96%bf%15%77%a1%b0%f4%a2%25%f2%af%1c%92%67%18%e5%f4%06%04%ef%90%b9%e4%00%e4%dd%3a%b5%19%ff%02%ba%f4%3c%ee%e0%8b%eb%37%8b%ec%f4%d7%ac%f2%f6%f0%3d%af%dd%75%91%33%19%1d%1c%40%cb%74%24%19%21%93%d9%14%fe%ac%2a%52%c7%8f%d5%04%49%e4%8d%63%47%88%3c%69%83%cb%fe%47%bd%2b%7e%4f%c5%95%ae%0e%9d%d4%d1%43%c0%67%73%e3%14%08%7e%e5%3f%9f%73%b8%33%0a%cf%5d%3f%34%87%96%8a%ee%53%e8%25%15%02%03%01%00%01" object-id: 2.5.29.37 value: "%30%16%06%03%55%1d%25%01%01%ff%04%0c%30%0a%06%08%2b%06%01%05%05%07%03%09" That changes the purpose of the amazon CA to OCSP signing. The CA is identified from the public-key-info (which is a HEX encoding of the subjectPublicKeyInfo of that CA's key), and the object-id and value are RFC5280 certificate extensions. When that file is in place using the gnutls-cli command above should fail. Other restrictions can be added, potentially all restrictions that can be expressed with extensions used by gnutls, e.g., restricting the host names a CA can sign for etc. Unfortunately the tools required to make these p11-kit files pretty much don't exist. You'll have to mess with some frob- examples or help Stef Walter who maintains p11-kit to make them happen. regards, Nikos From INVALID.NOREPLY at gnu.org Fri Sep 19 03:17:55 2014 From: INVALID.NOREPLY at gnu.org (Ryan Schmidt) Date: Fri, 19 Sep 2014 01:17:55 +0000 Subject: [gnutls-devel] [sr #108614] Reinstate support for C89 In-Reply-To: <20140727-123513.sv64386.57035@savannah.gnu.org> References: <20140714-062418.sv64386.1640@savannah.gnu.org> <20140727-152108.sv707.62584@savannah.gnu.org> <20140727-123513.sv64386.57035@savannah.gnu.org> Message-ID: <20140919-011754.sv64386.12112@savannah.gnu.org> Follow-up Comment #3, sr #108614 (project gnutls): It looks like you did apply this patch: https://gitorious.org/gnutls/gnutls/commit/0345118a91ac776671cdf6c907164c75ac3559f1 Thanks! So this ticket can be closed. While C99 may be 15 years old, C89 is the default mode of the gcc 4.2.1 compiler, which is the default compiler on OS X 10.6, which was released by Apple just 5 years ago in August 2009 and was not replaced by OS X 10.7 until July 2011. According to one company's survey just 6 weeks ago (https://chitika.com/insights/2014/yosemite-preview-adoption) OS X 10.6 remains the second most popular version of OS X with 17.5% market share, behind OS X 10.9 with 45.7%. So it is important to continue to support users using OS X 10.6 and its older compiler. _______________________________________________________ Reply to this item at: _______________________________________________ Message sent via/by Savannah http://savannah.gnu.org/ From INVALID.NOREPLY at gnu.org Fri Sep 19 03:24:55 2014 From: INVALID.NOREPLY at gnu.org (Ryan Schmidt) Date: Fri, 19 Sep 2014 01:24:55 +0000 Subject: [gnutls-devel] [sr #108655] Issue tracker's git link outdated Message-ID: <20140919-012454.sv64386.58648@savannah.gnu.org> URL: Summary: Issue tracker's git link outdated Project: GnuTLS Submitted by: ryandesign Submitted on: Fri 19 Sep 2014 01:24:54 AM GMT Category: None Priority: 5 - Normal Severity: 3 - Normal Status: None Privacy: Public Assigned to: None Originator Email: Open/Closed: Open Discussion Lock: Any Operating System: None _______________________________________________________ Details: In this issue tracker: https://savannah.gnu.org/support/?func=additem&group=gnutls Under the "Source Code" menu's "Browse Sources Repository" item, it takes you to: http://git.savannah.gnu.org/cgit/gnutls.git This repository has not been updated in 2 years. It seems that development has moved to this repository: https://gitorious.org/gnutls/gnutls The link in this issue tracker should be updated. The same update should be made on this page: https://savannah.gnu.org/git/?group=gnutls Thanks. _______________________________________________________ Reply to this item at: _______________________________________________ Message sent via/by Savannah http://savannah.gnu.org/ From ametzler at bebt.de Sat Sep 20 08:21:53 2014 From: ametzler at bebt.de (Andreas Metzler) Date: Sat, 20 Sep 2014 08:21:53 +0200 Subject: [gnutls-devel] openconnect's vasprintf() license is (L)GPLv3 incompatible Message-ID: <20140920062152.GA14826@downhill.g.la> Hello, looking over the diff from 3.3.7 to 3.3.8 I have stumbled over the newly added license header for lib/vasprintf.c (Thanks for it, BTW): * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * version 2.1, as published by the Free Software Foundation. This is a bit problematic, since LGPLv2.1 (without "or later") is incompatible with (L)GPLv3+. Therefore (L)GPLv3+ software linked against against GnuTLS could not be distributed. - It does not hit us on Debian since we have vasprintf() in glibc but it is something of a trap. cu Andreas -- `What a good friend you are to him, Dr. Maturin. His other friends are so grateful to you.' `I sew his ears on from time to time, sure' From ametzler at bebt.de Sat Sep 20 08:38:02 2014 From: ametzler at bebt.de (Andreas Metzler) Date: Sat, 20 Sep 2014 08:38:02 +0200 Subject: [gnutls-devel] openconnect's vasprintf() license is (L)GPLv3 incompatible In-Reply-To: <20140920062152.GA14826@downhill.g.la> References: <20140920062152.GA14826@downhill.g.la> Message-ID: <20140920063802.GB14826@downhill.g.la> On 2014-09-20 Andreas Metzler wrote: > looking over the diff from 3.3.7 to 3.3.8 I have stumbled over the > newly added license header for lib/vasprintf.c (Thanks for it, BTW): > * This program is free software; you can redistribute it and/or > * modify it under the terms of the GNU Lesser General Public License > * version 2.1, as published by the Free Software Foundation. > This is a bit problematic, since LGPLv2.1 (without "or later") > is incompatible with (L)GPLv3+. Therefore (L)GPLv3+ software linked > against against GnuTLS could not be distributed. - It does not hit us > on Debian since we have vasprintf() in glibc but it is something of a > trap. Please ignore. Looking at the compat matrix http://www.gnu.org/licenses/gpl-faq.html shows that there is actually no problem. cu Andreas -- `What a good friend you are to him, Dr. Maturin. His other friends are so grateful to you.' `I sew his ears on from time to time, sure' From nmav at gnutls.org Sun Sep 21 00:55:52 2014 From: nmav at gnutls.org (Nikos Mavrogiannopoulos) Date: Sun, 21 Sep 2014 00:55:52 +0200 Subject: [gnutls-devel] [PATCH 0/9] Getter functions for gnutls_credentials_t In-Reply-To: References: Message-ID: <1411253752.2517.3.camel@nomad.lan> On Thu, 2014-09-18 at 13:12 -0400, Armin Burgmeier wrote: > Hi, > > this is a series of patches that adds additional API to obtain > certificates, private keys and trusted CAs from a > gnutls_certificate_credentials_t structure. This could for example be > used to load the system CAs and then show those certificates in a user > interface. This was originally requested here: > https://savannah.gnu.org/support/index.php?108634 > > Most functions return copies of keys or certificates, so that the > implementation remains flexible with respect to future changes. > Fix a documentation typo > Memory leak fix on certificate copy failure > Add API to retrieve a X.509 or OpenPGP certificate from a > gnutls_pcert_t > Add a function to obtain the trust list of a > gnutls_certificate_credentials_t > Add gnutls_certificate_get_verify_flags Thank you. I've checked and applied these so far. > Add functions to export X.509 and OpenPGP private keys from the > abstract type > Add functions to obtain X.509 keys and certificates from certificate > credentials > Add getter functions for openpgp keys and certificates > Add an interface to iterate the trusted CA certificates in a trust > list Would it be possible to modify some test programs, or a add new ones to test these functions? That would ensure that the functionality offered will not break on any internal change. I'll try to add the missing part for the pkcs11 private key copy. regards, Nikos From INVALID.NOREPLY at gnu.org Sun Sep 21 01:21:27 2014 From: INVALID.NOREPLY at gnu.org (Nikos Mavrogiannopoulos) Date: Sat, 20 Sep 2014 23:21:27 +0000 Subject: [gnutls-devel] [sr #108655] Issue tracker's git link outdated In-Reply-To: <20140919-012454.sv64386.58648@savannah.gnu.org> References: <20140919-012454.sv64386.58648@savannah.gnu.org> Message-ID: <20140921-022127.sv707.66691@savannah.gnu.org> Follow-up Comment #1, sr #108655 (project gnutls): Thanks but unfortunately these links are hard coded by savannah. As gitorious doesn't offer a decent issue tracker we use that one here. I've modified the project's description here to reflex that. _______________________________________________________ Reply to this item at: _______________________________________________ Message sent via/by Savannah http://savannah.gnu.org/ From INVALID.NOREPLY at gnu.org Sun Sep 21 01:21:56 2014 From: INVALID.NOREPLY at gnu.org (Nikos Mavrogiannopoulos) Date: Sat, 20 Sep 2014 23:21:56 +0000 Subject: [gnutls-devel] [sr #108623] gnutls for Windows port. In-Reply-To: <20140731-132008.sv707.28574@savannah.gnu.org> References: <20140730-131401.sv79827.20795@savannah.gnu.org> <20140731-132008.sv707.28574@savannah.gnu.org> Message-ID: <20140921-022156.sv707.65820@savannah.gnu.org> Update of sr #108623 (project gnutls): Status: None => Done Open/Closed: Open => Closed _______________________________________________________ Reply to this item at: _______________________________________________ Message sent via/by Savannah http://savannah.gnu.org/ From INVALID.NOREPLY at gnu.org Sun Sep 21 01:22:11 2014 From: INVALID.NOREPLY at gnu.org (Nikos Mavrogiannopoulos) Date: Sat, 20 Sep 2014 23:22:11 +0000 Subject: [gnutls-devel] [sr #108614] Reinstate support for C89 In-Reply-To: <20140919-011754.sv64386.12112@savannah.gnu.org> References: <20140714-062418.sv64386.1640@savannah.gnu.org> <20140727-152108.sv707.62584@savannah.gnu.org> <20140727-123513.sv64386.57035@savannah.gnu.org> <20140919-011754.sv64386.12112@savannah.gnu.org> Message-ID: <20140921-022211.sv707.33608@savannah.gnu.org> Update of sr #108614 (project gnutls): Open/Closed: Open => Closed _______________________________________________________ Reply to this item at: _______________________________________________ Message sent via/by Savannah http://savannah.gnu.org/ From INVALID.NOREPLY at gnu.org Sun Sep 21 01:22:48 2014 From: INVALID.NOREPLY at gnu.org (Nikos Mavrogiannopoulos) Date: Sat, 20 Sep 2014 23:22:48 +0000 Subject: [gnutls-devel] [sr #108612] Both verify_ca() and verify_ee() abort DANE processing with DANE_E_UNKNOWN_DANE_DATA for unrecognised types In-Reply-To: <20140707-001314.sv707.39125@savannah.gnu.org> References: <20140706-193905.sv0.41002@savannah.gnu.org> <20140707-001314.sv707.39125@savannah.gnu.org> Message-ID: <20140921-022248.sv707.30825@savannah.gnu.org> Update of sr #108612 (project gnutls): Status: Ready For Test => Done Open/Closed: Open => Closed _______________________________________________________ Reply to this item at: _______________________________________________ Message sent via/by Savannah http://savannah.gnu.org/ From INVALID.NOREPLY at gnu.org Sun Sep 21 01:23:16 2014 From: INVALID.NOREPLY at gnu.org (Nikos Mavrogiannopoulos) Date: Sat, 20 Sep 2014 23:23:16 +0000 Subject: [gnutls-devel] [sr #108611] verify_ca() bypasses DANE checking if there are fewer than 2 certificates In-Reply-To: <20140707-000504.sv707.63200@savannah.gnu.org> References: <20140706-193407.sv0.89922@savannah.gnu.org> <20140707-000504.sv707.63200@savannah.gnu.org> Message-ID: <20140921-022316.sv707.46729@savannah.gnu.org> Update of sr #108611 (project gnutls): Status: None => Done Open/Closed: Open => Closed _______________________________________________________ Follow-up Comment #2: This was fixed in the repository. _______________________________________________________ Reply to this item at: _______________________________________________ Message sent via/by Savannah http://savannah.gnu.org/ From nmav at gnutls.org Sun Sep 21 08:52:28 2014 From: nmav at gnutls.org (Nikos Mavrogiannopoulos) Date: Sun, 21 Sep 2014 08:52:28 +0200 Subject: [gnutls-devel] certtool --crq-info should show signing algorithm In-Reply-To: <5418BA4E.7090602@fifthhorseman.net> References: <5418BA4E.7090602@fifthhorseman.net> Message-ID: <1411282348.2576.1.camel@nomad.lan> On Tue, 2014-09-16 at 18:31 -0400, Daniel Kahn Gillmor wrote: > when looking at a human-readable representation of a certificate signing > request (CSR), certtool --crq-info currently doesn't display the > algorithm used for the self-signature of the CSR. (i.e. it doesn't > indicate if it was RSAwithSHA1 or RSAwithSHA256, etc) > > It would occasionally be useful for people examining CSRs to see this > information (i was just asked for it privately, and i think it would be > useful too, e.g. when reviewing a CSR before submitting it to a CA). This was added in master (i.e., what to become 3.4.0). regards, Nikos From nmav at gnutls.org Mon Sep 22 09:03:51 2014 From: nmav at gnutls.org (Nikos Mavrogiannopoulos) Date: Mon, 22 Sep 2014 09:03:51 +0200 Subject: [gnutls-devel] [PATCH 3/9] Add API to retrieve a X.509 or OpenPGP certificate from a gnutls_pcert_t In-Reply-To: <05bb9ee6dbff87eecfe32565f451848fc2d5be38.1411060328.git.armin@arbur.net> References: <05bb9ee6dbff87eecfe32565f451848fc2d5be38.1411060328.git.armin@arbur.net> Message-ID: On Wed, Sep 17, 2014 at 6:26 PM, Armin Burgmeier wrote: > /** > + * gnutls_pcert_get_type: > + * @pcert: The pcert structure. > + * > + * Returns the certificate type of @pcert, one of X.509 or OpenPGP. > + * > + * Returns: The certificate type. > + * > + * Since: 3.4.0 > + */ > +gnutls_certificate_type_t > +gnutls_pcert_get_type(gnutls_pcert_st * pcert) Is this function necessary? As the structure is exported I'm wondering about the value of it... From ludo at gnu.org Mon Sep 22 15:51:16 2014 From: ludo at gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Date: Mon, 22 Sep 2014 15:51:16 +0200 Subject: [gnutls-devel] configure should check for Message-ID: <871tr3pxuz.fsf@gnu.org> When GNU libidn isn?t installed, compilation of ?master? fails with: --8<---------------cut here---------------start------------->8--- make[4]: Entering directory '/home/ludo/src/gnutls/+build/src/crywrap' CC crywrap.o ../../../src/crywrap/crywrap.c:35:18: fatal error: idna.h: No such file or directory #include ^ compilation terminated. --8<---------------cut here---------------end--------------->8--- I think configure should check for this header, and possibly bail out if this is a mandatory feature. WDYT? Ludo?. From ludo at gnu.org Mon Sep 22 16:25:14 2014 From: ludo at gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Date: Mon, 22 Sep 2014 16:25:14 +0200 Subject: [gnutls-devel] Guile patches committed Message-ID: <87wq8vohpx.fsf@gnu.org> Hi, Just to let you know I?ve committed two patches for the Guile bindings: e9fc746 adds bindings for ?gnutls_server_name_set?, and abcb456 restores a cross-reference in the manual. Nikos: could you port them to the stable branch (I?d rather let you do it than mess things up)? Make sure to regenerate doc/core.c.texi and doc/gnutls-guile.info for the next release. Thanks, Ludo?. From nmav at gnutls.org Mon Sep 22 18:57:11 2014 From: nmav at gnutls.org (Nikos Mavrogiannopoulos) Date: Mon, 22 Sep 2014 18:57:11 +0200 Subject: [gnutls-devel] configure should check for In-Reply-To: <871tr3pxuz.fsf@gnu.org> References: <871tr3pxuz.fsf@gnu.org> Message-ID: <1411405031.3469.1.camel@nomad.lan> On Mon, 2014-09-22 at 15:51 +0200, Ludovic Court?s wrote: > When GNU libidn isn?t installed, compilation of ?master? fails with: > > --8<---------------cut here---------------start------------->8--- > make[4]: Entering directory '/home/ludo/src/gnutls/+build/src/crywrap' > CC crywrap.o > ../../../src/crywrap/crywrap.c:35:18: fatal error: idna.h: No such file or directory > #include > ^ > compilation terminated. > I think configure should check for this header, and possibly bail out if > this is a mandatory feature. WDYT? Thanks. It is an optional requirement. I've modified the configure script to disable crywrap if libidn isn't there. regards, Nikos From nmav at gnutls.org Mon Sep 22 19:04:24 2014 From: nmav at gnutls.org (Nikos Mavrogiannopoulos) Date: Mon, 22 Sep 2014 19:04:24 +0200 Subject: [gnutls-devel] Guile patches committed In-Reply-To: <87wq8vohpx.fsf@gnu.org> References: <87wq8vohpx.fsf@gnu.org> Message-ID: <1411405464.3469.6.camel@nomad.lan> On Mon, 2014-09-22 at 16:25 +0200, Ludovic Court?s wrote: > Hi, > > Just to let you know I?ve committed two patches for the Guile bindings: > e9fc746 adds bindings for ?gnutls_server_name_set?, and abcb456 restores > a cross-reference in the manual. > > Nikos: could you port them to the stable branch (I?d rather let you do > it than mess things up)? Hi, I've done the cherry pick. Please add or suggest some NEWS entry. > Make sure to regenerate doc/core.c.texi and doc/gnutls-guile.info for > the next release. I realized that this manual isn't available through the document.wml. I'll try to add it before next release. regards, Nikos From ludo at gnu.org Mon Sep 22 19:21:08 2014 From: ludo at gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Date: Mon, 22 Sep 2014 19:21:08 +0200 Subject: [gnutls-devel] Guile patches committed In-Reply-To: <1411405464.3469.6.camel@nomad.lan> (Nikos Mavrogiannopoulos's message of "Mon, 22 Sep 2014 19:04:24 +0200") References: <87wq8vohpx.fsf@gnu.org> <1411405464.3469.6.camel@nomad.lan> Message-ID: <87k34vmv0b.fsf@gnu.org> Nikos Mavrogiannopoulos skribis: > On Mon, 2014-09-22 at 16:25 +0200, Ludovic Court?s wrote: >> Hi, >> >> Just to let you know I?ve committed two patches for the Guile bindings: >> e9fc746 adds bindings for ?gnutls_server_name_set?, and abcb456 restores >> a cross-reference in the manual. >> >> Nikos: could you port them to the stable branch (I?d rather let you do >> it than mess things up)? > > Hi, > I've done the cherry pick. Please add or suggest some NEWS entry. Cool. What about this: -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: text/x-patch Size: 308 bytes Desc: not available URL: -------------- next part -------------- >> Make sure to regenerate doc/core.c.texi and doc/gnutls-guile.info for >> the next release. > > I realized that this manual isn't available through the document.wml. What is document.wml? > I'll try to add it before next release. Great, thank you. Ludo?. From armin at arbur.net Mon Sep 22 21:56:46 2014 From: armin at arbur.net (Armin Burgmeier) Date: Mon, 22 Sep 2014 15:56:46 -0400 Subject: [gnutls-devel] [PATCH 0/9] Getter functions for gnutls_credentials_t In-Reply-To: <1411253752.2517.3.camel@nomad.lan> References: <1411253752.2517.3.camel@nomad.lan> Message-ID: <1411415806.1335.6.camel@waverley> > > Add functions to export X.509 and OpenPGP private keys from the > > abstract type > > Add functions to obtain X.509 keys and certificates from certificate > > credentials > > Add getter functions for openpgp keys and certificates > > Add an interface to iterate the trusted CA certificates in a trust > > list > > Would it be possible to modify some test programs, or a add new ones to > test these functions? That would ensure that the functionality offered > will not break on any internal change. Sounds reasonable, I'll take care of it. Cheers, Armin From armin at arbur.net Mon Sep 22 21:58:53 2014 From: armin at arbur.net (Armin Burgmeier) Date: Mon, 22 Sep 2014 15:58:53 -0400 Subject: [gnutls-devel] [PATCH 3/9] Add API to retrieve a X.509 or OpenPGP certificate from a gnutls_pcert_t In-Reply-To: References: <05bb9ee6dbff87eecfe32565f451848fc2d5be38.1411060328.git.armin@arbur.net> Message-ID: <1411415933.1335.8.camel@waverley> On Mon, 2014-09-22 at 09:03 +0200, Nikos Mavrogiannopoulos wrote: > On Wed, Sep 17, 2014 at 6:26 PM, Armin Burgmeier wrote: > > /** > > + * gnutls_pcert_get_type: > > + * @pcert: The pcert structure. > > + * > > + * Returns the certificate type of @pcert, one of X.509 or OpenPGP. > > + * > > + * Returns: The certificate type. > > + * > > + * Since: 3.4.0 > > + */ > > +gnutls_certificate_type_t > > +gnutls_pcert_get_type(gnutls_pcert_st * pcert) > > Is this function necessary? As the structure is exported I'm wondering > about the value of it... Oh, I was under the impression the structure is private. If the fields in the structure are part of the stable API then indeed, then indeed there is no additional value. Sorry, I missed that. Cheers, Armin From nmav at gnutls.org Mon Sep 22 22:13:02 2014 From: nmav at gnutls.org (Nikos Mavrogiannopoulos) Date: Mon, 22 Sep 2014 22:13:02 +0200 Subject: [gnutls-devel] Guile patches committed In-Reply-To: <87k34vmv0b.fsf@gnu.org> References: <87wq8vohpx.fsf@gnu.org> <1411405464.3469.6.camel@nomad.lan> <87k34vmv0b.fsf@gnu.org> Message-ID: <1411416782.5630.1.camel@nomad.lan> On Mon, 2014-09-22 at 19:21 +0200, Ludovic Court?s wrote: > Nikos Mavrogiannopoulos skribis: > > > On Mon, 2014-09-22 at 16:25 +0200, Ludovic Court?s wrote: > >> Hi, > >> > >> Just to let you know I?ve committed two patches for the Guile bindings: > >> e9fc746 adds bindings for ?gnutls_server_name_set?, and abcb456 restores > >> a cross-reference in the manual. > >> > >> Nikos: could you port them to the stable branch (I?d rather let you do > >> it than mess things up)? > > > > Hi, > > I've done the cherry pick. Please add or suggest some NEWS entry. > > Cool. What about this: > > >> Make sure to regenerate doc/core.c.texi and doc/gnutls-guile.info for > >> the next release. > > > > I realized that this manual isn't available through the document.wml. > > What is document.wml? If you checkout the web-pages branch you'll see the source code of the web pages. regards, Nikos From nmav at gnutls.org Mon Sep 22 22:39:45 2014 From: nmav at gnutls.org (Nikos Mavrogiannopoulos) Date: Mon, 22 Sep 2014 22:39:45 +0200 Subject: [gnutls-devel] [PATCH 3/9] Add API to retrieve a X.509 or OpenPGP certificate from a gnutls_pcert_t In-Reply-To: <1411415933.1335.8.camel@waverley> References: <05bb9ee6dbff87eecfe32565f451848fc2d5be38.1411060328.git.armin@arbur.net> <1411415933.1335.8.camel@waverley> Message-ID: <1411418385.5630.3.camel@nomad.lan> On Mon, 2014-09-22 at 15:58 -0400, Armin Burgmeier wrote: > > > /** > > > + * gnutls_pcert_get_type: > > > + * @pcert: The pcert structure. > > > + * > > > + * Returns the certificate type of @pcert, one of X.509 or OpenPGP. > > > + * > > > + * Returns: The certificate type. > > > + * > > > + * Since: 3.4.0 > > > + */ > > > +gnutls_certificate_type_t > > > +gnutls_pcert_get_type(gnutls_pcert_st * pcert) > > > > Is this function necessary? As the structure is exported I'm wondering > > about the value of it... > > Oh, I was under the impression the structure is private. If the fields > in the structure are part of the stable API then indeed, then indeed > there is no additional value. Sorry, I missed that. No problem. I've removed this function. regards, Nikos From nmav at gnutls.org Tue Sep 23 11:00:38 2014 From: nmav at gnutls.org (Nikos Mavrogiannopoulos) Date: Tue, 23 Sep 2014 11:00:38 +0200 Subject: [gnutls-devel] Guile patches committed In-Reply-To: <87k34vmv0b.fsf@gnu.org> References: <87wq8vohpx.fsf@gnu.org> <1411405464.3469.6.camel@nomad.lan> <87k34vmv0b.fsf@gnu.org> Message-ID: On Mon, Sep 22, 2014 at 7:21 PM, Ludovic Court?s wrote: >>> Just to let you know I've committed two patches for the Guile bindings: >>> e9fc746 adds bindings for 'gnutls_server_name_set', and abcb456 restores >>> a cross-reference in the manual. >>> Nikos: could you port them to the stable branch (I'd rather let you do >>> it than mess things up)? >> Hi, >> I've done the cherry pick. Please add or suggest some NEWS entry. > Cool. What about this: I think there is some text missing here... From ludo at gnu.org Tue Sep 23 11:46:21 2014 From: ludo at gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Date: Tue, 23 Sep 2014 11:46:21 +0200 Subject: [gnutls-devel] Guile patches committed In-Reply-To: (Nikos Mavrogiannopoulos's message of "Tue, 23 Sep 2014 11:00:38 +0200") References: <87wq8vohpx.fsf@gnu.org> <1411405464.3469.6.camel@nomad.lan> <87k34vmv0b.fsf@gnu.org> Message-ID: <877g0uoej6.fsf@gnu.org> Nikos Mavrogiannopoulos skribis: > On Mon, Sep 22, 2014 at 7:21 PM, Ludovic Court?s wrote: >>>> Just to let you know I've committed two patches for the Guile bindings: >>>> e9fc746 adds bindings for 'gnutls_server_name_set', and abcb456 restores >>>> a cross-reference in the manual. >>>> Nikos: could you port them to the stable branch (I'd rather let you do >>>> it than mess things up)? >>> Hi, >>> I've done the cherry pick. Please add or suggest some NEWS entry. >> Cool. What about this: > > I think there is some text missing here... What do you have in mind? The function is documented in the manual, so I didn?t see the need to describe it any further. Ludo?. From armin at arbur.net Tue Sep 23 22:12:38 2014 From: armin at arbur.net (Armin Burgmeier) Date: Tue, 23 Sep 2014 16:12:38 -0400 Subject: [gnutls-devel] [PATCH] Check the credentials getter functions as part of the unit tests Message-ID: --- tests/openpgp-auth.c | 47 ++++++++++++++++++++++ tests/x509cert.c | 107 ++++++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 149 insertions(+), 5 deletions(-) diff --git a/tests/openpgp-auth.c b/tests/openpgp-auth.c index 67faf73..82e3712 100644 --- a/tests/openpgp-auth.c +++ b/tests/openpgp-auth.c @@ -64,6 +64,49 @@ int key_recv_func(gnutls_session_t session, const unsigned char *keyfpr, return 0; } +void check_loaded_key(gnutls_certificate_credentials_t cred) +{ + int err; + gnutls_openpgp_privkey_t key; + gnutls_openpgp_crt_t *crts; + int n_crts; + gnutls_datum_t datum; + gnutls_openpgp_keyid_t keyid; + int i; + + /* check that the getter functions for openpgp keys of + * gnutls_certificate_credentials_t work and deliver the + * expected key ID. */ + + err = gnutls_certificate_get_openpgp_key(cred, 0, &key); + if (err != 0) + fail("get openpgp key %s\n", + gnutls_strerror(err)); + + gnutls_openpgp_privkey_get_subkey_id(key, 0, keyid); + if (keyid[0] != 0xf3 || keyid[1] != 0x0f || keyid[2] != 0xd4 || keyid[3] != 0x23 || + keyid[4] != 0xc1 || keyid[5] != 0x43 || keyid[6] != 0xe7 || keyid[7] != 0xba) + fail("incorrect key id (privkey)\n"); + + err = gnutls_certificate_get_openpgp_crt(cred, 0, &crts, &n_crts); + if (err != 0) + fail("get openpgp crts %s\n", + gnutls_strerror(err)); + + if (n_crts != 1) + fail("openpgp n_crts != 1\n"); + + gnutls_openpgp_crt_get_subkey_id(crts[0], 0, keyid); + if (keyid[0] != 0xf3 || keyid[1] != 0x0f || keyid[2] != 0xd4 || keyid[3] != 0x23 || + keyid[4] != 0xc1 || keyid[5] != 0x43 || keyid[6] != 0xe7 || keyid[7] != 0xba) + fail("incorrect key id (pubkey)\n"); + + for (i = 0; i < n_crts; ++i) + gnutls_openpgp_crt_deinit(crts[i]); + gnutls_free(crts); + gnutls_openpgp_privkey_deinit(key); +} + void doit() { int err, i; @@ -151,6 +194,8 @@ void doit() fail("client openpgp keys %s\n", gnutls_strerror(err)); + check_loaded_key(cred); + err = gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, @@ -230,6 +275,8 @@ void doit() fail("server openpgp keys %s\n", gnutls_strerror(err)); + check_loaded_key(cred); + err = gnutls_dh_params_init(&dh_params); if (err) fail("server DH params init %d\n", err); diff --git a/tests/x509cert.c b/tests/x509cert.c index 853e7e7..4e07ae5 100644 --- a/tests/x509cert.c +++ b/tests/x509cert.c @@ -64,7 +64,7 @@ static unsigned char ca_pem[] = "njuu7kHq5peUgYn8Jd9zNzExBOEp1VOipGsf6G66oQAhDFp2o8zkz7ZH71zR4HEW\n" "KoX6n5Emn6DvcEH/9pAhnGxNHJAoS7czTKv/JDZJhkqHxyrE1fuLsg5Qv25DTw7+\n" "PfqUpIhz5Bbm7J4=\n" "-----END CERTIFICATE-----\n"; -const gnutls_datum_t ca = { ca_pem, sizeof(ca_pem) }; +const gnutls_datum_t ca = { ca_pem, sizeof(ca_pem) - 1}; static unsigned char cert_pem[] = "-----BEGIN CERTIFICATE-----\n" @@ -92,7 +92,7 @@ static unsigned char cert_pem[] = "njuu7kHq5peUgYn8Jd9zNzExBOEp1VOipGsf6G66oQAhDFp2o8zkz7ZH71zR4HEW\n" "KoX6n5Emn6DvcEH/9pAhnGxNHJAoS7czTKv/JDZJhkqHxyrE1fuLsg5Qv25DTw7+\n" "PfqUpIhz5Bbm7J4=\n" "-----END CERTIFICATE-----\n"; -const gnutls_datum_t cert = { cert_pem, sizeof(cert_pem) }; +const gnutls_datum_t cert = { cert_pem, sizeof(cert_pem) - 1}; static unsigned char key_pem[] = "-----BEGIN RSA PRIVATE KEY-----\n" @@ -110,7 +110,7 @@ static unsigned char key_pem[] = "/iVX2cmMTSh3w3z8MaECQEp0XJWDVKOwcTW6Ajp9SowtmiZ3YDYo1LF9igb4iaLv\n" "sWZGfbnU3ryjvkb6YuFjgtzbZDZHWQCo8/cOtOBmPdk=\n" "-----END RSA PRIVATE KEY-----\n"; -const gnutls_datum_t key = { key_pem, sizeof(key_pem) }; +const gnutls_datum_t key = { key_pem, sizeof(key_pem) - 1}; static unsigned char server_cert_pem[] = "-----BEGIN CERTIFICATE-----\n" @@ -129,7 +129,7 @@ static unsigned char server_cert_pem[] = "rOKLUQRWJ0K3HyXRMhbqjdLIaQiCvQLuizo=\n" "-----END CERTIFICATE-----\n"; const gnutls_datum_t server_cert = { server_cert_pem, - sizeof(server_cert_pem) + sizeof(server_cert_pem) - 1 }; static unsigned char server_key_pem[] = @@ -150,7 +150,7 @@ static unsigned char server_key_pem[] = "-----END RSA PRIVATE KEY-----\n"; const gnutls_datum_t server_key = { server_key_pem, - sizeof(server_key_pem) + sizeof(server_key_pem) - 1 }; #define LIST_SIZE 3 @@ -165,6 +165,15 @@ void doit(void) size_t dn_size; unsigned int list_size; + gnutls_x509_privkey_t get_key; + gnutls_x509_crt_t *get_crts; + int n_get_crts; + gnutls_datum_t get_datum; + gnutls_x509_trust_list_t trust_list; + gnutls_x509_trust_list_iter_t trust_iter; + gnutls_x509_crt_t get_ca_crt; + int n_get_ca_crts; + /* this must be called once in the program */ global_init(); @@ -203,6 +212,94 @@ void doit(void) if (debug) fprintf(stderr, "Issuer's DN: %s\n", dn); + + /* test the getter functions of gnutls_certificate_credentials_t */ + + ret = + gnutls_certificate_get_x509_key(x509_cred, 0, &get_key); + if (ret < 0) + fail("gnutls_certificate_get_x509_key"); + + ret = + gnutls_x509_privkey_export2(get_key, + GNUTLS_X509_FMT_PEM, + &get_datum); + if (ret < 0) + fail("gnutls_x509_privkey_export2"); + + if (get_datum.size != server_key.size || + memcmp(get_datum.data, server_key.data, get_datum.size) != 0) { + fail( + "exported key %u vs. %u\n\n%s\n\nvs.\n\n%s", + get_datum.size, server_key.size, + get_datum.data, server_key.data); + } + + gnutls_free(get_datum.data); + + ret = + gnutls_certificate_get_x509_crt(x509_cred, 0, &get_crts, &n_get_crts); + if (ret < 0) + fail("gnutls_certificate_get_x509_crt"); + if (n_get_crts != 1) + fail("gnutls_certificate_get_x509_crt: n_crts != 1"); + + ret = + gnutls_x509_crt_export2(get_crts[0], + GNUTLS_X509_FMT_PEM, + &get_datum); + if (ret < 0) + fail("gnutls_x509_crt_export2"); + + if (get_datum.size != server_cert.size || + memcmp(get_datum.data, server_cert.data, get_datum.size) != 0) { + fail( + "exported certificate %u vs. %u\n\n%s\n\nvs.\n\n%s", + get_datum.size, server_cert.size, + get_datum.data, server_cert.data); + } + + gnutls_free(get_datum.data); + + gnutls_certificate_get_trust_list(x509_cred, &trust_list); + + n_get_ca_crts = 0; + trust_iter = NULL; + while (gnutls_x509_trust_list_iter_get_ca(trust_list, + &trust_iter, + &get_ca_crt) != + GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE) { + ret = + gnutls_x509_crt_export2(get_ca_crt, + GNUTLS_X509_FMT_PEM, + &get_datum); + if (ret < 0) + fail("gnutls_x509_crt_export2"); + + if (get_datum.size != ca.size || + memcmp(get_datum.data, ca.data, get_datum.size) != 0) { + fail( + "exported CA certificate %u vs. %u\n\n%s\n\nvs.\n\n%s", + get_datum.size, ca.size, + get_datum.data, ca.data); + } + + gnutls_x509_crt_deinit(get_ca_crt); + gnutls_free(get_datum.data); + + ++n_get_ca_crts; + } + + if (n_get_ca_crts != 1) + fail("gnutls_x509_trust_list_iter_get_ca: n_cas != 1"); + if (trust_iter != NULL) + fail("gnutls_x509_trust_list_iter_get_ca: iterator not NULL after iteration"); + + gnutls_x509_privkey_deinit(get_key); + for (i = 0; i < n_get_crts; i++) + gnutls_x509_crt_deinit(get_crts[i]); + gnutls_free(get_crts); + for (i = 0; i < list_size; i++) gnutls_x509_crt_deinit(list[i]); gnutls_certificate_free_credentials(x509_cred); -- 2.1.0 From nmav at gnutls.org Wed Sep 24 10:37:55 2014 From: nmav at gnutls.org (Nikos Mavrogiannopoulos) Date: Wed, 24 Sep 2014 10:37:55 +0200 Subject: [gnutls-devel] [PATCH] Check the credentials getter functions as part of the unit tests In-Reply-To: References: Message-ID: <1411547875.2495.3.camel@nomad.lan> On Tue, 2014-09-23 at 16:12 -0400, Armin Burgmeier wrote: > --- > tests/openpgp-auth.c | 47 ++++++++++++++++++++++ > tests/x509cert.c | 107 ++++++++++++++++++++++++++++++++++++++++++++++++--- > 2 files changed, 149 insertions(+), 5 deletions(-) Thank you. I've applied the complete patch set. regards, Nikos From citypw at gmail.com Wed Sep 24 16:30:34 2014 From: citypw at gmail.com (Shawn) Date: Wed, 24 Sep 2014 22:30:34 +0800 Subject: [gnutls-devel] [gnutls-help] gnutls 3.2.18 In-Reply-To: <1411041962.22024.2.camel@nomad.lan> References: <1411041962.22024.2.camel@nomad.lan> Message-ID: Can't download it from: ftp://ftp.gnutls.org/gcrypt/gnutls/v3.2/gnutls-3.2.18.tar.xz Plz check it out...Thanks! On Thu, Sep 18, 2014 at 8:06 PM, Nikos Mavrogiannopoulos wrote: > Hello, > I've just released gnutls 3.2.18. This is a bugfix release on the > current stable branch. > > * Version 3.2.18 (released 2014-09-18) > > ** libgnutls: Fixes in gnutls_x509_crt_set_dn() and friends to properly handle > strings with embedded spaces and escaped commas. > > ** libgnutls: Corrected gnutls_x509_crl_verify() which would always report > a CRL signature as invalid. Reported by Armin Burgmeier. > > ** libgnutls: Fixed issue with certificates being sanitized by gnutls prior > to signature verification. That resulted to certain non-DER compliant modifications > of valid certificates, being corrected by libtasn1's parser and restructured as > the original. Issue found and reported by Antti Karjalainen and Matti Kamunen from > Codenomicon. > > ** API and ABI modifications: > No changes since last version. > > > Getting the Software > ==================== > > GnuTLS may be downloaded directly from > . A list of GnuTLS mirrors can be > found at . > > Here are the XZ and LZIP compressed sources: > > ftp://ftp.gnutls.org/gcrypt/gnutls/v3.2/gnutls-3.2.18.tar.xz > ftp://ftp.gnutls.org/gcrypt/gnutls/v3.2/gnutls-3.2.18.tar.lz > > Here are OpenPGP detached signatures signed using key 0x96865171: > > ftp://ftp.gnutls.org/gcrypt/gnutls/v3.2/gnutls-3.2.18.tar.xz.sig > ftp://ftp.gnutls.org/gcrypt/gnutls/v3.2/gnutls-3.2.18.tar.lz.sig > > Note that it has been signed with my openpgp key: > pub 3104R/96865171 2008-05-04 [expires: 2028-04-29] > uid Nikos Mavrogiannopoulos gnutls.org> > uid Nikos Mavrogiannopoulos > gmail.com> > sub 2048R/9013B842 2008-05-04 [expires: 2018-05-02] > sub 2048R/1404A91D 2008-05-04 [expires: 2018-05-02] > > regards, > Nikos > > > > > _______________________________________________ > Gnutls-help mailing list > Gnutls-help at lists.gnutls.org > http://lists.gnupg.org/mailman/listinfo/gnutls-help -- GNU powered it... GPL protect it... God blessing it... regards Shawn From citypw at gmail.com Wed Sep 24 19:14:11 2014 From: citypw at gmail.com (Shawn) Date: Thu, 25 Sep 2014 01:14:11 +0800 Subject: [gnutls-devel] [gnutls-help] gnutls 3.2.18 In-Reply-To: References: <1411041962.22024.2.camel@nomad.lan> Message-ID: hey Mark, On Thu, Sep 25, 2014 at 1:03 AM, Mark Doliner wrote: > On Wed, Sep 24, 2014 at 7:30 AM, Shawn wrote: >> Can't download it from: >> ftp://ftp.gnutls.org/gcrypt/gnutls/v3.2/gnutls-3.2.18.tar.xz >> >> Plz check it out...Thanks! > > Hi Shawn. I was able to download from that URL just now. I suppose > it's possible someone fixed the problem since you sent your email. Are > you still unable to download? If so, can you describe the problem > you're having? > I'm still not able to download from above URL for now. wget would have some speed then totally down to the zero: ------------------------------------------------------------------------------------------------------------------------ --2014-09-25 01:12:10-- ftp://ftp.gnutls.org/gcrypt/gnutls/v3.2/gnutls-3.2.18.tar.xz => ?gnutls-3.2.18.tar.xz.1? Resolving ftp.gnutls.org (ftp.gnutls.org)... 217.69.76.55 Connecting to ftp.gnutls.org (ftp.gnutls.org)|217.69.76.55|:21... connected. Logging in as anonymous ... Logged in! ==> SYST ... done. ==> PWD ... done. ==> TYPE I ... done. ==> CWD (1) /gcrypt/gnutls/v3.2 ... done. ==> SIZE gnutls-3.2.18.tar.xz ... 5154476 ==> PASV ... done. ==> RETR gnutls-3.2.18.tar.xz ... done. Length: 5154476 (4.9M) (unauthoritative) 1% [> ] 71,000 --.-K/s eta 22m 6s ------------------------------------------------------------------------------------------------------------------------ I tried two different IPs but still got the same issue....Some mirrors are working fine, like this one: http://artfiles.org/gnupg.org/gnutls/v3.2/gnutls-3.2.18.tar.xz -- GNU powered it... GPL protect it... God blessing it... regards Shawn From mark at kingant.net Wed Sep 24 19:03:23 2014 From: mark at kingant.net (Mark Doliner) Date: Wed, 24 Sep 2014 10:03:23 -0700 Subject: [gnutls-devel] [gnutls-help] gnutls 3.2.18 In-Reply-To: References: <1411041962.22024.2.camel@nomad.lan> Message-ID: On Wed, Sep 24, 2014 at 7:30 AM, Shawn wrote: > Can't download it from: > ftp://ftp.gnutls.org/gcrypt/gnutls/v3.2/gnutls-3.2.18.tar.xz > > Plz check it out...Thanks! Hi Shawn. I was able to download from that URL just now. I suppose it's possible someone fixed the problem since you sent your email. Are you still unable to download? If so, can you describe the problem you're having? From nmav at gnutls.org Thu Sep 25 11:31:56 2014 From: nmav at gnutls.org (Nikos Mavrogiannopoulos) Date: Thu, 25 Sep 2014 11:31:56 +0200 Subject: [gnutls-devel] [gnutls-help] gnutls 3.2.18 In-Reply-To: References: <1411041962.22024.2.camel@nomad.lan> Message-ID: <1411637516.2494.11.camel@nomad.lan> On Thu, 2014-09-25 at 01:14 +0800, Shawn wrote: > hey Mark, > > On Thu, Sep 25, 2014 at 1:03 AM, Mark Doliner wrote: > > On Wed, Sep 24, 2014 at 7:30 AM, Shawn wrote: > >> Can't download it from: > >> ftp://ftp.gnutls.org/gcrypt/gnutls/v3.2/gnutls-3.2.18.tar.xz > >> > >> Plz check it out...Thanks! > > > > Hi Shawn. I was able to download from that URL just now. I suppose > > it's possible someone fixed the problem since you sent your email. Are > > you still unable to download? If so, can you describe the problem > > you're having? > > > I'm still not able to download from above URL for now. wget would have > some speed then totally down to the zero: That could be some firewall or routing issue between you and the gnupg server. You can use the available mirror list for alternative servers. regards, Nikos From nmav at gnutls.org Thu Sep 25 14:14:13 2014 From: nmav at gnutls.org (Nikos Mavrogiannopoulos) Date: Thu, 25 Sep 2014 14:14:13 +0200 Subject: [gnutls-devel] Symbol versioning in gnutls broken -> crashes In-Reply-To: References: <20140524065807.GA2250@downhill.g.la> <1410468974.3121.3.camel@nomad.lan> <20140912162227.GA5709@downhill.g.la> <1410546977.11023.8.camel@nomad.lan> <20140913060441.GA2429@downhill.g.la> Message-ID: <1411647253.24226.3.camel@nomad.lan> On Mon, 2014-09-15 at 15:49 +0200, Nikos Mavrogiannopoulos wrote: > On Mon, Sep 15, 2014 at 9:46 AM, Nikos Mavrogiannopoulos > wrote: > > I'm wondering whether there is some way to transition to a new ABI > > without breaking the old one. I'll try to see whether the ld script > > allows such move. > Ok, it seems that adding a new VERSION section with all the symbols in > the beginning of libgnutls.map, makes the default symbols to be the > new, but also exposes the old ones. So we can have a slow migration to > a new ABI, in the 3.4.0 release. However, That is not really > documented in [0], and I wonder whether we can rely on that. Unfortunately from what I could get from a brief thread in binutils, the only way to set a default symbol is through an explicit tag of the function. Thus my understanding is that we can't rely on that. Nevertheless, that would allow a program compiled in debian to work on other systems too. That doesn't sound ideal, but I think it is better than having completely incompatible versions around. What do you think? regards, Nikos From dev at cor0.com Thu Sep 25 14:51:46 2014 From: dev at cor0.com (dev) Date: Thu, 25 Sep 2014 08:51:46 -0400 (EDT) Subject: [gnutls-devel] [gnutls-help] gnutls 3.2.18 In-Reply-To: References: <1411041962.22024.2.camel@nomad.lan> Message-ID: <1505977686.21326.1411649506698.JavaMail.vpopmail@webmail2.networksolutionsemail.com> On September 24, 2014 at 10:30 AM Shawn wrote: > Can't download it from: > ftp://ftp.gnutls.org/gcrypt/gnutls/v3.2/gnutls-3.2.18.tar.xz > > Plz check it out...Thanks! wfm : node000 $ wget ftp://ftp.gnutls.org/gcrypt/gnutls/v3.2/gnutls-3.2.18.tar.xz --2014-09-25 12:50:08-- ftp://ftp.gnutls.org/gcrypt/gnutls/v3.2/gnutls-3.2.18.tar.xz => 'gnutls-3.2.18.tar.xz' Resolving ftp.gnutls.org... 217.69.76.55 Connecting to ftp.gnutls.org|217.69.76.55|:21... connected. Logging in as anonymous ... Logged in! ==> SYST ... done. ==> PWD ... done. ==> TYPE I ... done. ==> CWD (1) /gcrypt/gnutls/v3.2 ... done. ==> SIZE gnutls-3.2.18.tar.xz ... 5154476 ==> PASV ... done. ==> RETR gnutls-3.2.18.tar.xz ... done. Length: 5154476 (4.9M) (unauthoritative) 0K .... 100% 349K=14s 2014-09-25 12:50:25 (349 KB/s) - 'gnutls-3.2.18.tar.xz' saved [5154476] node000 $ /usr/local/ssl/bin/openssl dgst -sha256 gnutls-3.2.18.tar.xz SHA256(gnutls-3.2.18.tar.xz)= 4762afab5e1b9e829c5f53d2b00cd5e41d43fa6d035efcf239e3fe0459134d45 From armin at arbur.net Thu Sep 25 21:53:02 2014 From: armin at arbur.net (Armin Burgmeier) Date: Thu, 25 Sep 2014 15:53:02 -0400 Subject: [gnutls-devel] [PATCH] Check the credentials getter functions as part of the unit tests In-Reply-To: <1411547875.2495.3.camel@nomad.lan> References: <1411547875.2495.3.camel@nomad.lan> Message-ID: <1411674782.1339.13.camel@waverley> On Wed, 2014-09-24 at 10:37 +0200, Nikos Mavrogiannopoulos wrote: > On Tue, 2014-09-23 at 16:12 -0400, Armin Burgmeier wrote: > > --- > > tests/openpgp-auth.c | 47 ++++++++++++++++++++++ > > tests/x509cert.c | 107 ++++++++++++++++++++++++++++++++++++++++++++++++--- > > 2 files changed, 149 insertions(+), 5 deletions(-) > > Thank you. I've applied the complete patch set. Thanks! I suppose the ticket on savannah could then be closed as well. Armin From INVALID.NOREPLY at gnu.org Sat Sep 27 09:06:50 2014 From: INVALID.NOREPLY at gnu.org (Nikos Mavrogiannopoulos) Date: Sat, 27 Sep 2014 07:06:50 +0000 Subject: [gnutls-devel] [sr #108634] Getter functions for gnutls_certificate_credentials_t In-Reply-To: <20140907-200409.sv96363.42296@savannah.gnu.org> References: <20140818-164743.sv96363.52612@savannah.gnu.org> <20140825-203439.sv707.32318@savannah.gnu.org> <20140907-132239.sv707.3610@savannah.gnu.org> <20140907-200409.sv96363.42296@savannah.gnu.org> Message-ID: <20140927-100650.sv707.22938@savannah.gnu.org> Update of sr #108634 (project gnutls): Status: None => Done Open/Closed: Open => Closed _______________________________________________________ Reply to this item at: _______________________________________________ Message sent via/by Savannah http://savannah.gnu.org/ From ludo at gnu.org Tue Sep 30 13:24:13 2014 From: ludo at gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Date: Tue, 30 Sep 2014 13:24:13 +0200 Subject: [gnutls-devel] Guile patches committed In-Reply-To: <1411416782.5630.1.camel@nomad.lan> (Nikos Mavrogiannopoulos's message of "Mon, 22 Sep 2014 22:13:02 +0200") References: <87wq8vohpx.fsf@gnu.org> <1411405464.3469.6.camel@nomad.lan> <87k34vmv0b.fsf@gnu.org> <1411416782.5630.1.camel@nomad.lan> Message-ID: <87lhp1bbc2.fsf@gnu.org> Nikos Mavrogiannopoulos skribis: > If you checkout the web-pages branch you'll see the source code of the > web pages. I?ve now added the GnuTLS-Guile manual. Could you upload it? Thank you! Ludo?. From ludo at gnu.org Tue Sep 30 13:25:06 2014 From: ludo at gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Date: Tue, 30 Sep 2014 13:25:06 +0200 Subject: [gnutls-devel] Guile patches committed In-Reply-To: (Nikos Mavrogiannopoulos's message of "Tue, 23 Sep 2014 11:00:38 +0200") References: <87wq8vohpx.fsf@gnu.org> <1411405464.3469.6.camel@nomad.lan> <87k34vmv0b.fsf@gnu.org> Message-ID: <87h9zpbbal.fsf@gnu.org> Nikos Mavrogiannopoulos skribis: > On Mon, Sep 22, 2014 at 7:21 PM, Ludovic Court?s wrote: >>>> Just to let you know I've committed two patches for the Guile bindings: >>>> e9fc746 adds bindings for 'gnutls_server_name_set', and abcb456 restores >>>> a cross-reference in the manual. >>>> Nikos: could you port them to the stable branch (I'd rather let you do >>>> it than mess things up)? >>> Hi, >>> I've done the cherry pick. Please add or suggest some NEWS entry. >> Cool. What about this: > > I think there is some text missing here... Commit e9941db adds a NEWS entry. Could you cherry-pick it to the relevant branch(es)? Thanks, Ludo?. From nmav at gnutls.org Tue Sep 30 20:54:37 2014 From: nmav at gnutls.org (Nikos Mavrogiannopoulos) Date: Tue, 30 Sep 2014 20:54:37 +0200 Subject: [gnutls-devel] Guile patches committed In-Reply-To: <87lhp1bbc2.fsf@gnu.org> References: <87wq8vohpx.fsf@gnu.org> <1411405464.3469.6.camel@nomad.lan> <87k34vmv0b.fsf@gnu.org> <1411416782.5630.1.camel@nomad.lan> <87lhp1bbc2.fsf@gnu.org> Message-ID: <1412103277.2908.1.camel@nomad.lan> On Tue, 2014-09-30 at 13:24 +0200, Ludovic Court?s wrote: > Nikos Mavrogiannopoulos skribis: > > > If you checkout the web-pages branch you'll see the source code of the > > web pages. > > I?ve now added the GnuTLS-Guile manual. Could you upload it? Hi, I've regenerated the html and uploaded (it's automatically done every few hours) it but there is something wrong with the CSS (you can see the style difference between the two manuals). I think using --css-include=texinfo.css (the one in doc) would suffice. regards, Nikos From nmav at gnutls.org Tue Sep 30 20:57:21 2014 From: nmav at gnutls.org (Nikos Mavrogiannopoulos) Date: Tue, 30 Sep 2014 20:57:21 +0200 Subject: [gnutls-devel] Guile patches committed In-Reply-To: <87h9zpbbal.fsf@gnu.org> References: <87wq8vohpx.fsf@gnu.org> <1411405464.3469.6.camel@nomad.lan> <87k34vmv0b.fsf@gnu.org> <87h9zpbbal.fsf@gnu.org> Message-ID: <1412103441.2908.2.camel@nomad.lan> On Tue, 2014-09-30 at 13:25 +0200, Ludovic Court?s wrote: > > I think there is some text missing here... > > Commit e9941db adds a NEWS entry. Could you cherry-pick it to the > relevant branch(es)? Done, thanks.