Max-ratio relay selection in secure buffer-aided cooperative wireless networks

—This paper considers the security of transmission in buffer-aided decode-and-forward cooperative wireless networks. An eavesdropper which can intercept the data transmission from both the source and relay nodes is considered to threaten the security of transmission. Finite size data buffers are assumed to be available at every relay in order to avoid having to select concurrently the best source-to-relay and relay-to-destination links. A new max-ratio relay selection policy is proposed to optimize the secrecy transmission by considering all the possible source-to-relay and relay-to-destination links and selecting the relay having the link which maximizes the signal to eavesdropper channel gain ratio. Two cases are considered in terms of knowledge of the eavesdropper channel strengths: exact and average gains, respectively. Closed-form expressions for the secrecy outage probability for both cases are obtained, which are veriﬁed by simulations. The proposed max-ratio relay selection scheme is shown to outperform one based on a max-min-ratio relay scheme.

Max-Ratio Relay Selection in Secure Buffer-Aided Cooperative Wireless Networks Gaojie Chen, Member, IEEE, Zhao Tian, Student Member, IEEE, Yu Gong, Member, IEEE, Zhi Chen, Member, IEEE, and Jonathon A. Chambers, Fellow, IEEE Abstract-This paper considers the security of transmission in buffer-aided decode-and-forward cooperative wireless networks.An eavesdropper which can intercept the data transmission from both the source and relay nodes is considered to threaten the security of transmission.Finite size data buffers are assumed to be available at every relay in order to avoid having to select concurrently the best source-to-relay and relay-to-destination links.A new max-ratio relay selection policy is proposed to optimize the secrecy transmission by considering all the possible source-to-relay and relay-to-destination links and selecting the relay having the link which maximizes the signal to eavesdropper channel gain ratio.Two cases are considered in terms of knowledge of the eavesdropper channel strengths: exact and average gains, respectively.Closed-form expressions for the secrecy outage probability for both cases are obtained, which are verified by simulations.The proposed max-ratio relay selection scheme is shown to outperform one based on a max-min-ratio relay scheme.Index Terms-Secure wireless communications, cooperative networks, relay selection, secrecy capacity.

