libcrypt: Hide more private symbols by default. Fix style.
This commit is contained in:
parent
46c460af93
commit
f9151ba943
|
@ -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 *, u_int16_t, 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, u_int16_t clen, u_int8_t logr)
|
|||
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;
|
||||
|
|
|
@ -243,7 +243,7 @@ decode_option(argon2_context *ctx, argon2_type *atype, const char *option)
|
|||
return error;
|
||||
}
|
||||
|
||||
char *
|
||||
crypt_private char *
|
||||
__crypt_argon2(const char *pw, const char * salt)
|
||||
{
|
||||
/* we use the libargon2 api to generate */
|
||||
|
|
|
@ -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 2013/08/28 17:47:07 riastradh Exp $");
|
|||
* 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 hint)
|
|||
* 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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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/16 10:39:12 drochner Exp $");
|
|||
* 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)
|
||||
|
|
|
@ -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/08/28 17:47:07 riastradh Exp $");
|
|||
/*
|
||||
* MD5 password encryption.
|
||||
*/
|
||||
char *
|
||||
crypt_private char *
|
||||
__md5crypt(const char *pw, const char *salt)
|
||||
{
|
||||
static char passwd[120], *p;
|
||||
|
|
|
@ -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>
|
||||
|
@ -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, const char *option)
|
|||
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, const char* option)
|
|||
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, const char *option)
|
|||
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 saltsiz, const char *option)
|
|||
}
|
||||
|
||||
#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 saltsiz, const char *option,argon2_type atyp
|
|||
}
|
||||
|
||||
/* 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);
|
||||
|
|
Loading…
Reference in New Issue