On the Performance Analysis of RIS-Assisted Infinite and Finite Blocklength Communication in Presence of an Eavesdropper

This work investigates the performance of a reconfigurable intelligent surface (RIS) aided communication system under ultra-reliable low-latency communication (URLLC) constraints, where the secrecy performance for communication with multiple legitimate users <inline-formula> <tex-math notation="LaTeX">$(D)$ </tex-math></inline-formula>, scheduled one at a time, in presence of eavesdropper <inline-formula> <tex-math notation="LaTeX">$(E)$ </tex-math></inline-formula> is analyzed. The outage probability and block error rate (BLER) at <inline-formula> <tex-math notation="LaTeX">$D$ </tex-math></inline-formula> and <inline-formula> <tex-math notation="LaTeX">$E$ </tex-math></inline-formula> are derived for infinite and finite blocklength transmissions assuming that the direct communication links between source <inline-formula> <tex-math notation="LaTeX">$(S)-D$ </tex-math></inline-formula> and <inline-formula> <tex-math notation="LaTeX">$S-E$ </tex-math></inline-formula> exist. The expressions for the asymptotic outage probability, secrecy capacity, secrecy outage probability and secure BLER are also obtained. The new expressions for the probability density function (PDF) and the cumulative distribution function (CDF) for the difference of phases of two Nakagami<inline-formula> <tex-math notation="LaTeX">$-m$ </tex-math></inline-formula> distributed channel envelopes are derived. To validate the correctness of the derived analytical expressions and to analyze the impact of various system parameters including the number of RIS meta-atoms, the magnitude of reflection coefficient, transmit signal-to-noise ratio (SNR) threshold, and quantized phase-shifts, Monte-Carlo simulations are used. The performance of the proposed system is compared with that of the decode and forward relay-based system. It is also shown that RIS significantly improves the performance at <inline-formula> <tex-math notation="LaTeX">$D$ </tex-math></inline-formula>, whereas degrading the same for <inline-formula> <tex-math notation="LaTeX">$E$ </tex-math></inline-formula>.


I. INTRODUCTION
R ECENT growth in technology-driven applications and contemporary evolution in wireless communication technologies have made the efficient connectivity requirements of the users more demanding. Upcoming wireless technologies, such as fifth generation (5G) and beyond 5G (B5G) are expected to fulfil the requirements of very high data rates, improved spectral efficiency, larger connectivity, connection density, etc. For example, the number of connected devices in the context of the Internet of Things (IoT), mobiles phones, laptops, etc. are around 24901 million, which is expected to further rise to 37932 million by the end of 2026 [1]. Furthermore, the mobile subscriptions are expected to grow to 8775 million by the end of 2026 out of which around 3352 million would be contributed by the 5G subscriptions [1], [2]. The peak data rate of 1−20 Gbps with a user experience data rate of 10 − 100 Mbps and increased spectral efficiency of ×1 − ×3 is expected from the B5G communication systems [3]. To meet these demands several technologies like millimeter wave (mmWave), multiple-input multiple-output (MIMO), ultra-dense networks, etc., have been assessed in the recent past [4].
In a similar context, reconfigurable intelligent surface (RIS) is one of the potential candidate technologies for B5G communication systems that can be easily deployed on current infrastructure such as buildings, cars, etc., [5], [6], [7]. RISs are arrays of passive elements whose electromagnetic properties such as reflection coefficient can be intelligently controlled [8]. The RIS elements, also referred as meta-atoms, are constructed using the sub-wavelength rate of the system were assessed. The secrecy capacity maximization problem was addressed in [23], where a transmitter attempts to communicate with multiple receivers with the help of an RIS in presence of an eavesdropper. In [25], an RIS was used to securely transmit the information from a multi-antenna transmitter to a multi-antenna legitimate user in presence of a passive eavesdropper. The work in [26] compared the with and without RIS scenarios for PLS security and derived the expressions for the probability density function (PDF) and cumulative distribution function (CDF) of the signal-to-interference-plus-noise-ratio (SINR).
Further, the upcoming technological applications demand high reliability and low latency communications which can be achieved by adopting finite blocklength transmissions for ultra-reliable low-latency communication (URLLC). Several works have analyzed the RIS-based communication systems under URLLC constraints [28], [29], [30]. Note that although the impact of RIS-assisted secure communication has been well investigated in the literature under idealistic infinite blocklength [18], [19], [20], [21], [22], [23], [24], [25], [26], [27], there is a lack of relevant analytical framework in the literature in the case of finite blocklength transmission and the advantages of using an RIS in the presence of an Eavesdropper are yet to be explored, which is the main focus of this work.

