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
6c343d7d
Commit
6c343d7d
authored
Jul 10, 2014
by
Paul Bakker
Browse files
Fix mpi_write_string() to write "00" as hex output for empty MPI
parent
5b11d026
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
1 deletion
+9
-1
ChangeLog
ChangeLog
+2
-0
library/bignum.c
library/bignum.c
+1
-1
tests/suites/test_suite_mpi.data
tests/suites/test_suite_mpi.data
+6
-0
No files found.
ChangeLog
View file @
6c343d7d
...
...
@@ -66,6 +66,8 @@ Bugfix
* Disable broken Sparc64 bn_mul assembly (found by Florian Obser).
* Fix base64_decode() to return and check length correctly (in case of
tight buffers)
* Fix mpi_write_string() to write "00" as hex output for empty MPI (found
by Hui Dong)
= PolarSSL 1.3.7 released on 2014-05-02
Features
...
...
library/bignum.c
View file @
6c343d7d
...
...
@@ -530,7 +530,7 @@ int mpi_write_string( const mpi *X, int radix, char *s, size_t *slen )
{
c
=
(
X
->
p
[
i
-
1
]
>>
(
(
j
-
1
)
<<
3
)
)
&
0xFF
;
if
(
c
==
0
&&
k
==
0
&&
(
i
+
j
+
3
)
!=
0
)
if
(
c
==
0
&&
k
==
0
&&
(
i
+
j
)
!=
2
)
continue
;
*
(
p
++
)
=
"0123456789ABCDEF"
[
c
/
16
];
...
...
tests/suites/test_suite_mpi.data
View file @
6c343d7d
...
...
@@ -37,6 +37,12 @@ mpi_read_write_string:10:"29":15:"1e":100:0:0
Test mpi_read_write_string #7
mpi_read_write_string:10:"56125680981752282334141896320372489490613963693556392520816017892111350604111697682705498319512049040516698827829292076808006940873974979584527073481012636016353913462376755556720019831187364993587901952757307830896531678727717924":16:"0941379d00fed1491fe15df284dfde4a142f68aa8d412023195cee66883e6290ffe703f4ea5963bf212713cee46b107c09182b5edcd955adac418bf4918e2889af48e1099d513830cec85c26ac1e158b52620e33ba8692f893efbb2f958b4424":200:0:0
Test mpi_read_write_string #8 (Empty MPI -> hex)
mpi_read_write_string:16:"":16:"00":4:0:0
Test mpi_read_write_string #9 (Empty MPI -> dec)
mpi_read_write_string:16:"":10:"0":4:0:0
Base test mpi_read_binary #1
mpi_read_binary:"0941379d00fed1491fe15df284dfde4a142f68aa8d412023195cee66883e6290ffe703f4ea5963bf212713cee46b107c09182b5edcd955adac418bf4918e2889af48e1099d513830cec85c26ac1e158b52620e33ba8692f893efbb2f958b4424":10:"56125680981752282334141896320372489490613963693556392520816017892111350604111697682705498319512049040516698827829292076808006940873974979584527073481012636016353913462376755556720019831187364993587901952757307830896531678727717924"
...
...
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