summaryrefslogtreecommitdiff
path: root/src/lib/libc/crypt
diff options
context:
space:
mode:
authorguenther <>2015-09-11 09:18:27 +0000
committerguenther <>2015-09-11 09:18:27 +0000
commitb0404dc3aed5b42933d7f9650d2a9f6e0620f34c (patch)
tree54b7815c87b1e17a76f16279310a2867b9a1ef00 /src/lib/libc/crypt
parentc041f863310ba8ab2a1bce7605887f1deff68a38 (diff)
downloadopenbsd-b0404dc3aed5b42933d7f9650d2a9f6e0620f34c.tar.gz
openbsd-b0404dc3aed5b42933d7f9650d2a9f6e0620f34c.tar.bz2
openbsd-b0404dc3aed5b42933d7f9650d2a9f6e0620f34c.zip
Wrap blowfish, sha*, md5, and rmd160 so that internal calls go direct
ok deraadt@
Diffstat (limited to 'src/lib/libc/crypt')
-rw-r--r--src/lib/libc/crypt/blowfish.c15
1 files changed, 14 insertions, 1 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