Skip to content

Commit 70cee64

Browse files
authored
srp: remove client and server lifetimes (#231)
The only lifetime is a reference to the group, where the groups are all stored in `static`s and therefore we can just use a `'static` lifetime
1 parent 2656099 commit 70cee64

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

srp/src/client.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ use crate::{
112112
};
113113

114114
/// SRP client state before handshake with the server.
115-
pub struct SrpClient<'a, D: Digest> {
116-
params: &'a SrpGroup,
115+
pub struct SrpClient<D: Digest> {
116+
params: &'static SrpGroup,
117117
no_user_in_x: bool,
118118
d: PhantomData<D>,
119119
}
@@ -133,10 +133,10 @@ pub struct SrpClientVerifierRfc5054<D: Digest> {
133133
session_key: Vec<u8>,
134134
}
135135

136-
impl<'a, D: Digest> SrpClient<'a, D> {
136+
impl<D: Digest> SrpClient<D> {
137137
/// Create new SRP client instance.
138138
#[must_use]
139-
pub const fn new(params: &'a SrpGroup) -> Self {
139+
pub const fn new(params: &'static SrpGroup) -> Self {
140140
Self {
141141
params,
142142
no_user_in_x: false,
@@ -145,7 +145,7 @@ impl<'a, D: Digest> SrpClient<'a, D> {
145145
}
146146

147147
#[must_use]
148-
pub const fn new_with_options(params: &'a SrpGroup, no_user_in_x: bool) -> Self {
148+
pub const fn new_with_options(params: &'static SrpGroup, no_user_in_x: bool) -> Self {
149149
Self {
150150
params,
151151
no_user_in_x,

srp/src/server.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ use crate::{
9090
};
9191

9292
/// SRP server state
93-
pub struct SrpServer<'a, D: Digest> {
94-
params: &'a SrpGroup,
93+
pub struct SrpServer<D: Digest> {
94+
params: &'static SrpGroup,
9595
d: PhantomData<D>,
9696
}
9797

@@ -110,10 +110,10 @@ pub struct SrpServerVerifierRfc5054<D: Digest> {
110110
session_key: Vec<u8>,
111111
}
112112

113-
impl<'a, D: Digest> SrpServer<'a, D> {
113+
impl<D: Digest> SrpServer<D> {
114114
/// Create new server state.
115115
#[must_use]
116-
pub const fn new(params: &'a SrpGroup) -> Self {
116+
pub const fn new(params: &'static SrpGroup) -> Self {
117117
Self {
118118
params,
119119
d: PhantomData,

0 commit comments

Comments
 (0)