Skip to content

Commit 23e1b91

Browse files
authored
srp: make RFC5054 the default implementation (#238)
Removes `*_rfc5054` and `*Rfc5054` from method and type names so the RFC5054 methods/types seem like the primary ones to use.
1 parent 2df2cf1 commit 23e1b91

File tree

4 files changed

+17
-17
lines changed

4 files changed

+17
-17
lines changed

srp/src/client.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -203,17 +203,17 @@ impl<G: Group, D: Digest> Client<G, D> {
203203
/// Process server reply to the handshake according to RFC 5054.
204204
///
205205
/// # Params
206-
/// `a` is a random value,
207-
/// `username`, `password` is supplied by the user
208-
/// `salt` and `b_pub` come from the server
209-
pub fn process_reply_rfc5054(
206+
/// - `a` is a random value,
207+
/// - `username`, `password` is supplied by the user
208+
/// - `salt` and `b_pub` come from the server
209+
pub fn process_reply(
210210
&self,
211211
a: &[u8],
212212
username: &[u8],
213213
password: &[u8],
214214
salt: &[u8],
215215
b_pub: &[u8],
216-
) -> Result<ClientVerifierRfc5054<D>, AuthError> {
216+
) -> Result<ClientVerifier<D>, AuthError> {
217217
let a = BoxedUint::from_be_slice_vartime(a);
218218
let a_pub = self.compute_g_x(&a);
219219
let b_pub = BoxedUint::from_be_slice_vartime(b_pub);
@@ -250,7 +250,7 @@ impl<G: Group, D: Digest> Client<G, D> {
250250
session_key.as_slice(),
251251
);
252252

253-
Ok(ClientVerifierRfc5054 {
253+
Ok(ClientVerifier {
254254
m1,
255255
m2,
256256
key: premaster_secret.to_vec(),
@@ -351,14 +351,14 @@ impl<G: Group, D: Digest> Default for Client<G, D> {
351351
}
352352

353353
/// RFC 5054 SRP client state after handshake with the server.
354-
pub struct ClientVerifierRfc5054<D: Digest> {
354+
pub struct ClientVerifier<D: Digest> {
355355
m1: Output<D>,
356356
m2: Output<D>,
357357
key: Vec<u8>,
358358
session_key: Vec<u8>,
359359
}
360360

361-
impl<D: Digest> ClientVerifierRfc5054<D> {
361+
impl<D: Digest> ClientVerifier<D> {
362362
/// Get shared secret key without authenticating server, e.g. for using with
363363
/// authenticated encryption modes. DO NOT USE this method without
364364
/// some kind of secure authentication

srp/src/server.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -147,14 +147,14 @@ impl<G: Group, D: Digest> Server<G, D> {
147147
/// # Params
148148
/// - `b` is a random value,
149149
/// - `v` is the provided during initial user registration
150-
pub fn process_reply_rfc5054(
150+
pub fn process_reply(
151151
&self,
152152
username: &[u8],
153153
salt: &[u8],
154154
b: &[u8],
155155
v: &[u8],
156156
a_pub: &[u8],
157-
) -> Result<ServerVerifierRfc5054<D>, AuthError> {
157+
) -> Result<ServerVerifier<D>, AuthError> {
158158
let b = BoxedUint::from_be_slice_vartime(b);
159159
let v = BoxedUint::from_be_slice_vartime(v);
160160
let a_pub = BoxedUint::from_be_slice_vartime(a_pub);
@@ -191,7 +191,7 @@ impl<G: Group, D: Digest> Server<G, D> {
191191
session_key.as_slice(),
192192
);
193193

194-
Ok(ServerVerifierRfc5054 {
194+
Ok(ServerVerifier {
195195
m1,
196196
m2,
197197
key: premaster_secret.into(),
@@ -284,14 +284,14 @@ impl<G: Group, D: Digest> Default for Server<G, D> {
284284
}
285285

286286
/// RFC 5054 SRP server state after handshake with the client.
287-
pub struct ServerVerifierRfc5054<D: Digest> {
287+
pub struct ServerVerifier<D: Digest> {
288288
m1: Output<D>,
289289
m2: Output<D>,
290290
key: Vec<u8>,
291291
session_key: Vec<u8>,
292292
}
293293

294-
impl<D: Digest> ServerVerifierRfc5054<D> {
294+
impl<D: Digest> ServerVerifier<D> {
295295
/// Get shared secret between user and the server. (do not forget to verify
296296
/// that keys are the same!)
297297
pub fn key(&self) -> &[u8] {

srp/tests/bad_public.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use srp::server::Server;
99
fn bad_a_pub() {
1010
let server = Server::<G1024, Sha1>::new();
1111
server
12-
.process_reply_rfc5054(b"", b"", b"", b"", &BoxedUint::zero().to_be_bytes())
12+
.process_reply(b"", b"", b"", b"", &BoxedUint::zero().to_be_bytes())
1313
.unwrap();
1414
}
1515

@@ -18,6 +18,6 @@ fn bad_a_pub() {
1818
fn bad_b_pub() {
1919
let client = Client::<G1024, Sha1>::new();
2020
client
21-
.process_reply_rfc5054(b"", b"", b"", b"", &BoxedUint::zero().to_be_bytes())
21+
.process_reply(b"", b"", b"", b"", &BoxedUint::zero().to_be_bytes())
2222
.unwrap();
2323
}

srp/tests/srp.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ fn auth_test_rfc5054(true_pwd: &[u8], auth_pwd: &[u8]) {
4040
let mut a = [0u8; 64];
4141
rng.fill_bytes(&mut a);
4242
let client_verifier = client
43-
.process_reply_rfc5054(&a, username, auth_pwd, salt, &b_pub)
43+
.process_reply(&a, username, auth_pwd, salt, &b_pub)
4444
.unwrap();
4545
let a_pub = client.compute_public_ephemeral(&a);
4646
let client_proof = client_verifier.proof();
@@ -49,7 +49,7 @@ fn auth_test_rfc5054(true_pwd: &[u8], auth_pwd: &[u8]) {
4949

5050
// Server processes verification data
5151
let server_verifier = server
52-
.process_reply_rfc5054(username, salt, &b, &verifier, &a_pub)
52+
.process_reply(username, salt, &b, &verifier, &a_pub)
5353
.unwrap();
5454
println!("Client verification on server");
5555
let server_session_key = server_verifier.verify_client(client_proof).unwrap();

0 commit comments

Comments
 (0)