| @@ -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 | |
308 | static const struct swcr_auth_hash swcr_auth_hash_sha1 = { | | 308 | static 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 | |
314 | static const struct swcr_auth_hash swcr_auth_hash_hmac_sha2_256 = { | | 314 | static 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 | |
320 | static const struct swcr_auth_hash swcr_auth_hash_hmac_sha2_384 = { | | 320 | static 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 | |
326 | static const struct swcr_auth_hash swcr_auth_hash_hmac_sha2_512 = { | | 326 | static 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 | |
332 | static const struct swcr_auth_hash swcr_auth_hash_aes_xcbc_mac = { | | 332 | static 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 | |
339 | static const struct swcr_auth_hash swcr_auth_hash_gmac_aes_128 = { | | 339 | static 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 | |
348 | static const struct swcr_auth_hash swcr_auth_hash_gmac_aes_192 = { | | 348 | static const struct swcr_auth_hash swcr_auth_hash_gmac_aes_192 = { |