1
0
mirror of https://github.com/openbsd/src.git synced 2024-12-22 16:42:56 -08:00

hide symbols in sm, rand, and poly1305

ok jsing@
This commit is contained in:
beck 2023-07-07 12:01:32 +00:00
parent 6c89734d1e
commit 93f18f112b
11 changed files with 192 additions and 6 deletions

View File

@ -1263,6 +1263,30 @@ _libre_BIO_vprintf
_libre_BIO_snprintf
_libre_BIO_vsnprintf
_libre_ERR_load_BIO_strings
_libre_SM4_set_key
_libre_SM4_decrypt
_libre_SM4_encrypt
_libre_SM3_Init
_libre_SM3_Update
_libre_SM3_Final
_libre_RAND_set_rand_method
_libre_RAND_get_rand_method
_libre_RAND_set_rand_engine
_libre_RAND_SSLeay
_libre_RAND_cleanup
_libre_RAND_bytes
_libre_RAND_pseudo_bytes
_libre_RAND_seed
_libre_RAND_add
_libre_RAND_load_file
_libre_RAND_write_file
_libre_RAND_file_name
_libre_RAND_status
_libre_RAND_poll
_libre_ERR_load_RAND_strings
_libre_CRYPTO_poly1305_init
_libre_CRYPTO_poly1305_update
_libre_CRYPTO_poly1305_finish
_libre_TS_REQ_new
_libre_TS_REQ_free
_libre_i2d_TS_REQ

View File

@ -0,0 +1,32 @@
/* $OpenBSD: poly1305.h,v 1.1 2023/07/07 12:01:32 beck Exp $ */
/*
* Copyright (c) 2023 Bob Beck <beck@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef _LIBCRYPTO_POLY1305_H
#define _LIBCRYPTO_POLY1305_H
#ifndef _MSC_VER
#include_next <openssl/poly1305.h>
#else
#include "../include/openssl/poly1305.h"
#endif
#include "crypto_namespace.h"
LCRYPTO_USED(CRYPTO_poly1305_init);
LCRYPTO_USED(CRYPTO_poly1305_update);
LCRYPTO_USED(CRYPTO_poly1305_finish);
#endif /* _LIBCRYPTO_POLY1305_H */

View File

@ -0,0 +1,44 @@
/* $OpenBSD: rand.h,v 1.1 2023/07/07 12:01:32 beck Exp $ */
/*
* Copyright (c) 2023 Bob Beck <beck@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef _LIBCRYPTO_RAND_H
#define _LIBCRYPTO_RAND_H
#ifndef _MSC_VER
#include_next <openssl/rand.h>
#else
#include "../include/openssl/rand.h"
#endif
#include "crypto_namespace.h"
LCRYPTO_USED(RAND_set_rand_method);
LCRYPTO_USED(RAND_get_rand_method);
LCRYPTO_USED(RAND_set_rand_engine);
LCRYPTO_USED(RAND_SSLeay);
LCRYPTO_USED(RAND_cleanup);
LCRYPTO_USED(RAND_bytes);
LCRYPTO_USED(RAND_pseudo_bytes);
LCRYPTO_USED(RAND_seed);
LCRYPTO_USED(RAND_add);
LCRYPTO_USED(RAND_load_file);
LCRYPTO_USED(RAND_write_file);
LCRYPTO_USED(RAND_file_name);
LCRYPTO_USED(RAND_status);
LCRYPTO_USED(RAND_poll);
LCRYPTO_USED(ERR_load_RAND_strings);
#endif /* _LIBCRYPTO_RAND_H */

View File

@ -0,0 +1,32 @@
/* $OpenBSD: sm3.h,v 1.1 2023/07/07 12:01:32 beck Exp $ */
/*
* Copyright (c) 2023 Bob Beck <beck@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef _LIBCRYPTO_SM3_H
#define _LIBCRYPTO_SM3_H
#ifndef _MSC_VER
#include_next <openssl/sm3.h>
#else
#include "../include/openssl/sm3.h"
#endif
#include "crypto_namespace.h"
LCRYPTO_USED(SM3_Init);
LCRYPTO_USED(SM3_Update);
LCRYPTO_USED(SM3_Final);
#endif /* _LIBCRYPTO_SM3_H */

View File

@ -0,0 +1,32 @@
/* $OpenBSD: sm4.h,v 1.1 2023/07/07 12:01:32 beck Exp $ */
/*
* Copyright (c) 2023 Bob Beck <beck@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef _LIBCRYPTO_SM4_H
#define _LIBCRYPTO_SM4_H
#ifndef _MSC_VER
#include_next <openssl/sm4.h>
#else
#include "../include/openssl/sm4.h"
#endif
#include "crypto_namespace.h"
LCRYPTO_USED(SM4_set_key);
LCRYPTO_USED(SM4_decrypt);
LCRYPTO_USED(SM4_encrypt);
#endif /* _LIBCRYPTO_SM4_H */

View File

