RIS-Aided Physical Layer Security With Full-Duplex Jamming in Underlay D2D Networks

This paper investigates the physical layer security and data transmission for the underlay device-to-device (D2D) networks, and considers a combination of the reconfigurable intelligent surface (RIS) and full-duplex (FD) jamming receiver for the robustness and security enhancements of the system. In the demonstrated spectrum sharing setup, the total power of the D2D networks is conceived to the transmitter and receiver to transmit a private message and emit the artificial noise (AN) signals. To prevent information leakage, a beamforming design is presented for a multi-antenna FD D2D receiver in order to suppress and inject the AN signals in the direction of legitimate users and eavesdropper, respectively. The statistical characterization of end-to-end RIS-assisted wireless channels is presented, and the achievable ergodic secrecy rate of the system is derived in novel approximate expressions. The numerical and simulation results confirm the accuracy and effectiveness of the proposed analytical framework. The results demonstrate an optimal selection of the D2D power allocations for different number of reflecting elements in terms of achievable ergodic secrecy rates of the system.


I. INTRODUCTION
Over the past few years, the revolutionary progress in wireless communication protocols, computing capabilities, and sensors has enabled a new technology paradigm, i.e., Internet of Things (IoT). The major applications of IoT include healthcare, smart surveillance, automated transportation, industrial automation, remote management, and extended reality reality [1]. The global mobile traffic volume and internet-connected smart devices by 2030 are expected to exceed 5016 Exabyte/month, and 40 billion, respectively. However, the scarcity of spectrum resources is a challenge in The associate editor coordinating the review of this manuscript and approving it for publication was Young Jin Chun . establishing the ubiquitous connectivity, bandwidth demands, and optimized support for IoT; thus, identifying the novel enabling technologies and wireless communication networks is a necessity [2], [3]. Fifth generation (5G) networks are expected to play a key role in the widespread adoption of IoT. The standardization activities and deployment of 5G networks enabling the advanced functions such as ultra reliability, low latency, and mass connectivity have begun worldwide. The potential enabling technologies of 5G include multiple-input multiple-output (MIMO) [4], non-orthogonal multiple access (NOMA) [4], ultra-dense small cells [5], millimeter wave (mmWave) communication [5], and software-defined cognitive radios [6]. Despite the potential of these revolutionary technologies, 5G cannot VOLUME 9, 2021 This work is licensed under a Creative Commons Attribution 4.0 License. For more information, see https://creativecommons.org/licenses/by/4.0/ meet all the requirements of a post-2030 world. Therefore, the conceptualization of the sixth generation (6G) networks has been started. The core requirements, service categories, and enabling technologies of 6G networks present an interesting future of wireless communications [7], [8]. To derive the actualization of 6G networks, massive MIMO [9], artificial intelligence (AI) [10], efficient spectrum sharing [11], full-duplex (FD) communication [12], and reconfigurable intelligent surface (RIS) [13] are the potential key enabling technologies and solutions. In particular, RIS is a revolutionizing technology which reconfigures the wireless propagation environment smartly via software-controlled reflections. In a detail, passive reflecting elements integrated on a planar surface reflect the incident signals independently by controlling the amplitudes and/or phases, thereby collectively achieving a high-precision beamforming to enhance or cancel signals in any direction. Consequently, RIS improves the link performance and ensures a reliable reception. The advantages of RIS include high flexibility, superior compatibility, and low-cost deployment, and the design challenges include channel acquisition, beamforming design, and optimization [14].
In other developments, the security-sensitive applications require hyper-secured wireless networks. The private data are susceptible to malicious overhearing attacks owing to the broadcast nature of the wireless signals. The assurance of data security from the application to physical layers is essential. In this regard, the information-theoretic physical layer security (PLS) provides security against unintended users/eavesdroppers and ensures the data confidentiality. PLS limits the signal-to-interference-plus-noise ratio (SINR) to the eavesdroppers by utilizing the physical characteristics of the wireless channels, and enables the signals to be decoded at the intended users only. Eavesdroppers are classified into two complementary categories: passive eavesdroppers, who attempt to decode/analyze the information, and active eavesdroppers, who attempt to alter the information. In general, secrecy rate is considered as a optimization objective for the security provisioning [15], [16].

