# Joint Resource Allocation in Secure OFDMA-Based Networks Taking a Base Station as a Two-Way Relay
## 2 System Model
\begin{split}& R_{\text{sec},m}^{i,j}\\ &=\frac{1}{2}\log\left\{\frac{\left(P_{R,(A_{m},B_{m})}^{j}|s_{A_{ m}}^{j}|^{2}/\alpha^{2}+1\right)\sigma^{2}+P_{R,(A_{m},B_{m})}^{j}|s_{A_{m}}^{j}|^{2}P_{B _{m}}^{i}|^{j}_{B_{m},R}|^{j}/\alpha^{2}}{\left(P_{R,(A_{m},B_{m})}^{j}|s_{A_{ m}}^{j}|^{2}/\alpha^{2}+1\right)}\right.\\ &\cdot\frac{\left(P_{R,(A_{m},B_{m})}^{j}|s_{B_{m}}^{j}|^{2}/ \alpha^{2}+1\right)\sigma^{2}+P_{R,(A_{m},B_{m})}^{j}|s_{B_{m}}^{j}|^{2}P_{A_{ m}}^{j}|^{j}_{A_{m},R}|^{j}/\alpha^{2}}{\left(P_{R,(A_{m},B_{m})}^{j}|s_{B_{ m}}^{j}|^{2}/\alpha^{2}+1\right)}\right\}\\ &\left.-\frac{1}{2}\log\left\{P_{A_{m}}^{i}P_{B_{m}}^{i}(|t_{A_{ m},E}^{j}|^{2}|h_{B_{m},R}^{j}|^{2}+|t_{B_{m},E}^{j}|^{2}|h_{A_{m},R}^{j}|^{2})+ \sigma^{2}(P_{A_{m}}^{i}|h_{A_{m},E}^{i}|^{2}+P_{B_{m}}^{i}|h_{B_{m},E}^{i}|^{ 2}\right.\\ &\left.+P_{A_{m}}^{i}|h_{A_{m},R}^{i}|^{2}+P_{B_{m}}^{i}|h_{B_{m},R }^{i}|^{2})-P_{A_{m}}^{i}P_{B_{m}}^{i}2\Re\left\{h_{A_{m},E}^{i}\left(h_{B_{m}, E}^{i}\right)^{*}\left(h_{A_{m},R}^{i}\right)^{*}h_{B_{m},R}^{i}\right\}+ \sigma^{4}\right\}\end{split}  \tag{15}\]  
The achievable secure rate for the normal user \(T_{k},k\in\{1,2,...,K\}\) is:  
\[R_{\text{sec},T_{k}}^{i,j}=\left[R_{T_{k},R}^{i,j}-R_{T_{k},E}^{i,j}\right]^{ +}. \tag{16}\]  
\[R_{T_{k},R}^{i,j}=\frac{1}{4}\left\{\log\left(1+\frac{|h_{T_{k},R}^{i}|^{2}P_{ T_{k}}^{i}}{\sigma^{2}}\right)+\log\left(1+\frac{|g_{R,T_{k}}^{j}|^{2}P_{R,T_{k}}^{j}}{ \sigma^{2}}\right)\right\} \tag{17}\]  
\[R_{T_{k},E}^{i,j}=\frac{1}{4}\left\{\log\left(1+\frac{|h_{T_{k},E}^{i}|^{2}P_{ T_{k}}^{i}}{\sigma^{2}}\right)+\log\left(1+\frac{|g_{R,E}^{j}|^{2}P_{R,T_{k}}^{j}}{ \sigma^{2}}\right)\right\} \tag{18}\]  
\(R_{T_{k},R}^{i,j}\) is the main channel capacity between the normal user and the base station, \(R_{T_{k},E}^{i,j}\) is the wiretap channel capacity when the eavesdropper is wiretapping the communication process between the normal user and the base station, \(h_{T_{k},R}^{i}\) and \(g_{R,T_{k}}^{j}\) are the uplink and downlink channel gains between the normal user \(T_{k}\) and the base station over subcarrier \(i\) and \(j\) respectively; \(h_{T_{k},E}^{i}\) is the channel gain between the normal user \(T_{k}\) and the eavesdropper over subcarrier \(i\). \(P_{T_{k}}^{i}\) is the uplink transmit power from the normal user \(T_{k}\) to the base station and \(P_{R,T_{k}}^{i}\) is the downlink transmit power from the base station to the normal user \(T_{k}\) over subcarrier \(i\). We define two indicator functions to represent subcarrier assignment and subcarrier pairing. \(\pi_{i,j}=1\) or \(\eta_{i,j}=1\) means that the uplink subcarrier \(i\) is paired with the downlink subcarrier \(j\) for the normal user or the paired users; otherwise, \(\pi_{i,j}=0\) or \(\eta_{i,j}=0\). \(\rho_{k}^{i,j}=1\) or \(\rho_{m}^{i,j}=1\) means that the uplink subcarrier \(i\) and the downlink subcarrier \(j\) are assigned to the \(k\)-th normal user or the \(m\)-th paired users; otherwise, \(\rho_{k}^{i,j}=0\) or \(\rho_{m}^{ij}=0\). In the cellular network that has paired and normal users, we can realize secrecy communication without information leakage [26], if the information transmission rate is less than the maximum secrecy rate. Firstly, we need to investigate the problem of maximizing the total secrecy rate for paired and normal users in one cell by means of subcarrier assignment, subcarrier pairing and power allocation. This primary optimization problem can be expressed as:  
\[