Sat Oct 12 00:49:30 2019 UTC ()
add (void *) intermediate casts to elide gcc function cast warnings. This
is the simplest solution; choices:
- add pragmas, complex and ugly (need to be gcc-specific)
- add -Wno to COPTS. Needs to be done in many makefiles because of rump
- add intermediate functions: slows down things


(christos)
diff -r1.53 -r1.54 src/sys/opencrypto/cryptosoft.c
diff -r1.27 -r1.28 src/sys/opencrypto/cryptosoft_xform.c

cvs diff -r1.53 -r1.54 src/sys/opencrypto/cryptosoft.c (expand / switch to unified diff)

--- src/sys/opencrypto/cryptosoft.c 2019/07/11 23:27:24 1.53
+++ src/sys/opencrypto/cryptosoft.c 2019/10/12 00:49:30 1.54
@@ -1,40 +1,40 @@ @@ -1,40 +1,40 @@
1/* $NetBSD: cryptosoft.c,v 1.53 2019/07/11 23:27:24 christos Exp $ */ 1/* $NetBSD: cryptosoft.c,v 1.54 2019/10/12 00:49:30 christos Exp $ */
2/* $FreeBSD: src/sys/opencrypto/cryptosoft.c,v 1.2.2.1 2002/11/21 23:34:23 sam Exp $ */ 2/* $FreeBSD: src/sys/opencrypto/cryptosoft.c,v 1.2.2.1 2002/11/21 23:34:23 sam Exp $ */
3/* $OpenBSD: cryptosoft.c,v 1.35 2002/04/26 08:43:50 deraadt Exp $ */ 3/* $OpenBSD: cryptosoft.c,v 1.35 2002/04/26 08:43:50 deraadt Exp $ */
4 4
5/* 5/*
6 * The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu) 6 * The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu)
7 * 7 *
8 * This code was written by Angelos D. Keromytis in Athens, Greece, in 8 * This code was written by Angelos D. Keromytis in Athens, Greece, in
9 * February 2000. Network Security Technologies Inc. (NSTI) kindly 9 * February 2000. Network Security Technologies Inc. (NSTI) kindly
10 * supported the development of this code. 10 * supported the development of this code.
11 * 11 *
12 * Copyright (c) 2000, 2001 Angelos D. Keromytis 12 * Copyright (c) 2000, 2001 Angelos D. Keromytis
13 * 13 *
14 * Permission to use, copy, and modify this software with or without fee 14 * Permission to use, copy, and modify this software with or without fee
15 * is hereby granted, provided that this entire notice is included in 15 * is hereby granted, provided that this entire notice is included in
16 * all source code copies of any software which is or includes a copy or 16 * all source code copies of any software which is or includes a copy or
17 * modification of this software. 17 * modification of this software.
18 * 18 *
19 * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR 19 * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR
20 * IMPLIED WARRANTY. IN PARTICULAR, NONE OF THE AUTHORS MAKES ANY 20 * IMPLIED WARRANTY. IN PARTICULAR, NONE OF THE AUTHORS MAKES ANY
21 * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE 21 * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE
22 * MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR 22 * MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR
23 * PURPOSE. 23 * PURPOSE.
24 */ 24 */
25 25
26#include <sys/cdefs.h> 26#include <sys/cdefs.h>
27__KERNEL_RCSID(0, "$NetBSD: cryptosoft.c,v 1.53 2019/07/11 23:27:24 christos Exp $"); 27__KERNEL_RCSID(0, "$NetBSD: cryptosoft.c,v 1.54 2019/10/12 00:49:30 christos Exp $");
28 28
29#include <sys/param.h> 29#include <sys/param.h>
30#include <sys/systm.h> 30#include <sys/systm.h>
31#include <sys/malloc.h> 31#include <sys/malloc.h>
32#include <sys/mbuf.h> 32#include <sys/mbuf.h>
33#include <sys/sysctl.h> 33#include <sys/sysctl.h>
34#include <sys/errno.h> 34#include <sys/errno.h>
35#include <sys/cprng.h> 35#include <sys/cprng.h>
36#include <sys/module.h> 36#include <sys/module.h>
37#include <sys/device.h> 37#include <sys/device.h>
38 38
39#ifdef _KERNEL_OPT 39#ifdef _KERNEL_OPT
40#include "opt_ocf.h" 40#include "opt_ocf.h"
@@ -490,35 +490,35 @@ swcr_authcompute(struct cryptop *crp, st @@ -490,35 +490,35 @@ swcr_authcompute(struct cryptop *crp, st
490 if (sw->sw_ictx == 0) 490 if (sw->sw_ictx == 0)
491 return EINVAL; 491 return EINVAL;
492 492
493 axf = sw->sw_axf; 493 axf = sw->sw_axf;
494 494
495 memcpy(&ctx, sw->sw_ictx, axf->ctxsize); 495 memcpy(&ctx, sw->sw_ictx, axf->ctxsize);
496 496
497 switch (outtype) { 497 switch (outtype) {
498 case CRYPTO_BUF_CONTIG: 498 case CRYPTO_BUF_CONTIG:
499 axf->Update(&ctx, (char *)buf + crd->crd_skip, crd->crd_len); 499 axf->Update(&ctx, (char *)buf + crd->crd_skip, crd->crd_len);
500 break; 500 break;
501 case CRYPTO_BUF_MBUF: 501 case CRYPTO_BUF_MBUF:
502 err = m_apply((struct mbuf *) buf, crd->crd_skip, crd->crd_len, 502 err = m_apply((struct mbuf *) buf, crd->crd_skip, crd->crd_len,
503 (int (*)(void*, void *, unsigned int)) axf->Update, 503 (int (*)(void*, void *, unsigned int))(void *)axf->Update,
504 (void *) &ctx); 504 (void *) &ctx);
505 if (err) 505 if (err)
506 return err; 506 return err;
507 break; 507 break;
508 case CRYPTO_BUF_IOV: 508 case CRYPTO_BUF_IOV:
509 err = cuio_apply((struct uio *) buf, crd->crd_skip, 509 err = cuio_apply((struct uio *) buf, crd->crd_skip,
510 crd->crd_len, 510 crd->crd_len,
511 (int (*)(void *, void *, unsigned int)) axf->Update, 511 (int (*)(void *, void *, unsigned int))(void *)axf->Update,
512 (void *) &ctx); 512 (void *) &ctx);
513 if (err) { 513 if (err) {
514 return err; 514 return err;
515 } 515 }
516 break; 516 break;
517 default: 517 default:
518 return EINVAL; 518 return EINVAL;
519 } 519 }
520 520
521 switch (sw->sw_alg) { 521 switch (sw->sw_alg) {
522 case CRYPTO_MD5_HMAC: 522 case CRYPTO_MD5_HMAC:
523 case CRYPTO_MD5_HMAC_96: 523 case CRYPTO_MD5_HMAC_96:
524 case CRYPTO_SHA1_HMAC: 524 case CRYPTO_SHA1_HMAC:

cvs diff -r1.27 -r1.28 src/sys/opencrypto/cryptosoft_xform.c (expand / switch to unified diff)

--- src/sys/opencrypto/cryptosoft_xform.c 2014/11/27 20:30:21 1.27
+++ src/sys/opencrypto/cryptosoft_xform.c 2019/10/12 00:49:30 1.28
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: cryptosoft_xform.c,v 1.27 2014/11/27 20:30:21 christos Exp $ */ 1/* $NetBSD: cryptosoft_xform.c,v 1.28 2019/10/12 00:49:30 christos Exp $ */
2/* $FreeBSD: src/sys/opencrypto/xform.c,v 1.1.2.1 2002/11/21 23:34:23 sam Exp $ */ 2/* $FreeBSD: src/sys/opencrypto/xform.c,v 1.1.2.1 2002/11/21 23:34:23 sam Exp $ */
3/* $OpenBSD: xform.c,v 1.19 2002/08/16 22:47:25 dhartmei Exp $ */ 3/* $OpenBSD: xform.c,v 1.19 2002/08/16 22:47:25 dhartmei Exp $ */
4 4
5/* 5/*
6 * The authors of this code are John Ioannidis (ji@tla.org), 6 * The authors of this code are John Ioannidis (ji@tla.org),
7 * Angelos D. Keromytis (kermit@csd.uch.gr) and 7 * Angelos D. Keromytis (kermit@csd.uch.gr) and
8 * Niels Provos (provos@physnet.uni-hamburg.de). 8 * Niels Provos (provos@physnet.uni-hamburg.de).
9 * 9 *
10 * This code was written by John Ioannidis for BSD/OS in Athens, Greece, 10 * This code was written by John Ioannidis for BSD/OS in Athens, Greece,
11 * in November 1995. 11 * in November 1995.
12 * 12 *
13 * Ported to OpenBSD and NetBSD, with additional transforms, in December 1996, 13 * Ported to OpenBSD and NetBSD, with additional transforms, in December 1996,
14 * by Angelos D. Keromytis. 14 * by Angelos D. Keromytis.
@@ -30,27 +30,27 @@ @@ -30,27 +30,27 @@
30 * You may use this code under the GNU public license if you so wish. Please 30 * You may use this code under the GNU public license if you so wish. Please
31 * contribute changes back to the authors under this freer than GPL license 31 * contribute changes back to the authors under this freer than GPL license
32 * so that we may further the use of strong encryption without limitations to 32 * so that we may further the use of strong encryption without limitations to
33 * all. 33 * all.
34 * 34 *
35 * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR 35 * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR
36 * IMPLIED WARRANTY. IN PARTICULAR, NONE OF THE AUTHORS MAKES ANY 36 * IMPLIED WARRANTY. IN PARTICULAR, NONE OF THE AUTHORS MAKES ANY
37 * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE 37 * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE
38 * MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR 38 * MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR
39 * PURPOSE. 39 * PURPOSE.
40 */ 40 */
41 41
42#include <sys/cdefs.h> 42#include <sys/cdefs.h>
43__KERNEL_RCSID(1, "$NetBSD: cryptosoft_xform.c,v 1.27 2014/11/27 20:30:21 christos Exp $"); 43__KERNEL_RCSID(1, "$NetBSD: cryptosoft_xform.c,v 1.28 2019/10/12 00:49:30 christos Exp $");
44 44
45#include <crypto/blowfish/blowfish.h> 45#include <crypto/blowfish/blowfish.h>
46#include <crypto/cast128/cast128.h> 46#include <crypto/cast128/cast128.h>
47#include <crypto/des/des.h> 47#include <crypto/des/des.h>
48#include <crypto/rijndael/rijndael.h> 48#include <crypto/rijndael/rijndael.h>
49#include <crypto/skipjack/skipjack.h> 49#include <crypto/skipjack/skipjack.h>
50#include <crypto/camellia/camellia.h> 50#include <crypto/camellia/camellia.h>
51 51
52#include <opencrypto/deflate.h> 52#include <opencrypto/deflate.h>
53 53
54#include <sys/md5.h> 54#include <sys/md5.h>
55#include <sys/rmd160.h> 55#include <sys/rmd160.h>
56#include <sys/sha1.h> 56#include <sys/sha1.h>
@@ -303,46 +303,46 @@ static const struct swcr_auth_hash swcr_ @@ -303,46 +303,46 @@ static const struct swcr_auth_hash swcr_
303 &auth_hash_md5, sizeof(MD5_CTX), 303 &auth_hash_md5, sizeof(MD5_CTX),
304 (void (*) (void *)) MD5Init, NULL, NULL, MD5Update_int, 304 (void (*) (void *)) MD5Init, NULL, NULL, MD5Update_int,
305 (void (*) (u_int8_t *, void *)) MD5Final 305 (void (*) (u_int8_t *, void *)) MD5Final
306}; 306};
307 307
308static const struct swcr_auth_hash swcr_auth_hash_sha1 = { 308static const struct swcr_auth_hash swcr_auth_hash_sha1 = {
309 &auth_hash_sha1, sizeof(SHA1_CTX), 309 &auth_hash_sha1, sizeof(SHA1_CTX),
310 (void (*)(void *)) SHA1Init, NULL, NULL, SHA1Update_int, 310 (void (*)(void *)) SHA1Init, NULL, NULL, SHA1Update_int,
311 (void (*)(u_int8_t *, void *)) SHA1Final 311 (void (*)(u_int8_t *, void *)) SHA1Final
312}; 312};
313 313
314static const struct swcr_auth_hash swcr_auth_hash_hmac_sha2_256 = { 314static const struct swcr_auth_hash swcr_auth_hash_hmac_sha2_256 = {
315 &auth_hash_hmac_sha2_256, sizeof(SHA256_CTX), 315 &auth_hash_hmac_sha2_256, sizeof(SHA256_CTX),
316 (void (*)(void *)) SHA256_Init, NULL, NULL, SHA256Update_int, 316 (void (*)(void *))(void *)SHA256_Init, NULL, NULL, SHA256Update_int,
317 (void (*)(u_int8_t *, void *)) SHA256_Final 317 (void (*)(u_int8_t *, void *))(void *)SHA256_Final
318}; 318};
319 319
320static const struct swcr_auth_hash swcr_auth_hash_hmac_sha2_384 = { 320static const struct swcr_auth_hash swcr_auth_hash_hmac_sha2_384 = {
321 &auth_hash_hmac_sha2_384, sizeof(SHA384_CTX), 321 &auth_hash_hmac_sha2_384, sizeof(SHA384_CTX),
322 (void (*)(void *)) SHA384_Init, NULL, NULL, SHA384Update_int, 322 (void (*)(void *))(void *)SHA384_Init, NULL, NULL, SHA384Update_int,
323 (void (*)(u_int8_t *, void *)) SHA384_Final 323 (void (*)(u_int8_t *, void *))(void *)SHA384_Final
324}; 324};
325 325
326static const struct swcr_auth_hash swcr_auth_hash_hmac_sha2_512 = { 326static const struct swcr_auth_hash swcr_auth_hash_hmac_sha2_512 = {
327 &auth_hash_hmac_sha2_512, sizeof(SHA512_CTX), 327 &auth_hash_hmac_sha2_512, sizeof(SHA512_CTX),
328 (void (*)(void *)) SHA512_Init, NULL, NULL, SHA512Update_int, 328 (void (*)(void *))(void *)SHA512_Init, NULL, NULL, SHA512Update_int,
329 (void (*)(u_int8_t *, void *)) SHA512_Final 329 (void (*)(u_int8_t *, void *))(void *)SHA512_Final
330}; 330};
331 331
332static const struct swcr_auth_hash swcr_auth_hash_aes_xcbc_mac = { 332static const struct swcr_auth_hash swcr_auth_hash_aes_xcbc_mac = {
333 &auth_hash_aes_xcbc_mac_96, sizeof(aesxcbc_ctx), 333 &auth_hash_aes_xcbc_mac_96, sizeof(aesxcbc_ctx),
334 null_init, 334 null_init,
335 (void (*)(void *, const u_int8_t *, u_int16_t))aes_xcbc_mac_init, 335 (void (*)(void *, const u_int8_t *, u_int16_t))(void *)aes_xcbc_mac_init,
336 NULL, aes_xcbc_mac_loop, aes_xcbc_mac_result 336 NULL, aes_xcbc_mac_loop, aes_xcbc_mac_result
337}; 337};
338 338
339static const struct swcr_auth_hash swcr_auth_hash_gmac_aes_128 = { 339static const struct swcr_auth_hash swcr_auth_hash_gmac_aes_128 = {
340 &auth_hash_gmac_aes_128, sizeof(AES_GMAC_CTX), 340 &auth_hash_gmac_aes_128, sizeof(AES_GMAC_CTX),
341 (void (*)(void *))AES_GMAC_Init, 341 (void (*)(void *))AES_GMAC_Init,
342 (void (*)(void *, const u_int8_t *, u_int16_t))AES_GMAC_Setkey, 342 (void (*)(void *, const u_int8_t *, u_int16_t))AES_GMAC_Setkey,
343 (void (*)(void *, const u_int8_t *, u_int16_t))AES_GMAC_Reinit, 343 (void (*)(void *, const u_int8_t *, u_int16_t))AES_GMAC_Reinit,
344 (int (*)(void *, const u_int8_t *, u_int16_t))AES_GMAC_Update, 344 (int (*)(void *, const u_int8_t *, u_int16_t))AES_GMAC_Update,
345 (void (*)(u_int8_t *, void *))AES_GMAC_Final 345 (void (*)(u_int8_t *, void *))AES_GMAC_Final
346}; 346};
347 347
348static const struct swcr_auth_hash swcr_auth_hash_gmac_aes_192 = { 348static const struct swcr_auth_hash swcr_auth_hash_gmac_aes_192 = {