Module Name: src
Committed By: nia
Date: Sat Oct 16 10:53:34 UTC 2021
Modified Files:
src/lib/libcrypt: bcrypt.c crypt-argon2.c crypt-sha1.c crypt.h hmac.c
md5crypt.c pw_gensalt.c
Log Message:
libcrypt: Hide more private symbols by default. Fix style.
To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/lib/libcrypt/bcrypt.c
cvs rdiff -u -r1.9 -r1.10 src/lib/libcrypt/crypt-argon2.c
cvs rdiff -u -r1.8 -r1.9 src/lib/libcrypt/crypt-sha1.c
cvs rdiff -u -r1.7 -r1.8 src/lib/libcrypt/crypt.h
cvs rdiff -u -r1.3 -r1.4 src/lib/libcrypt/hmac.c
cvs rdiff -u -r1.14 -r1.15 src/lib/libcrypt/md5crypt.c
cvs rdiff -u -r1.11 -r1.12 src/lib/libcrypt/pw_gensalt.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/lib/libcrypt/bcrypt.c
diff -u src/lib/libcrypt/bcrypt.c:1.21 src/lib/libcrypt/bcrypt.c:1.22
--- src/lib/libcrypt/bcrypt.c:1.21 Wed Mar 25 21:02:26 2020
+++ src/lib/libcrypt/bcrypt.c Sat Oct 16 10:53:33 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: bcrypt.c,v 1.21 2020/03/25 21:02:26 christos Exp $ */
+/* $NetBSD: bcrypt.c,v 1.22 2021/10/16 10:53:33 nia Exp $ */
/* $OpenBSD: bcrypt.c,v 1.16 2002/02/19 19:39:36 millert Exp $ */
/*
@@ -46,7 +46,7 @@
*
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: bcrypt.c,v 1.21 2020/03/25 21:02:26 christos Exp $");
+__RCSID("$NetBSD: bcrypt.c,v 1.22 2021/10/16 10:53:33 nia Exp $");
#include <stdio.h>
#include <stdlib.h>
@@ -74,7 +74,7 @@ static void encode_salt(char *, u_int8_t
static void encode_base64(u_int8_t *, u_int8_t *, u_int16_t);
static void decode_base64(u_int8_t *, u_int16_t, const u_int8_t *);
-char *__bcrypt(const char *, const char *); /* XXX */
+crypt_private char *__bcrypt(const char *, const char *); /* XXX */
static char encrypted[_PASSWORD_LEN];
@@ -149,7 +149,7 @@ encode_salt(char *salt, u_int8_t *csalt,
encode_base64((u_int8_t *) salt + 7, csalt, clen);
}
-int
+crypt_private int
__gensalt_blowfish(char *salt, size_t saltlen, const char *option)
{
size_t i;
@@ -209,7 +209,7 @@ bcrypt_gensalt(u_int8_t log_rounds)
/* We handle $Vers$log2(NumRounds)$salt+passwd$
i.e. $2$04$iwouldntknowwhattosayetKdJ6iFtacBqJdKe6aW7ou */
-char *
+crypt_private char *
__bcrypt(const char *key, const char *salt)
{
blf_ctx state;
Index: src/lib/libcrypt/crypt-argon2.c
diff -u src/lib/libcrypt/crypt-argon2.c:1.9 src/lib/libcrypt/crypt-argon2.c:1.10
--- src/lib/libcrypt/crypt-argon2.c:1.9 Tue Oct 12 15:55:31 2021
+++ src/lib/libcrypt/crypt-argon2.c Sat Oct 16 10:53:33 2021
@@ -243,7 +243,7 @@ decode_option(argon2_context *ctx, argon
return error;
}
-char *
+crypt_private char *
__crypt_argon2(const char *pw, const char * salt)
{
/* we use the libargon2 api to generate */
Index: src/lib/libcrypt/crypt-sha1.c
diff -u src/lib/libcrypt/crypt-sha1.c:1.8 src/lib/libcrypt/crypt-sha1.c:1.9
--- src/lib/libcrypt/crypt-sha1.c:1.8 Wed Aug 28 17:47:07 2013
+++ src/lib/libcrypt/crypt-sha1.c Sat Oct 16 10:53:33 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: crypt-sha1.c,v 1.8 2013/08/28 17:47:07 riastradh Exp $ */
+/* $NetBSD: crypt-sha1.c,v 1.9 2021/10/16 10:53:33 nia Exp $ */
/*
* Copyright (c) 2004, Juniper Networks, Inc.
@@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#if !defined(lint)
-__RCSID("$NetBSD: crypt-sha1.c,v 1.8 2013/08/28 17:47:07 riastradh Exp $");
+__RCSID("$NetBSD: crypt-sha1.c,v 1.9 2021/10/16 10:53:33 nia Exp $");
#endif /* not lint */
#include <stdlib.h>
@@ -68,7 +68,7 @@ __RCSID("$NetBSD: crypt-sha1.c,v 1.8 201
* The number is varied to frustrate those attempting to generate a
* dictionary of pre-computed hashes.
*/
-unsigned int
+crypt_private unsigned int
__crypt_sha1_iterations (unsigned int hint)
{
static int once = 1;
@@ -115,7 +115,7 @@ __crypt_sha1_iterations (unsigned int hi
* strength, and avoid the need to hash it before using as the
* hmac key.
*/
-char *
+crypt_private char *
__crypt_sha1 (const char *pw, const char *salt)
{
static const char *magic = SHA1_MAGIC;
Index: src/lib/libcrypt/crypt.h
diff -u src/lib/libcrypt/crypt.h:1.7 src/lib/libcrypt/crypt.h:1.8
--- src/lib/libcrypt/crypt.h:1.7 Tue Oct 12 15:25:39 2021
+++ src/lib/libcrypt/crypt.h Sat Oct 16 10:53:33 2021
@@ -1,32 +1,32 @@
/*
- * $NetBSD: crypt.h,v 1.7 2021/10/12 15:25:39 nia Exp $
+ * $NetBSD: crypt.h,v 1.8 2021/10/16 10:53:33 nia Exp $
*/
#define crypt_private __attribute__((__visibility__("hidden")))
-char *__md5crypt(const char *pw, const char *salt); /* XXX */
-char *__bcrypt(const char *, const char *); /* XXX */
-char *__crypt_sha1(const char *pw, const char *salt);
-unsigned int __crypt_sha1_iterations (unsigned int hint);
-void __hmac_sha1(const unsigned char *, size_t, const unsigned char *, size_t,
- unsigned char *);
+crypt_private char *__md5crypt(const char *, const char *); /* XXX */
+crypt_private char *__bcrypt(const char *, const char *); /* XXX */
+crypt_private char *__crypt_sha1(const char *, const char *);
+crypt_private unsigned int __crypt_sha1_iterations (unsigned int);
+crypt_private void __hmac_sha1(const unsigned char *, size_t,
+ const unsigned char *, size_t, unsigned char *);
#ifdef HAVE_ARGON2
-char *__crypt_argon2(const char *pw, const char *salt);
-int __gensalt_argon2id(char *salt, size_t saltsiz, const char *option);
-int __gensalt_argon2i(char *salt, size_t saltsiz, const char *option);
-int __gensalt_argon2d(char *salt, size_t saltsiz, const char *option);
+crypt_private char *__crypt_argon2(const char *, const char *);
+crypt_private int __gensalt_argon2id(char *, size_t, const char *);
+crypt_private int __gensalt_argon2i(char *, size_t, const char *);
+crypt_private int __gensalt_argon2d(char *, size_t, const char *);
#endif /* HAVE_ARGON2 */
-int __gensalt_blowfish(char *salt, size_t saltlen, const char *option);
-int __gensalt_old(char *salt, size_t saltsiz, const char *option);
-int __gensalt_new(char *salt, size_t saltsiz, const char *option);
-int __gensalt_md5(char *salt, size_t saltsiz, const char *option);
-int __gensalt_sha1(char *salt, size_t saltsiz, const char *option);
+crypt_private int __gensalt_blowfish(char *, size_t, const char *);
+crypt_private int __gensalt_old(char *, size_t, const char *);
+crypt_private int __gensalt_new(char *, size_t, const char *);
+crypt_private int __gensalt_md5(char *, size_t, const char *);
+crypt_private int __gensalt_sha1(char *, size_t, const char *);
crypt_private int getnum(const char *, size_t *);
-crypt_private void __crypt_to64(char *s, uint32_t v, int n);
-crypt_private void __crypt_tobase64(char *s, uint32_t v, int n);
+crypt_private void __crypt_to64(char *, uint32_t, int);
+crypt_private void __crypt_tobase64(char *, uint32_t, int);
#define SHA1_MAGIC "$sha1$"
#define SHA1_SIZE 20
Index: src/lib/libcrypt/hmac.c
diff -u src/lib/libcrypt/hmac.c:1.3 src/lib/libcrypt/hmac.c:1.4
--- src/lib/libcrypt/hmac.c:1.3 Mon May 16 10:39:12 2011
+++ src/lib/libcrypt/hmac.c Sat Oct 16 10:53:33 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: hmac.c,v 1.3 2011/05/16 10:39:12 drochner Exp $ */
+/* $NetBSD: hmac.c,v 1.4 2021/10/16 10:53:33 nia Exp $ */
/*
* Copyright (c) 2004, Juniper Networks, Inc.
@@ -42,7 +42,7 @@
*/
#include <sys/cdefs.h>
#if !defined(lint)
-__RCSID("$NetBSD: hmac.c,v 1.3 2011/05/16 10:39:12 drochner Exp $");
+__RCSID("$NetBSD: hmac.c,v 1.4 2021/10/16 10:53:33 nia Exp $");
#endif /* not lint */
#include <stdlib.h>
@@ -63,7 +63,7 @@ __RCSID("$NetBSD: hmac.c,v 1.3 2011/05/1
* XOR with the pad byte, we just fill with the pad byte and
* XOR with the key.
*/
-void
+crypt_private void
HMAC_FUNC (const unsigned char *text, size_t text_len,
const unsigned char *key, size_t key_len,
unsigned char *digest)
Index: src/lib/libcrypt/md5crypt.c
diff -u src/lib/libcrypt/md5crypt.c:1.14 src/lib/libcrypt/md5crypt.c:1.15
--- src/lib/libcrypt/md5crypt.c:1.14 Wed Aug 28 17:47:07 2013
+++ src/lib/libcrypt/md5crypt.c Sat Oct 16 10:53:33 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: md5crypt.c,v 1.14 2013/08/28 17:47:07 riastradh Exp $ */
+/* $NetBSD: md5crypt.c,v 1.15 2021/10/16 10:53:33 nia Exp $ */
/*
* ----------------------------------------------------------------------------
@@ -15,7 +15,7 @@
#include <sys/cdefs.h>
#if !defined(lint)
-__RCSID("$NetBSD: md5crypt.c,v 1.14 2013/08/28 17:47:07 riastradh Exp $");
+__RCSID("$NetBSD: md5crypt.c,v 1.15 2021/10/16 10:53:33 nia Exp $");
#endif /* not lint */
#include <unistd.h>
@@ -36,7 +36,7 @@ __RCSID("$NetBSD: md5crypt.c,v 1.14 2013
/*
* MD5 password encryption.
*/
-char *
+crypt_private char *
__md5crypt(const char *pw, const char *salt)
{
static char passwd[120], *p;
Index: src/lib/libcrypt/pw_gensalt.c
diff -u src/lib/libcrypt/pw_gensalt.c:1.11 src/lib/libcrypt/pw_gensalt.c:1.12
--- src/lib/libcrypt/pw_gensalt.c:1.11 Tue Oct 12 15:25:39 2021
+++ src/lib/libcrypt/pw_gensalt.c Sat Oct 16 10:53:33 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: pw_gensalt.c,v 1.11 2021/10/12 15:25:39 nia Exp $ */
+/* $NetBSD: pw_gensalt.c,v 1.12 2021/10/16 10:53:33 nia Exp $ */
/*
* Copyright 1997 Niels Provos <[email protected]>
@@ -34,7 +34,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: pw_gensalt.c,v 1.11 2021/10/12 15:25:39 nia Exp $");
+__RCSID("$NetBSD: pw_gensalt.c,v 1.12 2021/10/16 10:53:33 nia Exp $");
#endif /* not lint */
#include <sys/syslimits.h>
@@ -81,7 +81,7 @@ static const struct pw_salt {
{ NULL, NULL }
};
-int
+crypt_private int
/*ARGSUSED2*/
__gensalt_old(char *salt, size_t saltsiz, const char *option)
{
@@ -94,7 +94,7 @@ __gensalt_old(char *salt, size_t saltsiz
return 0;
}
-int
+crypt_private int
/*ARGSUSED2*/
__gensalt_new(char *salt, size_t saltsiz, const char* option)
{
@@ -120,7 +120,7 @@ __gensalt_new(char *salt, size_t saltsiz
return 0;
}
-int
+crypt_private int
/*ARGSUSED2*/
__gensalt_md5(char *salt, size_t saltsiz, const char *option)
{
@@ -138,7 +138,7 @@ __gensalt_md5(char *salt, size_t saltsiz
return 0;
}
-int
+crypt_private int
__gensalt_sha1(char *salt, size_t saltsiz, const char *option)
{
int n;
@@ -162,7 +162,8 @@ __gensalt_sha1(char *salt, size_t saltsi
}
#ifdef HAVE_ARGON2
-static int __gensalt_argon2_decode_option(char * dst, size_t dlen, const char * option)
+static int
+__gensalt_argon2_decode_option(char *dst, size_t dlen, const char *option)
{
char * in = 0;
@@ -254,19 +255,19 @@ __gensalt_argon2(char *salt, size_t salt
}
/* argon2 variant-specific hooks to generic */
-int
+crypt_private int
__gensalt_argon2id(char *salt, size_t saltsiz, const char *option)
{
return __gensalt_argon2(salt, saltsiz, option, Argon2_id);
}
-int
+crypt_private int
__gensalt_argon2i(char *salt, size_t saltsiz, const char *option)
{
return __gensalt_argon2(salt, saltsiz, option, Argon2_i);
}
-int
+crypt_private int
__gensalt_argon2d(char *salt, size_t saltsiz, const char *option)
{
return __gensalt_argon2(salt, saltsiz, option, Argon2_d);