A. MOTIVATIONS AND CONTRIBUTIONS
We recall that proper tuning of the reflection coefficients of RIS meta-atoms helps maintain the secrecy of the communication system. However, in outdoor environments, the possibility of signal leakage can not be ignored. In such situations, the secrecy aspects also become critical as the signal broadcast from the user can be eavesdropped by the illegitimate user through a direct path along with the leaked signal component from RIS reflections. Therefore, the analysis of more realistic RIS-assisted systems is crucial for the design of these systems. However, the analysis of infinite blocklength transmissions presented in the literature [18], [19], [20], [21], [22], [23], [24], [25], [26], [27] cannot be extended in a straightforward manner to the case of finite blocklength transmission, which is a key technique for URLLC systems. Furthermore, [19], [21], [22], [24], [25], [27] considered the single-user case, and did not investigate the exigency of the multiple-user scenario. Additionally, except [26], all the works considered the analysis of the systems based on the secrecy metrics such as secrecy outage probability and secrecy capacity but did not analyze the SINR and other key performance metrics (KPIs) related to it at the legitimate user as well as at the eavesdropper. In particular, there are several challenges in analyzing the performance of such networks: • Due to the presence of the RIS channels along with the direct channel, the product and sum of different random variables lead to extremely complex integrations; thus, solving them is a challenging task. • Further, unlike the ideal case wherein the phase difference at the eavesdropper is either ignored or assumed to be constant, the randomness in this phase difference adds an additional challenge in obtaining closedform expressions of KPIs such as outage probability and BLER. Accordingly, due to these challenges, analysis of such networks is not straightforward and involves the use of advanced mathematical methods. Motivated by the aforementioned discussions, through this work, we aim to address these challenges and provide a benchmark mathematical framework on the impact of RIS in secure communication for the case of finite blocklength transmission with more realistic assumptions of randomness in the resultant phase difference at the eavesdropper. In order to highlight the discreteness of the presented study, a brief comparison of this work with the existing literature is provided in Table 1.
In particular, in this paper, we present an RIS-assisted multiple destination communication system in the presence of an eavesdropper. Considering the URLLC demands, we analyze the system for finite blocklength transmissions and compare the same with the conventional infinite blocklength transmissions. The main contributions of this work are summarized as follows: • We analyze the performance of a RIS-assisted secure communication system, where a source communicates with a scheduled legitimate destination out of multiple destinations in presence of an eavesdropper under infinite and finite blocklength codes. Additionally, considering the high fairness, we adopt a random scheduling scheme to select one of the legitimate destinations in a particular time-slot [32]. • Considering Nakagami−m distributed channel envelopes, the PDF and CDF of the random phase difference at the eavesdropper are derived for the first time. Thereafter, the expressions for the outage probability (for infinite blocklength transmission) and BLER (for finite blocklength transmission) are derived at both the receivers, i.e., scheduled legitimate destination and eavesdropper by adopting techniques such as Univariate dimension reduction and Gaussian Chebyshev Quadrature (GCQ) approximation. • In order to provide important insights, the asymptotic analysis for the outage probability at the destination is also derived. Additionally, we discuss the secrecy outage probability, secrecy capacity and secure BLER of the considered system. • Through Monte-Carlo simulations, we validate the accuracy of the derived expressions. Furthermore, in order to demonstrate the superiority of the RIS, we compare its performance with that of conventional decode and forward relay. Finally, we discuss the impact of key parameters such as the number of RIS meta-atoms, reflection coefficient, and transmit signal-to-noise ratio (SNR) threshold. It is shown that proper tuning of the RIS (via passive beamforming) leads to a significant improvement in the secrecy performance at the legitimate user while degrading the performance at the eavesdropper. Structure: The rest of the paper is organised as follows. Section II describes the considered system model while Section III discusses the performance analysis in terms of outage probability, BLER and secrecy outage probability. The results are presented in Section IV and the conclusions are drawn in Section V. Also, the key notations and abbreviations used in this paper are listed in Table 2.