I. INTRODUCTION
T RADITIONALLY security in wireless networks has been focused on higher layers using cryptographic methods [1].However, retaining security at high layers is becoming more challenging due to the increased potential for attack, therefore, there has been growing interest in implementing security at the physical layer.Related work was described as early as in the 1970s [2]- [5], and more recently for physical layer security in wireless communications [6]- [10].The purpose of physical layer security is to prevent eavesdroppers from intercepting the data transmitted between the source and intended destination.The secrecy is quantified by the secrecy capacity, or the maximum rate of reliable information sent from the source to the intended destination in the presence of eavesdroppers [5].
Recent research shows that cooperative communication not only significantly improves the transmission capacity for wireless networks (e.g.[11] and [12]), but also provides an effective way to improve the secrecy capacity.This is achieved by carefully designing the relays to maximize the information rate at the intended destination and minimize that at the eavesdroppers [13].In general, there are three ways to improve the secrecy capacity in a cooperative network: • Distributed beamforming -The secrecy capacity can be maximized by optimizing the transmission weights (or the beamforming weights) at the relay and source nodes (e.g.[14] and [15]).Such distributed beamforming however requires high coordination (such as synchronization and central optimization) among source and relay nodes, which usually requires high overhead in implementation, i.e. a large amount of information needs to be exchanged between the relay nodes.• Jamming -A jammer is used to inject artificial interference into the system.When the injected interfering power is higher at the eavesdroppers than that at the intended destination, the secrecy capacity can be improved (e.g.[16]- [18]).This often requires the jammer to be located closer to the eavesdroppers than to the destination node, which is not always possible in practice.• Relay selection -Relay selection can increase the secrecy capacity by choosing an appropriate relay node with "strong" transmission link to the intended destination node and "weak" link to the eavesdropper [19]- [22].The relay selection provides an attractive way to improve the secrecy capacity with little overhead in implementation.
The performance of the relay selection depends strongly on the number of available links for selection, which again depends on not only the number of relays but also the relay selection scheme.When the number of available links is limited, so is the secrecy performance.Thus it is important to investigate relay selection schemes to have the best secrecy performance for a given number of relays, which is the main objective of this paper.
In traditional relay selection to improve wireless communications, the best relay is selected with the strongest link connecting the source and destination (e.g.[23] and [24]).It is shown in [19] that by using relay selection the secrecy capacity can also be improved when the best relay is selected to maximize the signal to eavesdropper channel gain ratio, which is abbreviated as the "gain ratio" in this paper.The relay selection scheme in [19] is based on the scenario that the eavesdropper can only intercept the signals from the relays but not the source node.On the other hand, if the eavesdropper intercepts signals from both the relay and source nodes, the best relay is selected as having the maximum secrecy capacity among every pair of source-to-relay and relay-to-destination links [18], which is termed as the max-min-ratio scheme in this paper.Alternatively, it is also possible to select a jammer from the available relays (e.g [20]), but this is at the price of injecting more inference not only to the intended receivers but also to other users in the system.As was shown in [20], including a jammer does not necessarily lead to improvement in secrecy capacity, and thus a switching scheme was described to activate/deactivate the jammer.
Recent research shows that, by introducing data buffers at the relays, it is possible to relax the constraint that the best source-to-relay and relay-to-destination links for a packet transmission must be determined concurrently, and achieve significant performance advantage [25]- [30].A typical bufferaided relay selection is the max-max scheme described in [27], where the strongest source-to-relay and relay-to-destination links are selected alternatively so that it has significant coding gain over the traditional max-min scheme.Because the maxmax relay selection still follows the traditional transmission order, that is the source-to-relay and relay-to-destination transmissions always carry on in an alternative manner, it can only attain a diversity order of N which is the same as that for the max-min scheme, where N is the number of available relay nodes.In the recent max-link approach [25], this constraint on the transmission order is further relaxed so that, at any time, a best link is selected among all available source-to-relay and relay-to-destination links.Depending on whether a source-torelay or a relay-to-destination link is selected, either the source transmits a packet to the selected relay or the selected relay forwards a stored packet to the destination.It is shown in [25] that the max-link relay selection not only has coding gain over the max-min scheme, but also has higher diversity order than both the max-min and max-max schemes.In particular, the diversity order can approach 2N when the relay buffer size is large enough.
Inspired by the max-link scheme, in this paper, we propose a novel max-ratio relay selection scheme for secure transmission in decode-and-forward (DF) relay networks with an eavesdropper which can intercept signals from both the source and relay nodes.In the proposed max-ratio scheme, every relay is equipped with a data buffer, and the best link is always selected with the highest gain ratio among all available sourceto-relay and relay-to-destination links.We consider two cases for which either the exact, or the average gain, for the eavesdropping channel is available; the latter case is of particular interest in practice since it is not always possible to obtain the exact channel information describing the eavesdropping channels.Both theoretical and simulation results show that the proposed max-ratio relay selection has significantly better performance than the conventional max-min-ratio scheme, confirming that it represents an attractive approach for secure wireless transmission.The main contributions of this paper are summarized as follows to: • Propose the buffer-aided max-ratio relay selection policy for secure communications in a DF cooperative network.This is the first approach in using buffer-aided relay selection in secure transmission under the scenario that the eavesdropper can intercept signals from both the source and relay nodes.Existing relay selection schemes for secure transmission mainly assume no source-toeavesdropper link for simplicity (e.g.[19]).While in [22] both the source and relay to eavesdropper links are considered, the proposed scheme is for the two-way relay network and furthermore no closed form expression is obtained for the secrecy outage probability.• Derive closed-form expressions for the secrecy outage probability of the max-ratio scheme for both cases when either the exact, or average, gains of the eavesdropping channels are available.Because the gain-ratios for the source-to-relay and relay-to-destination transmissions have different statistical distributions, the secrecy outage performance of the proposed max-ratio scheme is much more involved to analyze than existing approaches such as the relay selection scheme for secure transmission in [19] and the buffer-aided max-link scheme for wireless communications in [25].In this paper, the problem arising from such "unbalanced" distribution has been successfully solved, and the analysis also provides a useful way in analyzing similar systems such as a typical relay selection scheme but without the usual assumption that the source-to-relay and relay-to-destination channels are independent and identically distributed (i.i.d.).The remainder of the paper is organized as follows: Section II describes the system model; Section III proposes the max-ratio relay selection scheme; Sections IV and V analyze the secrecy outage probability for the cases with exact and average knowledge of the eavesdropping channels, respectively; Section VI discusses the performance of the max-ratio scheme when the relay buffer sizes go to infinity; Section VII gives numerical simulations to verify the proposed max-ratio scheme; finally, Section VIII summarizes the paper.