A. RELATED WORK
Several techniques have been investigated to improve the spectrum utilization and fulfill the massive connectivity demands [17]- [20]. For example, FD communications improve the spectral efficiency. Particularly, the recent advances in self-interference (SI) cancellation have made FD a practical choice for the wireless applications [17]. The sharing of spectral resources of the cellular networks with D2D users is another approach to reuse the spectrum. The D2D communications offload the cellular traffic, deliver the content directly among proximity users, and offer the advantages, including reduced transmission latency, extended cellular coverage, and enhanced spectral/energy efficiency [18], [19]. The integration of FD in D2D communications provides an efficient design solution for the network architecture of 6G networks [20]. However, the potential gain of the cellular networks with underlay FD D2D communications requires efficient interference management and resource allocation. It is important to design efficient spectrum-sharing schemes to improve the cellular and D2D links simultaneously.
Simultaneously, academia and industry have shown tremendous interest to unlock the superior advantages of RIS, and enhance the several performance metrics of the networks, such as sum-secrecy rates, energy efficiency, and spectral efficiency. Different application scenarios of RIS have been introduced, including device-to-device (D2D) communication [21], mmWave communication [22], coordinated multipoint (CoMP) transmission [23], simultaneous wireless information and power transfer (SWIPT) [24], and PLS [25]- [27]. In specific to PLS, [25] adjusted the phase shifts and transmit powers to enhance the PLS performance in RIS-assisted two-way communications. The authors in [26] presented the secrecy maximization problem in RIS-assisted multiuser two-way communications by utilizing the signals of the users for degrading the eavesdropping capability. Moreover in [27], the proposed RIS-based channel randomization technique improved the secrecy performance for a downlink cellular wire-tap network. The application of PLS was also extended to the D2D communications underlaying cellular networks where the system interference was utilized to enhance the secrecy performance [28], [29]. Such a scenario provided a win-win situation as each node simultaneously achieved its own transmission. In contrast, friendly jammers required power to interfere with the malicious users [30]. The underlay FD D2D networks also improved the security of the system. The FD D2D receiver simultaneously received the confidential signal using the SI elimination procedure and generated the jamming signals to confuse the eavesdropper [31].

B. MOTIVATION, NOVELTY AND CONTRIBUTION
To summarize, the efficient spectrum sharing for underlay D2D networks with the performance enhancements via RIS, FD radios, and PLS, is required for the 6G era. In general, underlay D2D networks were analyzed in a typical setting of the spectrum sharing, i.e., a D2D transmitter secured the cellular network via jamming signals, using either a relay or a direct link [32]. The requirement of a power source and the negative impact of additive noise do not make relays a good choice for the poor-quality users [33]. The direct link and proximity conditions also do not guarantee a reliable transmission. Consequently, the integration of RISs with underlay D2D networks is essential. In addition, a secure D2D communication in underlay networks has become a prerequisite, as security issues have become a major concern, particularly with the IoT developments [34]. The combined application of the RIS and FD jamming receivers can be useful for the robustness and security enhancements of overall underlay networks. Existing literature does not focus on the above-mentioned work and bridging these gaps is the motivation behind our work. This paper presents a theoretical framework to quantify the robustness and security performance of RIS-assisted underlay D2D networks. An interesting application scenario is developed by introducing a multi-antenna D2D receiver as a FD jamming receiver. Consequently, the D2D transmitter and receiver share the total power, to transmit and emit the confidential and jamming signals, respectively. Finally, the optimal D2D power allocations according to number of reflecting elements for the achievable ergodic secrecy rates are identified. The technical contribution of this paper is: • Novel system setting: Presenting a novel analytical framework of spectrum sharing for RIS-assisted underlay D2D networks, the robustness and security enhancements of the system are investigated using a combination of the RIS and FD jamming receiver. To facilitate the stringent quality-of-service (QoS) requirements in cellular network, both direct and RIS cascaded links are considered. In our setup, a D2D receiver selects an antenna for the maximum reception, and beamforming is designed for the remaining antennas to inject and suppress the artificial noise (AN) in the direction of eavesdropper and legitimate users, respectively.
• Performance analysis: The statistical characterization of the end-to-end (E2E) RIS-assisted wireless channels and instantaneous E2E SINRs is presented. Building upon these expressions, the approximate expressions of the achievable ergodic secrecy rates of the system are derived. In particular, the effective channel powers for the legitimate receivers are approximated with the gamma distribution using moment-matching technique.
In contrast, the exponential and hypoexponential distributions are considered for the eavesdropping links.
• Insightful observations: Numerical results confirm an agreement between the theoretical and simulation results. The results suggest an optimization of D2D power allocations for the achievable ergodic secrecy rates of the system and provide valuable insights for an optimal selection with respect to number of reflecting elements.

