mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: musl@lists.openwall.com
Subject: Re: musl libc with libxcrypt as crypt provider
Date: Fri, 8 Nov 2019 14:13:44 -0500	[thread overview]
Message-ID: <20191108191344.GH16318@brightrain.aerifal.cx> (raw)
In-Reply-To: <22a02b7a-b753-e2e4-f92d-a7c0011866fb@2e0cer.net>

On Fri, Nov 08, 2019 at 06:59:19PM +0000, Michael Everitt wrote:
> In line with the eventual removal of 'libcrypt' and 'crypt.h' from
> glibc[0], Gentoo linux, following in the footsteps of Fedora[1], has been
> evaluating using libxcrypt[2] as provider of libcrypt.so* and the crypt.h
> header (see [3]). As the distro continues, and is increasing in interest
> with musl-libc, we have been trying to work out how best to integrate the
> new libxcrypt with musl without file collisions, as it's not (yet) apparent
> how to disable the built-in crypt.h within musl. Has the musl team
> considered possibl compatibility with libxcrypt moving forwards yet?
> 
> [0] https://sourceware.org/ml/libc-alpha/2017-08/msg01257.html
> [1]
> https://fedoraproject.org/wiki/Changes/Replace_glibc_libcrypt_with_libxcrypt
> [2] https://github.com/besser82/libxcrypt
> [3] https://bugs.gentoo.org/show_bug.cgi?id=699422

This was raised on #musl a day or two ago, and I have some concerns,
some of which may be unfounded. Is the idea of libxcrypt to repeat the
mistake of dynamically loading backends into every process that uses
the interface, the same way nss, pam, etc. did? If so, that's really
harmful to application stability, security, etc. Even if not, I really
doubt projects like Busybox will like being told to link to a new
third-party library for basic functionality.

A few years back I looked at supporting password hashes that were "too
big" to put in libc crypt, like scrypt or yescrypt with giant roms,
and my conclusion was that the right way to do it was probably to make
crypt[_r] interface with a daemon providing the service for setting
codes it doesn't internally recognize.

I never really went anywhere with this since use of unix account login
passwords (vs ssh with pubkey) is kinda outdated to begin with, and it
wasn't clear that other applications would be using the crypt[_r] API
for this anyway.

Anyway, if you do want to use libxcrypt in a distro, I don't think any
particular measures are needed for compatibility. You can just not
install the musl crypt.h. Linking libxcrypt should automatically cause
it to get used instead of the functions in libc.

One thing to look out for is whether libxcrypt insists on having a
large crypt_data structure. If so, existing applications built with
against musl's crypt.h might be unsafe to run with it loaded in place
of crypt[_r]. This should not be an issue, since the structure should
only store the output hash, not any working state, but historical
implementations got this wrong and it's bad for both security and
memory usage.

Rich


      reply	other threads:[~2019-11-08 19:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-08 18:59 Michael Everitt
2019-11-08 19:13 ` Rich Felker [this message]

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=20191108191344.GH16318@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --cc=musl@lists.openwall.com \
    /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 public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).