int payload_len = 0;
unsigned char *auth_data = NULL;
SilcUInt32 auth_data_len = 0;
+ SilcPacketFlags flags = 0;
SILC_LOG_DEBUG(("Start"));
if (connauth->aborted) {
/** Aborted */
silc_fsm_next(fsm, silc_connauth_st_initiator_failure);
- return SILC_FSM_CONTINUE;
+ SILC_FSM_CONTINUE;
}
/* Start timeout */
if (!auth_data) {
/** Out of memory */
silc_fsm_next(fsm, silc_connauth_st_initiator_failure);
- return SILC_FSM_CONTINUE;
+ SILC_FSM_CONTINUE;
}
auth_data_len = connauth->auth_data_len;
+ flags = SILC_PACKET_FLAG_LONG_PAD;
break;
case SILC_AUTH_PUBLIC_KEY:
if (!silc_connauth_get_signature(connauth, &auth_data, &auth_data_len)) {
/** Error computing signature */
silc_fsm_next(fsm, silc_connauth_st_initiator_failure);
- return SILC_FSM_CONTINUE;
+ SILC_FSM_CONTINUE;
}
break;
}
if (!packet) {
/** Out of memory */
silc_fsm_next(fsm, silc_connauth_st_initiator_failure);
- return SILC_FSM_CONTINUE;
+ SILC_FSM_CONTINUE;
}
silc_buffer_format(packet,
SILC_STR_END);
/* Send the packet */
- if (!silc_packet_send(connauth->ske->stream, SILC_PACKET_CONNECTION_AUTH, 0,
- packet->data, silc_buffer_len(packet))) {
+ if (!silc_packet_send(connauth->ske->stream, SILC_PACKET_CONNECTION_AUTH,
+ flags, packet->data, silc_buffer_len(packet))) {
/** Error sending packet */
silc_fsm_next(fsm, silc_connauth_st_initiator_failure);
- return SILC_FSM_CONTINUE;
+ SILC_FSM_CONTINUE;
}
if (auth_data) {
/** Wait for responder */
silc_fsm_next(fsm, silc_connauth_st_initiator_result);
- return SILC_FSM_WAIT;
+ SILC_FSM_WAIT;
}
SILC_FSM_STATE(silc_connauth_st_initiator_result)
if (connauth->aborted) {
/** Aborted */
silc_fsm_next(fsm, silc_connauth_st_initiator_failure);
- return SILC_FSM_CONTINUE;
+ SILC_FSM_CONTINUE;
}
/* Check the status of authentication */
/* Call completion callback */
connauth->completion(connauth, connauth->success, connauth->context);
- return SILC_FSM_FINISH;
+ SILC_FSM_FINISH;
}
SILC_FSM_STATE(silc_connauth_st_initiator_failure)
&silc_connauth_stream_cbs, connauth);
silc_schedule_task_del_by_context(silc_fsm_get_schedule(fsm), connauth);
- return SILC_FSM_FINISH;
+ SILC_FSM_FINISH;
}
SilcAsyncOperation
if (connauth->aborted) {
/** Aborted */
silc_fsm_next(fsm, silc_connauth_st_responder_failure);
- return SILC_FSM_CONTINUE;
+ SILC_FSM_CONTINUE;
}
/* Start timeout */
/** Wait for initiator */
silc_fsm_next(fsm, silc_connauth_st_responder_authenticate);
- return SILC_FSM_WAIT;
+ SILC_FSM_WAIT;
}
SILC_FSM_STATE(silc_connauth_st_responder_authenticate)
/** Aborted */
silc_packet_free(connauth->packet);
silc_fsm_next(fsm, silc_connauth_st_responder_failure);
- return SILC_FSM_CONTINUE;
+ SILC_FSM_CONTINUE;
}
if (connauth->packet->type != SILC_PACKET_CONNECTION_AUTH) {
/** Protocol failure */
silc_packet_free(connauth->packet);
silc_fsm_next(fsm, silc_connauth_st_responder_failure);
- return SILC_FSM_CONTINUE;
+ SILC_FSM_CONTINUE;
}
/* Parse the received authentication data packet. The received
SILC_LOG_ERROR(("Bad payload in authentication packet"));
silc_packet_free(connauth->packet);
silc_fsm_next(fsm, silc_connauth_st_responder_failure);
- return SILC_FSM_CONTINUE;
+ SILC_FSM_CONTINUE;
}
if (payload_len != silc_buffer_len(&connauth->packet->buffer)) {
SILC_LOG_ERROR(("Bad payload length in authentication packet"));
silc_packet_free(connauth->packet);
silc_fsm_next(fsm, silc_connauth_st_responder_failure);
- return SILC_FSM_CONTINUE;
+ SILC_FSM_CONTINUE;
}
payload_len -= 4;
conn_type));
silc_packet_free(connauth->packet);
silc_fsm_next(fsm, silc_connauth_st_responder_failure);
- return SILC_FSM_CONTINUE;
+ SILC_FSM_CONTINUE;
}
if (payload_len > 0) {
SILC_LOG_DEBUG(("Bad payload in authentication payload"));
silc_packet_free(connauth->packet);
silc_fsm_next(fsm, silc_connauth_st_responder_failure);
- return SILC_FSM_CONTINUE;
+ SILC_FSM_CONTINUE;
}
}
silc_packet_free(connauth->packet);
/** Connection not configured */
SILC_LOG_ERROR(("Remote connection not configured"));
silc_fsm_next(fsm, silc_connauth_st_responder_failure);
- return SILC_FSM_CONTINUE;
+ SILC_FSM_CONTINUE;
}
/* Verify */
if (!memcmp(auth_data, passphrase, passphrase_len)) {
/** Authentication failed */
silc_fsm_next(fsm, silc_connauth_st_responder_failure);
- return SILC_FSM_CONTINUE;
+ SILC_FSM_CONTINUE;
}
} else if (repository) {
/* Digital signature */
if (!find || !connauth->auth_data) {
/** Out of memory */
silc_fsm_next(fsm, silc_connauth_st_responder_failure);
- return SILC_FSM_CONTINUE;
+ SILC_FSM_CONTINUE;
}
silc_skr_find_set_pkcs_type(find, connauth->ske->pk_type);
/** Authentication successful */
silc_fsm_next(fsm, silc_connauth_st_responder_success);
- return SILC_FSM_CONTINUE;
+ SILC_FSM_CONTINUE;
}
SILC_FSM_STATE(silc_connauth_st_responder_authenticate_pk)
if (connauth->aborted) {
/** Aborted */
silc_fsm_next(fsm, silc_connauth_st_responder_failure);
- return SILC_FSM_CONTINUE;
+ SILC_FSM_CONTINUE;
}
if (connauth->skr_status != SILC_SKR_OK) {
/** Public key not found */
SILC_LOG_DEBUG(("Public key not found, error %d", connauth->skr_status));
silc_fsm_next(fsm, silc_connauth_st_responder_failure);
- return SILC_FSM_CONTINUE;
+ SILC_FSM_CONTINUE;
}
SILC_LOG_DEBUG(("Found %d public keys",
SILC_LOG_DEBUG(("Invalid signature"));
silc_free(connauth->auth_data);
silc_fsm_next(fsm, silc_connauth_st_responder_failure);
- return SILC_FSM_CONTINUE;
+ SILC_FSM_CONTINUE;
}
silc_free(connauth->auth_data);
/** Authentication successful */
silc_fsm_next(fsm, silc_connauth_st_responder_success);
- return SILC_FSM_CONTINUE;
+ SILC_FSM_CONTINUE;
}
SILC_FSM_STATE(silc_connauth_st_responder_success)
&silc_connauth_stream_cbs, connauth);
silc_schedule_task_del_by_context(silc_fsm_get_schedule(fsm), connauth);
- return SILC_FSM_FINISH;
+ SILC_FSM_FINISH;
}
SILC_FSM_STATE(silc_connauth_st_responder_failure)
&silc_connauth_stream_cbs, connauth);
silc_schedule_task_del_by_context(silc_fsm_get_schedule(fsm), connauth);
- return SILC_FSM_FINISH;
+ SILC_FSM_FINISH;
}
SilcAsyncOperation