II. SYSTEM MODEL
In this paper, we consider an RIS-assisted communication system as shown in Fig. 1. A source (S) intends to communicate with K destinations (D), one at a time, in presence of an eavesdropper (E). It is desired to transmit the information only to the scheduled D. The S, D and E are half-duplex (HD) nodes, each equipped with one antenna. The signal transmitted by the S can be sensed at D and E. To maintain the secrecy of the information and enable long-distance transmissions between the S and D, the communication is assisted by an RIS with N meta-atoms. The ith meta-atom has a reflection coefficient ζ i e jθ i . The RIS, being tuned towards the scheduled D, leads to beamforming towards the D and energy cancellation at E [17].
Let d Si , d iD k , d SD k , d SE and d iE are the distances between the S and ith atom of RIS, ith atom of RIS and D k , S and D k , S and E and, ith atom of RIS and E, respectively. Further, the fading channels between S and ith atom of RIS, ith atom of RIS and D k , S and D k , S and E and, ith atom of RIS and E be denoted as h Si   respectively. The channels' envelope, |h pq | ((pq) ∈ {(Si), (iD k ), (SD k ), (SE), (iE)}), is assumed to be Nakagami−m distributed with parameters pq and m pq , where the former is the channel power obtained on the basis of distance and path-loss exponent β and latter is the shaping parameter. The Nakagami−m distribution is a generalized model for characterizing the fading channels and has been recently used for the RIS-aided communication systems [13], [14], [33]. Note that it is a generalized distribution which can model different fading environments and can describe both line of sight (LOS) and non-LOS (NLOS) conditions. In addition to this, other fading models such as Rician, Rayleigh, etc., can be approximated as special cases of Nakagami-m for different value of "m" [34]. The PDF and CDF of |h pq | are respectively given as and where (x) = ∞ 0 x t−1 e −x dt is the Gamma function, and γ (m, x) =

A. RECEIVED SIGNAL CHARACTERISTICS AT D K
Let the x(n) be the signal transmitted by S with transmit power P s and E{|x k (n)| 2 } = 1 in the nth time-slot duration. The signal received at D k is a combination of the signal reflected from RIS and that received directly from S and is mathematically given as where θ i is the phase of the ith element of the RIS and w D ∼ N(0, σ 2 D ) is the additive white Gaussian noise (AWGN). The SNR is obtained as where γ s = P s is the transmit SNR. The channel coefficients can be defined as h Si = |h Si |e jθ h Si and h iD k = |h iD k |e where |h Si | and |h iD k | are the magnitude of h Si and h iD k , respectively, and θ h Si and θ h iD k are the phase of h Si and h iD k , respectively. 2 In order to beamform the incident signal towards D k , the phase of the RIS elements should be set in a way that it cancels out the phases induced by channels. Therefore, for optimal reception, the reflection coefficient's phase is tuned as [37]. Therefore, the angle of reflection coefficient for the ith meta-atom is Therefore, for optimal reception, the SNR at D k is given as We set identical reflection coefficients magnitude as ζ i = ζ, ∀i ∈ {1, 2, . . . , N} and |h For sufficiently large values of N, using central limit theorem (CLT), |h SiD k | follows a Gaussian distribution as |h and σ 2 SiD k is given in (9) on the bottom of the page. The PDF and CDF of |h SiD k | are respectively given as [15], [37] 2. Note that h Si and h iD k can be estimated precisely using effective channel estimation methods from the literature [35], [36].
where α SiD k is the normalization factor defined as

B. RECEIVED SIGNAL CHARACTERISTICS AT E
We recall that the signal transmitted by the S in the nth timeslot duration is available for the E to get sensed. The signal received at E is the combination of the reflected signal from RIS and that received directly from S. The signal received at E is given as where The channel coefficients can be defined as h Si = |h Si |e jθ h Si and h iE = |h iE |e jθ h iE . For optimal reception, the RIS is tuned towards the D. This leads to an introduction of a net phase difference in the signal received at the E, leading to a reduction in the signal strength at the E, maintaining the security. The net phase difference θ E i can be obtained as where θ Ei , θ h iE , θ h Si are resultant phase of the signal received from the ith element of RIS to E, phase of h iE and h iE , respectively. Substituting θ i from (5), we have Therefore, the final expression for y E (n) is (15) and the SNR at E is given as Lemma 1: The distribution of the PDF and CDF of θ E i are respectively given as , P and Q are the complexity-accuracy trade-off factors and R P and R Q are the error terms, being neglected for a significantly higher value of P and Q, respectively.
Proof: Please refer Appendix A for the proof. Remark 1: Note that, as evident from the (17) and (18), θ E i is independent of the channel power and depends only on the shape parameters of the channel (m iD and m iE ).

III. PERFORMANCE ANALYSIS
We analyze the performance of the system based on the outage probability and BLER for the infinite and finite blocklength transmissions, respectively at D and E. Furthermore, the secrecy outage probability and secrecy capacity have been discussed for the finite and infinite blocklength transmissions.

