X-Git-Url: http://git.silcnet.org/gitweb/?a=blobdiff_plain;f=lib%2Fsilccrypt%2Fsilcpkcs.c;h=74fd6f03ab8b5a3ed35d106a288ec8853d05e7b9;hb=52e57c880aba9c5e89f59d962eb9af75670b76e0;hp=4665c160d77545340f0edf49b2955ba950738d2e;hpb=cf21209b9866f826f566ebd10059661446f8b702;p=silc.git diff --git a/lib/silccrypt/silcpkcs.c b/lib/silccrypt/silcpkcs.c index 4665c160..74fd6f03 100644 --- a/lib/silccrypt/silcpkcs.c +++ b/lib/silccrypt/silcpkcs.c @@ -4,7 +4,7 @@ Author: Pekka Riikonen - Copyright (C) 1997 - 2006 Pekka Riikonen + Copyright (C) 1997 - 2007 Pekka Riikonen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -489,6 +489,7 @@ SilcBool silc_pkcs_public_key_alloc(SilcPKCSType type, void silc_pkcs_public_key_free(SilcPublicKey public_key) { public_key->pkcs->public_key_free(public_key->public_key); + silc_free(public_key); } /* Exports public key */ @@ -512,7 +513,7 @@ SilcUInt32 silc_pkcs_public_key_get_len(SilcPublicKey public_key) void *silc_pkcs_get_context(SilcPKCSType type, SilcPublicKey public_key) { if (public_key->pkcs->type != type) - return FALSE; + return NULL; return public_key->public_key; } @@ -564,6 +565,7 @@ SilcUInt32 silc_pkcs_private_key_get_len(SilcPrivateKey private_key) void silc_pkcs_private_key_free(SilcPrivateKey private_key) { private_key->pkcs->private_key_free(private_key->private_key); + silc_free(private_key); } /* Encrypts */ @@ -571,10 +573,10 @@ void silc_pkcs_private_key_free(SilcPrivateKey private_key) SilcBool silc_pkcs_encrypt(SilcPublicKey public_key, unsigned char *src, SilcUInt32 src_len, unsigned char *dst, SilcUInt32 dst_size, - SilcUInt32 *dst_len) + SilcUInt32 *dst_len, SilcRng rng) { return public_key->pkcs->encrypt(public_key->public_key, src, src_len, - dst, dst_size, dst_len); + dst, dst_size, dst_len, rng); } /* Decrypts */ @@ -593,10 +595,11 @@ SilcBool silc_pkcs_decrypt(SilcPrivateKey private_key, SilcBool silc_pkcs_sign(SilcPrivateKey private_key, unsigned char *src, SilcUInt32 src_len, unsigned char *dst, SilcUInt32 dst_size, - SilcUInt32 *dst_len, SilcHash hash) + SilcUInt32 *dst_len, SilcBool compute_hash, + SilcHash hash) { return private_key->pkcs->sign(private_key->private_key, src, src_len, - dst, dst_size, dst_len, hash); + dst, dst_size, dst_len, compute_hash, hash); } /* Verifies signature */ @@ -690,6 +693,7 @@ SilcBool silc_pkcs_load_public_key(const char *filename, silc_free(data); silc_free(public_key); + *ret_public_key = NULL; return FALSE; } @@ -775,6 +779,7 @@ SilcBool silc_pkcs_load_private_key(const char *filename, silc_free(data); silc_free(private_key); + *ret_private_key = NULL; return FALSE; }