  A three-dimensional extension of the structural default model with firms'
values driven by correlated diffusion processes is presented. Green's function
based semi-analytical methods for solving the forward calibration problem and
backward pricing problem are developed. These methods are used to analyze
bilateral counterparty risk for credit default swaps and evaluate the
corresponding credit and debt value adjustments. It is shown that in many
realistic cases these value adjustments can be surprisingly large.
