From ludo at gnu.org Wed Aug 1 23:35:19 2007 From: ludo at gnu.org (Ludovic =?iso-8859-1?Q?Court=E8s?=) Date: Wed, 01 Aug 2007 23:35:19 +0200 Subject: [gnutls-dev] On key usage flags Message-ID: <87ps27vsyw.fsf@chbouib.org> Hi, Recently, I tried to use OpenPGP-based authentication with the `RSA_NULL_MD5' cipher suite (i.e., no encryption). To that end, I generated (with GnuPG) an RSA OpenPGP key pair, and wrote a test program that specifies the right kx/cipher/mac priorities. Unfortunately, that doesn't work, because the generated OpenPGP key doesn't have the "encryption" key usage flag, which means that `_gnutls_selected_cert_supported_kx ()' will reject it while looking for a cipher suite. I don't know about X.509, but OpenPGP key usage flags are informative rather than authoritative. Thus, I'm wondering whether we should really systematically pay attention to them. Providing the option to honor them (e.g., through user-definable hooks) may be wise, but enforcing it doesn't feel right. In addition, GPG doesn't really permit usage flags to be chosen, making it hard to create a suitable key. What do you think? Thanks, Ludovic. From ludo at gnu.org Wed Aug 1 23:25:02 2007 From: ludo at gnu.org (Ludovic =?iso-8859-1?Q?Court=E8s?=) Date: Wed, 01 Aug 2007 23:25:02 +0200 Subject: [gnutls-dev] [PATCH] Certificate selection fixes Message-ID: <874pjjymkx.fsf@chbouib.org> A non-text attachment was scrubbed... Name: 0011-Fixed-erroneous-checks-and-sloppy-return-values-in-c.patch Type: text/x-patch Size: 1449 bytes Desc: The patch Url : /pipermail/attachments/20070801/19e7f1ee/attachment.bin From simon at josefsson.org Thu Aug 2 09:36:50 2007 From: simon at josefsson.org (Simon Josefsson) Date: Thu, 02 Aug 2007 09:36:50 +0200 Subject: [gnutls-dev] [PATCH] Certificate selection fixes In-Reply-To: <874pjjymkx.fsf@chbouib.org> ("Ludovic =?iso-8859-1?Q?Court?= =?iso-8859-1?Q?=E8s=22's?= message of "Wed, 01 Aug 2007 23:25:02 +0200") References: <874pjjymkx.fsf@chbouib.org> Message-ID: <87zm1ae6b1.fsf@mocca.josefsson.org> ludo at gnu.org (Ludovic Court?s) writes: > Hi! > > Glad to see new messages on this list. :-) > > The attached patch fixes sloppy checks and error codes in the > certification selection routines. Thanks. For reference, how did you trigger or found this problem? Bonus points if you answer in the form of a patch with a NEWS entry.. ;) /Simon From ludo at gnu.org Thu Aug 2 10:05:43 2007 From: ludo at gnu.org (Ludovic =?iso-8859-1?Q?Court=E8s?=) Date: Thu, 02 Aug 2007 10:05:43 +0200 Subject: [gnutls-dev] [PATCH] Certificate selection fixes References: <874pjjymkx.fsf@chbouib.org> <87zm1ae6b1.fsf@mocca.josefsson.org> Message-ID: <87r6mmtl7s.fsf@chbouib.org> A non-text attachment was scrubbed... Name: 0012-Updated-NEWS.patch Type: text/x-patch Size: 826 bytes Desc: Update `NEWS' Url : /pipermail/attachments/20070802/91ebd064/attachment.bin From simon at josefsson.org Thu Aug 2 20:41:13 2007 From: simon at josefsson.org (Simon Josefsson) Date: Thu, 02 Aug 2007 20:41:13 +0200 Subject: [gnutls-dev] [PATCH] Certificate selection fixes In-Reply-To: <87r6mmtl7s.fsf@chbouib.org> ("Ludovic =?iso-8859-1?Q?Court?= =?iso-8859-1?Q?=E8s=22's?= message of "Thu, 02 Aug 2007 10:05:43 +0200") References: <874pjjymkx.fsf@chbouib.org> <87zm1ae6b1.fsf@mocca.josefsson.org> <87r6mmtl7s.fsf@chbouib.org> Message-ID: <87y7gt4w52.fsf@mocca.josefsson.org> ludo at gnu.org (Ludovic Court?s) writes: > Hi Simon, > > Simon Josefsson writes: > >> Thanks. For reference, how did you trigger or found this problem? > > While trying to understand why I could not get the `RSA_NULL_MD5' cipher > suite to work. At some point I was getting misleading error messages > (such as "Decryption failed") so I started browsing that part of the > code. Ok. The PKCS#11 branch touches this code slightly, but we'll have to adapt that when it is mered. >> Bonus points if you answer in the form of a patch with a NEWS entry.. ;) > > See attached file. I hope it'll be good enough for me to get the bonus > point. :-) Bonus-point granted. :) Installed. /Simon From ludo at gnu.org Fri Aug 3 15:18:36 2007 From: ludo at gnu.org (Ludovic =?iso-8859-1?Q?Court=E8s?=) Date: Fri, 03 Aug 2007 15:18:36 +0200 Subject: [gnutls-dev] Preparing for the next stable release References: <87d4za50lj.fsf@mocca.josefsson.org> <878x9y4zsm.fsf@mocca.josefsson.org> <873b06k20c.fsf@chbouib.org> <87sl8525z0.fsf@mocca.josefsson.org> <87k5thb3oh.fsf@chbouib.org> <87lkdtq0e3.fsf@mocca.josefsson.org> <87lkdr3qib.fsf@chbouib.org> <87tzse1qhv.fsf@mocca.josefsson.org> <87ps321pdm.fsf@mocca.josefsson.org> <87hcod1s9r.fsf@chbouib.org> Message-ID: <87643wlpsj.fsf@chbouib.org> Hey, ludo at gnu.org (Ludovic Court?s) writes: >>From 7b3b8986de3f0d1ed281e8a93f1db74edd3cf118 Mon Sep 17 00:00:00 2001 > From: =?utf-8?q?Ludovic=20Court=C3=A8s?= > Date: Mon, 9 Jul 2007 17:58:17 +0200 > Subject: [PATCH] Capitalized subsection titles. > > * doc/gnutls.texi: Capitalized subsection titles. > > * doc/signatures.texi: Likewise. > --- > doc/gnutls.texi | 82 +++++++++++++++++++++++++------------------------- > doc/signatures.texi | 4 +- > 2 files changed, 43 insertions(+), 43 deletions(-) I think this patch wasn't applied (it shows up in "git-diff origin" here, but not in "git-whatchanged origin"). Thanks, Ludovic. From ludo at gnu.org Fri Aug 3 15:35:13 2007 From: ludo at gnu.org (Ludovic =?iso-8859-1?Q?Court=E8s?=) Date: Fri, 03 Aug 2007 15:35:13 +0200 Subject: [gnutls-dev] [PATCH] Fix CPPFLAGS for Guile code and documentation Message-ID: <87lkcskage.fsf@chbouib.org> A non-text attachment was scrubbed... Name: 0013-Fixed-CPPFLAGS-for-Guile-code-and-documentation.patch Type: text/x-patch Size: 2275 bytes Desc: The patch Url : /pipermail/attachments/20070803/0daa0ccb/attachment.bin From stef-list at memberwebs.com Fri Aug 3 17:16:07 2007 From: stef-list at memberwebs.com (Stef Walter) Date: Fri, 3 Aug 2007 15:16:07 +0000 (UTC) Subject: [gnutls-dev] Building gnutls HEAD Message-ID: <20070803151606.BF46FD4C17@mx.npubs.com> I've been trying to build gnutls HEAD from git but have been frustrated at each turn. After finally figuring out the right sequence of nasty auto* commands to run [1], I was greeted with these. Any ideas on what I did wrong? Cheers, Stef In file included from version-etc.h:24, from version-etc.c:23: ../lgl/stdio.h:31:15: error: #include_next expects "FILENAME" or ../lgl/stdio.h:39:7: error: operator '&&' has no left operand ../lgl/stdio.h:94:5: error: #if with no expression ../lgl/stdio.h:109:5: error: #if with no expression ../lgl/stdio.h:124:5: error: #if with no expression ../lgl/stdio.h:147:5: error: #if with no expression ../lgl/stdio.h:162:5: error: #if with no expression ../lgl/stdio.h:178:5: error: #if with no expression ../lgl/stdio.h:194:5: error: #if with no expression ../lgl/stdio.h:209:5: error: #if with no expression ../lgl/stdio.h:224:5: error: #if with no expression ../lgl/stdio.h:241:5: error: #if with no expression ../lgl/stdio.h:257:6: error: operator '&&' has no left operand ../lgl/stdio.h:279:5: error: #if with no expression ../lgl/stdio.h:293:6: error: operator '&&' has no left operand ../lgl/stdio.h:315:5: error: #if with no expression In file included from version-etc.c:23: version-etc.h:28: error: expected ')' before '*' token version-etc.h:32: error: expected ')' before '*' token In file included from /usr/include/sys/types.h:133, from /usr/include/stdlib.h:438, from version-etc.c:27: ../lgl/time.h:29:16: error: #include_next expects "FILENAME" or In file included from /usr/include/sys/select.h:44, from /usr/include/sys/types.h:220, from /usr/include/stdlib.h:438, from version-etc.c:27: ../lgl/time.h:29:16: error: #include_next expects "FILENAME" or version-etc.c:41: error: expected ')' before '*' token version-etc.c:165: error: expected ')' before '*' token make[3]: *** [version-etc.lo] Error 1 make[3]: Leaving directory `/data/projects/gnutls/gl' make[2]: *** [all] Error 2 make[2]: Leaving directory `/data/projects/gnutls/gl' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/data/projects/gnutls' make: *** [all] Error 2 [1] The stuff here seems to be out of date: http://cvs.gnupg.org/cgi-bin/viewcvs.cgi/gnutls/doc/README.CVS?rev=2.27&root=GNU+TLS+Library&view=auto From ludo at gnu.org Wed Aug 8 11:11:53 2007 From: ludo at gnu.org (Ludovic =?iso-8859-1?Q?Court=E8s?=) Date: Wed, 08 Aug 2007 11:11:53 +0200 Subject: [gnutls-dev] Building gnutls HEAD References: <20070803151606.BF46FD4C17@mx.npubs.com> Message-ID: <878x8m1jc6.fsf@chbouib.org> Hi, Stef Walter writes: > In file included from version-etc.h:24, > from version-etc.c:23: > ../lgl/stdio.h:31:15: error: #include_next expects "FILENAME" or > ../lgl/stdio.h:39:7: error: operator '&&' has no left operand > ../lgl/stdio.h:94:5: error: #if with no expression Can you show us these lines? There must be some obvious configuration trick that failed. Thanks, Ludovic. From simon at josefsson.org Wed Aug 8 11:38:00 2007 From: simon at josefsson.org (Simon Josefsson) Date: Wed, 08 Aug 2007 11:38:00 +0200 Subject: [gnutls-dev] GnuTLS 1.7.16 Message-ID: <87y7gmpds7.fsf@mocca.josefsson.org> A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 419 bytes Desc: not available Url : /pipermail/attachments/20070808/45cc635c/attachment.pgp From simon at josefsson.org Wed Aug 8 11:43:30 2007 From: simon at josefsson.org (Simon Josefsson) Date: Wed, 08 Aug 2007 11:43:30 +0200 Subject: [gnutls-dev] GnuTLS 1.7.16 In-Reply-To: <87y7gmpds7.fsf@mocca.josefsson.org> (Simon Josefsson's message of "Wed, 08 Aug 2007 11:38:00 +0200") References: <87y7gmpds7.fsf@mocca.josefsson.org> Message-ID: <87tzrapdj1.fsf@mocca.josefsson.org> Simon Josefsson writes: > * Check copyright papers for everyone who contributed during the 1.7.x > phase (I opportunistically installed some fixes after confirming with > authors that they were sending copyright assignments, although I have > not verified that the assignment were actually received). > > - I've confirmed that two contributor now has signed paper, I think > there is one still left that I need to confirm. FYI, as a consequence of the delays because of this, I've decided to never install any patches until FSF has confirmed that they have received papers from contributors. If it wasn't because of this issue, I'd probably had release the next major release already, without the signing-callback API because I never seem to have found to integrate that work. But until the legal issues are solved, the window is still open to get the sign-callback API integrated. /Simon From simon at josefsson.org Wed Aug 8 11:46:30 2007 From: simon at josefsson.org (Simon Josefsson) Date: Wed, 08 Aug 2007 11:46:30 +0200 Subject: [gnutls-dev] [PATCH] Fix CPPFLAGS for Guile code and documentation In-Reply-To: <87lkcskage.fsf@chbouib.org> ("Ludovic =?iso-8859-1?Q?Court?= =?iso-8859-1?Q?=E8s=22's?= message of "Fri, 03 Aug 2007 15:35:13 +0200") References: <87lkcskage.fsf@chbouib.org> Message-ID: <87ps1ypde1.fsf@mocca.josefsson.org> ludo at gnu.org (Ludovic Court?s) writes: > Hi, > > While compiling on a pristine machine (where GnuTLS headers were not > installed), I noticed that the CPPFLAGS were wrong for the Guile code > and documentation extraction. The attached patch fixes it. Applied, thanks! Sorry it didn't go into 1.7.16, I hope to do a quick 1.7.17 release later this week. > I'm not sure that deserves a `NEWS' entry, does it? Can't hurt, I added a small one. /Simon From simon at josefsson.org Wed Aug 8 11:50:37 2007 From: simon at josefsson.org (Simon Josefsson) Date: Wed, 08 Aug 2007 11:50:37 +0200 Subject: [gnutls-dev] Preparing for the next stable release In-Reply-To: <87643wlpsj.fsf@chbouib.org> ("Ludovic =?iso-8859-1?Q?Court?= =?iso-8859-1?Q?=E8s=22's?= message of "Fri, 03 Aug 2007 15:18:36 +0200") References: <87d4za50lj.fsf@mocca.josefsson.org> <878x9y4zsm.fsf@mocca.josefsson.org> <873b06k20c.fsf@chbouib.org> <87sl8525z0.fsf@mocca.josefsson.org> <87k5thb3oh.fsf@chbouib.org> <87lkdtq0e3.fsf@mocca.josefsson.org> <87lkdr3qib.fsf@chbouib.org> <87tzse1qhv.fsf@mocca.josefsson.org> <87ps321pdm.fsf@mocca.josefsson.org> <87hcod1s9r.fsf@chbouib.org> <87643wlpsj.fsf@chbouib.org> Message-ID: <87lkcmpd76.fsf@mocca.josefsson.org> ludo at gnu.org (Ludovic Court?s) writes: > Hey, > > ludo at gnu.org (Ludovic Court?s) writes: > >>>From 7b3b8986de3f0d1ed281e8a93f1db74edd3cf118 Mon Sep 17 00:00:00 2001 >> From: =?utf-8?q?Ludovic=20Court=C3=A8s?= >> Date: Mon, 9 Jul 2007 17:58:17 +0200 >> Subject: [PATCH] Capitalized subsection titles. >> >> * doc/gnutls.texi: Capitalized subsection titles. >> >> * doc/signatures.texi: Likewise. >> --- >> doc/gnutls.texi | 82 +++++++++++++++++++++++++------------------------- >> doc/signatures.texi | 4 +- >> 2 files changed, 43 insertions(+), 43 deletions(-) > > I think this patch wasn't applied (it shows up in "git-diff origin" > here, but not in "git-whatchanged origin"). Hi! Strange, I must have done something wrong when installing it. I ran git-am on it now, and it applied fine. Thanks for noticing it! Regards, Simon From simon at josefsson.org Wed Aug 8 11:33:51 2007 From: simon at josefsson.org (Simon Josefsson) Date: Wed, 08 Aug 2007 11:33:51 +0200 Subject: [gnutls-dev] Building gnutls HEAD In-Reply-To: <878x8m1jc6.fsf@chbouib.org> ("Ludovic =?iso-8859-1?Q?Court?= =?iso-8859-1?Q?=E8s=22's?= message of "Wed, 08 Aug 2007 11:11:53 +0200") References: <20070803151606.BF46FD4C17@mx.npubs.com> <878x8m1jc6.fsf@chbouib.org> Message-ID: <873ayuqsjk.fsf@mocca.josefsson.org> ludo at gnu.org (Ludovic Court?s) writes: > Hi, > > Stef Walter writes: > >> In file included from version-etc.h:24, >> from version-etc.c:23: >> ../lgl/stdio.h:31:15: error: #include_next expects "FILENAME" or >> ../lgl/stdio.h:39:7: error: operator '&&' has no left operand >> ../lgl/stdio.h:94:5: error: #if with no expression > > Can you show us these lines? There must be some obvious configuration > trick that failed. I agree; some autoconf check must have failed. Especially if one of the daily snapshots work? The recommended way to run the various auto* tools is to run GNU make at a fresh git checkout. It invokes autoreconf --install, see 'maint-cfg.mk' in the top-level directory. Stef Walter writes: > [1] The stuff here seems to be out of date: > http://cvs.gnupg.org/cgi-bin/viewcvs.cgi/gnutls/doc/README.CVS?rev=2.27&root=GNU+TLS+Library&view=auto GnuTLS isn't maintained in CVS any more, see http://git.josefsson.org/ or http://repo.or.cz/w/gnutls.git. The former is rsync'ed against my local development tree, the latter is synced manually by me doing 'git-push --all pub'. /Simon From simon at josefsson.org Fri Aug 10 13:53:59 2007 From: simon at josefsson.org (Simon Josefsson) Date: Fri, 10 Aug 2007 13:53:59 +0200 Subject: [gnutls-dev] External signing API Message-ID: <87y7gjppuw.fsf@mocca.josefsson.org> I'm now finally working on integrating the external signing API into the main branch. Here is what I've came up with API-wise. The names are intentionally slightly different from any other existing namespace since this is an experimental interface. Do you need any other parameters? /* External signing callback. Experimental. */ typedef int (*gnutls_sign_func) (gnutls_session_t session, void *userdata, gnutls_certificate_type_t cert_type, gnutls_datum_t cert, const gnutls_datum_t hash, gnutls_datum_t * signature); void gnutls_sign_callback_set (gnutls_session_t session, gnutls_sign_func sign_func, void *userdata); Thanks, Simon From alon.barlev at gmail.com Fri Aug 10 14:12:31 2007 From: alon.barlev at gmail.com (Alon Bar-Lev) Date: Fri, 10 Aug 2007 15:12:31 +0300 Subject: [gnutls-dev] External signing API In-Reply-To: <87y7gjppuw.fsf@mocca.josefsson.org> References: <87y7gjppuw.fsf@mocca.josefsson.org> Message-ID: <9e0cf0bf0708100512v1227820bk20d49c64e3a75d2@mail.gmail.com> Hi! You need a way get the userdata (gnutls_sign_callback_get). I guess integrating between certificate and private key to a single object will take time... But it will be the simplest solution as they are the same entity. Please also add something like: #define GNUTLS_E_LIBEXTESION_DEFINED_BASE -2000 #define GNUTLS_E_USER_DEFINED_BASE -3000 So that external library/user may define its own set of codes. Best Regards, Alon Bar-Lev. On 8/10/07, Simon Josefsson wrote: > I'm now finally working on integrating the external signing API into the > main branch. Here is what I've came up with API-wise. The names are > intentionally slightly different from any other existing namespace since > this is an experimental interface. Do you need any other parameters? > > /* External signing callback. Experimental. */ > typedef int (*gnutls_sign_func) (gnutls_session_t session, > void *userdata, > gnutls_certificate_type_t cert_type, > gnutls_datum_t cert, > const gnutls_datum_t hash, > gnutls_datum_t * signature); > > void gnutls_sign_callback_set (gnutls_session_t session, > gnutls_sign_func sign_func, > void *userdata); > > Thanks, > Simon > > _______________________________________________ > Gnutls-dev mailing list > Gnutls-dev at gnupg.org > http://lists.gnupg.org/mailman/listinfo/gnutls-dev > From simon at josefsson.org Fri Aug 10 15:41:28 2007 From: simon at josefsson.org (Simon Josefsson) Date: Fri, 10 Aug 2007 15:41:28 +0200 Subject: [gnutls-dev] External signing API In-Reply-To: <87y7gjppuw.fsf@mocca.josefsson.org> (Simon Josefsson's message of "Fri, 10 Aug 2007 13:53:59 +0200") References: <87y7gjppuw.fsf@mocca.josefsson.org> Message-ID: <87lkcjpkvr.fsf@mocca.josefsson.org> The entire patch for the external sign callback, now applied to the trunk, is as follows. It is not very large, so I'd thought I'd post it. It include a self-test. Please review. /Simon commit 4431c4369db575dc8ecd8ec3622bc2dfc9bee725 Author: Simon Josefsson Date: Fri Aug 10 15:20:40 2007 +0200 External signing callback interface. * includes/gnutls/gnutls.h.in (gnutls_sign_func): New type. (gnutls_sign_callback_set): New function. * includes/gnutls/x509.h (gnutls_x509_privkey_sign_hash): New function. * lib/gnutls_x509.c (gnutls_certificate_set_x509_key_mem): Handle NULL key. Doc fix. * lib/gnutls_sig.c (_gnutls_tls_sign_hdata): Pass session to _gnutls_tls_sign. (_gnutls_tls_sign_params): Likewise. (_gnutls_tls_sign): Add new parameter 'session'. Call sign callback if appropriate. (gnutls_sign_callback_set): New function. * lib/gnutls_x509.c (read_key_mem): Support a NULL key. * lib/gnutls_int.h (internals_st): Add sign_func, sign_func_userdata. * lib/auth_dhe.c (gen_dhe_server_kx): Use length of certificate list to decide wheter to sign, not presence of private key. * lib/auth_cert.c (_gnutls_gen_cert_client_cert_vrfy): Likewise. * lib/auth_rsa_export.c (gen_rsa_export_server_kx): Likewise. * lib/auth_cert.c(_gnutls_get_selected_cert): Don't require that private key is present. * lib/auth_rsa_export.c (gen_rsa_export_server_kx): Don't check key size when key is not present, assume it is > 512 bits. * lib/x509/privkey.c (gnutls_x509_privkey_sign_hash): New function. * tests/Makefile.am: Add x509signself. diff --git a/NEWS b/NEWS index 908da11..9f39fd1 100644 --- a/NEWS +++ b/NEWS @@ -5,8 +5,14 @@ See the end for copying conditions. * Version 1.7.17 (unreleased) +** New functions to perform external signing. +Set the signing callback function (of the gnutls_sign_func prototype) +using gnutls_sign_callback_set. In the callback, you may find the new +function gnutls_x509_privkey_sign_hash useful. + ** New self test of client and server authenticated X.509 TLS sessions. -See tests/x509self.c. +See tests/x509self.c and tests/x509signself.c. The latter also tests +the new external signing callback interface. ** gnutls_set_default_priority now disable TLS 1.2 by default. The RFC is not released yet, and we're approaching a major release so @@ -24,7 +30,9 @@ Thanks to Jakub Bogusz and Daniel Nylander . ** API and ABI modifications: -No changes since last version. +gnutls_sign_func: ADD, new type for sign callback. +gnutls_sign_callback_set: ADD, new function to set sign callback. +gnutls_x509_privkey_sign_hash: ADD, new function useful in sign callback. * Version 1.7.16 (released 2007-08-07) diff --git a/includes/gnutls/gnutls.h.in b/includes/gnutls/gnutls.h.in index 4071a10..8f1e364 100644 --- a/includes/gnutls/gnutls.h.in +++ b/includes/gnutls/gnutls.h.in @@ -703,7 +703,6 @@ extern "C" gnutls_x509_crl_t * crl_list, int crl_list_size); - /* global state functions */ int gnutls_global_init (void); @@ -1048,6 +1047,18 @@ extern "C" /* X509PKI */ + /* External signing callback. Experimental. */ + typedef int (*gnutls_sign_func) (gnutls_session_t session, + void *userdata, + gnutls_certificate_type_t cert_type, + gnutls_datum_t cert, + const gnutls_datum_t hash, + gnutls_datum_t * signature); + + void gnutls_sign_callback_set (gnutls_session_t session, + gnutls_sign_func sign_func, + void *userdata); + /* These are set on the credentials structure. */ void gnutls_certificate_client_set_retrieve_function diff --git a/includes/gnutls/x509.h b/includes/gnutls/x509.h index 8f570df..8357dc2 100644 --- a/includes/gnutls/x509.h +++ b/includes/gnutls/x509.h @@ -605,6 +605,10 @@ extern "C" const gnutls_datum_t * data, const gnutls_datum_t * signature); + int gnutls_x509_privkey_sign_hash (gnutls_x509_privkey_t key, + const gnutls_datum_t hash, + gnutls_datum_t *signature); + /* Certificate request stuff. */ diff --git a/lib/auth_cert.c b/lib/auth_cert.c index f0cb427..54b4a50 100644 --- a/lib/auth_cert.c +++ b/lib/auth_cert.c @@ -1307,7 +1307,7 @@ _gnutls_gen_cert_client_cert_vrfy (gnutls_session_t session, opaque ** data) return ret; } - if (apr_pkey != NULL) + if (apr_cert_list_length > 0) { if ((ret = _gnutls_tls_sign_hdata (session, @@ -1483,8 +1483,7 @@ _gnutls_get_selected_cert (gnutls_session_t session, *apr_pkey = session->internals.selected_key; *apr_cert_list_length = session->internals.selected_cert_list_length; - if (*apr_cert_list_length == 0 || *apr_pkey == NULL || - *apr_cert_list == NULL) + if (*apr_cert_list_length == 0 || *apr_cert_list == NULL) { gnutls_assert (); return GNUTLS_E_INSUFFICIENT_CREDENTIALS; diff --git a/lib/auth_dhe.c b/lib/auth_dhe.c index c9ff9f5..6cf658a 100644 --- a/lib/auth_dhe.c +++ b/lib/auth_dhe.c @@ -145,7 +145,7 @@ gen_dhe_server_kx (gnutls_session_t session, opaque ** data) ddata.data = *data; ddata.size = data_size; - if (apr_pkey != NULL) + if (apr_cert_list_length > 0) { if ((ret = _gnutls_tls_sign_params (session, &apr_cert_list[0], diff --git a/lib/auth_rsa_export.c b/lib/auth_rsa_export.c index a16ed17..a1b867a 100644 --- a/lib/auth_rsa_export.c +++ b/lib/auth_rsa_export.c @@ -100,7 +100,7 @@ gen_rsa_export_server_kx (gnutls_session_t session, opaque ** data) /* abort sending this message if we have a certificate * of 512 bits or less. */ - if (_gnutls_mpi_get_nbits (apr_pkey->params[0]) <= 512) + if (apr_pkey && _gnutls_mpi_get_nbits (apr_pkey->params[0]) <= 512) { gnutls_assert (); return GNUTLS_E_INT_RET_0; @@ -153,7 +153,7 @@ gen_rsa_export_server_kx (gnutls_session_t session, opaque ** data) ddata.data = *data; ddata.size = data_size; - if (apr_pkey != NULL) + if (apr_cert_list_length > 0) { if ((ret = _gnutls_tls_sign_params (session, &apr_cert_list[0], diff --git a/lib/gnutls_int.h b/lib/gnutls_int.h index b9a9dcd..6f01c96 100644 --- a/lib/gnutls_int.h +++ b/lib/gnutls_int.h @@ -627,6 +627,12 @@ typedef struct */ int errnum; + /* Function used to perform public-key signing operation during + handshake. Used by gnutls_sig.c:_gnutls_tls_sign(), see also + gnutls_sign_callback_set(). */ + gnutls_sign_func sign_func; + void *sign_func_userdata; + /* If you add anything here, check _gnutls_handshake_internal_state_clear(). */ } internals_st; diff --git a/lib/gnutls_sig.c b/lib/gnutls_sig.c index 31c845c..31db1cf 100644 --- a/lib/gnutls_sig.c +++ b/lib/gnutls_sig.c @@ -37,10 +37,11 @@ #include #include -static - int _gnutls_tls_sign (gnutls_cert * cert, gnutls_privkey * pkey, - const gnutls_datum_t * hash_concat, - gnutls_datum_t * signature); +static int +_gnutls_tls_sign (gnutls_session_t session, + gnutls_cert * cert, gnutls_privkey * pkey, + const gnutls_datum_t * hash_concat, + gnutls_datum_t * signature); /* Generates a signature of all the previous sent packets in the @@ -111,7 +112,7 @@ _gnutls_tls_sign_hdata (gnutls_session_t session, gnutls_assert (); return GNUTLS_E_INTERNAL_ERROR; } - ret = _gnutls_tls_sign (cert, pkey, &dconcat, signature); + ret = _gnutls_tls_sign (session, cert, pkey, &dconcat, signature); if (ret < 0) { gnutls_assert (); @@ -202,7 +203,7 @@ _gnutls_tls_sign_params (gnutls_session_t session, gnutls_cert * cert, _gnutls_hash_deinit (td_sha, NULL); return GNUTLS_E_INTERNAL_ERROR; } - ret = _gnutls_tls_sign (cert, pkey, &dconcat, signature); + ret = _gnutls_tls_sign (session, cert, pkey, &dconcat, signature); if (ret < 0) { gnutls_assert (); @@ -257,7 +258,8 @@ _gnutls_sign (gnutls_pk_algorithm_t algo, mpi_t * params, * it supports signing. */ static int -_gnutls_tls_sign (gnutls_cert * cert, gnutls_privkey * pkey, +_gnutls_tls_sign (gnutls_session_t session, + gnutls_cert * cert, gnutls_privkey * pkey, const gnutls_datum_t * hash_concat, gnutls_datum_t * signature) { @@ -273,11 +275,49 @@ _gnutls_tls_sign (gnutls_cert * cert, gnutls_privkey * pkey, return GNUTLS_E_KEY_USAGE_VIOLATION; } + /* External signing. */ + if (!pkey || pkey->params_size == 0) + { + if (!session->internals.sign_func) + return GNUTLS_E_INSUFFICIENT_CREDENTIALS; + + return (*session->internals.sign_func) + (session, session->internals.sign_func_userdata, + cert->cert_type, cert->raw, + *hash_concat, signature); + } + return _gnutls_sign (pkey->pk_algorithm, pkey->params, pkey->params_size, hash_concat, signature); - } +/** + * gnutls_sign_callback_set: + * @session: + * @sign_func: + * @userdata: + * + * Set the callback function. The function must have this prototype: + * + * typedef int (*gnutls_sign_func) (gnutls_session_t session, + * void *userdata, + * gnutls_certificate_type_t cert_type, + * gnutls_datum_t cert, + * const gnutls_datum_t hash, + * gnutls_datum_t * signature); + * + * The @userdata parameter is passed to the @sign_func verbatim, and + * can be used to store application-specific data needed in the + * callback function. + **/ +void +gnutls_sign_callback_set (gnutls_session_t session, + gnutls_sign_func sign_func, + void *userdata) +{ + session->internals.sign_func = sign_func; + session->internals.sign_func_userdata = userdata; +} static int _gnutls_verify_sig (gnutls_cert * cert, diff --git a/lib/gnutls_x509.c b/lib/gnutls_x509.c index d4b66ac..352f002 100644 --- a/lib/gnutls_x509.c +++ b/lib/gnutls_x509.c @@ -702,9 +702,9 @@ _gnutls_x509_raw_privkey_to_gkey (gnutls_privkey * privkey, return 0; } -/* Reads a PEM encoded PKCS-1 RSA private key from memory - * 2002-01-26: Added ability to read DSA keys. - * type indicates the certificate format. +/* Reads a PEM encoded PKCS-1 RSA/DSA private key from memory. Type + * indicates the certificate format. KEY can be NULL, to indicate + * that GnuTLS doesn't know the private key. */ static int read_key_mem (gnutls_certificate_credentials_t res, @@ -724,16 +724,21 @@ read_key_mem (gnutls_certificate_credentials_t res, return GNUTLS_E_MEMORY_ERROR; } - tmp.data = (opaque *) key; - tmp.size = key_size; - - ret = - _gnutls_x509_raw_privkey_to_gkey (&res->pkey[res->ncerts], &tmp, type); - if (ret < 0) + if (key) { - gnutls_assert (); - return ret; + tmp.data = (opaque *) key; + tmp.size = key_size; + + ret = + _gnutls_x509_raw_privkey_to_gkey (&res->pkey[res->ncerts], &tmp, type); + if (ret < 0) + { + gnutls_assert (); + return ret; + } } + else + memset (&res->pkey[res->ncerts], 0, sizeof (gnutls_privkey)); return 0; } @@ -790,7 +795,7 @@ read_key_file (gnutls_certificate_credentials_t res, * gnutls_certificate_set_x509_key_mem - Used to set keys in a gnutls_certificate_credentials_t structure * @res: is an #gnutls_certificate_credentials_t structure. * @cert: contains a certificate list (path) for the specified private key - * @key: is the private key + * @key: is the private key, or %NULL * @type: is PEM or DER * * This function sets a certificate/private key pair in the @@ -811,6 +816,9 @@ read_key_file (gnutls_certificate_credentials_t res, * If the certificate and the private key are given in PEM encoding * then the strings that hold their values must be null terminated. * + * The @key may be %NULL if you are using a sign callback, see + * gnutls_sign_callback_set(). + * **/ int gnutls_certificate_set_x509_key_mem (gnutls_certificate_credentials_t @@ -822,7 +830,8 @@ gnutls_certificate_set_x509_key_mem (gnutls_certificate_credentials_t /* this should be first */ - if ((ret = read_key_mem (res, key->data, key->size, type)) < 0) + if ((ret = read_key_mem (res, key ? key->data : NULL, + key ? key->size : 0, type)) < 0) return ret; if ((ret = read_cert_mem (res, cert->data, cert->size, type)) < 0) @@ -830,7 +839,7 @@ gnutls_certificate_set_x509_key_mem (gnutls_certificate_credentials_t res->ncerts++; - if ((ret = _gnutls_check_key_cert_match (res)) < 0) + if (key && (ret = _gnutls_check_key_cert_match (res)) < 0) { gnutls_assert (); return ret; diff --git a/lib/x509/privkey.c b/lib/x509/privkey.c index dd29e89..5044828 100644 --- a/lib/x509/privkey.c +++ b/lib/x509/privkey.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003, 2004, 2005 Free Software Foundation + * Copyright (C) 2003, 2004, 2005, 2007 Free Software Foundation * * Author: Nikos Mavroyanopoulos * @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -1555,6 +1556,41 @@ gnutls_x509_privkey_sign_data (gnutls_x509_privkey_t key, } /** + * gnutls_x509_privkey_sign_hash - This function will sign the given data using the private key params + * @key: Holds the key + * @hash: holds the data to be signed + * @signature: will contain newly allocated signature + * + * This function will sign the given hash using the private key. + * + * Return value: In case of failure a negative value will be returned, + * and 0 on success. + **/ +int +gnutls_x509_privkey_sign_hash (gnutls_x509_privkey_t key, + const gnutls_datum_t hash, + gnutls_datum_t *signature) +{ + int result; + + if (key == NULL) + { + gnutls_assert (); + return GNUTLS_E_INVALID_REQUEST; + } + + result = _gnutls_sign (key->pk_algorithm, key->params, + key->params_size, &hash, signature); + if (result < 0) + { + gnutls_assert (); + return result; + } + + return 0; +} + +/** * gnutls_x509_privkey_verify_data - This function will verify the given signed data. * @key: Holds the key * @flags: should be 0 for now diff --git a/tests/Makefile.am b/tests/Makefile.am index 15c63e5..209f343 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -40,7 +40,7 @@ ctests = simple openssl gc set_pkcs12_cred certder \ certificate_set_x509_crl dn parse_ca openssl_LDADD = $(LDADD) ../libextra/libgnutls-openssl.la if HAVE_FORK -ctests += x509self anonself pskself dhepskself tlsia resume +ctests += x509self x509signself anonself pskself dhepskself tlsia resume tlsia_LDADD = ../libextra/libgnutls-extra.la $(LDADD) @LTLIBREADLINE@ endif gc_LDADD = $(LDADD) $(LIBGCRYPT_LIBS) diff --git a/tests/x509signself.c b/tests/x509signself.c new file mode 100644 index 0000000..2a0a44c --- /dev/null +++ b/tests/x509signself.c @@ -0,0 +1,527 @@ +/* + * Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation + * + * Author: Simon Josefsson + * + * This file is part of GNUTLS. + * + * GNUTLS is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * GNUTLS is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNUTLS; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + +/* Parts copied from GnuTLS example programs. */ + +#if HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "utils.h" + +pid_t child; + +static void +tls_log_func (int level, const char *str) +{ + fprintf (stderr, "%s |<%d>| %s", child ? "server" : "client", level, str); +} + +/* A very basic TLS client, with anonymous authentication. + */ + +#define MAX_BUF 1024 +#define MSG "Hello TLS" + +/* Connects to the peer and returns a socket + * descriptor. + */ +int +tcp_connect (void) +{ + const char *PORT = "5556"; + const char *SERVER = "127.0.0.1"; + int err, sd; + struct sockaddr_in sa; + + /* connects to server + */ + sd = socket (AF_INET, SOCK_STREAM, 0); + + memset (&sa, '\0', sizeof (sa)); + sa.sin_family = AF_INET; + sa.sin_port = htons (atoi (PORT)); + inet_pton (AF_INET, SERVER, &sa.sin_addr); + + err = connect (sd, (struct sockaddr *) &sa, sizeof (sa)); + if (err < 0) + { + fprintf (stderr, "Connect error\n"); + exit (1); + } + + return sd; +} + +/* closes the given socket descriptor. + */ +void +tcp_close (int sd) +{ + shutdown (sd, SHUT_RDWR); /* no more receptions */ + close (sd); +} + +const char ca_pem[] = + "-----BEGIN CERTIFICATE-----\n" + "MIIB5zCCAVKgAwIBAgIERiYdJzALBgkqhkiG9w0BAQUwGTEXMBUGA1UEAxMOR251\n" + "VExTIHRlc3QgQ0EwHhcNMDcwNDE4MTMyOTExWhcNMDgwNDE3MTMyOTExWjAZMRcw\n" + "FQYDVQQDEw5HbnVUTFMgdGVzdCBDQTCBnDALBgkqhkiG9w0BAQEDgYwAMIGIAoGA\n" + "vuyYeh1vfmslnuggeEKgZAVmQ5ltSdUY7H25WGSygKMUYZ0KT74v8C780qtcNt9T\n" + "7EPH/N6RvB4BprdssgcQLsthR3XKA84jbjjxNCcaGs33lvOz8A1nf8p3hD+cKfRi\n" + "kfYSW2JazLrtCC4yRCas/SPOUxu78of+3HiTfFm/oXUCAwEAAaNDMEEwDwYDVR0T\n" + "AQH/BAUwAwEB/zAPBgNVHQ8BAf8EBQMDBwQAMB0GA1UdDgQWBBTpPBz7rZJu5gak\n" + "Viyi4cBTJ8jylTALBgkqhkiG9w0BAQUDgYEAiaIRqGfp1jPpNeVhABK60SU0KIAy\n" + "njuu7kHq5peUgYn8Jd9zNzExBOEp1VOipGsf6G66oQAhDFp2o8zkz7ZH71zR4HEW\n" + "KoX6n5Emn6DvcEH/9pAhnGxNHJAoS7czTKv/JDZJhkqHxyrE1fuLsg5Qv25DTw7+\n" + "PfqUpIhz5Bbm7J4=\n" + "-----END CERTIFICATE-----\n"; +const gnutls_datum_t ca = { ca_pem, sizeof (ca_pem) }; + +const char cert_pem[] = + "-----BEGIN CERTIFICATE-----\n" + "MIICHjCCAYmgAwIBAgIERiYdNzALBgkqhkiG9w0BAQUwGTEXMBUGA1UEAxMOR251\n" + "VExTIHRlc3QgQ0EwHhcNMDcwNDE4MTMyOTI3WhcNMDgwNDE3MTMyOTI3WjAdMRsw\n" + "GQYDVQQDExJHbnVUTFMgdGVzdCBjbGllbnQwgZwwCwYJKoZIhvcNAQEBA4GMADCB\n" + "iAKBgLtmQ/Xyxde2jMzF3/WIO7HJS2oOoa0gUEAIgKFPXKPQ+GzP5jz37AR2ExeL\n" + "ZIkiW8DdU3w77XwEu4C5KL6Om8aOoKUSy/VXHqLnu7czSZ/ju0quak1o/8kR4jKN\n" + "zj2AC41179gAgY8oBAOgIo1hBAf6tjd9IQdJ0glhaZiQo1ipAgMBAAGjdjB0MAwG\n" + "A1UdEwEB/wQCMAAwEwYDVR0lBAwwCgYIKwYBBQUHAwIwDwYDVR0PAQH/BAUDAweg\n" + "ADAdBgNVHQ4EFgQUTLkKm/odNON+3svSBxX+odrLaJEwHwYDVR0jBBgwFoAU6Twc\n" + "+62SbuYGpFYsouHAUyfI8pUwCwYJKoZIhvcNAQEFA4GBALujmBJVZnvaTXr9cFRJ\n" + "jpfc/3X7sLUsMvumcDE01ls/cG5mIatmiyEU9qI3jbgUf82z23ON/acwJf875D3/\n" + "U7jyOsBJ44SEQITbin2yUeJMIm1tievvdNXBDfW95AM507ShzP12sfiJkJfjjdhy\n" + "dc8Siq5JojruiMizAf0pA7in\n" + "-----END CERTIFICATE-----\n"; +const gnutls_datum_t cert = { cert_pem, sizeof (cert_pem) }; + +int +sign_func (gnutls_session_t session, + void *userdata, + gnutls_certificate_type_t cert_type, + gnutls_datum_t cert, + const gnutls_datum_t hash, + gnutls_datum_t * signature) +{ + gnutls_x509_privkey_t key; + const char key_pem[] = + "-----BEGIN RSA PRIVATE KEY-----\n" + "MIICXAIBAAKBgQC7ZkP18sXXtozMxd/1iDuxyUtqDqGtIFBACIChT1yj0Phsz+Y8\n" + "9+wEdhMXi2SJIlvA3VN8O+18BLuAuSi+jpvGjqClEsv1Vx6i57u3M0mf47tKrmpN\n" + "aP/JEeIyjc49gAuNde/YAIGPKAQDoCKNYQQH+rY3fSEHSdIJYWmYkKNYqQIDAQAB\n" + "AoGADpmARG5CQxS+AesNkGmpauepiCz1JBF/JwnyiX6vEzUh0Ypd39SZztwrDxvF\n" + "PJjQaKVljml1zkJpIDVsqvHdyVdse8M+Qn6hw4x2p5rogdvhhIL1mdWo7jWeVJTF\n" + "RKB7zLdMPs3ySdtcIQaF9nUAQ2KJEvldkO3m/bRJFEp54k0CQQDYy+RlTmwRD6hy\n" + "7UtMjR0H3CSZJeQ8svMCxHLmOluG9H1UKk55ZBYfRTsXniqUkJBZ5wuV1L+pR9EK\n" + "ca89a+1VAkEA3UmBelwEv2u9cAU1QjKjmwju1JgXbrjEohK+3B5y0ESEXPAwNQT9\n" + "TrDM1m9AyxYTWLxX93dI5QwNFJtmbtjeBQJARSCWXhsoaDRG8QZrCSjBxfzTCqZD\n" + "ZXtl807ymCipgJm60LiAt0JLr4LiucAsMZz6+j+quQbSakbFCACB8SLV1QJBAKZQ\n" + "YKf+EPNtnmta/rRKKvySsi3GQZZN+Dt3q0r094XgeTsAqrqujVNfPhTMeP4qEVBX\n" + "/iVX2cmMTSh3w3z8MaECQEp0XJWDVKOwcTW6Ajp9SowtmiZ3YDYo1LF9igb4iaLv\n" + "sWZGfbnU3ryjvkb6YuFjgtzbZDZHWQCo8/cOtOBmPdk=\n" + "-----END RSA PRIVATE KEY-----\n"; + const gnutls_datum_t key_dat = { key_pem, sizeof (key_pem) }; + int ret; + + ret = gnutls_x509_privkey_init (&key); + if (ret < 0) + return ret; + + ret = gnutls_x509_privkey_import (key, &key_dat, GNUTLS_X509_FMT_PEM); + if (ret < 0) + goto done; + + ret = gnutls_x509_privkey_sign_hash (key, hash, signature); + if (ret < 0) + goto done; + + ret = 0; + + done: + gnutls_x509_privkey_deinit (key); + return ret; +} + +void +client (void) +{ + int ret, sd, ii; + gnutls_session_t session; + char buffer[MAX_BUF + 1]; + gnutls_certificate_credentials_t xcred; + + gnutls_global_init (); + + gnutls_global_set_log_function (tls_log_func); + gnutls_global_set_log_level (4711); + + gnutls_certificate_allocate_credentials (&xcred); + + /* sets the trusted cas file + */ + gnutls_certificate_set_x509_trust_mem (xcred, &ca, GNUTLS_X509_FMT_PEM); + gnutls_certificate_set_x509_key_mem (xcred, &cert, NULL, + GNUTLS_X509_FMT_PEM); + + /* Initialize TLS session + */ + gnutls_init (&session, GNUTLS_CLIENT); + + /* Set sign callback. */ + gnutls_sign_callback_set (session, sign_func, NULL); + + /* Use default priorities */ + gnutls_set_default_priority (session); + + /* put the x509 credentials to the current session + */ + gnutls_credentials_set (session, GNUTLS_CRD_CERTIFICATE, xcred); + + /* connect to the peer + */ + sd = tcp_connect (); + + gnutls_transport_set_ptr (session, (gnutls_transport_ptr_t) sd); + + /* Perform the TLS handshake + */ + ret = gnutls_handshake (session); + + if (ret < 0) + { + fail ("client: Handshake failed\n"); + gnutls_perror (ret); + goto end; + } + else + { + success ("client: Handshake was completed\n"); + } + + success ("client: TLS version is: %s\n", + gnutls_protocol_get_name (gnutls_protocol_get_version (session))); + + /* see the Getting peer's information example */ + print_info(session); + + gnutls_record_send (session, MSG, strlen (MSG)); + + ret = gnutls_record_recv (session, buffer, MAX_BUF); + if (ret == 0) + { + success ("client: Peer has closed the TLS connection\n"); + goto end; + } + else if (ret < 0) + { + fail ("client: Error: %s\n", gnutls_strerror (ret)); + goto end; + } + + printf ("- Received %d bytes: ", ret); + for (ii = 0; ii < ret; ii++) + { + fputc (buffer[ii], stdout); + } + fputs ("\n", stdout); + + gnutls_bye (session, GNUTLS_SHUT_RDWR); + +end: + + tcp_close (sd); + + gnutls_deinit (session); + + gnutls_certificate_free_credentials (xcred); + + gnutls_global_deinit (); +} + +/* This is a sample TLS 1.0 echo server, using X.509 authentication. + */ + +#define SA struct sockaddr +#define MAX_BUF 1024 +#define PORT 5556 /* listen to 5556 port */ +#define DH_BITS 1024 + +/* These are global */ +gnutls_certificate_credentials_t x509_cred; + +gnutls_session_t +initialize_tls_session (void) +{ + gnutls_session_t session; + + gnutls_init (&session, GNUTLS_SERVER); + + /* avoid calling all the priority functions, since the defaults + * are adequate. + */ + gnutls_set_default_priority (session); + + gnutls_credentials_set (session, GNUTLS_CRD_CERTIFICATE, x509_cred); + + /* request client certificate if any. + */ + gnutls_certificate_server_set_request (session, GNUTLS_CERT_REQUEST); + + gnutls_dh_set_prime_bits (session, DH_BITS); + + return session; +} + +static gnutls_dh_params_t dh_params; + +static int +generate_dh_params (void) +{ + const gnutls_datum_t p3 = { pkcs3, strlen (pkcs3) }; + /* Generate Diffie Hellman parameters - for use with DHE + * kx algorithms. These should be discarded and regenerated + * once a day, once a week or once a month. Depending on the + * security requirements. + */ + gnutls_dh_params_init (&dh_params); + return gnutls_dh_params_import_pkcs3 (dh_params, &p3, GNUTLS_X509_FMT_PEM); +} + +int err, listen_sd, i; +int sd, ret; +struct sockaddr_in sa_serv; +struct sockaddr_in sa_cli; +int client_len; +char topbuf[512]; +gnutls_session_t session; +char buffer[MAX_BUF + 1]; +int optval = 1; + + +const char server_cert_pem[] = + "-----BEGIN CERTIFICATE-----\n" + "MIICVjCCAcGgAwIBAgIERiYdMTALBgkqhkiG9w0BAQUwGTEXMBUGA1UEAxMOR251\n" + "VExTIHRlc3QgQ0EwHhcNMDcwNDE4MTMyOTIxWhcNMDgwNDE3MTMyOTIxWjA3MRsw\n" + "GQYDVQQKExJHbnVUTFMgdGVzdCBzZXJ2ZXIxGDAWBgNVBAMTD3Rlc3QuZ251dGxz\n" + "Lm9yZzCBnDALBgkqhkiG9w0BAQEDgYwAMIGIAoGA17pcr6MM8C6pJ1aqU46o63+B\n" + "dUxrmL5K6rce+EvDasTaDQC46kwTHzYWk95y78akXrJutsoKiFV1kJbtple8DDt2\n" + "DZcevensf9Op7PuFZKBroEjOd35znDET/z3IrqVgbtm2jFqab7a+n2q9p/CgMyf1\n" + "tx2S5Zacc1LWn9bIjrECAwEAAaOBkzCBkDAMBgNVHRMBAf8EAjAAMBoGA1UdEQQT\n" + "MBGCD3Rlc3QuZ251dGxzLm9yZzATBgNVHSUEDDAKBggrBgEFBQcDATAPBgNVHQ8B\n" + "Af8EBQMDB6AAMB0GA1UdDgQWBBTrx0Vu5fglyoyNgw106YbU3VW0dTAfBgNVHSME\n" + "GDAWgBTpPBz7rZJu5gakViyi4cBTJ8jylTALBgkqhkiG9w0BAQUDgYEAaFEPTt+7\n" + "bzvBuOf7+QmeQcn29kT6Bsyh1RHJXf8KTk5QRfwp6ogbp94JQWcNQ/S7YDFHglD1\n" + "AwUNBRXwd3riUsMnsxgeSDxYBfJYbDLeohNBsqaPDJb7XailWbMQKfAbFQ8cnOxg\n" + "rOKLUQRWJ0K3HyXRMhbqjdLIaQiCvQLuizo=\n" + "-----END CERTIFICATE-----\n"; + +const gnutls_datum_t server_cert = { server_cert_pem, + sizeof (server_cert_pem) }; + +const char server_key_pem[] = + "-----BEGIN RSA PRIVATE KEY-----\n" + "MIICXAIBAAKBgQDXulyvowzwLqknVqpTjqjrf4F1TGuYvkrqtx74S8NqxNoNALjq\n" + "TBMfNhaT3nLvxqResm62ygqIVXWQlu2mV7wMO3YNlx696ex/06ns+4VkoGugSM53\n" + "fnOcMRP/PciupWBu2baMWppvtr6far2n8KAzJ/W3HZLllpxzUtaf1siOsQIDAQAB\n" + "AoGAYAFyKkAYC/PYF8e7+X+tsVCHXppp8AoP8TEZuUqOZz/AArVlle/ROrypg5kl\n" + "8YunrvUdzH9R/KZ7saNZlAPLjZyFG9beL/am6Ai7q7Ma5HMqjGU8kTEGwD7K+lbG\n" + "iomokKMOl+kkbY/2sI5Czmbm+/PqLXOjtVc5RAsdbgvtmvkCQQDdV5QuU8jap8Hs\n" + "Eodv/tLJ2z4+SKCV2k/7FXSKWe0vlrq0cl2qZfoTUYRnKRBcWxc9o92DxK44wgPi\n" + "oMQS+O7fAkEA+YG+K9e60sj1K4NYbMPAbYILbZxORDecvP8lcphvwkOVUqbmxOGh\n" + "XRmTZUuhBrJhJKKf6u7gf3KWlPl6ShKEbwJASC118cF6nurTjuLf7YKARDjNTEws\n" + "qZEeQbdWYINAmCMj0RH2P0mvybrsXSOD5UoDAyO7aWuqkHGcCLv6FGG+qwJAOVqq\n" + "tXdUucl6GjOKKw5geIvRRrQMhb/m5scb+5iw8A4LEEHPgGiBaF5NtJZLALgWfo5n\n" + "hmC8+G8F0F78znQtPwJBANexu+Tg5KfOnzSILJMo3oXiXhf5PqXIDmbN0BKyCKAQ\n" + "LfkcEcUbVfmDaHpvzwY9VEaoMOKVLitETXdNSxVpvWM=\n" + "-----END RSA PRIVATE KEY-----\n"; + +const gnutls_datum_t server_key = { server_key_pem, + sizeof (server_key_pem) }; + +void +server_start (void) +{ + /* this must be called once in the program + */ + gnutls_global_init (); + + gnutls_global_set_log_function (tls_log_func); + gnutls_global_set_log_level (4711); + + gnutls_certificate_allocate_credentials (&x509_cred); + gnutls_certificate_set_x509_trust_mem (x509_cred, &ca, GNUTLS_X509_FMT_PEM); + + gnutls_certificate_set_x509_key_mem (x509_cred, &server_cert, &server_key, + GNUTLS_X509_FMT_PEM); + + success ("Launched, generating DH parameters...\n"); + + generate_dh_params (); + + gnutls_certificate_set_dh_params (x509_cred, dh_params); + + /* Socket operations + */ + listen_sd = socket (AF_INET, SOCK_STREAM, 0); + if (err == -1) + { + perror ("socket"); + fail ("server: socket failed\n"); + return; + } + + memset (&sa_serv, '\0', sizeof (sa_serv)); + sa_serv.sin_family = AF_INET; + sa_serv.sin_addr.s_addr = INADDR_ANY; + sa_serv.sin_port = htons (PORT); /* Server Port number */ + + setsockopt (listen_sd, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof (int)); + + err = bind (listen_sd, (SA *) & sa_serv, sizeof (sa_serv)); + if (err == -1) + { + perror ("bind"); + fail ("server: bind failed\n"); + return; + } + + err = listen (listen_sd, 1024); + if (err == -1) + { + perror ("listen"); + fail ("server: listen failed\n"); + return; + } + + success ("server: ready. Listening to port '%d'.\n", PORT); +} + +#include "ex-session-info.c" +#include "ex-x509-info.c" + +void +server (void) +{ + client_len = sizeof (sa_cli); + + session = initialize_tls_session (); + + sd = accept (listen_sd, (SA *) & sa_cli, &client_len); + + success ("server: connection from %s, port %d\n", + inet_ntop (AF_INET, &sa_cli.sin_addr, topbuf, + sizeof (topbuf)), ntohs (sa_cli.sin_port)); + + gnutls_transport_set_ptr (session, (gnutls_transport_ptr_t) sd); + ret = gnutls_handshake (session); + if (ret < 0) + { + close (sd); + gnutls_deinit (session); + fail ("server: Handshake has failed (%s)\n\n", gnutls_strerror (ret)); + return; + } + success ("server: Handshake was completed\n"); + + success ("server: TLS version is: %s\n", + gnutls_protocol_get_name (gnutls_protocol_get_version (session))); + + /* see the Getting peer's information example */ + print_info(session); + + i = 0; + for (;;) + { + bzero (buffer, MAX_BUF + 1); + ret = gnutls_record_recv (session, buffer, MAX_BUF); + + if (ret == 0) + { + success ("server: Peer has closed the GNUTLS connection\n"); + break; + } + else if (ret < 0) + { + fail ("server: Received corrupted data(%d). Closing...\n", ret); + break; + } + else if (ret > 0) + { + /* echo data back to the client + */ + gnutls_record_send (session, buffer, strlen (buffer)); + } + } + /* do not wait for the peer to close the connection. + */ + gnutls_bye (session, GNUTLS_SHUT_WR); + + close (sd); + gnutls_deinit (session); + + close (listen_sd); + + gnutls_certificate_free_credentials (x509_cred); + + gnutls_global_deinit (); + + success ("server: finished\n"); +} + + +void +doit (void) +{ + server_start (); + if (error_count) + return; + + child = fork (); + if (child < 0) + { + perror ("fork"); + fail ("fork"); + return; + } + + if (child) + { + int status; + /* parent */ + server (); + wait (&status); + } + else + client (); +} From simon at josefsson.org Fri Aug 10 15:52:28 2007 From: simon at josefsson.org (Simon Josefsson) Date: Fri, 10 Aug 2007 15:52:28 +0200 Subject: [gnutls-dev] External signing API In-Reply-To: <9e0cf0bf0708100512v1227820bk20d49c64e3a75d2@mail.gmail.com> (Alon Bar-Lev's message of "Fri, 10 Aug 2007 15:12:31 +0300") References: <87y7gjppuw.fsf@mocca.josefsson.org> <9e0cf0bf0708100512v1227820bk20d49c64e3a75d2@mail.gmail.com> Message-ID: <87hcn7pkdf.fsf@mocca.josefsson.org> "Alon Bar-Lev" writes: > Hi! > > You need a way get the userdata (gnutls_sign_callback_get). Hi! The userdata is passed to the callback, see the prototype. Do you think another function is needed anyway? > I guess integrating between certificate and private key to a single > object will take time... But it will be the simplest solution as they > are the same entity. Yeah, I think the callback is in the best position to select the best key, by looking at the certificate. Anyway, I don't see how GnuTLS could implement that choice easily. > Please also add something like: > #define GNUTLS_E_LIBEXTESION_DEFINED_BASE -2000 > #define GNUTLS_E_USER_DEFINED_BASE -3000 > > So that external library/user may define its own set of codes. Hm, exactly what use do you see for this? Returning various different PKCS#11 errors? That makes sense... However, the return code from the signing callback influence the TLS handshake logic, some return codes leads to disconnect, some don't (although I'm having a hard time understanding how the state machine would recover). See gnutls_error_is_fatal. Looking at that function, it seems it has the wrong default: if an error code isn't known to gnutls, it is classified as non-fatal. That is likely incorrect, the internal logic needs to understand how to recover from non-fatal error cases, and will thus need to know about the error code. I've changed this. /Simon > > Best Regards, > Alon Bar-Lev. > > On 8/10/07, Simon Josefsson wrote: >> I'm now finally working on integrating the external signing API into the >> main branch. Here is what I've came up with API-wise. The names are >> intentionally slightly different from any other existing namespace since >> this is an experimental interface. Do you need any other parameters? >> >> /* External signing callback. Experimental. */ >> typedef int (*gnutls_sign_func) (gnutls_session_t session, >> void *userdata, >> gnutls_certificate_type_t cert_type, >> gnutls_datum_t cert, >> const gnutls_datum_t hash, >> gnutls_datum_t * signature); >> >> void gnutls_sign_callback_set (gnutls_session_t session, >> gnutls_sign_func sign_func, >> void *userdata); >> >> Thanks, >> Simon >> >> _______________________________________________ >> Gnutls-dev mailing list >> Gnutls-dev at gnupg.org >> http://lists.gnupg.org/mailman/listinfo/gnutls-dev >> From simon at josefsson.org Fri Aug 10 16:18:38 2007 From: simon at josefsson.org (Simon Josefsson) Date: Fri, 10 Aug 2007 16:18:38 +0200 Subject: [gnutls-dev] External signing API In-Reply-To: <87lkcjpkvr.fsf@mocca.josefsson.org> (Simon Josefsson's message of "Fri, 10 Aug 2007 15:41:28 +0200") References: <87y7gjppuw.fsf@mocca.josefsson.org> <87lkcjpkvr.fsf@mocca.josefsson.org> Message-ID: <87tzr7o4ld.fsf@mocca.josefsson.org> I re-generated today's daily snapshot with this functionality: http://daily.josefsson.org/gnutls/gnutls-20070810.tar.gz I plan to release it as 1.7.17 on Monday, and I would like to avoid substantial API changes after that release. So please test it! (Testing later snapshots, when they become available, is fine.) /Simon From alon.barlev at gmail.com Fri Aug 10 16:25:41 2007 From: alon.barlev at gmail.com (Alon Bar-Lev) Date: Fri, 10 Aug 2007 17:25:41 +0300 Subject: [gnutls-dev] External signing API In-Reply-To: <87hcn7pkdf.fsf@mocca.josefsson.org> References: <87y7gjppuw.fsf@mocca.josefsson.org> <9e0cf0bf0708100512v1227820bk20d49c64e3a75d2@mail.gmail.com> <87hcn7pkdf.fsf@mocca.josefsson.org> Message-ID: <9e0cf0bf0708100725x5708add1i3b8d38afe82848ae@mail.gmail.com> On 8/10/07, Simon Josefsson wrote: > Hi! The userdata is passed to the callback, see the prototype. Do you > think another function is needed anyway? Yes. During cleanup the user data should be accessible in order to optionally free it. > > Please also add something like: > > #define GNUTLS_E_LIBEXTESION_DEFINED_BASE -2000 > > #define GNUTLS_E_USER_DEFINED_BASE -3000 > > > > So that external library/user may define its own set of codes. > > Hm, exactly what use do you see for this? Returning various different > PKCS#11 errors? That makes sense... Right. > However, the return code from the signing callback influence the TLS > handshake logic, some return codes leads to disconnect, some don't > (although I'm having a hard time understanding how the state machine > would recover). See gnutls_error_is_fatal. Looking at that function, > it seems it has the wrong default: if an error code isn't known to > gnutls, it is classified as non-fatal. That is likely incorrect, the > internal logic needs to understand how to recover from non-fatal error > cases, and will thus need to know about the error code. I've changed > this. True... Unknown errors should be fatal. Best Regards, Alon Bar-Lev. From alon.barlev at gmail.com Fri Aug 10 16:26:53 2007 From: alon.barlev at gmail.com (Alon Bar-Lev) Date: Fri, 10 Aug 2007 17:26:53 +0300 Subject: [gnutls-dev] External signing API In-Reply-To: <87tzr7o4ld.fsf@mocca.josefsson.org> References: <87y7gjppuw.fsf@mocca.josefsson.org> <87lkcjpkvr.fsf@mocca.josefsson.org> <87tzr7o4ld.fsf@mocca.josefsson.org> Message-ID: <9e0cf0bf0708100726x3272b1dejff7c9b7bebf465c6@mail.gmail.com> On 8/10/07, Simon Josefsson wrote: > I re-generated today's daily snapshot with this functionality: > > http://daily.josefsson.org/gnutls/gnutls-20070810.tar.gz > > I plan to release it as 1.7.17 on Monday, and I would like to avoid > substantial API changes after that release. > > So please test it! If you add the get and tell me which error to return from PKCS#11 failures... :) Alon. From simon at josefsson.org Sat Aug 11 15:01:21 2007 From: simon at josefsson.org (Simon Josefsson) Date: Sat, 11 Aug 2007 15:01:21 +0200 Subject: [gnutls-dev] External signing API In-Reply-To: <9e0cf0bf0708100725x5708add1i3b8d38afe82848ae@mail.gmail.com> (Alon Bar-Lev's message of "Fri, 10 Aug 2007 17:25:41 +0300") References: <87y7gjppuw.fsf@mocca.josefsson.org> <9e0cf0bf0708100512v1227820bk20d49c64e3a75d2@mail.gmail.com> <87hcn7pkdf.fsf@mocca.josefsson.org> <9e0cf0bf0708100725x5708add1i3b8d38afe82848ae@mail.gmail.com> Message-ID: <878x8ifcny.fsf@mocca.josefsson.org> "Alon Bar-Lev" writes: > On 8/10/07, Simon Josefsson wrote: >> Hi! The userdata is passed to the callback, see the prototype. Do you >> think another function is needed anyway? > > Yes. > During cleanup the user data should be accessible in order to > optionally free it. Ah, makes sense. Added. I also added some new error codes, see patches below. I've git-push'ed the changes, so tomorrow's daily snapshot should contain this stuff (I can't trigger generation of a new daily snapshot right now). /Simon commit 3d5e85faf9d1dbb3cf2d58f9accfc8d2db917016 Author: Simon Josefsson Date: Sat Aug 11 14:34:15 2007 +0200 New errors GNUTLS_E_APPLICATION_ERROR_MIN..GNUTLS_E_APPLICATION_ERROR_MAX. diff --git a/NEWS b/NEWS index e31fcbf..f00212d 100644 --- a/NEWS +++ b/NEWS @@ -17,6 +17,16 @@ for comments and testing. See tests/x509self.c and tests/x509signself.c. The latter also tests the new external signing callback interface. +** New errors GNUTLS_E_APPLICATION_ERROR_MIN..GNUTLS_E_APPLICATION_ERROR_MAX. +These two actually describe the outer limits of a range of error codes +reserved to the application. All of the errors are treated as fatal +by the library (it has to since it doesn't know the semantics of the +error codes). This can be useful in callbacks, to signal some +application-specific error condition, which will usually eventually +cause some gnutls API to return the same error code as the callback, +which then can be inspected by the application. Note that error codes +are negative. + ** gnutls_set_default_priority now disable TLS 1.2 by default. The RFC is not released yet, and we're approaching a major release so let's not enable it just yet. @@ -37,6 +47,8 @@ gnutls_sign_func: ADD, new type for sign callback. gnutls_sign_callback_set: ADD, new function to set sign callback. gnutls_sign_callback_get: ADD, new function to retrieve sign callback. gnutls_x509_privkey_sign_hash: ADD, new function useful in sign callback. +GNUTLS_E_APPLICATION_ERROR_MIN, +GNUTLS_E_APPLICATION_ERROR_MAX: ADD, new CPP #defines for error codes. * Version 1.7.16 (released 2007-08-07) diff --git a/includes/gnutls/gnutls.h.in b/includes/gnutls/gnutls.h.in index 9663092..61b0b4d 100644 --- a/includes/gnutls/gnutls.h.in +++ b/includes/gnutls/gnutls.h.in @@ -1262,6 +1262,9 @@ extern "C" #define GNUTLS_E_UNIMPLEMENTED_FEATURE -1250 +#define GNUTLS_E_APPLICATION_ERROR_MAX -65000 +#define GNUTLS_E_APPLICATION_ERROR_MIN -65500 + #ifdef __cplusplus } #endif commit cfa77b1f37a94585bea9aea81db7545a9c4fa7eb Author: Simon Josefsson Date: Sat Aug 11 14:23:07 2007 +0200 Add gnutls_sign_callback_get. * includes/gnutls/gnutls.h.in (gnutls_sign_callback_get): Add. * lib/gnutls_cert.c (gnutls_sign_callback_set): Move here from gnutls_sig.c. Doc fix. (gnutls_sign_callback_get): New function. * lib/gnutls_sig.c (gnutls_sign_callback_set): Removed. diff --git a/NEWS b/NEWS index 9f39fd1..e31fcbf 100644 --- a/NEWS +++ b/NEWS @@ -7,8 +7,11 @@ See the end for copying conditions. ** New functions to perform external signing. Set the signing callback function (of the gnutls_sign_func prototype) -using gnutls_sign_callback_set. In the callback, you may find the new -function gnutls_x509_privkey_sign_hash useful. +using the gnutls_sign_callback_set function. In the callback, you may +find the new function gnutls_x509_privkey_sign_hash useful. A new +function gnutls_sign_callback_get is also added, to retrieve the +function pointer. Thanks to "Alon Bar-Lev" +for comments and testing. ** New self test of client and server authenticated X.509 TLS sessions. See tests/x509self.c and tests/x509signself.c. The latter also tests @@ -32,6 +35,7 @@ Thanks to Jakub Bogusz and Daniel Nylander ** API and ABI modifications: gnutls_sign_func: ADD, new type for sign callback. gnutls_sign_callback_set: ADD, new function to set sign callback. +gnutls_sign_callback_get: ADD, new function to retrieve sign callback. gnutls_x509_privkey_sign_hash: ADD, new function useful in sign callback. * Version 1.7.16 (released 2007-08-07) diff --git a/includes/gnutls/gnutls.h.in b/includes/gnutls/gnutls.h.in index 8f1e364..9663092 100644 --- a/includes/gnutls/gnutls.h.in +++ b/includes/gnutls/gnutls.h.in @@ -1058,6 +1058,9 @@ extern "C" void gnutls_sign_callback_set (gnutls_session_t session, gnutls_sign_func sign_func, void *userdata); + gnutls_sign_func + gnutls_sign_callback_get (gnutls_session_t session, + void **userdata); /* These are set on the credentials structure. */ diff --git a/lib/gnutls_cert.c b/lib/gnutls_cert.c index cc97842..23a0f3d 100644 --- a/lib/gnutls_cert.c +++ b/lib/gnutls_cert.c @@ -868,3 +868,50 @@ _gnutls_gcert_deinit (gnutls_cert * cert) _gnutls_free_datum (&cert->raw); } + +/** + * gnutls_sign_callback_set: + * @session: is a gnutls session + * @sign_func: function pointer to application's sign callback. + * @userdata: void pointer that will be passed to sign callback. + * + * Set the callback function. The function must have this prototype: + * + * typedef int (*gnutls_sign_func) (gnutls_session_t session, + * void *userdata, + * gnutls_certificate_type_t cert_type, + * gnutls_datum_t cert, + * const gnutls_datum_t hash, + * gnutls_datum_t * signature); + * + * The @userdata parameter is passed to the @sign_func verbatim, and + * can be used to store application-specific data needed in the + * callback function. See also gnutls_sign_callback_get(). + **/ +void +gnutls_sign_callback_set (gnutls_session_t session, + gnutls_sign_func sign_func, + void *userdata) +{ + session->internals.sign_func = sign_func; + session->internals.sign_func_userdata = userdata; +} + +/** + * gnutls_sign_callback_get: + * @session: is a gnutls session + * @userdata: if non-%NULL, will be set to abstract callback pointer. + * + * Retrieve the callback function, and its userdata pointer. + * + * Return value: The function pointer set by + * gnutls_sign_callback_set(), or if not set, %NULL. + **/ +gnutls_sign_func +gnutls_sign_callback_get (gnutls_session_t session, + void **userdata) +{ + if (userdata) + *userdata = session->internals.sign_func_userdata; + return session->internals.sign_func; +} diff --git a/lib/gnutls_sig.c b/lib/gnutls_sig.c index 31db1cf..1358b76 100644 --- a/lib/gnutls_sig.c +++ b/lib/gnutls_sig.c @@ -291,34 +291,6 @@ _gnutls_tls_sign (gnutls_session_t session, pkey->params_size, hash_concat, signature); } -/** - * gnutls_sign_callback_set: - * @session: - * @sign_func: - * @userdata: - * - * Set the callback function. The function must have this prototype: - * - * typedef int (*gnutls_sign_func) (gnutls_session_t session, - * void *userdata, - * gnutls_certificate_type_t cert_type, - * gnutls_datum_t cert, - * const gnutls_datum_t hash, - * gnutls_datum_t * signature); - * - * The @userdata parameter is passed to the @sign_func verbatim, and - * can be used to store application-specific data needed in the - * callback function. - **/ -void -gnutls_sign_callback_set (gnutls_session_t session, - gnutls_sign_func sign_func, - void *userdata) -{ - session->internals.sign_func = sign_func; - session->internals.sign_func_userdata = userdata; -} - static int _gnutls_verify_sig (gnutls_cert * cert, const gnutls_datum_t * hash_concat, From alon.barlev at gmail.com Sun Aug 12 07:13:24 2007 From: alon.barlev at gmail.com (Alon Bar-Lev) Date: Sun, 12 Aug 2007 08:13:24 +0300 Subject: [gnutls-dev] External signing API In-Reply-To: <878x8ifcny.fsf@mocca.josefsson.org> References: <87y7gjppuw.fsf@mocca.josefsson.org> <9e0cf0bf0708100512v1227820bk20d49c64e3a75d2@mail.gmail.com> <87hcn7pkdf.fsf@mocca.josefsson.org> <9e0cf0bf0708100725x5708add1i3b8d38afe82848ae@mail.gmail.com> <878x8ifcny.fsf@mocca.josefsson.org> Message-ID: <9e0cf0bf0708112213q4d297030jfa6c73cdd9a88f2c@mail.gmail.com> On 8/11/07, Simon Josefsson wrote: > "Alon Bar-Lev" writes: > Ah, makes sense. Added. I also added some new error codes, see patches > below. > > I've git-push'ed the changes, so tomorrow's daily snapshot should > contain this stuff (I can't trigger generation of a new daily snapshot > right now). Thanks! Working for me! Some questions: 1. Why don't you pass pointers to datum? 2. Why only the hash is const? 3. What do you expect the cert_type to be used? Can't it queried out the cert? typedef int (*gnutls_sign_func) (gnutls_session_t session, void *userdata, gnutls_certificate_type_t cert_type, gnutls_datum_t cert, const gnutls_datum_t hash, gnutls_datum_t * signature); Available at: http://alon.barlev.googlepages.com/gnutls-pkcs11-0.02.tar.bz2 Regards, Alon Bar-Lev. From simon at josefsson.org Sun Aug 12 11:36:54 2007 From: simon at josefsson.org (Simon Josefsson) Date: Sun, 12 Aug 2007 11:36:54 +0200 Subject: [gnutls-dev] External signing API In-Reply-To: <9e0cf0bf0708112213q4d297030jfa6c73cdd9a88f2c@mail.gmail.com> (Alon Bar-Lev's message of "Sun, 12 Aug 2007 08:13:24 +0300") References: <87y7gjppuw.fsf@mocca.josefsson.org> <9e0cf0bf0708100512v1227820bk20d49c64e3a75d2@mail.gmail.com> <87hcn7pkdf.fsf@mocca.josefsson.org> <9e0cf0bf0708100725x5708add1i3b8d38afe82848ae@mail.gmail.com> <878x8ifcny.fsf@mocca.josefsson.org> <9e0cf0bf0708112213q4d297030jfa6c73cdd9a88f2c@mail.gmail.com> Message-ID: <87643lt7pl.fsf@mocca.josefsson.org> "Alon Bar-Lev" writes: > On 8/11/07, Simon Josefsson wrote: >> "Alon Bar-Lev" writes: >> Ah, makes sense. Added. I also added some new error codes, see patches >> below. >> >> I've git-push'ed the changes, so tomorrow's daily snapshot should >> contain this stuff (I can't trigger generation of a new daily snapshot >> right now). > > Thanks! > Working for me! Great! > Some questions: > 1. Why don't you pass pointers to datum? > 2. Why only the hash is const? I've fixed this, please test tomorrow's snapshot. > 3. What do you expect the cert_type to be used? Can't it queried out the cert? No, the cert may be a PGP key, and this needs to be indicated somehow. I haven't tested that PGP signing works through this interface yet, but I think it makes sense to have cert_type there in case we support external signing for PGP keys in the future. /Simon From alon.barlev at gmail.com Sun Aug 12 19:40:22 2007 From: alon.barlev at gmail.com (Alon Bar-Lev) Date: Sun, 12 Aug 2007 20:40:22 +0300 Subject: [gnutls-dev] External signing API In-Reply-To: <87643lt7pl.fsf@mocca.josefsson.org> References: <87y7gjppuw.fsf@mocca.josefsson.org> <9e0cf0bf0708100512v1227820bk20d49c64e3a75d2@mail.gmail.com> <87hcn7pkdf.fsf@mocca.josefsson.org> <9e0cf0bf0708100725x5708add1i3b8d38afe82848ae@mail.gmail.com> <878x8ifcny.fsf@mocca.josefsson.org> <9e0cf0bf0708112213q4d297030jfa6c73cdd9a88f2c@mail.gmail.com> <87643lt7pl.fsf@mocca.josefsson.org> Message-ID: <9e0cf0bf0708121040s4382213ay91d5093192e265e0@mail.gmail.com> On 8/12/07, Simon Josefsson wrote: > > 3. What do you expect the cert_type to be used? Can't it queried out the cert? > > No, the cert may be a PGP key, and this needs to be indicated somehow. > I haven't tested that PGP signing works through this interface yet, but > I think it makes sense to have cert_type there in case we support > external signing for PGP keys in the future. I don't understand why the type is not part of the certificate object... type = gnutls_get_cert_type (cert); This should be much cleaner than passing two variable to each method. Alon. From simon at josefsson.org Mon Aug 13 13:04:33 2007 From: simon at josefsson.org (Simon Josefsson) Date: Mon, 13 Aug 2007 13:04:33 +0200 Subject: [gnutls-dev] External signing API References: <87y7gjppuw.fsf@mocca.josefsson.org> <9e0cf0bf0708100512v1227820bk20d49c64e3a75d2@mail.gmail.com> <87hcn7pkdf.fsf@mocca.josefsson.org> <9e0cf0bf0708100725x5708add1i3b8d38afe82848ae@mail.gmail.com> <878x8ifcny.fsf@mocca.josefsson.org> <9e0cf0bf0708112213q4d297030jfa6c73cdd9a88f2c@mail.gmail.com> <87643lt7pl.fsf@mocca.josefsson.org> <9e0cf0bf0708121040s4382213ay91d5093192e265e0@mail.gmail.com> Message-ID: <87643jofum.fsf@mocca.josefsson.org> "Alon Bar-Lev" writes: > On 8/12/07, Simon Josefsson wrote: >> > 3. What do you expect the cert_type to be used? Can't it queried out the cert? >> >> No, the cert may be a PGP key, and this needs to be indicated somehow. >> I haven't tested that PGP signing works through this interface yet, but >> I think it makes sense to have cert_type there in case we support >> external signing for PGP keys in the future. > > I don't understand why the type is not part of the certificate object... > type = gnutls_get_cert_type (cert); > > This should be much cleaner than passing two variable to each method. The cert in the sign callback is 'gnutls_datum_t', i.e., a raw binary blob with the X.509 certificate or OpenPGP key. Binary data doesn't know its own type, so it needs an out-of-band signal to denote the kind of data it is. There is no function gnutls_get_cert_type(binary_blob) that guesses whether some binary blob is X.509 or OpenPGP, is adding such a function what you are proposing? It seems rather fragile to me. Btw, I reviewed the call-path for PGP authentication, and it seems this callback function should function right now, if someone can write a OpenPGP callback signer. I added gnutls_openpgp_privkey_sign_hash that should be useful in the callback function. I'm not sure how useful this will be though. /Simon From simon at josefsson.org Mon Aug 13 15:04:39 2007 From: simon at josefsson.org (Simon Josefsson) Date: Mon, 13 Aug 2007 15:04:39 +0200 Subject: [gnutls-dev] External signing API In-Reply-To: <87643jofum.fsf@mocca.josefsson.org> (Simon Josefsson's message of "Mon, 13 Aug 2007 13:04:33 +0200") References: <87y7gjppuw.fsf@mocca.josefsson.org> <9e0cf0bf0708100512v1227820bk20d49c64e3a75d2@mail.gmail.com> <87hcn7pkdf.fsf@mocca.josefsson.org> <9e0cf0bf0708100725x5708add1i3b8d38afe82848ae@mail.gmail.com> <878x8ifcny.fsf@mocca.josefsson.org> <9e0cf0bf0708112213q4d297030jfa6c73cdd9a88f2c@mail.gmail.com> <87643lt7pl.fsf@mocca.josefsson.org> <9e0cf0bf0708121040s4382213ay91d5093192e265e0@mail.gmail.com> <87643jofum.fsf@mocca.josefsson.org> Message-ID: <87wsvzlh5k.fsf@mocca.josefsson.org> I have re-generated todays' daily build, see: http://daily.josefsson.org/gnutls/gnutls-20070813.tar.gz Please test that one (or any later ones). Since there has been some additions, I won't release it today. Changing the API after we make a public release is a no-no, and I don't want to risk that we release these API changes before we have had at least some positive feedback. My schedule for the next major release is now: * This week: release 1.7.17. * This week: Announce last call for 2.0. * Release 2.0 on September 1th. The expectation is that only minor changes will happen before 2.0. If I find the time to finish a contract job, it will contain another surprise too. :) /Simon From alon.barlev at gmail.com Mon Aug 13 22:01:55 2007 From: alon.barlev at gmail.com (Alon Bar-Lev) Date: Mon, 13 Aug 2007 23:01:55 +0300 Subject: [gnutls-dev] External signing API In-Reply-To: <87wsvzlh5k.fsf@mocca.josefsson.org> References: <87y7gjppuw.fsf@mocca.josefsson.org> <9e0cf0bf0708100512v1227820bk20d49c64e3a75d2@mail.gmail.com> <87hcn7pkdf.fsf@mocca.josefsson.org> <9e0cf0bf0708100725x5708add1i3b8d38afe82848ae@mail.gmail.com> <878x8ifcny.fsf@mocca.josefsson.org> <9e0cf0bf0708112213q4d297030jfa6c73cdd9a88f2c@mail.gmail.com> <87643lt7pl.fsf@mocca.josefsson.org> <9e0cf0bf0708121040s4382213ay91d5093192e265e0@mail.gmail.com> <87643jofum.fsf@mocca.josefsson.org> <87wsvzlh5k.fsf@mocca.josefsson.org> Message-ID: <9e0cf0bf0708131301t5233e3a3u8e2e1313742020c8@mail.gmail.com> On 8/13/07, Simon Josefsson wrote: > Please test that one (or any later ones). Since there has been some > additions, I won't release it today. Changing the API after we make a > public release is a no-no, and I don't want to risk that we release > these API changes before we have had at least some positive feedback. Working... :) Alon. From alon.barlev at gmail.com Mon Aug 13 22:01:30 2007 From: alon.barlev at gmail.com (Alon Bar-Lev) Date: Mon, 13 Aug 2007 23:01:30 +0300 Subject: [gnutls-dev] External signing API In-Reply-To: <87643lt7pl.fsf@mocca.josefsson.org> References: <87y7gjppuw.fsf@mocca.josefsson.org> <9e0cf0bf0708100512v1227820bk20d49c64e3a75d2@mail.gmail.com> <87hcn7pkdf.fsf@mocca.josefsson.org> <9e0cf0bf0708100725x5708add1i3b8d38afe82848ae@mail.gmail.com> <878x8ifcny.fsf@mocca.josefsson.org> <9e0cf0bf0708112213q4d297030jfa6c73cdd9a88f2c@mail.gmail.com> <87643lt7pl.fsf@mocca.josefsson.org> Message-ID: <9e0cf0bf0708131301o6a0670aamdcf820e8612c12a5@mail.gmail.com> On 8/12/07, Simon Josefsson wrote: > > 3. What do you expect the cert_type to be used? Can't it queried out the cert? > > No, the cert may be a PGP key, and this needs to be indicated somehow. > I haven't tested that PGP signing works through this interface yet, but > I think it makes sense to have cert_type there in case we support > external signing for PGP keys in the future. Wow... I was so confused! Providing certificate as blob will force the routine to parse it... This takes a lot of resources... If you wish to pass the certificate, it should be already parsed. But anyway... Why do you need the public part for signature anyway? I guess the private key will be more useful... But correct me if I am wrong here... Having the session handle allows you to pull these two anyway, right? Best Regards, Alon Bar-Lev. From simon at josefsson.org Tue Aug 14 11:39:21 2007 From: simon at josefsson.org (Simon Josefsson) Date: Tue, 14 Aug 2007 11:39:21 +0200 Subject: [gnutls-dev] External signing API In-Reply-To: <9e0cf0bf0708131301o6a0670aamdcf820e8612c12a5@mail.gmail.com> (Alon Bar-Lev's message of "Mon, 13 Aug 2007 23:01:30 +0300") References: <87y7gjppuw.fsf@mocca.josefsson.org> <9e0cf0bf0708100512v1227820bk20d49c64e3a75d2@mail.gmail.com> <87hcn7pkdf.fsf@mocca.josefsson.org> <9e0cf0bf0708100725x5708add1i3b8d38afe82848ae@mail.gmail.com> <878x8ifcny.fsf@mocca.josefsson.org> <9e0cf0bf0708112213q4d297030jfa6c73cdd9a88f2c@mail.gmail.com> <87643lt7pl.fsf@mocca.josefsson.org> <9e0cf0bf0708131301o6a0670aamdcf820e8612c12a5@mail.gmail.com> Message-ID: <87eji6ihfa.fsf@mocca.josefsson.org> "Alon Bar-Lev" writes: > On 8/12/07, Simon Josefsson wrote: >> > 3. What do you expect the cert_type to be used? Can't it queried out the cert? >> >> No, the cert may be a PGP key, and this needs to be indicated somehow. >> I haven't tested that PGP signing works through this interface yet, but >> I think it makes sense to have cert_type there in case we support >> external signing for PGP keys in the future. > > Wow... I was so confused! > Providing certificate as blob will force the routine to parse it... > This takes a lot of resources... If you wish to pass the certificate, > it should be already parsed. Not all application callbacks will need to parse it. The parsing needs to happen somewhere, and if the application doesn't do it, GnuTLS would have to do it. With the current approach, the application can chose whether to parse it or not. Only the application knows whether it needs to parse the certificate. Oh, and parsing is not that complicated, gnutls-cli in the old pkcs11 branch did this: if (verbose) { int ret; gnutls_datum_t out; gnutls_x509_crt_t crt; ret = gnutls_x509_crt_init (&crt); if (ret < 0) return ret; ret = gnutls_x509_crt_import (crt, cert, GNUTLS_X509_FMT_DER); if (ret < 0) return ret; ret = gnutls_x509_crt_print (crt, GNUTLS_X509_CRT_ONELINE, &out); if (ret < 0) return ret; printf ("*** PKCS#11 signing using credential: %s\n", out.data); gnutls_free (out.data); gnutls_x509_crt_deinit (crt); } That's all that is required. It takes some resources, but I don't think it is a lot compare to other operations (network latency, RSA/DSA signing operations, ...). > But anyway... Why do you need the public part for signature anyway? To find which private key should be used. The application may have multiple user certificates and private keys. Without knowing which user certificate should be used, the application can't select the appropriate key. > I guess the private key will be more useful... The idea with the external signing interface is that GnuTLS shouldn't have to deal with private keys. If you want to trust your private keys to Gnutls, you can use the normal APIs which are in use today. > But correct me if I am wrong here... Having the session handle allows > you to pull these two anyway, right? Hm, yes, you probably could. But it seems more elegant to provide the callback with the data it needs to do its job. The callback doesn't have to use the data. /Simon From simon at josefsson.org Wed Aug 15 01:18:17 2007 From: simon at josefsson.org (Simon Josefsson) Date: Wed, 15 Aug 2007 01:18:17 +0200 Subject: [gnutls-dev] GnuTLS 1.7.17 -- Last call for next stable major release v2.0! Message-ID: <87sl6lso1y.fsf@mocca.josefsson.org> A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 419 bytes Desc: not available Url : /pipermail/attachments/20070815/e295c4c0/attachment.pgp From ametzler at downhill.at.eu.org Wed Aug 15 12:03:31 2007 From: ametzler at downhill.at.eu.org (Andreas Metzler) Date: Wed, 15 Aug 2007 12:03:31 +0200 Subject: [gnutls-dev] GnuTLS 1.7.17 -- Last call for next stable major release v2.0! In-Reply-To: <87sl6lso1y.fsf@mocca.josefsson.org> References: <87sl6lso1y.fsf@mocca.josefsson.org> Message-ID: <20070815100331.GB4422@downhill.g.la> On 2007-08-15 Simon Josefsson wrote: > This is scheduled to be the last release on the development branch. > Unless I hear anything, I will release this as v2.0 on September 1th. > Test this release as you would a new stable release! All feedback is > welcome... [...] Hello, Unnecessary warnings: #1 gnutls_openpgp.c:1297: warning: implicit declaration of function '_gnutls_sign' #include #2 x509self.c:203: warning: implicit declaration of function 'print_info' Move #include "ex-session-info.c" #include "ex-x509-info.c" from line ~400 to the top of the file. #3. The existence of two similar print_info() functions in doc/examples/ex-session-info.c and src/common.c is a little bit strange, and neither of these handles all currently available values for gnutls_credentials_type_t: ex-session-info.c:32: warning: enumeration value 'GNUTLS_CRD_PSK' not handled in switch ex-session-info.c:32: warning: enumeration value 'GNUTLS_CRD_IA' not handled in switch common.c:494: warning: enumeration value 'GNUTLS_CRD_IA' not handled in switch thanks, 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' -------------- next part -------------- A non-text attachment was scrubbed... Name: 15_getridofimplicit1.diff Type: text/x-diff Size: 358 bytes Desc: not available Url : /pipermail/attachments/20070815/f404b9ae/attachment-0002.bin -------------- next part -------------- A non-text attachment was scrubbed... Name: 15_getridofimplicit2.diff Type: text/x-diff Size: 452 bytes Desc: not available Url : /pipermail/attachments/20070815/f404b9ae/attachment-0003.bin From simon at josefsson.org Wed Aug 15 13:45:20 2007 From: simon at josefsson.org (Simon Josefsson) Date: Wed, 15 Aug 2007 13:45:20 +0200 Subject: [gnutls-dev] GnuTLS 1.7.17 -- Last call for next stable major release v2.0! In-Reply-To: <20070815100331.GB4422@downhill.g.la> (Andreas Metzler's message of "Wed, 15 Aug 2007 12:03:31 +0200") References: <87sl6lso1y.fsf@mocca.josefsson.org> <20070815100331.GB4422@downhill.g.la> Message-ID: <87odh9yqb3.fsf@mocca.josefsson.org> Andreas Metzler writes: > On 2007-08-15 Simon Josefsson wrote: >> This is scheduled to be the last release on the development branch. >> Unless I hear anything, I will release this as v2.0 on September 1th. >> Test this release as you would a new stable release! All feedback is >> welcome... > [...] > > Hello, > Unnecessary warnings: > #1 > gnutls_openpgp.c:1297: warning: implicit declaration of function '_gnutls_sign' > > #include > > #2 > x509self.c:203: warning: implicit declaration of function 'print_info' > > Move > #include "ex-session-info.c" > #include "ex-x509-info.c" > from line ~400 to the top of the file. Patches applied, thanks! > #3. The existence of two similar print_info() functions in > doc/examples/ex-session-info.c and src/common.c is a little bit > strange, and neither of these handles all currently available values for > gnutls_credentials_type_t: > > ex-session-info.c:32: warning: enumeration value 'GNUTLS_CRD_PSK' not handled in switch > ex-session-info.c:32: warning: enumeration value 'GNUTLS_CRD_IA' not handled in switch > > common.c:494: warning: enumeration value 'GNUTLS_CRD_IA' not handled in switch I'll look into this. /Simon From ametzler at downhill.at.eu.org Wed Aug 15 18:26:51 2007 From: ametzler at downhill.at.eu.org (Andreas Metzler) Date: Wed, 15 Aug 2007 18:26:51 +0200 Subject: [gnutls-dev] Bad record MAC with a Nokia E90 Message-ID: <20070815162651.GB3741@downhill.g.la> Hello, this is http://bugs.debian.org/438137 submitted by Marc Haber for gnutls 1.7.16: When a Nokia E90 connects to a gnutls-serv, then connection is not established and it aborts with "Bad record MAC". [...] gnutls-serv output is attached an Marc will surely be available to add additional info if necessary. thanks, 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' -------------- next part -------------- |<7>| READ: Got 5 bytes from 5 |<7>| READ: read 5 bytes from 5 |<7>| 0000 - 16 03 00 00 45 |<7>| RB: Have 0 bytes into buffer. Adding 5 bytes. |<7>| RB: Requested 5 bytes |<4>| REC[8077a48]: Expected Packet[0] Handshake(22) with length: 1 |<4>| REC[8077a48]: Received Packet[0] Handshake(22) with length: 69 |<7>| READ: Got 69 bytes from 5 |<7>| READ: read 69 bytes from 5 |<7>| 0000 - 01 00 00 41 03 01 46 c3 21 e2 5b d2 cb f0 99 5d |<7>| 0001 - 69 5c 03 eb 5f 28 0d 8d 48 b2 65 d0 c6 39 17 d9 |<7>| 0002 - d0 ca 4e 61 0b cf 00 00 1a 00 35 00 2f 00 0a 00 |<7>| 0003 - 16 00 13 00 05 00 04 00 09 00 12 00 08 00 03 00 |<7>| 0004 - 11 00 14 01 00 |<7>| RB: Have 5 bytes into buffer. Adding 69 bytes. |<7>| RB: Requested 74 bytes |<4>| REC[8077a48]: Decrypted Packet[0] Handshake(22) with length: 69 |<6>| BUF[HSK]: Inserted 69 bytes of Data(22) |<6>| BUF[REC][HD]: Read 1 bytes of Data(22) |<6>| BUF[REC][HD]: Read 3 bytes of Data(22) |<3>| HSK[8077a48]: CLIENT HELLO was received [69 bytes] |<6>| BUF[REC][HD]: Read 65 bytes of Data(22) |<6>| BUF[HSK]: Peeked 0 bytes of Data |<6>| BUF[HSK]: Emptied buffer |<6>| BUF[HSK]: Inserted 4 bytes of Data |<6>| BUF[HSK]: Inserted 65 bytes of Data |<3>| HSK[8077a48]: Client's version: 3.1 |<2>| ASSERT: gnutls_db.c:327 |<2>| ASSERT: gnutls_db.c:247 |<3>| HSK[8077a48]: Selected Compression Method: NULL |<2>| ASSERT: gnutls_extensions.c:162 |<3>| HSK[8077a48]: Removing ciphersuite: PSK_SHA_ARCFOUR_SHA1 |<3>| HSK[8077a48]: Removing ciphersuite: PSK_SHA_3DES_EDE_CBC_SHA1 |<3>| HSK[8077a48]: Removing ciphersuite: PSK_SHA_AES_128_CBC_SHA1 |<3>| HSK[8077a48]: Removing ciphersuite: PSK_SHA_AES_256_CBC_SHA1 |<3>| HSK[8077a48]: Removing ciphersuite: DHE_PSK_SHA_ARCFOUR_SHA1 |<3>| HSK[8077a48]: Removing ciphersuite: DHE_PSK_SHA_3DES_EDE_CBC_SHA1 |<3>| HSK[8077a48]: Removing ciphersuite: DHE_PSK_SHA_AES_128_CBC_SHA1 |<3>| HSK[8077a48]: Removing ciphersuite: DHE_PSK_SHA_AES_256_CBC_SHA1 |<3>| HSK[8077a48]: Removing ciphersuite: SRP_SHA_3DES_EDE_CBC_SHA1 |<3>| HSK[8077a48]: Removing ciphersuite: SRP_SHA_AES_128_CBC_SHA1 |<3>| HSK[8077a48]: Removing ciphersuite: SRP_SHA_AES_256_CBC_SHA1 |<3>| HSK[8077a48]: Removing ciphersuite: SRP_SHA_DSS_3DES_EDE_CBC_SHA1 |<3>| HSK[8077a48]: Removing ciphersuite: SRP_SHA_RSA_3DES_EDE_CBC_SHA1 |<3>| HSK[8077a48]: Removing ciphersuite: SRP_SHA_DSS_AES_128_CBC_SHA1 |<3>| HSK[8077a48]: Removing ciphersuite: SRP_SHA_RSA_AES_128_CBC_SHA1 |<3>| HSK[8077a48]: Removing ciphersuite: SRP_SHA_DSS_AES_256_CBC_SHA1 |<3>| HSK[8077a48]: Removing ciphersuite: SRP_SHA_RSA_AES_256_CBC_SHA1 |<3>| HSK[8077a48]: Removing ciphersuite: DHE_DSS_ARCFOUR_SHA1 |<3>| HSK[8077a48]: Removing ciphersuite: DHE_DSS_3DES_EDE_CBC_SHA1 |<3>| HSK[8077a48]: Removing ciphersuite: DHE_DSS_AES_128_CBC_SHA1 |<3>| HSK[8077a48]: Removing ciphersuite: DHE_DSS_AES_256_CBC_SHA1 |<3>| HSK[8077a48]: Keeping ciphersuite: DHE_RSA_3DES_EDE_CBC_SHA1 |<3>| HSK[8077a48]: Keeping ciphersuite: DHE_RSA_AES_128_CBC_SHA1 |<3>| HSK[8077a48]: Keeping ciphersuite: DHE_RSA_AES_256_CBC_SHA1 |<3>| HSK[8077a48]: Keeping ciphersuite: RSA_ARCFOUR_SHA1 |<3>| HSK[8077a48]: Keeping ciphersuite: RSA_ARCFOUR_MD5 |<3>| HSK[8077a48]: Keeping ciphersuite: RSA_3DES_EDE_CBC_SHA1 |<3>| HSK[8077a48]: Keeping ciphersuite: RSA_AES_128_CBC_SHA1 |<3>| HSK[8077a48]: Keeping ciphersuite: RSA_AES_256_CBC_SHA1 |<3>| HSK[8077a48]: Selected cipher suite: RSA_AES_256_CBC_SHA1 |<2>| ASSERT: ext_authz.c:180 |<2>| ASSERT: ext_authz.c:237 |<3>| HSK[8077a48]: SessionID: 7481960c5ef0ef5f494fcec07334940612fd0e490d4a2ea5ebc591d1158075ba |<3>| HSK[8077a48]: SERVER HELLO was send [74 bytes] |<6>| BUF[HSK]: Peeked 69 bytes of Data |<6>| BUF[HSK]: Emptied buffer |<4>| REC[8077a48]: Sending Packet[0] Handshake(22) with length: 74 |<7>| WRITE: Will write 79 bytes to 5. |<7>| WRITE: wrote 79 bytes to 5. Left 0 bytes. Total 79 bytes. |<7>| 0000 - 16 03 01 00 4a 02 00 00 46 03 01 46 c3 21 fc d4 |<7>| 0001 - 60 16 a3 e6 b5 1a f0 1c 79 e2 04 0a d5 29 30 5c |<7>| 0002 - 26 99 f0 74 45 73 d5 f5 c3 fc 7d 20 74 81 96 0c |<7>| 0003 - 5e f0 ef 5f 49 4f ce c0 73 34 94 06 12 fd 0e 49 |<7>| 0004 - 0d 4a 2e a5 eb c5 91 d1 15 80 75 ba 00 35 00 |<4>| REC[8077a48]: Sent Packet[1] Handshake(22) with length: 79 |<3>| HSK[8077a48]: CERTIFICATE was send [669 bytes] |<6>| BUF[HSK]: Peeked 0 bytes of Data |<6>| BUF[HSK]: Emptied buffer |<4>| REC[8077a48]: Sending Packet[1] Handshake(22) with length: 669 |<7>| WRITE: Will write 674 bytes to 5. |<7>| WRITE: wrote 674 bytes to 5. Left 0 bytes. Total 674 bytes. |<7>| 0000 - 16 03 01 02 9d 0b 00 02 99 00 02 96 00 02 93 30 |<7>| 0001 - 82 02 8f 30 82 01 f8 02 09 00 a1 4d 2c 3c 2a 6f |<7>| 0002 - 46 a6 30 0d 06 09 2a 86 48 86 f7 0d 01 01 05 05 |<7>| 0003 - 00 30 81 8b 31 0b 30 09 06 03 55 04 06 13 02 44 |<7>| 0004 - 45 31 11 30 0f 06 03 55 04 07 13 08 4d 61 6e 6e |<7>| 0005 - 68 65 69 6d 31 12 30 10 06 03 55 04 0a 13 09 5a |<7>| 0006 - 75 67 73 63 68 6c 75 73 31 1e 30 1c 06 03 55 04 |<7>| 0007 - 03 13 15 6e 65 63 68 61 79 65 76 2e 7a 75 67 73 |<7>| 0008 - 63 68 6c 75 73 2e 64 65 31 35 30 33 06 09 2a 86 |<7>| 0009 - 48 86 f7 0d 01 09 01 16 26 6d 68 2b 6e 65 63 68 |<7>| 000a - 61 79 65 76 2d 65 78 69 6d 2d 74 6c 73 2d 63 65 |<7>| 000b - 72 74 40 7a 75 67 73 63 68 6c 75 73 2e 64 65 30 |<7>| 000c - 1e 17 0d 30 36 31 31 30 34 31 39 30 37 34 37 5a |<7>| 000d - 17 0d 30 39 31 31 30 33 31 39 30 37 34 37 5a 30 |<7>| 000e - 81 8b 31 0b 30 09 06 03 55 04 06 13 02 44 45 31 |<7>| 000f - 11 30 0f 06 03 55 04 07 13 08 4d 61 6e 6e 68 65 |<7>| 0010 - 69 6d 31 12 30 10 06 03 55 04 0a 13 09 5a 75 67 |<7>| 0011 - 73 63 68 6c 75 73 31 1e 30 1c 06 03 55 04 03 13 |<7>| 0012 - 15 6e 65 63 68 61 79 65 76 2e 7a 75 67 73 63 68 |<7>| 0013 - 6c 75 73 2e 64 65 31 35 30 33 06 09 2a 86 48 86 |<7>| 0014 - f7 0d 01 09 01 16 26 6d 68 2b 6e 65 63 68 61 79 |<7>| 0015 - 65 76 2d 65 78 69 6d 2d 74 6c 73 2d 63 65 72 74 |<7>| 0016 - 40 7a 75 67 73 63 68 6c 75 73 2e 64 65 30 81 9f |<7>| 0017 - 30 0d 06 09 2a 86 48 86 f7 0d 01 01 01 05 00 03 |<7>| 0018 - 81 8d 00 30 81 89 02 81 81 00 b7 ee 8e cb 06 da |<7>| 0019 - 0d 84 db 47 b1 73 eb f0 05 ed 66 de 75 4b 2c 19 |<7>| 001a - c8 cf e9 54 64 94 ea 2e 9a 10 99 30 76 7b f0 c6 |<7>| 001b - 11 7e 53 54 ba 63 1e ef c3 f6 8e 54 03 48 f0 60 |<7>| 001c - e5 02 da 7b 32 20 22 ba 9c fa 41 ba ea 01 ba 96 |<7>| 001d - d2 ba 37 b8 33 03 35 88 1c 3b c6 72 8f 16 d7 83 |<7>| 001e - fb c3 3c 95 4e 84 fb 07 1c 0c a8 8d 92 d4 d1 fa |<7>| 001f - 87 d9 b4 b0 a8 97 c2 c0 7b 02 77 3c 57 7d ed 12 |<7>| 0020 - 67 1e c2 d1 be 3b 7b ae 67 5f 02 03 01 00 01 30 |<7>| 0021 - 0d 06 09 2a 86 48 86 f7 0d 01 01 05 05 00 03 81 |<7>| 0022 - 81 00 19 d5 cb 24 d2 c6 26 80 2b 30 4d 92 9f b8 |<7>| 0023 - 14 81 ee 80 0e 6c 79 73 2e 29 6b 6e da 68 0d 85 |<7>| 0024 - c7 ef 4d f9 c9 40 d7 3b de 00 e8 45 7c ad b6 0b |<7>| 0025 - c6 e6 a4 ff 69 ca 95 42 05 c1 b2 05 44 c9 b4 4e |<7>| 0026 - 99 1b 21 ef dc 72 65 86 ae 0d 14 11 ab 24 a6 9b |<7>| 0027 - 5b 5f cc 98 9c 56 94 6f 4e bc 16 3e 19 c1 53 43 |<7>| 0028 - 6f 5f 21 41 ce e1 6c 74 4a ba 4c 06 6d fd 20 7b |<7>| 0029 - 2f 01 da 46 38 a0 24 de e9 1f cd ad 4b d9 1e c9 |<7>| 002a - f9 fc |<4>| REC[8077a48]: Sent Packet[2] Handshake(22) with length: 674 |<3>| HSK[8077a48]: CERTIFICATE REQUEST was send [9 bytes] |<6>| BUF[HSK]: Peeked 0 bytes of Data |<6>| BUF[HSK]: Emptied buffer |<4>| REC[8077a48]: Sending Packet[2] Handshake(22) with length: 9 |<7>| WRITE: Will write 14 bytes to 5. |<7>| WRITE: wrote 14 bytes to 5. Left 0 bytes. Total 14 bytes. |<7>| 0000 - 16 03 01 00 09 0d 00 00 05 02 01 02 00 00 |<4>| REC[8077a48]: Sent Packet[3] Handshake(22) with length: 14 |<3>| HSK[8077a48]: SERVER HELLO DONE was send [4 bytes] |<6>| BUF[HSK]: Peeked 0 bytes of Data |<6>| BUF[HSK]: Emptied buffer |<4>| REC[8077a48]: Sending Packet[3] Handshake(22) with length: 4 |<7>| WRITE: Will write 9 bytes to 5. |<7>| WRITE: wrote 9 bytes to 5. Left 0 bytes. Total 9 bytes. |<7>| 0000 - 16 03 01 00 04 0e 00 00 00 |<4>| REC[8077a48]: Sent Packet[4] Handshake(22) with length: 9 |<7>| READ: -1 returned from 5, errno=11 gerrno=0 |<2>| ASSERT: gnutls_buffers.c:360 |<2>| ASSERT: gnutls_buffers.c:1188 |<2>| ASSERT: gnutls_handshake.c:962 |<7>| READ: Got 5 bytes from 5 |<7>| READ: read 5 bytes from 5 |<7>| 0000 - 16 03 01 00 07 |<7>| RB: Have 0 bytes into buffer. Adding 5 bytes. |<7>| RB: Requested 5 bytes |<4>| REC[8077a48]: Expected Packet[1] Handshake(22) with length: 1 |<4>| REC[8077a48]: Received Packet[1] Handshake(22) with length: 7 |<7>| READ: Got 7 bytes from 5 |<7>| READ: read 7 bytes from 5 |<7>| 0000 - 0b 00 00 03 00 00 00 |<7>| RB: Have 5 bytes into buffer. Adding 7 bytes. |<7>| RB: Requested 12 bytes |<4>| REC[8077a48]: Decrypted Packet[1] Handshake(22) with length: 7 |<6>| BUF[HSK]: Inserted 7 bytes of Data(22) |<6>| BUF[REC][HD]: Read 1 bytes of Data(22) |<6>| BUF[REC][HD]: Read 3 bytes of Data(22) |<3>| HSK[8077a48]: CERTIFICATE was received [7 bytes] |<6>| BUF[REC][HD]: Read 3 bytes of Data(22) |<6>| BUF[HSK]: Peeked 0 bytes of Data |<6>| BUF[HSK]: Emptied buffer |<6>| BUF[HSK]: Inserted 4 bytes of Data |<6>| BUF[HSK]: Inserted 3 bytes of Data |<2>| ASSERT: auth_cert.c:874 |<7>| READ: -1 returned from 5, errno=11 gerrno=0 |<2>| ASSERT: gnutls_buffers.c:360 |<2>| ASSERT: gnutls_buffers.c:1188 |<2>| ASSERT: gnutls_handshake.c:962 |<7>| READ: Got 5 bytes from 5 |<7>| READ: read 5 bytes from 5 |<7>| 0000 - 16 03 01 00 86 |<7>| RB: Have 0 bytes into buffer. Adding 5 bytes. |<7>| RB: Requested 5 bytes |<4>| REC[8077a48]: Expected Packet[2] Handshake(22) with length: 1 |<4>| REC[8077a48]: Received Packet[2] Handshake(22) with length: 134 |<7>| READ: Got 134 bytes from 5 |<7>| READ: read 134 bytes from 5 |<7>| 0000 - 10 00 00 82 00 80 94 b7 c8 81 16 34 f2 09 78 ce |<7>| 0001 - f7 72 59 a7 98 52 15 ab 67 2a 8d 4d 31 43 50 0c |<7>| 0002 - 89 20 9f d8 1c 21 3e 83 56 c4 e3 20 1a 83 e3 a5 |<7>| 0003 - 13 e2 ac 76 41 00 4c 77 90 a5 21 24 df 93 aa ba |<7>| 0004 - c5 10 4f 17 92 fd d2 e3 55 ce 06 e7 0d 1c 5c 2a |<7>| 0005 - f2 10 af 9e 5b dd 28 8c 72 42 62 2f 65 24 07 d9 |<7>| 0006 - ce ea 6f 89 84 2a f6 0d d4 e3 da 4d 63 a2 ad 34 |<7>| 0007 - 5c 8f 70 6b 1a 5e f0 43 8e af 26 0f d6 32 64 4c |<7>| 0008 - f0 ba b7 a4 0b c5 |<7>| RB: Have 5 bytes into buffer. Adding 134 bytes. |<7>| RB: Requested 139 bytes |<4>| REC[8077a48]: Decrypted Packet[2] Handshake(22) with length: 134 |<6>| BUF[HSK]: Inserted 134 bytes of Data(22) |<6>| BUF[REC][HD]: Read 1 bytes of Data(22) |<6>| BUF[REC][HD]: Read 3 bytes of Data(22) |<3>| HSK[8077a48]: CLIENT KEY EXCHANGE was received [134 bytes] |<6>| BUF[REC][HD]: Read 130 bytes of Data(22) |<6>| BUF[HSK]: Peeked 7 bytes of Data |<6>| BUF[HSK]: Emptied buffer |<6>| BUF[HSK]: Inserted 4 bytes of Data |<6>| BUF[HSK]: Inserted 130 bytes of Data |<7>| READ: Got 5 bytes from 5 |<7>| READ: read 5 bytes from 5 |<7>| 0000 - 14 03 01 00 01 |<7>| RB: Have 0 bytes into buffer. Adding 5 bytes. |<7>| RB: Requested 5 bytes |<4>| REC[8077a48]: Expected Packet[3] Change Cipher Spec(20) with length: 1 |<4>| REC[8077a48]: Received Packet[3] Change Cipher Spec(20) with length: 1 |<7>| READ: Got 1 bytes from 5 |<7>| READ: read 1 bytes from 5 |<7>| 0000 - 01 |<7>| RB: Have 5 bytes into buffer. Adding 1 bytes. |<7>| RB: Requested 6 bytes |<4>| REC[8077a48]: ChangeCipherSpec Packet was received |<9>| INT: PREMASTER SECRET[48]: 0301de4cfe3f465e09960956fa07dc1966f9a368aeeb8756750ebb96e000f083cc0f92820d104b936401d17fb43c756a |<9>| INT: CLIENT RANDOM[32]: 46c321e25bd2cbf0995d695c03eb5f280d8d48b265d0c63917d9d0ca4e610bcf |<9>| INT: SERVER RANDOM[32]: 46c321fcd46016a3e6b51af01c79e2040ad529305c2699f0744573d5f5c3fc7d |<9>| INT: MASTER SECRET: 21bdab4b4fbf672cf9c2c71fd4cbb1cdafafc042a71e2612ea290ba482aa9faa81a462a055629ca2013702a654b93215 |<9>| INT: KEY BLOCK[136]: 81286440bd6c3af4fc1971ccd8a208bd231410f4aaf9ef048f2d381f05f2095e |<9>| INT: CLIENT WRITE KEY [32]: ae3a3530f37c3009edad3d55dff8fc90fb44ca7dbac89515f36b19ffb1328366 |<9>| INT: SERVER WRITE KEY [32]: 06a37896508f12096c11d87b6fa738d7920c78e18a91d5d7ffcff4ffeff306d1 |<3>| HSK[8077a48]: Cipher Suite: RSA_AES_256_CBC_SHA1 |<3>| HSK[8077a48]: Initializing internal [read] cipher sessions |<7>| READ: Got 5 bytes from 5 |<7>| READ: read 5 bytes from 5 |<7>| 0000 - 16 03 01 00 30 |<7>| RB: Have 0 bytes into buffer. Adding 5 bytes. |<7>| RB: Requested 5 bytes |<4>| REC[8077a48]: Expected Packet[0] Handshake(22) with length: 1 |<4>| REC[8077a48]: Received Packet[0] Handshake(22) with length: 48 |<7>| READ: Got 48 bytes from 5 |<7>| READ: read 48 bytes from 5 |<7>| 0000 - 07 e9 6a 55 67 a4 8d 16 b5 d2 98 1e 17 76 21 06 |<7>| 0001 - 9a 50 65 04 6d 2c b5 5c 5e 3a 7a 75 f5 7b 94 5a |<7>| 0002 - 56 ce cb f0 f4 00 08 3c 2b f1 0f 21 90 10 01 2b |<7>| 0003 - |<7>| RB: Have 5 bytes into buffer. Adding 48 bytes. |<7>| RB: Requested 53 bytes |<4>| REC[8077a48]: Decrypted Packet[0] Handshake(22) with length: 16 |<6>| BUF[HSK]: Inserted 16 bytes of Data(22) |<6>| BUF[REC][HD]: Read 1 bytes of Data(22) |<6>| BUF[REC][HD]: Read 3 bytes of Data(22) |<3>| HSK[8077a48]: FINISHED was received [16 bytes] |<6>| BUF[REC][HD]: Read 12 bytes of Data(22) |<6>| BUF[HSK]: Peeked 134 bytes of Data |<6>| BUF[HSK]: Emptied buffer |<6>| BUF[HSK]: Inserted 4 bytes of Data |<6>| BUF[HSK]: Inserted 12 bytes of Data |<3>| REC[8077a48]: Sent ChangeCipherSpec |<4>| REC[8077a48]: Sending Packet[4] Change Cipher Spec(20) with length: 1 |<7>| WRITE: Will write 6 bytes to 5. |<7>| WRITE: wrote 6 bytes to 5. Left 0 bytes. Total 6 bytes. |<7>| 0000 - 14 03 01 00 01 01 |<4>| REC[8077a48]: Sent Packet[5] Change Cipher Spec(20) with length: 6 |<3>| HSK[8077a48]: Cipher Suite: RSA_AES_256_CBC_SHA1 |<3>| HSK[8077a48]: Initializing internal [write] cipher sessions |<6>| BUF[HSK]: Peeked 16 bytes of Data |<6>| BUF[HSK]: Emptied buffer |<3>| HSK[8077a48]: FINISHED was send [16 bytes] |<6>| BUF[HSK]: Peeked 0 bytes of Data |<6>| BUF[HSK]: Emptied buffer |<4>| REC[8077a48]: Sending Packet[0] Handshake(22) with length: 16 |<7>| WRITE: Will write 197 bytes to 5. |<7>| WRITE: wrote 197 bytes to 5. Left 0 bytes. Total 197 bytes. |<7>| 0000 - 16 03 01 00 c0 9f 22 58 5d 6b a1 55 e1 a4 07 44 |<7>| 0001 - dd 3b b7 52 f4 2a 11 80 d9 f8 28 99 2d 70 8b 4e |<7>| 0002 - 2a 7c eb a6 9a f9 12 58 f8 6a 01 0a 7d c2 7b 0d |<7>| 0003 - 94 e9 9f 8e 1e e7 c1 b6 1a 24 08 9b 20 5f da 9a |<7>| 0004 - 88 f3 b0 db 7d 4e 55 98 f6 ad 51 68 d1 fa 46 c3 |<7>| 0005 - f6 63 ee eb 04 a4 04 c9 7f de c8 f2 30 78 d9 20 |<7>| 0006 - b3 c5 25 46 c5 c1 56 08 67 ef 32 bb f2 72 5b ff |<7>| 0007 - 9a 1c d3 d7 92 83 6e b8 b3 2e 6d bc 06 fe 41 ea |<7>| 0008 - 84 c5 4c 86 77 42 75 fc ef d0 0e 7f 48 6a 75 a6 |<7>| 0009 - 53 df a0 d6 83 c5 23 63 77 36 82 a3 fb 5a f9 b2 |<7>| 000a - 93 c7 43 2d e5 1b c1 02 5f d8 97 19 50 1a 6b 4c |<7>| 000b - 89 13 e9 cf 3b fc ed be da a9 70 b2 20 53 0f e6 |<7>| 000c - 99 4d 59 d1 c7 |<4>| REC[8077a48]: Sent Packet[1] Handshake(22) with length: 197 |<6>| BUF[HSK]: Cleared Data from buffer No certificates found! Set static Diffie Hellman parameters, consider --dhparams. Echo Server ready. Listening to port '1025'. * connection from ::ffff:194.95.226.145, port 57356 - Certificate type: X.509 - Peer did not send any certificate. - Version: TLS 1.0 - Key Exchange: RSA - Cipher: AES 256 CBC - MAC: SHA - Compression: NULL |<7>| READ: -1 returned from 5, errno=11 gerrno=0 |<2>| ASSERT: gnutls_buffers.c:360 |<7>| READ: Got 5 bytes from 5 |<7>| READ: read 5 bytes from 5 |<7>| 0000 - 15 03 01 00 20 |<7>| RB: Have 0 bytes into buffer. Adding 5 bytes. |<7>| RB: Requested 5 bytes |<4>| REC[8077a48]: Expected Packet[1] Application Data(23) with length: 1024 |<4>| REC[8077a48]: Received Packet[1] Alert(21) with length: 32 |<7>| READ: Got 32 bytes from 5 |<7>| READ: read 32 bytes from 5 |<7>| 0000 - 77 34 96 83 39 f1 c0 56 bb f9 89 3e 23 95 d1 5f |<7>| 0001 - f6 54 80 d8 60 6a 3c 62 60 8e cc dc 64 bc 0f 9d |<7>| 0002 - |<7>| RB: Have 5 bytes into buffer. Adding 32 bytes. |<7>| RB: Requested 37 bytes |<4>| REC[8077a48]: Decrypted Packet[1] Alert(21) with length: 2 |<4>| REC[8077a48]: Alert[2|20] - Bad record MAC - was received |<2>| ASSERT: gnutls_record.c:681 |<2>| ASSERT: gnutls_record.c:1028 Error while receiving data |<4>| REC: Sending Alert[1|0] - Close notify |<4>| REC[8077a48]: Sending Packet[1] Alert(21) with length: 2 |<7>| WRITE: Will write 53 bytes to 5. |<7>| WRITE: wrote 53 bytes to 5. Left 0 bytes. Total 53 bytes. |<7>| 0000 - 15 03 01 00 30 e5 14 68 8a ed 5a d2 27 cc fb 6f |<7>| 0001 - 74 66 dd c5 b2 40 e0 98 d5 ab a2 bd b6 7c b4 04 |<7>| 0002 - b7 6f 28 b7 2a 45 29 29 80 37 b5 6f 7a aa 21 19 |<7>| 0003 - 22 38 50 ae f0 |<4>| REC[8077a48]: Sent Packet[2] Alert(21) with length: 53 From simon at josefsson.org Wed Aug 15 19:21:42 2007 From: simon at josefsson.org (Simon Josefsson) Date: Wed, 15 Aug 2007 19:21:42 +0200 Subject: [gnutls-dev] png images referenced in info docs not installed (#423577) In-Reply-To: <873b1icq5i.fsf@mocca.josefsson.org> (Simon Josefsson's message of "Sun, 27 May 2007 16:11:37 +0200") References: <20070527111454.GD3725@downhill.g.la> <873b1icq5i.fsf@mocca.josefsson.org> Message-ID: <87odh8yaqh.fsf@mocca.josefsson.org> Simon Josefsson writes: > Andreas Metzler writes: > >> Hello, >> this was reported by Kevin Ryde in >> . gnutls' info docs refer/include a >> couple of png-images, however make install does not install them. >> >> Since installing a file of the generic name "internals.png" directly >> into /usr/share/info might result in conflicts with other software >> using a dedicated subdirectory (gnutls/) seems to be the way to solve >> this. > > How to deal with this properly is probably something that could be > discussed with the texinfo maintainers and/or gnu-hackers, I'll forward > the question. The resolution is not elegant, but I don't see any other option: http://thread.gmane.org/gmane.comp.tex.texinfo.bugs/3533 I have used this approach for some time in libidn, and it has worked fine. I have fixed this in gnutls git. There will likely be another release before the real one, to test that everything works, but I don't expect the real release to be delayed. Btw, the debian stuff need to make sure that /usr/share/info/gnutls*.png is included in the gnutls-doc package. /Simon From simon at josefsson.org Wed Aug 15 19:31:41 2007 From: simon at josefsson.org (Simon Josefsson) Date: Wed, 15 Aug 2007 19:31:41 +0200 Subject: [gnutls-dev] Bad record MAC with a Nokia E90 In-Reply-To: <20070815162651.GB3741@downhill.g.la> (Andreas Metzler's message of "Wed, 15 Aug 2007 18:26:51 +0200") References: <20070815162651.GB3741@downhill.g.la> Message-ID: <87k5rwya9u.fsf@mocca.josefsson.org> Andreas Metzler writes: > Hello, > this is http://bugs.debian.org/438137 submitted by Marc Haber for > gnutls 1.7.16: Thanks. Isn't this the same as #402861 aka #390712? I do have a Nokia 6233 and a Noka N80, but setting up the environment to debug this takes time and I'm afraid I'm too busy to do this at the moment. The tag 'help' is appropriate. /Simon From ametzler at downhill.at.eu.org Wed Aug 15 19:52:06 2007 From: ametzler at downhill.at.eu.org (Andreas Metzler) Date: Wed, 15 Aug 2007 19:52:06 +0200 Subject: [gnutls-dev] Bad record MAC with a Nokia E90 In-Reply-To: <87k5rwya9u.fsf@mocca.josefsson.org> References: <20070815162651.GB3741@downhill.g.la> <87k5rwya9u.fsf@mocca.josefsson.org> Message-ID: <20070815175206.GC3741@downhill.g.la> On 2007-08-15 Simon Josefsson wrote: > Andreas Metzler writes: > > Hello, > > this is http://bugs.debian.org/438137 submitted by Marc Haber for > > gnutls 1.7.16: > Thanks. Isn't this the same as #402861 aka #390712? [...] They do look similar indeed. Just different Phones (Nokia <> Ericsson). 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 downhill.at.eu.org Wed Aug 15 19:54:58 2007 From: ametzler at downhill.at.eu.org (Andreas Metzler) Date: Wed, 15 Aug 2007 19:54:58 +0200 Subject: [gnutls-dev] Bug#423577: png images referenced in info docs not installed (#423577) In-Reply-To: <87odh8yaqh.fsf@mocca.josefsson.org> References: <20070527111454.GD3725@downhill.g.la> <873b1icq5i.fsf@mocca.josefsson.org> <87odh8yaqh.fsf@mocca.josefsson.org> Message-ID: <20070815175458.GD3741@downhill.g.la> On 2007-08-15 Simon Josefsson wrote: [...] > Btw, the debian stuff need to make sure that /usr/share/info/gnutls*.png > is included in the gnutls-doc package. Thanks for the reminder. 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 simon at josefsson.org Wed Aug 15 20:00:32 2007 From: simon at josefsson.org (Simon Josefsson) Date: Wed, 15 Aug 2007 20:00:32 +0200 Subject: [gnutls-dev] Bug tracking on http://www.gnu.org/software/gnutls/bugs.html Message-ID: <87fy2ky8xr.fsf@mocca.josefsson.org> I created a web page with links to various bug trackers that contain information about bugs in GnuTLS: http://www.gnu.org/software/gnutls/bugs.html I've found a couple of unreported things already... sigh. If people can think of more places to check, feel free to mention them. I guess we're approaching the point when a real gnutls-specific bug tracker is useful. /Simon From simon at josefsson.org Thu Aug 16 14:09:56 2007 From: simon at josefsson.org (Simon Josefsson) Date: Thu, 16 Aug 2007 14:09:56 +0200 Subject: [gnutls-dev] Bad record MAC with a Nokia E90 In-Reply-To: <20070815175206.GC3741@downhill.g.la> (Andreas Metzler's message of "Wed, 15 Aug 2007 19:52:06 +0200") References: <20070815162651.GB3741@downhill.g.la> <87k5rwya9u.fsf@mocca.josefsson.org> <20070815175206.GC3741@downhill.g.la> Message-ID: <871we3smsr.fsf@mocca.josefsson.org> Andreas Metzler writes: > On 2007-08-15 Simon Josefsson wrote: >> Andreas Metzler writes: > >> > Hello, >> > this is http://bugs.debian.org/438137 submitted by Marc Haber for >> > gnutls 1.7.16: > >> Thanks. Isn't this the same as #402861 aka #390712? > [...] > > They do look similar indeed. Just different Phones (Nokia <> > Ericsson). The 402861 bug title is 'Noka and SE mobile phones', and include information from someone with a Noka E60. I wouldn't be surprised if the phones use the same or a similar TLS implementation. Still, we don't know what the problem is, so leaving them as separate bugs may be the appropriate action.. /Simon From simon at josefsson.org Thu Aug 16 14:42:45 2007 From: simon at josefsson.org (Simon Josefsson) Date: Thu, 16 Aug 2007 14:42:45 +0200 Subject: [gnutls-dev] GnuTLS 1.7.18 Message-ID: <87lkcbps56.fsf@mocca.josefsson.org> A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 419 bytes Desc: not available Url : /pipermail/attachments/20070816/0af61255/attachment.pgp From simon at josefsson.org Thu Aug 16 16:49:45 2007 From: simon at josefsson.org (Simon Josefsson) Date: Thu, 16 Aug 2007 16:49:45 +0200 Subject: [gnutls-dev] Bug tracking on http://www.gnu.org/software/gnutls/bugs.html In-Reply-To: <87fy2ky8xr.fsf@mocca.josefsson.org> (Simon Josefsson's message of "Wed, 15 Aug 2007 20:00:32 +0200") References: <87fy2ky8xr.fsf@mocca.josefsson.org> Message-ID: <87eji3o7p2.fsf@mocca.josefsson.org> Simon Josefsson writes: > I created a web page with links to various bug trackers that contain > information about bugs in GnuTLS: > > http://www.gnu.org/software/gnutls/bugs.html > > I've found a couple of unreported things already... sigh. > > If people can think of more places to check, feel free to mention them. > > I guess we're approaching the point when a real gnutls-specific bug > tracker is useful. Since savannah has a bug tracker for us, I enabled it and added a link to the page above. So if you want to make sure we don't forget about your problem, that is where the official mechanism to register a bug is. Personally, I dislike web based bug trackers without an e-mail interface, but I see that it can be useful to track more long-term bugs for which there is no immediate solution. And some users may prefer it. Note that there is no need to copy all bug reports from other bug trackers into ours though, it won't help get the problem solved faster. /Simon From alon.barlev at gmail.com Sat Aug 18 14:04:14 2007 From: alon.barlev at gmail.com (Alon Bar-Lev) Date: Sat, 18 Aug 2007 15:04:14 +0300 Subject: [gnutls-dev] [RFC] gnutls-pkcs11 Message-ID: <9e0cf0bf0708180504u25ed6bf2n2bd848ef6e787245@mail.gmail.com> Hello all, I would like to receive some input regarding gnutls-pkcs11 API. Source: http://alon.barlev.googlepages.com/gnutls-pkcs11-0.02.tar.bz2 Doc: http://alon.barlev.googlepages.com/gnutls-pkcs11-doc-0.02.tar.bz2 As I am not gnutls developer, I may have done something against the conventions. The main issues PKCS#11 implementation should handle are: 1. Support many variant of PKCS#11 providers' implementations To allow this I added a generic (unimplemented yet) params string to initialization and provider addition. The format would be name=value;name=value; 2. Support many providers at the same time. Most (large) user installation have many types of providers, allowing application to work with all without difference is important. 3. Access to token is not guarantee Even if the token was available at session establishment, it may not be available later on. We should have a way to prompt the user to insert his token when required. 4. Passphrase management Unlike files, token may require passphrase several times during a session, for example if it is removed and insert or it has internal timeout. 5. Identity serialization When certificate is requested, we may have or may not have the required token in the reader. But in order to allow people to select a specific certificate to a specific session, we should be able to serialize the identity so that it can be used in later transactions. So we end up with new type: gnutls_pkcs11_certificate_t. When x509 certificate is needed you can: gnutls_pkcs11_get_crt (pkcs11_cert, &x509) Best Regards, Alon Bar-Lev. From simon at josefsson.org Sat Aug 18 18:57:40 2007 From: simon at josefsson.org (Simon Josefsson) Date: Sat, 18 Aug 2007 18:57:40 +0200 Subject: [gnutls-dev] [RFC] gnutls-pkcs11 In-Reply-To: <9e0cf0bf0708180504u25ed6bf2n2bd848ef6e787245@mail.gmail.com> (Alon Bar-Lev's message of "Sat, 18 Aug 2007 15:04:14 +0300") References: <9e0cf0bf0708180504u25ed6bf2n2bd848ef6e787245@mail.gmail.com> Message-ID: <87d4xkdbln.fsf@mocca.josefsson.org> "Alon Bar-Lev" writes: > Hello all, > > I would like to receive some input regarding gnutls-pkcs11 API. > > Source: > http://alon.barlev.googlepages.com/gnutls-pkcs11-0.02.tar.bz2 > > Doc: > http://alon.barlev.googlepages.com/gnutls-pkcs11-doc-0.02.tar.bz2 > > As I am not gnutls developer, I may have done something against the > conventions. I think I have identified one problem. How do you handle multiple certificates/keys? In the callback, you don't appear to inspect the cert variable, and thus your code cannot know which certificate GnuTLS want to use for signing. That is, if I'm reading the code correctly. I just looked briefly. Consider the following scenario: the user has two certificates with one private keys for each. The certificates are stored in GnuTLS using normal APIs (i.e., gnutls_certificate_set_x509_key_mem with NULL keys). GnuTLS will select the appropriate user cert (one of the two certs) to use against each server, depending on the CA list received from the server. The certificate (which uniquely identify the private) to use for signing is passed in the 'cert' parameter to the sign_callback function. The callback need to locate the private key in the PKCS#11 backend(s) that match that user certificate, and use that key for signing. Otherwise I don't see any issues. /Simon From alon.barlev at gmail.com Sat Aug 18 19:42:11 2007 From: alon.barlev at gmail.com (Alon Bar-Lev) Date: Sat, 18 Aug 2007 20:42:11 +0300 Subject: [gnutls-dev] [RFC] gnutls-pkcs11 In-Reply-To: <87d4xkdbln.fsf@mocca.josefsson.org> References: <9e0cf0bf0708180504u25ed6bf2n2bd848ef6e787245@mail.gmail.com> <87d4xkdbln.fsf@mocca.josefsson.org> Message-ID: <9e0cf0bf0708181042r7398d01bkbb9464a355d57159@mail.gmail.com> Hello Simon, On 8/18/07, Simon Josefsson wrote: > I think I have identified one problem. How do you handle multiple > certificates/keys? In the callback, you don't appear to inspect the > cert variable, and thus your code cannot know which certificate GnuTLS > want to use for signing. > > That is, if I'm reading the code correctly. I just looked briefly. Maybe I don't understand your API correctly... > Consider the following scenario: the user has two certificates with one > private keys for each. The certificates are stored in GnuTLS using > normal APIs (i.e., gnutls_certificate_set_x509_key_mem with NULL keys). > GnuTLS will select the appropriate user cert (one of the two certs) to > use against each server, depending on the CA list received from the > server. The certificate (which uniquely identify the private) to use > for signing is passed in the 'cert' parameter to the sign_callback > function. The callback need to locate the private key in the PKCS#11 > backend(s) that match that user certificate, and use that key for > signing. I thought all the above scenario is done in: cert_callback set by gnutls_certificate_client_set_retrieve_function(). So you do have a chance to do the above logic... But you say that gnutls have some automatic method for this... I was not aware of it... (The term "set" is misleading... Should be "add"...) And now I get why you added the certificate into the sign callback... I let it go last time... But here it is back... Seems I cannot escape from it :) I don't understand how did you expect people to use this... Here are some of my thoughts... 1. You assume a static list of available certificates and objects is available to application, so that you can call gnutls_certificate_set_x509_key_mem() at initialization. But this is not true with smartcard aware application, as the user may insert his smartcard after initializtion. 2. You don't allow passing user data for the gnutls_certificate_set_x509_key_mem() function, so the application has to enumerate all available certificates during initialization, and then again enumerate all available certificates in sign callback in order to find a match. 3. Even if you allow to pass user data, it will solve (2), but there is an issue with resource cleaning, is there a callback to take the user data during credential clean? Of course I can put some user data in the session that have a reference between a certificate and its private key data, but this looks like a bad idea. 4. Do you expect building a new credentials object before each session? Maybe if you do, I understand (1) solution... But not the way the callback be efficiently implemented. I may be wrong... But the simpler approach of gnutls_certificate_client_set_retrieve_function() is more generic... A helper function will can be appropriate (maybe you already have it), that receives the callback parameters and a list of end certificate and return the index of the best certificate to use. This function be be called at the cert_callback without any resource/user implications. But as I see now, it the current implementation of the sign callback is not suitable for the API at all... It looks like you will not be able to escape implementing one type/structure to hold a public component and private reference which is passed throughout the code... This structure should have user data, sign callback, cleanup callback. Does it make any sense? Alon. From nmav at gnutls.org Sun Aug 19 01:12:56 2007 From: nmav at gnutls.org (Nikos Mavrogiannopoulos) Date: Sun, 19 Aug 2007 02:12:56 +0300 Subject: [gnutls-dev] Bad record MAC with a Nokia E90 In-Reply-To: <20070815162651.GB3741@downhill.g.la> References: <20070815162651.GB3741@downhill.g.la> Message-ID: <200708190212.56856.nmav@gnutls.org> On Wednesday 15 August 2007, Andreas Metzler wrote: > Hello, > this is http://bugs.debian.org/438137 submitted by Marc Haber for > gnutls 1.7.16: > > When a Nokia E90 connects to a gnutls-serv, then connection is not > established and it aborts with "Bad record MAC". > [...] > > gnutls-serv output is attached an Marc will surely be available to add > additional info if necessary. I glimpsed on the trace and saw that it selects this ciphersuite: <3>| HSK[8077a48]: Selected cipher suite: RSA_AES_256_CBC_SHA1 Something that might help in debugging without much fuss, would be to test handshake by enabling other ciphersuites. That would be for gnutls-serv to only enable: a. key exchage: DHE-RSA cipher: 3DES b. key exchange: DHE-RSA cipher: AES_256_CBC c. key exchange: RSA cipher ARCFOUR and return the traces if possible. best regards, Nikos From simon at josefsson.org Tue Aug 21 13:14:43 2007 From: simon at josefsson.org (Simon Josefsson) Date: Tue, 21 Aug 2007 13:14:43 +0200 Subject: [gnutls-dev] Building libgpg-error/libgcrypt/libtasn1/gnutls/gsasl without autoconf on uClinux Message-ID: <87sl6dyw9o.fsf@mocca.josefsson.org> Hi all, Sometimes it can be useful to build things without the autoconf ./configure machinery, and just use a simple and hand-maintained makefile and config.h. This is needed to build things in older uClinux environments. I wrote some instructions on how to achieve this, see: http://josefsson.org/uclinux/old/ The makefile/config.h aren't specific to uClinux, so if you for some reason need to build these projects in some other environment, without autoconf, the files may be useful. Note that instructions for how to get these projects to work under a modern uClinux (which supports the autoconf-machinery) is still available, and is the preferred way to build under uClinux, see: http://josefsson.org/uclinux/ Thanks, Simon From simon at josefsson.org Wed Aug 22 12:21:04 2007 From: simon at josefsson.org (Simon Josefsson) Date: Wed, 22 Aug 2007 12:21:04 +0200 Subject: [gnutls-dev] Building libgpg-error/libgcrypt/libtasn1/gnutls/gsasl without autoconf on uClinux In-Reply-To: <87y7g351ik.fsf@wheatstone.g10code.de> (Werner Koch's message of "Wed, 22 Aug 2007 12:04:03 +0200") References: <87sl6dyw9o.fsf@mocca.josefsson.org> <87y7g351ik.fsf@wheatstone.g10code.de> Message-ID: <87sl6brhtb.fsf@mocca.josefsson.org> Werner Koch writes: > On Tue, 21 Aug 2007 13:14, simon at josefsson.org said: > >> Sometimes it can be useful to build things without the autoconf >> ./configure machinery, and just use a simple and hand-maintained >> makefile and config.h. This is needed to build things in older uClinux >> environments. > > Is this due to libtool? Back in 2003 I was able to build gpg on uCLinux > for Coldfire; the configure invocation is still available in autogen.sh. I didn't even get to libtool, I couldn't get the m68k gcc compiler from 2003 to work in ./configure -- it didn't use a.out as the default output name, it didn't link to the proper libc by default, and there were many more problems. All those problems have been solved in modern versions of the toolchain and uClinux. All our packages build fine using a simple ./configure approach. The only reason for anyone to want to look at this work if they are using very broken toolchains that can never be supported by proper ./configure usage. Unfortunately, that situation seems to happen often enough for me that it became useful to try and publish something re-usable. /Simon From wk at gnupg.org Wed Aug 22 12:04:03 2007 From: wk at gnupg.org (Werner Koch) Date: Wed, 22 Aug 2007 12:04:03 +0200 Subject: [gnutls-dev] Building libgpg-error/libgcrypt/libtasn1/gnutls/gsasl without autoconf on uClinux In-Reply-To: <87sl6dyw9o.fsf@mocca.josefsson.org> (Simon Josefsson's message of "Tue, 21 Aug 2007 13:14:43 +0200") References: <87sl6dyw9o.fsf@mocca.josefsson.org> Message-ID: <87y7g351ik.fsf@wheatstone.g10code.de> On Tue, 21 Aug 2007 13:14, simon at josefsson.org said: > Sometimes it can be useful to build things without the autoconf > ./configure machinery, and just use a simple and hand-maintained > makefile and config.h. This is needed to build things in older uClinux > environments. Is this due to libtool? Back in 2003 I was able to build gpg on uCLinux for Coldfire; the configure invocation is still available in autogen.sh. Salam-Shalom, Werner -- Die Gedanken sind frei. Auschnahmen regelt ein Bundeschgesetz. From ametzler at downhill.at.eu.org Sun Aug 26 16:52:45 2007 From: ametzler at downhill.at.eu.org (Andreas Metzler) Date: Sun, 26 Aug 2007 16:52:45 +0200 Subject: [gnutls-dev] gnutls 1.7.17 and greater do not work with mutt anymore Message-ID: <20070826145245.GC4413@downhill.g.la> Hello, This is . gnutls 1.7.17 broke mutt's usage of Gnutls. It is easy to reproduce, just use mutt -R -f imaps://imap.gmx.net/INBOX and choose accept (o)nce on the Certificate check. The patch below seems to have *triggered* it, reverting it makes 1.7.1[78] work. The 1mio$question is probably what causes an unknown error (code seems to be 21) in the first place. 2007-08-10 Simon Josefsson * lib/gnutls_errors.c: (gnutls_error_is_fatal): Return default is 1 for unknown error codes. --------------------------- --- gnutls-1.7.16/lib/gnutls_errors.c 2007-05-25 15:04:22.000000000 +0200 +++ gnutls-1.7.17/lib/gnutls_errors.c 2007-08-10 15:51:07.000000000 +0200 @@ -269,7 +269,7 @@ int gnutls_error_is_fatal (int error) { - int ret = 0; + int ret = 1; GNUTLS_ERROR_ALG_LOOP (ret = p->fatal); return ret; --------------------------- 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' -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : /pipermail/attachments/20070826/1e48a23e/attachment.pgp From simon at josefsson.org Mon Aug 27 12:30:43 2007 From: simon at josefsson.org (Simon Josefsson) Date: Mon, 27 Aug 2007 12:30:43 +0200 Subject: [gnutls-dev] gnutls 1.7.17 and greater do not work with mutt anymore In-Reply-To: <20070826145245.GC4413@downhill.g.la> (Andreas Metzler's message of "Sun, 26 Aug 2007 16:52:45 +0200") References: <20070826145245.GC4413@downhill.g.la> Message-ID: <87odgtl164.fsf@mocca.josefsson.org> Andreas Metzler writes: > Hello, > > This is . > > gnutls 1.7.17 broke mutt's usage of Gnutls. It is easy to reproduce, > just use > > mutt -R -f imaps://imap.gmx.net/INBOX > > and choose accept (o)nce on the Certificate check. > > The patch below seems to have *triggered* it, reverting it makes > 1.7.1[78] work. The 1mio$question is probably what causes an unknown > error (code seems to be 21) in the first place. Thanks for investigating, I'll see if I can reproduce it and debug it further later today. /Simon > 2007-08-10 Simon Josefsson > > * lib/gnutls_errors.c: (gnutls_error_is_fatal): Return default is 1 for > unknown error codes. > --------------------------- > --- gnutls-1.7.16/lib/gnutls_errors.c 2007-05-25 15:04:22.000000000 +0200 > +++ gnutls-1.7.17/lib/gnutls_errors.c 2007-08-10 15:51:07.000000000 +0200 > @@ -269,7 +269,7 @@ > int > gnutls_error_is_fatal (int error) > { > - int ret = 0; > + int ret = 1; > > GNUTLS_ERROR_ALG_LOOP (ret = p->fatal); > return ret; > --------------------------- > 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' > _______________________________________________ > Gnutls-dev mailing list > Gnutls-dev at gnupg.org > http://lists.gnupg.org/mailman/listinfo/gnutls-dev From simon at josefsson.org Mon Aug 27 16:07:41 2007 From: simon at josefsson.org (Simon Josefsson) Date: Mon, 27 Aug 2007 16:07:41 +0200 Subject: [gnutls-dev] gnutls 1.7.17 and greater do not work with mutt anymore In-Reply-To: <20070826145245.GC4413@downhill.g.la> (Andreas Metzler's message of "Sun, 26 Aug 2007 16:52:45 +0200") References: <20070826145245.GC4413@downhill.g.la> Message-ID: <87tzqljck2.fsf@mocca.josefsson.org> Andreas Metzler writes: > The patch below seems to have *triggered* it, reverting it makes > 1.7.1[78] work. The 1mio$question is probably what causes an unknown > error (code seems to be 21) in the first place. The problem was that gnutls_error_is_fatal was called with a positive value. This probably indicates a mutt bug (investigation appreciated), but it seems like a safe approach to apply the patch below so I did that. I'll roll a new rc-release soon. /Simon commit 1d12c895fda4a65071dbfcc1f1fa3c9abce24686 Author: Simon Josefsson Date: Mon Aug 27 16:04:57 2007 +0200 Doc fix. diff --git a/lib/gnutls_errors.c b/lib/gnutls_errors.c index 150e23a..2c8afd4 100644 --- a/lib/gnutls_errors.c +++ b/lib/gnutls_errors.c @@ -265,6 +265,8 @@ static const gnutls_error_entry error_algorithms[] = { * This is only useful if you are dealing with errors from the * record layer or the handshake layer. * + * For positive @error values, 0 is returned. + * **/ int gnutls_error_is_fatal (int error) commit fc9a8c420d86c226442f4f8c8cb9b6f4e29e47f2 Author: Simon Josefsson Date: Mon Aug 27 15:59:51 2007 +0200 Have gnutls_error_is_fatal return 0 on positive "errors". Would fix bug reported by Andreas Metzler in . diff --git a/lib/gnutls_errors.c b/lib/gnutls_errors.c index 0e28275..150e23a 100644 --- a/lib/gnutls_errors.c +++ b/lib/gnutls_errors.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation + * Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation * * Author: Nikos Mavroyanopoulos * @@ -271,7 +271,13 @@ gnutls_error_is_fatal (int error) { int ret = 1; + /* Input sanitzation. Positive values are not errors at all, and + definitely not fatal. */ + if (error > 0) + return 0; + GNUTLS_ERROR_ALG_LOOP (ret = p->fatal); + return ret; } From simon at josefsson.org Mon Aug 27 16:39:52 2007 From: simon at josefsson.org (Simon Josefsson) Date: Mon, 27 Aug 2007 16:39:52 +0200 Subject: [gnutls-dev] GnuTLS 1.7.17 -- Last call for next stable major release v2.0! In-Reply-To: <87odh9yqb3.fsf@mocca.josefsson.org> (Simon Josefsson's message of "Wed, 15 Aug 2007 13:45:20 +0200") References: <87sl6lso1y.fsf@mocca.josefsson.org> <20070815100331.GB4422@downhill.g.la> <87odh9yqb3.fsf@mocca.josefsson.org> Message-ID: <87odgtjb2f.fsf@mocca.josefsson.org> Simon Josefsson writes: >> #3. The existence of two similar print_info() functions in >> doc/examples/ex-session-info.c and src/common.c is a little bit >> strange, and neither of these handles all currently available values for >> gnutls_credentials_type_t: >> >> ex-session-info.c:32: warning: enumeration value 'GNUTLS_CRD_PSK' not handled in switch >> ex-session-info.c:32: warning: enumeration value 'GNUTLS_CRD_IA' not handled in switch >> >> common.c:494: warning: enumeration value 'GNUTLS_CRD_IA' not handled in switch > > I'll look into this. I have fixed the warnings. I'm not sure how to avoid the code duplication. Possibly there should be something like that in the core library, I suspect many applications want to print some info about the current connection. /Simon From simon at josefsson.org Mon Aug 27 16:54:19 2007 From: simon at josefsson.org (Simon Josefsson) Date: Mon, 27 Aug 2007 16:54:19 +0200 Subject: [gnutls-dev] [RFC] gnutls-pkcs11 In-Reply-To: <9e0cf0bf0708181042r7398d01bkbb9464a355d57159@mail.gmail.com> (Alon Bar-Lev's message of "Sat, 18 Aug 2007 20:42:11 +0300") References: <9e0cf0bf0708180504u25ed6bf2n2bd848ef6e787245@mail.gmail.com> <87d4xkdbln.fsf@mocca.josefsson.org> <9e0cf0bf0708181042r7398d01bkbb9464a355d57159@mail.gmail.com> Message-ID: <87k5rhjaec.fsf@mocca.josefsson.org> "Alon Bar-Lev" writes: >> Consider the following scenario: the user has two certificates with one >> private keys for each. The certificates are stored in GnuTLS using >> normal APIs (i.e., gnutls_certificate_set_x509_key_mem with NULL keys). >> GnuTLS will select the appropriate user cert (one of the two certs) to >> use against each server, depending on the CA list received from the >> server. The certificate (which uniquely identify the private) to use >> for signing is passed in the 'cert' parameter to the sign_callback >> function. The callback need to locate the private key in the PKCS#11 >> backend(s) that match that user certificate, and use that key for >> signing. > > I thought all the above scenario is done in: > cert_callback set by gnutls_certificate_client_set_retrieve_function(). That function is only used to retrieve the users' certificates. It doesn't handle the private keys. However, of course, if you only let GnuTLS know about one user certificate via the cert_callback, GnuTLS will never ask the sign_callback about any other private key. > So you do have a chance to do the above logic... Right, and it works now. But not all applications use the cert_callback approach, and they should be able to retrieve the appropriate private key to use with the chosen user certificate. > But you say that gnutls have some automatic method for this... > I was not aware of it... (The term "set" is misleading... Should be "add"...) The automatic method is used when the application doesn't use gnutls_certificate_client_set_retrieve_function. I don't follow the remark about set vs add, the function set the function callback, it doesn't add it -- you can't have two function callbacks. > And now I get why you added the certificate into the sign callback... > I let it go last time... But here it is back... Seems I cannot escape > from it :) > > I don't understand how did you expect people to use this... Here are > some of my thoughts... > > 1. You assume a static list of available certificates and objects is > available to application, so that you can call > gnutls_certificate_set_x509_key_mem() at initialization. But this is > not true with smartcard aware application, as the user may insert his > smartcard after initializtion. True, and you can use gnutls_certificate_client_set_retrieve to solve this. But not all applications need to use that interface. > 2. You don't allow passing user data for the > gnutls_certificate_set_x509_key_mem() function, so the application has > to enumerate all available certificates during initialization, and > then again enumerate all available certificates in sign callback in > order to find a match. It doesn't have to enumerate them, there are other solutions depending on the application. However, if you use the cert_callback approach, this shouldn't be a problem, right? > 3. Even if you allow to pass user data, it will solve (2), but there > is an issue with resource cleaning, is there a callback to take the > user data during credential clean? > > Of course I can put some user data in the session that have a > reference between a certificate and its private key data, but this > looks like a bad idea. I don't see any reason to re-design the cert_callback API right now, it seems to be working and doing everything that is needed. > 4. Do you expect building a new credentials object before each > session? Maybe if you do, I understand (1) solution... But not the way > the callback be efficiently implemented. It depends, some applications will build a new object each time, some won't. I think there are appropriate APIs for both variants. > I may be wrong... But the simpler approach of > gnutls_certificate_client_set_retrieve_function() is more generic... Hm, I don't follow what you prefer -- that function is already there. > A helper function will can be appropriate (maybe you already have it), > that receives the callback parameters and a list of end certificate > and return the index of the best certificate to use. This function be > be called at the cert_callback without any resource/user implications. There's no such helper function. We could add it if you send a patch, but it doesn't seem like a generically useful thing > But as I see now, it the current implementation of the sign callback > is not suitable for the API at all... It looks like you will not be > able to escape implementing one type/structure to hold a public > component and private reference which is passed throughout the code... > This structure should have user data, sign callback, cleanup callback. The API may not be perfect, I admit that, but to design a really clean API, GnuTLS would need to have data types or functions that work on generic "user credential" that contains both user certificate (both OpenPGP and X.509) and private keys (OpenPGP/X509). That is a significant amount of work, and there is yet little indication that people request this feature often. /Simon From simon at josefsson.org Mon Aug 27 18:12:48 2007 From: simon at josefsson.org (Simon Josefsson) Date: Mon, 27 Aug 2007 18:12:48 +0200 Subject: [gnutls-dev] GnuTLS 1.7.19 Message-ID: <87fy25j6rj.fsf@mocca.josefsson.org> A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 419 bytes Desc: not available Url : /pipermail/attachments/20070827/cd75631e/attachment.pgp From simon at josefsson.org Thu Aug 30 06:17:54 2007 From: simon at josefsson.org (Simon Josefsson) Date: Thu, 30 Aug 2007 06:17:54 +0200 Subject: [gnutls-dev] GnuTLS 1.7.19 In-Reply-To: <87fy25j6rj.fsf@mocca.josefsson.org> (Simon Josefsson's message of "Mon, 27 Aug 2007 18:12:48 +0200") References: <87fy25j6rj.fsf@mocca.josefsson.org> Message-ID: <873ay1zmdp.fsf@mocca.josefsson.org> Simon Josefsson writes: > Unless I hear anything, I will release this as v2.0 on September 1th. I just realized I'll be out of town on September 1th, so it will be on monday or tuesday instead. That gives us a few more days for the Debian guys to test it... :) /Simon From simon at josefsson.org Fri Aug 31 16:06:36 2007 From: simon at josefsson.org (Simon Josefsson) Date: Fri, 31 Aug 2007 16:06:36 +0200 Subject: [gnutls-dev] Libtasn1 1.0 Message-ID: <878x7rn6hf.fsf@mocca.josefsson.org> A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 419 bytes Desc: not available Url : /pipermail/attachments/20070831/2f66fdff/attachment.pgp From simon at josefsson.org Fri Aug 31 17:32:46 2007 From: simon at josefsson.org (Simon Josefsson) Date: Fri, 31 Aug 2007 17:32:46 +0200 Subject: [gnutls-dev] Libtasn1 1.1 Message-ID: <873axzlnxd.fsf@mocca.josefsson.org> A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 419 bytes Desc: not available Url : /pipermail/attachments/20070831/48a285a3/attachment.pgp