Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
df29cc8f
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 搜索 >>
提交
df29cc8f
编写于
11月 27, 2002
作者:
R
Richard Levitte
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add OPENSSL_cleanse() to help cleanse memory and avoid certain compiler
and linker optimizations. PR: 343
上级
ec716413
变更
7
展开全部
显示空白变更内容
内联
并排
Showing
7 changed file
with
294 addition
and
190 deletion
+294
-190
CHANGES
CHANGES
+8
-0
crypto/Makefile.ssl
crypto/Makefile.ssl
+6
-2
crypto/crypto-lib.com
crypto/crypto-lib.com
+1
-1
crypto/crypto.h
crypto/crypto.h
+2
-0
crypto/mem.c
crypto/mem.c
+14
-0
crypto/mem_clr.c
crypto/mem_clr.c
+75
-0
util/libeay.num
util/libeay.num
+188
-187
未找到文件。
CHANGES
浏览文件 @
df29cc8f
...
...
@@ -2116,6 +2116,14 @@ des-cbc 3624.96k 5258.21k 5530.91k 5624.30k 5628.26k
Changes between 0.9.6g and 0.9.6h [xx XXX xxxx]
*) New function OPENSSL_cleanse(), which is used to cleanse a section of
memory from it's contents. This is done with a counter that will
place alternating values in each byte. This can be used to solve
two issues: 1) the removal of calls to memset() by highly optimizing
compilers, and 2) cleansing with other values than 0, since those can
be read through on certain media, for example a swap space on disk.
[Geoff Thorpe]
*) Bugfix: client side session caching did not work with external caching,
because the session->cipher setting was not restored when reloading
from the external cache. This problem was masked, when
...
...
crypto/Makefile.ssl
浏览文件 @
df29cc8f
...
...
@@ -36,8 +36,8 @@ GENERAL=Makefile README crypto-lib.com install.com
LIB
=
$(TOP)
/libcrypto.a
SHARED_LIB
=
libcrypto
$(SHLIB_EXT)
LIBSRC
=
cryptlib.c mem.c mem_dbg.c cversion.c ex_data.c tmdiff.c cpt_err.c ebcdic.c uid.c o_time.c
LIBOBJ
=
cryptlib.o mem.o mem_dbg.o cversion.o ex_data.o tmdiff.o cpt_err.o ebcdic.o uid.o o_time.o
LIBSRC
=
cryptlib.c mem.c mem_
clr.c mem_
dbg.c cversion.c ex_data.c tmdiff.c cpt_err.c ebcdic.c uid.c o_time.c
LIBOBJ
=
cryptlib.o mem.o mem_
clr.o mem_
dbg.o cversion.o ex_data.o tmdiff.o cpt_err.o ebcdic.o uid.o o_time.o
SRC
=
$(LIBSRC)
...
...
@@ -193,6 +193,10 @@ mem.o: ../include/openssl/err.h ../include/openssl/lhash.h
mem.o
:
../include/openssl/opensslconf.h ../include/openssl/opensslv.h
mem.o
:
../include/openssl/safestack.h ../include/openssl/stack.h
mem.o
:
../include/openssl/symhacks.h cryptlib.h mem.c
mem_clr.o
:
../include/openssl/crypto.h ../include/openssl/e_os2.h
mem_clr.o
:
../include/openssl/opensslconf.h ../include/openssl/opensslv.h
mem_clr.o
:
../include/openssl/safestack.h ../include/openssl/stack.h
mem_clr.o
:
../include/openssl/symhacks.h mem_clr.c
mem_dbg.o
:
../e_os.h ../include/openssl/bio.h ../include/openssl/buffer.h
mem_dbg.o
:
../include/openssl/crypto.h ../include/openssl/e_os2.h
mem_dbg.o
:
../include/openssl/err.h ../include/openssl/lhash.h
...
...
crypto/crypto-lib.com
浏览文件 @
df29cc8f
...
...
@@ -158,7 +158,7 @@ $!
$ APPS_DES = "DES/DES,CBC3_ENC"
$ APPS_PKCS7 = "ENC/ENC;DEC/DEC;SIGN/SIGN;VERIFY/VERIFY,EXAMPLE"
$
$ LIB_ = "cryptlib,mem,mem_dbg,cversion,ex_data,tmdiff,cpt_err,ebcdic,uid,o_time"
$ LIB_ = "cryptlib,mem,mem_
clr,mem_
dbg,cversion,ex_data,tmdiff,cpt_err,ebcdic,uid,o_time"
$ LIB_MD2 = "md2_dgst,md2_one"
$ LIB_MD4 = "md4_dgst,md4_one"
$ LIB_MD5 = "md5_dgst,md5_one"
...
...
crypto/crypto.h
浏览文件 @
df29cc8f
...
...
@@ -454,6 +454,8 @@ void *CRYPTO_realloc_clean(void *addr,int old_num,int num,const char *file,
int
line
);
void
*
CRYPTO_remalloc
(
void
*
addr
,
int
num
,
const
char
*
file
,
int
line
);
void
OPENSSL_cleanse
(
void
*
ptr
,
size_t
len
);
void
CRYPTO_set_mem_debug_options
(
long
bits
);
long
CRYPTO_get_mem_debug_options
(
void
);
...
...
crypto/mem.c
浏览文件 @
df29cc8f
...
...
@@ -250,6 +250,7 @@ void CRYPTO_get_mem_debug_functions(void (**m)(void *,int,const char *,int,int),
void
*
CRYPTO_malloc_locked
(
int
num
,
const
char
*
file
,
int
line
)
{
void
*
ret
=
NULL
;
extern
unsigned
char
cleanse_ctr
;
allow_customize
=
0
;
if
(
malloc_debug_func
!=
NULL
)
...
...
@@ -264,6 +265,12 @@ void *CRYPTO_malloc_locked(int num, const char *file, int line)
if
(
malloc_debug_func
!=
NULL
)
malloc_debug_func
(
ret
,
num
,
file
,
line
,
1
);
/* Create a dependency on the value of 'cleanse_ctr' so our memory
* sanitisation function can't be optimised out. NB: We only do
* this for >2Kb so the overhead doesn't bother us. */
if
(
ret
&&
(
num
>
2048
))
((
unsigned
char
*
)
ret
)[
0
]
=
cleanse_ctr
;
return
ret
;
}
...
...
@@ -282,6 +289,7 @@ void CRYPTO_free_locked(void *str)
void
*
CRYPTO_malloc
(
int
num
,
const
char
*
file
,
int
line
)
{
void
*
ret
=
NULL
;
extern
unsigned
char
cleanse_ctr
;
allow_customize
=
0
;
if
(
malloc_debug_func
!=
NULL
)
...
...
@@ -296,6 +304,12 @@ void *CRYPTO_malloc(int num, const char *file, int line)
if
(
malloc_debug_func
!=
NULL
)
malloc_debug_func
(
ret
,
num
,
file
,
line
,
1
);
/* Create a dependency on the value of 'cleanse_ctr' so our memory
* sanitisation function can't be optimised out. NB: We only do
* this for >2Kb so the overhead doesn't bother us. */
if
(
ret
&&
(
num
>
2048
))
((
unsigned
char
*
)
ret
)[
0
]
=
cleanse_ctr
;
return
ret
;
}
...
...
crypto/mem_clr.c
0 → 100644
浏览文件 @
df29cc8f
/* crypto/mem_clr.c -*- mode:C; c-file-style: "eay" -*- */
/* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL
* project 2002.
*/
/* ====================================================================
* Copyright (c) 2001 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. All advertising materials mentioning features or use of this
* software must display the following acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
*
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
* endorse or promote products derived from this software without
* prior written permission. For written permission, please contact
* openssl-core@openssl.org.
*
* 5. Products derived from this software may not be called "OpenSSL"
* nor may "OpenSSL" appear in their names without prior written
* permission of the OpenSSL Project.
*
* 6. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit (http://www.openssl.org/)"
*
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
* ====================================================================
*
* This product includes cryptographic software written by Eric Young
* (eay@cryptsoft.com). This product includes software written by Tim
* Hudson (tjh@cryptsoft.com).
*
*/
#include <string.h>
#include <openssl/crypto.h>
unsigned
char
cleanse_ctr
=
0
;
void
OPENSSL_cleanse
(
void
*
ptr
,
size_t
len
)
{
unsigned
char
*
p
=
ptr
;
size_t
loop
=
len
;
while
(
loop
--
)
{
*
(
p
++
)
=
cleanse_ctr
;
cleanse_ctr
+=
(
17
+
(((
unsigned
char
*
)
&
p
)[
sizeof
(
unsigned
char
*
)
-
1
]
&
0xF
));
}
if
(
memchr
(
ptr
,
cleanse_ctr
,
len
))
cleanse_ctr
+=
63
;
}
util/libeay.num
浏览文件 @
df29cc8f
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录