summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2012-07-04 17:49:51 +0200
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2012-07-04 17:49:51 +0200
commit8eb212b1e03671b774ed13071eb72b402e1c0882 (patch)
treed99f625be736477247f0b262a5b0a068762ee148
parentae312d9b32361e88b6b522cf3478f06ea4392bbf (diff)
downloadgnutls-8eb212b1e03671b774ed13071eb72b402e1c0882.tar.gz
A deinit function implies GNUTLS_PRIVKEY_IMPORT_AUTO_RELEASE. Based on patch by David Woodhouse.
-rw-r--r--lib/gnutls_privkey.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/gnutls_privkey.c b/lib/gnutls_privkey.c
index e87f1ab69f..de8061f5ab 100644
--- a/lib/gnutls_privkey.c
+++ b/lib/gnutls_privkey.c
@@ -435,7 +435,8 @@ int ret;
*
* This function will associate the given callbacks with the
* #gnutls_privkey_t structure. At least one of the two callbacks
- * must be non-null.
+ * must be non-null. If a deinitialization function is provided
+ * then flags is assumed to contain %GNUTLS_PRIVKEY_IMPORT_AUTO_RELEASE.
*
* Returns: On success, %GNUTLS_E_SUCCESS (0) is returned, otherwise a
* negative error value.
@@ -471,6 +472,10 @@ int ret;
pkey->pk_algorithm = pk;
pkey->flags = flags;
+ /* Ensure gnutls_privkey_deinit() calls the deinit_func */
+ if (deinit_func)
+ pkey->flags |= GNUTLS_PRIVKEY_IMPORT_AUTO_RELEASE;
+
return 0;
}