From: Eli Zaretskii <eliz@gnu.org>
To: emacs-devel@gnu.org
Subject: Re: GNU Emacs-libnettle-libhogweed integration patch v1
Date: Sun, 06 Oct 2013 19:09:41 +0300 [thread overview]
Message-ID: <83wqlq5qka.fsf@gnu.org> (raw)
In-Reply-To: <877gdqrc9u.fsf@flea.lifelogs.com>
> From: Ted Zlatanov <tzz@lifelogs.com>
> Date: Sun, 06 Oct 2013 05:15:09 -0400
> Cc: nettle-bugs@lists.lysator.liu.se
>
> This is the first cut of the Nettle integration for your review.
Thanks.
> +DEFUN ("nettle-available-p", Fnettle_available_p, Snettle_available_p, 0, 0, 0,
> + doc: /* Return t if libnettle+libhogweed are available in this instance of Emacs. */)
> + (void)
> +{
> + return Qt;
> +}
For the record: this will have to be changed for MS-Windows, to
support dynamic loading, like we do, e.g., in decompress.c.
> +DEFUN ("nettle-hmac", Fnettle_hmac, Snettle_hmac, 3, 3, 0,
> + doc: /* Hash INPUT string with HASH-METHOD and KEY into a unibyte string according to HMAC (RFC 2104).
The first line of the doc string is too long. (There are others with
similar problems.)
> + digest = xzalloc (length);
> + hmac_digest (outer_ctx, inner_ctx, state_ctx, alg, length, digest);
> +
> + ret = make_unibyte_string (digest, length);
Instead of xzalloc, then make_unibyte_string, I think you should be
able to allocate a string first, and then work on its SDATA. This
will save you from at least one allocation.
> + free (digest);
> + free (state_ctx);
> + free (outer_ctx);
> + free (inner_ctx);
We tend to use xfree, not free.
> + sha1_mode = 0 == strcmp (SDATA (hash_method), "sha1");
> + sha256_mode = 0 == strcmp (SDATA (hash_method), "sha256");
Perhaps using Fstring_equal is better here, not sure.
> + uint8_t *digest = xzalloc (outlength);
^^^^^^^
Why not 'unsigned char'?
> + if (!rsa_keypair_from_der (&key, NULL, 0, SCHARS (public_key), SDATA (public_key)) &&
> + !rsa_keypair_from_sexp (&key, NULL, 0, SCHARS (public_key), SDATA (public_key)))
The && should be at the beginning of a line, not at the end.
next prev parent reply other threads:[~2013-10-06 16:09 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-06 9:15 GNU Emacs-libnettle-libhogweed integration patch v1 Ted Zlatanov
2013-10-06 9:58 ` bignum support in Emacs with libgmp (was: GNU Emacs-libnettle-libhogweed integration patch v1) Ted Zlatanov
2013-10-06 16:09 ` Eli Zaretskii [this message]
2013-10-06 21:07 ` GNU Emacs-libnettle-libhogweed integration patch v1 Ted Zlatanov
2013-10-06 16:51 ` Stefan Monnier
2013-10-06 16:58 ` Eli Zaretskii
2013-10-06 21:19 ` Ted Zlatanov
2013-10-07 4:02 ` Stefan Monnier
2013-10-07 11:41 ` Ted Zlatanov
2013-10-07 22:03 ` Ted Zlatanov
2013-10-07 22:58 ` Stefan Monnier
2013-10-07 23:43 ` Emacs crypto use cases (was: GNU Emacs-libnettle-libhogweed integration patch v1) Ted Zlatanov
2013-10-08 3:02 ` Emacs crypto use cases Stefan Monnier
2013-10-08 10:33 ` Ted Zlatanov
2013-10-08 13:17 ` Stephen J. Turnbull
2013-10-08 16:35 ` DSO-style FFI (was: Emacs crypto use cases) Stefan Monnier
2013-10-08 17:32 ` DSO-style FFI Tom Tromey
2013-10-08 19:42 ` Ted Zlatanov
2013-10-08 20:43 ` Tom Tromey
2013-10-09 23:21 ` Ted Zlatanov
2013-10-10 8:09 ` Andreas Schwab
2013-10-08 20:47 ` Davis Herring
2013-10-09 22:26 ` Ted Zlatanov
2013-10-09 23:52 ` Davis Herring
2013-10-10 1:25 ` Ted Zlatanov
2013-10-10 4:36 ` DSO-style DSOs (this is NOT an FFI!) Stephen J. Turnbull
2013-10-09 1:48 ` DSO-style FFI Stephen J. Turnbull
2013-10-09 2:40 ` Stefan Monnier
2013-10-12 15:34 ` Michael Welsh Duggan
2013-10-12 18:55 ` Stefan Monnier
2013-10-18 13:31 ` Ted Zlatanov
2013-10-19 14:41 ` Stefan Monnier
2013-10-19 15:08 ` Stefan Monnier
2013-10-19 17:33 ` Andy Moreton
2013-10-19 19:44 ` Ted Zlatanov
2013-10-12 23:36 ` Stephen J. Turnbull
2013-10-08 19:50 ` Ted Zlatanov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=83wqlq5qka.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.