Skip to content
GitLab
菜单
为什么选择 GitLab
定价
联系销售
探索
为什么选择 GitLab
定价
联系销售
探索
登录
获取免费试用
主导航
搜索或转到…
项目
M
mbedtls
管理
动态
成员
标记
计划
议题
议题看板
里程碑
迭代
Wiki
代码
合并请求
仓库
分支
提交
标签
仓库图
比较修订版本
代码片段
锁定的文件
构建
流水线
作业
流水线计划
产物
部署
发布
Package registry
容器镜像库
模型注册表
运维
环境
Terraform 模块
监控
事件
服务台
分析
价值流分析
贡献者分析
CI/CD 分析
仓库分析
代码评审分析
议题分析
模型实验
效能分析
帮助
帮助
支持
GitLab 文档
比较 GitLab 各版本
社区论坛
为极狐GitLab 提交贡献
提交反馈
隐私声明
快捷键
?
新增功能
4
代码片段
群组
项目
显示更多面包屑
esp-mirror
Mbed-TLS
mbedtls
提交
be4e7dca
提交
be4e7dca
编辑于
14 years ago
作者:
Paul Bakker
浏览文件
操作
下载
补丁
差异文件
- Debug print of MPI now removes leading zero octets and displays actual bit size of the value
上级
b3dcbc18
No related branches found
No related tags found
无相关合并请求
变更
4
隐藏空白变更内容
行内
左右并排
显示
4 个更改的文件
ChangeLog
+9
-0
9 个添加, 0 个删除
ChangeLog
library/debug.c
+37
-13
37 个添加, 13 个删除
library/debug.c
tests/suites/test_suite_debug.data
+24
-1
24 个添加, 1 个删除
tests/suites/test_suite_debug.data
tests/suites/test_suite_debug.function
+24
-0
24 个添加, 0 个删除
tests/suites/test_suite_debug.function
有
94 个添加
和
14 个删除
ChangeLog
+
9
−
0
浏览文件 @
be4e7dca
...
...
@@ -5,6 +5,15 @@ Features
* Added support for PKCS#1 v2.1 encoding and thus support
for the RSAES-OAEP and RSASSA-PSS operations.
Changes
* Debug print of MPI now removes leading zero octets and
displays actual bit size of the value.
Bugfix
* Debug output of MPI's now the same independent of underlying
platform (32-bit / 64-bit) (Fixes ticket #19, found by Mads
Kiilerich and Mihai Militaru)
= Version 0.99-pre3 released on 2011-02-28
This release replaces version 0.99-pre2 which had possible copyright issues.
Features
...
...
此差异已折叠。
点击以展开。
library/debug.c
+
37
−
13
浏览文件 @
be4e7dca
...
...
@@ -132,43 +132,67 @@ void debug_print_mpi( const ssl_context *ssl, int level,
const
char
*
text
,
const
mpi
*
X
)
{
char
str
[
512
];
int
i
,
j
,
k
,
n
,
maxlen
=
sizeof
(
str
)
-
1
;
int
i
,
j
,
k
,
n
,
maxlen
=
sizeof
(
str
)
-
1
,
zeros
=
1
;
if
(
ssl
->
f_dbg
==
NULL
||
X
==
NULL
)
return
;
for
(
n
=
X
->
n
-
1
;
n
>
=
0
;
n
--
)
for
(
n
=
X
->
n
-
1
;
n
>
0
;
n
--
)
if
(
X
->
p
[
n
]
!=
0
)
break
;
for
(
j
=
(
sizeof
(
t_int
)
<<
3
)
-
1
;
j
>=
0
;
j
--
)
if
(
(
(
X
->
p
[
n
]
>>
j
)
&
1
)
!=
0
)
break
;
snprintf
(
str
,
maxlen
,
"%s(%04d): value of '%s' (%lu bits) is:
\n
"
,
file
,
line
,
text
,
(
unsigned
long
)
(
(
n
+
1
)
*
sizeof
(
t_int
)
)
<<
3
);
(
unsigned
long
)
(
(
n
*
(
sizeof
(
t_int
)
<<
3
)
)
+
j
+
1
)
);
str
[
maxlen
]
=
'\0'
;
ssl
->
f_dbg
(
ssl
->
p_dbg
,
level
,
str
);
for
(
i
=
n
,
j
=
0
;
i
>=
0
;
i
--
,
j
++
)
for
(
i
=
n
,
j
=
0
;
i
>=
0
;
i
--
)
{
if
(
j
%
(
16
/
sizeof
(
t_int
)
)
==
0
)
if
(
zeros
&&
X
->
p
[
i
]
==
0
)
continue
;
for
(
k
=
sizeof
(
t_int
)
-
1
;
k
>=
0
;
k
--
)
{
if
(
j
>
0
)
ssl
->
f_dbg
(
ssl
->
p_dbg
,
level
,
"
\n
"
);
if
(
zeros
&&
(
(
X
->
p
[
i
]
>>
(
k
<<
3
)
)
&
0xFF
)
==
0
)
continue
;
else
zeros
=
0
;
snprintf
(
str
,
maxlen
,
"%s(%04d): "
,
file
,
line
);
if
(
j
%
16
==
0
)
{
if
(
j
>
0
)
ssl
->
f_dbg
(
ssl
->
p_dbg
,
level
,
"
\n
"
);
str
[
maxlen
]
=
'\0'
;
ssl
->
f_dbg
(
ssl
->
p_dbg
,
level
,
str
);
}
snprintf
(
str
,
maxlen
,
"%s(%04d): "
,
file
,
line
);
str
[
maxlen
]
=
'\0'
;
ssl
->
f_dbg
(
ssl
->
p_dbg
,
level
,
str
);
}
for
(
k
=
sizeof
(
t_int
)
-
1
;
k
>=
0
;
k
--
)
{
snprintf
(
str
,
maxlen
,
" %02x"
,
(
unsigned
int
)
(
X
->
p
[
i
]
>>
(
k
<<
3
)
)
&
0xFF
);
str
[
maxlen
]
=
'\0'
;
ssl
->
f_dbg
(
ssl
->
p_dbg
,
level
,
str
);
j
++
;
}
}
if
(
zeros
==
1
)
{
snprintf
(
str
,
maxlen
,
"%s(%04d): "
,
file
,
line
);
str
[
maxlen
]
=
'\0'
;
ssl
->
f_dbg
(
ssl
->
p_dbg
,
level
,
str
);
ssl
->
f_dbg
(
ssl
->
p_dbg
,
level
,
" 00"
);
}
ssl
->
f_dbg
(
ssl
->
p_dbg
,
level
,
"
\n
"
);
...
...
此差异已折叠。
点击以展开。
tests/suites/test_suite_debug.data
+
24
−
1
浏览文件 @
be4e7dca
Debug print certificate #1
depends_on:POLARSSL_DEBUG_C:POLARSSL_PEM_C
debug_print_crt:"data_files/server1.crt":"MyFile":999:"PREFIX_":"MyFile(0999)\: PREFIX_ #1\:\nMyFile(0999)\: cert. version \: 3\nMyFile(0999)\: serial number \: 01\nMyFile(0999)\: issuer name \: C=NL, O=PolarSSL, CN=PolarSSL Test CA\nMyFile(0999)\: subject name \: C=NL, O=PolarSSL, CN=PolarSSL Server 1\nMyFile(0999)\: issued on \: 2011-02-12 14\:44\:06\nMyFile(0999)\: expires on \: 2021-02-12 14\:44\:06\nMyFile(0999)\: signed using \: RSA+SHA1\nMyFile(0999)\: RSA key size \: 2048 bits\nMyFile(0999)\: value of 'crt->rsa.N' (2048 bits) is\:\nMyFile(0999)\: a9 02 1f 3d 40 6a d5 55 53 8b fd 36 ee 82 65 2e\nMyFile(0999)\: 15 61 5e 89 bf b8 e8 45 90 db ee 88 16 52 d3 f1\nMyFile(0999)\: 43 50 47 96 12 59 64 87 6b fd 2b e0 46 f9 73 be\nMyFile(0999)\: dd cf 92 e1 91 5b ed 66 a0 6f 89 29 79 45 80 d0\nMyFile(0999)\: 83 6a d5 41 43 77 5f 39 7c 09 04 47 82 b0 57 39\nMyFile(0999)\: 70 ed a3 ec 15 19 1e a8 33 08 47 c1 05 42 a9 fd\nMyFile(0999)\: 4c c3 b4 df dd 06 1f 4d 10 51 40 67 73 13 0f 40\nMyFile(0999)\: f8 6d 81 25 5f 0a b1 53 c6 30 7e 15 39 ac f9 5a\nMyFile(0999)\: ee 7f 92 9e a6 05 5b e7 13 97 85 b5 23 92 d9 d4\nMyFile(0999)\: 24 06 d5 09 25 89 75 07 dd a6 1a 8f 3f 09 19 be\nMyFile(0999)\: ad 65 2c 64 eb 95 9b dc fe 41 5e 17 a6 da 6c 5b\nMyFile(0999)\: 69 cc 02 ba 14 2c 16 24 9c 4a dc cd d0 f7 52 67\nMyFile(0999)\: 73 f1 2d a0 23 fd 7e f4 31 ca 2d 70 ca 89 0b 04\nMyFile(0999)\: db 2e a6 4f 70 6e 9e ce bd 58 89 e2 53 59 9e 6e\nMyFile(0999)\: 5a 92 65 e2 88 3f 0c 94 19 a3 dd e5 e8 9d 95 13\nMyFile(0999)\: ed 29 db ab 70 12 dc 5a ca 6b 17 ab 52 82 54 b1\nMyFile(0999)\: value of 'crt->rsa.E' (
32
bits) is\:\nMyFile(0999)\:
00
01 00 01\n"
debug_print_crt:"data_files/server1.crt":"MyFile":999:"PREFIX_":"MyFile(0999)\: PREFIX_ #1\:\nMyFile(0999)\: cert. version \: 3\nMyFile(0999)\: serial number \: 01\nMyFile(0999)\: issuer name \: C=NL, O=PolarSSL, CN=PolarSSL Test CA\nMyFile(0999)\: subject name \: C=NL, O=PolarSSL, CN=PolarSSL Server 1\nMyFile(0999)\: issued on \: 2011-02-12 14\:44\:06\nMyFile(0999)\: expires on \: 2021-02-12 14\:44\:06\nMyFile(0999)\: signed using \: RSA+SHA1\nMyFile(0999)\: RSA key size \: 2048 bits\nMyFile(0999)\: value of 'crt->rsa.N' (2048 bits) is\:\nMyFile(0999)\: a9 02 1f 3d 40 6a d5 55 53 8b fd 36 ee 82 65 2e\nMyFile(0999)\: 15 61 5e 89 bf b8 e8 45 90 db ee 88 16 52 d3 f1\nMyFile(0999)\: 43 50 47 96 12 59 64 87 6b fd 2b e0 46 f9 73 be\nMyFile(0999)\: dd cf 92 e1 91 5b ed 66 a0 6f 89 29 79 45 80 d0\nMyFile(0999)\: 83 6a d5 41 43 77 5f 39 7c 09 04 47 82 b0 57 39\nMyFile(0999)\: 70 ed a3 ec 15 19 1e a8 33 08 47 c1 05 42 a9 fd\nMyFile(0999)\: 4c c3 b4 df dd 06 1f 4d 10 51 40 67 73 13 0f 40\nMyFile(0999)\: f8 6d 81 25 5f 0a b1 53 c6 30 7e 15 39 ac f9 5a\nMyFile(0999)\: ee 7f 92 9e a6 05 5b e7 13 97 85 b5 23 92 d9 d4\nMyFile(0999)\: 24 06 d5 09 25 89 75 07 dd a6 1a 8f 3f 09 19 be\nMyFile(0999)\: ad 65 2c 64 eb 95 9b dc fe 41 5e 17 a6 da 6c 5b\nMyFile(0999)\: 69 cc 02 ba 14 2c 16 24 9c 4a dc cd d0 f7 52 67\nMyFile(0999)\: 73 f1 2d a0 23 fd 7e f4 31 ca 2d 70 ca 89 0b 04\nMyFile(0999)\: db 2e a6 4f 70 6e 9e ce bd 58 89 e2 53 59 9e 6e\nMyFile(0999)\: 5a 92 65 e2 88 3f 0c 94 19 a3 dd e5 e8 9d 95 13\nMyFile(0999)\: ed 29 db ab 70 12 dc 5a ca 6b 17 ab 52 82 54 b1\nMyFile(0999)\: value of 'crt->rsa.E' (
17
bits) is\:\nMyFile(0999)\: 01 00 01\n"
Debug print mpi #1
depends_on:POLARSSL_DEBUG_C
debug_print_mpi:16:"01020304050607":"MyFile":999:"VALUE":"MyFile(0999)\: value of 'VALUE' (49 bits) is\:\nMyFile(0999)\: 01 02 03 04 05 06 07\n"
Debug print mpi #2
depends_on:POLARSSL_DEBUG_C
debug_print_mpi:16:"00000000000007":"MyFile":999:"VALUE":"MyFile(0999)\: value of 'VALUE' (3 bits) is\:\nMyFile(0999)\: 07\n"
Debug print mpi #3
depends_on:POLARSSL_DEBUG_C
debug_print_mpi:16:"00000000000000":"MyFile":999:"VALUE":"MyFile(0999)\: value of 'VALUE' (0 bits) is\:\nMyFile(0999)\: 00\n"
Debug print mpi #4
depends_on:POLARSSL_DEBUG_C
debug_print_mpi:16:"0941379d00fed1491fe15df284dfde4a142f68aa8d412023195cee66883e6290ffe703f4ea5963bf212713cee46b107c09182b5edcd955adac418bf4918e2889af48e1099d513830cec85c26ac1e158b52620e33ba8692f893efbb2f958b4424":"MyFile":999:"VALUE":"MyFile(0999)\: value of 'VALUE' (764 bits) is\:\nMyFile(0999)\: 09 41 37 9d 00 fe d1 49 1f e1 5d f2 84 df de 4a\nMyFile(0999)\: 14 2f 68 aa 8d 41 20 23 19 5c ee 66 88 3e 62 90\nMyFile(0999)\: ff e7 03 f4 ea 59 63 bf 21 27 13 ce e4 6b 10 7c\nMyFile(0999)\: 09 18 2b 5e dc d9 55 ad ac 41 8b f4 91 8e 28 89\nMyFile(0999)\: af 48 e1 09 9d 51 38 30 ce c8 5c 26 ac 1e 15 8b\nMyFile(0999)\: 52 62 0e 33 ba 86 92 f8 93 ef bb 2f 95 8b 44 24\n"
Debug print mpi #5
depends_on:POLARSSL_DEBUG_C
debug_print_mpi:16:"0000000000000000000000000000000000000000000000000000000941379d00fed1491fe15df284dfde4a142f68aa8d412023195cee66883e6290ffe703f4ea5963bf212713cee46b107c09182b5edcd955adac418bf4918e2889af48e1099d513830cec85c26ac1e158b52620e33ba8692f893efbb2f958b4424":"MyFile":999:"VALUE":"MyFile(0999)\: value of 'VALUE' (764 bits) is\:\nMyFile(0999)\: 09 41 37 9d 00 fe d1 49 1f e1 5d f2 84 df de 4a\nMyFile(0999)\: 14 2f 68 aa 8d 41 20 23 19 5c ee 66 88 3e 62 90\nMyFile(0999)\: ff e7 03 f4 ea 59 63 bf 21 27 13 ce e4 6b 10 7c\nMyFile(0999)\: 09 18 2b 5e dc d9 55 ad ac 41 8b f4 91 8e 28 89\nMyFile(0999)\: af 48 e1 09 9d 51 38 30 ce c8 5c 26 ac 1e 15 8b\nMyFile(0999)\: 52 62 0e 33 ba 86 92 f8 93 ef bb 2f 95 8b 44 24\n"
Debug print mpi #6
depends_on:POLARSSL_DEBUG_C
debug_print_mpi:16:"0000000000000000000000000000000000000000000000000000000041379d00fed1491fe15df284dfde4a142f68aa8d412023195cee66883e6290ffe703f4ea5963bf212713cee46b107c09182b5edcd955adac418bf4918e2889af48e1099d513830cec85c26ac1e158b52620e33ba8692f893efbb2f958b4424":"MyFile":999:"VALUE":"MyFile(0999)\: value of 'VALUE' (759 bits) is\:\nMyFile(0999)\: 41 37 9d 00 fe d1 49 1f e1 5d f2 84 df de 4a 14\nMyFile(0999)\: 2f 68 aa 8d 41 20 23 19 5c ee 66 88 3e 62 90 ff\nMyFile(0999)\: e7 03 f4 ea 59 63 bf 21 27 13 ce e4 6b 10 7c 09\nMyFile(0999)\: 18 2b 5e dc d9 55 ad ac 41 8b f4 91 8e 28 89 af\nMyFile(0999)\: 48 e1 09 9d 51 38 30 ce c8 5c 26 ac 1e 15 8b 52\nMyFile(0999)\: 62 0e 33 ba 86 92 f8 93 ef bb 2f 95 8b 44 24\n"
此差异已折叠。
点击以展开。
tests/suites/test_suite_debug.function
+
24
−
0
浏览文件 @
be4e7dca
...
...
@@ -37,3 +37,27 @@ debug_print_crt:crt_file:file:line:prefix:result_str
TEST_ASSERT( strcmp( buffer.buf, {result_str} ) == 0 );
}
END_CASE
BEGIN_CASE
debug_print_mpi:radix:value:file:line:prefix:result_str
{
ssl_context ssl;
struct buffer_data buffer;
mpi val;
mpi_init( &val, NULL );
memset( &ssl, 0, sizeof( ssl_context ) );
memset( buffer.buf, 0, 2000 );
buffer.ptr = buffer.buf;
TEST_ASSERT( mpi_read_string( &val, {radix}, {value} ) == 0 );
ssl_set_dbg(&ssl, string_debug, &buffer);
debug_print_mpi( &ssl, 0, {file}, {line}, {prefix}, &val);
TEST_ASSERT( strcmp( buffer.buf, {result_str} ) == 0 );
}
END_CASE
此差异已折叠。
点击以展开。
预览
0%
加载中
请重试
或
添加新附件
.
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
保存评论
取消
想要评论请
注册
或
登录