Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Dmitry Baryshkov
nettle
Commits
4da2b5da
Commit
4da2b5da
authored
Aug 11, 2003
by
Luiz Eduardo Gava
Committed by
Niels Möller
Aug 11, 2003
Browse files
(rsa_encrypt): Bugfix contributed by
leg@terra.com.br. Rev: src/nettle/rsa-encrypt.c:1.6
parent
440dbfd2
Changes
1
Hide whitespace changes
Inline
Side-by-side
rsa-encrypt.c
View file @
4da2b5da
...
...
@@ -56,11 +56,11 @@ rsa_encrypt(const struct rsa_public_key *key,
* where padding should be at least 8 pseudorandomly generated
* *non-zero* octets. */
if
(
length
+
11
<
key
->
size
)
if
(
length
+
11
>
key
->
size
)
/* Message too long for this key. */
return
0
;
/* At least 8
bi
ts of random padding */
/* At least 8
octe
ts of random padding */
padding
=
key
->
size
-
length
-
3
;
assert
(
padding
>=
8
);
...
...
@@ -73,8 +73,9 @@ rsa_encrypt(const struct rsa_public_key *key,
for
(
i
=
0
;
i
<
padding
;
i
++
)
if
(
!
em
[
i
+
1
])
em
[
i
+
1
]
=
1
;
memcpy
(
em
+
1
+
padding
,
message
,
length
);
em
[
padding
+
1
]
=
0
;
memcpy
(
em
+
2
+
padding
,
message
,
length
);
nettle_mpz_set_str_256_u
(
gibbberish
,
key
->
size
-
1
,
em
);
mpz_powm
(
gibbberish
,
gibbberish
,
key
->
e
,
key
->
n
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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