Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
tg
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
tg
Commits
a73ca70a
Commit
a73ca70a
authored
Oct 02, 2015
by
V V
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
merged openssl switch
parent
c6de6b20
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
244 additions
and
10 deletions
+244
-10
Makefile.tgl
Makefile.tgl
+2
-2
config.h.in
config.h.in
+7
-0
configure
configure
+216
-1
configure.ac
configure.ac
+13
-1
interface.c
interface.c
+2
-0
loop.c
loop.c
+1
-5
main.c
main.c
+2
-0
tgl
tgl
+1
-1
No files found.
Makefile.tgl
View file @
a73ca70a
TGL_OBJECTS
=
${
OBJ
}
/mtproto-common.o
${
OBJ
}
/mtproto-client.o
${
OBJ
}
/queries.o
${
OBJ
}
/structures.o
${
OBJ
}
/binlog.o
${
OBJ
}
/tgl.o
${
OBJ
}
/updates.o
${
OBJ
}
/tgl-net.o
${
OBJ
}
/tgl-timers.o
${
OBJ
}
/tg-mime-types.o
${
OBJ
}
/mtproto-utils.o
TGL_OBJECTS
=
${
OBJ
}
/mtproto-common.o
${
OBJ
}
/mtproto-client.o
${
OBJ
}
/queries.o
${
OBJ
}
/structures.o
${
OBJ
}
/binlog.o
${
OBJ
}
/tgl.o
${
OBJ
}
/updates.o
${
OBJ
}
/tgl-net.o
${
OBJ
}
/tgl-timers.o
${
OBJ
}
/tg-mime-types.o
${
OBJ
}
/mtproto-utils.o
${
OBJ
}
/crypto/bn_openssl.o
${
OBJ
}
/crypto/bn_altern.o
${
OBJ
}
/crypto/rsa_pem_openssl.o
${
OBJ
}
/crypto/rsa_pem_altern.o
${
OBJ
}
/crypto/md5_openssl.o
${
OBJ
}
/crypto/md5_altern.o
${
OBJ
}
/crypto/sha_openssl.o
${
OBJ
}
/crypto/sha_altern.o
${
OBJ
}
/crypto/aes_openssl.o
${
OBJ
}
/crypto/aes_altern.o
TGL_OBJECTS_AUTO
=
${
OBJ
}
/auto/auto-skip.o
${
OBJ
}
/auto/auto-fetch.o
${
OBJ
}
/auto/auto-store.o
${
OBJ
}
/auto/auto-autocomplete.o
${
OBJ
}
/auto/auto-types.o
${
OBJ
}
/auto/auto-fetch-ds.o
${
OBJ
}
/auto/auto-free-ds.o
${
OBJ
}
/auto/auto-store-ds.o
${
OBJ
}
/auto/auto-print-ds.o
TGL_OBJECTS_AUTO
=
${
OBJ
}
/auto/auto-skip.o
${
OBJ
}
/auto/auto-fetch.o
${
OBJ
}
/auto/auto-store.o
${
OBJ
}
/auto/auto-autocomplete.o
${
OBJ
}
/auto/auto-types.o
${
OBJ
}
/auto/auto-fetch-ds.o
${
OBJ
}
/auto/auto-free-ds.o
${
OBJ
}
/auto/auto-store-ds.o
${
OBJ
}
/auto/auto-print-ds.o
TLD_OBJECTS
=
${
OBJ
}
/dump-tl-file.o
TLD_OBJECTS
=
${
OBJ
}
/dump-tl-file.o
GENERATE_OBJECTS
=
${
OBJ
}
/generate.o
GENERATE_OBJECTS
=
${
OBJ
}
/generate.o
TGL_COMMON_OBJECTS
=
${
OBJ
}
/tools.o
TGL_COMMON_OBJECTS
=
${
OBJ
}
/tools.o
${
OBJ
}
/crypto/rand_openssl.o
${
OBJ
}
/crypto/rand_altern.o
${
OBJ
}
/crypto/err_openssl.o
${
OBJ
}
/crypto/err_altern.o
TGL_OBJ_C
=
${
GENERATE_OBJECTS
}
${
TGL_COMMON_OBJECTS
}
${
TGL_OBJECTS
}
${
TLD_OBJECTS
}
TGL_OBJ_C
=
${
GENERATE_OBJECTS
}
${
TGL_COMMON_OBJECTS
}
${
TGL_OBJECTS
}
${
TLD_OBJECTS
}
.SUFFIXES
:
.SUFFIXES
:
...
...
config.h.in
View file @
a73ca70a
...
@@ -36,6 +36,9 @@
...
@@ -36,6 +36,9 @@
/* Define to 1 if you have the `event' library (-levent). */
/* Define to 1 if you have the `event' library (-levent). */
#undef HAVE_LIBEVENT
#undef HAVE_LIBEVENT
/* Define to 1 if you have the `gcrypt' library (-lgcrypt). */
#undef HAVE_LIBGCRYPT
/* Define to 1 if you have the `jansson' library (-ljansson). */
/* Define to 1 if you have the `jansson' library (-ljansson). */
#undef HAVE_LIBJANSSON
#undef HAVE_LIBJANSSON
...
@@ -158,6 +161,10 @@
...
@@ -158,6 +161,10 @@
/* Define to 1 if you have the ANSI C header files. */
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
#undef STDC_HEADERS
/* avoid OpenSSL entirely, use libgcrypt instead (this can't read *.pub files,
though.) */
#undef TGL_AVOID_OPENSSL
/* use json */
/* use json */
#undef USE_JSON
#undef USE_JSON
...
...
configure
View file @
a73ca70a
...
@@ -695,6 +695,7 @@ SHELL'
...
@@ -695,6 +695,7 @@ SHELL'
ac_subst_files
=
''
ac_subst_files
=
''
ac_user_opts
=
'
ac_user_opts
=
'
enable_option_checking
enable_option_checking
enable_openssl
with_openssl
with_openssl
with_zlib
with_zlib
enable_libconfig
enable_libconfig
...
@@ -1326,6 +1327,8 @@ Optional Features:
...
@@ -1326,6 +1327,8 @@ Optional Features:
--disable-option-checking ignore unrecognized --enable/--with options
--disable-option-checking ignore unrecognized --enable/--with options
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--disable-openssl disables OpenSSL, and don't link against it
(this can't read *.pub files, though.)
--enable-libconfig/--disable-libconfig
--enable-libconfig/--disable-libconfig
--enable-extf/--disable-extf
--enable-extf/--disable-extf
--enable-liblua/--disable-liblua
--enable-liblua/--disable-liblua
...
@@ -4129,6 +4132,60 @@ EXTRA_LIBS=""
...
@@ -4129,6 +4132,60 @@ EXTRA_LIBS=""
# OPENSSL_LIBS to the -l directives required
# OPENSSL_LIBS to the -l directives required
# OPENSSL_LDFLAGS to the -L or -R flags required
# OPENSSL_LDFLAGS to the -L or -R flags required
# Check whether --enable-openssl was given.
if
test
"
${
enable_openssl
+set
}
"
=
set
;
then
:
enableval
=
$enable_openssl
;
if
test
"x
$enableval
"
=
"xno"
;
then
$as_echo
"#define TGL_AVOID_OPENSSL 1"
>>
confdefs.h
{
$as_echo
"
$as_me
:
${
as_lineno
-
$LINENO
}
: checking for gcry_md_open in -lgcrypt"
>
&5
$as_echo_n
"checking for gcry_md_open in -lgcrypt... "
>
&6
;
}
if
${
ac_cv_lib_gcrypt_gcry_md_open
+
:
}
false
;
then
:
$as_echo_n
"(cached) "
>
&6
else
ac_check_lib_save_LIBS
=
$LIBS
LIBS
=
"-lgcrypt
$LIBS
"
cat
confdefs.h -
<<
_ACEOF
>conftest.
$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char gcry_md_open ();
int
main ()
{
return gcry_md_open ();
;
return 0;
}
_ACEOF
if
ac_fn_c_try_link
"
$LINENO
"
;
then
:
ac_cv_lib_gcrypt_gcry_md_open
=
yes
else
ac_cv_lib_gcrypt_gcry_md_open
=
no
fi
rm
-f
core conftest.err conftest.
$ac_objext
\
conftest
$ac_exeext
conftest.
$ac_ext
LIBS
=
$ac_check_lib_save_LIBS
fi
{
$as_echo
"
$as_me
:
${
as_lineno
-
$LINENO
}
: result:
$ac_cv_lib_gcrypt_gcry_md_open
"
>
&5
$as_echo
"
$ac_cv_lib_gcrypt_gcry_md_open
"
>
&6
;
}
if
test
"x
$ac_cv_lib_gcrypt_gcry_md_open
"
=
xyes
;
then
:
cat
>>
confdefs.h
<<
_ACEOF
#define HAVE_LIBGCRYPT 1
_ACEOF
LIBS
=
"-lgcrypt
$LIBS
"
fi
else
# Don't be annoying, so don't inform the user about --disable-openssl
found
=
false
found
=
false
...
@@ -4267,7 +4324,7 @@ else
...
@@ -4267,7 +4324,7 @@ else
{
$as_echo
"
$as_me
:
${
as_lineno
-
$LINENO
}
: result: no"
>
&5
{
$as_echo
"
$as_me
:
${
as_lineno
-
$LINENO
}
: result: no"
>
&5
$as_echo
"no"
>
&6
;
}
$as_echo
"no"
>
&6
;
}
as_fn_error
$?
"No openssl found"
"
$LINENO
"
5
as_fn_error
$?
"No openssl found
.
"
"
$LINENO
"
5
fi
fi
rm
-f
core conftest.err conftest.
$ac_objext
\
rm
-f
core conftest.err conftest.
$ac_objext
\
...
@@ -4280,6 +4337,164 @@ rm -f core conftest.err conftest.$ac_objext \
...
@@ -4280,6 +4337,164 @@ rm -f core conftest.err conftest.$ac_objext \
fi
else
found
=
false
# Check whether --with-openssl was given.
if
test
"
${
with_openssl
+set
}
"
=
set
;
then
:
withval
=
$with_openssl
;
case
"
$withval
"
in
""
|
y
|
ye
|
yes
|
n
|
no
)
as_fn_error
$?
"Invalid --with-openssl value"
"
$LINENO
"
5
;;
*
)
ssldirs
=
"
$withval
"
;;
esac
else
# if pkg-config is installed and openssl has installed a .pc file,
# then use that information and don't search ssldirs
# Extract the first word of "pkg-config", so it can be a program name with args.
set
dummy pkg-config
;
ac_word
=
$2
{
$as_echo
"
$as_me
:
${
as_lineno
-
$LINENO
}
: checking for
$ac_word
"
>
&5
$as_echo_n
"checking for
$ac_word
... "
>
&6
;
}
if
${
ac_cv_path_PKG_CONFIG
+
:
}
false
;
then
:
$as_echo_n
"(cached) "
>
&6
else
case
$PKG_CONFIG
in
[
\\
/]
*
|
?:[
\\
/]
*
)
ac_cv_path_PKG_CONFIG
=
"
$PKG_CONFIG
"
# Let the user override the test with a path.
;;
*
)
as_save_IFS
=
$IFS
;
IFS
=
$PATH_SEPARATOR
for
as_dir
in
$PATH
do
IFS
=
$as_save_IFS
test
-z
"
$as_dir
"
&&
as_dir
=
.
for
ac_exec_ext
in
''
$ac_executable_extensions
;
do
if
as_fn_executable_p
"
$as_dir
/
$ac_word$ac_exec_ext
"
;
then
ac_cv_path_PKG_CONFIG
=
"
$as_dir
/
$ac_word$ac_exec_ext
"
$as_echo
"
$as_me
:
${
as_lineno
-
$LINENO
}
: found
$as_dir
/
$ac_word$ac_exec_ext
"
>
&5
break
2
fi
done
done
IFS
=
$as_save_IFS
;;
esac
fi
PKG_CONFIG
=
$ac_cv_path_PKG_CONFIG
if
test
-n
"
$PKG_CONFIG
"
;
then
{
$as_echo
"
$as_me
:
${
as_lineno
-
$LINENO
}
: result:
$PKG_CONFIG
"
>
&5
$as_echo
"
$PKG_CONFIG
"
>
&6
;
}
else
{
$as_echo
"
$as_me
:
${
as_lineno
-
$LINENO
}
: result: no"
>
&5
$as_echo
"no"
>
&6
;
}
fi
if
test
x
"
$PKG_CONFIG
"
!=
x
""
;
then
OPENSSL_LDFLAGS
=
`
$PKG_CONFIG
openssl
--libs-only-L
2>/dev/null
`
if
test
$?
=
0
;
then
OPENSSL_LIBS
=
`
$PKG_CONFIG
openssl
--libs-only-l
2>/dev/null
`
OPENSSL_INCLUDES
=
`
$PKG_CONFIG
openssl
--cflags-only-I
2>/dev/null
`
found
=
true
fi
fi
# no such luck; use some default ssldirs
if
!
$found
;
then
ssldirs
=
"/usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /usr"
fi
fi
# note that we #include <openssl/foo.h>, so the OpenSSL headers have to be in
# an 'openssl' subdirectory
if
!
$found
;
then
OPENSSL_INCLUDES
=
for
ssldir
in
$ssldirs
;
do
{
$as_echo
"
$as_me
:
${
as_lineno
-
$LINENO
}
: checking for openssl/ssl.h in
$ssldir
"
>
&5
$as_echo_n
"checking for openssl/ssl.h in
$ssldir
... "
>
&6
;
}
if
test
-f
"
$ssldir
/include/openssl/ssl.h"
;
then
OPENSSL_INCLUDES
=
"-I
$ssldir
/include"
OPENSSL_LDFLAGS
=
"-L
$ssldir
/lib"
OPENSSL_LIBS
=
"-lssl -lcrypto"
found
=
true
{
$as_echo
"
$as_me
:
${
as_lineno
-
$LINENO
}
: result: yes"
>
&5
$as_echo
"yes"
>
&6
;
}
break
else
{
$as_echo
"
$as_me
:
${
as_lineno
-
$LINENO
}
: result: no"
>
&5
$as_echo
"no"
>
&6
;
}
fi
done
# if the file wasn't found, well, go ahead and try the link anyway -- maybe
# it will just work!
fi
# try the preprocessor and linker with our new flags,
# being careful not to pollute the global LIBS, LDFLAGS, and CPPFLAGS
{
$as_echo
"
$as_me
:
${
as_lineno
-
$LINENO
}
: checking whether compiling and linking against OpenSSL works"
>
&5
$as_echo_n
"checking whether compiling and linking against OpenSSL works... "
>
&6
;
}
echo
"Trying link with OPENSSL_LDFLAGS=
$OPENSSL_LDFLAGS
;"
\
"OPENSSL_LIBS=
$OPENSSL_LIBS
; OPENSSL_INCLUDES=
$OPENSSL_INCLUDES
"
>
&5
save_LIBS
=
"
$LIBS
"
save_LDFLAGS
=
"
$LDFLAGS
"
save_CPPFLAGS
=
"
$CPPFLAGS
"
LDFLAGS
=
"
$LDFLAGS
$OPENSSL_LDFLAGS
"
LIBS
=
"
$OPENSSL_LIBS
$LIBS
"
CPPFLAGS
=
"
$OPENSSL_INCLUDES
$CPPFLAGS
"
cat
confdefs.h -
<<
_ACEOF
>conftest.
$ac_ext
/* end confdefs.h. */
#include <openssl/ssl.h>
int
main ()
{
SSL_new(NULL)
;
return 0;
}
_ACEOF
if
ac_fn_c_try_link
"
$LINENO
"
;
then
:
{
$as_echo
"
$as_me
:
${
as_lineno
-
$LINENO
}
: result: yes"
>
&5
$as_echo
"yes"
>
&6
;
}
else
{
$as_echo
"
$as_me
:
${
as_lineno
-
$LINENO
}
: result: no"
>
&5
$as_echo
"no"
>
&6
;
}
as_fn_error
$?
"No openssl found. With --disable-openssl, libtgl will use libgcrypt instead."
"
$LINENO
"
5
fi
rm
-f
core conftest.err conftest.
$ac_objext
\
conftest
$ac_exeext
conftest.
$ac_ext
CPPFLAGS
=
"
$save_CPPFLAGS
"
LDFLAGS
=
"
$save_LDFLAGS
"
LIBS
=
"
$save_LIBS
"
fi
#
#
# Handle user hints
# Handle user hints
#
#
...
...
configure.ac
View file @
a73ca70a
...
@@ -34,7 +34,19 @@ EXTRA_LIBS=""
...
@@ -34,7 +34,19 @@ EXTRA_LIBS=""
# OPENSSL_LIBS to the -l directives required
# OPENSSL_LIBS to the -l directives required
# OPENSSL_LDFLAGS to the -L or -R flags required
# OPENSSL_LDFLAGS to the -L or -R flags required
AX_CHECK_OPENSSL(,[AC_MSG_ERROR([No openssl found])])
AC_ARG_ENABLE(openssl,[ --disable-openssl disables OpenSSL, and don't link against it
(this can't read *.pub files, though.)],
[
if test "x$enableval" = "xno" ; then
AC_DEFINE([TGL_AVOID_OPENSSL],[1],[avoid OpenSSL entirely, use libgcrypt instead (this can't read *.pub files, though.)])
AC_CHECK_LIB([gcrypt], [gcry_md_open])
else
# Don't be annoying, so don't inform the user about --disable-openssl
AX_CHECK_OPENSSL(,[AC_MSG_ERROR([No openssl found.])])
fi
],[
AX_CHECK_OPENSSL(,[AC_MSG_ERROR([No openssl found. With --disable-openssl, libtgl will use libgcrypt instead.])])
])
AX_CHECK_ZLIB(, [AC_MSG_ERROR([No zlib found])])
AX_CHECK_ZLIB(, [AC_MSG_ERROR([No zlib found])])
AC_CHECK_LIB([readline], [rl_save_prompt], [ EXTRA_LIBS="${EXTRA_LIBS} -lreadline" ; ], [AC_MSG_ERROR([no libreadline found])])
AC_CHECK_LIB([readline], [rl_save_prompt], [ EXTRA_LIBS="${EXTRA_LIBS} -lreadline" ; ], [AC_MSG_ERROR([no libreadline found])])
...
...
interface.c
View file @
a73ca70a
...
@@ -93,6 +93,8 @@
...
@@ -93,6 +93,8 @@
#include "auto/auto-types.h"
#include "auto/auto-types.h"
#include "auto/auto-free-ds.h"
#include "auto/auto-free-ds.h"
#include <errno.h>
#define ALLOW_MULT 1
#define ALLOW_MULT 1
char
*
default_prompt
=
"> "
;
char
*
default_prompt
=
"> "
;
...
...
loop.c
View file @
a73ca70a
...
@@ -637,11 +637,7 @@ void read_secret_chat (int fd, int v) {
...
@@ -637,11 +637,7 @@ void read_secret_chat (int fd, int v) {
assert
(
read
(
fd
,
&
state
,
4
)
==
4
);
assert
(
read
(
fd
,
&
state
,
4
)
==
4
);
assert
(
read
(
fd
,
&
key_fingerprint
,
8
)
==
8
);
assert
(
read
(
fd
,
&
key_fingerprint
,
8
)
==
8
);
assert
(
read
(
fd
,
&
key
,
256
)
==
256
);
assert
(
read
(
fd
,
&
key
,
256
)
==
256
);
if
(
v
>=
2
)
{
assert
(
read
(
fd
,
sha
,
20
)
==
20
);
assert
(
read
(
fd
,
sha
,
20
)
==
20
);
}
else
{
SHA1
((
void
*
)
key
,
256
,
sha
);
}
int
in_seq_no
=
0
,
out_seq_no
=
0
,
last_in_seq_no
=
0
;
int
in_seq_no
=
0
,
out_seq_no
=
0
,
last_in_seq_no
=
0
;
if
(
v
>=
1
)
{
if
(
v
>=
1
)
{
assert
(
read
(
fd
,
&
in_seq_no
,
4
)
==
4
);
assert
(
read
(
fd
,
&
in_seq_no
,
4
)
==
4
);
...
...
main.c
View file @
a73ca70a
...
@@ -973,6 +973,8 @@ int main (int argc, char **argv) {
...
@@ -973,6 +973,8 @@ int main (int argc, char **argv) {
#endif
#endif
tgl_set_rsa_key
(
TLS
,
"tg-server.pub"
);
tgl_set_rsa_key
(
TLS
,
"tg-server.pub"
);
#include "tgl/mtproto-key.c"
tgl_set_rsa_key_direct
(
TLS
,
_mtproto_default_e
,
_mtproto_default_key_len
,
_mtproto_default_key
);
get_terminal_attributes
();
get_terminal_attributes
();
...
...
tgl
@
e9858634
Subproject commit
5faeb3e0bed7237fef33b77855ba3be408ef712d
Subproject commit
e9858634ec18db8ae7a6fe70daa00af1b3970772
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