A. OUTAGE PROBABILITY AT D K IN THE CASE OF INFINITE BLOCKLENGTH TRANSMISSION
The outage probability at D (P o,D k ) is defined as From (7), where, F Z (z) is From (1) and (11), and substituting exp − we obtain (23) on the bottom of the page. F |h SiD k | (·) includes the Q−function and is present in the integral with a ln(·) term, which makes finding the exact closed-form expression mathematically intractable. Hence, (23) can be further approximated using the GCQ [38, eq. (25.4.30)] as (24) on the bottom of the page, where φ l = cos 2l−1 2L π , z l = ( 1+φ l 2 ), L is the complexity-accuracy trade-off factor and R G is the error term, being neglected for a significantly higher value of L. Therefore, from (20) and (24), the final expression for P o,D is obtained in (25) on the bottom of the page.

1) ASYMPTOTIC ANALYSIS
To perform the asymptotic analysis, we adopt the moment matching method. We can compute the SNR at the kth destination considering the optimal phase-shift and tuning for beamforming at D k as To obtain CDF and PDF of Z, first the mean (μ Z ) and the variance (σ 2 Z ) are obtained as (27) and Var |h Si ||h iD k | , (28) respectively. Furthermore, (27) and (28) are simplified as (29) and (30) on the bottom of the next page, respectively.
The CDF of Z is approximated as where k Z = E{Z} 2 Var{Z} , θ Z = Var{Z} E{Z} , and the outage probability is given by The outage probability can be approximated as [39] For high transmit SNR regions, i.e., γ s → ∞, the first term dominates and the remaining terms can be ignored and thus, we have where are the coding and diversity gain, respectively.
Remark 2: The higher value of transmit SNR (γ s ) provides an excellent outage performance at D k . In particular, as evident from (34)

2) DESTINATION SCHEDULING
The S transmits information to one destination at a time, hence scheduling of the destinations is required. Several scheduling schemes, such as absolute SINR of channel power based (CPB), normalized SINR or CPB, max-min scheduling schemes, etc. can be found in literature [30], [32], [40], [41].
In this work, we are only considering the random scheduling scheme while other schemes can also be considered. In a random scheduling scheme for destination selection, a destination is randomly selected with probability 1/K. The resultant PDF and CDF of the channel and the resultant outage probability for S to D link is

B. OUTAGE PROBABILITY AT EIN THE CASE OF INFINITE BLOCKLENGTH TRANSMISSION:
The outage probability at E (P o,E ) is defined as Lemma 2: The outage probability at E is given by (38) on the bottom of the next page.
Proof: Please refer to Appendix B for the derivation.

C. BLER AT D K AND E IN THE CASE OF FINITE BLOCKLENGTH TRANSMISSION
The analysis in the case of infinite blocklength is mainly designed based on the Shannon formula, which is an idealistic approach. However, in the case of finite blocklength, the errors cannot be reduced to arbitrarily low for a given coding rate due to the limited packet size [42]. Consequently, we adopt the approximated rate in [42] to obtain BLER expressions at each receiver as follows.
Let the overall BLER between S to scheduled D and S to E be SD and SE , respectively. Since, the S intends to transmit to D, hence the channel uses and coding rate depends on the same. Let the S transmit b SD bits over M channels. For μ SD channel uses, the coding rate in bits/channel uses is given as r SD = b SD μ SD . The BLER for S to D and S to E links are respectively given as where 2 are the Shannon channel capacity and channel dispersion, respectively and x ∈ { D , E }. Considering the mathematical intractability to obtain the exact closed-form expressions for BLER, a linear approximation is adopted for The BLER expressions for both links are given as (42) and (43) on the bottom of the next page.
Integrating F D (·) and F E (·) to get the exact closed-form expressions becomes mathematically intractable. Hence, the equations (42) and (43) can be approximated using GCQ [38, eq. (25.4.30)] as where φ g = cos 2g−1 2G π , z = ( ξ −ς 2 )φ g + ( ξ +ς 2 ), G is the complexity-accuracy trade-off factor and R G is the error term, which can be neglected for high values of G. 3 Remark 3: Note that the improvement of latency and reliability is directly proportional to the reduction of message size and thus BLER of the considered system [44]. Using (44) and (45), the latency and reliability of the considered system can be obtained as 3. To analyze the effect of complexity accuracy trade-off factor, we plot the error, defined as |analytical value − simulation value|, for the outage probabilities of D k and E as a function of the complexity accuracy tradeoff factor as in Fig. 2. The error in both cases reduces with an increase in the value of complexity-accuracy trade-off factor and saturates to a value < 10 −3 around 2000, which is sufficiently low. and respectively, where i ∈ {SD, SE} and T is the time required by each channel use.

