Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
B
brpc
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
brpc
Commits
83cd59d8
Commit
83cd59d8
authored
Aug 21, 2017
by
gejun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Patch svn r35106 r35110; fix patch_from_svn
parent
68bc2727
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
104 deletions
+25
-104
ssl_compat.h
src/base/ssl_compat.h
+11
-98
patch_from_svn
tools/patch_from_svn
+14
-6
No files found.
src/base/ssl_compat.h
View file @
83cd59d8
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
#ifndef BRPC_BASE_SSL_COMPAT_H
#ifndef BRPC_BASE_SSL_COMPAT_H
#define BRPC_BASE_SSL_COMPAT_H
#define BRPC_BASE_SSL_COMPAT_H
#include <openssl/ssl.h>
#include <openssl/opensslv.h>
#include <openssl/opensslv.h>
/* Provide functions added in newer openssl but missing in older versions */
/* Provide functions added in newer openssl but missing in older versions */
...
@@ -207,23 +208,6 @@ BRPC_INLINE int DSA_SIG_set0(DSA_SIG *sig, BIGNUM *r, BIGNUM *s) {
...
@@ -207,23 +208,6 @@ BRPC_INLINE int DSA_SIG_set0(DSA_SIG *sig, BIGNUM *r, BIGNUM *s) {
return
1
;
return
1
;
}
}
BRPC_INLINE
void
ECDSA_SIG_get0
(
const
ECDSA_SIG
*
sig
,
const
BIGNUM
**
pr
,
const
BIGNUM
**
ps
)
{
if
(
pr
!=
NULL
)
*
pr
=
sig
->
r
;
if
(
ps
!=
NULL
)
*
ps
=
sig
->
s
;
}
BRPC_INLINE
int
ECDSA_SIG_set0
(
ECDSA_SIG
*
sig
,
BIGNUM
*
r
,
BIGNUM
*
s
)
{
if
(
r
==
NULL
||
s
==
NULL
)
return
0
;
BN_clear_free
(
sig
->
r
);
BN_clear_free
(
sig
->
s
);
sig
->
r
=
r
;
sig
->
s
=
s
;
return
1
;
}
BRPC_INLINE
void
DH_get0_pqg
(
const
DH
*
dh
,
BRPC_INLINE
void
DH_get0_pqg
(
const
DH
*
dh
,
const
BIGNUM
**
p
,
const
BIGNUM
**
q
,
const
BIGNUM
**
g
)
{
const
BIGNUM
**
p
,
const
BIGNUM
**
q
,
const
BIGNUM
**
g
)
{
if
(
p
!=
NULL
)
if
(
p
!=
NULL
)
...
@@ -294,54 +278,6 @@ BRPC_INLINE int DH_set_length(DH *dh, long length) {
...
@@ -294,54 +278,6 @@ BRPC_INLINE int DH_set_length(DH *dh, long length) {
return
1
;
return
1
;
}
}
BRPC_INLINE
const
unsigned
char
*
EVP_CIPHER_CTX_iv
(
const
EVP_CIPHER_CTX
*
ctx
)
{
return
ctx
->
iv
;
}
BRPC_INLINE
unsigned
char
*
EVP_CIPHER_CTX_iv_noconst
(
EVP_CIPHER_CTX
*
ctx
)
{
return
ctx
->
iv
;
}
BRPC_INLINE
EVP_MD_CTX
*
EVP_MD_CTX_new
(
void
)
{
return
(
EVP_MD_CTX
*
)
OPENSSL_zalloc
(
sizeof
(
EVP_MD_CTX
));
}
BRPC_INLINE
void
EVP_MD_CTX_free
(
EVP_MD_CTX
*
ctx
)
{
EVP_MD_CTX_cleanup
(
ctx
);
OPENSSL_free
(
ctx
);
}
BRPC_INLINE
RSA_METHOD
*
RSA_meth_dup
(
const
RSA_METHOD
*
meth
)
{
RSA_METHOD
*
ret
;
ret
=
(
RSA_METHOD
*
)
OPENSSL_malloc
(
sizeof
(
RSA_METHOD
));
if
(
ret
!=
NULL
)
{
memcpy
(
ret
,
meth
,
sizeof
(
*
meth
));
ret
->
name
=
OPENSSL_strdup
(
meth
->
name
);
if
(
ret
->
name
==
NULL
)
{
OPENSSL_free
(
ret
);
return
NULL
;
}
}
return
ret
;
}
BRPC_INLINE
int
RSA_meth_set1_name
(
RSA_METHOD
*
meth
,
const
char
*
name
)
{
char
*
tmpname
;
tmpname
=
OPENSSL_strdup
(
name
);
if
(
tmpname
==
NULL
)
{
return
0
;
}
OPENSSL_free
((
char
*
)
meth
->
name
);
meth
->
name
=
tmpname
;
return
1
;
}
BRPC_INLINE
int
RSA_meth_set_priv_enc
(
RSA_METHOD
*
meth
,
BRPC_INLINE
int
RSA_meth_set_priv_enc
(
RSA_METHOD
*
meth
,
int
(
*
priv_enc
)
(
int
flen
,
const
unsigned
char
*
from
,
int
(
*
priv_enc
)
(
int
flen
,
const
unsigned
char
*
from
,
unsigned
char
*
to
,
RSA
*
rsa
,
unsigned
char
*
to
,
RSA
*
rsa
,
...
@@ -374,37 +310,6 @@ BRPC_INLINE int RSA_bits(const RSA *r) {
...
@@ -374,37 +310,6 @@ BRPC_INLINE int RSA_bits(const RSA *r) {
return
(
BN_num_bits
(
r
->
n
));
return
(
BN_num_bits
(
r
->
n
));
}
}
BRPC_INLINE
RSA
*
EVP_PKEY_get0_RSA
(
EVP_PKEY
*
pkey
)
{
if
(
pkey
->
type
!=
EVP_PKEY_RSA
)
{
return
NULL
;
}
return
pkey
->
pkey
.
rsa
;
}
/* following 2 functions don't compile in openssl 1.0.1f*/
/*
BRPC_INLINE HMAC_CTX *HMAC_CTX_new(void) {
HMAC_CTX *ctx = (HMAC_CTX*)OPENSSL_malloc(sizeof(*ctx));
if (ctx != NULL) {
if (!HMAC_CTX_reset(ctx)) {
HMAC_CTX_free(ctx);
return NULL;
}
}
return ctx;
}
BRPC_INLINE void HMAC_CTX_free(HMAC_CTX *ctx) {
if (ctx != NULL) {
hmac_ctx_cleanup(ctx);
EVP_MD_CTX_free(ctx->i_ctx);
EVP_MD_CTX_free(ctx->o_ctx);
EVP_MD_CTX_free(ctx->md_ctx);
OPENSSL_free(ctx);
}
}
*/
#endif
/* OPENSSL_VERSION_NUMBER < 0x10100000L */
#endif
/* OPENSSL_VERSION_NUMBER < 0x10100000L */
#if OPENSSL_VERSION_NUMBER < 0x0090801fL
#if OPENSSL_VERSION_NUMBER < 0x0090801fL
...
@@ -422,10 +327,10 @@ BRPC_INLINE BIGNUM* get_rfc2409_prime_1024(BIGNUM* bn) {
...
@@ -422,10 +327,10 @@ BRPC_INLINE BIGNUM* get_rfc2409_prime_1024(BIGNUM* bn) {
0x7C
,
0x4B
,
0x1F
,
0xE6
,
0x49
,
0x28
,
0x66
,
0x51
,
0xEC
,
0xE6
,
0x53
,
0x81
,
0x7C
,
0x4B
,
0x1F
,
0xE6
,
0x49
,
0x28
,
0x66
,
0x51
,
0xEC
,
0xE6
,
0x53
,
0x81
,
0xFF
,
0xFF
,
0xFF
,
0xFF
,
0xFF
,
0xFF
,
0xFF
,
0xFF
,
0xFF
,
0xFF
,
0xFF
,
0xFF
,
0xFF
,
0xFF
,
0xFF
,
0xFF
,
};
};
return
BN_bin2bn
(
RFC2409_PRIME_1024
,
sizeof
(
RFC2409_
RP
IME_1024
),
bn
);
return
BN_bin2bn
(
RFC2409_PRIME_1024
,
sizeof
(
RFC2409_
PR
IME_1024
),
bn
);
}
}
BRPC_INLINE
BIGNUM
*
get_rfc3526_prime_2048
(
BIGNUM
*
bn
)
;
BRPC_INLINE
BIGNUM
*
get_rfc3526_prime_2048
(
BIGNUM
*
bn
)
{
static
const
unsigned
char
RFC3526_PRIME_2048
[]
=
{
static
const
unsigned
char
RFC3526_PRIME_2048
[]
=
{
0xFF
,
0xFF
,
0xFF
,
0xFF
,
0xFF
,
0xFF
,
0xFF
,
0xFF
,
0xC9
,
0x0F
,
0xDA
,
0xA2
,
0xFF
,
0xFF
,
0xFF
,
0xFF
,
0xFF
,
0xFF
,
0xFF
,
0xFF
,
0xC9
,
0x0F
,
0xDA
,
0xA2
,
0x21
,
0x68
,
0xC2
,
0x34
,
0xC4
,
0xC6
,
0x62
,
0x8B
,
0x80
,
0xDC
,
0x1C
,
0xD1
,
0x21
,
0x68
,
0xC2
,
0x34
,
0xC4
,
0xC6
,
0x62
,
0x8B
,
0x80
,
0xDC
,
0x1C
,
0xD1
,
...
@@ -595,6 +500,14 @@ BRPC_INLINE BIGNUM* get_rfc3526_prime_8192(BIGNUM* bn) {
...
@@ -595,6 +500,14 @@ BRPC_INLINE BIGNUM* get_rfc3526_prime_8192(BIGNUM* bn) {
return
BN_bin2bn
(
RFC3526_PRIME_8192
,
sizeof
(
RFC3526_PRIME_8192
),
bn
);
return
BN_bin2bn
(
RFC3526_PRIME_8192
,
sizeof
(
RFC3526_PRIME_8192
),
bn
);
}
}
BRPC_INLINE
int
EVP_PKEY_base_id
(
const
EVP_PKEY
*
pkey
)
{
return
EVP_PKEY_type
(
pkey
->
type
);
}
BRPC_INLINE
int
EVP_PKEY_base_id
(
const
EVP_PKEY
*
pkey
)
{
return
EVP_PKEY_type
(
pkey
->
type
);
}
#endif
/* OPENSSL_VERSION_NUMBER < 0x0090801fL */
#endif
/* OPENSSL_VERSION_NUMBER < 0x0090801fL */
#endif
/* BRPC_BASE_SSL_COMPAT_H */
#endif
/* BRPC_BASE_SSL_COMPAT_H */
tools/patch_from_svn
View file @
83cd59d8
...
@@ -5,12 +5,16 @@ if [ -z "$1" ]; then
...
@@ -5,12 +5,16 @@ if [ -z "$1" ]; then
exit
1
exit
1
fi
fi
PATCHFILE
=
$1
PATCHFILE
=
$1
FILTER_TARGET_DIR_CMD
=
if
[
-d
"
$1
/.svn"
]
;
then
if
[
-d
"
$1
/.svn"
]
;
then
if
[
-z
"
$2
"
]
;
then
if
[
-z
"
$2
"
]
;
then
echo
"Second argument must be a SVN revision"
echo
"Second argument must be a SVN revision"
exit
1
exit
1
fi
fi
CURRENT_DIR
=
`
pwd
`
SVN_DIR
=
$1
SVN_DIR
=
$1
# replace the filepaths in diff
FILTER_TARGET_DIR_CMD
=
-e
\
"s|
$SVN_DIR
|
$CURRENT_DIR
/src/|g"
REV
=
$2
REV
=
$2
PATCHFILE
=
$REV
.patch
PATCHFILE
=
$REV
.patch
echo
"*** Generating diff of
$SVN_DIR
@
$REV
"
echo
"*** Generating diff of
$SVN_DIR
@
$REV
"
...
@@ -19,7 +23,7 @@ fi
...
@@ -19,7 +23,7 @@ fi
MODIFIED_PATCHFILE
=
"
$(
basename
$PATCHFILE
)
.brpc_os"
MODIFIED_PATCHFILE
=
"
$(
basename
$PATCHFILE
)
.brpc_os"
cat
$PATCHFILE
|
sed
-e
's/src\/baidu\/rpc\//brpc\//g'
\
cat
$PATCHFILE
|
sed
-e
's/src\/baidu\/rpc\//
src\/
brpc\//g'
\
-e
's/\<baidu\/rpc\//brpc\//g'
\
-e
's/\<baidu\/rpc\//brpc\//g'
\
-e
's/brpc\/test\/test_\(.*\)\.cpp/test\/brpc_\1_unittest.cpp/g'
\
-e
's/brpc\/test\/test_\(.*\)\.cpp/test\/brpc_\1_unittest.cpp/g'
\
-e
's/\<namespace \+baidu *{/namespace brpc {/g'
\
-e
's/\<namespace \+baidu *{/namespace brpc {/g'
\
...
@@ -29,18 +33,22 @@ cat $PATCHFILE | sed -e 's/src\/baidu\/rpc\//brpc\//g' \
...
@@ -29,18 +33,22 @@ cat $PATCHFILE | sed -e 's/src\/baidu\/rpc\//brpc\//g' \
-e
's/\<baidu::rpc::/brpc::/g'
\
-e
's/\<baidu::rpc::/brpc::/g'
\
-e
's/\<rpc::/brpc::/g'
\
-e
's/\<rpc::/brpc::/g'
\
-e
's/\<BAIDU_RPC_/BRPC_/g'
\
-e
's/\<BAIDU_RPC_/BRPC_/g'
\
-e
's/\<protocol\/\(.*\)\.proto/\1.proto/g'
\
-e
's/\<protocol\/\(.*\)\.proto/
src\/
\1.proto/g'
\
-e
's/TEST_F(HttpMessageTest/TEST(HttpMessageTest/g'
\
-e
's/TEST_F(HttpMessageTest/TEST(HttpMessageTest/g'
\
-e
's/TEST_F(URITest/TEST(URITest/g'
\
-e
's/TEST_F(URITest/TEST(URITest/g'
\
-e
's/bthread_cond\.cpp/bthread\/condition_variable.cpp/g'
\
-e
's/bthread_cond\.cpp/
src\/
bthread\/condition_variable.cpp/g'
\
-e
's/bthread_\([^.]*\)\.cpp/bthread\/\1.cpp/g'
\
-e
's/bthread_\([^.]*\)\.cpp/
src\/
bthread\/\1.cpp/g'
\
-e
's/bthread_\([^.]*\)\.h/bthread\/\1.h/g'
\
-e
's/bthread_\([^.]*\)\.h/
src\/
bthread\/\1.h/g'
\
-e
's/bthread\.h/bthread\/bthread.h/g'
\
-e
's/bthread\.h/
src\/
bthread\/bthread.h/g'
\
-e
's/<\(brpc\/[^>]*\)>/"\1"/g'
\
-e
's/<\(brpc\/[^>]*\)>/"\1"/g'
\
-e
's/<\(bvar\/[^>]*\)>/"\1"/g'
\
-e
's/<\(bvar\/[^>]*\)>/"\1"/g'
\
-e
's/<\(base\/[^>]*\)>/"\1"/g'
\
-e
's/<\(base\/[^>]*\)>/"\1"/g'
\
-e
's/<\(bthread\/[^>]*\)>/"\1"/g'
\
-e
's/<\(bthread\/[^>]*\)>/"\1"/g'
\
-e
's/<\(mcpack2pb\/[^>]*\)>/"\1"/g'
\
-e
's/<\(mcpack2pb\/[^>]*\)>/"\1"/g'
\
-e
's/ base\// src\/base\//g'
\
-e
's/ bthread\// src\/bthread\//g'
\
-e
's/ bvar\// src\/bvar\//g'
\
$FILTER_TARGET_DIR_CMD
\
>
$MODIFIED_PATCHFILE
>
$MODIFIED_PATCHFILE
EXTRA_ARGS
=
EXTRA_ARGS
=
if
[
-z
"
$DO_RUN
"
]
;
then
if
[
-z
"
$DO_RUN
"
]
;
then
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment