Added preliminary Symbian support.
[silc.git] / lib / silccrypt / silcpkcs.h
index b18747fbd1c28892e47d08d8ed485a988743901b..78812b0f870bd3fcbbb1571fd7be6659d1f28932 100644 (file)
@@ -4,7 +4,7 @@
 
   Author: Pekka Riikonen <priikone@silcnet.org>
 
-  Copyright (C) 1997 - 2005 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
@@ -155,7 +155,8 @@ typedef struct {
                      SilcUInt32 src_len,
                      unsigned char *dst,
                      SilcUInt32 dst_size,
-                     SilcUInt32 *ret_dst_len);
+                     SilcUInt32 *ret_dst_len,
+                     SilcRng rng);
   SilcBool (*decrypt)(void *private_key,
                      unsigned char *src,
                      SilcUInt32 src_len,
@@ -260,7 +261,8 @@ struct SilcPKCSObjectStruct {
                      SilcUInt32 src_len,
                      unsigned char *dst,
                      SilcUInt32 dst_size,
-                     SilcUInt32 *ret_dst_len);
+                     SilcUInt32 *ret_dst_len,
+                     SilcRng rng);
   SilcBool (*decrypt)(void *private_key,
                      unsigned char *src,
                      SilcUInt32 src_len,
@@ -429,53 +431,57 @@ const SilcPKCSAlgorithm *silc_pkcs_find_algorithm(const char *algorithm,
  *
  * SYNOPSIS
  *
- *    const SilcPKCSObject *silc_pkcs_get_pkcs(SilcPublicKey public_key);
+ *    const SilcPKCSObject *silc_pkcs_get_pkcs(void *key);
  *
  * DESCRIPTION
  *
- *    Returns the PKCS object from `public_key'.
+ *    Returns the PKCS object from `key', which may be SilcPublicKey or
+ *    SilcPrivateKey pointer.
  *
  ***/
-const SilcPKCSObject *silc_pkcs_get_pkcs(SilcPublicKey public_key);
+const SilcPKCSObject *silc_pkcs_get_pkcs(void *key);
 
 /****f* silccrypt/SilcPKCSAPI/silc_pkcs_get_algorithm
  *
  * SYNOPSIS
  *
- *    const SilcPKCSObject *silc_pkcs_get_algorithm(SilcPublicKey public_key);
+ *    const SilcPKCSAlgorithm *silc_pkcs_get_algorithm(void *key);
  *
  * DESCRIPTION
  *
- *    Returns the PKCS algorithm object from `public_key'.
+ *    Returns the PKCS algorithm object from `key', which may be SilcPublicKey
+ *    or SilcPrivateKey pointer.
  *
  ***/
-const SilcPKCSAlgorithm *silc_pkcs_get_algorithm(SilcPublicKey public_key);
+const SilcPKCSAlgorithm *silc_pkcs_get_algorithm(void *key);
 
 /****f* silccrypt/SilcPKCSAPI/silc_pkcs_get_name
  *
  * SYNOPSIS
  *
- *    const char *silc_pkcs_get_name(SilcPublicKey public_key)
+ *    const char *silc_pkcs_get_name(void *key);
  *
  * DESCRIPTION
  *
- *    Returns PKCS algorithm name from the public key.
+ *    Returns PKCS algorithm name from the `key', which may be SilcPublicKey
+ *    or SilcPrivateKey pointer.
  *
  ***/
-const char *silc_pkcs_get_name(SilcPublicKey public_key);
+const char *silc_pkcs_get_name(void *key);
 
 /****f* silccrypt/SilcPKCSAPI/silc_pkcs_get_type
  *
  * SYNOPSIS
  *
- *    SilcPKCSType silc_pkcs_get_type(SilcPublicKey public_key);
+ *    SilcPKCSType silc_pkcs_get_type(void *key);
  *
  * DESCRIPTION
  *
- *    Returns PKCS type from the public key.
+ *    Returns PKCS type from the `key', which may be SilcPublicKey or
+ *    SilcPrivateKey pointer.
  *
  ***/
-SilcPKCSType silc_pkcs_get_type(SilcPublicKey public_key);
+SilcPKCSType silc_pkcs_get_type(void *key);
 
 /****f* silccrypt/SilcPKCSAPI/silc_pkcs_get_context
  *
@@ -617,7 +623,7 @@ SilcBool silc_pkcs_private_key_alloc(SilcPKCSType type,
  *
  * DESCRIPTION
  *
- *    Returns the key length in bits from the public key.
+ *    Returns the key length in bits from the private key.
  *
  ***/
 SilcUInt32 silc_pkcs_private_key_get_len(SilcPrivateKey private_key);
@@ -652,7 +658,7 @@ 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);
 
 /****f* silccrypt/SilcPKCSAPI/silc_pkcs_decrypt
  *