D. SECRECY CAPACITY AND SECRECY OUTAGE PROBABILITY 1) INFINITE BLOCKLENGTH TRANSMISSIONS
For infinite blocklength communications, the maximum secrecy rate is given as and the average secrecy capacity is given by where f D (x) and f E (y) are the PDFs of D and E , respectively. The corresponding secrecy outage probability P sec,o for a threshold rate of R is given as Therefore, we get

2) FINITE BLOCKLENGTH TRANSMISSIONS
The equations (48) and (50) are valid for infinite blocklength communications and do not hold true for finite blocklength communications, and hence URLLC [45], [46]. The lower bound on the maximum secrecy rate is given as [47] where ε and δ are the target bit error rate at D and secrecy constraint on information leakage, respectively and Q −1 is the inverse Q−function. The average secrecy capacity is given by Obtaining closed form expressions of (49) and (53) is mathematically intractable, hence we solve them numerically to obtain the results. The corresponding secrecy outage probability for R threshold rate is approximated as such that Deriving the exact closed-form expressions for X and Y, requires the respective distributions of Z X1 , Z X1 , Z Y1 and Z Y2 , which makes the derivation mathematically intractable and hence is considered as an aspect to be addressed as a future scope.

E. SECURE BLOCK ERROR RATE
From (52) the error in securely decoding the signal at D for the information leakage level of δ is given as Therefore, similar to [31], [48], [49], the average secure BLER is given as (59) on the bottom of the page.

IV. SIMULATION RESULTS
To validate the correctness of the derived expressions and analyze the effect of various parameters on system performance, we use Monte Carlo (MC) simulations. The parameters are set similar to those in [50], [51]. The distances d Si = 90 m, d iD = 5 m, d SD = 85 m, d SE = 80 m, and d iE = 30 m. As in [51], the channel power is distance dependent and is set as pq = d −β pq , where β = 4 is the path-loss exponent. The shape parameters (m pq , (pq) ∈ {(Si), (iD k ), (iE), (SE)(SD k )}) are set to 1. The γ s is set to 60 dB, reflection coefficient ζ = 1, γ th = −15 dB and the value of N is varied throughout the simulations.

A. PDF AND CDF OF θ E I
The expression for the PDF and CDF of the difference of phases for channels with Nakagami−m envelope are derived in this paper. Initially, we analyze the effect of shape parameters on the PDF and CDF in Fig. 3. It can be observed from the (17) and (18) that θ E i is independent of the channel power and depends only on the shape parameters. From the figure, we observed that both PDF and CDF have oscillations which tend to increase with the increase in the values of m iD and m iE . Furthermore, as seen in Fig. 3(a), the local points of local maxima and minima points are the same. Furthermore, the PDF shows even symmetry. It should be noted that no oscillations are observed for m iE = m iD = 1. The involvement of m iE and m iD k can be observed in I(a, b) and K 12 . Increase in m iE = m iD k increases the exponent of the | sin(2z)| and | sin(2z + 2θ )|, thereby increasing the oscillations. K 12 is an increasing function of m iE = m iD k , and hence the peak value of PDF increases with an increase in m iE = m iD k . Hence, as observed in Fig. 3(a), for lower values of m iE = m iD k , the oscillations observed are lower, as well as, the peak value of PDF is also low.

B. PERFORMANCE ANALYSIS AND EFFECTS OF PARAMETERS
Further, we analyze the effect of various parameters such as the number of RIS atoms, reflection coefficient, threshold, etc. on the system performance.

1) EFFECT OF THE THRESHOLD AND NUMBER OF RIS ATOMS
Initially, we consider the effect of threshold (γ th ) in Fig. 4, where the outage probabilities at D and E are plotted as a function of γ th for different value of the number of RIS metaatoms (N). It is observed that for both, D and E, the outage probability increases with γ th . Furthermore, we observe that, for D, the outage probability decreases with an increase in N for lower values of γ th . For the case of E, opposite trends were observed wherein with an increase in N, the outage probability showed a negligible increase. This is due to the fact that, with increasing N, the signal incident on the RIS is beamformed towards D more accurately, and the leaked signal towards the E reduces.