C. NOTATIONS AND PAPER ORGANIZATION
Notation: In this paper, vectors and matrices are shown in bold letters. x H , x , and x −1 denote the Hermitian transpose, Euclidian norm, and inverse operators of a matrix x, respectively. [x] z and |.| implies the z element of x and the absolute value, respectively. arg (x) returns the argument of a complex number x and diag {x} denotes a diagonal matrix in which each diagonal element is the corresponding element in x. The space of P × Q complex-valued matrices is denoted by C P×Q . The symbols∼ and mean approximately follow the distribution and element-wise product, respectively. E {.}, V {.}, f X and F X denote the statistical expectation, variance, probability density function (PDF) and cumulative distribution function (CDF) of a random variable (RV), respectively. log (.) and ln (.) stand for the binary and natural logarithm functions, respectively. Furthermore, K v (.) stands for the modified Bessel function of the second kind. The rest of this paper is organized as follows: In Section II, the system model of the presented framework, including the network description, design of beamforming and AN, and signal transmission model, is provided. Section III describes the analytical framework of the statistical characterization of RIS-assisted E2E wireless channels, and Section IV presents the achievable ergodic secrecy rate analysis. Section V reports the numerical results to validate the analytical results with the performance comparison. Finally, the conclusions of the paper are summarized in Section VI.
The abbreviations and notations used in this paper are listed in Tables 1 and 2, respectively.

II. SYSTEM MODEL A. NETWORK DESCRIPTION
As shown in Fig. 1, a spectrum sharing setup for a cellular network with in-band underlay D2D communications is considered. The D2D users transmit simultaneously in the same spectral band, and in a compensation, contribute to a high-level security of the system [33], [34]. In the downlink transmission scenario, a D2D transmitter (DT) and a cellular base station (CT) send information symbols to a D2D receiver (DR) and a cellular user (CR), respectively, under the malicious attempt of a passive eavesdropper (E). To assist the transmissions and improve the instantaneous SINR at the intended receivers, RISs are deployed, i.e., RiS c in the vicinity of CT, and RiS d in the vicinity of DT. To facilitate the high SINR requirements for a CR, both the direct and RIS-cascaded links are considered. A RIS-cascaded without a direct link is considered for a D2D user. For analysis, the transmission mode of all nodes other than DR is set as a half-duplex with a single-antenna. In contrast, DR with VOLUME 9, 2021  M antennas in a multi-antenna setup works in a FD mode. DR selects an antenna for the maximum reception from RiS d , and designs the beamforming to use M − 1 antennas to emit the AN signals in the direction of E 1 and suppress the AN signals in the directions of CR and receiving antenna of DR. 2 1 The jamming signals for E are provided via direct link only because a scenario is considered where the direct distance between E and DR is significantly smaller than via RiS d . 2 Due to the proximity of the D2D users, the signal from RiS c to DR is not included. However, in practice, CT is unaware of the D2D transmissions in underlay D2D networks. The changing in this setting will provide a more general system setup and has been left for future work.
The conventional RIS setup, i.e., a planar surface with several passive reflecting elements and a smart controller, is considered [35]. To demonstrate the practical setup of RIS-assisted underlay networks and examine the impact of the reflecting elements precisely, different number of reflecting elements is considered in both networks. In particular, RiS c and RiS d contain R and S number of reflecting elements, respectively, and adjust their phase shifts to constructively add the signals at CR and DR, respectively.
Without loss of generality, all the baseband equivalent channels are assumed to be independent, identical, and flat, with the amplitudes following the Rayleigh distribution 3 with a scale parameter equal to 1. 4 In total, there are 11 communication links, and DR → DR, and are denoted by the complex channel coefficients,

