We present a new method for sensitivity analysis of photonic crystal devices. The algorithm is based on a finite-difference frequency-domain model and uses the adjoint variable method and perturbation theory techniques. We show that our method is highly efficient and accurate and can be applied to calculation of the sensitivity of transmission parameters of resonant nanophotonic devices.