Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
27b78273
T
Third Party Openssl
项目概览
OpenHarmony
/
Third Party Openssl
9 个月 前同步成功
通知
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 搜索 >>
提交
27b78273
编写于
2月 29, 2000
作者:
B
Bodo Möller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
'rand' application for creating pseudo-random files.
上级
19c057da
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
164 addition
and
10 deletion
+164
-10
apps/Makefile.ssl
apps/Makefile.ssl
+20
-7
apps/app_rand.c
apps/app_rand.c
+1
-1
apps/progs.h
apps/progs.h
+2
-0
apps/rand.c
apps/rand.c
+139
-0
crypto/bio/bio.h
crypto/bio/bio.h
+1
-1
crypto/bio/bio_lib.c
crypto/bio/bio_lib.c
+1
-1
未找到文件。
apps/Makefile.ssl
浏览文件 @
27b78273
...
...
@@ -38,7 +38,7 @@ E_EXE= verify asn1pars req dgst dh dhparam enc passwd gendh errstr \
ca crl rsa dsa dsaparam
\
x509 genrsa gendsa s_server s_client speed
\
s_time version pkcs7 crl2pkcs7 sess_id ciphers nseq pkcs12
\
pkcs8 spkac smime
pkcs8 spkac smime
rand
PROGS
=
$(PROGRAM)
.c
...
...
@@ -54,18 +54,14 @@ E_OBJ= verify.o asn1pars.o req.o dgst.o dh.o dhparam.o enc.o passwd.o gendh.o er
rsa.o dsa.o dsaparam.o
\
x509.o genrsa.o gendsa.o s_server.o s_client.o speed.o
\
s_time.o
$(A_OBJ)
$(S_OBJ)
$(RAND_OBJ)
version.o sess_id.o
\
ciphers.o nseq.o pkcs12.o pkcs8.o spkac.o smime.o
# pem_mail.o
ciphers.o nseq.o pkcs12.o pkcs8.o spkac.o smime.o rand.o
E_SRC
=
verify.c asn1pars.c req.c dgst.c dh.c enc.c passwd.c gendh.c errstr.c ca.c
\
pkcs7.c crl2p7.c crl.c
\
rsa.c dsa.c dsaparam.c
\
x509.c genrsa.c gendsa.c s_server.c s_client.c speed.c
\
s_time.c
$(A_SRC)
$(S_SRC)
$(RAND_SRC)
version.c sess_id.c
\
ciphers.c nseq.c pkcs12.c pkcs8.c spkac.c smime.c
# pem_mail.c
ciphers.c nseq.c pkcs12.c pkcs8.c spkac.c smime.c rand.c
SRC
=
$(E_SRC)
...
...
@@ -537,6 +533,23 @@ pkcs8.o: ../include/openssl/ripemd.h ../include/openssl/rsa.h
pkcs8.o
:
../include/openssl/safestack.h ../include/openssl/sha.h
pkcs8.o
:
../include/openssl/stack.h ../include/openssl/x509.h
pkcs8.o
:
../include/openssl/x509_vfy.h apps.h
rand.o
:
../include/openssl/asn1.h ../include/openssl/bio.h
rand.o
:
../include/openssl/blowfish.h ../include/openssl/bn.h
rand.o
:
../include/openssl/buffer.h ../include/openssl/cast.h
rand.o
:
../include/openssl/crypto.h ../include/openssl/des.h
rand.o
:
../include/openssl/dh.h ../include/openssl/dsa.h
rand.o
:
../include/openssl/e_os.h ../include/openssl/e_os2.h
rand.o
:
../include/openssl/err.h ../include/openssl/evp.h
rand.o
:
../include/openssl/idea.h ../include/openssl/md2.h
rand.o
:
../include/openssl/md5.h ../include/openssl/mdc2.h
rand.o
:
../include/openssl/objects.h ../include/openssl/opensslconf.h
rand.o
:
../include/openssl/opensslv.h ../include/openssl/pkcs7.h
rand.o
:
../include/openssl/rand.h ../include/openssl/rc2.h
rand.o
:
../include/openssl/rc4.h ../include/openssl/rc5.h
rand.o
:
../include/openssl/ripemd.h ../include/openssl/rsa.h
rand.o
:
../include/openssl/safestack.h ../include/openssl/sha.h
rand.o
:
../include/openssl/stack.h ../include/openssl/x509.h
rand.o
:
../include/openssl/x509_vfy.h apps.h
req.o
:
../include/openssl/asn1.h ../include/openssl/bio.h
req.o
:
../include/openssl/blowfish.h ../include/openssl/bn.h
req.o
:
../include/openssl/buffer.h ../include/openssl/cast.h
...
...
apps/app_rand.c
浏览文件 @
27b78273
...
...
@@ -164,7 +164,7 @@ long app_RAND_load_files(char *name)
char
*
p
,
*
n
;
int
last
;
long
tot
=
0
;
int
egd
;
int
egd
;
for
(;;)
{
...
...
apps/progs.h
浏览文件 @
27b78273
...
...
@@ -33,6 +33,7 @@ extern int pkcs12_main(int argc,char *argv[]);
extern
int
pkcs8_main
(
int
argc
,
char
*
argv
[]);
extern
int
spkac_main
(
int
argc
,
char
*
argv
[]);
extern
int
smime_main
(
int
argc
,
char
*
argv
[]);
extern
int
rand_main
(
int
argc
,
char
*
argv
[]);
#define FUNC_TYPE_GENERAL 1
#define FUNC_TYPE_MD 2
...
...
@@ -103,6 +104,7 @@ FUNCTION functions[] = {
{
FUNC_TYPE_GENERAL
,
"pkcs8"
,
pkcs8_main
},
{
FUNC_TYPE_GENERAL
,
"spkac"
,
spkac_main
},
{
FUNC_TYPE_GENERAL
,
"smime"
,
smime_main
},
{
FUNC_TYPE_GENERAL
,
"rand"
,
rand_main
},
{
FUNC_TYPE_MD
,
"md2"
,
dgst_main
},
{
FUNC_TYPE_MD
,
"md5"
,
dgst_main
},
{
FUNC_TYPE_MD
,
"sha"
,
dgst_main
},
...
...
apps/rand.c
0 → 100644
浏览文件 @
27b78273
/* apps/rand.c */
#include "apps.h"
#include <ctype.h>
#include <stdio.h>
#include <openssl/bio.h>
#include <openssl/err.h>
#include <openssl/rand.h>
#undef PROG
#define PROG rand_main
/* -out file - write to file
* -rand file:file - PRNG seed files
* -base64 - encode output
* num - write 'num' bytes
*/
int
MAIN
(
int
,
char
**
);
int
MAIN
(
int
argc
,
char
**
argv
)
{
int
i
,
r
,
ret
=
1
;
int
badopt
;
char
*
outfile
=
NULL
;
char
*
inrand
=
NULL
;
int
base64
=
0
;
BIO
*
out
=
NULL
;
int
num
=
-
1
;
apps_startup
();
if
(
bio_err
==
NULL
)
if
((
bio_err
=
BIO_new
(
BIO_s_file
()))
!=
NULL
)
BIO_set_fp
(
bio_err
,
stderr
,
BIO_NOCLOSE
|
BIO_FP_TEXT
);
badopt
=
0
;
i
=
0
;
while
(
!
badopt
&&
argv
[
++
i
]
!=
NULL
)
{
if
(
strcmp
(
argv
[
i
],
"-out"
)
==
0
)
{
if
((
argv
[
i
+
1
]
!=
NULL
)
&&
(
outfile
==
NULL
))
outfile
=
argv
[
++
i
];
else
badopt
=
1
;
}
else
if
(
strcmp
(
argv
[
i
],
"-rand"
)
==
0
)
{
if
((
argv
[
i
+
1
]
!=
NULL
)
&&
(
inrand
==
NULL
))
inrand
=
argv
[
++
i
];
else
badopt
=
1
;
}
else
if
(
strcmp
(
argv
[
i
],
"-base64"
)
==
0
)
{
if
(
!
base64
)
base64
=
1
;
else
badopt
=
1
;
}
else
if
(
isdigit
(
argv
[
i
][
0
]))
{
if
(
num
<
0
)
{
r
=
sscanf
(
argv
[
i
],
"%d"
,
&
num
);
if
(
r
==
0
||
num
<
0
)
badopt
=
1
;
}
else
badopt
=
1
;
}
else
badopt
=
1
;
}
if
(
num
<
0
)
badopt
=
1
;
if
(
badopt
)
{
BIO_printf
(
bio_err
,
"Usage: rand [options] num
\n
"
);
BIO_printf
(
bio_err
,
"where options are
\n
"
);
BIO_printf
(
bio_err
,
"-out file - write to file
\n
"
);
BIO_printf
(
bio_err
,
"-rand file:file:... - seed PRNG from files
\n
"
);
BIO_printf
(
bio_err
,
"-base64 - encode output
\n
"
);
goto
err
;
}
app_RAND_load_file
(
NULL
,
bio_err
,
(
inrand
!=
NULL
));
if
(
inrand
!=
NULL
)
BIO_printf
(
bio_err
,
"%ld semi-random bytes loaded
\n
"
,
app_RAND_load_files
(
inrand
));
out
=
BIO_new
(
BIO_s_file
());
if
(
out
==
NULL
)
goto
err
;
if
(
outfile
!=
NULL
)
r
=
BIO_write_filename
(
out
,
outfile
);
else
r
=
BIO_set_fp
(
out
,
stdout
,
BIO_NOCLOSE
|
BIO_FP_TEXT
);
if
(
r
<=
0
)
goto
err
;
if
(
base64
)
{
BIO
*
b64
=
BIO_new
(
BIO_f_base64
());
if
(
b64
==
NULL
)
goto
err
;
out
=
BIO_push
(
b64
,
out
);
}
while
(
num
>
0
)
{
unsigned
char
buf
[
4096
];
int
chunk
;
chunk
=
num
;
if
(
chunk
>
sizeof
buf
)
chunk
=
sizeof
buf
;
r
=
RAND_bytes
(
buf
,
chunk
);
if
(
r
<=
0
)
goto
err
;
BIO_write
(
out
,
buf
,
chunk
);
num
-=
chunk
;
}
BIO_flush
(
out
);
app_RAND_write_file
(
NULL
,
bio_err
);
ret
=
0
;
err:
ERR_print_errors
(
bio_err
);
if
(
out
)
BIO_free_all
(
out
);
EXIT
(
ret
);
}
crypto/bio/bio.h
浏览文件 @
27b78273
...
...
@@ -507,7 +507,7 @@ int BIO_set(BIO *a,BIO_METHOD *type);
int
BIO_free
(
BIO
*
a
);
int
BIO_read
(
BIO
*
b
,
void
*
data
,
int
len
);
int
BIO_gets
(
BIO
*
bp
,
char
*
buf
,
int
size
);
int
BIO_write
(
BIO
*
b
,
const
char
*
data
,
int
len
);
int
BIO_write
(
BIO
*
b
,
const
void
*
data
,
int
len
);
int
BIO_puts
(
BIO
*
bp
,
const
char
*
buf
);
long
BIO_ctrl
(
BIO
*
bp
,
int
cmd
,
long
larg
,
void
*
parg
);
long
BIO_callback_ctrl
(
BIO
*
bp
,
int
cmd
,
void
(
*
fp
)());
...
...
crypto/bio/bio_lib.c
浏览文件 @
27b78273
...
...
@@ -169,7 +169,7 @@ int BIO_read(BIO *b, void *out, int outl)
return
(
i
);
}
int
BIO_write
(
BIO
*
b
,
const
char
*
in
,
int
inl
)
int
BIO_write
(
BIO
*
b
,
const
void
*
in
,
int
inl
)
{
int
i
;
long
(
*
cb
)();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录