2) EFFECT OF MAGNITUDE OF REFLECTION COEFFICIENT
The effect of the magnitude of the reflection coefficient (ζ ) is observed in Fig. 5. The outage probabilities for both E and D as a function of ζ are plotted for different values of N. For D, we observe that, with an increase in ζ , the outage probability significantly decreases. Whereas, for E, a slight increase in the outage probability is observed with an increase in ζ . Similar to Fig. 4, decrease in outage probability and a slight increase in outage probability was observed with an increase in N at D and E, respectively. Similar to the increase in N, an increase in ζ also improves the strength of the beamformed signal at D. The increase in outage probability at E is marginal and the outage probability is not unity. The slight decrease in outage probability at E is due to the presence of the direct path as well as the leaked signal from the RIS. With increase in N, the leaked signal reduces, but the direct path signal still persists leading to a marginal increase in outage probability.

3) EFFECT OF TRANSMIT SNR
Furthermore, the outage probability as a function of transmit SNR (γ s ) for D and E are observed in Fig. 6. A decrease in outage probability is observed for D and E with an increase in γ s . With an increase in N, a lower value of γ s is required to obtain the same outage probability. Furthermore, with increased N, the outage probability at lower γ s decreases for D, but the outage probability at E does not show a tremendous decrease till γ s = 55 dB, and remains near to one, improving the secrecy of the system. For example, for N = 500, the outage probability at γ s ≈ 41 dB is 10 −6 and 1 for D and E, respectively, assuring secrecy of the information transmitted by the S.
Summarizing, it can be observed from Fig. 4, Fig. 5 and Fig. 6 that some part of the signal is available at E for being sense due to the presence of the direct link between S and E and some reflections from RIS. With an increase in the number of RIS atoms (N), the performance at D significantly improves. The outage probability at E was observed to be approximately constant, with a slight or marginal increase, with an increase in N. This is because the RIS, being tuned to D, beamforms the incident signal towards D. This leads to improvement in the performance at D, whereas degradation of the performance at E. Hence, the RIS is capable of maintaining the secrecy of the communication system.

4) EFFECT OF THE NUMBER OF RIS ATOMS, CHANNEL USES AND BITS
The effect of RIS atoms on the BLER at D and E was analyzed in Fig. 7, where BLER as a function of N for different values of μ SD and b SD . It is observed that, with an increase in N, the BLER at D reduces significantly. Whereas the BLER at E remains approximately constant, with a slight increase with the increase in N. Moreover, μ SD and b SD have similar effects on BLER at D and E. For example, for a constant value of b SD , BLER reduces for a high value of μ SD , whereas for a constant value of μ SD , it increases with increase in b SD . However, the change in BLER due to μ SD and b SD is minute at E when compared to that at D. The BLER reduces for higher μ SD , with constant b SD and lower  b SD with constant μ SD . In both of these cases, the target rate b SD /μ SD reduces, thereby reducing the overall BLER.

5) ASYMPTOTIC ANALYSIS
The asymptotic analysis for the outage probability at D is performed in Fig. 8. The outage probability is plotted as a function of γ s for different values of N and γ th . Concordant with the results shown in Fig. 4, Fig. 5 and Fig. 6, the outage probability decreases with an increase in N and γ th . The asymptotic results trace the Monte Carlo simulation and analytical plots in the high SNR region.

6) SECRECY CAPACITY
The average secrecy capacity as a function of the magnitude of reflection coefficient (ζ ) for different values of the number of RIS elements for both, finite and infinite blocklength, transmission regimes are presented in Fig. 9. The secrecy capacity increases with the increase in the ζ and N. It can be seen that the high value of ζ and N ensures better beamforming towards the scheduled D, thereby increasing the strength at D and significantly reducing the same at E making it undetectable at E, hence increasing the secrecy capacity. We observe that the secrecy capacity for the finite blocklength is lower compared to that for the infinite blocklength transmissions. This is due to the fact that the finite blocklength transmission of length M increases the value ln (2) , thereby reducing the entire secrecy capacity.

7) SECRECY OUTAGE PROBABILITY
Further, the simulation results for the secrecy outage probability as a function of N for infinite blocklength transmissions is analyzed in Fig. 10. P sec,o is reduced with an increase in N and a decrease in threshold R. A similar observation was made for the case of URLLC, i.e., finite blocklength transmissions, in Fig. 11. To obtain the results, we set ε = 10 −7 and δ = 10 −5 . It can be observed that the secrecy outage probability increases for URLLC as compared to the infinite blocklength case. It should be noted that the term ln (2) in (54) is a positive term majorly governed by M, i.e., blocklength, and target errors ε and δ, and is subtracted from the rate of the non-URLLC case. The consideration of finite blocklength of dimension M is responsible for the increase in the secrecy outage probability, compared to that for the non-URLLC or infinite blocklength case.

