From: Alejandro Colomar <alx+linux-man@kernel.org>
To: Rich Felker <dalias@libc.org>
Cc: Walter Harms <wharms@bfs.de>,
"linux-man@vger.kernel.org" <linux-man@vger.kernel.org>,
libc-alpha@sourceware.org, musl@lists.openwall.com,
~hallyn/shadow@lists.sr.ht
Subject: Re: [musl] Re: RFC: how to document musl-crypt failure ?
Date: Thu, 12 Nov 2026 16:01:30 +0100 [thread overview]
Message-ID: <avXUkpcnCLdIREEN@devuan> (raw)
In-Reply-To: <20261112144550.GJ5716@brightrain.aerifal.cx>
[-- Attachment #1: Type: text/plain, Size: 1739 bytes --]
Hi Rich,
> Date: 2026-11-12 09:45:53-0500
> From: Rich Felker <dalias@libc.org>
>
[...]
> > --- HEAD:man/man3/crypt.3
> > +++ ./man/man3/crypt.3
> > @@ -152,6 +152,19 @@ NOTES
> > than 1000, 999999999 if xxx is greater than 999999999, and
> > is equal to xxx otherwise.
> >
> > +EXAMPLES
> > + When comparing a password against an existing hash, that
> > + hash (and no other) must be passed as salt. If and only
> > + if salt compares equal (see streq(3)) to the returned
> > + string, the password matches the existing hash specified
> > + by salt.
> > +
> > + if (streq(H, crypt(P, H))) {
> > + // good password
> > + } else {
> > + // bad password
> > + }
> > +
> > SEE ALSO
> > login(1), passwd(1), encrypt(3), getpass(3), passwd(5)
>
> Missing null return check.
Ouch! Thanks!
--- HEAD:man/man3/crypt.3
+++ ./man/man3/crypt.3
@@ -152,6 +152,20 @@ NOTES
than 1000, 999999999 if xxx is greater than 999999999, and
is equal to xxx otherwise.
+EXAMPLES
+ When comparing a password against an existing hash, that
+ hash (and no other) must be passed as salt. If and only
+ if salt compares equal (see streq(3)) to the returned
+ string, the password matches the existing hash specified
+ by salt.
+
+ const char *h = crypt(P, H);
+ if (h != NULL && streq(h, H)) {
+ // good password
+ } else {
+ // bad password
+ }
+
SEE ALSO
login(1), passwd(1), encrypt(3), getpass(3), passwd(5)
Cheers,
Alex
--
<https://www.alejandro-colomar.es>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
prev parent reply other threads:[~2026-11-12 15:01 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-09 8:59 RFC: how to document musl-crypt failure ? Walter Harms
2026-11-09 10:10 ` Alejandro Colomar
2026-11-09 10:23 ` Andreas Schwab
2026-11-09 11:24 ` Sam James
2026-11-09 13:56 ` [musl] " Rich Felker
2026-11-09 15:50 ` Alejandro Colomar
2026-11-12 14:37 ` Alejandro Colomar
2026-11-12 14:45 ` Rich Felker
2026-11-12 15:01 ` Alejandro Colomar [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=avXUkpcnCLdIREEN@devuan \
--to=alx+linux-man@kernel.org \
--cc=dalias@libc.org \
--cc=libc-alpha@sourceware.org \
--cc=linux-man@vger.kernel.org \
--cc=musl@lists.openwall.com \
--cc=wharms@bfs.de \
--cc=~hallyn/shadow@lists.sr.ht \
/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.
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.