summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/libc/crypt/blowfish.c15
-rw-r--r--src/lib/libc/include/namespace.h11
2 files changed, 24 insertions, 2 deletions
diff --git a/src/lib/libc/crypt/blowfish.c b/src/lib/libc/crypt/blowfish.c
index c337df8a0a..a658e602d2 100644
--- a/src/lib/libc/crypt/blowfish.c
+++ b/src/lib/libc/crypt/blowfish.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: blowfish.c,v 1.18 2004/11/02 17:23:26 hshoexer Exp $ */ 1/* $OpenBSD: blowfish.c,v 1.19 2015/09/11 09:18:27 guenther Exp $ */
2/* 2/*
3 * Blowfish block cipher for OpenBSD 3 * Blowfish block cipher for OpenBSD
4 * Copyright 1997 Niels Provos <provos@physnet.uni-hamburg.de> 4 * 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)
87 *xl = Xr ^ p[17]; 87 *xl = Xr ^ p[17];
88 *xr = Xl; 88 *xr = Xl;
89} 89}
90DEF_WEAK(Blowfish_encipher);
90 91
91void 92void
92Blowfish_decipher(blf_ctx *c, u_int32_t *xl, u_int32_t *xr) 93Blowfish_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)
112 *xl = Xr ^ p[0]; 113 *xl = Xr ^ p[0];
113 *xr = Xl; 114 *xr = Xl;
114} 115}
116DEF_WEAK(Blowfish_decipher);
115 117
116void 118void
117Blowfish_initstate(blf_ctx *c) 119Blowfish_initstate(blf_ctx *c)
@@ -391,6 +393,7 @@ Blowfish_initstate(blf_ctx *c)
391 393
392 *c = initstate; 394 *c = initstate;
393} 395}
396DEF_WEAK(Blowfish_initstate);
394 397
395u_int32_t 398u_int32_t
396Blowfish_stream2word(const u_int8_t *data, u_int16_t databytes, 399Blowfish_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,
412 *current = j; 415 *current = j;
413 return temp; 416 return temp;
414} 417}
418DEF_WEAK(Blowfish_stream2word);
415 419
416void 420void
417Blowfish_expand0state(blf_ctx *c, const u_int8_t *key, u_int16_t keybytes) 421Blowfish_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)
449 } 453 }
450 } 454 }
451} 455}
456DEF_WEAK(Blowfish_expand0state);
452 457
453 458
454void 459void
@@ -493,6 +498,7 @@ Blowfish_expandstate(blf_ctx *c, const u_int8_t *data, u_int16_t databytes,
493 } 498 }
494 499
495} 500}
501DEF_WEAK(Blowfish_expandstate);
496 502
497void 503void
498blf_key(blf_ctx *c, const u_int8_t *k, u_int16_t len) 504blf_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)
503 /* Transform S-boxes and subkeys with key */ 509 /* Transform S-boxes and subkeys with key */
504 Blowfish_expand0state(c, k, len); 510 Blowfish_expand0state(c, k, len);
505} 511}
512DEF_WEAK(blf_key);
506 513
507void 514void
508blf_enc(blf_ctx *c, u_int32_t *data, u_int16_t blocks) 515blf_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)
516 d += 2; 523 d += 2;
517 } 524 }
518} 525}
526DEF_WEAK(blf_enc);
519 527
520void 528void
521blf_dec(blf_ctx *c, u_int32_t *data, u_int16_t blocks) 529blf_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)
529 d += 2; 537 d += 2;
530 } 538 }
531} 539}
540DEF_WEAK(blf_dec);
532 541
533void 542void
534blf_ecb_encrypt(blf_ctx *c, u_int8_t *data, u_int32_t len) 543blf_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)
551 data += 8; 560 data += 8;
552 } 561 }
553} 562}
563DEF_WEAK(blf_ecb_encrypt);
554 564
555void 565void
556blf_ecb_decrypt(blf_ctx *c, u_int8_t *data, u_int32_t len) 566blf_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)
573 data += 8; 583 data += 8;
574 } 584 }
575} 585}
586DEF_WEAK(blf_ecb_decrypt);
576 587
577void 588void
578blf_cbc_encrypt(blf_ctx *c, u_int8_t *iv, u_int8_t *data, u_int32_t len) 589blf_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)
598 data += 8; 609 data += 8;
599 } 610 }
600} 611}
612DEF_WEAK(blf_cbc_encrypt);
601 613
602void 614void
603blf_cbc_decrypt(blf_ctx *c, u_int8_t *iva, u_int8_t *data, u_int32_t len) 615blf_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)
639 for (j = 0; j < 8; j++) 651 for (j = 0; j < 8; j++)
640 data[j] ^= iva[j]; 652 data[j] ^= iva[j];
641} 653}
654DEF_WEAK(blf_cbc_decrypt);
642 655
643#if 0 656#if 0
644void 657void
diff --git a/src/lib/libc/include/namespace.h b/src/lib/libc/include/namespace.h
index c8c864a266..cfdb95ad02 100644
--- a/src/lib/libc/include/namespace.h
+++ b/src/lib/libc/include/namespace.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: namespace.h,v 1.6 2015/09/10 18:13:46 guenther Exp $ */ 1/* $OpenBSD: namespace.h,v 1.7 2015/09/11 09:18:27 guenther Exp $ */
2 2
3#ifndef _LIBC_NAMESPACE_H_ 3#ifndef _LIBC_NAMESPACE_H_
4#define _LIBC_NAMESPACE_H_ 4#define _LIBC_NAMESPACE_H_
@@ -124,6 +124,12 @@
124 * only be needed for syscalls that have C instead of asm stubs. 124 * only be needed for syscalls that have C instead of asm stubs.
125 * Matches with PROTO_NORMAL(), PROTO_CANCEL(), or PROTO_WRAP() 125 * Matches with PROTO_NORMAL(), PROTO_CANCEL(), or PROTO_WRAP()
126 * ex: DEF_SYS(pread) 126 * ex: DEF_SYS(pread)
127 *
128 * MAKE_CLONE(dst, src) Symbols that are exact clones of other symbols
129 * This declares _libc_dst as being the same type as dst, and makes
130 * _libc_dst a strong, hidden alias for _libc_src. You still need to
131 * DEF_STRONG(dst) or DEF_WEAK(dst) to alias dst itself
132 * ex: MAKE_CLONE(SHA224Pad, SHA256Pad)
127 */ 133 */
128 134
129#include <sys/cdefs.h> /* for __dso_hidden and __{weak,strong}_alias */ 135#include <sys/cdefs.h> /* for __dso_hidden and __{weak,strong}_alias */
@@ -146,6 +152,9 @@
146#define DEF_WRAP(x) __weak_alias(x, WRAP(x)) 152#define DEF_WRAP(x) __weak_alias(x, WRAP(x))
147#define DEF_SYS(x) __strong_alias(_thread_sys_##x, HIDDEN(x)) 153#define DEF_SYS(x) __strong_alias(_thread_sys_##x, HIDDEN(x))
148 154
155#define MAKE_CLONE(dst, src) __dso_hidden typeof(dst) HIDDEN(dst) \
156 __attribute__((alias (HIDDEN_STRING(src))))
157
149 158
150/* 159/*
151 * gcc will generate calls to the functions below. 160 * gcc will generate calls to the functions below.