Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
35a1cc90
T
Third Party Openssl
项目概览
OpenHarmony
/
Third Party Openssl
1 年多 前同步成功
通知
10
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看板
提交
35a1cc90
编写于
1月 17, 2015
作者:
M
Matt Caswell
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
More comment realignment
Reviewed-by:
N
Tim Hudson
<
tjh@openssl.org
>
上级
50e735f9
变更
41
隐藏空白更改
内联
并排
Showing
41 changed file
with
403 addition
and
398 deletion
+403
-398
apps/gendh.c
apps/gendh.c
+2
-2
apps/s_cb.c
apps/s_cb.c
+4
-4
apps/s_client.c
apps/s_client.c
+2
-2
crypto/bio/b_sock.c
crypto/bio/b_sock.c
+7
-7
crypto/bio/bf_null.c
crypto/bio/bf_null.c
+5
-5
crypto/bio/bss_acpt.c
crypto/bio/bss_acpt.c
+6
-6
crypto/bn/bn_kron.c
crypto/bn/bn_kron.c
+7
-7
crypto/bn/bn_print.c
crypto/bn/bn_print.c
+6
-6
crypto/bn/bn_sqrt.c
crypto/bn/bn_sqrt.c
+26
-26
crypto/cast/casttest.c
crypto/cast/casttest.c
+3
-3
crypto/des/destest.c
crypto/des/destest.c
+1
-1
crypto/des/enc_read.c
crypto/des/enc_read.c
+6
-6
crypto/des/ofb64ede.c
crypto/des/ofb64ede.c
+2
-2
crypto/ec/ecp_nistp256.c
crypto/ec/ecp_nistp256.c
+40
-37
crypto/ec/ecp_nistp521.c
crypto/ec/ecp_nistp521.c
+23
-22
crypto/ec/ecp_oct.c
crypto/ec/ecp_oct.c
+5
-5
crypto/ec/ecp_smpl.c
crypto/ec/ecp_smpl.c
+25
-25
crypto/idea/ideatest.c
crypto/idea/ideatest.c
+3
-3
crypto/lhash/lhash.c
crypto/lhash/lhash.c
+3
-3
crypto/pem/pem.h
crypto/pem/pem.h
+5
-5
crypto/rand/randfile.c
crypto/rand/randfile.c
+4
-4
crypto/rc2/rc2test.c
crypto/rc2/rc2test.c
+3
-3
crypto/threads/mttest.c
crypto/threads/mttest.c
+15
-15
crypto/x509/by_dir.c
crypto/x509/by_dir.c
+2
-2
crypto/x509/x509_lu.c
crypto/x509/x509_lu.c
+2
-2
crypto/x509/x509_r2x.c
crypto/x509/x509_r2x.c
+2
-2
crypto/x509/x509_vfy.c
crypto/x509/x509_vfy.c
+9
-9
crypto/x509/x509name.c
crypto/x509/x509name.c
+10
-10
crypto/x509v3/v3_utl.c
crypto/x509v3/v3_utl.c
+5
-5
demos/engines/zencod/hw_zencod.h
demos/engines/zencod/hw_zencod.h
+8
-8
engines/ccgost/gost_ctl.c
engines/ccgost/gost_ctl.c
+13
-13
engines/e_cswift.c
engines/e_cswift.c
+5
-5
ssl/d1_pkt.c
ssl/d1_pkt.c
+11
-11
ssl/s3_cbc.c
ssl/s3_cbc.c
+19
-19
ssl/s3_clnt.c
ssl/s3_clnt.c
+37
-37
ssl/s3_enc.c
ssl/s3_enc.c
+8
-7
ssl/ssl_lib.c
ssl/ssl_lib.c
+4
-4
ssl/ssl_sess.c
ssl/ssl_sess.c
+15
-15
ssl/ssl_task.c
ssl/ssl_task.c
+2
-2
ssl/ssltest.c
ssl/ssltest.c
+42
-42
test/methtest.c
test/methtest.c
+6
-6
未找到文件。
apps/gendh.c
浏览文件 @
35a1cc90
...
@@ -120,8 +120,8 @@ int MAIN(int argc, char **argv)
...
@@ -120,8 +120,8 @@ int MAIN(int argc, char **argv)
outfile
=
*
(
++
argv
);
outfile
=
*
(
++
argv
);
}
else
if
(
strcmp
(
*
argv
,
"-2"
)
==
0
)
}
else
if
(
strcmp
(
*
argv
,
"-2"
)
==
0
)
g
=
2
;
g
=
2
;
/*- else if (strcmp(*argv,"-3") == 0)
/*- else if (strcmp(*argv,"-3") == 0)
g=3; */
g=3; */
else
if
(
strcmp
(
*
argv
,
"-5"
)
==
0
)
else
if
(
strcmp
(
*
argv
,
"-5"
)
==
0
)
g
=
5
;
g
=
5
;
# ifndef OPENSSL_NO_ENGINE
# ifndef OPENSSL_NO_ENGINE
...
...
apps/s_cb.c
浏览文件 @
35a1cc90
...
@@ -200,10 +200,10 @@ int verify_callback(int ok, X509_STORE_CTX *ctx)
...
@@ -200,10 +200,10 @@ int verify_callback(int ok, X509_STORE_CTX *ctx)
int
set_cert_stuff
(
SSL_CTX
*
ctx
,
char
*
cert_file
,
char
*
key_file
)
int
set_cert_stuff
(
SSL_CTX
*
ctx
,
char
*
cert_file
,
char
*
key_file
)
{
{
if
(
cert_file
!=
NULL
)
{
if
(
cert_file
!=
NULL
)
{
/*-
/*-
SSL *ssl;
SSL *ssl;
X509 *x509;
X509 *x509;
*/
*/
if
(
SSL_CTX_use_certificate_file
(
ctx
,
cert_file
,
if
(
SSL_CTX_use_certificate_file
(
ctx
,
cert_file
,
SSL_FILETYPE_PEM
)
<=
0
)
{
SSL_FILETYPE_PEM
)
<=
0
)
{
...
...
apps/s_client.c
浏览文件 @
35a1cc90
...
@@ -1749,8 +1749,8 @@ int MAIN(int argc, char **argv)
...
@@ -1749,8 +1749,8 @@ int MAIN(int argc, char **argv)
openssl_fdset
(
SSL_get_fd
(
con
),
&
writefds
);
openssl_fdset
(
SSL_get_fd
(
con
),
&
writefds
);
}
}
#endif
#endif
/*-
printf("mode tty(%d %d%d) ssl(%d%d)\n",
/*- printf("mode tty(%d %d%d) ssl(%d%d)\n",
tty_on,read_tty,write_tty,read_ssl,write_ssl);*/
tty_on,read_tty,write_tty,read_ssl,write_ssl);*/
/*
/*
* Note: under VMS with SOCKETSHR the second parameter is
* Note: under VMS with SOCKETSHR the second parameter is
...
...
crypto/bio/b_sock.c
浏览文件 @
35a1cc90
...
@@ -529,13 +529,13 @@ int BIO_socket_ioctl(int fd, long type, void *arg)
...
@@ -529,13 +529,13 @@ int BIO_socket_ioctl(int fd, long type, void *arg)
i
=
ioctlsocket
(
fd
,
type
,
(
char
*
)
arg
);
i
=
ioctlsocket
(
fd
,
type
,
(
char
*
)
arg
);
# else
# else
# if defined(OPENSSL_SYS_VMS)
# if defined(OPENSSL_SYS_VMS)
/*-
/*-
* 2011-02-18 SMS.
* 2011-02-18 SMS.
* VMS ioctl() can't tolerate a 64-bit "void *arg", but we
* VMS ioctl() can't tolerate a 64-bit "void *arg", but we
* observe that all the consumers pass in an "unsigned long *",
* observe that all the consumers pass in an "unsigned long *",
* so we arrange a local copy with a short pointer, and use
* so we arrange a local copy with a short pointer, and use
* that, instead.
* that, instead.
*/
*/
# if __INITIAL_POINTER_SIZE == 64
# if __INITIAL_POINTER_SIZE == 64
# define ARG arg_32p
# define ARG arg_32p
# pragma pointer_size save
# pragma pointer_size save
...
...
crypto/bio/bf_null.c
浏览文件 @
35a1cc90
...
@@ -103,11 +103,11 @@ static int nullf_free(BIO *a)
...
@@ -103,11 +103,11 @@ static int nullf_free(BIO *a)
{
{
if
(
a
==
NULL
)
if
(
a
==
NULL
)
return
(
0
);
return
(
0
);
/*-
/*-
a->ptr=NULL;
a->ptr=NULL;
a->init=0;
a->init=0;
a->flags=0;
a->flags=0;
*/
*/
return
(
1
);
return
(
1
);
}
}
...
...
crypto/bio/bss_acpt.c
浏览文件 @
35a1cc90
...
@@ -415,12 +415,12 @@ static long acpt_ctrl(BIO *b, int cmd, long num, void *ptr)
...
@@ -415,12 +415,12 @@ static long acpt_ctrl(BIO *b, int cmd, long num, void *ptr)
ret
=
(
long
)
data
->
bind_mode
;
ret
=
(
long
)
data
->
bind_mode
;
break
;
break
;
case
BIO_CTRL_DUP
:
case
BIO_CTRL_DUP
:
/*-
dbio=(BIO *)ptr;
/*- dbio=(BIO *)ptr;
if (data->param_port) EAY EAY
if (data->param_port) EAY EAY
BIO_set_port(dbio,data->param_port);
BIO_set_port(dbio,data->param_port);
if (data->param_hostname)
if (data->param_hostname)
BIO_set_hostname(dbio,data->param_hostname);
BIO_set_hostname(dbio,data->param_hostname);
BIO_set_nbio(dbio,data->nbio); */
BIO_set_nbio(dbio,data->nbio); */
break
;
break
;
default:
default:
...
...
crypto/bn/bn_kron.c
浏览文件 @
35a1cc90
...
@@ -66,13 +66,13 @@ int BN_kronecker(const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
...
@@ -66,13 +66,13 @@ int BN_kronecker(const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
int
ret
=
-
2
;
/* avoid 'uninitialized' warning */
int
ret
=
-
2
;
/* avoid 'uninitialized' warning */
int
err
=
0
;
int
err
=
0
;
BIGNUM
*
A
,
*
B
,
*
tmp
;
BIGNUM
*
A
,
*
B
,
*
tmp
;
/*-
/*-
* In 'tab', only odd-indexed entries are relevant:
* In 'tab', only odd-indexed entries are relevant:
* For any odd BIGNUM n,
* For any odd BIGNUM n,
* tab[BN_lsw(n) & 7]
* tab[BN_lsw(n) & 7]
* is $(-1)^{(n^2-1)/8}$ (using TeX notation).
* is $(-1)^{(n^2-1)/8}$ (using TeX notation).
* Note that the sign of n does not matter.
* Note that the sign of n does not matter.
*/
*/
static
const
int
tab
[
8
]
=
{
0
,
1
,
0
,
-
1
,
0
,
-
1
,
0
,
1
};
static
const
int
tab
[
8
]
=
{
0
,
1
,
0
,
-
1
,
0
,
-
1
,
0
,
1
};
bn_check_top
(
a
);
bn_check_top
(
a
);
...
...
crypto/bn/bn_print.c
浏览文件 @
35a1cc90
...
@@ -106,12 +106,12 @@ char *BN_bn2dec(const BIGNUM *a)
...
@@ -106,12 +106,12 @@ char *BN_bn2dec(const BIGNUM *a)
BIGNUM
*
t
=
NULL
;
BIGNUM
*
t
=
NULL
;
BN_ULONG
*
bn_data
=
NULL
,
*
lp
;
BN_ULONG
*
bn_data
=
NULL
,
*
lp
;
/*-
/*-
* get an upper bound for the length of the decimal integer
* get an upper bound for the length of the decimal integer
* num <= (BN_num_bits(a) + 1) * log(2)
* num <= (BN_num_bits(a) + 1) * log(2)
* <= 3 * BN_num_bits(a) * 0.1001 + log(2) + 1 (rounding error)
* <= 3 * BN_num_bits(a) * 0.1001 + log(2) + 1 (rounding error)
* <= BN_num_bits(a)/10 + BN_num_bits/1000 + 1 + 1
* <= BN_num_bits(a)/10 + BN_num_bits/1000 + 1 + 1
*/
*/
i
=
BN_num_bits
(
a
)
*
3
;
i
=
BN_num_bits
(
a
)
*
3
;
num
=
(
i
/
10
+
i
/
1000
+
1
)
+
1
;
num
=
(
i
/
10
+
i
/
1000
+
1
)
+
1
;
bn_data
=
bn_data
=
...
...
crypto/bn/bn_sqrt.c
浏览文件 @
35a1cc90
...
@@ -152,32 +152,32 @@ BIGNUM *BN_mod_sqrt(BIGNUM *in, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx)
...
@@ -152,32 +152,32 @@ BIGNUM *BN_mod_sqrt(BIGNUM *in, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx)
}
}
if
(
e
==
2
)
{
if
(
e
==
2
)
{
/*-
/*-
* |p| == 5 (mod 8)
* |p| == 5 (mod 8)
*
*
* In this case 2 is always a non-square since
* In this case 2 is always a non-square since
* Legendre(2,p) = (-1)^((p^2-1)/8) for any odd prime.
* Legendre(2,p) = (-1)^((p^2-1)/8) for any odd prime.
* So if a really is a square, then 2*a is a non-square.
* So if a really is a square, then 2*a is a non-square.
* Thus for
* Thus for
* b := (2*a)^((|p|-5)/8),
* b := (2*a)^((|p|-5)/8),
* i := (2*a)*b^2
* i := (2*a)*b^2
* we have
* we have
* i^2 = (2*a)^((1 + (|p|-5)/4)*2)
* i^2 = (2*a)^((1 + (|p|-5)/4)*2)
* = (2*a)^((p-1)/2)
* = (2*a)^((p-1)/2)
* = -1;
* = -1;
* so if we set
* so if we set
* x := a*b*(i-1),
* x := a*b*(i-1),
* then
* then
* x^2 = a^2 * b^2 * (i^2 - 2*i + 1)
* x^2 = a^2 * b^2 * (i^2 - 2*i + 1)
* = a^2 * b^2 * (-2*i)
* = a^2 * b^2 * (-2*i)
* = a*(-i)*(2*a*b^2)
* = a*(-i)*(2*a*b^2)
* = a*(-i)*i
* = a*(-i)*i
* = a.
* = a.
*
*
* (This is due to A.O.L. Atkin,
* (This is due to A.O.L. Atkin,
* <URL: http://listserv.nodak.edu/scripts/wa.exe?A2=ind9211&L=nmbrthry&O=T&P=562>,
* <URL: http://listserv.nodak.edu/scripts/wa.exe?A2=ind9211&L=nmbrthry&O=T&P=562>,
* November 1992.)
* November 1992.)
*/
*/
/* t := 2*a */
/* t := 2*a */
if
(
!
BN_mod_lshift1_quick
(
t
,
A
,
p
))
if
(
!
BN_mod_lshift1_quick
(
t
,
A
,
p
))
...
...
crypto/cast/casttest.c
浏览文件 @
35a1cc90
...
@@ -134,9 +134,9 @@ static unsigned char cfb_cipher64[CFB_TEST_SIZE] = {
...
@@ -134,9 +134,9 @@ static unsigned char cfb_cipher64[CFB_TEST_SIZE] = {
0x59
,
0xD8
,
0xE2
,
0x65
,
0x00
,
0x58
,
0x6C
,
0x3F
,
0x59
,
0xD8
,
0xE2
,
0x65
,
0x00
,
0x58
,
0x6C
,
0x3F
,
0x2C
,
0x17
,
0x25
,
0xD0
,
0x1A
,
0x38
,
0xB7
,
0x2A
,
0x2C
,
0x17
,
0x25
,
0xD0
,
0x1A
,
0x38
,
0xB7
,
0x2A
,
0x39
,
0x61
,
0x37
,
0xDC
,
0x79
,
0xFB
,
0x9F
,
0x45
0x39
,
0x61
,
0x37
,
0xDC
,
0x79
,
0xFB
,
0x9F
,
0x45
/*-
0xF9,0x78,0x32,0xB5,0x42,0x1A,0x6B,0x38,
/*- 0xF9,0x78,0x32,0xB5,0x42,0x1A,0x6B,0x38,
0x9A,0x44,0xD6,0x04,0x19,0x43,0xC4,0xD9,
0x9A,0x44,0xD6,0x04,0x19,0x43,0xC4,0xD9,
0x3D,0x1E,0xAE,0x47,0xFC,0xCF,0x29,0x0B,*/
0x3D,0x1E,0xAE,0x47,0xFC,0xCF,0x29,0x0B,*/
};
};
# endif
# endif
...
...
crypto/des/destest.c
浏览文件 @
35a1cc90
...
@@ -397,7 +397,7 @@ int main(int argc, char *argv[])
...
@@ -397,7 +397,7 @@ int main(int argc, char *argv[])
DES_ENCRYPT
);
DES_ENCRYPT
);
DES_ede3_cbcm_encrypt
(
&
cbc_data
[
16
],
&
cbc_out
[
16
],
i
-
16
,
&
ks
,
&
ks2
,
DES_ede3_cbcm_encrypt
(
&
cbc_data
[
16
],
&
cbc_out
[
16
],
i
-
16
,
&
ks
,
&
ks2
,
&
ks3
,
&
iv3
,
&
iv2
,
DES_ENCRYPT
);
&
ks3
,
&
iv3
,
&
iv2
,
DES_ENCRYPT
);
/*-
if (memcmp(cbc_out,cbc3_ok,
/*- if (memcmp(cbc_out,cbc3_ok,
(unsigned int)(strlen((char *)cbc_data)+1+7)/8*8) != 0)
(unsigned int)(strlen((char *)cbc_data)+1+7)/8*8) != 0)
{
{
printf("des_ede3_cbc_encrypt encrypt error\n");
printf("des_ede3_cbc_encrypt encrypt error\n");
...
...
crypto/des/enc_read.c
浏览文件 @
35a1cc90
...
@@ -205,12 +205,12 @@ int DES_enc_read(int fd, void *buf, int len, DES_key_schedule *sched,
...
@@ -205,12 +205,12 @@ int DES_enc_read(int fd, void *buf, int len, DES_key_schedule *sched,
*/
*/
num
=
len
;
num
=
len
;
}
else
{
}
else
{
/*-
/*-
* >output is a multiple of 8 byes, if len < rnum
* >output is a multiple of 8 byes, if len < rnum
* >we must be careful. The user must be aware that this
* >we must be careful. The user must be aware that this
* >routine will write more bytes than he asked for.
* >routine will write more bytes than he asked for.
* >The length of the buffer must be correct.
* >The length of the buffer must be correct.
* FIXED - Should be ok now 18-9-90 - eay */
* FIXED - Should be ok now 18-9-90 - eay */
if
(
len
<
rnum
)
{
if
(
len
<
rnum
)
{
if
(
DES_rw_mode
&
DES_PCBC_MODE
)
if
(
DES_rw_mode
&
DES_PCBC_MODE
)
...
...
crypto/des/ofb64ede.c
浏览文件 @
35a1cc90
...
@@ -102,8 +102,8 @@ void DES_ede3_ofb64_encrypt(register const unsigned char *in,
...
@@ -102,8 +102,8 @@ void DES_ede3_ofb64_encrypt(register const unsigned char *in,
n
=
(
n
+
1
)
&
0x07
;
n
=
(
n
+
1
)
&
0x07
;
}
}
if
(
save
)
{
if
(
save
)
{
/*-
v0=ti[0];
/*- v0=ti[0];
v1=ti[1];*/
v1=ti[1];*/
iv
=
&
(
*
ivec
)[
0
];
iv
=
&
(
*
ivec
)[
0
];
l2c
(
v0
,
iv
);
l2c
(
v0
,
iv
);
l2c
(
v1
,
iv
);
l2c
(
v1
,
iv
);
...
...
crypto/ec/ecp_nistp256.c
浏览文件 @
35a1cc90
...
@@ -432,25 +432,25 @@ static void felem_shrink(smallfelem out, const felem in)
...
@@ -432,25 +432,25 @@ static void felem_shrink(smallfelem out, const felem in)
/* As tmp[3] < 2^65, high is either 1 or 0 */
/* As tmp[3] < 2^65, high is either 1 or 0 */
high
<<=
63
;
high
<<=
63
;
high
>>=
63
;
high
>>=
63
;
/*-
/*-
* high is:
* high is:
* all ones if the high word of tmp[3] is 1
* all ones if the high word of tmp[3] is 1
* all zeros if the high word of tmp[3] if 0 */
* all zeros if the high word of tmp[3] if 0 */
low
=
tmp
[
3
];
low
=
tmp
[
3
];
mask
=
low
>>
63
;
mask
=
low
>>
63
;
/*-
/*-
* mask is:
* mask is:
* all ones if the MSB of low is 1
* all ones if the MSB of low is 1
* all zeros if the MSB of low if 0 */
* all zeros if the MSB of low if 0 */
low
&=
bottom63bits
;
low
&=
bottom63bits
;
low
-=
kPrime3Test
;
low
-=
kPrime3Test
;
/* if low was greater than kPrime3Test then the MSB is zero */
/* if low was greater than kPrime3Test then the MSB is zero */
low
=
~
low
;
low
=
~
low
;
low
>>=
63
;
low
>>=
63
;
/*-
/*-
* low is:
* low is:
* all ones if low was > kPrime3Test
* all ones if low was > kPrime3Test
* all zeros if low was <= kPrime3Test */
* all zeros if low was <= kPrime3Test */
mask
=
(
mask
&
low
)
|
high
;
mask
=
(
mask
&
low
)
|
high
;
tmp
[
0
]
-=
mask
&
kPrime
[
0
];
tmp
[
0
]
-=
mask
&
kPrime
[
0
];
tmp
[
1
]
-=
mask
&
kPrime
[
1
];
tmp
[
1
]
-=
mask
&
kPrime
[
1
];
...
@@ -790,17 +790,17 @@ static void felem_reduce(felem out, const longfelem in)
...
@@ -790,17 +790,17 @@ static void felem_reduce(felem out, const longfelem in)
felem_reduce_
(
out
,
in
);
felem_reduce_
(
out
,
in
);
/*-
/*-
* out[0] > 2^100 - 2^36 - 2^4 - 3*2^64 - 3*2^96 - 2^64 - 2^96 > 0
* out[0] > 2^100 - 2^36 - 2^4 - 3*2^64 - 3*2^96 - 2^64 - 2^96 > 0
* out[1] > 2^100 - 2^64 - 7*2^96 > 0
* out[1] > 2^100 - 2^64 - 7*2^96 > 0
* out[2] > 2^100 - 2^36 + 2^4 - 5*2^64 - 5*2^96 > 0
* out[2] > 2^100 - 2^36 + 2^4 - 5*2^64 - 5*2^96 > 0
* out[3] > 2^100 - 2^36 + 2^4 - 7*2^64 - 5*2^96 - 3*2^96 > 0
* out[3] > 2^100 - 2^36 + 2^4 - 7*2^64 - 5*2^96 - 3*2^96 > 0
*
*
* out[0] < 2^100 + 2^64 + 7*2^64 + 5*2^96 < 2^101
* out[0] < 2^100 + 2^64 + 7*2^64 + 5*2^96 < 2^101
* out[1] < 2^100 + 3*2^64 + 5*2^64 + 3*2^97 < 2^101
* out[1] < 2^100 + 3*2^64 + 5*2^64 + 3*2^97 < 2^101
* out[2] < 2^100 + 5*2^64 + 2^64 + 3*2^65 + 2^97 < 2^101
* out[2] < 2^100 + 5*2^64 + 2^64 + 3*2^65 + 2^97 < 2^101
* out[3] < 2^100 + 7*2^64 + 7*2^96 + 3*2^64 < 2^101
* out[3] < 2^100 + 7*2^64 + 7*2^96 + 3*2^64 < 2^101
*/
*/
}
}
/*-
/*-
...
@@ -819,17 +819,17 @@ static void felem_reduce_zero105(felem out, const longfelem in)
...
@@ -819,17 +819,17 @@ static void felem_reduce_zero105(felem out, const longfelem in)
felem_reduce_
(
out
,
in
);
felem_reduce_
(
out
,
in
);
/*-
/*-
* out[0] > 2^105 - 2^41 - 2^9 - 2^71 - 2^103 - 2^71 - 2^103 > 0
* out[0] > 2^105 - 2^41 - 2^9 - 2^71 - 2^103 - 2^71 - 2^103 > 0
* out[1] > 2^105 - 2^71 - 2^103 > 0
* out[1] > 2^105 - 2^71 - 2^103 > 0
* out[2] > 2^105 - 2^41 + 2^9 - 2^71 - 2^103 > 0
* out[2] > 2^105 - 2^41 + 2^9 - 2^71 - 2^103 > 0
* out[3] > 2^105 - 2^41 + 2^9 - 2^71 - 2^103 - 2^103 > 0
* out[3] > 2^105 - 2^41 + 2^9 - 2^71 - 2^103 - 2^103 > 0
*
*
* out[0] < 2^105 + 2^71 + 2^71 + 2^103 < 2^106
* out[0] < 2^105 + 2^71 + 2^71 + 2^103 < 2^106
* out[1] < 2^105 + 2^71 + 2^71 + 2^103 < 2^106
* out[1] < 2^105 + 2^71 + 2^71 + 2^103 < 2^106
* out[2] < 2^105 + 2^71 + 2^71 + 2^71 + 2^103 < 2^106
* out[2] < 2^105 + 2^71 + 2^71 + 2^71 + 2^103 < 2^106
* out[3] < 2^105 + 2^71 + 2^103 + 2^71 < 2^106
* out[3] < 2^105 + 2^71 + 2^103 + 2^71 < 2^106
*/
*/
}
}
/*
/*
...
@@ -1094,7 +1094,8 @@ static void smallfelem_inv_contract(smallfelem out, const smallfelem in)
...
@@ -1094,7 +1094,8 @@ static void smallfelem_inv_contract(smallfelem out, const smallfelem in)
*
*
* Building on top of the field operations we have the operations on the
* Building on top of the field operations we have the operations on the
* elliptic curve group itself. Points on the curve are represented in Jacobian
* elliptic curve group itself. Points on the curve are represented in Jacobian
* coordinates */
* coordinates
*/
/*-
/*-
* point_double calculates 2*(x_in, y_in, z_in)
* point_double calculates 2*(x_in, y_in, z_in)
...
@@ -1103,7 +1104,8 @@ static void smallfelem_inv_contract(smallfelem out, const smallfelem in)
...
@@ -1103,7 +1104,8 @@ static void smallfelem_inv_contract(smallfelem out, const smallfelem in)
* http://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#doubling-dbl-2001-b
* http://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#doubling-dbl-2001-b
*
*
* Outputs can equal corresponding inputs, i.e., x_out == x_in is allowed.
* Outputs can equal corresponding inputs, i.e., x_out == x_in is allowed.
* while x_out == y_in is not (maybe this works, but it's not tested). */
* while x_out == y_in is not (maybe this works, but it's not tested).
*/
static
void
static
void
point_double
(
felem
x_out
,
felem
y_out
,
felem
z_out
,
point_double
(
felem
x_out
,
felem
y_out
,
felem
z_out
,
const
felem
x_in
,
const
felem
y_in
,
const
felem
z_in
)
const
felem
x_in
,
const
felem
y_in
,
const
felem
z_in
)
...
@@ -1234,7 +1236,8 @@ static void copy_small_conditional(felem out, const smallfelem in, limb mask)
...
@@ -1234,7 +1236,8 @@ static void copy_small_conditional(felem out, const smallfelem in, limb mask)
* This function includes a branch for checking whether the two input points
* This function includes a branch for checking whether the two input points
* are equal, (while not equal to the point at infinity). This case never
* are equal, (while not equal to the point at infinity). This case never
* happens during single point multiplication, so there is no timing leak for
* happens during single point multiplication, so there is no timing leak for
* ECDH or ECDSA signing. */
* ECDH or ECDSA signing.
*/
static
void
point_add
(
felem
x3
,
felem
y3
,
felem
z3
,
static
void
point_add
(
felem
x3
,
felem
y3
,
felem
z3
,
const
felem
x1
,
const
felem
y1
,
const
felem
z1
,
const
felem
x1
,
const
felem
y1
,
const
felem
z1
,
const
int
mixed
,
const
smallfelem
x2
,
const
int
mixed
,
const
smallfelem
x2
,
...
...
crypto/ec/ecp_nistp521.c
浏览文件 @
35a1cc90
...
@@ -414,15 +414,16 @@ static void felem_square(largefelem out, const felem in)
...
@@ -414,15 +414,16 @@ static void felem_square(largefelem out, const felem in)
felem_scalar
(
inx2
,
in
,
2
);
felem_scalar
(
inx2
,
in
,
2
);
felem_scalar
(
inx4
,
in
,
4
);
felem_scalar
(
inx4
,
in
,
4
);
/*-
/*-
* We have many cases were we want to do
* We have many cases were we want to do
* in[x] * in[y] +
* in[x] * in[y] +
* in[y] * in[x]
* in[y] * in[x]
* This is obviously just
* This is obviously just
* 2 * in[x] * in[y]
* 2 * in[x] * in[y]
* However, rather than do the doubling on the 128 bit result, we
* However, rather than do the doubling on the 128 bit result, we
* double one of the inputs to the multiplication by reading from
* double one of the inputs to the multiplication by reading from
* |inx2| */
* |inx2|
*/
out
[
0
]
=
((
uint128_t
)
in
[
0
])
*
in
[
0
];
out
[
0
]
=
((
uint128_t
)
in
[
0
])
*
in
[
0
];
out
[
1
]
=
((
uint128_t
)
in
[
0
])
*
inx2
[
1
];
out
[
1
]
=
((
uint128_t
)
in
[
0
])
*
inx2
[
1
];
...
@@ -610,10 +611,10 @@ static void felem_reduce(felem out, const largefelem in)
...
@@ -610,10 +611,10 @@ static void felem_reduce(felem out, const largefelem in)
out
[
1
]
+=
((
limb
)
in
[
0
])
>>
58
;
out
[
1
]
+=
((
limb
)
in
[
0
])
>>
58
;
out
[
1
]
+=
(((
limb
)
(
in
[
0
]
>>
64
))
&
bottom52bits
)
<<
6
;
out
[
1
]
+=
(((
limb
)
(
in
[
0
]
>>
64
))
&
bottom52bits
)
<<
6
;
/*-
/*-
* out[1] < 2^58 + 2^6 + 2^58
* out[1] < 2^58 + 2^6 + 2^58
* = 2^59 + 2^6
* = 2^59 + 2^6
*/
*/
out
[
2
]
+=
((
limb
)
(
in
[
0
]
>>
64
))
>>
52
;
out
[
2
]
+=
((
limb
)
(
in
[
0
]
>>
64
))
>>
52
;
out
[
2
]
+=
((
limb
)
in
[
1
])
>>
58
;
out
[
2
]
+=
((
limb
)
in
[
1
])
>>
58
;
...
@@ -642,10 +643,10 @@ static void felem_reduce(felem out, const largefelem in)
...
@@ -642,10 +643,10 @@ static void felem_reduce(felem out, const largefelem in)
out
[
8
]
+=
((
limb
)
in
[
7
])
>>
58
;
out
[
8
]
+=
((
limb
)
in
[
7
])
>>
58
;
out
[
8
]
+=
(((
limb
)
(
in
[
7
]
>>
64
))
&
bottom52bits
)
<<
6
;
out
[
8
]
+=
(((
limb
)
(
in
[
7
]
>>
64
))
&
bottom52bits
)
<<
6
;
/*-
/*-
* out[x > 1] < 2^58 + 2^6 + 2^58 + 2^12
* out[x > 1] < 2^58 + 2^6 + 2^58 + 2^12
* < 2^59 + 2^13
* < 2^59 + 2^13
*/
*/
overflow1
=
((
limb
)
(
in
[
7
]
>>
64
))
>>
52
;
overflow1
=
((
limb
)
(
in
[
7
]
>>
64
))
>>
52
;
overflow1
+=
((
limb
)
in
[
8
])
>>
58
;
overflow1
+=
((
limb
)
in
[
8
])
>>
58
;
...
@@ -660,11 +661,11 @@ static void felem_reduce(felem out, const largefelem in)
...
@@ -660,11 +661,11 @@ static void felem_reduce(felem out, const largefelem in)
out
[
1
]
+=
out
[
0
]
>>
58
;
out
[
1
]
+=
out
[
0
]
>>
58
;
out
[
0
]
&=
bottom58bits
;
out
[
0
]
&=
bottom58bits
;
/*-
/*-
* out[0] < 2^58
* out[0] < 2^58
* out[1] < 2^59 + 2^6 + 2^13 + 2^2
* out[1] < 2^59 + 2^6 + 2^13 + 2^2
* < 2^59 + 2^14
* < 2^59 + 2^14
*/
*/
}
}
static
void
felem_square_reduce
(
felem
out
,
const
felem
in
)
static
void
felem_square_reduce
(
felem
out
,
const
felem
in
)
...
...
crypto/ec/ecp_oct.c
浏览文件 @
35a1cc90
...
@@ -96,11 +96,11 @@ int ec_GFp_simple_set_compressed_coordinates(const EC_GROUP *group,
...
@@ -96,11 +96,11 @@ int ec_GFp_simple_set_compressed_coordinates(const EC_GROUP *group,
if
(
y
==
NULL
)
if
(
y
==
NULL
)
goto
err
;
goto
err
;
/*-
/*-
* Recover y. We have a Weierstrass equation
* Recover y. We have a Weierstrass equation
* y^2 = x^3 + a*x + b,
* y^2 = x^3 + a*x + b,
* so y is one of the square roots of x^3 + a*x + b.
* so y is one of the square roots of x^3 + a*x + b.
*/
*/
/* tmp1 := x^3 */
/* tmp1 := x^3 */
if
(
!
BN_nnmod
(
x
,
x_
,
group
->
field
,
ctx
))
if
(
!
BN_nnmod
(
x
,
x_
,
group
->
field
,
ctx
))
...
...
crypto/ec/ecp_smpl.c
浏览文件 @
35a1cc90
...
@@ -909,10 +909,10 @@ int ec_GFp_simple_dbl(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a,
...
@@ -909,10 +909,10 @@ int ec_GFp_simple_dbl(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a,
goto
err
;
goto
err
;
if
(
!
BN_mod_add_quick
(
n1
,
n0
,
n1
,
p
))
if
(
!
BN_mod_add_quick
(
n1
,
n0
,
n1
,
p
))
goto
err
;
goto
err
;
/*-
/*-
* n1 = 3 * (X_a + Z_a^2) * (X_a - Z_a^2)
* n1 = 3 * (X_a + Z_a^2) * (X_a - Z_a^2)
* = 3 * X_a^2 - 3 * Z_a^4
* = 3 * X_a^2 - 3 * Z_a^4
*/
*/
}
else
{
}
else
{
if
(
!
field_sqr
(
group
,
n0
,
a
->
X
,
ctx
))
if
(
!
field_sqr
(
group
,
n0
,
a
->
X
,
ctx
))
goto
err
;
goto
err
;
...
@@ -1033,15 +1033,15 @@ int ec_GFp_simple_is_on_curve(const EC_GROUP *group, const EC_POINT *point,
...
@@ -1033,15 +1033,15 @@ int ec_GFp_simple_is_on_curve(const EC_GROUP *group, const EC_POINT *point,
if
(
Z6
==
NULL
)
if
(
Z6
==
NULL
)
goto
err
;
goto
err
;
/*-
/*-
* We have a curve defined by a Weierstrass equation
* We have a curve defined by a Weierstrass equation
* y^2 = x^3 + a*x + b.
* y^2 = x^3 + a*x + b.
* The point to consider is given in Jacobian projective coordinates
* The point to consider is given in Jacobian projective coordinates
* where (X, Y, Z) represents (x, y) = (X/Z^2, Y/Z^3).
* where (X, Y, Z) represents (x, y) = (X/Z^2, Y/Z^3).
* Substituting this and multiplying by Z^6 transforms the above equation into
* Substituting this and multiplying by Z^6 transforms the above equation into
* Y^2 = X^3 + a*X*Z^4 + b*Z^6.
* Y^2 = X^3 + a*X*Z^4 + b*Z^6.
* To test this, we add up the right-hand side in 'rh'.
* To test this, we add up the right-hand side in 'rh'.
*/
*/
/* rh := X^2 */
/* rh := X^2 */
if
(
!
field_sqr
(
group
,
rh
,
point
->
X
,
ctx
))
if
(
!
field_sqr
(
group
,
rh
,
point
->
X
,
ctx
))
...
@@ -1108,12 +1108,12 @@ int ec_GFp_simple_is_on_curve(const EC_GROUP *group, const EC_POINT *point,
...
@@ -1108,12 +1108,12 @@ int ec_GFp_simple_is_on_curve(const EC_GROUP *group, const EC_POINT *point,
int
ec_GFp_simple_cmp
(
const
EC_GROUP
*
group
,
const
EC_POINT
*
a
,
int
ec_GFp_simple_cmp
(
const
EC_GROUP
*
group
,
const
EC_POINT
*
a
,
const
EC_POINT
*
b
,
BN_CTX
*
ctx
)
const
EC_POINT
*
b
,
BN_CTX
*
ctx
)
{
{
/*-
/*-
* return values:
* return values:
* -1 error
* -1 error
* 0 equal (in affine coordinates)
* 0 equal (in affine coordinates)
* 1 not equal
* 1 not equal
*/
*/
int
(
*
field_mul
)
(
const
EC_GROUP
*
,
BIGNUM
*
,
const
BIGNUM
*
,
int
(
*
field_mul
)
(
const
EC_GROUP
*
,
BIGNUM
*
,
const
BIGNUM
*
,
const
BIGNUM
*
,
BN_CTX
*
);
const
BIGNUM
*
,
BN_CTX
*
);
...
@@ -1151,12 +1151,12 @@ int ec_GFp_simple_cmp(const EC_GROUP *group, const EC_POINT *a,
...
@@ -1151,12 +1151,12 @@ int ec_GFp_simple_cmp(const EC_GROUP *group, const EC_POINT *a,
if
(
Zb23
==
NULL
)
if
(
Zb23
==
NULL
)
goto
end
;
goto
end
;
/*-
/*-
* We have to decide whether
* We have to decide whether
* (X_a/Z_a^2, Y_a/Z_a^3) = (X_b/Z_b^2, Y_b/Z_b^3),
* (X_a/Z_a^2, Y_a/Z_a^3) = (X_b/Z_b^2, Y_b/Z_b^3),
* or equivalently, whether
* or equivalently, whether
* (X_a*Z_b^2, Y_a*Z_b^3) = (X_b*Z_a^2, Y_b*Z_a^3).
* (X_a*Z_b^2, Y_a*Z_b^3) = (X_b*Z_a^2, Y_b*Z_a^3).
*/
*/
if
(
!
b
->
Z_is_one
)
{
if
(
!
b
->
Z_is_one
)
{
if
(
!
field_sqr
(
group
,
Zb23
,
b
->
Z
,
ctx
))
if
(
!
field_sqr
(
group
,
Zb23
,
b
->
Z
,
ctx
))
...
...
crypto/idea/ideatest.c
浏览文件 @
35a1cc90
...
@@ -102,9 +102,9 @@ static unsigned char cfb_cipher64[CFB_TEST_SIZE] = {
...
@@ -102,9 +102,9 @@ static unsigned char cfb_cipher64[CFB_TEST_SIZE] = {
0x59
,
0xD8
,
0xE2
,
0x65
,
0x00
,
0x58
,
0x6C
,
0x3F
,
0x59
,
0xD8
,
0xE2
,
0x65
,
0x00
,
0x58
,
0x6C
,
0x3F
,
0x2C
,
0x17
,
0x25
,
0xD0
,
0x1A
,
0x38
,
0xB7
,
0x2A
,
0x2C
,
0x17
,
0x25
,
0xD0
,
0x1A
,
0x38
,
0xB7
,
0x2A
,
0x39
,
0x61
,
0x37
,
0xDC
,
0x79
,
0xFB
,
0x9F
,
0x45
0x39
,
0x61
,
0x37
,
0xDC
,
0x79
,
0xFB
,
0x9F
,
0x45
/*-
0xF9,0x78,0x32,0xB5,0x42,0x1A,0x6B,0x38,
/*- 0xF9,0x78,0x32,0xB5,0x42,0x1A,0x6B,0x38,
0x9A,0x44,0xD6,0x04,0x19,0x43,0xC4,0xD9,
0x9A,0x44,0xD6,0x04,0x19,0x43,0xC4,0xD9,
0x3D,0x1E,0xAE,0x47,0xFC,0xCF,0x29,0x0B,*/
0x3D,0x1E,0xAE,0x47,0xFC,0xCF,0x29,0x0B,*/
};
};
static
int
cfb64_test
(
unsigned
char
*
cfb_cipher
);
static
int
cfb64_test
(
unsigned
char
*
cfb_cipher
);
...
...
crypto/lhash/lhash.c
浏览文件 @
35a1cc90
...
@@ -434,9 +434,9 @@ unsigned long lh_strhash(const char *c)
...
@@ -434,9 +434,9 @@ unsigned long lh_strhash(const char *c)
if
((
c
==
NULL
)
||
(
*
c
==
'\0'
))
if
((
c
==
NULL
)
||
(
*
c
==
'\0'
))
return
(
ret
);
return
(
ret
);
/*-
/*-
unsigned char b[16];
unsigned char b[16];
MD5(c,strlen(c),b);
MD5(c,strlen(c),b);
return(b[0]|(b[1]<<8)|(b[2]<<16)|(b[3]<<24));
return(b[0]|(b[1]<<8)|(b[2]<<16)|(b[3]<<24));
*/
*/
n
=
0x100
;
n
=
0x100
;
...
...
crypto/pem/pem.h
浏览文件 @
35a1cc90
...
@@ -174,8 +174,8 @@ typedef struct pem_ctx_st {
...
@@ -174,8 +174,8 @@ typedef struct pem_ctx_st {
struct
{
struct
{
int
cipher
;
int
cipher
;
/*-
/*-
unused, and wrong size
unused, and wrong size
unsigned char iv[8]; */
unsigned char iv[8]; */
}
DEK_info
;
}
DEK_info
;
PEM_USER
*
originator
;
PEM_USER
*
originator
;
...
@@ -195,9 +195,9 @@ typedef struct pem_ctx_st {
...
@@ -195,9 +195,9 @@ typedef struct pem_ctx_st {
EVP_CIPHER
*
dec
;
/* date encryption cipher */
EVP_CIPHER
*
dec
;
/* date encryption cipher */
int
key_len
;
/* key length */
int
key_len
;
/* key length */
unsigned
char
*
key
;
/* key */
unsigned
char
*
key
;
/* key */
/*-
/*-
unused, and wrong size
unused, and wrong size
unsigned char iv[8]; */
unsigned char iv[8]; */
int
data_enc
;
/* is the data encrypted */
int
data_enc
;
/* is the data encrypted */
int
data_len
;
int
data_len
;
...
...
crypto/rand/randfile.c
浏览文件 @
35a1cc90
...
@@ -113,10 +113,10 @@ static FILE *(*const vms_fopen)(const char *, const char *, ...) =
...
@@ -113,10 +113,10 @@ static FILE *(*const vms_fopen)(const char *, const char *, ...) =
int
RAND_load_file
(
const
char
*
file
,
long
bytes
)
int
RAND_load_file
(
const
char
*
file
,
long
bytes
)
{
{
/*-
/*-
* If bytes >= 0, read up to 'bytes' bytes.
* If bytes >= 0, read up to 'bytes' bytes.
* if bytes == -1, read complete file.
* if bytes == -1, read complete file.
*/
*/
MS_STATIC
unsigned
char
buf
[
BUFSIZE
];
MS_STATIC
unsigned
char
buf
[
BUFSIZE
];
#ifndef OPENSSL_NO_POSIX_IO
#ifndef OPENSSL_NO_POSIX_IO
...
...
crypto/rc2/rc2test.c
浏览文件 @
35a1cc90
...
@@ -134,9 +134,9 @@ static unsigned char cfb_cipher64[CFB_TEST_SIZE] = {
...
@@ -134,9 +134,9 @@ static unsigned char cfb_cipher64[CFB_TEST_SIZE] = {
0x59
,
0xD8
,
0xE2
,
0x65
,
0x00
,
0x58
,
0x6C
,
0x3F
,
0x59
,
0xD8
,
0xE2
,
0x65
,
0x00
,
0x58
,
0x6C
,
0x3F
,
0x2C
,
0x17
,
0x25
,
0xD0
,
0x1A
,
0x38
,
0xB7
,
0x2A
,
0x2C
,
0x17
,
0x25
,
0xD0
,
0x1A
,
0x38
,
0xB7
,
0x2A
,
0x39
,
0x61
,
0x37
,
0xDC
,
0x79
,
0xFB
,
0x9F
,
0x45
0x39
,
0x61
,
0x37
,
0xDC
,
0x79
,
0xFB
,
0x9F
,
0x45
/*-
0xF9,0x78,0x32,0xB5,0x42,0x1A,0x6B,0x38,
/*- 0xF9,0x78,0x32,0xB5,0x42,0x1A,0x6B,0x38,
0x9A,0x44,0xD6,0x04,0x19,0x43,0xC4,0xD9,
0x9A,0x44,0xD6,0x04,0x19,0x43,0xC4,0xD9,
0x3D,0x1E,0xAE,0x47,0xFC,0xCF,0x29,0x0B,*/
0x3D,0x1E,0xAE,0x47,0xFC,0xCF,0x29,0x0B,*/
};
};
/*
/*
...
...
crypto/threads/mttest.c
浏览文件 @
35a1cc90
...
@@ -798,23 +798,23 @@ void solaris_locking_callback(int mode, int type, char *file, int line)
...
@@ -798,23 +798,23 @@ void solaris_locking_callback(int mode, int type, char *file, int line)
(
type
&
CRYPTO_READ
)
?
"r"
:
"w"
,
file
,
line
);
(
type
&
CRYPTO_READ
)
?
"r"
:
"w"
,
file
,
line
);
# endif
# endif
/*-
/*-
if (CRYPTO_LOCK_SSL_CERT == type)
if (CRYPTO_LOCK_SSL_CERT == type)
fprintf(stderr,"(t,m,f,l) %ld %d %s %d\n",
fprintf(stderr,"(t,m,f,l) %ld %d %s %d\n",
CRYPTO_thread_id(),
CRYPTO_thread_id(),
mode,file,line);
mode,file,line);
*/
*/
if
(
mode
&
CRYPTO_LOCK
)
{
if
(
mode
&
CRYPTO_LOCK
)
{
/*-
/*-
if (mode & CRYPTO_READ)
if (mode & CRYPTO_READ)
rw_rdlock(&(lock_cs[type]));
rw_rdlock(&(lock_cs[type]));
else
else
rw_wrlock(&(lock_cs[type])); */
rw_wrlock(&(lock_cs[type])); */
mutex_lock
(
&
(
lock_cs
[
type
]));
mutex_lock
(
&
(
lock_cs
[
type
]));
lock_count
[
type
]
++
;
lock_count
[
type
]
++
;
}
else
{
}
else
{
/*
rw_unlock(&(lock_cs[type])); */
/* rw_unlock(&(lock_cs[type])); */
mutex_unlock
(
&
(
lock_cs
[
type
]));
mutex_unlock
(
&
(
lock_cs
[
type
]));
}
}
}
}
...
@@ -984,10 +984,10 @@ void pthreads_locking_callback(int mode, int type, char *file, int line)
...
@@ -984,10 +984,10 @@ void pthreads_locking_callback(int mode, int type, char *file, int line)
(
type
&
CRYPTO_READ
)
?
"r"
:
"w"
,
file
,
line
);
(
type
&
CRYPTO_READ
)
?
"r"
:
"w"
,
file
,
line
);
# endif
# endif
/*-
/*-
if (CRYPTO_LOCK_SSL_CERT == type)
if (CRYPTO_LOCK_SSL_CERT == type)
fprintf(stderr,"(t,m,f,l) %ld %d %s %d\n",
fprintf(stderr,"(t,m,f,l) %ld %d %s %d\n",
CRYPTO_thread_id(),
CRYPTO_thread_id(),
mode,file,line);
mode,file,line);
*/
*/
if
(
mode
&
CRYPTO_LOCK
)
{
if
(
mode
&
CRYPTO_LOCK
)
{
pthread_mutex_lock
(
&
(
lock_cs
[
type
]));
pthread_mutex_lock
(
&
(
lock_cs
[
type
]));
...
...
crypto/x509/by_dir.c
浏览文件 @
35a1cc90
...
@@ -430,8 +430,8 @@ static int get_cert_by_subject(X509_LOOKUP *xl, int type, X509_NAME *name,
...
@@ -430,8 +430,8 @@ static int get_cert_by_subject(X509_LOOKUP *xl, int type, X509_NAME *name,
* If we were going to up the reference count, we would need to
* If we were going to up the reference count, we would need to
* do it on a perl 'type' basis
* do it on a perl 'type' basis
*/
*/
/*-
CRYPTO_add(&tmp->data.x509->references,1,
/*- CRYPTO_add(&tmp->data.x509->references,1,
CRYPTO_LOCK_X509);*/
CRYPTO_LOCK_X509);*/
goto
finish
;
goto
finish
;
}
}
}
}
...
...
crypto/x509/x509_lu.c
浏览文件 @
35a1cc90
...
@@ -323,8 +323,8 @@ int X509_STORE_get_by_subject(X509_STORE_CTX *vs, int type, X509_NAME *name,
...
@@ -323,8 +323,8 @@ int X509_STORE_get_by_subject(X509_STORE_CTX *vs, int type, X509_NAME *name,
return
0
;
return
0
;
}
}
/*-
if (ret->data.ptr != NULL)
/*- if (ret->data.ptr != NULL)
X509_OBJECT_free_contents(ret); */
X509_OBJECT_free_contents(ret); */
ret
->
type
=
tmp
->
type
;
ret
->
type
=
tmp
->
type
;
ret
->
data
.
ptr
=
tmp
->
data
.
ptr
;
ret
->
data
.
ptr
=
tmp
->
data
.
ptr
;
...
...
crypto/x509/x509_r2x.c
浏览文件 @
35a1cc90
...
@@ -84,8 +84,8 @@ X509 *X509_REQ_to_X509(X509_REQ *r, int days, EVP_PKEY *pkey)
...
@@ -84,8 +84,8 @@ X509 *X509_REQ_to_X509(X509_REQ *r, int days, EVP_PKEY *pkey)
goto
err
;
goto
err
;
if
(
!
ASN1_INTEGER_set
(
xi
->
version
,
2
))
if
(
!
ASN1_INTEGER_set
(
xi
->
version
,
2
))
goto
err
;
goto
err
;
/*-
xi->extensions=ri->attributes; <- bad, should not ever be done
/*- xi->extensions=ri->attributes; <- bad, should not ever be done
ri->attributes=NULL; */
ri->attributes=NULL; */
}
}
xn
=
X509_REQ_get_subject_name
(
r
);
xn
=
X509_REQ_get_subject_name
(
r
);
...
...
crypto/x509/x509_vfy.c
浏览文件 @
35a1cc90
...
@@ -549,15 +549,15 @@ static int check_chain_extensions(X509_STORE_CTX *ctx)
...
@@ -549,15 +549,15 @@ static int check_chain_extensions(X509_STORE_CTX *ctx)
int
allow_proxy_certs
;
int
allow_proxy_certs
;
cb
=
ctx
->
verify_cb
;
cb
=
ctx
->
verify_cb
;
/*-
/*-
* must_be_ca can have 1 of 3 values:
* must_be_ca can have 1 of 3 values:
* -1: we accept both CA and non-CA certificates, to allow direct
* -1: we accept both CA and non-CA certificates, to allow direct
* use of self-signed certificates (which are marked as CA).
* use of self-signed certificates (which are marked as CA).
* 0: we only accept non-CA certificates. This is currently not
* 0: we only accept non-CA certificates. This is currently not
* used, but the possibility is present for future extensions.
* used, but the possibility is present for future extensions.
* 1: we only accept CA certificates. This is currently used for
* 1: we only accept CA certificates. This is currently used for
* all certificates in the chain except the leaf certificate.
* all certificates in the chain except the leaf certificate.
*/
*/
must_be_ca
=
-
1
;
must_be_ca
=
-
1
;
/* CRL path validation */
/* CRL path validation */
...
...
crypto/x509/x509name.c
浏览文件 @
35a1cc90
...
@@ -162,16 +162,16 @@ X509_NAME_ENTRY *X509_NAME_delete_entry(X509_NAME *name, int loc)
...
@@ -162,16 +162,16 @@ X509_NAME_ENTRY *X509_NAME_delete_entry(X509_NAME *name, int loc)
set_prev
=
ret
->
set
-
1
;
set_prev
=
ret
->
set
-
1
;
set_next
=
sk_X509_NAME_ENTRY_value
(
sk
,
loc
)
->
set
;
set_next
=
sk_X509_NAME_ENTRY_value
(
sk
,
loc
)
->
set
;
/*-
/*-
* set_prev is the previous set
* set_prev is the previous set
* set is the current set
* set is the current set
* set_next is the following
* set_next is the following
* prev 1 1 1 1 1 1 1 1
* prev 1 1 1 1 1 1 1 1
* set 1 1 2 2
* set 1 1 2 2
* next 1 1 2 2 2 2 3 2
* next 1 1 2 2 2 2 3 2
* so basically only if prev and next differ by 2, then
* so basically only if prev and next differ by 2, then
* re-number down by 1
* re-number down by 1
*/
*/
if
(
set_prev
+
1
<
set_next
)
if
(
set_prev
+
1
<
set_next
)
for
(
i
=
loc
;
i
<
n
;
i
++
)
for
(
i
=
loc
;
i
<
n
;
i
++
)
sk_X509_NAME_ENTRY_value
(
sk
,
i
)
->
set
--
;
sk_X509_NAME_ENTRY_value
(
sk
,
i
)
->
set
--
;
...
...
crypto/x509v3/v3_utl.c
浏览文件 @
35a1cc90
...
@@ -808,11 +808,11 @@ static const unsigned char *valid_star(const unsigned char *p, size_t len,
...
@@ -808,11 +808,11 @@ static const unsigned char *valid_star(const unsigned char *p, size_t len,
if
(
p
[
i
]
==
'*'
)
{
if
(
p
[
i
]
==
'*'
)
{
int
atstart
=
(
state
&
LABEL_START
);
int
atstart
=
(
state
&
LABEL_START
);
int
atend
=
(
i
==
len
-
1
||
p
[
i
+
i
]
==
'.'
);
int
atend
=
(
i
==
len
-
1
||
p
[
i
+
i
]
==
'.'
);
/*-
/*-
* At most one wildcard per pattern.
* At most one wildcard per pattern.
* No wildcards in IDNA labels.
* No wildcards in IDNA labels.
* No wildcards after the first label.
* No wildcards after the first label.
*/
*/
if
(
star
!=
NULL
||
(
state
&
LABEL_IDNA
)
!=
0
||
dots
)
if
(
star
!=
NULL
||
(
state
&
LABEL_IDNA
)
!=
0
||
dots
)
return
NULL
;
return
NULL
;
/* Only full-label '*.example.com' wildcards? */
/* Only full-label '*.example.com' wildcards? */
...
...
demos/engines/zencod/hw_zencod.h
浏览文件 @
35a1cc90
...
@@ -106,14 +106,14 @@ extern "C" {
...
@@ -106,14 +106,14 @@ extern "C" {
/*
/*
* Functions for Digest (MD5, SHA1) stuff
* Functions for Digest (MD5, SHA1) stuff
*/
*/
/* output : output data buffer */
/* output : output data buffer */
/* input : input data buffer */
/* input : input data buffer */
/* algo : hash algorithm, MD5 or SHA1 */
/* algo : hash algorithm, MD5 or SHA1 */
/*-
/*-
* typedef int t_zencod_hash ( KEY *output, const KEY *input, int algo ) ;
* typedef int t_zencod_hash ( KEY *output, const KEY *input, int algo ) ;
* typedef int t_zencod_sha_hash ( KEY *output, const KEY *input, int algo ) ;
* typedef int t_zencod_sha_hash ( KEY *output, const KEY *input, int algo ) ;
*/
*/
/* For now separate this stuff that mad it easier to test */
/* For now separate this stuff that mad it easier to test */
typedef
int
t_zencod_md5_init
(
ZEN_MD_DATA
*
data
);
typedef
int
t_zencod_md5_init
(
ZEN_MD_DATA
*
data
);
typedef
int
t_zencod_md5_update
(
ZEN_MD_DATA
*
data
,
const
KEY
*
input
);
typedef
int
t_zencod_md5_update
(
ZEN_MD_DATA
*
data
,
const
KEY
*
input
);
typedef
int
t_zencod_md5_do_final
(
ZEN_MD_DATA
*
data
,
KEY
*
output
);
typedef
int
t_zencod_md5_do_final
(
ZEN_MD_DATA
*
data
,
KEY
*
output
);
...
...
engines/ccgost/gost_ctl.c
浏览文件 @
35a1cc90
...
@@ -18,20 +18,20 @@ static char *gost_params[GOST_PARAM_MAX + 1] = { NULL };
...
@@ -18,20 +18,20 @@ static char *gost_params[GOST_PARAM_MAX + 1] = { NULL };
static
const
char
*
gost_envnames
[]
=
{
"CRYPT_PARAMS"
};
static
const
char
*
gost_envnames
[]
=
{
"CRYPT_PARAMS"
};
const
ENGINE_CMD_DEFN
gost_cmds
[]
=
{
const
ENGINE_CMD_DEFN
gost_cmds
[]
=
{
/*-
{ GOST_CTRL_RNG,
/*- { GOST_CTRL_RNG,
"RNG",
"RNG",
"Type of random number generator to use",
"Type of random number generator to use",
ENGINE_CMD_FLAG_STRING
ENGINE_CMD_FLAG_STRING
},
},
{ GOST_CTRL_RNG_PARAMS,
{ GOST_CTRL_RNG_PARAMS,
"RNG_PARAMS",
"RNG_PARAMS",
"Parameter for random number generator",
"Parameter for random number generator",
ENGINE_CMD_FLAG_STRING
ENGINE_CMD_FLAG_STRING
},
},
*/
{
GOST_CTRL_CRYPT_PARAMS
,
*/
{
GOST_CTRL_CRYPT_PARAMS
,
"CRYPT_PARAMS"
,
"CRYPT_PARAMS"
,
"OID of default GOST 28147-89 parameters"
,
"OID of default GOST 28147-89 parameters"
,
ENGINE_CMD_FLAG_STRING
},
ENGINE_CMD_FLAG_STRING
},
{
0
,
NULL
,
NULL
,
0
}
{
0
,
NULL
,
NULL
,
0
}
};
};
...
...
engines/e_cswift.c
浏览文件 @
35a1cc90
...
@@ -1037,11 +1037,11 @@ static int cswift_rand_bytes(unsigned char *buf, int num)
...
@@ -1037,11 +1037,11 @@ static int cswift_rand_bytes(unsigned char *buf, int num)
while
(
num
>=
(
int
)
sizeof
(
buf32
))
{
while
(
num
>=
(
int
)
sizeof
(
buf32
))
{
largenum
.
value
=
buf
;
largenum
.
value
=
buf
;
largenum
.
nbytes
=
sizeof
(
buf32
);
largenum
.
nbytes
=
sizeof
(
buf32
);
/*-
/*-
* tell CryptoSwift how many bytes we want and where we want it.
* tell CryptoSwift how many bytes we want and where we want it.
* Note: - CryptoSwift cannot do more than 4096 bytes at a time.
* Note: - CryptoSwift cannot do more than 4096 bytes at a time.
* - CryptoSwift can only do multiple of 32-bits.
* - CryptoSwift can only do multiple of 32-bits.
*/
*/
swrc
=
swrc
=
p_CSwift_SimpleRequest
(
hac
,
SW_CMD_RAND
,
NULL
,
0
,
&
largenum
,
1
);
p_CSwift_SimpleRequest
(
hac
,
SW_CMD_RAND
,
NULL
,
0
,
&
largenum
,
1
);
if
(
swrc
!=
SW_OK
)
{
if
(
swrc
!=
SW_OK
)
{
...
...
ssl/d1_pkt.c
浏览文件 @
35a1cc90
...
@@ -433,12 +433,12 @@ static int dtls1_process_record(SSL *s)
...
@@ -433,12 +433,12 @@ static int dtls1_process_record(SSL *s)
rr
->
orig_len
=
rr
->
length
;
rr
->
orig_len
=
rr
->
length
;
enc_err
=
s
->
method
->
ssl3_enc
->
enc
(
s
,
0
);
enc_err
=
s
->
method
->
ssl3_enc
->
enc
(
s
,
0
);
/*-
/*-
* enc_err is:
* enc_err is:
* 0: (in non-constant time) if the record is publically invalid.
* 0: (in non-constant time) if the record is publically invalid.
* 1: if the padding is valid
* 1: if the padding is valid
* -1: if the padding is invalid
* -1: if the padding is invalid
*/
*/
if
(
enc_err
==
0
)
{
if
(
enc_err
==
0
)
{
/* For DTLS we simply ignore bad packets. */
/* For DTLS we simply ignore bad packets. */
rr
->
length
=
0
;
rr
->
length
=
0
;
...
@@ -1046,11 +1046,11 @@ int dtls1_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek)
...
@@ -1046,11 +1046,11 @@ int dtls1_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek)
}
}
}
}
/*-
/*-
* s->d1->handshake_fragment_len == 12 iff rr->type == SSL3_RT_HANDSHAKE;
* s->d1->handshake_fragment_len == 12 iff rr->type == SSL3_RT_HANDSHAKE;
* s->d1->alert_fragment_len == 7 iff rr->type == SSL3_RT_ALERT.
* s->d1->alert_fragment_len == 7 iff rr->type == SSL3_RT_ALERT.
* (Possibly rr is 'empty' now, i.e. rr->length may be 0.)
* (Possibly rr is 'empty' now, i.e. rr->length may be 0.)
*/
*/
/* If we are a client, check for an incoming 'Hello Request': */
/* If we are a client, check for an incoming 'Hello Request': */
if
((
!
s
->
server
)
&&
if
((
!
s
->
server
)
&&
...
...
ssl/s3_cbc.c
浏览文件 @
35a1cc90
...
@@ -754,25 +754,25 @@ void tls_fips_digest_extra(const EVP_CIPHER_CTX *cipher_ctx,
...
@@ -754,25 +754,25 @@ void tls_fips_digest_extra(const EVP_CIPHER_CTX *cipher_ctx,
if
(
EVP_CIPHER_CTX_mode
(
cipher_ctx
)
!=
EVP_CIPH_CBC_MODE
)
if
(
EVP_CIPHER_CTX_mode
(
cipher_ctx
)
!=
EVP_CIPH_CBC_MODE
)
return
;
return
;
block_size
=
EVP_MD_CTX_block_size
(
mac_ctx
);
block_size
=
EVP_MD_CTX_block_size
(
mac_ctx
);
/*-
/*-
* We are in FIPS mode if we get this far so we know we have only SHA*
* We are in FIPS mode if we get this far so we know we have only SHA*
* digests and TLS to deal with.
* digests and TLS to deal with.
* Minimum digest padding length is 17 for SHA384/SHA512 and 9
* Minimum digest padding length is 17 for SHA384/SHA512 and 9
* otherwise.
* otherwise.
* Additional header is 13 bytes. To get the number of digest blocks
* Additional header is 13 bytes. To get the number of digest blocks
* processed round up the amount of data plus padding to the nearest
* processed round up the amount of data plus padding to the nearest
* block length. Block length is 128 for SHA384/SHA512 and 64 otherwise.
* block length. Block length is 128 for SHA384/SHA512 and 64 otherwise.
* So we have:
* So we have:
* blocks = (payload_len + digest_pad + 13 + block_size - 1)/block_size
* blocks = (payload_len + digest_pad + 13 + block_size - 1)/block_size
* equivalently:
* equivalently:
* blocks = (payload_len + digest_pad + 12)/block_size + 1
* blocks = (payload_len + digest_pad + 12)/block_size + 1
* HMAC adds a constant overhead.
* HMAC adds a constant overhead.
* We're ultimately only interested in differences so this becomes
* We're ultimately only interested in differences so this becomes
* blocks = (payload_len + 29)/128
* blocks = (payload_len + 29)/128
* for SHA384/SHA512 and
* for SHA384/SHA512 and
* blocks = (payload_len + 21)/64
* blocks = (payload_len + 21)/64
* otherwise.
* otherwise.
*/
*/
digest_pad
=
block_size
==
64
?
21
:
29
;
digest_pad
=
block_size
==
64
?
21
:
29
;
blocks_orig
=
(
orig_len
+
digest_pad
)
/
block_size
;
blocks_orig
=
(
orig_len
+
digest_pad
)
/
block_size
;
blocks_data
=
(
data_len
+
digest_pad
)
/
block_size
;
blocks_data
=
(
data_len
+
digest_pad
)
/
block_size
;
...
...
ssl/s3_clnt.c
浏览文件 @
35a1cc90
...
@@ -725,36 +725,36 @@ int ssl3_client_hello(SSL *s)
...
@@ -725,36 +725,36 @@ int ssl3_client_hello(SSL *s)
/* Do the message type and length last */
/* Do the message type and length last */
d
=
p
=
ssl_handshake_start
(
s
);
d
=
p
=
ssl_handshake_start
(
s
);
/*-
/*-
* version indicates the negotiated version: for example from
* version indicates the negotiated version: for example from
* an SSLv2/v3 compatible client hello). The client_version
* an SSLv2/v3 compatible client hello). The client_version
* field is the maximum version we permit and it is also
* field is the maximum version we permit and it is also
* used in RSA encrypted premaster secrets. Some servers can
* used in RSA encrypted premaster secrets. Some servers can
* choke if we initially report a higher version then
* choke if we initially report a higher version then
* renegotiate to a lower one in the premaster secret. This
* renegotiate to a lower one in the premaster secret. This
* didn't happen with TLS 1.0 as most servers supported it
* didn't happen with TLS 1.0 as most servers supported it
* but it can with TLS 1.1 or later if the server only supports
* but it can with TLS 1.1 or later if the server only supports
* 1.0.
* 1.0.
*
*
* Possible scenario with previous logic:
* Possible scenario with previous logic:
* 1. Client hello indicates TLS 1.2
* 1. Client hello indicates TLS 1.2
* 2. Server hello says TLS 1.0
* 2. Server hello says TLS 1.0
* 3. RSA encrypted premaster secret uses 1.2.
* 3. RSA encrypted premaster secret uses 1.2.
* 4. Handhaked proceeds using TLS 1.0.
* 4. Handhaked proceeds using TLS 1.0.
* 5. Server sends hello request to renegotiate.
* 5. Server sends hello request to renegotiate.
* 6. Client hello indicates TLS v1.0 as we now
* 6. Client hello indicates TLS v1.0 as we now
* know that is maximum server supports.
* know that is maximum server supports.
* 7. Server chokes on RSA encrypted premaster secret
* 7. Server chokes on RSA encrypted premaster secret
* containing version 1.0.
* containing version 1.0.
*
*
* For interoperability it should be OK to always use the
* For interoperability it should be OK to always use the
* maximum version we support in client hello and then rely
* maximum version we support in client hello and then rely
* on the checking of version to ensure the servers isn't
* on the checking of version to ensure the servers isn't
* being inconsistent: for example initially negotiating with
* being inconsistent: for example initially negotiating with
* TLS 1.0 and renegotiating with TLS 1.2. We do this by using
* TLS 1.0 and renegotiating with TLS 1.2. We do this by using
* client_version in client hello and not resetting it to
* client_version in client hello and not resetting it to
* the negotiated version.
* the negotiated version.
*/
*/
#if 0
#if 0
*(p++) = s->version >> 8;
*(p++) = s->version >> 8;
*(p++) = s->version & 0xff;
*(p++) = s->version & 0xff;
...
@@ -2514,13 +2514,13 @@ int ssl3_send_client_key_exchange(SSL *s)
...
@@ -2514,13 +2514,13 @@ int ssl3_send_client_key_exchange(SSL *s)
if
(
RAND_bytes
(
&
(
tmp_buf
[
2
]),
sizeof
tmp_buf
-
2
)
<=
0
)
if
(
RAND_bytes
(
&
(
tmp_buf
[
2
]),
sizeof
tmp_buf
-
2
)
<=
0
)
goto
err
;
goto
err
;
/*-
/*-
* 20010420 VRS. Tried it this way; failed.
* 20010420 VRS. Tried it this way; failed.
* EVP_EncryptInit_ex(&ciph_ctx,enc, NULL,NULL);
* EVP_EncryptInit_ex(&ciph_ctx,enc, NULL,NULL);
* EVP_CIPHER_CTX_set_key_length(&ciph_ctx,
* EVP_CIPHER_CTX_set_key_length(&ciph_ctx,
* kssl_ctx->length);
* kssl_ctx->length);
* EVP_EncryptInit_ex(&ciph_ctx,NULL, key,iv);
* EVP_EncryptInit_ex(&ciph_ctx,NULL, key,iv);
*/
*/
memset
(
iv
,
0
,
sizeof
iv
);
/* per RFC 1510 */
memset
(
iv
,
0
,
sizeof
iv
);
/* per RFC 1510 */
EVP_EncryptInit_ex
(
&
ciph_ctx
,
enc
,
NULL
,
kssl_ctx
->
key
,
iv
);
EVP_EncryptInit_ex
(
&
ciph_ctx
,
enc
,
NULL
,
kssl_ctx
->
key
,
iv
);
...
...
ssl/s3_enc.c
浏览文件 @
35a1cc90
...
@@ -748,13 +748,14 @@ int n_ssl3_mac(SSL *ssl, unsigned char *md, int send)
...
@@ -748,13 +748,14 @@ int n_ssl3_mac(SSL *ssl, unsigned char *md, int send)
* are hashing because that gives an attacker a timing-oracle.
* are hashing because that gives an attacker a timing-oracle.
*/
*/
/*-
/*-
* npad is, at most, 48 bytes and that's with MD5:
* npad is, at most, 48 bytes and that's with MD5:
* 16 + 48 + 8 (sequence bytes) + 1 + 2 = 75.
* 16 + 48 + 8 (sequence bytes) + 1 + 2 = 75.
*
*
* With SHA-1 (the largest hash speced for SSLv3) the hash size
* With SHA-1 (the largest hash speced for SSLv3) the hash size
* goes up 4, but npad goes down by 8, resulting in a smaller
* goes up 4, but npad goes down by 8, resulting in a smaller
* total size. */
* total size.
*/
unsigned
char
header
[
75
];
unsigned
char
header
[
75
];
unsigned
j
=
0
;
unsigned
j
=
0
;
memcpy
(
header
+
j
,
mac_sec
,
md_size
);
memcpy
(
header
+
j
,
mac_sec
,
md_size
);
...
...
ssl/ssl_lib.c
浏览文件 @
35a1cc90
...
@@ -1913,11 +1913,11 @@ SSL_CTX *SSL_CTX_new(const SSL_METHOD *meth)
...
@@ -1913,11 +1913,11 @@ SSL_CTX *SSL_CTX_new(const SSL_METHOD *meth)
ret
->
references
=
1
;
ret
->
references
=
1
;
ret
->
quiet_shutdown
=
0
;
ret
->
quiet_shutdown
=
0
;
/*
ret->cipher=NULL;*/
/* ret->cipher=NULL;*/
/*-
/*-
ret->s2->challenge=NULL;
ret->s2->challenge=NULL;
ret->master_key=NULL;
ret->master_key=NULL;
ret->s2->conn_id=NULL; */
ret->s2->conn_id=NULL; */
ret
->
info_callback
=
NULL
;
ret
->
info_callback
=
NULL
;
...
...
ssl/ssl_sess.c
浏览文件 @
35a1cc90
...
@@ -325,21 +325,21 @@ int ssl_get_new_session(SSL *s, int session)
...
@@ -325,21 +325,21 @@ int ssl_get_new_session(SSL *s, int session)
return
(
0
);
return
(
0
);
}
}
#ifndef OPENSSL_NO_TLSEXT
#ifndef OPENSSL_NO_TLSEXT
/*-
/*-
* If RFC5077 ticket, use empty session ID (as server).
* If RFC5077 ticket, use empty session ID (as server).
* Note that:
* Note that:
* (a) ssl_get_prev_session() does lookahead into the
* (a) ssl_get_prev_session() does lookahead into the
* ClientHello extensions to find the session ticket.
* ClientHello extensions to find the session ticket.
* When ssl_get_prev_session() fails, s3_srvr.c calls
* When ssl_get_prev_session() fails, s3_srvr.c calls
* ssl_get_new_session() in ssl3_get_client_hello().
* ssl_get_new_session() in ssl3_get_client_hello().
* At that point, it has not yet parsed the extensions,
* At that point, it has not yet parsed the extensions,
* however, because of the lookahead, it already knows
* however, because of the lookahead, it already knows
* whether a ticket is expected or not.
* whether a ticket is expected or not.
*
*
* (b) s3_clnt.c calls ssl_get_new_session() before parsing
* (b) s3_clnt.c calls ssl_get_new_session() before parsing
* ServerHello extensions, and before recording the session
* ServerHello extensions, and before recording the session
* ID received from the server, so this block is a noop.
* ID received from the server, so this block is a noop.
*/
*/
if
(
s
->
tlsext_ticket_expected
)
{
if
(
s
->
tlsext_ticket_expected
)
{
ss
->
session_id_length
=
0
;
ss
->
session_id_length
=
0
;
goto
sess_id_done
;
goto
sess_id_done
;
...
...
ssl/ssl_task.c
浏览文件 @
35a1cc90
...
@@ -288,8 +288,8 @@ int doit(io_channel chan, SSL_CTX *s_ctx)
...
@@ -288,8 +288,8 @@ int doit(io_channel chan, SSL_CTX *s_ctx)
if
((
s_to_c
==
NULL
)
||
(
c_to_s
==
NULL
))
if
((
s_to_c
==
NULL
)
||
(
c_to_s
==
NULL
))
goto
err
;
goto
err
;
/*- original, DRM 24-SEP-1997
/*- original, DRM 24-SEP-1997
BIO_set_fd ( c_to_s, "", chan );
BIO_set_fd ( c_to_s, "", chan );
BIO_set_fd ( s_to_c, "", chan );
BIO_set_fd ( s_to_c, "", chan );
*/
*/
BIO_set_fd
(
c_to_s
,
0
,
chan
);
BIO_set_fd
(
c_to_s
,
0
,
chan
);
BIO_set_fd
(
s_to_c
,
0
,
chan
);
BIO_set_fd
(
s_to_c
,
0
,
chan
);
...
...
ssl/ssltest.c
浏览文件 @
35a1cc90
...
@@ -1845,40 +1845,40 @@ int doit_biopair(SSL *s_ssl, SSL *c_ssl, long count,
...
@@ -1845,40 +1845,40 @@ int doit_biopair(SSL *s_ssl, SSL *c_ssl, long count,
(
void
)
BIO_set_ssl
(
s_ssl_bio
,
s_ssl
,
BIO_NOCLOSE
);
(
void
)
BIO_set_ssl
(
s_ssl_bio
,
s_ssl
,
BIO_NOCLOSE
);
do
{
do
{
/*-
/*-
* c_ssl_bio: SSL filter BIO
* c_ssl_bio: SSL filter BIO
*
*
* client: pseudo-I/O for SSL library
* client: pseudo-I/O for SSL library
*
*
* client_io: client's SSL communication; usually to be
* client_io: client's SSL communication; usually to be
* relayed over some I/O facility, but in this
* relayed over some I/O facility, but in this
* test program, we're the server, too:
* test program, we're the server, too:
*
*
* server_io: server's SSL communication
* server_io: server's SSL communication
*
*
* server: pseudo-I/O for SSL library
* server: pseudo-I/O for SSL library
*
*
* s_ssl_bio: SSL filter BIO
* s_ssl_bio: SSL filter BIO
*
*
* The client and the server each employ a "BIO pair":
* The client and the server each employ a "BIO pair":
* client + client_io, server + server_io.
* client + client_io, server + server_io.
* BIO pairs are symmetric. A BIO pair behaves similar
* BIO pairs are symmetric. A BIO pair behaves similar
* to a non-blocking socketpair (but both endpoints must
* to a non-blocking socketpair (but both endpoints must
* be handled by the same thread).
* be handled by the same thread).
* [Here we could connect client and server to the ends
* [Here we could connect client and server to the ends
* of a single BIO pair, but then this code would be less
* of a single BIO pair, but then this code would be less
* suitable as an example for BIO pairs in general.]
* suitable as an example for BIO pairs in general.]
*
*
* Useful functions for querying the state of BIO pair endpoints:
* Useful functions for querying the state of BIO pair endpoints:
*
*
* BIO_ctrl_pending(bio) number of bytes we can read now
* BIO_ctrl_pending(bio) number of bytes we can read now
* BIO_ctrl_get_read_request(bio) number of bytes needed to fulfil
* BIO_ctrl_get_read_request(bio) number of bytes needed to fulfil
* other side's read attempt
* other side's read attempt
* BIO_ctrl_get_write_guarantee(bio) number of bytes we can write now
* BIO_ctrl_get_write_guarantee(bio) number of bytes we can write now
*
*
* ..._read_request is never more than ..._write_guarantee;
* ..._read_request is never more than ..._write_guarantee;
* it depends on the application which one you should use.
* it depends on the application which one you should use.
*/
*/
/*
/*
* We have non-blocking behaviour throughout this test program, but
* We have non-blocking behaviour throughout this test program, but
...
@@ -2266,10 +2266,10 @@ int doit(SSL *s_ssl, SSL *c_ssl, long count)
...
@@ -2266,10 +2266,10 @@ int doit(SSL *s_ssl, SSL *c_ssl, long count)
printf
(
"server waiting in SSL_accept - %s
\n
"
,
printf
(
"server waiting in SSL_accept - %s
\n
"
,
SSL_state_string_long
(
s_ssl
));
SSL_state_string_long
(
s_ssl
));
/*-
/*-
else if (s_write)
else if (s_write)
printf("server:SSL_write()\n");
printf("server:SSL_write()\n");
else
else
printf("server:SSL_read()\n"); */
printf("server:SSL_read()\n"); */
}
}
if
(
do_client
&&
debug
)
{
if
(
do_client
&&
debug
)
{
...
@@ -2277,10 +2277,10 @@ int doit(SSL *s_ssl, SSL *c_ssl, long count)
...
@@ -2277,10 +2277,10 @@ int doit(SSL *s_ssl, SSL *c_ssl, long count)
printf
(
"client waiting in SSL_connect - %s
\n
"
,
printf
(
"client waiting in SSL_connect - %s
\n
"
,
SSL_state_string_long
(
c_ssl
));
SSL_state_string_long
(
c_ssl
));
/*-
/*-
else if (c_write)
else if (c_write)
printf("client:SSL_write()\n");
printf("client:SSL_write()\n");
else
else
printf("client:SSL_read()\n"); */
printf("client:SSL_read()\n"); */
}
}
if
(
!
do_client
&&
!
do_server
)
{
if
(
!
do_client
&&
!
do_server
)
{
...
...
test/methtest.c
浏览文件 @
35a1cc90
...
@@ -86,13 +86,13 @@ char *argv[];
...
@@ -86,13 +86,13 @@ char *argv[];
METH_arg
(
tmp2
,
METH_TYPE_DIR
,
"/usr/local/ssl/certs"
);
METH_arg
(
tmp2
,
METH_TYPE_DIR
,
"/usr/local/ssl/certs"
);
METH_push
(
top
,
METH_X509_CA_BY_SUBJECT
,
tmp2
);
METH_push
(
top
,
METH_X509_CA_BY_SUBJECT
,
tmp2
);
/*-
tmp=METH_new(x509_by_issuer_dir);
/*- tmp=METH_new(x509_by_issuer_dir);
METH_arg(tmp,METH_TYPE_DIR,"/home/eay/.mycerts");
METH_arg(tmp,METH_TYPE_DIR,"/home/eay/.mycerts");
METH_push(top,METH_X509_BY_ISSUER,tmp);
METH_push(top,METH_X509_BY_ISSUER,tmp);
tmp=METH_new(x509_by_issuer_primary);
tmp=METH_new(x509_by_issuer_primary);
METH_arg(tmp,METH_TYPE_FILE,"/home/eay/.mycerts/primary.pem");
METH_arg(tmp,METH_TYPE_FILE,"/home/eay/.mycerts/primary.pem");
METH_push(top,METH_X509_BY_ISSUER,tmp);
METH_push(top,METH_X509_BY_ISSUER,tmp);
*/
*/
METH_init
(
top
);
METH_init
(
top
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录