Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
external
mbedtls
Commits
ff7fe670
Commit
ff7fe670
authored
Jul 18, 2010
by
Paul Bakker
Browse files
- Minor DHM code cleanup/comments
parent
f55ec08b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
4 deletions
+6
-4
include/polarssl/dhm.h
include/polarssl/dhm.h
+1
-1
library/dhm.c
library/dhm.c
+5
-3
No files found.
include/polarssl/dhm.h
View file @
ff7fe670
...
...
@@ -64,7 +64,7 @@ int dhm_read_params( dhm_context *ctx,
* \brief Setup and write the ServerKeyExchange parameters
*
* \param ctx DHM context
* \param x_size private value size in b
it
s
* \param x_size private value size in b
yte
s
* \param output destination buffer
* \param olen number of chars written
* \param f_rng RNG function
...
...
library/dhm.c
View file @
ff7fe670
...
...
@@ -99,20 +99,22 @@ int dhm_make_params( dhm_context *ctx, int x_size,
unsigned
char
*
p
;
/*
*
g
enerate X a
nd calculate GX = G^X mod P
*
G
enerate X a
s large as possible ( < P )
*/
n
=
x_size
/
sizeof
(
t_int
);
MPI_CHK
(
mpi_grow
(
&
ctx
->
X
,
n
)
);
MPI_CHK
(
mpi_lset
(
&
ctx
->
X
,
0
)
);
n
=
x_size
-
1
;
p
=
(
unsigned
char
*
)
ctx
->
X
.
p
;
for
(
i
=
0
;
i
<
n
;
i
++
)
for
(
i
=
0
;
i
<
x_size
-
1
;
i
++
)
*
p
++
=
(
unsigned
char
)
f_rng
(
p_rng
);
while
(
mpi_cmp_mpi
(
&
ctx
->
X
,
&
ctx
->
P
)
>=
0
)
mpi_shift_r
(
&
ctx
->
X
,
1
);
/*
* Calculate GX = G^X mod P
*/
MPI_CHK
(
mpi_exp_mod
(
&
ctx
->
GX
,
&
ctx
->
G
,
&
ctx
->
X
,
&
ctx
->
P
,
&
ctx
->
RP
)
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment