changeset 2969:6b3cea1fee3e

6484163 memory leak in get_dsa_public_key
author mcpowers
date Mon, 23 Oct 2006 08:01:32 -0700
parents 77abf329e9ed
children f7b39b7a47d4
files usr/src/lib/pkcs11/pkcs11_kernel/common/kernelSign.c usr/src/lib/pkcs11/pkcs11_kernel/common/kernelVerify.c
diffstat 2 files changed, 9 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/lib/pkcs11/pkcs11_kernel/common/kernelSign.c	Mon Oct 23 06:15:58 2006 -0700
+++ b/usr/src/lib/pkcs11/pkcs11_kernel/common/kernelSign.c	Mon Oct 23 08:01:32 2006 -0700
@@ -2,9 +2,8 @@
  * CDDL HEADER START
  *
  * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License").  You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
  *
  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  * or http://www.opensolaris.org/os/licensing.
@@ -20,7 +19,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -137,9 +136,7 @@
 	if (key_p->is_lib_obj) {
 		if (key_p->class == CKO_SECRET_KEY) {
 			free(sign_init.si_key.ck_data);
-		} else if (key_p->key_type == CKK_RSA) {
-			free_key_attributes(&sign_init.si_key);
-		} else if (key_p->key_type == CKK_DSA) {
+		} else {
 			free_key_attributes(&sign_init.si_key);
 		}
 	}
--- a/usr/src/lib/pkcs11/pkcs11_kernel/common/kernelVerify.c	Mon Oct 23 06:15:58 2006 -0700
+++ b/usr/src/lib/pkcs11/pkcs11_kernel/common/kernelVerify.c	Mon Oct 23 08:01:32 2006 -0700
@@ -2,9 +2,8 @@
  * CDDL HEADER START
  *
  * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License").  You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
  *
  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  * or http://www.opensolaris.org/os/licensing.
@@ -20,7 +19,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -136,11 +135,11 @@
 		rv = crypto2pkcs11_error_number(verify_init.vi_return_value);
 	}
 
-	/* free the memory allocated for sign_init.si_key */
+	/* free the memory allocated for verify_init.vi_key */
 	if (key_p->is_lib_obj) {
 		if (key_p->class == CKO_SECRET_KEY) {
 			free(verify_init.vi_key.ck_data);
-		} else if (key_p->key_type == CKK_RSA) {
+		} else {
 			free_key_attributes(&verify_init.vi_key);
 		}
 	}