@ -1,4 +1,4 @@
/* $OpenBSD: poly1305.c,v 1.3 2014/06/12 15:49:30 deraadt Exp $ */
/* $OpenBSD: poly1305.c,v 1.4 2023/07/07 12:01:32 beck Exp $ */
/*
* Copyright (c) 2014 Joel Sing <jsing@openbsd.org>
*
@ -23,6 +23,7 @@ CRYPTO_poly1305_init(poly1305_context *ctx, const unsigned char key[32])
{
poly1305_init(ctx, key);
}
LCRYPTO_ALIAS(CRYPTO_poly1305_init);
void
CRYPTO_poly1305_update(poly1305_context *ctx, const unsigned char *in,
@ -30,9 +31,11 @@ CRYPTO_poly1305_update(poly1305_context *ctx, const unsigned char *in,
{
poly1305_update(ctx, in, len);
}
LCRYPTO_ALIAS(CRYPTO_poly1305_update);
void
CRYPTO_poly1305_finish(poly1305_context *ctx, unsigned char mac[16])
{
poly1305_finish(ctx, mac);
}
LCRYPTO_ALIAS(CRYPTO_poly1305_finish);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: rand_err.c,v 1.16 2022/07/12 14:42:50 kn Exp $ */
/* $OpenBSD: rand_err.c,v 1.17 2023/07/07 12:01:32 beck Exp $ */
/* ====================================================================
* Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved.
*
@ -91,3 +91,4 @@ ERR_load_RAND_strings(void)
}
#endif
}
LCRYPTO_ALIAS(ERR_load_RAND_strings);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: rand_lib.c,v 1.20 2014/10/22 13:02:04 jsing Exp $ */
/* $OpenBSD: rand_lib.c,v 1.21 2023/07/07 12:01:32 beck Exp $ */
/*
* Copyright (c) 2014 Ted Unangst <tedu@openbsd.org>
*
@ -29,18 +29,21 @@ RAND_set_rand_method(const RAND_METHOD *meth)
{
return 1;
}
LCRYPTO_ALIAS(RAND_set_rand_method);
const RAND_METHOD *
RAND_get_rand_method(void)
{
return NULL;
}
LCRYPTO_ALIAS(RAND_get_rand_method);
RAND_METHOD *
RAND_SSLeay(void)
{
return NULL;
}
LCRYPTO_ALIAS(RAND_SSLeay);
#ifndef OPENSSL_NO_ENGINE
int
@ -48,6 +51,7 @@ RAND_set_rand_engine(ENGINE *engine)
{
return 1;
}
LCRYPTO_ALIAS(RAND_set_rand_engine);
#endif
void
@ -55,30 +59,35 @@ RAND_cleanup(void)
{
}
LCRYPTO_ALIAS(RAND_cleanup);
void
RAND_seed(const void *buf, int num)
{
}
LCRYPTO_ALIAS(RAND_seed);
void
RAND_add(const void *buf, int num, double entropy)
{
}
LCRYPTO_ALIAS(RAND_add);
int
RAND_status(void)
{
return 1;
}
LCRYPTO_ALIAS(RAND_status);
int
RAND_poll(void)
{
return 1;
}
LCRYPTO_ALIAS(RAND_poll);
/*
* Hurray. You've made it to the good parts.
@ -90,6 +99,7 @@ RAND_bytes(unsigned char *buf, int num)
arc4random_buf(buf, num);
return 1;
}
LCRYPTO_ALIAS(RAND_bytes);
int
RAND_pseudo_bytes(unsigned char *buf, int num)
@ -98,3 +108,4 @@ RAND_pseudo_bytes(unsigned char *buf, int num)
arc4random_buf(buf, num);
return 1;
}
LCRYPTO_ALIAS(RAND_pseudo_bytes);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: randfile.c,v 1.42 2015/09/10 15:56:25 jsing Exp $ */
/* $OpenBSD: randfile.c,v 1.43 2023/07/07 12:01:32 beck Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@ -85,6 +85,7 @@ RAND_load_file(const char *file, long bytes)
else
return bytes;
}
LCRYPTO_ALIAS(RAND_load_file);
int
RAND_write_file(const char *file)
@ -133,6 +134,7 @@ RAND_write_file(const char *file)
explicit_bzero(buf, BUFSIZE);
return ret;
}
LCRYPTO_ALIAS(RAND_write_file);
const char *
RAND_file_name(char * buf, size_t size)
@ -141,3 +143,4 @@ RAND_file_name(char * buf, size_t size)
return (NULL);
return buf;
}
LCRYPTO_ALIAS(RAND_file_name);

View File

@ -1,4 +1,4 @@
/* $OpenBSD: sm3.c,v 1.2 2022/11/26 16:08:54 tb Exp $ */
/* $OpenBSD: sm3.c,v 1.3 2023/07/07 12:01:32 beck Exp $ */
/*
* Copyright (c) 2018, Ribose Inc
*
@ -35,6 +35,7 @@ SM3_Init(SM3_CTX *c)
c->H = SM3_H;
return 1;
}
LCRYPTO_ALIAS(SM3_Init);
void
SM3_block_data_order(SM3_CTX *ctx, const void *p, size_t num)

View File

@ -1,4 +1,4 @@
/* $OpenBSD: sm4.c,v 1.1 2019/03/17 17:42:37 tb Exp $ */
/* $OpenBSD: sm4.c,v 1.2 2023/07/07 12:01:32 beck Exp $ */
/*
* Copyright (c) 2017, 2019 Ribose Inc
*
@ -199,6 +199,7 @@ SM4_set_key(const uint8_t *key, SM4_KEY *k)
return 1;
}
LCRYPTO_ALIAS(SM4_set_key);
#define SM4_ROUNDS(k0, k1, k2, k3, F) \
do { \
@ -235,6 +236,7 @@ SM4_encrypt(const uint8_t *in, uint8_t *out, const SM4_KEY *k)
store_u32_be(B1, out + 8);
store_u32_be(B0, out + 12);
}
LCRYPTO_ALIAS(SM4_encrypt);
void
SM4_decrypt(const uint8_t *in, uint8_t *out, const SM4_KEY *k)
@ -259,5 +261,6 @@ SM4_decrypt(const uint8_t *in, uint8_t *out, const SM4_KEY *k)
store_u32_be(B1, out + 8);
store_u32_be(B0, out + 12);
}
LCRYPTO_ALIAS(SM4_decrypt);
#endif /* OPENSSL_NO_SM4 */