II. SYSTEM MODEL
The system model of the relay network with an eavesdropper is shown in Fig. 1, where there is one source node (S), one destination node (D), a set of K relays {R 1 , R 2 , . . ., R K }, and one eavesdropper (E) which can intercept signals from both the source and relay nodes.The relay nodes apply the DF protocol and perform the half-duplex mode so that they do not transmit and receive simultaneously.
In our model, we assume no direct link between the source and the destination due to path loss or shadowing effects. 1he channel coefficients for and h r k e (t) respectively, where similar subscripts are also used for other parameters to indicate different channels in this paper.We assume the channels are quasi-static Rayleigh fading so that the channel coefficients remain unchanged during one packet duration but independently vary from one packet time to another.We also assume that all source-torelay links are independent and identically distributed (i.i.d.) fading and that E|h sr k (t)|2 = γ sr for all k; all relay-todestination channel gains are also i.i.d. and E|h r k d (t)| 2 = γ rd , as are all relay-to-eavesdropper channel gains for which E|h r k e (t)| 2 = γ re .The source-to-eavesdropper channel gain is denoted as E|h se (t)| 2 = γ se .It is noted that we do not require any two of γ sr , γ rd , γ se and γ re to be the same, thereby representing a "practical" scenario.All noises are additive white Gaussian noise (AWGN), and without losing generality the noise variances are all normalized to unity.The transmission powers for source and relay nodes are all assumed to be E s .
With the DF applied at the relays, if the relay R k is selected for the data transmission, the instantaneous secrecy capacity for the overall system is obtained as [31] C If the exact knowledge of the eavesdropping channels are available, the best relay node can be selected with the maximum C k (t).On the other hand, if only the average gains of the eavesdropping channels are known, the best relay maximizes C k (t) with |h se (t)| 2 and |h r k e (t)| 2 being replaced with the average gains γ se and γ re in (1) respectively.This scheme is termed as the max-min-ratio relay selection in this paper.
For convenience in development, the time index t is ignored in the rest of the paper unless necessary.

III. MAX-RATIO RELAY SELECTION
The performance of the max-min-ratio scheme is limited by the constraint that the best source-to-relay and relay-todestination links must be determined concurrently.In this paper, we propose a new max-ratio selection scheme by making use of data buffers at the relays.To be specific, we assume that every relay is equipped with a data buffer Q k (1 ≤ k ≤ K ) of finite size L (in the number of data packets), and the data packets in the buffer follow the "first-in-first-out"rule.
At any time, the best transmission link with the highest gain-ratio is selected among all available source-to-relay and relay-to-destination links.Depending on the knowledge of the eavesdropper channel, we have two selection criteria: Case 1 -If the exact knowledge of all channels, 2 including the eavesdropping channels h se and h r k e , are available, the max-ratio selects the best relay as where gives the number of data packets in buffer Q k .
Case 2 -If only the average channel gains for the eavesdropping channels, i.e. γ se and γ re , are available (but the exact knowledge for all other channels is known), the best relay for the max-ratio scheme is selected as:

A. Secrecy Outage Probability
The secrecy outage probability is defined as P out = P(C < r sc ), where C is the instantaneous secrecy capacity, r sc is the target secrecy capacity and P(.) gives the probability of the enclosed.In the max-ratio relay selection scheme, at any time, the numbers of data packets in every buffer form a "state".Because there are K available relays and every relay is equipped with a buffer of size L, there are (L + 1) K states in total.The l-th state vector is defined as where l (Q k ) gives the number of data packets in buffer Every state corresponds to one pair of (K 1 , K 2 ), where K 1 and K 2 are the numbers of available links for source-to-relay and relayto-destination transmission, respectively.A source-to-relay or a relay-to-destination link is considered available when the buffer of the corresponding relay node is not full or not empty respectively.It is clear that 0 ≤ K 1 ≤ K and 0 ≤ K 2 ≤ K .Specifically, if none of the buffers is full or empty, all links are available such that At state s l , the best link is selected among all K 1 source-torelay and K 2 relay-to-destination links.We denote p s l out as the outage probability for state s l .Considering all possible states, we obtain the secrecy outage probability for the max-ratio relay selection as where π l = p(s l ) which is the stationary probability for state s l .

B. State Transition Matrix
Suppose at time t, the state for the relay buffers is s l .At time (t + 1), there is one relay selected for either receiving or transmitting a data packet, so that the number of packets in the corresponding buffer is increased or decreased by one respectively.Depending on which relay receives or transmits data, at time (t + 1), the buffers may move from state s l to several possible states, forming a Markov chain.We denote A as the (L + 1) K × (L + 1) K state transition matrix, where the entry A n,l = P(X t +1 = s n |X t = s l ) is the transition probability that the state moves from s l at time t to s n at time (t + 1).
If the secrecy outage event occurs, the state s l remain unchanged at time (t + 1).Otherwise, s l moves to another state.Thus the probability for s l to leave for another state is given by It is clear from the selection rules ( 2) and (3) that, for both Cases 1 and 2, the probabilities to select the source-to-relay and relay-to-destination transmission at any time are not the same.This is very different from the max-link approach in [25] where the selection of any available link is equally likely.We divide all states which can be moved from s l into two sets, U + l and U − l , where U + l contains all states to which s l can move when a source-to-relay link is selected and U − l contains all states to which s l can move when a relay-to-destination link is selected.We let p S→D s l and p R→D s l be the probabilities that the source-to-relay and relay-to-destination transmissions are selected at state s l , respectively.It is clear that p S→D s l On the other hand, because we assume all source-to-relay channels are i.i.d.fading and all relay-to-destination channels are also i.i.d.frequency flat fading and so are the relay-toeavesdropper channels, the selection of one particular link within either U + l or U − l is equally likely.Therefore, the probability to select a source-to-relay or relay-to-destination link at state s l is given by ), respectively.With these observations, the (n, l)-th entry of the state transition matrix A is expressed as Because the transition matrix A in ( 8) is column stochastic, irreducible and aperiodic,3 the stationary state probability vector is obtained as (see [35] and [36]) π = (A − I + B) −1 b, (9) where π = [π 1 , • • • , π (L+1) K ] T , b = (1, 1, . . ., 1) T , I is the identity matrix and B n,l is an n × l all one matrix.
Finally, substituting ( 8) and ( 9) into (5) re-formats the secrecy outage probability as where diag(A) is a vector consisting of all diagonal elements of A.
It is clear from (10) that the secrecy outage probability P out is determined by A which again, from (8), is determined by p s l out and p R→D s l .The secrecy outage probabilities for both Cases 1 and 2 can be expressed as (10), but with different p s l out and p R→D s l which are derived below.

IV. CASE 1 -EXACT KNOWLEDGE OF EAVESDROPPING CHANNELS
In Case 1, we assume exact knowledge for the instantaneous gains for all channels, including the eavesdropping channels.This is a typical assumption in many existing approaches (e.g.[20] and [21]).

