We investigate the potential of phase-diversity (PD) and Gerchberg- Saxton (GS) algorithms in the calibration of active instruments. A set of images is recorded with the focal-plane scientific camera, each image having a known and unique defocus. The phase- retrieval algorithms are used, with those images, to estimate the non-common path aberration that needs to be compensated by correct alignment of the instrument. We demonstrate by numerical simulations that such algorithms, in particular GS, are sufficient detection methods to fully correct wavefronts with an rms error at least up to 6 rad — but this requires several iterative correction stages.