From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: libnettle/libhogweed WIP Date: Sat, 18 Mar 2017 10:12:23 +0200 Message-ID: <83pohfxau0.fsf@gnu.org> References: <83a89gq3us.fsf@gnu.org> <87bmtjiv0w.fsf_-_@lifelogs.com> <83o9xjn06c.fsf@gnu.org> <87shmeb5ln.fsf_-_@lifelogs.com> <83y3w5z1ez.fsf@gnu.org> <874lyrbjy2.fsf@lifelogs.com> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1489824776 11338 195.159.176.226 (18 Mar 2017 08:12:56 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 18 Mar 2017 08:12:56 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Mar 18 09:12:51 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cp9Tk-0002Kh-LS for ged-emacs-devel@m.gmane.org; Sat, 18 Mar 2017 09:12:48 +0100 Original-Received: from localhost ([::1]:52205 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cp9Tq-0008Hb-D6 for ged-emacs-devel@m.gmane.org; Sat, 18 Mar 2017 04:12:54 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54114) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cp9Tj-0008HU-NH for emacs-devel@gnu.org; Sat, 18 Mar 2017 04:12:48 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cp9Tg-0003hj-Ht for emacs-devel@gnu.org; Sat, 18 Mar 2017 04:12:47 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:58850) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cp9Tg-0003hd-E7 for emacs-devel@gnu.org; Sat, 18 Mar 2017 04:12:44 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:1523 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1cp9Tf-0001Ac-Mg for emacs-devel@gnu.org; Sat, 18 Mar 2017 04:12:44 -0400 In-reply-to: <874lyrbjy2.fsf@lifelogs.com> (message from Ted Zlatanov on Fri, 17 Mar 2017 18:46:29 -0400) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:213108 Archived-At: > From: Ted Zlatanov > Date: Fri, 17 Mar 2017 18:46:29 -0400 > > >> * it compiles but doesn't link: "error adding symbols: DSO missing from > >> command line" which I hope is something trivial > > EZ> Did the -lhogweed -lnettle switches appear on the link command line? > > Here's the full monster (I just did `./autogen.sh all && configure > --with-nettle && make' on a Ubuntu system): Looks like -lhogweed is not followed by -lnettle, perhaps that's the problem. > CCLD temacs > /usr/bin/ld: nettle.o: undefined reference to symbol 'nettle_hmac_set_key@@NETTLE_6' > /usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/libnettle.so: error adding symbols: DSO missing from command line > collect2: error: ld returned 1 exit status > Makefile:612: recipe for target 'temacs' failed > > I'm still not sure why it's failing. Is it the order of the libraries? Probably. > What does the error mean? It means the linker didn't find that function in the libraries it scanned after encountering the first reference to the function. > EZ> . support for dynamic loading on MS-Windows should be added > > Can we agree that's a followup task? Yes. Once you get the branch to a good shape, someone should add that to the branch, before it is merged. > EZ> . did you consider exposing this functionality through corresponding > EZ> GnuTLS functions? > > I'm not sure what you mean. AFAICT, GnuTLS exposes at least some of the functions you want to use, so we could instead implement these APIs by calling GnuTLS. > EZ> Another design question: should be support buffer regions, instead of > EZ> strings, as input to these functions? The way your code is written, > EZ> Lisp programs must always cons a string from buffer text, before they > EZ> invoke these functions. This could be gratuitous cost in some use > EZ> cases. > > Yes, but I think a low-level interface shouldn't know about buffers. Why not? > Right. But I can't pre-define the symbols because I don't know what > hashes and ciphers will be dynamically available. You could intern all the symbols at startup time, or the first time any of these functions is called. > So is it OK to check if the symbol name equals a C string? You have SYMBOL_NAME for that. But I think interning the symbols at startup is better. > Is there a fast safe way to do > that (considering that symbol names have a pretty rich charset)? Not sure what you mean: since the internal representation is a superset of UTF-8, strcmp should work just fine, no? > EZ> Once again, since the length is known in advance, producing output > EZ> into an allocated buffer and then creating a Lisp string by copying > EZ> that buffer is wasteful. It is better to produce output directly into > EZ> a string's data. > > I don't know enough about the Lisp string internals to do this safely. That's the same comment about make_uninit_string above. Thanks.