Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
btwise
openssl
提交
57376542
O
openssl
项目概览
btwise
/
openssl
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
openssl
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
57376542
编写于
2月 28, 2003
作者:
B
Bodo Möller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
use tabs for indentation, not spaces
上级
b8dc9693
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
80 addition
and
80 deletion
+80
-80
ssl/s3_clnt.c
ssl/s3_clnt.c
+80
-80
未找到文件。
ssl/s3_clnt.c
浏览文件 @
57376542
...
...
@@ -785,7 +785,7 @@ static int ssl3_get_server_certificate(SSL *s)
STACK_OF
(
X509
)
*
sk
=
NULL
;
SESS_CERT
*
sc
;
EVP_PKEY
*
pkey
=
NULL
;
int
need_cert
=
1
;
/* VRS: 0=> will allow null cert if auth == KRB5 */
int
need_cert
=
1
;
/* VRS: 0=> will allow null cert if auth == KRB5 */
n
=
ssl3_get_message
(
s
,
SSL3_ST_CR_CERT_A
,
...
...
@@ -860,10 +860,10 @@ static int ssl3_get_server_certificate(SSL *s)
i
=
ssl_verify_cert_chain
(
s
,
sk
);
if
((
s
->
verify_mode
!=
SSL_VERIFY_NONE
)
&&
(
!
i
)
#ifndef OPENSSL_NO_KRB5
&&
(
s
->
s3
->
tmp
.
new_cipher
->
algorithms
&
(
SSL_MKEY_MASK
|
SSL_AUTH_MASK
))
!=
(
SSL_aKRB5
|
SSL_kKRB5
)
&&
(
s
->
s3
->
tmp
.
new_cipher
->
algorithms
&
(
SSL_MKEY_MASK
|
SSL_AUTH_MASK
))
!=
(
SSL_aKRB5
|
SSL_kKRB5
)
#endif
/* OPENSSL_NO_KRB5 */
)
)
{
al
=
ssl_verify_alarm_type
(
s
->
verify_result
);
SSLerr
(
SSL_F_SSL3_GET_SERVER_CERTIFICATE
,
SSL_R_CERTIFICATE_VERIFY_FAILED
);
...
...
@@ -886,16 +886,16 @@ static int ssl3_get_server_certificate(SSL *s)
pkey
=
X509_get_pubkey
(
x
);
/* VRS: allow null cert if auth == KRB5 */
need_cert
=
((
s
->
s3
->
tmp
.
new_cipher
->
algorithms
&
(
SSL_MKEY_MASK
|
SSL_AUTH_MASK
))
==
(
SSL_aKRB5
|
SSL_kKRB5
))
?
0
:
1
;
/* VRS: allow null cert if auth == KRB5 */
need_cert
=
((
s
->
s3
->
tmp
.
new_cipher
->
algorithms
&
(
SSL_MKEY_MASK
|
SSL_AUTH_MASK
))
==
(
SSL_aKRB5
|
SSL_kKRB5
))
?
0
:
1
;
#ifdef KSSL_DEBUG
printf
(
"pkey,x = %p, %p
\n
"
,
pkey
,
x
);
printf
(
"ssl_cert_type(x,pkey) = %d
\n
"
,
ssl_cert_type
(
x
,
pkey
));
printf
(
"cipher, alg, nc = %s, %lx, %d
\n
"
,
s
->
s3
->
tmp
.
new_cipher
->
name
,
s
->
s3
->
tmp
.
new_cipher
->
algorithms
,
need_cert
);
s
->
s3
->
tmp
.
new_cipher
->
algorithms
,
need_cert
);
#endif
/* KSSL_DEBUG */
if
(
need_cert
&&
((
pkey
==
NULL
)
||
EVP_PKEY_missing_parameters
(
pkey
)))
...
...
@@ -917,31 +917,31 @@ static int ssl3_get_server_certificate(SSL *s)
goto
f_err
;
}
if
(
need_cert
)
{
sc
->
peer_cert_type
=
i
;
CRYPTO_add
(
&
x
->
references
,
1
,
CRYPTO_LOCK_X509
);
/* Why would the following ever happen?
* We just created sc a couple of lines ago. */
if
(
sc
->
peer_pkeys
[
i
].
x509
!=
NULL
)
X509_free
(
sc
->
peer_pkeys
[
i
].
x509
);
sc
->
peer_pkeys
[
i
].
x509
=
x
;
sc
->
peer_key
=
&
(
sc
->
peer_pkeys
[
i
]);
if
(
s
->
session
->
peer
!=
NULL
)
X509_free
(
s
->
session
->
peer
);
CRYPTO_add
(
&
x
->
references
,
1
,
CRYPTO_LOCK_X509
);
s
->
session
->
peer
=
x
;
}
else
{
sc
->
peer_cert_type
=
i
;
sc
->
peer_key
=
NULL
;
if
(
s
->
session
->
peer
!=
NULL
)
X509_free
(
s
->
session
->
peer
);
s
->
session
->
peer
=
NULL
;
}
if
(
need_cert
)
{
sc
->
peer_cert_type
=
i
;
CRYPTO_add
(
&
x
->
references
,
1
,
CRYPTO_LOCK_X509
);
/* Why would the following ever happen?
* We just created sc a couple of lines ago. */
if
(
sc
->
peer_pkeys
[
i
].
x509
!=
NULL
)
X509_free
(
sc
->
peer_pkeys
[
i
].
x509
);
sc
->
peer_pkeys
[
i
].
x509
=
x
;
sc
->
peer_key
=
&
(
sc
->
peer_pkeys
[
i
]);
if
(
s
->
session
->
peer
!=
NULL
)
X509_free
(
s
->
session
->
peer
);
CRYPTO_add
(
&
x
->
references
,
1
,
CRYPTO_LOCK_X509
);
s
->
session
->
peer
=
x
;
}
else
{
sc
->
peer_cert_type
=
i
;
sc
->
peer_key
=
NULL
;
if
(
s
->
session
->
peer
!=
NULL
)
X509_free
(
s
->
session
->
peer
);
s
->
session
->
peer
=
NULL
;
}
s
->
session
->
verify_result
=
s
->
verify_result
;
x
=
NULL
;
...
...
@@ -1584,7 +1584,7 @@ static int ssl3_send_client_key_exchange(SSL *s)
EVP_PKEY
*
pkey
=
NULL
;
#endif
#ifndef OPENSSL_NO_KRB5
KSSL_ERR
kssl_err
;
KSSL_ERR
kssl_err
;
#endif
/* OPENSSL_NO_KRB5 */
#ifndef OPENSSL_NO_ECDH
EC_KEY
*
clnt_ecdh
=
NULL
;
...
...
@@ -1602,8 +1602,8 @@ static int ssl3_send_client_key_exchange(SSL *s)
l
=
s
->
s3
->
tmp
.
new_cipher
->
algorithms
;
/* Fool emacs indentation */
if
(
0
)
{}
/* Fool emacs indentation */
if
(
0
)
{}
#ifndef OPENSSL_NO_RSA
else
if
(
l
&
SSL_kRSA
)
{
...
...
@@ -1665,12 +1665,12 @@ static int ssl3_send_client_key_exchange(SSL *s)
#endif
#ifndef OPENSSL_NO_KRB5
else
if
(
l
&
SSL_kKRB5
)
{
krb5_error_code
krb5rc
;
KSSL_CTX
*
kssl_ctx
=
s
->
kssl_ctx
;
/* krb5_data krb5_ap_req; */
krb5_data
*
enc_ticket
;
krb5_data
authenticator
,
*
authp
=
NULL
;
{
krb5_error_code
krb5rc
;
KSSL_CTX
*
kssl_ctx
=
s
->
kssl_ctx
;
/* krb5_data krb5_ap_req; */
krb5_data
*
enc_ticket
;
krb5_data
authenticator
,
*
authp
=
NULL
;
EVP_CIPHER_CTX
ciph_ctx
;
EVP_CIPHER
*
enc
=
NULL
;
unsigned
char
iv
[
EVP_MAX_IV_LENGTH
];
...
...
@@ -1682,8 +1682,8 @@ static int ssl3_send_client_key_exchange(SSL *s)
EVP_CIPHER_CTX_init
(
&
ciph_ctx
);
#ifdef KSSL_DEBUG
printf
(
"ssl3_send_client_key_exchange(%lx & %lx)
\n
"
,
l
,
SSL_kKRB5
);
printf
(
"ssl3_send_client_key_exchange(%lx & %lx)
\n
"
,
l
,
SSL_kKRB5
);
#endif
/* KSSL_DEBUG */
authp
=
NULL
;
...
...
@@ -1691,37 +1691,37 @@ static int ssl3_send_client_key_exchange(SSL *s)
if
(
KRB5SENDAUTH
)
authp
=
&
authenticator
;
#endif
/* KRB5SENDAUTH */
krb5rc
=
kssl_cget_tkt
(
kssl_ctx
,
&
enc_ticket
,
authp
,
krb5rc
=
kssl_cget_tkt
(
kssl_ctx
,
&
enc_ticket
,
authp
,
&
kssl_err
);
enc
=
kssl_map_enc
(
kssl_ctx
->
enctype
);
if
(
enc
==
NULL
)
goto
err
;
if
(
enc
==
NULL
)
goto
err
;
#ifdef KSSL_DEBUG
{
printf
(
"kssl_cget_tkt rtn %d
\n
"
,
krb5rc
);
if
(
krb5rc
&&
kssl_err
.
text
)
{
printf
(
"kssl_cget_tkt rtn %d
\n
"
,
krb5rc
);
if
(
krb5rc
&&
kssl_err
.
text
)
printf
(
"kssl_cget_tkt kssl_err=%s
\n
"
,
kssl_err
.
text
);
}
}
#endif
/* KSSL_DEBUG */
if
(
krb5rc
)
{
ssl3_send_alert
(
s
,
SSL3_AL_FATAL
,
if
(
krb5rc
)
{
ssl3_send_alert
(
s
,
SSL3_AL_FATAL
,
SSL_AD_HANDSHAKE_FAILURE
);
SSLerr
(
SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE
,
SSLerr
(
SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE
,
kssl_err
.
reason
);
goto
err
;
}
goto
err
;
}
/* 20010406 VRS - Earlier versions used KRB5 AP_REQ
** in place of RFC 2712 KerberosWrapper, as in:
**
** Send ticket (copy to *p, set n = length)
** n = krb5_ap_req.length;
** memcpy(p, krb5_ap_req.data, krb5_ap_req.length);
** if (krb5_ap_req.data)
** kssl_krb5_free_data_contents(NULL,&krb5_ap_req);
**
** Send ticket (copy to *p, set n = length)
** n = krb5_ap_req.length;
** memcpy(p, krb5_ap_req.data, krb5_ap_req.length);
** if (krb5_ap_req.data)
** kssl_krb5_free_data_contents(NULL,&krb5_ap_req);
**
** Now using real RFC 2712 KerberosWrapper
** (Thanks to Simon Wilkinson <sxw@sxw.org.uk>)
** Note: 2712 "opaque" types are here replaced
...
...
@@ -1786,14 +1786,14 @@ static int ssl3_send_client_key_exchange(SSL *s)
p
+=
outl
;
n
+=
outl
+
2
;
s
->
session
->
master_key_length
=
s
->
method
->
ssl3_enc
->
generate_master_secret
(
s
,
s
->
session
->
master_key_length
=
s
->
method
->
ssl3_enc
->
generate_master_secret
(
s
,
s
->
session
->
master_key
,
tmp_buf
,
sizeof
tmp_buf
);
OPENSSL_cleanse
(
tmp_buf
,
sizeof
tmp_buf
);
OPENSSL_cleanse
(
epms
,
outl
);
}
}
#endif
#ifndef OPENSSL_NO_DH
else
if
(
l
&
(
SSL_kEDH
|
SSL_kDHr
|
SSL_kDHd
))
...
...
@@ -1928,7 +1928,7 @@ static int ssl3_send_client_key_exchange(SSL *s)
clnt_ecdh
->
group
=
srvr_group
;
if
(
ecdh_clnt_cert
)
{
/* Reuse key info from our certificate
/* Reuse key info from our certificate
* We only need our private key to perform
* the ECDH computation.
*/
...
...
@@ -1945,25 +1945,25 @@ static int ssl3_send_client_key_exchange(SSL *s)
}
}
/* use the 'p' output buffer for the ECDH key, but
* make sure to clear it out afterwards
/* use the 'p' output buffer for the ECDH key, but
* make sure to clear it out afterwards
*/
n
=
ECDH_compute_key
(
p
,
srvr_ecpoint
,
clnt_ecdh
);
n
=
ECDH_compute_key
(
p
,
srvr_ecpoint
,
clnt_ecdh
);
if
(
n
<=
0
)
{
SSLerr
(
SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE
,
{
SSLerr
(
SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE
,
ERR_R_ECDH_LIB
);
goto
err
;
goto
err
;
}
/* generate master key from the result */
s
->
session
->
master_key_length
=
s
->
method
->
ssl3_enc
\
/* generate master key from the result */
s
->
session
->
master_key_length
=
s
->
method
->
ssl3_enc
\
->
generate_master_secret
(
s
,
s
->
session
->
master_key
,
p
,
n
);
memset
(
p
,
0
,
n
);
/* clean up */
memset
(
p
,
0
,
n
);
/* clean up */
if
(
ecdh_clnt_cert
)
{
...
...
@@ -1999,7 +1999,7 @@ static int ssl3_send_client_key_exchange(SSL *s)
encodedPoint
,
encoded_pt_len
,
bn_ctx
);
*
p
=
n
;
/* length of encoded point */
/* Encoded point will be copied here */
/* Encoded point will be copied here */
p
+=
1
;
/* copy the point */
memcpy
((
unsigned
char
*
)
p
,
encodedPoint
,
n
);
...
...
@@ -2012,7 +2012,7 @@ static int ssl3_send_client_key_exchange(SSL *s)
if
(
encodedPoint
!=
NULL
)
OPENSSL_free
(
encodedPoint
);
if
(
clnt_ecdh
!=
NULL
)
{
/* group is shared */
/* group is shared */
clnt_ecdh
->
group
=
NULL
;
EC_KEY_free
(
clnt_ecdh
);
}
...
...
@@ -2049,7 +2049,7 @@ err:
clnt_ecdh
->
group
=
NULL
;
EC_KEY_free
(
clnt_ecdh
);
}
EVP_PKEY_free
(
srvr_pub_pkey
);
EVP_PKEY_free
(
srvr_pub_pkey
);
#endif
return
(
-
1
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录