Author: Pekka Riikonen <priikone@silcnet.org>
- 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
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 */
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;
}
void silc_pkcs_private_key_free(SilcPrivateKey private_key)
{
private_key->pkcs->private_key_free(private_key->private_key);
+ silc_free(private_key);
}
/* Encrypts */
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 */
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 */
silc_free(data);
silc_free(public_key);
+ *ret_public_key = NULL;
return FALSE;
}
silc_free(data);
silc_free(private_key);
+ *ret_private_key = NULL;
return FALSE;
}