all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* rfc2104 change on 2008-02-01
@ 2008-04-25 10:42 Simon Josefsson
  2008-04-25 11:37 ` Reiner Steib
  2008-04-25 14:28 ` Stefan Monnier
  0 siblings, 2 replies; 6+ messages in thread
From: Simon Josefsson @ 2008-04-25 10:42 UTC (permalink / raw)
  To: emacs-devel, ding, Kenichi Handa

Hi.

I have tracked down a problem sending authenticated e-mail that resulted
in randomly failed CRAM-MD5 authentication (it sometimes work, usually
after 2-3 retries).  The cause is:

2008-02-01  Kenichi Handa  <handa@m17n.org>

        * rfc2104.el (rfc2104-hexstring-to-byte-list): Renamed from
        rfc2104-hexstring-to-bitstring and changed to return a byte list.
        (rfc2104-hash): Convert the result of concat to unibyte string.

The significant patch is:

-    (funcall hash (concat k_opad (rfc2104-hexstring-to-bitstring
-				  ;; perform inner hash
-				  (funcall hash (concat k_ipad text)))))))
+    (funcall hash
+	     (encode-coding-string
+	      (concat k_opad (rfc2104-hexstring-to-byte-list
+			      ;; perform inner hash
+			      (funcall hash (concat k_ipad text))))
+	      'iso-latin-1))))

The data to be hashed contains binary data, printed it just looks like
garbage.  Presumably, the reason the operation fails is because it can't
be encoded into latin-1 which as far as I recall have some reserved
parts.  This would be consistent with only happening sometimes, since it
may happen that a string doesn't contain any reserved characters.

I have experimented with fixes, and changed the 'iso-latin-1 to 'binary
and that appears to work.

There is nothing iso-latin-1 specific about CRAM-MD5 so if that is the
right thing, I think there should be a comment to explain why.

Handa, could you explain the motivation for this change?

To resolve it, we can chose:

1) Revert the patch.

2) Change 'iso-latin-1 to 'binary.

There may be other options too.

I propose to change it to 'binary if I don't hear anything.

If there were mailing list discussions about this, I'd appreciate a
pointer to that.  I don't think I was cc'ed, and I couldn't find any
discussion now that I search for it.

Thoughts?

Thanks,
Simon



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

end of thread, other threads:[~2008-04-26  6:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-25 10:42 rfc2104 change on 2008-02-01 Simon Josefsson
2008-04-25 11:37 ` Reiner Steib
2008-04-25 13:40   ` Simon Josefsson
2008-04-25 16:03     ` Thien-Thi Nguyen
2008-04-25 14:28 ` Stefan Monnier
2008-04-26  6:59   ` Gabor Z. Papp

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.