B. DESIGN OF BEAMFORMING AND AN
First, a DR selects an antenna as arg max m=1,··· ,M | dm | 2 to maximize the received power, where | dm | 2 is the effective channel power from the DT to the antenna m at DR. Conceiving the total power of D2D networks is P d , in which, a portion of P d , ϕ, is assigned to DT to transmit the confidential information symbol to DR, and the remaining portion, 1 − ϕ, is used by DR to emit the AN signals to E, where 0 ≤ ϕ ≤ 1 is the ratio of the D2D power allocation. 5 ϒ is a (M − 1) × 1 Gaussian vector of the AN signals having all the element entities with a zero mean and unit variance. Because the CSI of E is unknown, the power (1 − ϕ) P d is allocated evenly to M − 1 entities of ϒ to emit the AN signal. To protect the DR and CR against the AN signals, an (M − 1) × (M − 1) beamforming matrix, , is designed as where Q is given by 3 Following a generic assumption on PLS, i.e., the availability of the perfect channel state information (CSI) of the legitimate links and the channel distribution information of the eavesdropping links, this paper considers the optimal phase shift setting for the legitimate links only, and the beamforming design at FD DR without the perfect CSI of E [36]. In a detail, RIS cascaded channel can be estimated by utilizing the active transceivers at the transmitter and receiver (i.e., by transmitting/receiving the pilots) [37]. However, a detailed channel estimation procedure for RIS assisted communications is outside the scope of this paper. 4 This assumption corresponds to the scenario in which there exists the several scatters if the line-of-sight (LoS) link is blocked. 5 Such a setting corresponds to a scenario in which the DT and DR, as a single transmitter-receiver pair in the D2D networks, transmit alternatively in each transmission duration. Therefore, the sum of the powers assigned to DT and DR in the proposed setting is equal to the total power assigned to DT in the time division duplex system. In such a way, both the SI signal at DR and the AN signal towards CR are nullified, ensuring the normal receptions at both DR and CR without the interference.

C. SIGNAL TRANSMISSION MODEL
The baseband equivalent received signals at CR, DR, and E are, respectively represented as and  [38], [39]. Furthermore, x c , E |x c | 2 = 1, and x d , E |x d | 2 = 1, are the Gaussian modulated signals intended for CR and DR, respectively. n c , n d , and n e , with the variance σ 2 c , σ 2 d , and σ 2 e , denote the additive white Gaussian noise (AWGN) related to the receiving antenna of CR, DR, and E, respectively. The independent, identically distributed noise, i.e., σ 2 = σ 2 c = σ 2 d = σ 2 e , is considered for the mathematical tractability. In this respect, ρ c P c σ 2 , ρ d ϕP d σ 2 , and ρ j (1−ϕ)P d (M −1)σ 2 are the SNR at CT, DT, and DR, respectively [40]. Furthermore, P c is the power assigned to the cellular network. By nullifying the AN signals in the directions of CR and DR, 6 the SINRs decoding x c and x d at indicates the residual SI after the beamforming procedure. 0 ≤ b sic ≤ 1 is the SI elimination factor (i.e., b sic = 0 indicates the nullified SI, and b sic = 1 is the maximum SI or invalid beamforming). Importantly, the perfect estimation of h 11 is required to nullify the SI and is not possible in the practical systems. However, because beamforming is implemented to nullify the AN in the directions of DR and CR, the residual SI at DR is very small (as compared to the AN signal that deteriorate the channel of E), and thus can be ignored, i.e., b sic = 0.
CR and DR are simplified as and respectively. Similarly, the SINRs decoding x c and x d at E are denoted by and respectively.

