Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
ea5240a5
T
Third Party Openssl
项目概览
OpenHarmony
/
Third Party Openssl
8 个月 前同步成功
通知
8
Star
18
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Third Party Openssl
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
ea5240a5
编写于
4月 29, 2003
作者:
R
Richard Levitte
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add an extended variant of OBJ_bsearch() that can be given a few
flags.
上级
eec7968f
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
48 addition
and
9 deletion
+48
-9
CHANGES
CHANGES
+15
-0
crypto/objects/obj_dat.c
crypto/objects/obj_dat.c
+27
-8
crypto/objects/objects.h
crypto/objects/objects.h
+6
-1
未找到文件。
CHANGES
浏览文件 @
ea5240a5
...
...
@@ -4,6 +4,21 @@
Changes between 0.9.7a and 0.9.8 [xx XXX xxxx]
*) Add the function OBJ_bsearch_ex() which works like OBJ_bsearch() but
takes an extra flags argument for optional functionality. Currently,
the following flags are defined:
OBJ_BSEARCH_VALUE_ON_NOMATCH
This one gets OBJ_bsearch_ex() to return a pointer to the first
element where the comparing function returns a negative or zero
number.
OBJ_BSEARCH_FIRST_VALUE_ON_MATCH
This one gets OBJ_bsearch_ex() to return a pointer to the first
element where the comparing function returns zero. This is useful
if there are more than one element where the comparing function
returns zero.
*) Make it possible to create self-signed certificates with 'openssl ca'
in such a way that the self-signed certificate becomes part of the
CA database and uses the same mechanisms for serial number generation
...
...
crypto/objects/obj_dat.c
浏览文件 @
ea5240a5
...
...
@@ -556,8 +556,14 @@ static int obj_cmp(const void *ap, const void *bp)
const
char
*
OBJ_bsearch
(
const
char
*
key
,
const
char
*
base
,
int
num
,
int
size
,
int
(
*
cmp
)(
const
void
*
,
const
void
*
))
{
return
OBJ_bsearch_ex
(
key
,
base
,
num
,
size
,
cmp
,
0
);
}
const
char
*
OBJ_bsearch_ex
(
const
char
*
key
,
const
char
*
base
,
int
num
,
int
size
,
int
(
*
cmp
)(
const
void
*
,
const
void
*
),
int
flags
)
{
int
l
,
h
,
i
,
c
;
const
char
*
p
;
const
char
*
p
=
NULL
;
if
(
num
==
0
)
return
(
NULL
);
l
=
0
;
...
...
@@ -572,20 +578,33 @@ const char *OBJ_bsearch(const char *key, const char *base, int num, int size,
else
if
(
c
>
0
)
l
=
i
+
1
;
else
return
(
p
)
;
break
;
}
#ifdef CHARSET_EBCDIC
/* THIS IS A KLUDGE - Because the *_obj is sorted in ASCII order, and
* I don't have perl (yet), we revert to a *LINEAR* search
* when the object wasn't found in the binary search.
*/
for
(
i
=
0
;
i
<
num
;
++
i
)
{
p
=
&
(
base
[
i
*
size
]);
if
((
*
cmp
)(
key
,
p
)
==
0
)
return
p
;
}
if
(
c
!=
0
)
{
for
(
i
=
0
;
i
<
num
;
++
i
)
{
p
=
&
(
base
[
i
*
size
]);
c
=
(
*
cmp
)(
key
,
p
);
if
(
c
==
0
||
(
c
<
0
&&
(
flags
&
OBJ_BSEARCH_VALUE_ON_NOMATCH
)))
return
p
;
}
}
#endif
return
(
NULL
);
if
(
c
!=
0
&&
!
(
flags
&
OBJ_BSEARCH_VALUE_ON_NOMATCH
))
p
=
NULL
;
else
if
(
c
==
0
&&
(
flags
&
OBJ_BSEARCH_FIRST_VALUE_ON_MATCH
))
{
while
(
i
>
0
&&
(
*
cmp
)(
key
,
&
(
base
[(
i
-
1
)
*
size
]))
==
0
)
i
--
;
p
=
&
(
base
[
i
*
size
]);
}
return
(
p
);
}
int
OBJ_create_objects
(
BIO
*
in
)
...
...
crypto/objects/objects.h
浏览文件 @
ea5240a5
...
...
@@ -966,7 +966,10 @@
#define OBJ_NAME_TYPE_COMP_METH 0x04
#define OBJ_NAME_TYPE_NUM 0x05
#define OBJ_NAME_ALIAS 0x8000
#define OBJ_NAME_ALIAS 0x8000
#define OBJ_BSEARCH_VALUE_ON_NOMATCH 0x01
#define OBJ_BSEARCH_FIRST_VALUE_ON_MATCH 0x02
#ifdef __cplusplus
...
...
@@ -1010,6 +1013,8 @@ int OBJ_sn2nid(const char *s);
int
OBJ_cmp
(
const
ASN1_OBJECT
*
a
,
const
ASN1_OBJECT
*
b
);
const
char
*
OBJ_bsearch
(
const
char
*
key
,
const
char
*
base
,
int
num
,
int
size
,
int
(
*
cmp
)(
const
void
*
,
const
void
*
));
const
char
*
OBJ_bsearch_ex
(
const
char
*
key
,
const
char
*
base
,
int
num
,
int
size
,
int
(
*
cmp
)(
const
void
*
,
const
void
*
),
int
flags
);
int
OBJ_new_nid
(
int
num
);
int
OBJ_add_object
(
const
ASN1_OBJECT
*
obj
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录