Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
bdcb1a2c
T
Third Party Openssl
项目概览
OpenHarmony
/
Third Party Openssl
接近 2 年 前同步成功
通知
12
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看板
提交
bdcb1a2c
编写于
5月 03, 2015
作者:
D
Dr. Stephen Henson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more OSSL_NELEM cases
Reviewed-by:
N
Tim Hudson
<
tjh@openssl.org
>
上级
59ef580a
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
19 addition
and
21 deletion
+19
-21
apps/apps.c
apps/apps.c
+1
-1
apps/ca.c
apps/ca.c
+1
-1
apps/speed.c
apps/speed.c
+1
-1
crypto/cryptlib.c
crypto/cryptlib.c
+2
-2
crypto/x509v3/ext_dat.h
crypto/x509v3/ext_dat.h
+1
-1
test/constant_time_test.c
test/constant_time_test.c
+4
-4
test/dhtest.c
test/dhtest.c
+1
-1
test/ectest.c
test/ectest.c
+1
-3
test/gost2814789test.c
test/gost2814789test.c
+2
-1
test/igetest.c
test/igetest.c
+3
-5
test/testutil.c
test/testutil.c
+2
-1
未找到文件。
apps/apps.c
浏览文件 @
bdcb1a2c
...
@@ -2654,7 +2654,7 @@ int app_isdir(const char *name)
...
@@ -2654,7 +2654,7 @@ int app_isdir(const char *name)
# if defined(UNICODE) || defined(_UNICODE)
# if defined(UNICODE) || defined(_UNICODE)
size_t
i
,
len_0
=
strlen
(
name
)
+
1
;
size_t
i
,
len_0
=
strlen
(
name
)
+
1
;
if
(
len_0
>
sizeof
(
FileData
.
cFileName
)
/
sizeof
(
FileData
.
cFileName
[
0
]
))
if
(
len_0
>
OSSL_NELEM
(
FileData
.
cFileName
))
return
-
1
;
return
-
1
;
# if !defined(_WIN32_WCE) || _WIN32_WCE>=101
# if !defined(_WIN32_WCE) || _WIN32_WCE>=101
...
...
apps/ca.c
浏览文件 @
bdcb1a2c
...
@@ -2408,7 +2408,7 @@ static const char *crl_reasons[] = {
...
@@ -2408,7 +2408,7 @@ static const char *crl_reasons[] = {
"CAkeyTime"
"CAkeyTime"
};
};
#define NUM_REASONS
(sizeof(crl_reasons) / sizeof(char *)
)
#define NUM_REASONS
OSSL_NELEM(crl_reasons
)
/*
/*
* Given revocation information convert to a DB string. The format of the
* Given revocation information convert to a DB string. The format of the
...
...
apps/speed.c
浏览文件 @
bdcb1a2c
...
@@ -2438,7 +2438,7 @@ static void multiblock_speed(const EVP_CIPHER *evp_cipher)
...
@@ -2438,7 +2438,7 @@ static void multiblock_speed(const EVP_CIPHER *evp_cipher)
{
{
static
int
mblengths
[]
=
static
int
mblengths
[]
=
{
8
*
1024
,
2
*
8
*
1024
,
4
*
8
*
1024
,
8
*
8
*
1024
,
8
*
16
*
1024
};
{
8
*
1024
,
2
*
8
*
1024
,
4
*
8
*
1024
,
8
*
8
*
1024
,
8
*
16
*
1024
};
int
j
,
count
,
num
=
sizeof
(
lengths
)
/
sizeof
(
lengths
[
0
]
);
int
j
,
count
,
num
=
OSSL_NELEM
(
lengths
);
const
char
*
alg_name
;
const
char
*
alg_name
;
unsigned
char
*
inp
,
*
out
,
no_key
[
32
],
no_iv
[
16
];
unsigned
char
*
inp
,
*
out
,
no_key
[
32
],
no_iv
[
16
];
EVP_CIPHER_CTX
ctx
;
EVP_CIPHER_CTX
ctx
;
...
...
crypto/cryptlib.c
浏览文件 @
bdcb1a2c
...
@@ -406,8 +406,8 @@ void OPENSSL_showfatal(const char *fmta, ...)
...
@@ -406,8 +406,8 @@ void OPENSSL_showfatal(const char *fmta, ...)
}
while
(
0
);
}
while
(
0
);
va_start
(
ap
,
fmta
);
va_start
(
ap
,
fmta
);
_vsntprintf
(
buf
,
sizeof
(
buf
)
/
sizeof
(
TCHAR
)
-
1
,
fmt
,
ap
);
_vsntprintf
(
buf
,
OSSL_NELEM
(
buf
)
-
1
,
fmt
,
ap
);
buf
[
sizeof
(
buf
)
/
sizeof
(
TCHAR
)
-
1
]
=
_T
(
'\0'
);
buf
[
OSSL_NELEM
(
buf
)
-
1
]
=
_T
(
'\0'
);
va_end
(
ap
);
va_end
(
ap
);
# if defined(_WIN32_WINNT) && _WIN32_WINNT>=0x0333
# if defined(_WIN32_WINNT) && _WIN32_WINNT>=0x0333
...
...
crypto/x509v3/ext_dat.h
浏览文件 @
bdcb1a2c
...
@@ -131,4 +131,4 @@ static const X509V3_EXT_METHOD *standard_exts[] = {
...
@@ -131,4 +131,4 @@ static const X509V3_EXT_METHOD *standard_exts[] = {
/* Number of standard extensions */
/* Number of standard extensions */
#define STANDARD_EXTENSION_COUNT
(sizeof(standard_exts)/sizeof(X509V3_EXT_METHOD *)
)
#define STANDARD_EXTENSION_COUNT
OSSL_NELEM(standard_exts
)
test/constant_time_test.c
浏览文件 @
bdcb1a2c
...
@@ -231,12 +231,12 @@ int main(int argc, char *argv[])
...
@@ -231,12 +231,12 @@ int main(int argc, char *argv[])
int
num_failed
=
0
,
num_all
=
0
;
int
num_failed
=
0
,
num_all
=
0
;
fprintf
(
stdout
,
"Testing constant time operations...
\n
"
);
fprintf
(
stdout
,
"Testing constant time operations...
\n
"
);
for
(
i
=
0
;
i
<
sizeof
(
test_values
)
/
sizeof
(
int
);
++
i
)
{
for
(
i
=
0
;
i
<
OSSL_NELEM
(
test_values
);
++
i
)
{
a
=
test_values
[
i
];
a
=
test_values
[
i
];
num_failed
+=
test_is_zero
(
a
);
num_failed
+=
test_is_zero
(
a
);
num_failed
+=
test_is_zero_8
(
a
);
num_failed
+=
test_is_zero_8
(
a
);
num_all
+=
2
;
num_all
+=
2
;
for
(
j
=
0
;
j
<
sizeof
(
test_values
)
/
sizeof
(
int
);
++
j
)
{
for
(
j
=
0
;
j
<
OSSL_NELEM
(
test_values
);
++
j
)
{
b
=
test_values
[
j
];
b
=
test_values
[
j
];
num_failed
+=
test_binary_op
(
&
constant_time_lt
,
num_failed
+=
test_binary_op
(
&
constant_time_lt
,
"constant_time_lt"
,
a
,
b
,
a
<
b
);
"constant_time_lt"
,
a
,
b
,
a
<
b
);
...
@@ -274,9 +274,9 @@ int main(int argc, char *argv[])
...
@@ -274,9 +274,9 @@ int main(int argc, char *argv[])
}
}
}
}
for
(
i
=
0
;
i
<
sizeof
(
signed_test_values
)
/
sizeof
(
int
);
++
i
)
{
for
(
i
=
0
;
i
<
OSSL_NELEM
(
signed_test_values
);
++
i
)
{
c
=
signed_test_values
[
i
];
c
=
signed_test_values
[
i
];
for
(
j
=
0
;
j
<
sizeof
(
signed_test_values
)
/
sizeof
(
int
);
++
j
)
{
for
(
j
=
0
;
j
<
OSSL_NELEM
(
signed_test_values
);
++
j
)
{
d
=
signed_test_values
[
j
];
d
=
signed_test_values
[
j
];
num_failed
+=
test_select_int
(
c
,
d
);
num_failed
+=
test_select_int
(
c
,
d
);
num_failed
+=
test_eq_int
(
c
,
d
);
num_failed
+=
test_eq_int
(
c
,
d
);
...
...
test/dhtest.c
浏览文件 @
bdcb1a2c
...
@@ -485,7 +485,7 @@ static const rfc5114_td rfctd[] = {
...
@@ -485,7 +485,7 @@ static const rfc5114_td rfctd[] = {
static
int
run_rfc5114_tests
(
void
)
static
int
run_rfc5114_tests
(
void
)
{
{
int
i
;
int
i
;
for
(
i
=
0
;
i
<
(
int
)
(
sizeof
(
rfctd
)
/
sizeof
(
rfc5114_td
)
);
i
++
)
{
for
(
i
=
0
;
i
<
(
int
)
OSSL_NELEM
(
rfctd
);
i
++
)
{
DH
*
dhA
,
*
dhB
;
DH
*
dhA
,
*
dhB
;
unsigned
char
*
Z1
=
NULL
,
*
Z2
=
NULL
;
unsigned
char
*
Z1
=
NULL
,
*
Z2
=
NULL
;
const
rfc5114_td
*
td
=
rfctd
+
i
;
const
rfc5114_td
*
td
=
rfctd
+
i
;
...
...
test/ectest.c
浏览文件 @
bdcb1a2c
...
@@ -1628,9 +1628,7 @@ static void nistp_tests()
...
@@ -1628,9 +1628,7 @@ static void nistp_tests()
{
{
unsigned
i
;
unsigned
i
;
for
(
i
=
0
;
for
(
i
=
0
;
i
<
OSSL_NELEM
(
nistp_tests_params
);
i
++
)
{
i
<
sizeof
(
nistp_tests_params
)
/
sizeof
(
struct
nistp_test_params
);
i
++
)
{
nistp_single_test
(
&
nistp_tests_params
[
i
]);
nistp_single_test
(
&
nistp_tests_params
[
i
]);
}
}
}
}
...
...
test/gost2814789test.c
浏览文件 @
bdcb1a2c
...
@@ -26,6 +26,7 @@ int main(int argc, char *argv[])
...
@@ -26,6 +26,7 @@ int main(int argc, char *argv[])
# include <openssl/evp.h>
# include <openssl/evp.h>
# include <openssl/hmac.h>
# include <openssl/hmac.h>
# include <openssl/obj_mac.h>
# include <openssl/obj_mac.h>
# include "e_os.h"
# define CCGOST_ID "gost"
# define CCGOST_ID "gost"
...
@@ -1311,7 +1312,7 @@ int main(int argc, char *argv[])
...
@@ -1311,7 +1312,7 @@ int main(int argc, char *argv[])
}
}
/* Test cases */
/* Test cases */
for
(
t
=
0
;
t
<
sizeof
(
tcs
)
/
sizeof
(
tcs
[
0
]
);
t
++
)
{
for
(
t
=
0
;
t
<
OSSL_NELEM
(
tcs
);
t
++
)
{
if
(
NULL
==
tcs
[
t
].
szDerive
)
{
if
(
NULL
==
tcs
[
t
].
szDerive
)
{
continue
;
continue
;
}
}
...
...
test/igetest.c
浏览文件 @
bdcb1a2c
...
@@ -55,6 +55,7 @@
...
@@ -55,6 +55,7 @@
#include <stdio.h>
#include <stdio.h>
#include <string.h>
#include <string.h>
#include <assert.h>
#include <assert.h>
#include "e_os.h"
#define TEST_SIZE 128
#define TEST_SIZE 128
#define BIG_TEST_SIZE 10240
#define BIG_TEST_SIZE 10240
...
@@ -191,8 +192,7 @@ static int run_test_vectors(void)
...
@@ -191,8 +192,7 @@ static int run_test_vectors(void)
unsigned
int
n
;
unsigned
int
n
;
int
errs
=
0
;
int
errs
=
0
;
for
(
n
=
0
;
n
<
sizeof
(
ige_test_vectors
)
/
sizeof
(
ige_test_vectors
[
0
]);
for
(
n
=
0
;
n
<
OSSL_NELEM
(
ige_test_vectors
);
++
n
)
{
++
n
)
{
const
struct
ige_test
*
const
v
=
&
ige_test_vectors
[
n
];
const
struct
ige_test
*
const
v
=
&
ige_test_vectors
[
n
];
AES_KEY
key
;
AES_KEY
key
;
unsigned
char
buf
[
MAX_VECTOR_SIZE
];
unsigned
char
buf
[
MAX_VECTOR_SIZE
];
...
@@ -235,9 +235,7 @@ static int run_test_vectors(void)
...
@@ -235,9 +235,7 @@ static int run_test_vectors(void)
}
}
}
}
for
(
n
=
0
;
for
(
n
=
0
;
n
<
OSSL_NELEM
(
bi_ige_test_vectors
);
++
n
)
{
n
<
sizeof
(
bi_ige_test_vectors
)
/
sizeof
(
bi_ige_test_vectors
[
0
]);
++
n
)
{
const
struct
bi_ige_test
*
const
v
=
&
bi_ige_test_vectors
[
n
];
const
struct
bi_ige_test
*
const
v
=
&
bi_ige_test_vectors
[
n
];
AES_KEY
key1
;
AES_KEY
key1
;
AES_KEY
key2
;
AES_KEY
key2
;
...
...
test/testutil.c
浏览文件 @
bdcb1a2c
...
@@ -61,6 +61,7 @@
...
@@ -61,6 +61,7 @@
#include <assert.h>
#include <assert.h>
#include <stdlib.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdio.h>
#include "e_os.h"
/*
/*
* Declares the structures needed to register each test case function.
* Declares the structures needed to register each test case function.
...
@@ -75,7 +76,7 @@ static int num_tests = 0;
...
@@ -75,7 +76,7 @@ static int num_tests = 0;
void
add_test
(
const
char
*
test_case_name
,
int
(
*
test_fn
)
())
void
add_test
(
const
char
*
test_case_name
,
int
(
*
test_fn
)
())
{
{
assert
(
num_tests
!=
(
sizeof
(
all_tests
)
/
sizeof
(
all_tests
)[
0
]
));
assert
(
num_tests
!=
OSSL_NELEM
(
all_tests
));
all_tests
[
num_tests
].
test_case_name
=
test_case_name
;
all_tests
[
num_tests
].
test_case_name
=
test_case_name
;
all_tests
[
num_tests
].
test_fn
=
test_fn
;
all_tests
[
num_tests
].
test_fn
=
test_fn
;
++
num_tests
;
++
num_tests
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录