A. p s l out : Outage Probability at State s l for Case 1
The relay selection rule for Case 1 is shown in (2).For better exposition, we let x = max and z = max(x, y).In order to concentrate on the secrecy capacity, we assume the channel SNR is high enough so that the decoding is always successfully at the relay and destination nodes. 4The probability of outage event at state s l at the high SNR is given by where F Z (z) is the cumulative-probability-function (CDF) of z which is derived below.Recall that state s l corresponds to (K 1 , K 2 ).From the theory of order statistics [37], if the number of available source-torelay links is K 1 , the CDF of x 1 = max Noting that x = x 1 /|h se | 2 , the CDF of x is then obtained as where which is the binomial coefficient, and M 1 = γ sr /γ se which is the average gain ratio between the source-to-relay and source-to-eavesdropper channels.
On the other hand, because the number of available relayto-destination links is K 2 , the CDF of y is given by where M 2 = γ rd /γ re which is the average gain ratio between the relay-to-destination and relay-to-eavesdropper channels.Because x and y are mutually independent, from ( 13) and ( 14), the CDF of z = max(x, y) is obtained as: Substituting ( 15) into (11) gives The next subsection will provide the probability of selecting the relay to destination transmission at state s l .

B. p R→D s l : Probability of Selecting the Relay-to-Destination Transmission at State s l for Case 1
If there are no relay-to-destination links available (or K 2 = 0), we have p R→D s l = 0. On the other hand, if there are no source-to-relay links available (or K 1 = 0), we have p R→D s l = 1.For other cases, p R→D s l is obtained in Appendix I.In summary, we have obtained p R→D s l (17), as shown at the bottom of the page, where B(x, y) = 1 0 t x−1 (1 − t) y−1 dt which is the Beta function and F 2,1 (a, b, c, z) is the first hypergeometric function.Finally, substituting ( 16) and ( 17) into (10) gives the secrecy outage probability at the high SNR for Case 1.

V. CASE 2 -KNOWLEDGE OF THE AVERAGE CHANNEL GAINS FOR EAVESDROPPING CHANNELS
In case 2, we only have knowledge of the average gains for eavesdropping channels, while the exact information for all other channels are still available.

A. p s l
out : Outage Probability at State s l for Case 2 We let u ab = |h ab | 2 /γ ab be the normalized gain for channel h ab , where {ab} ∈ {sr k , se, r k d, r k e}.Because of the normalization, all u ab have the same probability-densitydistribution (PDF) as The selection rule in (3) can then be expressed as where M 1 and M 2 are defined in ( 13) and ( 14), respectively.We further let f = max directly obtained from the selection rule (3) which is based on the average gain of the eavesdropping channels.On the other hand, the secrecy outage is determined by the instantaneous gains of the data and eavesdropping channels.Therefore, in order to obtain the outage probability, w needs to be divided by u which is normalized exponentially distributed with PDF given by (18).Or the outage probability for state s l for Case 2 is given by where v = w/u.The CDF-s of f and g are given by respectively.Because f and g are mutually independent, the CDF of w = max{ f, g} is obtained as Then the CDF of v = w/u is Substituting ( 23) into (11) gives The next subsection will provide the probability of selecting the relay to destination transmission at state s l .

B. p R→D
where f F G ( f, g) is the joint PDF of f and g.From ( 21), the PDFs of f and g are obtained as respectively.Because f and g are mutually independent, we have Substituting ( 26) into ( 25) gives (27), as shown at the bottom of the page.Therefore, we have p R→D s l in (28), as shown at the bottom of the page.Finally, substituting ( 24) and (28), into (10) gives the secrecy outage probability at high SNR for Case 2.