III. STATISTICAL CHARACTERIZATION OF RIS-ASSISTED E2E WIRELESS CHANNELS
This section presents the theoretical framework of the statistical characterization of the RIS-assisted E2E legitimate and eavesdropping wireless channels in the cellular and D2D networks.  [42]. The effective channel power for CR is defined as c = |h 1 | + |h 3,2 | 2 , which is the square of the sum of the Rayleigh and Gaussian distributed RVs. By using the moment matching technique for the distribution approximations [43], c is approximated with a regular gamma distribution, i.e., c∼ (k c , θ c ). The shape parameter k c , and scale parameter θ c , are given by and VOLUME 9, 2021 respectively, where E { c } and E 2 c are the first and second moments of c , respectively.
The following theorem determines the parameters k c and θ c .
Theorem 1: The parameters, k c and θ c , are expressed by respectively. Substituting Eqs. (11) and (12) into Eqs. (9) and (10) . The channel power for the DR in the D2D network, d = |h 7,6 | 2 , is the square of Gaussian RV only, and can also be approximated with a regular gamma distribution, i.e., d∼ (k d , θ d ), using the moment matching technique [44]. Following the similar steps, the shape and scale parameters of d , i.e., k d and θ d , can be derived using the first and second moments as

C. E2E EAVESDROPPING CHANNELS
Without the perfect CSI, RiS c and RiS d cannot adjust the phase shifts of their respective reflecting elements according to the fading gain phases of the eavesdropping links, and therefore the optimal setting of phase shifts is not obtained [45]. Consequently, the eavesdropping SINRs, γ C E and γ D E can be rewritten as and respectively. Here, and where φ 2r , φ 4r , φ 5r , φ 6s , and φ 8s are the phases of [ and t 2 can be approximated using the exponential RV with parameters λ t 1 = R + 1 and λ t 2 = S, respectively. The probability density function (PDF) of t 3 also follows an exponential distribution with parameter λ t 3 = M − 1. Here, the PDF of

IV. ACHIEVABLE ERGODIC SECRECY RATE ANALYSIS
This section provides an analytical framework to derive the approximate achievable ergodic secrecy rates in the cellular and D2D networks.

A. ACHIEVABLE ERGODIC RATE FOR CELLULAR LEGITIMATE USER
The achievable ergodic rate associated with x c at CR is given by where γ C L = ρ c c . For c∼ (k c , θ c ) and any scalar ρ c > 0, ρ c c∼ (k c , ρ c θ c ). Using Eqs. (9) and (10), we get ρ c c∼ Proof: The proof is available in [46].
Using Lemma 2 and Theorem 2, as well as the algebraic manipulation, Eq. (20) can be approximated as Using Theorem 1 and substituting the values of k c and θ c obtained in Eqs. (11) and (12), Eq. (24) is solved. In this way, the approximate expression of the achievable ergodic rate at CR in cellular network is obtained.

B. ACHIEVABLE ERGODIC RATE FOR D2D LEGITIMATE USER
The achievable ergodic rate associated with symbol x d at DR can be expressed by where γ D L = ρ d d . Using the same approach, Eq. (25) can be approximated as By obtaining the values of k d and θ d using the first and second moments, i.e., E { d } and E 2 d , Eq. (26) is solved. In this way, the approximate expression of the achievable ergodic rate at DR in D2D network is obtained.

C. ACHIEVABLE ERGODIC RATE FOR EAVESDROPPER
The achievable ergodic rates associated with symbols x c and x d at E are given by and respectively. and respectively, where U 1 = ρ c t 1 +ρ d t 2 +ρ j t 3 , U 2 = ρ d t 2 +ρ j t 3 , and U 3 = ρ c t 1 + ρ j t 3 .
To solve Eqs. (29) and (30), the following Lemmas and Theorem are presented Lemma 3: If Y∼ Exp (κ), then for the positive factor c 0 , c 0 Y∼ Exp κ c 0 . Proof: See Appendix D. Lemma 4: For 1 ≤ k ≤ K , the sum of K independent exponential RVs with a distinct rate κ k , (κ k is the rate of the k th exponential distribution) can be approximated by the generalized Erlang or hypoexponential distributed RV U∼ hypoexp (κ 1 , . . . , κ k ).
Theorem 3: The approximate expressions of the achievable ergodic rate associated with symbols x c and x d at E can be determined as and respectively, where Proof: See Appendix E. VOLUME 9, 2021

D. ACHIEVABLE ERGODIC SECRECY RATE OF THE SYSTEM
Similar to [48], the achievable ergodic secrecy rate is defined as a positive discrepancy between the achievable ergodic rates for the legitimate user and eavesdropper. Using the derived expressions associated with the cellular and D2D information symbols, the achievable ergodic secrecy rates can be defined as and where [v] + = max(0, v). R C L and R C E are calculated by Eqs. (24) and (31), and R D L and R D E are calculated by Eqs. (26) and (32), respectively.
In practice, R C S and R D S are non-negative by designing the secure transmissions for the underlay D2D networks. In this respect, the achievable ergodic secrecy rates of the system can be acquired as

V. NUMERICAL RESULTS
This section presents the numerical results to verify the analytical results presented in the previous sections, and provides the valuable insights. If not specified otherwise, the main parameters are set as R = 60, S = 30, M = 15, and P c σ 2 = P d σ 2 = 10dB, and are selected for a behavioral validation of the system. For the comparison, the benchmark scheme in [32] is plotted in which the jamming signals for the cellular network were provided via a D2D RIS-cascaded channel, and only a direct link (i.e., without a RIS-cascaded channel) was used for a cellular user. Moreover, D2D users in [32] were evaluated in terms of the reliability performance only. In order to evaluate the performance of the cellular network comprehensively, the baseline scheme is also plotted in which the cellular networks used only a RIS-cascaded channel (i.e., without a direct link), and were not provided the jamming signals (i.e., no cooperation between the networks). The simulation results are obtained via the Monte Carlo simulations with 10 7 channel realizations. Notably, the numerical and simulation results are consistent and therefore verify the accuracy of the presented analytical framework.

A. PERFORMANCE OF THE CELLULAR NETWORKS
First, the performance of the cellular networks is evaluated in terms of the achievable ergodic secrecy rates. Fig. 2 shows the relationship between the achievable ergodic rates at CR, R C L , with the SNR at CT, ρ c . The analysis point is calculated by Eq. (24). The results show that R C L exhibits an incremental relationship with ρ c , and the presented framework provides a superior performance compared to the benchmark and baseline schemes. This is because the presented framework considers both direct and RIS-cascaded links. R C L can be enhanced by the RIS, instead of increasing ρ c or a relay link, for the SINR improvement. This is justified by the degree of freedom achieved by the optimal phase shifting and the amount of additional information that can be transmitted using the proposed framework. In contrast, the benchmark scheme provides the worst performance because it is based on an environment where RIS does not exist. Fig. 3 depicts the relationship between the achievable ergodic rates at E, R C E , with ρ c , and provides a performance comparison with the benchmark and baseline schemes. The analysis point is calculated by Eq. (31). In the presented framework, the jamming signals for the cellular network are provided from both the DT (via RIS-cascaded channel), and multi-antenna DR. In contrast, only the single-antenna DT provides the jamming signals in benchmark strategy. As expected, R C E also increases with ρ c , due to the increase in leakage information. The presented framework guarantees a superior performance in comparison to baseline scheme for which there is no cooperation from D2D network in terms of jamming signals. The superior performance of the presented framework in comparison to benchmark scheme relies on the D2D power allocation strategy. Fig. 4 plots the achievable ergodic secrecy rates in the cellular network, R C S and ρ c , and presents a performance comparison with the benchmark and baseline schemes. The analysis point is calculated by Eq. (33). For all the schemes, R C S first increases and then decreases as ρ c increases, demonstrating that ρ c can be optimized. This implies a trade-off between the security and reliability in the event of an eavesdropping attack, referred as the security-reliability trade-off. The presented framework provides best performance in terms of R C S by utilizing the proper D2D power allocation strategy. By adjusting the D2D power allocations, the achievable ergodic rates associated with x c at CR exceed than that at E, and therefore higher R C S points are attainable throughout  ρ c . The benchmark outperforms the baseline scheme as it provides a comparatively lesser leakage information due to the jamming signals.

B. PERFORMANCE OF THE OVERALL SYSTEM
Now, the achievable ergodic secrecy rate performance of the overall system is evaluated. Fig. 5 shows the relationship between the total achievable ergodic rates at the legitimate users, CR and DR, i.e., R C L + R D L , with D2D power allocation ratio (ϕ). The analysis points are calculated by Eqs. (24) and (26). Here, the relationship is also incremental. Importantly, the presented framework provides the maximum decoding SINRs at CR, given by Eq. (5), and DR, given by Eq. (6), and thus provides an optimal performance in terms of total achievable ergodic rates. This is justified by the argument that the AN signals in the direction of the CR and DR are eliminated by adapting the proposed beamforming design; therefore, the interference is minimized. It can also be observed that the reflecting elements in both networks, i.e., R and S, have a positive impact on the performance. By an optimal phase shift setting, increase in reflecting elements enables an efficient exploitation of the spatial degrees of freedom, providing substantial performance gain. Fig. 6 depicts the relationship between the total achievable ergodic rates at E, i.e., R C E + R D E , with ϕ. The analysis points are calculated by Eqs. (31) and (32). In the presented framework, the total SINR decoding x c and x d at E increase with an increment in ϕ, and consequently, ϕ is directly proportional to the total achievable ergodic rates at E. It is observed that the information leakage also increases with a increase in both R and S. It verifies that E manages to receive R and S number of copies of the intended signals, although RiS c and RiS d do not optimally adjust the phases for their eavesdropping links (due to absence of CSI), and cannot maximize γ C E and γ D E , respectively. Fig. 7 plots the achievable ergodic secrecy rates of the system, R Total S with ϕ, R, and S. While validating the previous results in Fig. 5 and Fig. 6, the results show an increment in R Total S first, and then a decrement, as ϕ increases, and demonstrate that for a given number of R and S, there exists an optimal ϕ (ϕ * ) to maximize R Total S . Another important VOLUME 9, 2021 FIGURE 6. Total achievable ergodic rates at E vs. D2D power allocation ratio (ϕ). observation is that the positive impact of R and S in terms of R Total S is attainable although the increase in R and S increases the total achievable ergodic rates both at the legitimate users and E. Fig. 8 illustrates ϕ * for different number of reflecting elements in RiS c , and RiS d . The analytical solution, i.e., ϕ * for the maximum R Total S , is obtained for different number of R and S. It is observed that ϕ * has an incremental relationship for both R and S. Our results identify the optimal selection of D2D power allocations according to the number of reflecting elements in D2D and cellular networks, and provide guidelines for the robustness and security enhancements of the RIS-assisted underlay D2D networks.

VI. CONCLUSION
Despite the potential of the key technologies, 5G networks will not meet all the requirements of a post-2030 world, which necessitates the designing of 6G networks. The anticipated approaches for 6G networks include the RIS, efficient spectrum sharing, FD communication, massive MIMO, and PLS. This paper presented a novel analytical framework of spectrum sharing for the underlay D2D networks to enhance the robustness and security of the system under an eavesdropping attempt, using a combination of the RIS technology and FD jamming receiver. We statistically characterized the E2E channel powers and derived the approximate expressions for the achievable ergodic secrecy rates. The derived analytical expressions provided an easy selection of the optimal D2D power allocations for different number of reflecting elements. The results could provide design insights into the architecture of the RIS-assisted underlay D2D networks to be implemented in the 6G era.

APPENDIX B PROOF OF THEOREM 1
Using the moment matching technique, the first moment of c , E { c }, is determined as, By substituting the statistics associated with a Rayleigh distributed h 1 , and a Gaussian distributed h 3,2 , i.e., in Eq. (40), the second moment of c is obtained. This proves Theorem 1.

APPENDIX C PROOF OF THEOREM 2
We use the Taylor

APPENDIX D PROOF OF LEMMA 3
The CDF of RV c 0 Y is given by F c 0 Y (y) = P (c 0 Y ≤ y) = F Y y c 0 , where F Y (.) is the CDF of Y . Lemma 3 proves that.

APPENDIX E PROOF OF THEOREM 3
Using Theorem 2, algebraic manipulation, and substituting the results of Lemma 3 and 4, Eqs. (29) and (30) are solved. This concludes the proof.