8) SECURE BLOCK ERROR RATE
To gain further insights regarding the secure finite blocklength transmissions, we plot the secure BLER as a function of blocklength (M) for different values of leakage error δ and number of RIS elements N in Fig. 12. We observe that with an increase in blocklength, the secure BLER reduces. A drastic reduction is observed when the number of RIS elements is increased from N = 150 to N = 200. The secure BLER increases with a reduction in δ. This is due to the fact that lower δ enables better detection of the information at the eavesdropper, thereby reducing the secrecy.

9) EFFECT OF PHASE-QUANTIZATION
To gain insights regarding the quantized phase shifts, we plot the Monte-Carlo simulation results for the outage probability at D and E for different values of the number of bits (b) in Fig. 13. Due to hardware limitations, the controllers cannot generate any phase in [0, 2π) to compensate for the phases introduced by the random channels. Instead, the phases are generated in a quantized manner with 2 b levels represented by b bits. This introduces a phase quantization error in the SNR at D k as D k = γ s |h SD + N i=1 h Si h iD ζ e j θ i | 2 , where θ i = θ i + θ h Si + θ h iD and is uniformly distributed as θ i ∼ U(−2 −b π, 2 −b , π). Similarly, the phase term in the SNR of E will have an additional θ i term as where, the term θ Ei = θ h iE − θ h iD k arising due to the tuning of RIS towards D k , leading to a phase mismatch at E. It is observed that, with an increase in the number of bits, the quantization error reduces, thereby reducing the outage probability at D. An opposite trend is seen in E as with the increase in b, accurate phase compensation is achieved, increasing the signal strength of the signal received at D and reducing the strength of the leaked signal at E.

10) COMPARISON WITH DECODE AND FORWARD RELAY-BASED SYSTEMS
Fig. 14 compares the performance of the proposed scheme with the decode and forward relay system in presence of a direct path. The outage probability for infinite blocklength transmissions and the BLER for the finite blocklength transmissions are plotted as a function of transmit SNR (γ s ). It is observed that, for the case of RIS, the outage probability and BLER are significantly low (in order of 10 −5 and 10 −6 ). Whereas for the relay-based system, the outage and BLER at D are around 0.86, which is significantly high. At E, the outage and BLER are around 0.75 and 0.85 for the RIS-based and relay-based systems, respectively. The inclusion of RIS provides beamforming towards the D for both finite and infinite blocklength cases, degrading the outage probability and BLER at E and improving at D, thereby improving the secrecy of the system. Whereas, in the case of relay-based systems, the outage and BLER at D and E are approximately the same as well as high, leading to the outage of the overall system, as well as poor secrecy.

V. CONCLUSION
In this paper, the performance of an RIS-assisted communication system consisting of a source (S) that communicates with one of the multiple-legitimate destinations (D), selected using random scheduling, in presence of an eavesdropper (E) was considered under infinite and finite blocklength codes. The expressions of the outage probabilities, BLER, and secrecy capacity were derived. The expressions for the PDF and CDF of difference in phases of two channels with Nakagami−m envelope were also derived and validated. It was observed that the PDF and CDF were dependent only on the shape parameter and were independent of the channel power. Further, the effects of various system parameters such as transmit SNR, threshold, the magnitude of reflection coefficient, quantized phase shifts and number of RIS atoms on the system performance were analyzed. In particular, it was noted that the outage probability increased with an increase in threshold whereas decreased with an increase in the transmit SNR for both D and E. Additionally, the outage probability was found to decrease for D and marginally increase for E with the increase in the reflection coefficient and the number of RIS atoms. The BLER and secrecy outage probability decreased with an increase in the number of RIS atoms. We also compared the proposed system with the decode and forward relay systems. It was established that with the introduction of the RIS in such networks, we can maintain the secrecy of the system by improving the performance at D while degrading the same at E. Further, the extension of the presented analysis considering multiple eavesdroppers will be an interesting future research direction.

APPENDIX A PROOF OF PDF AND CDF OF θ E
θ E i is the difference of two RVs and the PDF is given as [52] where ' * ' is the convolution operation and assuming symmetric nature of the f θ h iE (θ ) and f θ h iD k (θ ). For Nakagami−m distributed envelope, the PDF of θ h iE and θ h iD k are respectively given as [53] where (pq) ∈ {iE, iD k }. The result of the convolution ranges from θ ∈ [−2π, 2π) and considering the nature of f θ hpq (θ ), the convolution can be calculated based on four cases on θ as: 1) θ ≤ −2π where there is no overlap and the convolution integral results in a value 0; 2) −2π ≤ θ ≤ 0 there is an overlap from −π to θ +π ; 3) 0 ≤ θ < 2π there is an overlap from θ − π to π ; 4) θ ≥ 2π where there is no overlap and the convolution integral results in a value 0. Applying these conditions on (60), the PDF of θ E i is given as in (17), where and I(a, b) is defined as The (63) can be further approximated using the GCQ as [38, eq. (25.4.30)] , G is the complexity-accuracy trade-off factor and R G is the error term, being neglected for a significantly higher value of G. Furthermore, the CDF of θ E is given in (18). This completes the proof.

