From e8c016ef6bb7e825057460cea4d904e2b90eb424 Mon Sep 17 00:00:00 2001 From: Mark Powers Date: Thu, 15 Jan 2009 13:39:15 -0800 Subject: 6773928 n2cp should support CKM_AES_GCM --- usr/src/common/crypto/modes/gcm.c | 4 ++-- usr/src/common/crypto/modes/modes.h | 4 +++- usr/src/uts/common/crypto/core/kcf_prov_lib.c | 14 +++----------- usr/src/uts/common/sys/crypto/common.h | 5 +++-- 4 files changed, 11 insertions(+), 16 deletions(-) (limited to 'usr/src') diff --git a/usr/src/common/crypto/modes/gcm.c b/usr/src/common/crypto/modes/gcm.c index 4802d387d0..8f04f137c2 100644 --- a/usr/src/common/crypto/modes/gcm.c +++ b/usr/src/common/crypto/modes/gcm.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -42,7 +42,7 @@ struct aes_block { uint64_t b; }; -static void +void gcm_mul(uint64_t *x_in, uint64_t *y, uint64_t *res) { uint64_t R = { 0xe100000000000000ULL }; diff --git a/usr/src/common/crypto/modes/modes.h b/usr/src/common/crypto/modes/modes.h index 86cef69343..a52b7b6507 100644 --- a/usr/src/common/crypto/modes/modes.h +++ b/usr/src/common/crypto/modes/modes.h @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -362,6 +362,8 @@ extern int gcm_init_ctx(gcm_ctx_t *, char *, size_t, extern void calculate_ccm_mac(ccm_ctx_t *, uint8_t *, int (*encrypt_block)(const void *, const uint8_t *, uint8_t *)); +extern void gcm_mul(uint64_t *, uint64_t *, uint64_t *); + extern void crypto_init_ptrs(crypto_data_t *, void **, offset_t *); extern void crypto_get_ptrs(crypto_data_t *, void **, offset_t *, uint8_t **, size_t *, uint8_t **, size_t); diff --git a/usr/src/uts/common/crypto/core/kcf_prov_lib.c b/usr/src/uts/common/crypto/core/kcf_prov_lib.c index 2c116c4ba6..47402f648e 100644 --- a/usr/src/uts/common/crypto/core/kcf_prov_lib.c +++ b/usr/src/uts/common/crypto/core/kcf_prov_lib.c @@ -19,12 +19,10 @@ * CDDL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include #include #include @@ -94,12 +92,9 @@ crypto_uio_data(crypto_data_t *data, uchar_t *buf, int len, cmd_type_t cmd, buf += cur_len; break; case MD5_DIGEST_DATA: - update(digest_ctx, datap, cur_len); - break; case SHA1_DIGEST_DATA: - update(digest_ctx, datap, cur_len); - break; case SHA2_DIGEST_DATA: + case GHASH_DATA: update(digest_ctx, datap, cur_len); break; } @@ -177,12 +172,9 @@ crypto_mblk_data(crypto_data_t *data, uchar_t *buf, int len, cmd_type_t cmd, buf += cur_len; break; case MD5_DIGEST_DATA: - update(digest_ctx, datap, cur_len); - break; case SHA1_DIGEST_DATA: - update(digest_ctx, datap, cur_len); - break; case SHA2_DIGEST_DATA: + case GHASH_DATA: update(digest_ctx, datap, cur_len); break; } diff --git a/usr/src/uts/common/sys/crypto/common.h b/usr/src/uts/common/sys/crypto/common.h index 795d25b07c..29fa0048d8 100644 --- a/usr/src/uts/common/sys/crypto/common.h +++ b/usr/src/uts/common/sys/crypto/common.h @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -448,7 +448,8 @@ typedef enum cmd_type { COMPARE_TO_DATA, MD5_DIGEST_DATA, SHA1_DIGEST_DATA, - SHA2_DIGEST_DATA + SHA2_DIGEST_DATA, + GHASH_DATA } cmd_type_t; #define CRYPTO_DO_UPDATE 0x01 -- cgit v1.2.3