Skip to content

Commit

Permalink
use the new Kex moduli accessor functions rather than Hashtbls directly
Browse files Browse the repository at this point in the history
  • Loading branch information
avsm committed Mar 3, 2012
1 parent cf923c8 commit 717c691
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion server/ssh_openssh_formats.ml
Expand Up @@ -37,7 +37,7 @@ let moduli file primes =
let generator = Mpl_stdlib.Mpl_mpint.of_string
(binary_of_hex (Printf.sprintf "%02x" (int_of_string (nth 5)))) in
let prime = Mpl_stdlib.Mpl_mpint.of_string (binary_of_hex (nth 6)) in
hashtbl_add_to_list primes size (prime, generator)
Kex.Methods.DHGex.add_moduli ~primes ~size ~prime ~generator;
end
done;
with End_of_file -> close_in fin
Expand Down
8 changes: 4 additions & 4 deletions server/sshd.ml
Expand Up @@ -50,17 +50,17 @@ class mlsshd_config conf =

(* Initialize a moduli file in OpenSSH format (normally /etc/moduli) *)
method moduli_init =
let primes = Hashtbl.create 1 in
let primes = Kex.Methods.DHGex.empty_moduli () in
try
Ssh_openssh_formats.moduli moduli_file primes;
primes;
with Ssh_openssh_formats.Parse_failure ->
(* Clear primes to be safe *)
Hashtbl.clear primes;
let primes = Kex.Methods.DHGex.empty_moduli () in
let g1p,g1g = Kex.Methods.public_parameters Kex.Methods.DiffieHellmanGroup1SHA1 in
let g14p,g14g = Kex.Methods.public_parameters Kex.Methods.DiffieHellmanGroup14SHA1 in
hashtbl_add_to_list primes 1024l (g1p,g1g);
hashtbl_add_to_list primes 2048l (g14p,g14g);
Kex.Methods.DHGex.add_moduli ~primes ~size:1024l ~prime:g1p ~generator:g1g;
Kex.Methods.DHGex.add_moduli ~primes ~size:2048l ~prime:g14p ~generator:g14g;
primes

(* Check to see if a banner should be displayed to the user at
Expand Down

0 comments on commit 717c691

Please sign in to comment.