Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libcrypt libcrypt: Hide more private symbols by default....
details: https://anonhg.NetBSD.org/src/rev/edb64cafdf21
branches: trunk
changeset: 1024288:edb64cafdf21
user: nia <nia%NetBSD.org@localhost>
date: Sat Oct 16 10:53:33 2021 +0000
description:
libcrypt: Hide more private symbols by default. Fix style.
diffstat:
lib/libcrypt/bcrypt.c | 10 +++++-----
lib/libcrypt/crypt-argon2.c | 2 +-
lib/libcrypt/crypt-sha1.c | 8 ++++----
lib/libcrypt/crypt.h | 36 ++++++++++++++++++------------------
lib/libcrypt/hmac.c | 6 +++---
lib/libcrypt/md5crypt.c | 6 +++---
lib/libcrypt/pw_gensalt.c | 21 +++++++++++----------
7 files changed, 45 insertions(+), 44 deletions(-)
diffs (288 lines):
diff -r 6ceeb239bb78 -r edb64cafdf21 lib/libcrypt/bcrypt.c
--- a/lib/libcrypt/bcrypt.c Sat Oct 16 09:39:21 2021 +0000
+++ b/lib/libcrypt/bcrypt.c Sat Oct 16 10:53:33 2021 +0000
@@ -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_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_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 @@
/* 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;
diff -r 6ceeb239bb78 -r edb64cafdf21 lib/libcrypt/crypt-argon2.c
--- a/lib/libcrypt/crypt-argon2.c Sat Oct 16 09:39:21 2021 +0000
+++ b/lib/libcrypt/crypt-argon2.c Sat Oct 16 10:53:33 2021 +0000
@@ -243,7 +243,7 @@
return error;
}
-char *
+crypt_private char *
__crypt_argon2(const char *pw, const char * salt)
{
/* we use the libargon2 api to generate */
diff -r 6ceeb239bb78 -r edb64cafdf21 lib/libcrypt/crypt-sha1.c
--- a/lib/libcrypt/crypt-sha1.c Sat Oct 16 09:39:21 2021 +0000
+++ b/lib/libcrypt/crypt-sha1.c Sat Oct 16 10:53:33 2021 +0000
@@ -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 @@
* 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 @@
* 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;
diff -r 6ceeb239bb78 -r edb64cafdf21 lib/libcrypt/crypt.h
--- a/lib/libcrypt/crypt.h Sat Oct 16 09:39:21 2021 +0000
+++ b/lib/libcrypt/crypt.h Sat Oct 16 10:53:33 2021 +0000
@@ -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
diff -r 6ceeb239bb78 -r edb64cafdf21 lib/libcrypt/hmac.c
--- a/lib/libcrypt/hmac.c Sat Oct 16 09:39:21 2021 +0000
+++ b/lib/libcrypt/hmac.c Sat Oct 16 10:53:33 2021 +0000
@@ -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 @@
* 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)
diff -r 6ceeb239bb78 -r edb64cafdf21 lib/libcrypt/md5crypt.c
--- a/lib/libcrypt/md5crypt.c Sat Oct 16 09:39:21 2021 +0000
+++ b/lib/libcrypt/md5crypt.c Sat Oct 16 10:53:33 2021 +0000
@@ -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 @@
/*
* MD5 password encryption.
*/
-char *
+crypt_private char *
__md5crypt(const char *pw, const char *salt)
{
static char passwd[120], *p;
diff -r 6ceeb239bb78 -r edb64cafdf21 lib/libcrypt/pw_gensalt.c
--- a/lib/libcrypt/pw_gensalt.c Sat Oct 16 09:39:21 2021 +0000
+++ b/lib/libcrypt/pw_gensalt.c Sat Oct 16 10:53:33 2021 +0000
@@ -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 <provos%physnet.uni-hamburg.de@localhost>
@@ -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 @@
{ NULL, NULL }
};
-int
+crypt_private int
/*ARGSUSED2*/
__gensalt_old(char *salt, size_t saltsiz, const char *option)
{
@@ -94,7 +94,7 @@
return 0;
}
-int
+crypt_private int
/*ARGSUSED2*/
__gensalt_new(char *salt, size_t saltsiz, const char* option)
{
@@ -120,7 +120,7 @@
return 0;
}
-int
+crypt_private int
/*ARGSUSED2*/
__gensalt_md5(char *salt, size_t saltsiz, const char *option)
{
@@ -138,7 +138,7 @@
return 0;
}
-int
+crypt_private int
__gensalt_sha1(char *salt, size_t saltsiz, const char *option)
{
int n;
@@ -162,7 +162,8 @@
}
#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 @@
}
/* 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);
Home |
Main Index |
Thread Index |
Old Index