VI. DISCUSSION
In this section, we consider a specific scenario that the average gain ratios for the source-to-relay and relay-to-destination transmissions are the same, or M 1 = M 2 .Of particular interest is the outage performance for L → ∞ which shows the best potential performance for the max-ratio scheme.
First we consider Case 2. Because M 1 = M 2 , the probabilities to select a source-to-relay and relay-to-destination link are the same, and both equal 1/(K 1 + K 2 ).This is similar to the max-link scheme in [25].Thus building upon the analysis in [25], we can obtain that, if L → ∞, the stationary probability for any state corresponding to K 1 = K or K 2 = K must be 0, or we have This implies that, if L → ∞, at any time, the best link is always selected from K 1 + K 2 = 2K available channels with the max-ratio scheme in Case 2.
In Case 1, unfortunately, we cannot have a simple form as in (29) for L → ∞, because the probabilities to select a source-to-relay and relay-to-destination link are not equal, even with M 1 = M 2 .In order to illustrate the performance for L → ∞, the original scheme can be assumed to be equivalent to a virtual relay section scheme having equal probability to select a source-to-relay and relay-to-destination link, or P(x < y) = 0.5 where x and y are defined in Section IV-A.Then in the virtual scheme with L → ∞, the number of available source-to-relay and relay-to-destination links are always K 1 and K 2 , respectively, or be obtained by solving P(x < y) = 0.5 as (30), as shown at the bottom of the page, where P(x < y) is given by (35) in the Appendix I.
Since K 2 obtained from ( 30) is usually not an integer, the virtual selection scheme cannot be realized in practice.However, it provides interesting insight in understanding the secrecy performance of the original max-ratio scheme in Case 1 for L → ∞.Normally, we have K 2 < K , which implies that, on the average, the best link is always selected from K 1 + K 2 available channels at any time and For both Case 1 and 2, with a limited buffer size L, we always have K 1 + K 2 ≥ K at any time.On the contrary, in the max-min-ratio selection scheme, the best link is selected from only K links.Therefore, it follows that the max-ratio scheme has significantly better secrecy outage performance than the benchmark max-min-ratio scheme, and the best potential performance for the max-ratio scheme is reached when L → ∞.This will be verified the next section.

VII. NUMERICAL RESULTS
In this section, simulation results are given to verify the secrecy outage probabilities for the proposed max-ratio relay selection scheme.Both Case 1 and 2 are considered.In the  simulation, all noise variance and transmission powers are normalized to unity, and the average channel gains for sourceto-relay and relay-to-destination transmissions are set as γ sr = γ rd = 30 dB.Thus the corresponding average channel SNR is also 30 dB which is high enough to guarantee successful decoding at the relays and destination.The average eavesdropping channel gains, i.e. γ se and γ re , are determined through the settings of the average gain ratios M 1 = γ sr /γ se and M 2 = γ rd /γ re , where we let M 1 = M 2 for various values in the simulations.In every simulation below, both theoretical and simulated secrecy outage probabilities are shown to essentially perfectly match, where the theoretical results are based on (10) and simulation results are obtained by averaging 5, 000, 000 independent runs.This verifies the closed-form secrecy outage probabilities obtained in this paper.
Fig. 2 compares the secrecy outage performance of the proposed max-ratio scheme with those for the no relay selection and the traditional max-min-ratio schemes, where the relay number is set as K = 5 in all relay selection schemes.It is clearly shown that the no relay selection scheme has the worst outage performance and the proposed max-ratio has the best.It is interesting to observe that, for both Cases 1 and 2, with buffer size L = 1, the max-ratio still performs significantly better than the max-min-ratio scheme.We highlight that the max-min-ratio scheme is effectively also equipped with a buffer of size 1, because the relays need to store the decoded data at one time and transmit out at the next time.However, even with L = 1, the max-ratio does not reduce to the maxmin-ratio scheme.This is because, for any relay receiving a data packet in the max-ratio scheme, it has the choice of whether to transmit the packet out at the next time or not.On the contrary, the relays in the max-min-ratio schemes do not have such choices.Therefore, the max-ratio scheme has "coding gain" over the max-min-ratio approach.On the other hand, with L → ∞, the best potential performance of the max-ratio is reached, which is clearly shown in Fig. 2(a) and (b) for both Case 1 and 2 respectively.Fig. 3 compares the secrecy outage probabilities of the maxratio scheme for Cases 1 and 2, where the buffer size is fixed at L = 3, the average gain ratios are set as M 1 = M 2 = 2 or 5, and the relay number is set as K = 2 or 5.It is clearly shown that the max-ratio scheme in Case 1 has consistently better performance than that in Case 2.
Fig. 4 compares the secrecy outage probabilities of the max-ratio scheme for different numbers of relays, where the buffer size is fixed as L = 5 and the average gain ratios are set as M 1 = M 2 = 5.It is clearly shown that, in both cases, the increase of the relay number can significantly improve the secrecy outage performance.For example, for the target secrecy capacity γ sc = 0.5, when the relay number is increased from K = 2 to K = 5, the secrecy outage probability decreases by approximately 10 dB in Case 1, and by almost 6 dB in Case 2. This verifies the effectiveness of using the max-ratio relay selection in improving the secrecy performance.
Fig. 5 compares the secrecy outage probabilities of the max-ratio scheme for different relay buffer sizes, where the relay number and average gain ratio are fixed at K = 4 and M 1 = M 2 = 5, respectively.While both the theoretical and simulation results have been obtained and perfectly match each other, only the theoretical results are shown in Fig. 5 as otherwise it would be too congested for illustration.Particularly, for L → ∞ in Case 1, K 1 and K 2 for the virtual selection scheme (described in Section VI) are obtained as K 1 = K = 4 and K 2 2.23 respectively.The theoretical result for Case 1 is then obtained by using K 1 = 4, K 2 2.23 to calculate the outage probability in (10).On the other hand, the theoretical result for L → ∞ in Case 2 is obtained by using K 1 = K 2 = K = 4 in the corresponding outage probability expression.In both Cases 1 and 2, for L → ∞, the simulation results are actually obtained by using a very large buffer size L = 500.It is clearly shown that, for both Cases 1 and 2, the secrecy outage probability decreases with the increase of the buffer size L, but the improvement becomes less significant as L increases.In fact, when L = 50, the secrecy outage probability is already very close to that for L → ∞.
Fig. 6 shows the secrecy outage probabilities vs the SNR for the proposed max-ratio scheme.It is clear that, in both Cases 1 and 2, the secrecy outage probability improves significantly with increased number of the relay nodes.

