diff options
author | 2015-09-11 09:18:27 +0000 | |
---|---|---|
committer | 2015-09-11 09:18:27 +0000 | |
commit | 89db3a204d87a918319b4ef97bce4540c64a667e (patch) | |
tree | b536b5b296b2aea1c855688380200936f1c9cb06 /lib/libc | |
parent | remove some more trailing whitespace (diff) | |
download | wireguard-openbsd-89db3a204d87a918319b4ef97bce4540c64a667e.tar.xz wireguard-openbsd-89db3a204d87a918319b4ef97bce4540c64a667e.zip |
Wrap blowfish, sha*, md5, and rmd160 so that internal calls go direct
ok deraadt@
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/crypt/blowfish.c | 15 | ||||
-rw-r--r-- | lib/libc/hash/helper.c | 6 | ||||
-rw-r--r-- | lib/libc/hash/md5.c | 7 | ||||
-rw-r--r-- | lib/libc/hash/rmd160.c | 5 | ||||
-rw-r--r-- | lib/libc/hash/sha1.c | 7 | ||||
-rw-r--r-- | lib/libc/hash/sha2.c | 34 | ||||
-rw-r--r-- | lib/libc/hash/siphash.c | 7 | ||||
-rw-r--r-- | lib/libc/hidden/blf.h | 37 | ||||
-rw-r--r-- | lib/libc/hidden/md5.h | 34 | ||||
-rw-r--r-- | lib/libc/hidden/rmd160.h | 33 | ||||
-rw-r--r-- | lib/libc/hidden/sha1.h | 34 | ||||
-rw-r--r-- | lib/libc/hidden/sha2.h | 61 | ||||
-rw-r--r-- | lib/libc/hidden/siphash.h | 29 | ||||
-rw-r--r-- | lib/libc/include/namespace.h | 11 |
14 files changed, 307 insertions, 13 deletions
diff --git a/lib/libc/crypt/blowfish.c b/lib/libc/crypt/blowfish.c index c337df8a0a3..a658e602d24 100644 --- a/lib/libc/crypt/blowfish.c +++ b/lib/libc/crypt/blowfish.c @@ -1,4 +1,4 @@ -/* $OpenBSD: blowfish.c,v 1.18 2004/11/02 17:23:26 hshoexer Exp $ */ +/* $OpenBSD: blowfish.c,v 1.19 2015/09/11 09:18:27 guenther Exp $ */ /* * Blowfish block cipher for OpenBSD * Copyright 1997 Niels Provos <provos@physnet.uni-hamburg.de> @@ -87,6 +87,7 @@ Blowfish_encipher(blf_ctx *c, u_int32_t *xl, u_int32_t *xr) *xl = Xr ^ p[17]; *xr = Xl; } +DEF_WEAK(Blowfish_encipher); void Blowfish_decipher(blf_ctx *c, u_int32_t *xl, u_int32_t *xr) @@ -112,6 +113,7 @@ Blowfish_decipher(blf_ctx *c, u_int32_t *xl, u_int32_t *xr) *xl = Xr ^ p[0]; *xr = Xl; } +DEF_WEAK(Blowfish_decipher); void Blowfish_initstate(blf_ctx *c) @@ -391,6 +393,7 @@ Blowfish_initstate(blf_ctx *c) *c = initstate; } +DEF_WEAK(Blowfish_initstate); u_int32_t Blowfish_stream2word(const u_int8_t *data, u_int16_t databytes, @@ -412,6 +415,7 @@ Blowfish_stream2word(const u_int8_t *data, u_int16_t databytes, *current = j; return temp; } +DEF_WEAK(Blowfish_stream2word); void Blowfish_expand0state(blf_ctx *c, const u_int8_t *key, u_int16_t keybytes) @@ -449,6 +453,7 @@ Blowfish_expand0state(blf_ctx *c, const u_int8_t *key, u_int16_t keybytes) } } } +DEF_WEAK(Blowfish_expand0state); void @@ -493,6 +498,7 @@ Blowfish_expandstate(blf_ctx *c, const u_int8_t *data, u_int16_t databytes, } } +DEF_WEAK(Blowfish_expandstate); void blf_key(blf_ctx *c, const u_int8_t *k, u_int16_t len) @@ -503,6 +509,7 @@ blf_key(blf_ctx *c, const u_int8_t *k, u_int16_t len) /* Transform S-boxes and subkeys with key */ Blowfish_expand0state(c, k, len); } +DEF_WEAK(blf_key); void blf_enc(blf_ctx *c, u_int32_t *data, u_int16_t blocks) @@ -516,6 +523,7 @@ blf_enc(blf_ctx *c, u_int32_t *data, u_int16_t blocks) d += 2; } } +DEF_WEAK(blf_enc); void blf_dec(blf_ctx *c, u_int32_t *data, u_int16_t blocks) @@ -529,6 +537,7 @@ blf_dec(blf_ctx *c, u_int32_t *data, u_int16_t blocks) d += 2; } } +DEF_WEAK(blf_dec); void blf_ecb_encrypt(blf_ctx *c, u_int8_t *data, u_int32_t len) @@ -551,6 +560,7 @@ blf_ecb_encrypt(blf_ctx *c, u_int8_t *data, u_int32_t len) data += 8; } } +DEF_WEAK(blf_ecb_encrypt); void blf_ecb_decrypt(blf_ctx *c, u_int8_t *data, u_int32_t len) @@ -573,6 +583,7 @@ blf_ecb_decrypt(blf_ctx *c, u_int8_t *data, u_int32_t len) data += 8; } } +DEF_WEAK(blf_ecb_decrypt); void blf_cbc_encrypt(blf_ctx *c, u_int8_t *iv, u_int8_t *data, u_int32_t len) @@ -598,6 +609,7 @@ blf_cbc_encrypt(blf_ctx *c, u_int8_t *iv, u_int8_t *data, u_int32_t len) data += 8; } } +DEF_WEAK(blf_cbc_encrypt); void blf_cbc_decrypt(blf_ctx *c, u_int8_t *iva, u_int8_t *data, u_int32_t len) @@ -639,6 +651,7 @@ blf_cbc_decrypt(blf_ctx *c, u_int8_t *iva, u_int8_t *data, u_int32_t len) for (j = 0; j < 8; j++) data[j] ^= iva[j]; } +DEF_WEAK(blf_cbc_decrypt); #if 0 void diff --git a/lib/libc/hash/helper.c b/lib/libc/hash/helper.c index ee174176894..b5a938666e4 100644 --- a/lib/libc/hash/helper.c +++ b/lib/libc/hash/helper.c @@ -1,4 +1,4 @@ -/* $OpenBSD: helper.c,v 1.13 2015/01/16 16:48:51 deraadt Exp $ */ +/* $OpenBSD: helper.c,v 1.14 2015/09/11 09:18:27 guenther Exp $ */ /* * Copyright (c) 2000 Poul-Henning Kamp <phk@FreeBSD.org> @@ -55,6 +55,7 @@ HASHEnd(HASH_CTX *ctx, char *buf) explicit_bzero(digest, sizeof(digest)); return (buf); } +DEF_WEAK(HASHEnd); char * HASHFileChunk(const char *filename, char *buf, off_t off, off_t len) @@ -92,12 +93,14 @@ HASHFileChunk(const char *filename, char *buf, off_t off, off_t len) errno = save_errno; return (nr < 0 ? NULL : HASHEnd(&ctx, buf)); } +DEF_WEAK(HASHFileChunk); char * HASHFile(const char *filename, char *buf) { return (HASHFileChunk(filename, buf, (off_t)0, (off_t)0)); } +DEF_WEAK(HASHFile); char * HASHData(const u_char *data, size_t len, char *buf) @@ -108,3 +111,4 @@ HASHData(const u_char *data, size_t len, char *buf) HASHUpdate(&ctx, data, len); return (HASHEnd(&ctx, buf)); } +DEF_WEAK(HASHData); diff --git a/lib/libc/hash/md5.c b/lib/libc/hash/md5.c index 2428ed526c0..435e5ac8838 100644 --- a/lib/libc/hash/md5.c +++ b/lib/libc/hash/md5.c @@ -1,4 +1,4 @@ -/* $OpenBSD: md5.c,v 1.10 2015/01/15 13:05:59 millert Exp $ */ +/* $OpenBSD: md5.c,v 1.11 2015/09/11 09:18:27 guenther Exp $ */ /* * This code implements the MD5 message-digest algorithm. @@ -56,6 +56,7 @@ MD5Init(MD5_CTX *ctx) ctx->state[2] = 0x98badcfe; ctx->state[3] = 0x10325476; } +DEF_WEAK(MD5Init); /* * Update context to reflect the concatenation of another buffer full @@ -94,6 +95,7 @@ MD5Update(MD5_CTX *ctx, const unsigned char *input, size_t len) if (len != 0) memcpy(ctx->buffer + have, input, len); } +DEF_WEAK(MD5Update); /* * Pad pad to 64-byte boundary with the bit pattern @@ -116,6 +118,7 @@ MD5Pad(MD5_CTX *ctx) MD5Update(ctx, PADDING, padlen - 8); /* padlen - 8 <= 64 */ MD5Update(ctx, count, 8); } +DEF_WEAK(MD5Pad); /* * Final wrapup--call MD5Pad, fill in digest and zero out ctx. @@ -130,6 +133,7 @@ MD5Final(unsigned char digest[MD5_DIGEST_LENGTH], MD5_CTX *ctx) PUT_32BIT_LE(digest + i * 4, ctx->state[i]); explicit_bzero(ctx, sizeof(*ctx)); } +DEF_WEAK(MD5Final); /* The four core functions - F1 is optimized somewhat */ @@ -244,3 +248,4 @@ MD5Transform(u_int32_t state[4], const u_int8_t block[MD5_BLOCK_LENGTH]) state[2] += c; state[3] += d; } +DEF_WEAK(MD5Transform); diff --git a/lib/libc/hash/rmd160.c b/lib/libc/hash/rmd160.c index 3abc7cc74af..3bf5801221c 100644 --- a/lib/libc/hash/rmd160.c +++ b/lib/libc/hash/rmd160.c @@ -98,6 +98,7 @@ RMD160Init(RMD160_CTX *ctx) ctx->state[3] = H3; ctx->state[4] = H4; } +DEF_WEAK(RMD160Init); void RMD160Update(RMD160_CTX *ctx, const u_int8_t *input, size_t len) @@ -125,6 +126,7 @@ RMD160Update(RMD160_CTX *ctx, const u_int8_t *input, size_t len) if (off < len) memcpy(ctx->buffer + have, input+off, len-off); } +DEF_WEAK(RMD160Update); void RMD160Pad(RMD160_CTX *ctx) @@ -144,6 +146,7 @@ RMD160Pad(RMD160_CTX *ctx) RMD160Update(ctx, PADDING, padlen - 8); /* padlen - 8 <= 64 */ RMD160Update(ctx, size, 8); } +DEF_WEAK(RMD160Pad); void RMD160Final(u_int8_t digest[RMD160_DIGEST_LENGTH], RMD160_CTX *ctx) @@ -155,6 +158,7 @@ RMD160Final(u_int8_t digest[RMD160_DIGEST_LENGTH], RMD160_CTX *ctx) PUT_32BIT_LE(digest + i*4, ctx->state[i]); explicit_bzero(ctx, sizeof (*ctx)); } +DEF_WEAK(RMD160Final); void RMD160Transform(u_int32_t state[5], const u_int8_t block[RMD160_BLOCK_LENGTH]) @@ -367,3 +371,4 @@ RMD160Transform(u_int32_t state[5], const u_int8_t block[RMD160_BLOCK_LENGTH]) state[4] = state[0] + bb + c; state[0] = t; } +DEF_WEAK(RMD160Transform); diff --git a/lib/libc/hash/sha1.c b/lib/libc/hash/sha1.c index fbaab9bafe8..4a6cc325206 100644 --- a/lib/libc/hash/sha1.c +++ b/lib/libc/hash/sha1.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sha1.c,v 1.25 2015/01/16 16:48:51 deraadt Exp $ */ +/* $OpenBSD: sha1.c,v 1.26 2015/09/11 09:18:27 guenther Exp $ */ /* * SHA-1 in C @@ -98,6 +98,7 @@ SHA1Transform(u_int32_t state[5], const u_int8_t buffer[SHA1_BLOCK_LENGTH]) /* Wipe variables */ a = b = c = d = e = 0; } +DEF_WEAK(SHA1Transform); /* @@ -115,6 +116,7 @@ SHA1Init(SHA1_CTX *context) context->state[3] = 0x10325476; context->state[4] = 0xC3D2E1F0; } +DEF_WEAK(SHA1Init); /* @@ -138,6 +140,7 @@ SHA1Update(SHA1_CTX *context, const u_int8_t *data, size_t len) } (void)memcpy(&context->buffer[j], &data[i], len - i); } +DEF_WEAK(SHA1Update); /* @@ -158,6 +161,7 @@ SHA1Pad(SHA1_CTX *context) SHA1Update(context, (u_int8_t *)"\0", 1); SHA1Update(context, finalcount, 8); /* Should cause a SHA1Transform() */ } +DEF_WEAK(SHA1Pad); void SHA1Final(u_int8_t digest[SHA1_DIGEST_LENGTH], SHA1_CTX *context) @@ -171,3 +175,4 @@ SHA1Final(u_int8_t digest[SHA1_DIGEST_LENGTH], SHA1_CTX *context) } explicit_bzero(context, sizeof(*context)); } +DEF_WEAK(SHA1Final); diff --git a/lib/libc/hash/sha2.c b/lib/libc/hash/sha2.c index 4842e429670..16486bcbedb 100644 --- a/lib/libc/hash/sha2.c +++ b/lib/libc/hash/sha2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sha2.c,v 1.23 2015/01/15 13:05:59 millert Exp $ */ +/* $OpenBSD: sha2.c,v 1.24 2015/09/11 09:18:27 guenther Exp $ */ /* * FILE: sha2.c @@ -297,10 +297,14 @@ SHA224Init(SHA2_CTX *context) memset(context->buffer, 0, sizeof(context->buffer)); context->bitcount[0] = 0; } +DEF_WEAK(SHA224Init); -__weak_alias(SHA224Transform, SHA256Transform); -__weak_alias(SHA224Update, SHA256Update); -__weak_alias(SHA224Pad, SHA256Pad); +MAKE_CLONE(SHA224Transform, SHA256Transform); +MAKE_CLONE(SHA224Update, SHA256Update); +MAKE_CLONE(SHA224Pad, SHA256Pad); +DEF_WEAK(SHA224Transform); +DEF_WEAK(SHA224Update); +DEF_WEAK(SHA224Pad); void SHA224Final(u_int8_t digest[SHA224_DIGEST_LENGTH], SHA2_CTX *context) @@ -318,6 +322,7 @@ SHA224Final(u_int8_t digest[SHA224_DIGEST_LENGTH], SHA2_CTX *context) #endif explicit_bzero(context, sizeof(*context)); } +DEF_WEAK(SHA224Final); #endif /* !defined(SHA2_SMALL) */ /*** SHA-256: *********************************************************/ @@ -329,6 +334,7 @@ SHA256Init(SHA2_CTX *context) memset(context->buffer, 0, sizeof(context->buffer)); context->bitcount[0] = 0; } +DEF_WEAK(SHA256Init); #ifdef SHA2_UNROLL_TRANSFORM @@ -487,6 +493,7 @@ SHA256Transform(u_int32_t state[8], const u_int8_t data[SHA256_BLOCK_LENGTH]) } #endif /* SHA2_UNROLL_TRANSFORM */ +DEF_WEAK(SHA256Transform); void SHA256Update(SHA2_CTX *context, const u_int8_t *data, size_t len) @@ -533,6 +540,7 @@ SHA256Update(SHA2_CTX *context, const u_int8_t *data, size_t len) /* Clean up: */ usedspace = freespace = 0; } +DEF_WEAK(SHA256Update); void SHA256Pad(SHA2_CTX *context) @@ -576,6 +584,7 @@ SHA256Pad(SHA2_CTX *context) /* Clean up: */ usedspace = 0; } +DEF_WEAK(SHA256Pad); void SHA256Final(u_int8_t digest[SHA256_DIGEST_LENGTH], SHA2_CTX *context) @@ -593,6 +602,7 @@ SHA256Final(u_int8_t digest[SHA256_DIGEST_LENGTH], SHA2_CTX *context) #endif explicit_bzero(context, sizeof(*context)); } +DEF_WEAK(SHA256Final); /*** SHA-512: *********************************************************/ @@ -604,6 +614,7 @@ SHA512Init(SHA2_CTX *context) memset(context->buffer, 0, sizeof(context->buffer)); context->bitcount[0] = context->bitcount[1] = 0; } +DEF_WEAK(SHA512Init); #ifdef SHA2_UNROLL_TRANSFORM @@ -763,6 +774,7 @@ SHA512Transform(u_int64_t state[8], const u_int8_t data[SHA512_BLOCK_LENGTH]) } #endif /* SHA2_UNROLL_TRANSFORM */ +DEF_WEAK(SHA512Transform); void SHA512Update(SHA2_CTX *context, const u_int8_t *data, size_t len) @@ -809,6 +821,7 @@ SHA512Update(SHA2_CTX *context, const u_int8_t *data, size_t len) /* Clean up: */ usedspace = freespace = 0; } +DEF_WEAK(SHA512Update); void SHA512Pad(SHA2_CTX *context) @@ -852,6 +865,7 @@ SHA512Pad(SHA2_CTX *context) /* Clean up: */ usedspace = 0; } +DEF_WEAK(SHA512Pad); void SHA512Final(u_int8_t digest[SHA512_DIGEST_LENGTH], SHA2_CTX *context) @@ -869,6 +883,7 @@ SHA512Final(u_int8_t digest[SHA512_DIGEST_LENGTH], SHA2_CTX *context) #endif explicit_bzero(context, sizeof(*context)); } +DEF_WEAK(SHA512Final); #if !defined(SHA2_SMALL) @@ -881,10 +896,14 @@ SHA384Init(SHA2_CTX *context) memset(context->buffer, 0, sizeof(context->buffer)); context->bitcount[0] = context->bitcount[1] = 0; } +DEF_WEAK(SHA384Init); -__weak_alias(SHA384Transform, SHA512Transform); -__weak_alias(SHA384Update, SHA512Update); -__weak_alias(SHA384Pad, SHA512Pad); +MAKE_CLONE(SHA384Transform, SHA512Transform); +MAKE_CLONE(SHA384Update, SHA512Update); +MAKE_CLONE(SHA384Pad, SHA512Pad); +DEF_WEAK(SHA384Transform); +DEF_WEAK(SHA384Update); +DEF_WEAK(SHA384Pad); void SHA384Final(u_int8_t digest[SHA384_DIGEST_LENGTH], SHA2_CTX *context) @@ -903,4 +922,5 @@ SHA384Final(u_int8_t digest[SHA384_DIGEST_LENGTH], SHA2_CTX *context) /* Zero out state data */ explicit_bzero(context, sizeof(*context)); } +DEF_WEAK(SHA384Final); #endif /* !defined(SHA2_SMALL) */ diff --git a/lib/libc/hash/siphash.c b/lib/libc/hash/siphash.c index 1e1b9077a34..0f056a35811 100644 --- a/lib/libc/hash/siphash.c +++ b/lib/libc/hash/siphash.c @@ -1,4 +1,4 @@ -/* $OpenBSD: siphash.c,v 1.4 2015/02/20 11:51:03 tedu Exp $ */ +/* $OpenBSD: siphash.c,v 1.5 2015/09/11 09:18:27 guenther Exp $ */ /*- * Copyright (c) 2013 Andre Oppermann <andre@FreeBSD.org> @@ -68,6 +68,7 @@ SipHash_Init(SIPHASH_CTX *ctx, const SIPHASH_KEY *key) memset(ctx->buf, 0, sizeof(ctx->buf)); ctx->bytes = 0; } +DEF_WEAK(SipHash_Init); void SipHash_Update(SIPHASH_CTX *ctx, int rc, int rf, const void *src, size_t len) @@ -105,6 +106,7 @@ SipHash_Update(SIPHASH_CTX *ctx, int rc, int rf, const void *src, size_t len) if (len > 0) memcpy(&ctx->buf[used], ptr, len); } +DEF_WEAK(SipHash_Update); void SipHash_Final(void *dst, SIPHASH_CTX *ctx, int rc, int rf) @@ -115,6 +117,7 @@ SipHash_Final(void *dst, SIPHASH_CTX *ctx, int rc, int rf) *(uint64_t *)dst = htole64(r); } +DEF_WEAK(SipHash_Final); uint64_t SipHash_End(SIPHASH_CTX *ctx, int rc, int rf) @@ -135,6 +138,7 @@ SipHash_End(SIPHASH_CTX *ctx, int rc, int rf) explicit_bzero(ctx, sizeof(*ctx)); return (r); } +DEF_WEAK(SipHash_End); uint64_t SipHash(const SIPHASH_KEY *key, int rc, int rf, const void *src, size_t len) @@ -145,6 +149,7 @@ SipHash(const SIPHASH_KEY *key, int rc, int rf, const void *src, size_t len) SipHash_Update(&ctx, rc, rf, src, len); return (SipHash_End(&ctx, rc, rf)); } +DEF_WEAK(SipHash); #define SIP_ROTL(x, b) ((x) << (b)) | ( (x) >> (64 - (b))) diff --git a/lib/libc/hidden/blf.h b/lib/libc/hidden/blf.h new file mode 100644 index 00000000000..66bc66a1c7c --- /dev/null +++ b/lib/libc/hidden/blf.h @@ -0,0 +1,37 @@ +/* $OpenBSD: blf.h,v 1.1 2015/09/11 09:18:27 guenther Exp $ */ +/* + * Copyright (c) 2015 Philip Guenther <guenther@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 _LIBC_BLF_H_ +#define _LIBC_BLF_H_ + +#include_next <blf.h> + +PROTO_NORMAL(Blowfish_decipher); +PROTO_NORMAL(Blowfish_encipher); +PROTO_NORMAL(Blowfish_expand0state); +PROTO_NORMAL(Blowfish_expandstate); +PROTO_NORMAL(Blowfish_initstate); +PROTO_NORMAL(Blowfish_stream2word); +PROTO_NORMAL(blf_cbc_decrypt); +PROTO_NORMAL(blf_cbc_encrypt); +PROTO_NORMAL(blf_dec); +PROTO_NORMAL(blf_ecb_decrypt); +PROTO_NORMAL(blf_ecb_encrypt); +PROTO_NORMAL(blf_enc); +PROTO_NORMAL(blf_key); + +#endif /* _LIBC_BLF_H_ */ diff --git a/lib/libc/hidden/md5.h b/lib/libc/hidden/md5.h new file mode 100644 index 00000000000..3020cf69b50 --- /dev/null +++ b/lib/libc/hidden/md5.h @@ -0,0 +1,34 @@ +/* $OpenBSD: md5.h,v 1.1 2015/09/11 09:18:27 guenther Exp $ */ +/* + * Copyright (c) 2015 Philip Guenther <guenther@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 _LIBC_MD5_H_ +#define _LIBC_MD5_H_ + +#include_next <md5.h> +#include "namespace.h" + +PROTO_NORMAL(MD5Data); +PROTO_NORMAL(MD5End); +PROTO_NORMAL(MD5File); +PROTO_NORMAL(MD5FileChunk); +PROTO_NORMAL(MD5Final); +PROTO_NORMAL(MD5Init); +PROTO_NORMAL(MD5Pad); +PROTO_NORMAL(MD5Transform); +PROTO_NORMAL(MD5Update); + +#endif /* _LIBC_MD5_H_ */ diff --git a/lib/libc/hidden/rmd160.h b/lib/libc/hidden/rmd160.h new file mode 100644 index 00000000000..d71642ff6a5 --- /dev/null +++ b/lib/libc/hidden/rmd160.h @@ -0,0 +1,33 @@ +/* $OpenBSD: rmd160.h,v 1.1 2015/09/11 09:18:27 guenther Exp $ */ +/* + * Copyright (c) 2015 Philip Guenther <guenther@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 _LIBC_RMD160_H +#define _LIBC_RMD160_H + +#include_next <rmd160.h> + +PROTO_NORMAL(RMD160Data); +PROTO_NORMAL(RMD160End); +PROTO_NORMAL(RMD160File); +PROTO_NORMAL(RMD160FileChunk); +PROTO_NORMAL(RMD160Final); +PROTO_NORMAL(RMD160Init); +PROTO_NORMAL(RMD160Pad); +PROTO_NORMAL(RMD160Transform); +PROTO_NORMAL(RMD160Update); + +#endif /* _LIBC_RMD160_H */ diff --git a/lib/libc/hidden/sha1.h b/lib/libc/hidden/sha1.h new file mode 100644 index 00000000000..082d8ca16d7 --- /dev/null +++ b/lib/libc/hidden/sha1.h @@ -0,0 +1,34 @@ +/* $OpenBSD: sha1.h,v 1.1 2015/09/11 09:18:27 guenther Exp $ */ +/* + * Copyright (c) 2015 Philip Guenther <guenther@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. + */ +/* $OpenBSD: sha1.h,v 1.1 2015/09/11 09:18:27 guenther Exp $ */ + +#ifndef _LIBC_SHA1_H +#define _LIBC_SHA1_H + +#include_next <sha1.h> + +PROTO_NORMAL(SHA1Data); +PROTO_NORMAL(SHA1End); +PROTO_NORMAL(SHA1File); +PROTO_NORMAL(SHA1FileChunk); +PROTO_NORMAL(SHA1Final); +PROTO_NORMAL(SHA1Init); +PROTO_NORMAL(SHA1Pad); +PROTO_NORMAL(SHA1Transform); +PROTO_NORMAL(SHA1Update); + +#endif /* _LIBC_SHA1_H */ diff --git a/lib/libc/hidden/sha2.h b/lib/libc/hidden/sha2.h new file mode 100644 index 00000000000..a2cc81eaa0b --- /dev/null +++ b/lib/libc/hidden/sha2.h @@ -0,0 +1,61 @@ +/* $OpenBSD: sha2.h,v 1.1 2015/09/11 09:18:27 guenther Exp $ */ +/* + * Copyright (c) 2015 Philip Guenther <guenther@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. + */ +/* $OpenBSD: sha2.h,v 1.1 2015/09/11 09:18:27 guenther Exp $ */ + +#ifndef _LIBC_SHA2_H +#define _LIBC_SHA2_H + +#include_next <sha2.h> + +PROTO_NORMAL(SHA224Data); +PROTO_NORMAL(SHA224End); +PROTO_NORMAL(SHA224File); +PROTO_NORMAL(SHA224FileChunk); +PROTO_NORMAL(SHA224Final); +PROTO_NORMAL(SHA224Init); +PROTO_NORMAL(SHA224Pad); +PROTO_NORMAL(SHA224Transform); +PROTO_NORMAL(SHA224Update); +PROTO_NORMAL(SHA256Data); +PROTO_NORMAL(SHA256End); +PROTO_NORMAL(SHA256File); +PROTO_NORMAL(SHA256FileChunk); +PROTO_NORMAL(SHA256Final); +PROTO_NORMAL(SHA256Init); +PROTO_NORMAL(SHA256Pad); +PROTO_NORMAL(SHA256Transform); +PROTO_NORMAL(SHA256Update); +PROTO_NORMAL(SHA384Data); +PROTO_NORMAL(SHA384End); +PROTO_NORMAL(SHA384File); +PROTO_NORMAL(SHA384FileChunk); +PROTO_NORMAL(SHA384Final); +PROTO_NORMAL(SHA384Init); +PROTO_NORMAL(SHA384Pad); +PROTO_NORMAL(SHA384Transform); +PROTO_NORMAL(SHA384Update); +PROTO_NORMAL(SHA512Data); +PROTO_NORMAL(SHA512End); +PROTO_NORMAL(SHA512File); +PROTO_NORMAL(SHA512FileChunk); +PROTO_NORMAL(SHA512Final); +PROTO_NORMAL(SHA512Init); +PROTO_NORMAL(SHA512Pad); +PROTO_NORMAL(SHA512Transform); +PROTO_NORMAL(SHA512Update); + +#endif /* _LIBC_SHA2_H */ diff --git a/lib/libc/hidden/siphash.h b/lib/libc/hidden/siphash.h new file mode 100644 index 00000000000..f7dd884dd5e --- /dev/null +++ b/lib/libc/hidden/siphash.h @@ -0,0 +1,29 @@ +/* $OpenBSD: siphash.h,v 1.1 2015/09/11 09:18:27 guenther Exp $ */ +/* + * Copyright (c) 2015 Philip Guenther <guenther@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 _LIBC_SIPHASH +#define _LIBC_SIPHASH + +#include_next <siphash.h> + +PROTO_NORMAL(SipHash_Init); +PROTO_NORMAL(SipHash_Update); +PROTO_NORMAL(SipHash_End); +PROTO_NORMAL(SipHash_Final); +PROTO_NORMAL(SipHash); + +#endif /* !_LIBC_SIPHASH */ diff --git a/lib/libc/include/namespace.h b/lib/libc/include/namespace.h index c8c864a266e..cfdb95ad023 100644 --- a/lib/libc/include/namespace.h +++ b/lib/libc/include/namespace.h @@ -1,4 +1,4 @@ -/* $OpenBSD: namespace.h,v 1.6 2015/09/10 18:13:46 guenther Exp $ */ +/* $OpenBSD: namespace.h,v 1.7 2015/09/11 09:18:27 guenther Exp $ */ #ifndef _LIBC_NAMESPACE_H_ #define _LIBC_NAMESPACE_H_ @@ -124,6 +124,12 @@ * only be needed for syscalls that have C instead of asm stubs. * Matches with PROTO_NORMAL(), PROTO_CANCEL(), or PROTO_WRAP() * ex: DEF_SYS(pread) + * + * MAKE_CLONE(dst, src) Symbols that are exact clones of other symbols + * This declares _libc_dst as being the same type as dst, and makes + * _libc_dst a strong, hidden alias for _libc_src. You still need to + * DEF_STRONG(dst) or DEF_WEAK(dst) to alias dst itself + * ex: MAKE_CLONE(SHA224Pad, SHA256Pad) */ #include <sys/cdefs.h> /* for __dso_hidden and __{weak,strong}_alias */ @@ -146,6 +152,9 @@ #define DEF_WRAP(x) __weak_alias(x, WRAP(x)) #define DEF_SYS(x) __strong_alias(_thread_sys_##x, HIDDEN(x)) +#define MAKE_CLONE(dst, src) __dso_hidden typeof(dst) HIDDEN(dst) \ + __attribute__((alias (HIDDEN_STRING(src)))) + /* * gcc will generate calls to the functions below. |