{
SilcUInt32 prime_bits = keylen / 2;
SilcMPInt p, q;
- bool found = FALSE;
+ SilcBool found = FALSE;
if (keylen < 768 || keylen > 16384)
return FALSE;
to compute the modulus n has to be generated before calling this. They
are then sent as argument for the function. */
-bool rsa_generate_keys(RsaKey *key, SilcUInt32 bits,
+SilcBool rsa_generate_keys(RsaKey *key, SilcUInt32 bits,
SilcMPInt *p, SilcMPInt *q)
{
SilcMPInt phi, hlp;
/* Clears whole key structure. */
-bool rsa_clear_keys(RsaKey *key)
+SilcBool rsa_clear_keys(RsaKey *key)
{
key->bits = 0;
if (key->pub_set) {
/* RSA public key operation */
-bool rsa_public_operation(RsaKey *key, SilcMPInt *src, SilcMPInt *dst)
+SilcBool rsa_public_operation(RsaKey *key, SilcMPInt *src, SilcMPInt *dst)
{
/* dst = src ^ e mod n */
silc_mp_pow_mod(dst, src, &key->e, &key->n);
/* RSA private key operation */
-bool rsa_private_operation(RsaKey *key, SilcMPInt *src, SilcMPInt *dst)
+SilcBool rsa_private_operation(RsaKey *key, SilcMPInt *src, SilcMPInt *dst)
{
if (!key->crt) {
/* dst = src ^ d mod n */
unsigned int crt : 1; /* TRUE if CRT is used */
} RsaKey;
-bool rsa_generate_keys(RsaKey *key, SilcUInt32 bits,
+SilcBool rsa_generate_keys(RsaKey *key, SilcUInt32 bits,
SilcMPInt *p, SilcMPInt *q);
-bool rsa_clear_keys(RsaKey *key);
-bool rsa_public_operation(RsaKey *key, SilcMPInt *src, SilcMPInt *dst);
-bool rsa_private_operation(RsaKey *key, SilcMPInt *src, SilcMPInt *dst);
+SilcBool rsa_clear_keys(RsaKey *key);
+SilcBool rsa_public_operation(RsaKey *key, SilcMPInt *src, SilcMPInt *dst);
+SilcBool rsa_private_operation(RsaKey *key, SilcMPInt *src, SilcMPInt *dst);
#endif
registered. Therefore, if memory has been allocated for the object sent
as argument it has to be free'd after this function returns succesfully. */
-bool silc_cipher_register(const SilcCipherObject *cipher)
+SilcBool silc_cipher_register(const SilcCipherObject *cipher)
{
#ifndef SILC_EPOC
SilcCipherObject *new;
/* Unregister a cipher from the SILC. */
-bool silc_cipher_unregister(SilcCipherObject *cipher)
+SilcBool silc_cipher_unregister(SilcCipherObject *cipher)
{
#ifndef SILC_EPOC
SilcCipherObject *entry;
The application may use this to register the default ciphers if specific
ciphers in any specific order is not wanted. */
-bool silc_cipher_register_default(void)
+SilcBool silc_cipher_register_default(void)
{
#ifndef SILC_EPOC
int i;
return TRUE;
}
-bool silc_cipher_unregister_all(void)
+SilcBool silc_cipher_unregister_all(void)
{
#ifndef SILC_EPOC
SilcCipherObject *entry;
caller must set the key to the cipher after this function has returned
by calling the ciphers set_key function. */
-bool silc_cipher_alloc(const unsigned char *name, SilcCipher *new_cipher)
+SilcBool silc_cipher_alloc(const unsigned char *name, SilcCipher *new_cipher)
{
SilcCipherObject *entry = NULL;
/* Returns TRUE if cipher `name' is supported. */
-bool silc_cipher_is_supported(const unsigned char *name)
+SilcBool silc_cipher_is_supported(const unsigned char *name)
{
#ifndef SILC_EPOC
SilcCipherObject *entry;
/* Encrypts */
-bool silc_cipher_encrypt(SilcCipher cipher, const unsigned char *src,
+SilcBool silc_cipher_encrypt(SilcCipher cipher, const unsigned char *src,
unsigned char *dst, SilcUInt32 len,
unsigned char *iv)
{
/* Decrypts */
-bool silc_cipher_decrypt(SilcCipher cipher, const unsigned char *src,
+SilcBool silc_cipher_decrypt(SilcCipher cipher, const unsigned char *src,
unsigned char *dst, SilcUInt32 len,
unsigned char *iv)
{
/* Sets the key for the cipher */
-bool silc_cipher_set_key(SilcCipher cipher, const unsigned char *key,
+SilcBool silc_cipher_set_key(SilcCipher cipher, const unsigned char *key,
SilcUInt32 keylen)
{
return cipher->cipher->set_key(cipher->context, key, keylen);
SilcUInt32 block_len;
SilcUInt32 key_len;
- bool (*set_key)(void *, const unsigned char *, SilcUInt32);
- bool (*set_key_with_string)(void *, const unsigned char *, SilcUInt32);
- bool (*encrypt)(void *, const unsigned char *, unsigned char *,
+ SilcBool (*set_key)(void *, const unsigned char *, SilcUInt32);
+ SilcBool (*set_key_with_string)(void *, const unsigned char *, SilcUInt32);
+ SilcBool (*encrypt)(void *, const unsigned char *, unsigned char *,
SilcUInt32, unsigned char *);
- bool (*decrypt)(void *, const unsigned char *, unsigned char *,
+ SilcBool (*decrypt)(void *, const unsigned char *, unsigned char *,
SilcUInt32, unsigned char *);
SilcUInt32 (*context_len)();
} SilcCipherObject;
/* These macros can be used to implement the SILC Crypto API and to avoid
errors in the API these macros should be used always. */
#define SILC_CIPHER_API_SET_KEY(cipher) \
-bool silc_##cipher##_set_key(void *context, \
+SilcBool silc_##cipher##_set_key(void *context, \
const unsigned char *key, \
SilcUInt32 keylen)
#define SILC_CIPHER_API_SET_KEY_WITH_STRING(cipher) \
-bool silc_##cipher##_set_key_with_string(void *context, \
+SilcBool silc_##cipher##_set_key_with_string(void *context, \
const unsigned char *string, \
SilcUInt32 stringlen)
#define SILC_CIPHER_API_ENCRYPT_CBC(cipher) \
-bool silc_##cipher##_encrypt_cbc(void *context, \
+SilcBool silc_##cipher##_encrypt_cbc(void *context, \
const unsigned char *src, \
unsigned char *dst, \
SilcUInt32 len, \
unsigned char *iv)
#define SILC_CIPHER_API_DECRYPT_CBC(cipher) \
-bool silc_##cipher##_decrypt_cbc(void *context, \
+SilcBool silc_##cipher##_decrypt_cbc(void *context, \
const unsigned char *src, \
unsigned char *dst, \
SilcUInt32 len, \
*
* SYNOPSIS
*
- * bool silc_cipher_register(const SilcCipherObject *cipher);
+ * SilcBool silc_cipher_register(const SilcCipherObject *cipher);
*
* DESCRIPTION
*
* as argument it has to be free'd after this function returns succesfully.
*
***/
-bool silc_cipher_register(const SilcCipherObject *cipher);
+SilcBool silc_cipher_register(const SilcCipherObject *cipher);
/****f* silccrypt/SilcCipherAPI/silc_cipher_unregister
*
* SYNOPSIS
*
- * bool silc_cipher_unregister(SilcCipherObject *cipher);
+ * SilcBool silc_cipher_unregister(SilcCipherObject *cipher);
*
* DESCRIPTION
*
* Unregister a cipher from the SILC.
*
***/
-bool silc_cipher_unregister(SilcCipherObject *cipher);
+SilcBool silc_cipher_unregister(SilcCipherObject *cipher);
/****f* silccrypt/SilcCipherAPI/silc_cipher_register_default
*
* SYNOPSIS
*
- * bool silc_cipher_register_default(void);
+ * SilcBool silc_cipher_register_default(void);
*
* DESCRIPTION
*
* ciphers in any specific order is not wanted.
*
***/
-bool silc_cipher_register_default(void);
+SilcBool silc_cipher_register_default(void);
/****f* silccrypt/SilcCipherAPI/silc_cipher_unregister_all
*
* SYNOPSIS
*
- * bool silc_cipher_unregister_all(void);
+ * SilcBool silc_cipher_unregister_all(void);
*
* DESCRIPTION
*
* Unregisters all ciphers.
*
***/
-bool silc_cipher_unregister_all(void);
+SilcBool silc_cipher_unregister_all(void);
/****f* silccrypt/SilcCipherAPI/silc_cipher_alloc
*
* SYNOPSIS
*
- * bool silc_cipher_alloc(const unsigned char *name,
+ * SilcBool silc_cipher_alloc(const unsigned char *name,
* SilcCipher *new_cipher);
*
* DESCRIPTION
* by calling the ciphers set_key function.
*
***/
-bool silc_cipher_alloc(const unsigned char *name, SilcCipher *new_cipher);
+SilcBool silc_cipher_alloc(const unsigned char *name, SilcCipher *new_cipher);
/****f* silccrypt/SilcCipherAPI/silc_cipher_free
*
*
* SYNOPSIS
*
- * bool silc_cipher_is_supported(const unsigned char *name);
+ * SilcBool silc_cipher_is_supported(const unsigned char *name);
*
* DESCRIPTION
*
* Returns TRUE if cipher `name' is supported.
*
***/
-bool silc_cipher_is_supported(const unsigned char *name);
+SilcBool silc_cipher_is_supported(const unsigned char *name);
/****f* silccrypt/SilcCipherAPI/silc_cipher_get_supported
*
*
* SYNOPSIS
*
- * bool silc_cipher_encrypt(SilcCipher cipher, const unsigned char *src,
+ * SilcBool silc_cipher_encrypt(SilcCipher cipher, const unsigned char *src,
* unsigned char *dst, SilcUInt32 len,
* unsigned char *iv);
*
* IV is used. The `src' and `dst' maybe same buffer.
*
***/
-bool silc_cipher_encrypt(SilcCipher cipher, const unsigned char *src,
+SilcBool silc_cipher_encrypt(SilcCipher cipher, const unsigned char *src,
unsigned char *dst, SilcUInt32 len,
unsigned char *iv);
*
* SYNOPSIS
*
- * bool silc_cipher_decrypt(SilcCipher cipher, const unsigned char *src,
+ * SilcBool silc_cipher_decrypt(SilcCipher cipher, const unsigned char *src,
* unsigned char *dst, SilcUInt32 len,
* unsigned char *iv);
*
* IV is used. The `src' and `dst' maybe same buffer.
*
***/
-bool silc_cipher_decrypt(SilcCipher cipher, const unsigned char *src,
+SilcBool silc_cipher_decrypt(SilcCipher cipher, const unsigned char *src,
unsigned char *dst, SilcUInt32 len,
unsigned char *iv);
*
* SYNOPSIS
*
- * bool silc_cipher_set_key(SilcCipher cipher, const unsigned char *key,
+ * SilcBool silc_cipher_set_key(SilcCipher cipher, const unsigned char *key,
* SilcUInt32 keylen);
*
* DESCRIPTION
* bits.
*
***/
-bool silc_cipher_set_key(SilcCipher cipher, const unsigned char *key,
+SilcBool silc_cipher_set_key(SilcCipher cipher, const unsigned char *key,
SilcUInt32 keylen);
/****f* silccrypt/SilcCipherAPI/silc_cipher_set_iv
*
* SYNOPSIS
*
- * bool silc_dh_generate_private(SilcDH dh, const SilcMPInt **x);
+ * SilcBool silc_dh_generate_private(SilcDH dh, const SilcMPInt **x);
*
* DESCRIPTION
*
* the `x' is NULL. The returned `x' must not be freed by the caller.
*
***/
-bool silc_dh_generate_private(SilcDH dh, const SilcMPInt **x);
+SilcBool silc_dh_generate_private(SilcDH dh, const SilcMPInt **x);
/****f* silccrypt/SilcDH/silc_dh_compute_public
*
* SYNOPSIS
*
- * bool silc_dh_compute_public(SilcDH dh, const SilcMPInt **y);
+ * SilcBool silc_dh_compute_public(SilcDH dh, const SilcMPInt **y);
*
* DESCRIPTION
*
* freed by the caller.
*
***/
-bool silc_dh_compute_public(SilcDH dh, const SilcMPInt **y);
+SilcBool silc_dh_compute_public(SilcDH dh, const SilcMPInt **y);
/****f* silccrypt/SilcDH/silc_dh_remote_public
*
* SYNOPSIS
*
- * bool silc_dh_compute_public(SilcDH dh, SilcMPInt *y);
+ * SilcBool silc_dh_compute_public(SilcDH dh, SilcMPInt *y);
*
* DESCRIPTION
*
* on error.
*
***/
-bool silc_dh_set_remote_public(SilcDH dh, SilcMPInt *y);
+SilcBool silc_dh_set_remote_public(SilcDH dh, SilcMPInt *y);
/****f* silccrypt/SilcDH/silc_dh_compute_key
*
* SYNOPSIS
*
- * bool silc_dh_compute_key(SilcDH dh, const SilcMPInt **z);
+ * SilcBool silc_dh_compute_key(SilcDH dh, const SilcMPInt **z);
*
* DESCRIPTION
*
* freed by the caller.
*
***/
-bool silc_dh_compute_key(SilcDH dh, const SilcMPInt **z);
+SilcBool silc_dh_compute_key(SilcDH dh, const SilcMPInt **z);
/****f* silccrypt/SilcDH/silc_dh_remote_public
*
* SYNOPSIS
*
- * bool silc_dh_compute_key_data(SilcDH dh, unsigned char **z,
+ * SilcBool silc_dh_compute_key_data(SilcDH dh, unsigned char **z,
* SilcUInt32 *z_len);
*
* DESCRIPTION
* string. The caller must free the returned binary string.
*
***/
-bool silc_dh_compute_key_data(SilcDH dh, unsigned char **z,
+SilcBool silc_dh_compute_key_data(SilcDH dh, unsigned char **z,
SilcUInt32 *z_len);
#endif
/* Registers a new hash function into the SILC. This function is used at
the initialization of the SILC. */
-bool silc_hash_register(const SilcHashObject *hash)
+SilcBool silc_hash_register(const SilcHashObject *hash)
{
#ifndef SILC_EPOC
SilcHashObject *new;
/* Unregister a hash function from the SILC. */
-bool silc_hash_unregister(SilcHashObject *hash)
+SilcBool silc_hash_unregister(SilcHashObject *hash)
{
#ifndef SILC_EPOC
SilcHashObject *entry;
The application may use this to register the default hash funcs if
specific hash funcs in any specific order is not wanted. */
-bool silc_hash_register_default(void)
+SilcBool silc_hash_register_default(void)
{
#ifndef SILC_EPOC
int i;
return TRUE;
}
-bool silc_hash_unregister_all(void)
+SilcBool silc_hash_unregister_all(void)
{
#ifndef SILC_EPOC
SilcHashObject *entry;
/* Allocates a new SilcHash object. New object is returned into new_hash
argument. */
-bool silc_hash_alloc(const unsigned char *name, SilcHash *new_hash)
+SilcBool silc_hash_alloc(const unsigned char *name, SilcHash *new_hash)
{
SilcHashObject *entry = NULL;
/* Returns TRUE if hash algorithm `name' is supported. */
-bool silc_hash_is_supported(const unsigned char *name)
+SilcBool silc_hash_is_supported(const unsigned char *name)
{
#ifndef SILC_EPOC
SilcHashObject *entry;
*
* SYNOPSIS
*
- * bool silc_hash_register(const SilcHashObject *hash);
+ * SilcBool silc_hash_register(const SilcHashObject *hash);
*
* DESCRIPTION
*
* that are builtin the sources. Returns FALSE on error.
*
***/
-bool silc_hash_register(const SilcHashObject *hash);
+SilcBool silc_hash_register(const SilcHashObject *hash);
/****f* silccrypt/SilcHashAPI/silc_hash_unregister
*
* SYNOPSIS
*
- * bool silc_hash_unregister(SilcHashObject *hash);
+ * SilcBool silc_hash_unregister(SilcHashObject *hash);
*
* DESCRIPTION
*
* FALSE on error.
*
***/
-bool silc_hash_unregister(SilcHashObject *hash);
+SilcBool silc_hash_unregister(SilcHashObject *hash);
/****f* silccrypt/SilcHashAPI/silc_hash_register_default
*
* SYNOPSIS
*
- * bool silc_hash_register_default(void);
+ * SilcBool silc_hash_register_default(void);
*
* DESCRIPTION
*
* which case this function should not be used).
*
***/
-bool silc_hash_register_default(void);
+SilcBool silc_hash_register_default(void);
/****f* silccrypt/SilcHashAPI/silc_hash_unregister_all
*
* SYNOPSIS
*
- * bool silc_hash_unregister_all(void);
+ * SilcBool silc_hash_unregister_all(void);
*
* DESCRIPTION
*
* Unregisters all registered hash functions.
*
***/
-bool silc_hash_unregister_all(void);
+SilcBool silc_hash_unregister_all(void);
/****f* silccrypt/SilcHashAPI/silc_hash_alloc
*
* SYNOPSIS
*
- * bool silc_hash_alloc(const unsigned char *name, SilcHash *new_hash);
+ * SilcBool silc_hash_alloc(const unsigned char *name, SilcHash *new_hash);
*
* DESCRIPTION
*
* returns FALSE if such hash function does not exist.
*
***/
-bool silc_hash_alloc(const unsigned char *name, SilcHash *new_hash);
+SilcBool silc_hash_alloc(const unsigned char *name, SilcHash *new_hash);
/****f* silccrypt/SilcHashAPI/silc_hash_free
*
*
* SYNOPSIS
*
- * bool silc_hash_is_supported(const unsigned char *name);
+ * SilcBool silc_hash_is_supported(const unsigned char *name);
*
* DESCRIPTION
*
* Returns TRUE if the hash function indicated by the `name' exists.
*
***/
-bool silc_hash_is_supported(const unsigned char *name);
+SilcBool silc_hash_is_supported(const unsigned char *name);
/****f* silccrypt/SilcHashAPI/silc_hash_get_supported
*
/* Registers a new HMAC into the SILC. This function is used at the
initialization of the SILC. */
-bool silc_hmac_register(const SilcHmacObject *hmac)
+SilcBool silc_hmac_register(const SilcHmacObject *hmac)
{
#ifndef SILC_EPOC
SilcHmacObject *new;
/* Unregister a HMAC from the SILC. */
-bool silc_hmac_unregister(SilcHmacObject *hmac)
+SilcBool silc_hmac_unregister(SilcHmacObject *hmac)
{
#ifndef SILC_EPOC
SilcHmacObject *entry;
The application may use this to register the default hmacs if
specific hmacs in any specific order is not wanted. */
-bool silc_hmac_register_default(void)
+SilcBool silc_hmac_register_default(void)
{
#ifndef SILC_EPOC
int i;
return TRUE;
}
-bool silc_hmac_unregister_all(void)
+SilcBool silc_hmac_unregister_all(void)
{
#ifndef SILC_EPOC
SilcHmacObject *entry;
of the HMAC. If it is NULL then the hash function is allocated and
the name of the hash algorithm is derived from the `name'. */
-bool silc_hmac_alloc(const char *name, SilcHash hash, SilcHmac *new_hmac)
+SilcBool silc_hmac_alloc(const char *name, SilcHash hash, SilcHmac *new_hmac)
{
SILC_LOG_DEBUG(("Allocating new HMAC"));
/* Returns TRUE if HMAC `name' is supported. */
-bool silc_hmac_is_supported(const char *name)
+SilcBool silc_hmac_is_supported(const char *name)
{
#ifndef SILC_EPOC
SilcHmacObject *entry;
*
* SYNOPSIS
*
- * bool silc_hmac_register(const SilcHmacObject *hmac);
+ * SilcBool silc_hmac_register(const SilcHmacObject *hmac);
*
* DESCRIPTION
*
* that are builtin the sources. Returns FALSE on error.
*
***/
-bool silc_hmac_register(const SilcHmacObject *hmac);
+SilcBool silc_hmac_register(const SilcHmacObject *hmac);
/****f* silccrypt/SilcHMACAPI/silc_hmac_unregister
*
* SYNOPSIS
*
- * bool silc_hmac_unregister(SilcHmacObject *hmac);
+ * SilcBool silc_hmac_unregister(SilcHmacObject *hmac);
*
* DESCRIPTION
*
* error.
*
***/
-bool silc_hmac_unregister(SilcHmacObject *hmac);
+SilcBool silc_hmac_unregister(SilcHmacObject *hmac);
/****f* silccrypt/SilcHMACAPI/silc_hmac_register_default
*
* SYNOPSIS
*
- * bool silc_hmac_register_default(void);
+ * SilcBool silc_hmac_register_default(void);
*
* DESCRIPTION
*
* used).
*
***/
-bool silc_hmac_register_default(void);
+SilcBool silc_hmac_register_default(void);
/****f* silccrypt/SilcHMACAPI/silc_hmac_unregister_all
*
* SYNOPSIS
*
- * bool silc_hmac_unregister_all(void);
+ * SilcBool silc_hmac_unregister_all(void);
*
* DESCRIPTION
*
* Unregisters all registered HMACs.
*
***/
-bool silc_hmac_unregister_all(void);
+SilcBool silc_hmac_unregister_all(void);
/****f* silccrypt/SilcHMACAPI/silc_hmac_alloc
*
* SYNOPSIS
*
- * bool silc_hmac_alloc(const char *name, SilcHash hash,
+ * SilcBool silc_hmac_alloc(const char *name, SilcHash hash,
* SilcHmac *new_hmac);
*
* DESCRIPTION
* FALSE if such HMAC does not exist.
*
***/
-bool silc_hmac_alloc(const char *name, SilcHash hash, SilcHmac *new_hmac);
+SilcBool silc_hmac_alloc(const char *name, SilcHash hash, SilcHmac *new_hmac);
/****f* silccrypt/SilcHMACAPI/silc_hmac_free
*
*
* SYNOPSIS
*
- * bool silc_hmac_is_supported(const char *name);
+ * SilcBool silc_hmac_is_supported(const char *name);
*
* DESCRIPTION
*
* Returns TRUE if the HMAC indicated by the `name' exists.
*
***/
-bool silc_hmac_is_supported(const char *name);
+SilcBool silc_hmac_is_supported(const char *name);
/****f* silccrypt/SilcHMACAPI/silc_hmac_get_supported
*
/* Register a new PKCS into SILC. This is used at the initialization of
the SILC. */
-bool silc_pkcs_register(const SilcPKCSObject *pkcs)
+SilcBool silc_pkcs_register(const SilcPKCSObject *pkcs)
{
#ifndef SILC_EPOC
SilcPKCSObject *new;
/* Unregister a PKCS from the SILC. */
-bool silc_pkcs_unregister(SilcPKCSObject *pkcs)
+SilcBool silc_pkcs_unregister(SilcPKCSObject *pkcs)
{
#ifndef SILC_EPOC
SilcPKCSObject *entry;
The application may use this to register the default PKCS if specific
PKCS in any specific order is not wanted. */
-bool silc_pkcs_register_default(void)
+SilcBool silc_pkcs_register_default(void)
{
#ifndef SILC_EPOC
int i;
return TRUE;
}
-bool silc_pkcs_unregister_all(void)
+SilcBool silc_pkcs_unregister_all(void)
{
#ifndef SILC_EPOC
SilcPKCSObject *entry;
/* Allocates a new SilcPKCS object. The new allocated object is returned
to the 'new_pkcs' argument. */
-bool silc_pkcs_alloc(const unsigned char *name, SilcPKCS *new_pkcs)
+SilcBool silc_pkcs_alloc(const unsigned char *name, SilcPKCS *new_pkcs)
{
SilcPKCSObject *entry = NULL;
/* Return TRUE if PKCS algorithm `name' is supported. */
-bool silc_pkcs_is_supported(const unsigned char *name)
+SilcBool silc_pkcs_is_supported(const unsigned char *name)
{
#ifndef SILC_EPOC
SilcPKCSObject *entry;
/* Generate new key pair into the `pkcs' context. */
-bool silc_pkcs_generate_key(SilcPKCS pkcs, SilcUInt32 bits_key_len,
+SilcBool silc_pkcs_generate_key(SilcPKCS pkcs, SilcUInt32 bits_key_len,
SilcRng rng)
{
- bool ret = pkcs->pkcs->init(pkcs->context, bits_key_len, rng);
+ SilcBool ret = pkcs->pkcs->init(pkcs->context, bits_key_len, rng);
if (ret)
pkcs->key_len = bits_key_len;
return ret;
/* Encrypts */
-bool silc_pkcs_encrypt(SilcPKCS pkcs, unsigned char *src, SilcUInt32 src_len,
+SilcBool silc_pkcs_encrypt(SilcPKCS pkcs, unsigned char *src, SilcUInt32 src_len,
unsigned char *dst, SilcUInt32 *dst_len)
{
return pkcs->pkcs->encrypt(pkcs->context, src, src_len, dst, dst_len);
/* Decrypts */
-bool silc_pkcs_decrypt(SilcPKCS pkcs, unsigned char *src, SilcUInt32 src_len,
+SilcBool silc_pkcs_decrypt(SilcPKCS pkcs, unsigned char *src, SilcUInt32 src_len,
unsigned char *dst, SilcUInt32 *dst_len)
{
return pkcs->pkcs->decrypt(pkcs->context, src, src_len, dst, dst_len);
/* Generates signature */
-bool silc_pkcs_sign(SilcPKCS pkcs, unsigned char *src, SilcUInt32 src_len,
+SilcBool silc_pkcs_sign(SilcPKCS pkcs, unsigned char *src, SilcUInt32 src_len,
unsigned char *dst, SilcUInt32 *dst_len)
{
return pkcs->pkcs->sign(pkcs->context, src, src_len, dst, dst_len);
/* Verifies signature */
-bool silc_pkcs_verify(SilcPKCS pkcs, unsigned char *signature,
+SilcBool silc_pkcs_verify(SilcPKCS pkcs, unsigned char *signature,
SilcUInt32 signature_len, unsigned char *data,
SilcUInt32 data_len)
{
/* Generates signature with hash. The hash is signed. */
-bool silc_pkcs_sign_with_hash(SilcPKCS pkcs, SilcHash hash,
+SilcBool silc_pkcs_sign_with_hash(SilcPKCS pkcs, SilcHash hash,
unsigned char *src, SilcUInt32 src_len,
unsigned char *dst, SilcUInt32 *dst_len)
{
/* Verifies signature with hash. The `data' is hashed and verified against
the `signature'. */
-bool silc_pkcs_verify_with_hash(SilcPKCS pkcs, SilcHash hash,
+SilcBool silc_pkcs_verify_with_hash(SilcPKCS pkcs, SilcHash hash,
unsigned char *signature,
SilcUInt32 signature_len,
unsigned char *data,
/* Decodes SILC style public key. Returns TRUE if the decoding was
successful. Allocates new public key as well. */
-bool silc_pkcs_public_key_decode(unsigned char *data, SilcUInt32 data_len,
+SilcBool silc_pkcs_public_key_decode(unsigned char *data, SilcUInt32 data_len,
SilcPublicKey *public_key)
{
SilcBufferStruct buf;
/* Decode Public Key Payload and decodes the public key inside it to
to `payload'. */
-bool silc_pkcs_public_key_payload_decode(unsigned char *data,
+SilcBool silc_pkcs_public_key_payload_decode(unsigned char *data,
SilcUInt32 data_len,
SilcPublicKey *public_key)
{
/* Compares two public keys and returns TRUE if they are same key, and
FALSE if they are not same. */
-bool silc_pkcs_public_key_compare(SilcPublicKey key1, SilcPublicKey key2)
+SilcBool silc_pkcs_public_key_compare(SilcPublicKey key1, SilcPublicKey key2)
{
if (key1 == key2)
return TRUE;
/* Decodes SILC style private key. Returns TRUE if the decoding was
successful. Allocates new private key as well. */
-bool silc_pkcs_private_key_decode(unsigned char *data, SilcUInt32 data_len,
+SilcBool silc_pkcs_private_key_decode(unsigned char *data, SilcUInt32 data_len,
SilcPrivateKey *private_key)
{
SilcBufferStruct buf;
/* Internal routine to save public key */
-static bool silc_pkcs_save_public_key_internal(const char *filename,
+static SilcBool silc_pkcs_save_public_key_internal(const char *filename,
unsigned char *data,
SilcUInt32 data_len,
SilcUInt32 encoding)
/* Saves public key into file */
-bool silc_pkcs_save_public_key(const char *filename, SilcPublicKey public_key,
+SilcBool silc_pkcs_save_public_key(const char *filename, SilcPublicKey public_key,
SilcUInt32 encoding)
{
unsigned char *data;
SilcUInt32 data_len;
- bool ret;
+ SilcBool ret;
data = silc_pkcs_public_key_encode(public_key, &data_len);
ret = silc_pkcs_save_public_key_internal(filename, data, data_len,
/* Saves public key into file */
-bool silc_pkcs_save_public_key_data(const char *filename, unsigned char *data,
+SilcBool silc_pkcs_save_public_key_data(const char *filename, unsigned char *data,
SilcUInt32 data_len, SilcUInt32 encoding)
{
return silc_pkcs_save_public_key_internal(filename, data, data_len,
/* Internal routine to save private key. */
-static bool silc_pkcs_save_private_key_internal(const char *filename,
+static SilcBool silc_pkcs_save_private_key_internal(const char *filename,
unsigned char *data,
SilcUInt32 data_len,
unsigned char *key,
/* Saves private key into file. */
-bool silc_pkcs_save_private_key(const char *filename,
+SilcBool silc_pkcs_save_private_key(const char *filename,
SilcPrivateKey private_key,
unsigned char *passphrase,
SilcUInt32 passphrase_len,
{
unsigned char *data;
SilcUInt32 data_len;
- bool ret;
+ SilcBool ret;
data = silc_pkcs_private_key_encode(private_key, &data_len);
ret = silc_pkcs_save_private_key_internal(filename, data, data_len,
/* Loads public key from file and allocates new public key. Returns TRUE
if loading was successful. */
-bool silc_pkcs_load_public_key(const char *filename, SilcPublicKey *public_key,
+SilcBool silc_pkcs_load_public_key(const char *filename, SilcPublicKey *public_key,
SilcUInt32 encoding)
{
unsigned char *cp, *old, *data, byte;
/* Load private key from file and allocates new private key. Returns TRUE
if loading was successful. */
-bool silc_pkcs_load_private_key(const char *filename,
+SilcBool silc_pkcs_load_private_key(const char *filename,
SilcPrivateKey *private_key,
unsigned char *passphrase,
SilcUInt32 passphrase_len,
*
* SYNOPSIS
*
- * bool silc_pkcs_register(const SilcPKCSObject *pkcs);
+ * SilcBool silc_pkcs_register(const SilcPKCSObject *pkcs);
*
* DESCRIPTION
*
* builtin the sources. Returns FALSE on error.
*
***/
-bool silc_pkcs_register(const SilcPKCSObject *pkcs);
+SilcBool silc_pkcs_register(const SilcPKCSObject *pkcs);
/****f* silccrypt/SilcPKCSAPI/silc_pkcs_unregister
*
* SYNOPSIS
*
- * bool silc_pkcs_unregister(SilcPKCSObject *pkcs);
+ * SilcBool silc_pkcs_unregister(SilcPKCSObject *pkcs);
*
* DESCRIPTION
*
* Unregister a PKCS from the SILC. Returns FALSE on error.
*
***/
-bool silc_pkcs_unregister(SilcPKCSObject *pkcs);
+SilcBool silc_pkcs_unregister(SilcPKCSObject *pkcs);
/****f* silccrypt/SilcPKCSAPI/silc_pkcs_register_default
*
* SYNOPSIS
*
- * bool silc_pkcs_register_default(void);
+ * SilcBool silc_pkcs_register_default(void);
*
* DESCRIPTION
*
* order is not wanted. Returns FALSE on error.
*
***/
-bool silc_pkcs_register_default(void);
+SilcBool silc_pkcs_register_default(void);
/****f* silccrypt/SilcPKCSAPI/silc_pkcs_unregister_all
*
* SYNOPSIS
*
- * bool silc_pkcs_unregister_all(void);
+ * SilcBool silc_pkcs_unregister_all(void);
*
* DESCRIPTION
*
* Returns FALSE on error.
*
***/
-bool silc_pkcs_unregister_all(void);
+SilcBool silc_pkcs_unregister_all(void);
/****f* silccrypt/SilcPKCSAPI/silc_pkcs_alloc
*
* SYNOPSIS
*
- * bool silc_pkcs_alloc(const unsigned char *name, SilcPKCS *new_pkcs);
+ * SilcBool silc_pkcs_alloc(const unsigned char *name, SilcPKCS *new_pkcs);
*
* DESCRIPTION
*
* to the 'new_pkcs' argument. Returns FALSE on error.
*
***/
-bool silc_pkcs_alloc(const unsigned char *name, SilcPKCS *new_pkcs);
+SilcBool silc_pkcs_alloc(const unsigned char *name, SilcPKCS *new_pkcs);
/****f* silccrypt/SilcPKCSAPI/silc_pkcs_free
*
*
* SYNOPSIS
*
- * bool silc_pkcs_is_supported(const unsigned char *name);
+ * SilcBool silc_pkcs_is_supported(const unsigned char *name);
*
* DESCRIPTION
*
* Returns TRUE if PKCS algorithm `name' is supported.
*
***/
-bool silc_pkcs_is_supported(const unsigned char *name);
+SilcBool silc_pkcs_is_supported(const unsigned char *name);
/****f* silccrypt/SilcPKCSAPI/silc_pkcs_get_supported
*
*
* SYNOPSIS
*
- * bool silc_pkcs_generate_key(SilcPKCS pkcs, SilcUInt32 bits_key_len,
+ * SilcBool silc_pkcs_generate_key(SilcPKCS pkcs, SilcUInt32 bits_key_len,
* SilcRng rng);
*
* DESCRIPTION
* If the `rng' is NULL global SILC RNG will be used.
*
***/
-bool silc_pkcs_generate_key(SilcPKCS pkcs, SilcUInt32 bits_key_len,
+SilcBool silc_pkcs_generate_key(SilcPKCS pkcs, SilcUInt32 bits_key_len,
SilcRng rng);
/****f* silccrypt/SilcPKCSAPI/silc_pkcs_get_key_len
*
* SYNOPSIS
*
- * bool silc_pkcs_encrypt(SilcPKCS pkcs, unsigned char *src,
+ * SilcBool silc_pkcs_encrypt(SilcPKCS pkcs, unsigned char *src,
* SilcUInt32 src_len, unsigned char *dst,
* SilcUInt32 *dst_len);
*
* Encrypts. Returns FALSE on error.
*
***/
-bool silc_pkcs_encrypt(SilcPKCS pkcs, unsigned char *src, SilcUInt32 src_len,
+SilcBool silc_pkcs_encrypt(SilcPKCS pkcs, unsigned char *src, SilcUInt32 src_len,
unsigned char *dst, SilcUInt32 *dst_len);
/****f* silccrypt/SilcPKCSAPI/silc_pkcs_decrypt
*
* SYNOPSIS
*
- * bool silc_pkcs_decrypt(SilcPKCS pkcs, unsigned char *src,
+ * SilcBool silc_pkcs_decrypt(SilcPKCS pkcs, unsigned char *src,
* SilcUInt32 src_len, unsigned char *dst,
* SilcUInt32 *dst_len);
*
* Decrypts. Returns FALSE on error.
*
***/
-bool silc_pkcs_decrypt(SilcPKCS pkcs, unsigned char *src, SilcUInt32 src_len,
+SilcBool silc_pkcs_decrypt(SilcPKCS pkcs, unsigned char *src, SilcUInt32 src_len,
unsigned char *dst, SilcUInt32 *dst_len);
/****f* silccrypt/SilcPKCSAPI/silc_pkcs_sign
*
* SYNOPSIS
*
- * bool silc_pkcs_sign(SilcPKCS pkcs, unsigned char *src,
+ * SilcBool silc_pkcs_sign(SilcPKCS pkcs, unsigned char *src,
* SilcUInt32 src_len, unsigned char *dst,
* SilcUInt32 *dst_len);
*
* Generates signature. Returns FALSE on error.
*
***/
-bool silc_pkcs_sign(SilcPKCS pkcs, unsigned char *src, SilcUInt32 src_len,
+SilcBool silc_pkcs_sign(SilcPKCS pkcs, unsigned char *src, SilcUInt32 src_len,
unsigned char *dst, SilcUInt32 *dst_len);
/****f* silccrypt/SilcPKCSAPI/silc_pkcs_verify
*
* SYNOPSIS
*
- * bool silc_pkcs_verify(SilcPKCS pkcs, unsigned char *signature,
+ * SilcBool silc_pkcs_verify(SilcPKCS pkcs, unsigned char *signature,
* SilcUInt32 signature_len, unsigned char *data,
* SilcUInt32 data_len);
*
* verified against the 'data'.
*
***/
-bool silc_pkcs_verify(SilcPKCS pkcs, unsigned char *signature,
+SilcBool silc_pkcs_verify(SilcPKCS pkcs, unsigned char *signature,
SilcUInt32 signature_len, unsigned char *data,
SilcUInt32 data_len);
*
* SYNOPSIS
*
- * bool silc_pkcs_sign_with_hash(SilcPKCS pkcs, SilcHash hash,
+ * SilcBool silc_pkcs_sign_with_hash(SilcPKCS pkcs, SilcHash hash,
* unsigned char *src, SilcUInt32 src_len,
* unsigned char *dst, SilcUInt32 *dst_len);
*
* error.
*
***/
-bool silc_pkcs_sign_with_hash(SilcPKCS pkcs, SilcHash hash,
+SilcBool silc_pkcs_sign_with_hash(SilcPKCS pkcs, SilcHash hash,
unsigned char *src, SilcUInt32 src_len,
unsigned char *dst, SilcUInt32 *dst_len);
*
* SYNOPSIS
*
- * bool silc_pkcs_verify_with_hash(SilcPKCS pkcs, SilcHash hash,
+ * SilcBool silc_pkcs_verify_with_hash(SilcPKCS pkcs, SilcHash hash,
* unsigned char *signature,
* SilcUInt32 signature_len,
* unsigned char *data,
* the `signature'. Returns FALSE on error.
*
***/
-bool silc_pkcs_verify_with_hash(SilcPKCS pkcs, SilcHash hash,
+SilcBool silc_pkcs_verify_with_hash(SilcPKCS pkcs, SilcHash hash,
unsigned char *signature,
SilcUInt32 signature_len,
unsigned char *data,
*
* SYNOPSIS
*
- * bool silc_pkcs_public_key_decode(unsigned char *data,
+ * SilcBool silc_pkcs_public_key_decode(unsigned char *data,
* SilcUInt32 data_len,
* SilcPublicKey *public_key);
*
* successful. Allocates new public key as well.
*
***/
-bool silc_pkcs_public_key_decode(unsigned char *data, SilcUInt32 data_len,
+SilcBool silc_pkcs_public_key_decode(unsigned char *data, SilcUInt32 data_len,
SilcPublicKey *public_key);
/****f* silccrypt/SilcPKCSAPI/silc_pkcs_public_key_payload_encode
*
* SYNOPSIS
*
- * bool silc_pkcs_public_key_payload_encode(SilcPublicKey public_key);
+ * SilcBool silc_pkcs_public_key_payload_encode(SilcPublicKey public_key);
*
* DESCRIPTION
*
*
* SYNOPSIS
*
- * bool silc_pkcs_public_key_payload_decode(unsigned char *data,
+ * SilcBool silc_pkcs_public_key_payload_decode(unsigned char *data,
* SilcUInt32 data_len,
* SilcPublicKey *public_key);
*
* cannot be decoded.
*
***/
-bool silc_pkcs_public_key_payload_decode(unsigned char *data,
+SilcBool silc_pkcs_public_key_payload_decode(unsigned char *data,
SilcUInt32 data_len,
SilcPublicKey *public_key);
*
* SYNOPSIS
*
- * bool silc_pkcs_public_key_compare(SilcPublicKey key1,
+ * SilcBool silc_pkcs_public_key_compare(SilcPublicKey key1,
* SilcPublicKey key2);
*
* DESCRIPTION
* FALSE if they are not same.
*
***/
-bool silc_pkcs_public_key_compare(SilcPublicKey key1, SilcPublicKey key2);
+SilcBool silc_pkcs_public_key_compare(SilcPublicKey key1, SilcPublicKey key2);
/****f* silccrypt/SilcPKCSAPI/silc_pkcs_public_key_copy
*
*
* SYNOPSIS
*
- * bool silc_pkcs_private_key_decode(unsigned char *data,
+ * SilcBool silc_pkcs_private_key_decode(unsigned char *data,
* SilcUInt32 data_len,
* SilcPrivateKey *private_key);
*
* successful. Allocates new private key as well.
*
***/
-bool silc_pkcs_private_key_decode(unsigned char *data, SilcUInt32 data_len,
+SilcBool silc_pkcs_private_key_decode(unsigned char *data, SilcUInt32 data_len,
SilcPrivateKey *private_key);
/****f* silccrypt/SilcPKCSAPI/silc_pkcs_save_public_key
*
* SYNOPSIS
*
- * bool silc_pkcs_save_public_key(const char *filename,
+ * SilcBool silc_pkcs_save_public_key(const char *filename,
* SilcPublicKey public_key,
* SilcUInt32 encoding);
*
* Saves public key into file. Returns FALSE on error.
*
***/
-bool silc_pkcs_save_public_key(const char *filename, SilcPublicKey public_key,
+SilcBool silc_pkcs_save_public_key(const char *filename, SilcPublicKey public_key,
SilcUInt32 encoding);
/****f* silccrypt/SilcPKCSAPI/silc_pkcs_save_public_key_data
*
* SYNOPSIS
*
- * bool silc_pkcs_save_public_key_data(const char *filename,
+ * SilcBool silc_pkcs_save_public_key_data(const char *filename,
* unsigned char *data,
* SilcUInt32 data_len,
* SilcUInt32 encoding);
* data when calling this function. Returns FALSE on error.
*
***/
-bool silc_pkcs_save_public_key_data(const char *filename, unsigned char *data,
+SilcBool silc_pkcs_save_public_key_data(const char *filename, unsigned char *data,
SilcUInt32 data_len, SilcUInt32 encoding);
/****f* silccrypt/SilcPKCSAPI/silc_pkcs_save_private_key
*
* SYNOPSIS
*
- * bool silc_pkcs_save_private_key(const char *filename,
+ * SilcBool silc_pkcs_save_private_key(const char *filename,
* SilcPrivateKey private_key,
* unsigned char *passphrase,
* SilcUInt32 passphrase_len,
* is AES with 256 bit key in CBC mode. Returns FALSE on error.
*
***/
-bool silc_pkcs_save_private_key(const char *filename,
+SilcBool silc_pkcs_save_private_key(const char *filename,
SilcPrivateKey private_key,
unsigned char *passphrase,
SilcUInt32 passphrase_len,
*
* SYNOPSIS
*
- * bool silc_pkcs_load_public_key(const char *filename,
+ * SilcBool silc_pkcs_load_public_key(const char *filename,
* SilcPublicKey *public_key,
* SilcUInt32 encoding);
*
* if loading was successful.
*
***/
-bool silc_pkcs_load_public_key(const char *filename, SilcPublicKey *public_key,
+SilcBool silc_pkcs_load_public_key(const char *filename, SilcPublicKey *public_key,
SilcUInt32 encoding);
/****f* silccrypt/SilcPKCSAPI/silc_pkcs_load_private_key
*
* SYNOPSIS
*
- * bool silc_pkcs_load_private_key(const char *filename,
+ * SilcBool silc_pkcs_load_private_key(const char *filename,
* SilcPrivateKey *private_key,
* unsigned char *passphrase,
* SilcUInt32 passphrase_len,
* key of the private key file.
*
***/
-bool silc_pkcs_load_private_key(const char *filename,
+SilcBool silc_pkcs_load_private_key(const char *filename,
SilcPrivateKey *private_key,
unsigned char *passphrase,
SilcUInt32 passphrase_len,
set when `bt' is SILC_PKCS1_BT_PUB. This function returns TRUE on
success. */
-bool silc_pkcs1_encode(SilcPkcs1BlockType bt,
+SilcBool silc_pkcs1_encode(SilcPkcs1BlockType bt,
const unsigned char *data,
SilcUInt32 data_len,
unsigned char *dest_data,
the deocded block does not fit to `dest_data' this returns FALSE.
Returns TRUE on success. */
-bool silc_pkcs1_decode(SilcPkcs1BlockType bt,
+SilcBool silc_pkcs1_decode(SilcPkcs1BlockType bt,
const unsigned char *data,
SilcUInt32 data_len,
unsigned char *dest_data,
*
* SYNOPSIS
*
- * bool silc_pkcs1_encode(SilcPkcs1BlockType bt,
+ * SilcBool silc_pkcs1_encode(SilcPkcs1BlockType bt,
* const unsigned char *data,
* SilcUInt32 data_len,
* unsigned char *dest_data,
* function returns TRUE on success.
*
***/
-bool silc_pkcs1_encode(SilcPkcs1BlockType bt,
+SilcBool silc_pkcs1_encode(SilcPkcs1BlockType bt,
const unsigned char *data,
SilcUInt32 data_len,
unsigned char *dest_data,
*
* SYNOPSIS
*
- * bool silc_pkcs1_decode(SilcPkcs1BlockType bt,
+ * SilcBool silc_pkcs1_decode(SilcPkcs1BlockType bt,
* const unsigned char *data,
* SilcUInt32 data_len,
* unsigned char *dest_data,
* Returns the decoded length into `dest_len'.
*
***/
-bool silc_pkcs1_decode(SilcPkcs1BlockType bt,
+SilcBool silc_pkcs1_decode(SilcPkcs1BlockType bt,
const unsigned char *data,
SilcUInt32 data_len,
unsigned char *dest_data,
/* Initialize global RNG. If `rng' is provided it is set as the global
RNG object (it can be allocated by the application for example). */
-bool silc_rng_global_init(SilcRng rng)
+SilcBool silc_rng_global_init(SilcRng rng)
{
if (rng) {
global_rng = rng;
/* Uninitialize global RNG */
-bool silc_rng_global_uninit(void)
+SilcBool silc_rng_global_uninit(void)
{
if (global_rng) {
silc_rng_free(global_rng);
*
* SYNOPSIS
*
- * bool silc_rng_global_init(SilcRng rng);
+ * SilcBool silc_rng_global_init(SilcRng rng);
*
* DESCRIPTION
*
* the RNG as argument.
*
***/
-bool silc_rng_global_init(SilcRng rng);
+SilcBool silc_rng_global_init(SilcRng rng);
/****f* silccrypt/SilcRNGAPI/silc_rng_global_uninit
*
* SYNOPSIS
*
- * bool silc_rng_global_uninit(void);
+ * SilcBool silc_rng_global_uninit(void);
*
* DESCRIPTION
*
* be called if silc_rng_global_init was called with non-NULL RNG.
*
***/
-bool silc_rng_global_uninit(void);
+SilcBool silc_rng_global_uninit(void);
/****f* silccrypt/SilcRNGAPI/silc_rng_global_get_byte
*
int main(int argc, char **argv)
{
- bool success = FALSE;
+ SilcBool success = FALSE;
SilcCipher cipher;
unsigned char dst[256], pdst[256];
int i;
int main(int argc, char **argv)
{
- bool success = FALSE;
+ SilcBool success = FALSE;
unsigned char digest[16];
SilcUInt32 len;
SilcHmac hmac;
int main(int argc, char **argv)
{
- bool success = FALSE;
+ SilcBool success = FALSE;
unsigned char digest[20];
SilcUInt32 len;
SilcHmac hmac;
int main(int argc, char **argv)
{
- bool success = FALSE;
+ SilcBool success = FALSE;
unsigned char digest[20];
SilcUInt32 len;
SilcHmac hmac;
int main(int argc, char **argv)
{
- bool success = FALSE;
+ SilcBool success = FALSE;
unsigned char digest[16];
SilcHash md5;
int main(int argc, char **argv)
{
- bool success = FALSE;
+ SilcBool success = FALSE;
unsigned char digest[20];
SilcHash sha1;
int main(int argc, char **argv)
{
- bool success = FALSE;
+ SilcBool success = FALSE;
unsigned char digest[20];
SilcHash sha256;
int test()
{
- bool success = FALSE;
+ SilcBool success = FALSE;
SilcPKCS pkcs;
unsigned char *pk, *prv;
char *identifier;