APPENDIX B OUTAGE PROBABILITY AT E (P O,E )
From (16), the SNR at E can be further simplified as Let the vectors X, C and S be defined as E can be re-written is terms of the vectors X, C and S as The outage probability for a given threshold γ th is defined as Note that, E is sum of squares of two terms, ( √ γ s |h SE |+ C T X) and (S T X), and C T X and S T X are sum of products of large number of RVs. To the best of our knowledge, the expression for the PDF and CDF of these terms is not available in the literature. Furthermore, solving (70) directly becomes mathematically intractable. The outage probability for a given value of E = θ E and X = x, where where u(·) is the Heaviside function. The final outage probability is calculated as average of P o,E (γ th | E = θ E , X = x) with respect to all the elements of x and θ E . Therefore, the outage probability expression is obtained as (72) on the bottom of the page, where f θ E i (·) can be obtained from (17) and is obtained from the CDF and PDF of the |h Si ||h iE |. Let s i = |h Si ||h iE |, therefore the CDF is given as Therefore, the PDF is obtained as Substituting f |h Si | (·) and f |h iE | (·) from (1) and exp − m Si Si y 2 = t the expression in integral form for f s i (s) can be obtained. Furthermore, we have x i = √ γ s s i , therefore the PDF of x i is obtained with the help of the whose closed-form expression is difficult to obtain and can be approximated using GCQ as [38, eq. (25.4.30)] where φ g 1 = cos 2g 1 −1 2G 1 π , z g 1 = ( , G 1 is the complexity-accuracy trade-off factor and R G 1 is the error term, being neglected for a significantly higher value of G 1 . The (72) consists of 2N integrals and it is difficult to obtain an exact expression for the same. The outage probability at E is derived using the univariate dimension reduction method and utilizing the derived PDF expression of phasedifference [54]. The univariate dimension reduction is used as calculating the 2N integrals for marginalizing the conditional outage probability is mathematically intractable. The univariate dimension reduction method reduces the number of integrals to 2, making the entire derivation mathematically tractable. Considering this fact, (72) is approximated using the univariate dimension reduction method [54].
From [54, eq. (20)], the outage probability can be approximated as where such that the respective means are obtained as and E{θ E j−N } = 0. Considering the RIS elements independent and identically distributed (IID), μ x j = μ, ∀j ∈ {N + 1, . . . , 2N}. Based on the means, the value of g(μ 1 , μ 2 , . . . μ j−1 , z j , μ j+1 , . . . , μ 2N ) is obtained as (81), which is given on the bottom of the page. Further Substituting (81), (82) in (78) and considering the x j and θ E i IID, we have P o,E (γ th ) = NI 1 + NI 2 − (2N − 1)g(μ 1 , μ 2 , . . . , μ 2N ) where I 1 and I 2 are respectively and In order to obtain the final expression of the outage probability, the expressions for I 1 and I 2 need to be known. We begin we deriving the expression for I 1 . From (84), I 1 can be further simplified as Considering f x i (x) from (76) and substituting exp − m Si m iE x 2 γ s Si iE ln 1/z g 1 = y, we have Obtaining the exact expression for the integral becomes difficult. Hence, the above equation can be further approximated using GCQ as [38, eq. (25.4.30)] where φ p 1 = cos 2p 1 −1 2P 1 π , z p 1 = ( 1+φ p 1 2 ), P 1 is the complexity-accuracy trade-off factor and R P 1 is the error term, being neglected for a significantly higher value of P 1 and (81) Further, we consider I 2 . From (85) and (17), I 2 can be written as (90) on the top of the page. Further, (90) can be approximated as (91), which is given on the top of the page, where φ g 2 = cos 2g 2 −1 2G 2 π , φ p 2 = cos 2p 2 −1 2P 2 π , z g 2 = π(φ g 2 − 1), z p 2 = π(φ p 2 + 1), G 2 and P 2 are the complexity-accuracy trade-off factors and R G 2 and R P 2 are the error terms, being neglected for a significantly higher value of G 2 and P 2 , respectively. The final outage probability is obtained as in (38) by substituting (88) and (91) in (83). This completes the proof.