Aiming at the ambiguous synchronization of binary offset carrier (BOC) and composite binary offset carrier (CBOC) modulation signals due to secondary peaks for Global Navigation Satellite System (GNSS), a reconstructed sub-correlation function synchronization algorithm (RSSA) for BOC and CBOC is proposed. The general autocorrelation subfunctions of BOC and CBOC are obtained by deriving the subfunctions of the cross-correlation function between BOC signals with different modulation orders. According to the characteristics of the subfunctions, the corresponding reconstruction rules are set to obtain the unambiguous correlation functions. To further reduce the complexity of the local auxiliary signal, a local auxiliary signal optimization algorithm (LASOA) is proposed based on RSSA, which only needs to generate a local two-level signal compared to the conventional CBOC local four-level signal. The simulations show that the two algorithms proposed in this paper reduce the amplitude of the side peaks of the normalized correlation peaks of BOC by at least 0.09 compared with the autocorrelation side-peak cancellation technique (ASPeCT), maintain a high detection probability, and the multipath error is smaller than that of the autocorrelation side-peak cancellation technique (ASPeCT) and other traditional algorithms. The phase discrimination curves show that the linear region slope gains of the two algorithms in this paper are above 2 dB compared with the ASPeCT and other conventional algorithms.