VIII. CONCLUSION
This paper proposed a new max-ratio relay selection policy for secure buffer-aided cooperative DF networks.With the help of buffers at the relays, the best relay was selected with the largest gain ratio among all available source-to-relay and relayto-destination links.Both cases with knowledge of exact and average gain for eavesdropping links were considered, and for the first time, in the challenging secure transmission context, closed-form expressions for the secrecy outage probabilities for both cases were derived.Both analysis and simulations show that the proposed max-ratio relay selection has significantly better performance in secrecy outage probability than the benchmark max-min-ratio scheme, and provides an attractive way to realize and improve secure transmission at the physical layer of wireless communications.APPENDIX I PROOF OF (17) Noting the definition of x and y in Section IV-A, we have  (31) where f XY (x, y) is the joint PDF of x and y.
From the CDF-s of x and y given by ( 13) and ( 14) respectively, the PDF-s of x and y are obtained as respectively.Because x and y are mutually independent, we have Substituting ( 33) into (31) gives Then according to [38], if K 2 > 1, we obtain if K 2 = 1 and M 1 = M 2 , we have and if K 2 = 1 and M 1 = M 2 , we have (37)

Fig. 1 .
Fig. 1.Relay selection system model in secure transmission, where the eavesdropper intercepts signals from both the source and relay nodes.

:
Probability of Selecting the Relay-to-Destination Transmission at State s l for Case 2 Similar to that in Case 1, we have p R→D s l = 0 for K 2 = 0, and p R→D s l = 1 for K 1 = 0.But otherwise, we have

Fig. The secrecy outage
Fig.The secrecy outage probabilities of the max-ratio scheme for Cases 1 and 2.

Fig. 4 .
Fig. 4. The secrecy outage probabilities of the max-ratio scheme for different relay numbers K .(a) Case 1.(b) Case 2.