fingerprint = silc_hash_fingerprint(NULL, pk, pk_len);
babbleprint = silc_hash_babbleprint(NULL, pk, pk_len);
- silc_pubkey = silc_pkcs_get_context(SILC_PKCS_SILC, pubkey);
+ silc_pubkey = silc_pkcs_public_key_get_pkcs(SILC_PKCS_SILC, pubkey);
printformat_module("fe-common/silc", server, NULL,
MSGLEVEL_CRAP, SILCTXT_CHANNEL_PK_LIST_ENTRY,
SilcPublicKey cached_pk=NULL;
/* try to load the file */
- if (!silc_pkcs_load_public_key(filename, &cached_pk)) {
+ if (!silc_pkcs_load_public_key(filename, SILC_PKCS_ANY, &cached_pk)) {
printformat_module("fe-common/silc", NULL, NULL, MSGLEVEL_CRAP,
SILCTXT_PUBKEY_COULD_NOT_LOAD, "client");
if (pk == NULL)
((SilcServerEntry)getkey->entry)->public_key);
SilcSILCPublicKey silc_pubkey;
- silc_pubkey = silc_pkcs_get_context(SILC_PKCS_SILC, public_key);
+ silc_pubkey = silc_pkcs_public_key_get_pkcs(SILC_PKCS_SILC, public_key);
if (success) {
if (getkey->id_type == SILC_ID_CLIENT)
return;
}
- silc_pubkey = silc_pkcs_get_context(SILC_PKCS_SILC, public_key);
+ silc_pubkey = silc_pkcs_public_key_get_pkcs(SILC_PKCS_SILC, public_key);
pw = getpwuid(getuid());
if (!pw) {
SilcUInt32 encpk_len;
/* Load the key file, try for both IP filename and hostname filename */
- if (!silc_pkcs_load_public_key(ipf, &local_pubkey) &&
- (!hostf || (!silc_pkcs_load_public_key(hostf, &local_pubkey)))) {
+ if (!silc_pkcs_load_public_key(ipf, SILC_PKCS_ANY, &local_pubkey) &&
+ (!hostf || (!silc_pkcs_load_public_key(hostf, SILC_PKCS_ANY,
+ &local_pubkey)))) {
printformat_module("fe-common/silc", NULL, NULL, MSGLEVEL_CRAP,
SILCTXT_PUBKEY_RECEIVED,verify->entity_name ?
verify->entity_name : entity);
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_client_list_ciphers()
{
- char *ciphers = silc_cipher_get_supported();
+ char *ciphers = silc_cipher_get_supported(FALSE);
#ifdef SILC_PLUGIN
printformat_module("fe-common/silc", NULL, NULL,
MSGLEVEL_CRAP, SILCTXT_CONFIG_ALGOS,
SilcUInt32 key_len = 0;
int is_server_key = (strstr(pub_filename, "serverkeys") != NULL);
- if (!silc_pkcs_load_public_key((char *)pub_filename, &public_key)) {
+ if (!silc_pkcs_load_public_key((char *)pub_filename, SILC_PKCS_ANY,
+ &public_key)) {
printformat_module("fe-common/silc", NULL, NULL,
MSGLEVEL_CRAP, SILCTXT_LISTKEY_LOADPUB,
pub_filename);
return;
}
- silc_pubkey = silc_pkcs_get_context(SILC_PKCS_SILC, public_key);
+ silc_pubkey = silc_pkcs_public_key_get_pkcs(SILC_PKCS_SILC, public_key);
ident = &silc_pubkey->identifier;
pk = silc_pkcs_public_key_encode(NULL, public_key, &pk_len);
if (verifyd)
silc_pkcs_verify(verify->public_key, usersign.data,
usersign.data_len, verifyd, verify_len, sha1hash,
+ silc_client->rng,
silc_query_attributes_verify, &verified);
if (verified) {
if (verifyd)
silc_pkcs_verify(public_key, serversign.data,
serversign.data_len, verifyd, verify_len, sha1hash,
+ silc_client->rng,
silc_query_attributes_verify, &verified);
if (verified) {
printformat_module("fe-common/silc", server, NULL,
#ifdef SILC_DIST_ACC
silcacc \
#endif SILC_DIST_ACC
+#ifdef SILC_DIST_SSH
+ silcssh \
+#endif SILC_DIST_SSH
if SILC_ENABLE_SHARED
LIBTOOL_OPTS= -release $(LIB_BASE_VERSION) -rpath $(DESTDIR)$(libdir)
#ifdef SILC_DIST_ACC
SILC_LIB_INCLUDES="$SILC_LIB_INCLUDES -I$SILC_TOP_SRCDIR/lib/silcacc"
#endif SILC_DIST_ACC
+#ifdef SILC_DIST_PGP
+SILC_LIB_INCLUDES="$SILC_LIB_INCLUDES -I$SILC_TOP_SRCDIR/lib/silcpgp"
+#endif SILC_DIST_PGP
+#ifdef SILC_DIST_SSH
+SILC_LIB_INCLUDES="$SILC_LIB_INCLUDES -I$SILC_TOP_SRCDIR/lib/silcssh"
+#endif SILC_DIST_SSH
##
## Library versioning.
)
#endif SILC_DIST_ACC
+#ifdef SILC_DIST_PGP
+AC_CONFIG_FILES(
+lib/silcpgp/Makefile
+#ifdef SILC_DIST_INPLACE
+lib/silcpgp/tests/Makefile
+#endif SILC_DIST_INPLACE
+)
+#endif SILC_DIST_PGP
+
+#ifdef SILC_DIST_SSH
+AC_CONFIG_FILES(
+lib/silcssh/Makefile
+#ifdef SILC_DIST_INPLACE
+lib/silcssh/tests/Makefile
+#endif SILC_DIST_INPLACE
+)
+#endif SILC_DIST_SSH
+
fi # compile_libs
#endif SILC_DIST_LIB
--- /dev/null
+<!--
+@LIBRARY=SILC Accelerator Library
+@FILENAME=silcacclib.html
+@LINK=silcacc.html:SILC Accelerator Interface
+-->
+
+<big><b>SILC Accelerator Library</b></big>
+<br />
+<small>Directory: lib/silcacc/</small>
+<br />
+<small>Library: libsilc.a, libsilc.lib</small>
+<br /><br />
+<b>Introduction</b>
+
+<br /><br />
+SILC Accelerator Library
+
+<br /><br />
+@LINKS@
/* Accelerate */
return prv->acc->pkcs[prv->pkcs_index].sign(
&prv->acc->pkcs[prv->pkcs_index], prv->context, src,
- src_len, compute_hash, hash, sign_cb, context);
+ src_len, compute_hash, hash, rng, sign_cb, context);
}
SILC_PKCS_VERIFY(silc_acc_pkcs_verify)
/* Accelerate */
return pub->acc->pkcs[pub->pkcs_index].verify(
&pub->acc->pkcs[pub->pkcs_index], pub->context,
- signature, signature_len, data, data_len, hash,
+ signature, signature_len, data, data_len, hash, rng,
verify_cb, context);
}
acc_pubkey->pkcs_index = i;
/* Accelerate the public key. Returns accelerator context. */
- if (!acc->pkcs->import_public_key(&acc->pkcs[i], public_key, 0,
- &acc_pubkey->context)) {
+ if (!acc->pkcs[i].import_public_key(&acc->pkcs[i], public_key, 0,
+ &acc_pubkey->context)) {
SILC_LOG_ERROR(("Error accelerating public key with accelerator '%s'",
acc->name));
silc_free(acc_pubkey);
acc_privkey->pkcs_index = i;
/* Accelerate the public key. Returns accelerator context. */
- if (!acc->pkcs->import_private_key(&acc->pkcs[i], private_key, 0,
- &acc_privkey->context)) {
+ if (!acc->pkcs[i].import_private_key(&acc->pkcs[i], private_key, 0,
+ &acc_privkey->context)) {
SILC_LOG_ERROR(("Error accelerating private key with accelerator '%s'",
acc->name));
silc_free(acc_privkey);
case SILC_SOFTACC_SIGN:
silc_pkcs_sign(e->key.private_key, e->src, e->src_len, e->compute_hash,
- e->hash, silc_softacc_data_cb, e);
+ e->hash, e->rng, silc_softacc_data_cb, e);
break;
case SILC_SOFTACC_VERIFY:
silc_pkcs_verify(e->key.public_key, e->src, e->src_len, e->data,
- e->data_len, e->hash, silc_softacc_verify_cb, e);
+ e->data_len, e->hash, e->rng, silc_softacc_verify_cb, e);
break;
}
}
SILC_LOG_DEBUG(("Loading public and private keys"));
- if (!silc_pkcs_load_public_key(pub_filename, return_public_key)) {
+ if (!silc_pkcs_load_public_key(pub_filename,
+ SILC_PKCS_ANY, return_public_key)) {
if (pass)
memset(pass, 0, strlen(pass));
silc_free(pass);
if (!silc_pkcs_load_private_key(prv_filename,
(const unsigned char *)pass, strlen(pass),
+ SILC_PKCS_ANY,
return_private_key)) {
silc_pkcs_public_key_free(*return_public_key);
*return_public_key = NULL;
SilcUInt32 pk_len;
SilcUInt32 key_len = 0;
- silc_pubkey = silc_pkcs_get_context(SILC_PKCS_SILC, public_key);
+ silc_pubkey = silc_pkcs_public_key_get_pkcs(SILC_PKCS_SILC, public_key);
if (!silc_pubkey)
return FALSE;
SilcPublicKey public_key;
SilcBool ret;
- if (!silc_pkcs_load_public_key((char *)pub_filename, &public_key)) {
+ if (!silc_pkcs_load_public_key((char *)pub_filename,
+ SILC_PKCS_ANY, &public_key)) {
fprintf(stderr, "Could not load public key file `%s'\n", pub_filename);
return FALSE;
}
if (!silc_pkcs_load_private_key(prv_filename,
(const unsigned char *)pass, strlen(pass),
+ SILC_PKCS_ANY,
&private_key)) {
memset(pass, 0, strlen(pass));
silc_free(pass);
* the `dest' is dynamically allocated and caller must free it by itself.
* If the `stack' was given to silc_asn1_alloc, the SILC_ASN1_ALLOC will
* allocate from that stack and consume the stack. Alternatively if
- * SILC_ASN1_ACCUMUL is given then memory is accumulated from `asn1' fo
+ * SILC_ASN1_ACCUMUL is given then memory is accumulated from `asn1' for
* `dest' and it is freed only when silc_asn1_free or silc_asn1_uninit
* is called. Next call to silc_asn1_encode will not cancel the previous
* result, but will accumulate more memory for new result.
/* Finally compute the digital signature of all the data we provided. */
silc_pkcs_sign(conn->private_key, silc_buffer_data(buffer),
silc_buffer_len(buffer), TRUE, conn->internal->sha1hash,
- silc_client_attributes_process_signed, s);
+ client->rng, silc_client_attributes_process_signed, s);
}
static void silc_client_attribute_destruct(void *key, void *context,
SilcAttributeObjPk obj;
SilcPublicKey pk;
- if (!silc_pkcs_load_public_key(pubkey, &pk)) {
+ if (!silc_pkcs_load_public_key(pubkey, SILC_PKCS_ANY, &pk)) {
SAY(client, conn, SILC_CLIENT_MESSAGE_COMMAND_ERROR,
"Could not load public key %s, check the filename",
pubkey);
action[0] = 0x01;
/* Check if it is public key file to be added to invite list */
- silc_pkcs_load_public_key(cmd->argv[2] + 1, &pubkey);
+ silc_pkcs_load_public_key(cmd->argv[2] + 1, SILC_PKCS_ANY, &pubkey);
invite = cmd->argv[2];
if (!pubkey)
invite++;
pubkey, privkey,
pubdata, sizeof(pubdata),
conn->internal->sha1hash,
+ client->rng,
conn->local_id,
SILC_ID_CLIENT,
silc_client_command_join_signed,
for (k = 3; k < cmd->argc; k++) {
if (cmd->argv[k][0] == '+')
chadd = TRUE;
- if (!silc_pkcs_load_public_key(cmd->argv[k] + 1, &chpk)) {
+ if (!silc_pkcs_load_public_key(cmd->argv[k] + 1, SILC_PKCS_ANY,
+ &chpk)) {
SAY(conn->client, conn, SILC_CLIENT_MESSAGE_COMMAND_ERROR,
"Could not load public key %s, check the filename",
cmd->argv[k]);
action[0] = 0x01;
/* Check if it is public key file to be added to invite list */
- silc_pkcs_load_public_key(cmd->argv[2] + 1, &pubkey);
+ silc_pkcs_load_public_key(cmd->argv[2] + 1, SILC_PKCS_ANY, &pubkey);
ban = cmd->argv[2];
if (!pubkey)
ban++;
SilcPublicKey pk;
SilcBuffer buffer;
- if (!silc_pkcs_load_public_key(pubkey, &pk)) {
+ if (!silc_pkcs_load_public_key(pubkey, SILC_PKCS_ANY, &pk)) {
SAY(conn->client, conn, SILC_CLIENT_MESSAGE_COMMAND_ERROR,
"Could not load public key %s, check the filename", pubkey);
COMMAND_ERROR(SILC_STATUS_ERR_NOT_ENOUGH_PARAMS);
return silc_auth_public_key_auth_generate_wpub(public_key, private_key,
randomdata, sizeof(randomdata),
- hash, id, type, generated,
+ hash, rng, id, type, generated,
context);
}
const unsigned char *pubdata,
SilcUInt32 pubdata_len,
SilcHash hash,
+ SilcRng rng,
const void *id, SilcIdType type,
SilcAuthGenerated generated,
void *context)
}
/* Compute the hash and the signature. */
- op = silc_pkcs_sign(private_key, tmp, tmp_len, TRUE, hash,
+ op = silc_pkcs_sign(private_key, tmp, tmp_len, TRUE, hash, rng,
silc_auth_public_key_auth_generate_cb, a);
memset(tmp, 0, tmp_len);
/* Verify the authentication data */
op = silc_pkcs_verify(public_key, payload->auth_data,
- payload->auth_len, tmp, tmp_len, hash,
+ payload->auth_len, tmp, tmp_len, hash, NULL,
result, context);
memset(tmp, 0, tmp_len);
* const unsigned char *pubdata,
* SilcUInt32 pubdata_len,
* SilcHash hash,
+ * SilcRng rng,
* const void *id,
* SilcIdType type,
* SilcAuthGenerated generated,
const unsigned char *pubdata,
SilcUInt32 pubdata_len,
SilcHash hash,
+ SilcRng rng,
const void *id, SilcIdType type,
SilcAuthGenerated generated,
void *context);
SilcMessageFlags flags;
SilcPublicKey public_key;
SilcPrivateKey private_key;
+ SilcRng rng;
SilcHash hash;
SilcCipher cipher;
SilcHmac hmac;
SilcUInt32 pk_len = 0;
SilcUInt16 pk_type;
SilcStack stack = e->stack;
+ SilcRng rng = e->rng;
SilcHash hash = e->hash;
SilcPublicKey public_key = e->public_key;
SilcPrivateKey private_key = e->private_key;
/* Compute signature */
op = silc_pkcs_sign(private_key, sign->data, silc_buffer_len(sign),
- TRUE, hash, silc_message_signed_payload_encode_cb, e);
+ TRUE, hash, rng,
+ silc_message_signed_payload_encode_cb, e);
return op;
}
e->flags = flags;
e->public_key = public_key;
e->private_key = private_key;
+ e->rng = rng;
e->hash = hash;
e->cipher = cipher;
e->hmac = hmac;
/* Verify the authentication data */
op = silc_pkcs_verify(remote_public_key, sig->sign_data, sig->sign_len,
- silc_buffer_data(sign), silc_buffer_len(sign), hash,
- result, context);
+ silc_buffer_data(sign), silc_buffer_len(sign),
+ hash, NULL, result, context);
silc_buffer_clear(sign);
silc_buffer_sfree(stack, sign);
/* Compute signature */
op = silc_pkcs_sign(private_key, auth->data, silc_buffer_len(auth),
- TRUE, ske->prop->hash,
+ TRUE, ske->prop->hash, ske->rng,
silc_connauth_get_signature_cb, connauth);
silc_buffer_free(auth);
/* Verify signature */
op = silc_pkcs_verify(pub_key, sign, sign_len, auth->data,
- silc_buffer_len(auth), ske->prop->hash,
+ silc_buffer_len(auth), ske->prop->hash, ske->rng,
silc_connauth_verify_signature_cb, connauth);
silc_buffer_free(auth);
rp->pkcs_alg_len = strlen(rp->pkcs_alg_list);
/* Get supported encryption algorithms */
- rp->enc_alg_list = silc_cipher_get_supported();
+ rp->enc_alg_list = silc_cipher_get_supported(TRUE);
rp->enc_alg_len = strlen(rp->enc_alg_list);
/* Get supported hash algorithms */
/* Sign the hash value */
SILC_FSM_CALL(ske->key_op =
silc_pkcs_sign(ske->private_key, hash, hash_len, FALSE,
- ske->prop->hash,
+ ske->prop->hash, ske->rng,
silc_ske_initiator_sign_cb, ske));
/* NOT REACHED */
}
SILC_FSM_CALL(ske->key_op =
silc_pkcs_verify(ske->prop->public_key, payload->sign_data,
payload->sign_len, hash, hash_len, NULL,
- silc_ske_verify_cb, ske));
+ ske->rng, silc_ske_verify_cb, ske));
/* NOT REACHED */
}
silc_pkcs_verify(ske->prop->public_key,
recv_payload->sign_data,
recv_payload->sign_len,
- hash, hash_len, NULL,
+ hash, hash_len, NULL, ske->rng,
silc_ske_verify_cb, ske));
/* NOT REACHED */
}
/* Sign the hash value */
SILC_FSM_CALL(ske->key_op =
silc_pkcs_sign(ske->private_key, hash, hash_len, FALSE,
- ske->prop->hash,
+ ske->prop->hash, ske->rng,
silc_ske_responder_sign_cb, ske));
/* NOT REACHED */
}
#endif /* SILC_DEBUG */
/* Get the SILC public key */
- silc_pubkey = silc_pkcs_get_context(SILC_PKCS_SILC, public_key);
+ silc_pubkey = silc_pkcs_public_key_get_pkcs(SILC_PKCS_SILC, public_key);
ident = &silc_pubkey->identifier;
SILC_LOG_DEBUG(("Adding SILC public key %p [%s], context %p",
SilcDList entry;
/* Get the SILC public key */
- silc_pubkey = silc_pkcs_get_context(SILC_PKCS_SILC, public_key);
+ silc_pubkey = silc_pkcs_public_key_get_pkcs(SILC_PKCS_SILC, public_key);
ident = &silc_pubkey->identifier;
SILC_LOG_DEBUG(("Deleting SILC public key [%s]", ident->username));