├── testdata ├── x509 │ ├── google.dk │ │ ├── wildcard-google.dk-leaf.notAfter │ │ ├── wildcard-google.dk-leaf.notBefore │ │ ├── wildcard-google.dk-leaf.crt │ │ ├── wildcard-google.dk-chain.p12 │ │ ├── wildcard-google.dk-leaf.sha1 │ │ ├── wildcard-google.dk-leaf.sha256 │ │ ├── wildcard-google.dk-chain-password.p12 │ │ ├── generate.bash │ │ └── wildcard-google.dk-chain.pem │ ├── altnames │ │ ├── dns.crt │ │ ├── dns.key │ │ ├── email.crt │ │ ├── email.key │ │ ├── dns.cnf │ │ ├── email.cnf │ │ └── generate.bash │ ├── selfsign │ │ ├── self.crt │ │ ├── self.key │ │ └── generate.bash │ ├── trickydn │ │ ├── tricky.crt │ │ ├── tricky.key │ │ └── generate.bash │ └── selfsign-server │ │ ├── selfsign-server.crt │ │ ├── selfsign-server.key │ │ ├── selfsign-server.cnf │ │ └── generate.bash └── vet.bash ├── AUTHORS ├── 3rdparty ├── opensslbuild │ ├── include │ │ └── openssl │ │ │ ├── e_os2.h │ │ │ ├── kssl.h │ │ │ ├── ssl.h │ │ │ ├── ssl2.h │ │ │ ├── ssl3.h │ │ │ ├── tls1.h │ │ │ ├── aes.h │ │ │ ├── bio.h │ │ │ ├── bn.h │ │ │ ├── cms.h │ │ │ ├── des.h │ │ │ ├── dh.h │ │ │ ├── dsa.h │ │ │ ├── dso.h │ │ │ ├── dtls1.h │ │ │ ├── ec.h │ │ │ ├── err.h │ │ │ ├── evp.h │ │ │ ├── md4.h │ │ │ ├── md5.h │ │ │ ├── pem.h │ │ │ ├── rc2.h │ │ │ ├── rc4.h │ │ │ ├── rsa.h │ │ │ ├── sha.h │ │ │ ├── ssl23.h │ │ │ ├── ts.h │ │ │ ├── ui.h │ │ │ ├── asn1.h │ │ │ ├── asn1t.h │ │ │ ├── cast.h │ │ │ ├── comp.h │ │ │ ├── conf.h │ │ │ ├── crypto.h │ │ │ ├── ebcdic.h │ │ │ ├── ecdh.h │ │ │ ├── hmac.h │ │ │ ├── idea.h │ │ │ ├── mdc2.h │ │ │ ├── ocsp.h │ │ │ ├── pem2.h │ │ │ ├── rand.h │ │ │ ├── seed.h │ │ │ ├── x509.h │ │ │ ├── blowfish.h │ │ │ ├── buffer.h │ │ │ ├── des_old.h │ │ │ ├── ecdsa.h │ │ │ ├── engine.h │ │ │ ├── lhash.h │ │ │ ├── modes.h │ │ │ ├── opensslv.h │ │ │ ├── ossl_typ.h │ │ │ ├── pkcs12.h │ │ │ ├── pkcs7.h │ │ │ ├── pqueue.h │ │ │ ├── ripemd.h │ │ │ ├── stack.h │ │ │ ├── symhacks.h │ │ │ ├── txt_db.h │ │ │ ├── x509v3.h │ │ │ ├── asn1_mac.h │ │ │ ├── camellia.h │ │ │ ├── conf_api.h │ │ │ ├── krb5_asn.h │ │ │ ├── obj_mac.h │ │ │ ├── objects.h │ │ │ ├── safestack.h │ │ │ ├── ui_compat.h │ │ │ ├── whrlpool.h │ │ │ ├── x509_vfy.h │ │ │ └── opensslconf.h │ ├── generate-assembly.bash │ ├── generate-headers.bash │ ├── genasm-gnuas-x86_64.bash │ ├── genasm-gnuas-arm.bash │ ├── generate-opensslconf.bash │ ├── genasm-gnuas-x86.bash │ └── asm │ │ ├── gnuas-x86_64-macosx │ │ └── crypto │ │ │ ├── bn │ │ │ └── asm │ │ │ │ └── x86_64-mont.S │ │ │ └── x86_64cpuid.S │ │ ├── gnuas-x86_64-mingw64 │ │ └── crypto │ │ │ ├── x86_64cpuid.S │ │ │ └── bn │ │ │ └── asm │ │ │ └── x86_64-mont.S │ │ ├── gnuas-x86_64-elf │ │ └── crypto │ │ │ ├── bn │ │ │ └── asm │ │ │ │ └── x86_64-mont.S │ │ │ └── x86_64cpuid.S │ │ ├── gnuas-arm-macosx │ │ └── crypto │ │ │ └── bn │ │ │ └── asm │ │ │ └── armv4-mont.S │ │ ├── gnuas-arm-elf │ │ └── crypto │ │ │ └── bn │ │ │ └── asm │ │ │ └── armv4-mont.S │ │ ├── gnuas-x86-macosx │ │ └── crypto │ │ │ ├── rc4 │ │ │ └── asm │ │ │ │ └── rc4-586.S │ │ │ └── x86cpuid.S │ │ └── gnuas-x86-elf │ │ └── crypto │ │ └── rc4 │ │ └── asm │ │ └── rc4-586.S ├── gtestbuild │ └── ios │ │ ├── crt_externs.c │ │ └── include │ │ └── crt_externs.h ├── libuvbuild │ ├── README │ └── diff-uv.gyp.bash ├── yasm │ ├── LICENSE.chromium │ └── yasm_gnuas.gypi └── protobufbuild │ ├── LICENSE.chromium │ ├── protoc.gypi │ └── config.h ├── src ├── Utils.h ├── mumble_test.mm ├── Compat_android.h ├── Utils.cpp ├── Compat_win.h ├── mumble_test.h ├── UVUtils.h ├── X509Verifier_mac.h ├── UVUtils.cpp ├── X509Verifier_unix.h ├── X509Verifier_android.h ├── X509HostnameVerifier.h ├── X509PEMVerifier.h ├── OpenSSLUtils.h ├── Compat_android.cpp ├── X509Verifier_win.h ├── UVBio.h ├── Compat_win.cpp ├── TLSConnection.cpp ├── Error.cpp ├── mumble_test.cpp ├── demo.cpp ├── X509Verifier_unix.cpp ├── X509Certificate_p.h ├── Compat_win_test.cpp ├── X509HostnameVerifier_test.cpp ├── OpenSSLUtils.cpp ├── Compat_android_test.cpp ├── X509HostnameVerifier.cpp ├── TLSConnection_p.h ├── X509Certificate.cpp ├── X509PEMVerifier.cpp ├── X509Verifier_android.cpp ├── ByteArray.cpp ├── UVBio.cpp ├── X509Verifier_mac.mm ├── ByteArray_test.cpp └── X509Verifier_test.cpp ├── proto ├── Mumble.pb.cpp └── generate.bash ├── test.bat ├── .gitmodules ├── .gitignore ├── common.gypi ├── LICENSE ├── include └── mumble │ ├── X509Verifier.h │ └── Error.h ├── test.bash └── README /testdata/x509/google.dk/wildcard-google.dk-leaf.notAfter: -------------------------------------------------------------------------------- 1 | 1370634207 -------------------------------------------------------------------------------- /testdata/x509/google.dk/wildcard-google.dk-leaf.notBefore: -------------------------------------------------------------------------------- 1 | 1354784164 -------------------------------------------------------------------------------- /testdata/x509/altnames/dns.crt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mumble-voip/libmumble-legacy/master/testdata/x509/altnames/dns.crt -------------------------------------------------------------------------------- /testdata/x509/altnames/dns.key: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mumble-voip/libmumble-legacy/master/testdata/x509/altnames/dns.key -------------------------------------------------------------------------------- /testdata/x509/selfsign/self.crt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mumble-voip/libmumble-legacy/master/testdata/x509/selfsign/self.crt -------------------------------------------------------------------------------- /testdata/x509/selfsign/self.key: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mumble-voip/libmumble-legacy/master/testdata/x509/selfsign/self.key -------------------------------------------------------------------------------- /testdata/x509/altnames/email.crt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mumble-voip/libmumble-legacy/master/testdata/x509/altnames/email.crt -------------------------------------------------------------------------------- /testdata/x509/altnames/email.key: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mumble-voip/libmumble-legacy/master/testdata/x509/altnames/email.key -------------------------------------------------------------------------------- /testdata/x509/trickydn/tricky.crt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mumble-voip/libmumble-legacy/master/testdata/x509/trickydn/tricky.crt -------------------------------------------------------------------------------- /testdata/x509/trickydn/tricky.key: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mumble-voip/libmumble-legacy/master/testdata/x509/trickydn/tricky.key -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | // This file lists The libmumble Developers, the people 2 | // who collectively hold the copyright to libmumble. 3 | 4 | Mikkel Krautz 5 | -------------------------------------------------------------------------------- /testdata/x509/google.dk/wildcard-google.dk-leaf.crt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mumble-voip/libmumble-legacy/master/testdata/x509/google.dk/wildcard-google.dk-leaf.crt -------------------------------------------------------------------------------- /testdata/x509/selfsign-server/selfsign-server.crt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mumble-voip/libmumble-legacy/master/testdata/x509/selfsign-server/selfsign-server.crt -------------------------------------------------------------------------------- /testdata/x509/selfsign-server/selfsign-server.key: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mumble-voip/libmumble-legacy/master/testdata/x509/selfsign-server/selfsign-server.key -------------------------------------------------------------------------------- /testdata/x509/google.dk/wildcard-google.dk-chain.p12: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mumble-voip/libmumble-legacy/master/testdata/x509/google.dk/wildcard-google.dk-chain.p12 -------------------------------------------------------------------------------- /testdata/x509/google.dk/wildcard-google.dk-leaf.sha1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mumble-voip/libmumble-legacy/master/testdata/x509/google.dk/wildcard-google.dk-leaf.sha1 -------------------------------------------------------------------------------- /testdata/x509/google.dk/wildcard-google.dk-leaf.sha256: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mumble-voip/libmumble-legacy/master/testdata/x509/google.dk/wildcard-google.dk-leaf.sha256 -------------------------------------------------------------------------------- /testdata/x509/altnames/dns.cnf: -------------------------------------------------------------------------------- 1 | [v3_req] 2 | subjectAltName = @alt_names 3 | 4 | [alt_names] 5 | DNS.1 = www1.example.com 6 | DNS.2 = www2.example.com 7 | DNS.3 = www3.example.com 8 | -------------------------------------------------------------------------------- /testdata/x509/google.dk/wildcard-google.dk-chain-password.p12: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mumble-voip/libmumble-legacy/master/testdata/x509/google.dk/wildcard-google.dk-chain-password.p12 -------------------------------------------------------------------------------- /testdata/x509/altnames/email.cnf: -------------------------------------------------------------------------------- 1 | [v3_req] 2 | subjectAltName = @alt_names 3 | 4 | [alt_names] 5 | email.1 = noreply@example.com 6 | email.2 = alt@example.com 7 | email.3 = postmaster@example.com 8 | -------------------------------------------------------------------------------- /testdata/x509/selfsign-server/selfsign-server.cnf: -------------------------------------------------------------------------------- 1 | [v3_req] 2 | keyUsage = digitalSignature, Key Encipherment, Data Encipherment 3 | extendedKeyUsage = TLS Web Server Authentication 4 | subjectAltName = @alt_names 5 | 6 | [alt_names] 7 | DNS.1 = mumble.example.com 8 | 9 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/e_os2.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:11+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../e_os2.h" 6 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/kssl.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:12+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../ssl/kssl.h" 6 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/ssl.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:13+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../ssl/ssl.h" 6 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/ssl2.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:13+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../ssl/ssl2.h" 6 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/ssl3.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:13+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../ssl/ssl3.h" 6 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/tls1.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:13+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../ssl/tls1.h" 6 | -------------------------------------------------------------------------------- /src/Utils.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 The libmumble Developers 2 | // The use of this source code is goverened by a BSD-style 3 | // license that can be found in the LICENSE-file. 4 | 5 | #ifndef MUMBLE_UTILS_H_ 6 | #define MUMBLE_UTILS_H_ 7 | 8 | void NotReached(); 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/aes.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:10+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../crypto/aes/aes.h" 6 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/bio.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:10+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../crypto/bio/bio.h" 6 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/bn.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:11+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../crypto/bn/bn.h" 6 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/cms.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:11+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../crypto/cms/cms.h" 6 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/des.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:11+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../crypto/des/des.h" 6 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/dh.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:11+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../crypto/dh/dh.h" 6 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/dsa.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:11+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../crypto/dsa/dsa.h" 6 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/dso.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:11+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../crypto/dso/dso.h" 6 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/dtls1.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:11+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../ssl/dtls1.h" 6 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/ec.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:11+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../crypto/ec/ec.h" 6 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/err.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:12+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../crypto/err/err.h" 6 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/evp.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:12+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../crypto/evp/evp.h" 6 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/md4.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:12+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../crypto/md4/md4.h" 6 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/md5.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:12+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../crypto/md5/md5.h" 6 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/pem.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:12+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../crypto/pem/pem.h" 6 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/rc2.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:13+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../crypto/rc2/rc2.h" 6 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/rc4.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:13+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../crypto/rc4/rc4.h" 6 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/rsa.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:13+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../crypto/rsa/rsa.h" 6 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/sha.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:13+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../crypto/sha/sha.h" 6 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/ssl23.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:13+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../ssl/ssl23.h" 6 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/ts.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:13+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../crypto/ts/ts.h" 6 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/ui.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:13+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../crypto/ui/ui.h" 6 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/asn1.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:10+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../crypto/asn1/asn1.h" 6 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/asn1t.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:10+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../crypto/asn1/asn1t.h" 6 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/cast.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:11+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../crypto/cast/cast.h" 6 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/comp.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:11+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../crypto/comp/comp.h" 6 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/conf.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:11+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../crypto/conf/conf.h" 6 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/crypto.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:11+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../crypto/crypto.h" 6 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/ebcdic.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:11+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../crypto/ebcdic.h" 6 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/ecdh.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:11+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../crypto/ecdh/ecdh.h" 6 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/hmac.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:12+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../crypto/hmac/hmac.h" 6 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/idea.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:12+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../crypto/idea/idea.h" 6 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/mdc2.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:12+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../crypto/mdc2/mdc2.h" 6 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/ocsp.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:12+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../crypto/ocsp/ocsp.h" 6 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/pem2.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:12+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../crypto/pem/pem2.h" 6 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/rand.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:13+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../crypto/rand/rand.h" 6 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/seed.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:13+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../crypto/seed/seed.h" 6 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/x509.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:14+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../crypto/x509/x509.h" 6 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/blowfish.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:10+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../crypto/bf/blowfish.h" 6 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/buffer.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:11+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../crypto/buffer/buffer.h" 6 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/des_old.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:11+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../crypto/des/des_old.h" 6 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/ecdsa.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:11+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../crypto/ecdsa/ecdsa.h" 6 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/engine.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:11+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../crypto/engine/engine.h" 6 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/lhash.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:12+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../crypto/lhash/lhash.h" 6 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/modes.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:12+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../crypto/modes/modes.h" 6 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/opensslv.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:12+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../crypto/opensslv.h" 6 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/ossl_typ.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:12+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../crypto/ossl_typ.h" 6 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/pkcs12.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:12+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../crypto/pkcs12/pkcs12.h" 6 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/pkcs7.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:12+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../crypto/pkcs7/pkcs7.h" 6 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/pqueue.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:13+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../crypto/pqueue/pqueue.h" 6 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/ripemd.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:13+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../crypto/ripemd/ripemd.h" 6 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/stack.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:13+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../crypto/stack/stack.h" 6 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/symhacks.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:13+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../crypto/symhacks.h" 6 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/txt_db.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:13+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../crypto/txt_db/txt_db.h" 6 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/x509v3.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:14+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../crypto/x509v3/x509v3.h" 6 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/asn1_mac.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:10+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../crypto/asn1/asn1_mac.h" 6 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/camellia.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:11+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../crypto/camellia/camellia.h" 6 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/conf_api.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:11+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../crypto/conf/conf_api.h" 6 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/krb5_asn.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:12+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../crypto/krb5/krb5_asn.h" 6 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/obj_mac.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:12+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../crypto/objects/obj_mac.h" 6 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/objects.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:12+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../crypto/objects/objects.h" 6 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/safestack.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:13+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../crypto/stack/safestack.h" 6 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/ui_compat.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:13+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../crypto/ui/ui_compat.h" 6 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/whrlpool.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:13+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../crypto/whrlpool/whrlpool.h" 6 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/x509_vfy.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:14+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #include "../../openssl/include/openssl/../../crypto/x509/x509_vfy.h" 6 | -------------------------------------------------------------------------------- /src/mumble_test.mm: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 The libmumble Developers 2 | // The use of this source code is goverened by a BSD-style 3 | // license that can be found in the LICENSE-file. 4 | 5 | // This file is a redirector that allows mumble_test.cpp to 6 | // be treated as Objective-C++ on iOS. 7 | #include "mumble_test.cpp" -------------------------------------------------------------------------------- /src/Compat_android.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 The libmumble Developers 2 | // The use of this source code is goverened by a BSD-style 3 | // license that can be found in the LICENSE-file. 4 | 5 | #ifndef MUMBLE_COMPAT_ANDROID_H_ 6 | #define MUMBLE_COMPAT_ANDROID_H_ 7 | 8 | #include 9 | 10 | std::time_t timegm(struct tm *tm); 11 | 12 | #endif -------------------------------------------------------------------------------- /src/Utils.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 The libmumble Developers 2 | // The use of this source code is goverened by a BSD-style 3 | // license that can be found in the LICENSE-file. 4 | 5 | #include "Utils.h" 6 | 7 | #include 8 | 9 | void NotReached() { 10 | #ifdef __EXCEPTIONS 11 | throw "not reached"; 12 | #else 13 | abort(); 14 | #endif 15 | } 16 | -------------------------------------------------------------------------------- /proto/Mumble.pb.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 The libmumble Developers 2 | // The use of this source code is goverened by a BSD-style 3 | // license that can be found in the LICENSE-file. 4 | 5 | // This file is a redirector that allows us to include 6 | // Mumble.pb.cc into our sources on Android. Gyp insists 7 | // that all of our C++ sources share the same extension. 8 | #include "Mumble.pb.cc" -------------------------------------------------------------------------------- /src/Compat_win.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 The libmumble Developers 2 | // The use of this source code is goverened by a BSD-style 3 | // license that can be found in the LICENSE-file. 4 | 5 | #ifndef MUMBLE_COMPAT_WIN_H_ 6 | #define MUMBLE_COMPAT_WIN_H_ 7 | 8 | #include 9 | 10 | std::time_t timegm(struct tm *tm); 11 | char *strptime(const char *buf, const char *fmt, struct tm *tm); 12 | 13 | #endif -------------------------------------------------------------------------------- /src/mumble_test.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 The libmumble Developers 2 | // The use of this source code is goverened by a BSD-style 3 | // license that can be found in the LICENSE-file. 4 | 5 | #ifndef MUMBLE_TEST_H_ 6 | #define MUMBLE_TEST_H_ 7 | 8 | #include 9 | 10 | mumble::ByteArray LoadFile(const std::string &path); 11 | bool SaveFile(const std::string &path, const mumble::ByteArray &ba); 12 | 13 | #endif -------------------------------------------------------------------------------- /3rdparty/gtestbuild/ios/crt_externs.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 The libmumble Developers 2 | // The use of this source code is goverened by a BSD-style 3 | // license that can be found in the LICENSE-file. 4 | 5 | #include 6 | 7 | static char **fakeenviron = NULL; 8 | 9 | // _NSGetEnviron will trigger a false positive if submitted 10 | // to Apple for review, so watch out that this stub only gets 11 | // included in the test runner. 12 | char ***_NSGetEnviron() { 13 | return &fakeenviron; 14 | } -------------------------------------------------------------------------------- /src/UVUtils.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 The libmumble Developers 2 | // The use of this source code is goverened by a BSD-style 3 | // license that can be found in the LICENSE-file. 4 | 5 | #ifndef MUMBLE_UV_UTILS_H_ 6 | #define MUMBLE_UV_UTILS_H_ 7 | 8 | #include 9 | 10 | #include 11 | 12 | namespace mumble { 13 | 14 | class UVUtils { 15 | public: 16 | static Error ErrorFromLastUVError(uv_loop_t *loop); 17 | static Error ErrorFromUVError(uv_err_t err); 18 | }; 19 | 20 | } 21 | 22 | #endif -------------------------------------------------------------------------------- /test.bat: -------------------------------------------------------------------------------- 1 | :: Copyright (c) 2013 The libmumble Developers 2 | :: The use of this source code is goverened by a BSD-style 3 | :: license that can be found in the LICENSE-file. 4 | 5 | set GYP=./3rdparty/gyp/gyp_main.py 6 | set GYPFLAGS=-I common.gypi 7 | set GYP_MSVS_VERSION=2013 8 | 9 | python %GYP% libmumble.gyp %GYPFLAGS% -f msvs --depth .. -Dlibrary=static_library -Dopenssl_asm=gnuas-x86_64 -Dtarget_arch=x64 --generator-out=test 10 | msbuild test\libmumble.sln /m /target:libmumble-test 11 | test\Default\libmumble-test.exe -------------------------------------------------------------------------------- /3rdparty/gtestbuild/ios/include/crt_externs.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 The libmumble Developers 2 | // The use of this source code is goverened by a BSD-style 3 | // license that can be found in the LICENSE-file. 4 | 5 | #ifndef LIBMUMBLE_GTEST_CRT_EXTERNS_IPHONEOS_H_ 6 | #define LIBMUMBLE_GTEST_CRT_EXTERNS_IPHONEOS_H_ 7 | 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif // __cpluslplus 11 | 12 | char ***_NSGetEnviron(); 13 | 14 | #ifdef __cplusplus 15 | } 16 | #endif // __cpluslplus 17 | 18 | #endif // LIBMUMBLE_GTEST_CRT_EXTERNS_IPHONEOS_H_ -------------------------------------------------------------------------------- /3rdparty/libuvbuild/README: -------------------------------------------------------------------------------- 1 | The uv.gyp file in this directory is a copy of 3rdparty/libuv 2 | with the following modifications: 3 | 4 | * All paths are changed to be relative to 3rdparty/libuvbuild 5 | instead of 3rdparty/libuv. This is a big change, and a lot 6 | of noise. 7 | 8 | Please use the diff-uv.gyp.bash script provided in this 9 | directory to see the true diff of all the modifications 10 | listed below this one (if any). 11 | 12 | * A small set of changes to allow use of -DOS=ios for generation 13 | of .xcodeprojs compatible with iOS. -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "3rdparty/libuv"] 2 | path = 3rdparty/libuv 3 | url = git://github.com/joyent/libuv.git 4 | [submodule "3rdparty/gtest"] 5 | path = 3rdparty/gtest 6 | url = https://git.chromium.org/git/external/gtest.git 7 | [submodule "3rdparty/openssl"] 8 | path = 3rdparty/openssl 9 | url = git://openssl.net/openssl 10 | [submodule "3rdparty/gyp"] 11 | path = 3rdparty/gyp 12 | url = https://chromium.googlesource.com/external/gyp.git 13 | [submodule "3rdparty/protobuf"] 14 | path = 3rdparty/protobuf 15 | url = https://github.com/mkrautz/external-protobuf.git 16 | -------------------------------------------------------------------------------- /testdata/x509/selfsign/generate.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) 2012 The libmumble Developers 3 | # The use of this source code is goverened by a BSD-style 4 | # license that can be found in the LICENSE-file. 5 | 6 | # Generate a self-signed certificate valid for one year, with CN=SelfSignedTest 7 | openssl genrsa -out /dev/stdout 2048 | openssl rsa -inform PEM -outform DER > self.key 8 | openssl req -new -keyform DER -key self.key -subj "/CN=SelfSignedTest" -out self.csr -batch 9 | openssl x509 -req -days 365 -in self.csr -keyform DER -signkey self.key -out self.crt -outform DER 10 | rm self.csr 11 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .ninja_log 2 | CMakeCache.txt 3 | CMakeFiles 4 | build.ninja 5 | cmake_install.cmake 6 | libmumble.a 7 | mumble-test 8 | mumble-demo 9 | rules.ninja 10 | 3rdparty/yasm/yasm.exe 11 | test/ 12 | 13 | # Android NDK build files. 14 | # These can be cleaned up by running 15 | # build/android/cleanup.bash from the root of the source tree. 16 | build/android/libs 17 | build/android/obj 18 | build/android/jni/3rdparty 19 | build/android/jni/Android.mk 20 | build/android/jni/*.target.mk 21 | 22 | # iOS build files. 23 | build/iphoneos/xcode 24 | 25 | # Mac build files 26 | build/mac/xcode 27 | build/mac/products -------------------------------------------------------------------------------- /src/X509Verifier_mac.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 The libmumble Developers 2 | // The use of this source code is goverened by a BSD-style 3 | // license that can be found in the LICENSE-file. 4 | 5 | #ifndef MUMBLE_X509_VERIFIER_MAC_H_ 6 | #define MUMBLE_X509_VERIFIER_MAC_H_ 7 | 8 | #include 9 | 10 | #include 11 | #include 12 | 13 | namespace mumble { 14 | 15 | class X509VerifierPrivate { 16 | public: 17 | X509VerifierPrivate(); 18 | bool VerifyChain(std::vector chain, const X509VerifierOptions &opts); 19 | static void InitializeSystemVerifier(); 20 | }; 21 | 22 | } 23 | 24 | #endif -------------------------------------------------------------------------------- /3rdparty/opensslbuild/include/openssl/opensslconf.h: -------------------------------------------------------------------------------- 1 | // This file was generated by generate-headers.bash 2 | // on 2013-07-06 18:07:14+0200 using CYGWIN_NT-6.2-WOW64 1.7.20(0.266/5/3) 3 | // for OpenSSL version OpenSSL_1_0_0k (d9e048c) 4 | 5 | #if LIBMUMBLE_OPENSSLCONF_X86 == 1 6 | # include "../../opensslconf-x86.h" 7 | #elif LIBMUMBLE_OPENSSLCONF_X86_64 == 1 8 | # include "../../opensslconf-x86_64.h" 9 | #elif LIBMUMBLE_OPENSSLCONF_X86_64_LLP == 1 10 | # include "../../opensslconf-x86_64-llp64.h" 11 | #elif LIBMUMBLE_OPENSSLCONF_ARM == 1 12 | # include "../../opensslconf-arm.h" 13 | #else 14 | # include "../../opensslconf-dist.h" 15 | #endif 16 | -------------------------------------------------------------------------------- /testdata/x509/trickydn/generate.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) 2012 The libmumble Developers 3 | # The use of this source code is goverened by a BSD-style 4 | # license that can be found in the LICENSE-file. 5 | 6 | # Generate a self-signed certificate valid for one year, with CN=SelfSignedTest 7 | openssl genrsa -out /dev/stdout 2048 | openssl rsa -inform PEM -outform DER > tricky.key 8 | openssl req -new -keyform DER -key tricky.key -subj "/CN=Name With A Comma, \"and another one, haha\"/O=ACME" -out tricky.csr -batch 9 | openssl x509 -req -days 365 -in tricky.csr -keyform DER -signkey tricky.key -out tricky.crt -outform DER 10 | rm tricky.csr 11 | -------------------------------------------------------------------------------- /src/UVUtils.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 The libmumble Developers 2 | // The use of this source code is goverened by a BSD-style 3 | // license that can be found in the LICENSE-file. 4 | 5 | #include "UVUtils.h" 6 | #include 7 | 8 | #include 9 | 10 | namespace mumble { 11 | 12 | Error UVUtils::ErrorFromLastUVError(uv_loop_t *loop) { 13 | uv_err_t last = uv_last_error(loop); 14 | return UVUtils::ErrorFromUVError(last); 15 | } 16 | 17 | Error UVUtils::ErrorFromUVError(uv_err_t err) { 18 | return Error::ErrorFromDescription( 19 | std::string("uv"), 20 | static_cast(err.code), 21 | std::string(uv_strerror(err)) 22 | ); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/X509Verifier_unix.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 The libmumble Developers 2 | // The use of this source code is goverened by a BSD-style 3 | // license that can be found in the LICENSE-file. 4 | 5 | #ifndef MUMBLE_X509_VERIFIER_UNIX_H_ 6 | #define MUMBLE_X509_VERIFIER_UNIX_H_ 7 | 8 | #include 9 | #include "X509PEMVerifier.h" 10 | 11 | #include 12 | #include 13 | 14 | #include 15 | #include 16 | 17 | namespace mumble { 18 | 19 | class X509VerifierPrivate { 20 | public: 21 | X509VerifierPrivate(); 22 | static void InitializeSystemVerifier(); 23 | 24 | X509PEMVerifier pem_verifier_; 25 | }; 26 | 27 | } 28 | 29 | #endif -------------------------------------------------------------------------------- /testdata/vet.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) 2013 The libmumble Developers 3 | # The use of this source code is goverened by a BSD-style 4 | # license that can be found in the LICENSE-file. 5 | 6 | # Check that the basenames of files in the testdata 7 | # directory are unique. On iOS, we copy them directly 8 | # into the app bundle, and non-unique filenames would 9 | # cause weird test failures. 10 | TEST_FILES=$(find testdata -type f | grep -v \.bash$ | xargs basename | sort | openssl dgst -sha1) 11 | UNIQUE_TEST_FILES=$(find testdata -type f | grep -v \.bash$ | xargs basename | sort | uniq | openssl dgst -sha1) 12 | if [ "${TEST_FILES}" != "${UNIQUE_TEST_FILES}" ]; then 13 | exit 1 14 | fi -------------------------------------------------------------------------------- /src/X509Verifier_android.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 The libmumble Developers 2 | // The use of this source code is goverened by a BSD-style 3 | // license that can be found in the LICENSE-file. 4 | 5 | #ifndef MUMBLE_X509_VERIFIER_ANDROID_H_ 6 | #define MUMBLE_X509_VERIFIER_ANDROID_H_ 7 | 8 | #include 9 | #include "X509PEMVerifier.h" 10 | 11 | #include 12 | #include 13 | 14 | #include 15 | #include 16 | 17 | namespace mumble { 18 | 19 | class X509VerifierPrivate { 20 | public: 21 | X509VerifierPrivate(); 22 | static void InitializeSystemVerifier(); 23 | void ReadSystemRoots(); 24 | X509PEMVerifier pem_verifier_; 25 | }; 26 | 27 | } 28 | 29 | #endif -------------------------------------------------------------------------------- /3rdparty/libuvbuild/diff-uv.gyp.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) 2013 The libmumble Developers 3 | # The use of this source code is goverened by a BSD-style 4 | # license that can be found in the LICENSE-file. 5 | 6 | trap exit SIGINT SIGTERM 7 | 8 | FN=${BASH_SOURCE} 9 | type -P cygpath 2>&1 >/dev/null 10 | if [ $? -eq 0 ]; then 11 | FN=$(cygpath -u "${FN}") 12 | fi 13 | SCRIPT_DIR=$(dirname ${FN}) 14 | 15 | # Show a diff between our modified uv.gyp and the 16 | # uv.gyp in 3rdparty/libuv without taking the path 17 | # changes that occur from living in 3rdparty/libuvbuild 18 | # instead of 3rdparty/libuv into consideration. 19 | cat ${SCRIPT_DIR}/uv.gyp | sed 's,../libuv/,,' | diff -urNp ${SCRIPT_DIR}/../libuv/uv.gyp /dev/stdin -------------------------------------------------------------------------------- /src/X509HostnameVerifier.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 The libmumble Developers 2 | // The use of this source code is goverened by a BSD-style 3 | // license that can be found in the LICENSE-file. 4 | 5 | #ifndef MUMBLE_X509_HOSTNAME_VERIFIER_P_H_ 6 | #define MUMBLE_X509_HOSTNAME_VERIFIER_P_H_ 7 | 8 | #include 9 | #include 10 | 11 | namespace mumble { 12 | 13 | class X509Certificate; 14 | 15 | class X509HostnameVerifier { 16 | public: 17 | static std::vector LowerCaseHostnameVector(const std::string &hostname); 18 | static bool HostnameExprMatch(const std::string &hostexpr, const std::string &hostname); 19 | static bool VerifyHostname(const X509Certificate &cert, const std::string &hostname); 20 | }; 21 | 22 | } 23 | 24 | #endif -------------------------------------------------------------------------------- /src/X509PEMVerifier.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 The libmumble Developers 2 | // The use of this source code is goverened by a BSD-style 3 | // license that can be found in the LICENSE-file. 4 | 5 | #ifndef MUMBLE_X509_PEM_VERIFIER_H_ 6 | #define MUMBLE_X509_PEM_VERIFIER_H_ 7 | 8 | #include 9 | #include 10 | 11 | #include 12 | #include 13 | 14 | #include 15 | #include 16 | 17 | namespace mumble { 18 | 19 | class X509PEMVerifier { 20 | public: 21 | X509PEMVerifier(); 22 | bool AddPEM(const ByteArray &buf); 23 | bool VerifyChain(const std::vector &chain, const X509VerifierOptions &opts); 24 | private: 25 | friend class X509VerifierPrivate; 26 | X509_STORE *store_; 27 | }; 28 | 29 | } 30 | 31 | #endif -------------------------------------------------------------------------------- /src/OpenSSLUtils.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 The libmumble Developers 2 | // The use of this source code is goverened by a BSD-style 3 | // license that can be found in the LICENSE-file. 4 | 5 | #ifndef MUMBLE_OPENSSL_UTILS_H_ 6 | #define MUMBLE_OPENSSL_UTILS_H_ 7 | 8 | #include 9 | 10 | namespace mumble { 11 | 12 | class OpenSSLUtils { 13 | public: 14 | static void EnsureInitialized(); 15 | 16 | /// ErrorFromOpenSSLErrorCode translates a libssl 17 | /// error code into a mumble::Error. 18 | static Error ErrorFromOpenSSLErrorCode(int SSLerr); 19 | 20 | /// ErrorFromLastCryptoError calls libcrypto's 21 | /// ERR_get_error to translate the last error 22 | /// that happened in the calling thread to a 23 | /// mumble::Error. 24 | static Error ErrorFromLastCryptoError(); 25 | }; 26 | 27 | } 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /testdata/x509/selfsign-server/generate.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) 2012 The libmumble Developers 3 | # The use of this source code is goverened by a BSD-style 4 | # license that can be found in the LICENSE-file. 5 | 6 | # Generate a self-signed server certificate valid for one year, with CN=mumble.example.com 7 | # as well as the usual server key usages, and mumble.example.com as a DNS alt name. 8 | openssl genrsa -out /dev/stdout 2048 | openssl rsa -inform PEM -outform DER > selfsign-server.key 9 | openssl req -new -keyform DER -key selfsign-server.key -subj "/CN=mumble.example.com" -out selfsign-server.csr -batch 10 | openssl x509 -req -extfile selfsign-server.cnf -extensions v3_req -days 365 -in selfsign-server.csr -keyform DER -signkey selfsign-server.key -out selfsign-server.crt -outform DER 11 | rm selfsign-server.csr 12 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/generate-assembly.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) 2013 The libmumble Developers 3 | # The use of this source code is goverened by a BSD-style 4 | # license that can be found in the LICENSE-file. 5 | 6 | # This script generates the assembly source files 7 | # that are needed to build OpenSSL. 8 | 9 | trap exit SIGINT SIGTERM 10 | 11 | # Generate gnuas-x86-elf 12 | ./genasm-gnuas-x86.bash elf 13 | 14 | # Generate gnuas-x86-macosx 15 | ./genasm-gnuas-x86.bash macosx 16 | 17 | # Generate gnuas-x86_64-elf 18 | ./genasm-gnuas-x86_64.bash elf 19 | 20 | # Generate gnuas-x86_64-mingw64 21 | ./genasm-gnuas-x86_64.bash mingw64 22 | 23 | # Generate gnuas-x86_64-macosx 24 | ./genasm-gnuas-x86_64.bash macosx 25 | 26 | # Generate gnuas-arm-elf 27 | ./genasm-gnuas-arm.bash elf 28 | 29 | # Generate gnuas-arm-macosx 30 | ./genasm-gnuas-arm.bash macosx -------------------------------------------------------------------------------- /common.gypi: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2013 The libmumble Developers 2 | # The use of this source code is goverened by a BSD-style 3 | # license that can be found in the LICENSE-file. 4 | 5 | { 6 | 'variables': { 7 | 'use_system_protobuf': 0, 8 | 'openssl_zlib': 0, 9 | }, 10 | 'target_defaults': { 11 | 'conditions': [ 12 | ['OS == "win"', { 13 | 'target_conditions': [ 14 | ['target_arch=="x64"', { 15 | 'msvs_configuration_platform': 'x64', 16 | }], 17 | ], 18 | }], 19 | ['OS == "mac"', { 20 | 'target_conditions': [ 21 | ['target_arch=="x64"', { 22 | 'xcode_settings': { 23 | 'ARCHS': 'x86_64', 24 | }, 25 | }], 26 | ], 27 | }], 28 | ['OS == "ios"', { 29 | 'xcode_settings': { 30 | 'SDKROOT': 'iphoneos', 31 | 'IPHONEOS_DEPLOYMENT_TARGET': '5.0', 32 | }, 33 | }], 34 | ], 35 | }, 36 | } -------------------------------------------------------------------------------- /src/Compat_android.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 The libmumble Developers 2 | // The use of this source code is goverened by a BSD-style 3 | // license that can be found in the LICENSE-file. 4 | 5 | #include "Compat_android.h" 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | std::time_t timegm(struct tm *tm) { 12 | // Android's time_t is a 32-bit signed integer, but Android also provides a 64-bit time type 13 | // called time64_t. The timegm function in Android is only defined for the time64_t type, 14 | // and is called timegm64. Since our API is defined as returning a time_t, we'll stick to 15 | // that even though it means we'll only span Unix timestamps from INT32_MIN through INT32_MAX. 16 | static_assert(sizeof(std::time_t) == 4, "expecting 32-bit time_t on Android"); 17 | time64_t ts = timegm64(tm); 18 | if (ts < INT32_MIN || ts > INT32_MAX) { 19 | return INT32_MIN; 20 | } 21 | return static_cast(ts); 22 | } -------------------------------------------------------------------------------- /testdata/x509/altnames/generate.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) 2012 The libmumble Developers 3 | # The use of this source code is goverened by a BSD-style 4 | # license that can be found in the LICENSE-file. 5 | 6 | # Generate a certifiacte with DNS subject alt names 7 | openssl genrsa -out /dev/stdout 2048 | openssl rsa -inform PEM -outform DER > dns.key 8 | openssl req -new -keyform DER -key dns.key -subj "/O=libmumble" -out dns.csr -batch 9 | openssl x509 -extfile dns.cnf -extensions v3_req -req -days 365 -in dns.csr -keyform DER -signkey dns.key -out dns.crt -outform DER 10 | rm dns.csr 11 | 12 | # Generate a certificate with email subject alt names 13 | openssl genrsa -out /dev/stdout 2048 | openssl rsa -inform PEM -outform DER > email.key 14 | openssl req -new -keyform DER -key email.key -subj "/O=libmumble" -out email.csr -batch 15 | openssl x509 -extfile email.cnf -extensions v3_req -req -days 365 -in email.csr -keyform DER -signkey email.key -out email.crt -outform DER 16 | rm email.csr 17 | -------------------------------------------------------------------------------- /src/X509Verifier_win.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 The libmumble Developers 2 | // The use of this source code is goverened by a BSD-style 3 | // license that can be found in the LICENSE-file. 4 | 5 | #ifndef MUMBLE_X509_VERIFIER_WIN_H_ 6 | #define MUMBLE_X509_VERIFIER_WIN_H_ 7 | 8 | #include 9 | 10 | #include 11 | #include 12 | 13 | #define WIN32_LEAN_AND_MEAN 14 | #include 15 | #include 16 | 17 | namespace mumble { 18 | 19 | class X509VerifierPrivate { 20 | public: 21 | X509VerifierPrivate(); 22 | bool VerifyChain(std::vector chain, const X509VerifierOptions &opts); 23 | static void InitializeSystemVerifier(); 24 | 25 | private: 26 | bool AddCertToStore(HCERTSTORE store, const X509Certificate &cert, const CERT_CONTEXT **ctx_out = nullptr) const; 27 | const CERT_CONTEXT *CreateCertContextFromChain(const std::vector &chain) const; 28 | 29 | WCHAR *X509VerifierPrivate::UTF16StringFromStdString(const std::string &str) const; 30 | FILETIME FileTimeFromStdTimeT(std::time_t time) const; 31 | }; 32 | 33 | } 34 | 35 | #endif -------------------------------------------------------------------------------- /proto/generate.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) 2013 The libmumble Developers 3 | # The use of this source code is goverened by a BSD-style 4 | # license that can be found in the LICENSE-file. 5 | 6 | # Generate an updated proto description from Mumble.proto. 7 | # Remember to run 'git clean -dfx' in 3rdparty/protobuf once 8 | # you are done re-generating the .pb.* files. 9 | 10 | FN=${BASH_SOURCE} 11 | type -P cygpath 2>&1 >/dev/null 12 | if [ $? -eq 0 ]; then 13 | FN=$(cygpath -u "${FN}") 14 | fi 15 | SCRIPT_DIR=$(dirname ${FN}) 16 | 17 | cd ${SCRIPT_DIR}/../3rdparty/protobuf 18 | 19 | if [ ! -f src/protoc ]; then 20 | echo "No existing protoc binary found in 3rdparty/protobuf" 21 | echo "Re-building protoc binary in 3rdparty/protobuf" 22 | ./autogen.sh 23 | ./configure 24 | make -j4 25 | else 26 | echo "Using existing 3rdparty/protobuf protoc compiler" 27 | fi 28 | 29 | src/protoc ../../proto/Mumble.proto \ 30 | --proto_path=../../proto/ \ 31 | --cpp_out=../../proto/ 32 | 33 | # There seems to be a bug when generating for protobuf-lite? Remove 34 | # it with some magic sed powder for now. 35 | sed -i '' -e 's,::google::protobuf::::,::,' ../../proto/Mumble.pb.cc -------------------------------------------------------------------------------- /src/UVBio.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 The libmumble Developers 2 | // The use of this source code is goverened by a BSD-style 3 | // license that can be found in the LICENSE-file. 4 | 5 | #ifndef MUMBLE_UVBIO_H_ 6 | #define MUMBLE_UVBIO_H_ 7 | 8 | #include 9 | 10 | #include "uv.h" 11 | 12 | #include 13 | 14 | #include 15 | 16 | namespace mumble { 17 | 18 | class UVBioState { 19 | public: 20 | static BIO_METHOD *GetMethod(); 21 | 22 | UVBioState(uv_connect_t *connect); 23 | ~UVBioState(); 24 | 25 | void PutNewBuffer(ByteArray ba); 26 | void PutOldBuffer(ByteArray ba); 27 | bool HasBuffers(); 28 | ByteArray GetBuffer(); 29 | 30 | static int Create(BIO *b); 31 | static int Destroy(BIO *b); 32 | static int Read(BIO *b, char *buf, int len); 33 | static void WriteCallback(uv_write_t *req, int status); 34 | static int Write(BIO *b, const char *buf, int len); 35 | static int Puts(BIO *b, const char *str); 36 | static int Gets(BIO *B, char *buf, int len); 37 | static long Ctrl(BIO *b, int cmd, long num, void *ptr); 38 | 39 | static BIO_METHOD method_; 40 | uv_connect_t *connect_; 41 | std::list bufs_; 42 | }; 43 | 44 | } 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /src/Compat_win.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 The libmumble Developers 2 | // The use of this source code is goverened by a BSD-style 3 | // license that can be found in the LICENSE-file. 4 | 5 | #include "Compat_win.h" 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | #include 13 | 14 | std::time_t timegm(struct tm *tm) { 15 | return _mkgmtime(tm); 16 | } 17 | 18 | char *strptime(const char *buf, const char *fmt, struct tm *tm) { 19 | const std::string x509fmt("%Y%m%d%H%M%S"); 20 | 21 | if (tm == nullptr) { 22 | return nullptr; 23 | } 24 | 25 | std::string infmt(fmt); 26 | if (infmt != x509fmt) { 27 | return nullptr; 28 | } 29 | 30 | if (strlen(buf) < 14) { 31 | return nullptr; 32 | } 33 | 34 | int year = (buf[0]-'0') * 1000 + (buf[1]-'0') * 100 + (buf[2]-'0') * 10 + (buf[3]-'0'); 35 | tm->tm_year = year - 1900; 36 | 37 | int month = (buf[4]-'0') * 10 + (buf[5]-'0'); 38 | tm->tm_mon = month - 1; 39 | 40 | int day = (buf[6]-'0') * 10 + (buf[7]-'0'); 41 | tm->tm_mday = day; 42 | 43 | int hour = (buf[8]-'0') * 10 + (buf[9]-'0'); 44 | tm->tm_hour = hour; 45 | 46 | int minute = (buf[10]-'0') * 10 + (buf[11]-'0'); 47 | tm->tm_min = minute; 48 | 49 | int seconds = (buf[12]-'0') * 10 + (buf[13]-'0'); 50 | tm->tm_sec = seconds; 51 | 52 | tm->tm_wday = 0; 53 | tm->tm_yday = 0; 54 | tm->tm_isdst = 0; 55 | 56 | return const_cast(&buf[14]); 57 | } -------------------------------------------------------------------------------- /src/TLSConnection.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 The libmumble Developers 2 | // The use of this source code is goverened by a BSD-style 3 | // license that can be found in the LICENSE-file. 4 | 5 | #include 6 | #include "TLSConnection_p.h" 7 | 8 | #include 9 | 10 | namespace mumble { 11 | 12 | TLSConnection::TLSConnection() : priv_(new TLSConnectionPrivate) { 13 | } 14 | 15 | TLSConnection::~TLSConnection() { 16 | } 17 | 18 | Error TLSConnection::Connect(const std::string &ipaddr, int port, TLSConnectionOptions *opts) { 19 | return priv_->Connect(ipaddr, port, opts); 20 | } 21 | 22 | void TLSConnection::Disconnect() { 23 | priv_->Disconnect(); 24 | } 25 | 26 | void TLSConnection::Write(const ByteArray &buf) { 27 | priv_->Write(buf); 28 | } 29 | 30 | TLSConnection& TLSConnection::SetChainVerifyHandler(TLSConnectionChainVerifyHandler fn) { 31 | priv_->chain_verify_handler_ = fn; 32 | return *this; 33 | } 34 | 35 | TLSConnection& TLSConnection::SetEstablishedHandler(TLSConnectionEstablishedHandler fn) { 36 | priv_->established_handler_ = fn; 37 | return *this; 38 | } 39 | 40 | TLSConnection& TLSConnection::SetReadHandler(TLSConnectionReadHandler fn) { 41 | priv_->read_handler_ = fn; 42 | return *this; 43 | } 44 | 45 | TLSConnection& TLSConnection::SetErrorHandler(TLSConnectionErrorHandler fn) { 46 | priv_->error_handler_ = fn; 47 | return *this; 48 | } 49 | 50 | TLSConnection &TLSConnection::SetDisconnectHandler(TLSConnectionDisconnectHandler fn) { 51 | priv_->disconnect_handler_ = fn; 52 | return *this; 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2012 The libmumble Developers 2 | 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions 7 | are met: 8 | 9 | - Redistributions of source code must retain the above copyright notice, 10 | this list of conditions and the following disclaimer. 11 | - Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | - Neither the name of The libmumble Developers nor the names of its 15 | contributors may be used to endorse or promote products derived from this 16 | software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 22 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 25 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 26 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 27 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------- /3rdparty/yasm/LICENSE.chromium: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 The Chromium Authors. All rights reserved. 2 | // 3 | // Redistribution and use in source and binary forms, with or without 4 | // modification, are permitted provided that the following conditions are 5 | // met: 6 | // 7 | // * Redistributions of source code must retain the above copyright 8 | // notice, this list of conditions and the following disclaimer. 9 | // * Redistributions in binary form must reproduce the above 10 | // copyright notice, this list of conditions and the following disclaimer 11 | // in the documentation and/or other materials provided with the 12 | // distribution. 13 | // * Neither the name of Google Inc. nor the names of its 14 | // contributors may be used to endorse or promote products derived from 15 | // this software without specific prior written permission. 16 | // 17 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /3rdparty/protobufbuild/LICENSE.chromium: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 The Chromium Authors. All rights reserved. 2 | // 3 | // Redistribution and use in source and binary forms, with or without 4 | // modification, are permitted provided that the following conditions are 5 | // met: 6 | // 7 | // * Redistributions of source code must retain the above copyright 8 | // notice, this list of conditions and the following disclaimer. 9 | // * Redistributions in binary form must reproduce the above 10 | // copyright notice, this list of conditions and the following disclaimer 11 | // in the documentation and/or other materials provided with the 12 | // distribution. 13 | // * Neither the name of Google Inc. nor the names of its 14 | // contributors may be used to endorse or promote products derived from 15 | // this software without specific prior written permission. 16 | // 17 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /src/Error.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 The libmumble Developers 2 | // The use of this source code is goverened by a BSD-style 3 | // license that can be found in the LICENSE-file. 4 | 5 | #include 6 | 7 | #include 8 | #include 9 | 10 | namespace mumble { 11 | 12 | struct ErrorPrivate { 13 | public: 14 | ErrorPrivate(); 15 | std::string domain_; 16 | std::string description_; 17 | long code_; 18 | }; 19 | 20 | ErrorPrivate::ErrorPrivate() : code_(0) { 21 | } 22 | 23 | Error Error::ErrorFromDescription(std::string domain, long code, std::string description) { 24 | Error err; 25 | err.priv_->domain_ = domain; 26 | err.priv_->code_ = code; 27 | err.priv_->description_ = description; 28 | return err; 29 | } 30 | 31 | Error Error::NoError() { 32 | return Error(); 33 | } 34 | 35 | Error::Error() : priv_(new ErrorPrivate) { 36 | } 37 | 38 | Error::~Error() { 39 | } 40 | 41 | Error::Error(const Error &err) : priv_(new ErrorPrivate) { 42 | this->priv_->domain_ = err.priv_->domain_; 43 | this->priv_->code_ = err.priv_->code_; 44 | this->priv_->description_ = err.priv_->description_; 45 | } 46 | 47 | Error& Error::operator=(Error err) { 48 | std::swap((*this).priv_, err.priv_); 49 | return *this; 50 | } 51 | 52 | bool Error::HasError() const { 53 | return !(priv_->domain_.empty() && priv_->description_.empty() && priv_->code_ == 0L); 54 | } 55 | 56 | std::string Error::Domain() const { 57 | return priv_->domain_; 58 | } 59 | 60 | long Error::Code() const { 61 | return priv_->code_; 62 | } 63 | 64 | std::string Error::Description() const { 65 | return priv_->description_; 66 | } 67 | 68 | std::string Error::String() const { 69 | std::stringstream ss; 70 | ss << priv_->domain_ << ": " << priv_->description_ << " (error code: " << priv_->code_ << ")"; 71 | return ss.str(); 72 | } 73 | 74 | } -------------------------------------------------------------------------------- /3rdparty/opensslbuild/generate-headers.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) 2013 The libmumble Developers 3 | # The use of this source code is goverened by a BSD-style 4 | # license that can be found in the LICENSE-file. 5 | 6 | # This script creates a hierarchy of header files that mimics 7 | # the standard OpenSSL include directory from OpenSSL tarballs. 8 | # 9 | # Our bundled OpenSSL is a git submodule, and does not include 10 | # the usual header tree, so we have to provide it ourselves in 11 | # opensslbuild. 12 | 13 | trap exit SIGINT SIGTERM 14 | 15 | cd ../openssl 16 | 17 | openssl_ver=$(git describe) 18 | openssl_rev=$(git rev-parse --short HEAD) 19 | 20 | git clean -dfx 21 | git reset --hard 22 | 23 | ./Configure linux-elf 24 | cd ../opensslbuild 25 | 26 | rm -rf include/openssl 27 | mkdir -p include/openssl 28 | 29 | for fn in $(ls ../openssl/include/openssl); do 30 | dst=$(readlink ../openssl/include/openssl/${fn}) 31 | cat > include/openssl/${fn} < include/openssl/opensslconf.h < wildcard-google.dk-leaf.sha1 23 | cat wildcard-google.dk-leaf.crt | openssl sha -sha256 -binary > wildcard-google.dk-leaf.sha256 24 | 25 | # Extract notBefore and notAfter dates 26 | alias mumble_tconv="python -c \"import sys; import time; import calendar; sys.stdout.write(str(int(calendar.timegm(time.strptime(sys.stdin.read()[:-1], '%b %d %H:%M:%S %Y %Z')))))\"" 27 | openssl x509 -in wildcard-google.dk-leaf.crt -inform DER -noout -startdate | sed 's,notBefore=,,' | mumble_tconv > wildcard-google.dk-leaf.notBefore 28 | openssl x509 -in wildcard-google.dk-leaf.crt -inform DER -noout -enddate | sed 's,notAfter=,,' | mumble_tconv > wildcard-google.dk-leaf.notAfter 29 | -------------------------------------------------------------------------------- /include/mumble/X509Verifier.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 The libmumble Developers 2 | // The use of this source code is goverened by a BSD-style 3 | // license that can be found in the LICENSE-file. 4 | 5 | #ifndef MUMBLE_X509_VERIFIER_H_ 6 | #define MUMBLE_X509_VERIFIER_H_ 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | namespace mumble { 14 | 15 | /// X509VerifierOptions specifies options for an X509Verifier. 16 | struct X509VerifierOptions { 17 | /// The DNS name to verify against. 18 | /// If this field is not empty, the verifier will 19 | /// treat the certificate chain as being an SSL server 20 | /// chain, and verify it accordingly. 21 | std::string dns_name; 22 | /// The time that the verifier should use when checking 23 | /// the validity period of the certificate chain. If this 24 | /// field is 0, the system time is used. 25 | std::time_t time; 26 | }; 27 | 28 | class X509Certificate; 29 | class X509VerifierPrivate; 30 | 31 | /// X509Verifier implements objects that can verify X509 certificate chains. 32 | class X509Verifier { 33 | public: 34 | /// SystemVerifier returns an X509Verifier that calls 35 | /// the operating system's native X509 verification routines. 36 | static X509Verifier &SystemVerifier(); 37 | 38 | /// VerifyChain verifies a chain of X509Certificates. 39 | /// 40 | /// @param chain The certificate chain to verify. 41 | /// @param opts Options to use during the verification process. 42 | /// 43 | /// @return Returns true if the verifier deemed the certificate 44 | /// valid for the use given in opts. 45 | bool VerifyChain(std::vector chain, const X509VerifierOptions &opts); 46 | 47 | private: 48 | X509Verifier(); 49 | X509Verifier(const X509Verifier &verifier); 50 | X509Verifier& operator=(X509Verifier verifier); 51 | ~X509Verifier(); 52 | 53 | friend class X509VerifierPrivate; 54 | std::unique_ptr dptr_; 55 | }; 56 | 57 | } 58 | 59 | #endif -------------------------------------------------------------------------------- /src/mumble_test.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 The libmumble Developers 2 | // The use of this source code is goverened by a BSD-style 3 | // license that can be found in the LICENSE-file. 4 | 5 | #include 6 | 7 | #include "mumble_test.h" 8 | 9 | #include 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | #include 16 | #include 17 | 18 | // The Android generator for gyp is very keen on 19 | // all sources of a target having the same file 20 | // extension. This means that we can't include 21 | // gtest's test-all.cc file in our sources. 22 | // 23 | // Let's just include it here instead. 24 | #include "src/gtest-all.cc" 25 | 26 | #if LIBMUMBLE_OS_IOS == 1 27 | #import 28 | #endif 29 | 30 | mumble::ByteArray LoadFile(const std::string &path) { 31 | #if LIBMUMBLE_OS_IOS == 1 32 | std::string basename = path.substr(path.rfind("/")+1); 33 | NSString *absFn = [[NSBundle mainBundle] pathForResource:@(basename.c_str()) ofType:nil]; 34 | NSData *data = [NSData dataWithContentsOfFile:absFn]; 35 | return mumble::ByteArray(const_cast(reinterpret_cast([data bytes])), 36 | static_cast([data length])); 37 | #else 38 | mumble::ByteArray ba; 39 | 40 | std::ifstream ifs; 41 | ifs.open(path, std::ifstream::binary); 42 | 43 | while (ifs.good()) { 44 | mumble::ByteArray chunk(256); 45 | char *buf = chunk.Data(); 46 | ifs.read(buf, chunk.Length()); 47 | chunk.Truncate(ifs.gcount()); 48 | if (chunk.Length() > 0) { 49 | ba.Append(chunk); 50 | } 51 | } 52 | 53 | ifs.close(); 54 | 55 | return ba; 56 | #endif 57 | } 58 | 59 | bool SaveFile(const std::string &path, const mumble::ByteArray &ba) { 60 | bool ok; 61 | std::ofstream ofs; 62 | ofs.open(path, std::ios::binary|std::ios::out|std::ios::trunc); 63 | if (ofs.is_open()) { 64 | ofs.write(ba.ConstData(), ba.Length()); 65 | ofs.flush(); 66 | ok = ofs.good(); 67 | ofs.close(); 68 | } 69 | return ok; 70 | } 71 | 72 | int main(int argc, char **argv) { 73 | testing::InitGoogleTest(&argc, argv); 74 | return RUN_ALL_TESTS(); 75 | } 76 | -------------------------------------------------------------------------------- /src/demo.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 The libmumble Developers 2 | // The use of this source code is goverened by a BSD-style 3 | // license that can be found in the LICENSE-file. 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #include 11 | #include 12 | #include 13 | 14 | #include "uv.h" 15 | 16 | static uv_timer_t timer; 17 | 18 | void timerFunc(uv_timer_t *tmr, int) { 19 | // No-op to keep the main loop running. 20 | } 21 | 22 | int main(int argc, char **argv) { 23 | mumble::TLSConnection conn; 24 | 25 | conn.SetChainVerifyHandler([&](const std::vector &chain) { 26 | mumble::X509Verifier &system_verifier = mumble::X509Verifier::SystemVerifier(); 27 | 28 | mumble::X509VerifierOptions opts; 29 | opts.dns_name = std::string("www.google.com"); 30 | opts.time = 0; 31 | 32 | return system_verifier.VerifyChain(chain, opts); 33 | }).SetEstablishedHandler([&]{ 34 | const char *req = "GET / HTTP/1.1\r\n" 35 | "Host: www.google.com\r\n" 36 | "Connection: close\r\n\r\n"; 37 | mumble::ByteArray getReq(const_cast(req), strlen(req)); 38 | conn.Write(getReq); 39 | }).SetReadHandler([&](const mumble::ByteArray &buf) { 40 | std::string rsp(buf.ConstData(), buf.Length()); 41 | std::cerr << "Connection response: " << std::endl; 42 | std::cerr << rsp; 43 | }).SetErrorHandler([&](const mumble::Error &err) { 44 | std::cerr << "Connection error: " << err.String() << std::endl; 45 | }).SetDisconnectHandler([&](bool local) { 46 | std::cerr << "Disconnect! (local? " << local << ")" << std::endl; 47 | }); 48 | 49 | mumble::Error err = conn.Connect(std::string("173.194.66.106"), 443, nullptr); 50 | if (err.HasError()) { 51 | std::cerr << "Got error from Connect: " << err.String() << std::endl; 52 | } 53 | 54 | uv_loop_t *loop = uv_default_loop(); 55 | 56 | uv_timer_init(loop, &timer); 57 | uv_timer_start(&timer, timerFunc, 1000, 1000); 58 | 59 | if (uv_run(loop, UV_RUN_DEFAULT) == -1) { 60 | std::cerr << "got error: " << uv_strerror(uv_last_error(loop)) << std::endl; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/X509Verifier_unix.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 The libmumble Developers 2 | // The use of this source code is goverened by a BSD-style 3 | // license that can be found in the LICENSE-file. 4 | 5 | #include 6 | #include 7 | #include "X509Verifier_unix.h" 8 | #include "X509PEMVerifier.h" 9 | 10 | #include 11 | #include 12 | #include 13 | 14 | #include 15 | #include 16 | #include "uv.h" 17 | 18 | namespace mumble { 19 | 20 | static uv_once_t system_verifier_once_ = UV_ONCE_INIT; 21 | static X509Verifier *system_verifier_ptr_; 22 | 23 | void X509VerifierPrivate::InitializeSystemVerifier() { 24 | system_verifier_ptr_ = new X509Verifier; 25 | } 26 | 27 | X509Verifier &X509Verifier::SystemVerifier() { 28 | uv_once(&system_verifier_once_, X509VerifierPrivate::InitializeSystemVerifier); 29 | return *system_verifier_ptr_; 30 | } 31 | 32 | X509Verifier::X509Verifier() : dptr_(new X509VerifierPrivate) { 33 | } 34 | 35 | X509Verifier::~X509Verifier() { 36 | } 37 | 38 | bool X509Verifier::VerifyChain(std::vector chain, const X509VerifierOptions &opts) { 39 | return dptr_->pem_verifier_.VerifyChain(chain, opts); 40 | } 41 | 42 | // read_caroot_pem reads a CA certificate named fn from dir. 43 | ByteArray read_pem_bundle(const std::string &fn) { 44 | mumble::ByteArray ba; 45 | std::ifstream ifs; 46 | ifs.open(fn, std::ios::binary); 47 | while (ifs.good()) { 48 | mumble::ByteArray chunk(256); 49 | char *buf = chunk.Data(); 50 | ifs.read(buf, chunk.Length()); 51 | chunk.Truncate(ifs.gcount()); 52 | if (chunk.Length() > 0) { 53 | ba.Append(chunk); 54 | } 55 | } 56 | ifs.close(); 57 | return ba; 58 | } 59 | 60 | X509VerifierPrivate::X509VerifierPrivate() { 61 | #if defined(LIBMUMBLE_SYSTEM_OPENSSL) 62 | X509_STORE_set_default_paths(pem_verifier_.store_); 63 | #else 64 | const char *bundles[] = { 65 | // Debian and Ubuntu 66 | "/etc/ssl/certs/ca-certificates.crt", 67 | }; 68 | 69 | int nbundles = sizeof(bundles)/sizeof(*bundles); 70 | for (int i = 0; i < nbundles; i++) { 71 | ByteArray bundle = read_pem_bundle(std::string(bundles[i])); 72 | if (bundle.Length() > 0) { 73 | pem_verifier_.AddPEM(bundle); 74 | break; 75 | } 76 | } 77 | #endif 78 | } 79 | 80 | } -------------------------------------------------------------------------------- /3rdparty/opensslbuild/genasm-gnuas-x86_64.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) 2013 The libmumble Developers 3 | # The use of this source code is goverened by a BSD-style 4 | # license that can be found in the LICENSE-file. 5 | 6 | trap exit SIGINT SIGTERM 7 | 8 | FN=${BASH_SOURCE} 9 | type -P cygpath 2>&1 >/dev/null 10 | if [ $? -eq 0 ]; then 11 | FN=$(cygpath -u "${FN}") 12 | fi 13 | SCRIPT_DIR=$(dirname ${FN}) 14 | 15 | KIND="$1" 16 | 17 | mkdir -p "${SCRIPT_DIR}/asm/gnuas-x86_64-${KIND}/crypto/aes/asm" 18 | mkdir -p "${SCRIPT_DIR}/asm/gnuas-x86_64-${KIND}/crypto/sha/asm" 19 | mkdir -p "${SCRIPT_DIR}/asm/gnuas-x86_64-${KIND}/crypto/camellia/asm" 20 | mkdir -p "${SCRIPT_DIR}/asm/gnuas-x86_64-${KIND}/crypto/md5/asm" 21 | mkdir -p "${SCRIPT_DIR}/asm/gnuas-x86_64-${KIND}/crypto/whrlpool/asm" 22 | mkdir -p "${SCRIPT_DIR}/asm/gnuas-x86_64-${KIND}/crypto/rc4/asm" 23 | mkdir -p "${SCRIPT_DIR}/asm/gnuas-x86_64-${KIND}/crypto/bn/asm" 24 | 25 | perl "${SCRIPT_DIR}/../openssl/crypto/x86_64cpuid.pl" "${KIND}" "${SCRIPT_DIR}/asm/gnuas-x86_64-${KIND}/crypto/x86_64cpuid.S" 26 | perl "${SCRIPT_DIR}/../openssl/crypto/aes/asm/aes-x86_64.pl" "${KIND}" "${SCRIPT_DIR}/asm/gnuas-x86_64-${KIND}/crypto/aes/asm/aes-x86_64.S" 27 | perl "${SCRIPT_DIR}/../openssl/crypto/sha/asm/sha1-x86_64.pl" "${KIND}" "${SCRIPT_DIR}/asm/gnuas-x86_64-${KIND}/crypto/sha/asm/sha1-x86_64.S" 28 | perl "${SCRIPT_DIR}/../openssl/crypto/sha/asm/sha512-x86_64.pl" "${KIND}" "${SCRIPT_DIR}/asm/gnuas-x86_64-${KIND}/crypto/sha/asm/sha256-x86_64.S" 29 | perl "${SCRIPT_DIR}/../openssl/crypto/sha/asm/sha512-x86_64.pl" "${KIND}" "${SCRIPT_DIR}/asm/gnuas-x86_64-${KIND}/crypto/sha/asm/sha512-x86_64.S" 30 | perl "${SCRIPT_DIR}/../openssl/crypto/camellia/asm/cmll-x86_64.pl" "${KIND}" "${SCRIPT_DIR}/asm/gnuas-x86_64-${KIND}/crypto/camellia/asm/cmll-x86_64.S" 31 | perl "${SCRIPT_DIR}/../openssl/crypto/md5/asm/md5-x86_64.pl" "${KIND}" "${SCRIPT_DIR}/asm/gnuas-x86_64-${KIND}/crypto/md5/asm/md5-x86_64.S" 32 | perl "${SCRIPT_DIR}/../openssl/crypto/whrlpool/asm/wp-x86_64.pl" "${KIND}" "${SCRIPT_DIR}/asm/gnuas-x86_64-${KIND}/crypto/whrlpool/asm/wp-x86_64.S" 33 | perl "${SCRIPT_DIR}/../openssl/crypto/rc4/asm/rc4-x86_64.pl" "${KIND}" "${SCRIPT_DIR}/asm/gnuas-x86_64-${KIND}/crypto/rc4/asm/rc4-x86_64.S" 34 | perl "${SCRIPT_DIR}/../openssl/crypto/bn/asm/x86_64-mont.pl" "${KIND}" "${SCRIPT_DIR}/asm/gnuas-x86_64-${KIND}/crypto/bn/asm/x86_64-mont.S" 35 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/genasm-gnuas-arm.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) 2013 The libmumble Developers 3 | # The use of this source code is goverened by a BSD-style 4 | # license that can be found in the LICENSE-file. 5 | 6 | trap exit SIGINT SIGTERM 7 | 8 | FN=${BASH_SOURCE} 9 | type -P cygpath 2>&1 >/dev/null 10 | if [ $? -eq 0 ]; then 11 | FN=$(cygpath -u "${FN}") 12 | fi 13 | SCRIPT_DIR=$(dirname ${FN}) 14 | 15 | KIND="$1" 16 | 17 | mkdir -p ${SCRIPT_DIR}/asm/gnuas-arm-${KIND}/crypto/aes/asm 18 | mkdir -p ${SCRIPT_DIR}/asm/gnuas-arm-${KIND}/crypto/bn/asm 19 | mkdir -p ${SCRIPT_DIR}/asm/gnuas-arm-${KIND}/crypto/sha/asm 20 | 21 | case "$KIND" in 22 | elf ) 23 | perl ${SCRIPT_DIR}/../openssl/crypto/aes/asm/aes-armv4.pl > ${SCRIPT_DIR}/asm/gnuas-arm-${KIND}/crypto/aes/asm/aes-armv4.S 24 | perl ${SCRIPT_DIR}/../openssl/crypto/bn/asm/armv4-mont.pl > ${SCRIPT_DIR}/asm/gnuas-arm-${KIND}/crypto/bn/asm/armv4-mont.S 25 | perl ${SCRIPT_DIR}/../openssl/crypto/sha/asm/sha1-armv4-large.pl > ${SCRIPT_DIR}/asm/gnuas-arm-${KIND}/crypto/sha/asm/sha1-armv4-large.S 26 | perl ${SCRIPT_DIR}/../openssl/crypto/sha/asm/sha256-armv4.pl > ${SCRIPT_DIR}/asm/gnuas-arm-${KIND}/crypto/sha/asm/sha256-armv4.S 27 | perl ${SCRIPT_DIR}/../openssl/crypto/sha/asm/sha512-armv4.pl > ${SCRIPT_DIR}/asm/gnuas-arm-${KIND}/crypto/sha/asm/sha512-armv4.S 28 | ;; 29 | macosx ) 30 | perl ${SCRIPT_DIR}/../openssl/crypto/aes/asm/aes-armv4.pl | grep -v "^\.[type|size].*" > ${SCRIPT_DIR}/asm/gnuas-arm-${KIND}/crypto/aes/asm/aes-armv4.S 31 | perl ${SCRIPT_DIR}/../openssl/crypto/bn/asm/armv4-mont.pl | grep -v "^\.[type|size].*" | sed 's,bn_mul_mont,_bn_mul_mont,' > ${SCRIPT_DIR}/asm/gnuas-arm-${KIND}/crypto/bn/asm/armv4-mont.S 32 | perl ${SCRIPT_DIR}/../openssl/crypto/sha/asm/sha1-armv4-large.pl | grep -v "^\.[type|size].*" | sed 's,sha1_block_data_order,_sha1_block_data_order,'> ${SCRIPT_DIR}/asm/gnuas-arm-${KIND}/crypto/sha/asm/sha1-armv4-large.S 33 | perl ${SCRIPT_DIR}/../openssl/crypto/sha/asm/sha256-armv4.pl | grep -v "^\.[type|size].*" | sed 's,sha256_block_data_order,_sha256_block_data_order,' > ${SCRIPT_DIR}/asm/gnuas-arm-${KIND}/crypto/sha/asm/sha256-armv4.S 34 | perl ${SCRIPT_DIR}/../openssl/crypto/sha/asm/sha512-armv4.pl | grep -v "^\.[type|size].*" | sed 's,sha512_block_data_order,_sha512_block_data_order,' > ${SCRIPT_DIR}/asm/gnuas-arm-${KIND}/crypto/sha/asm/sha512-armv4.S 35 | ;; 36 | esac 37 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/generate-opensslconf.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) 2013 The libmumble Developers 3 | # The use of this source code is goverened by a BSD-style 4 | # license that can be found in the LICENSE-file. 5 | 6 | # This script generates the canonical versions of opensslconf.h 7 | # for the architectures we support in 3rdparty/openssl. 8 | # The script is destructive, and will wipe any changes in your 9 | # 3rdparty/openssl submodule, so run with care. 10 | 11 | # Notes: 12 | # We strip OPENSSL_CPUID_OBJ and define it in the gyp file instead. 13 | 14 | trap exit SIGINT SIGTERM 15 | 16 | cd ../openssl 17 | 18 | function writehdr { 19 | command=${1} 20 | out=${2} 21 | echo "// This file was generated by generate-opensslconf.bash" > ${out} 22 | echo "// by executing '${command}' in the OpenSSL source tree." >> ${out} 23 | echo >> ${out} 24 | } 25 | 26 | # dist (generic) 27 | git clean -dfx 28 | git reset --hard 29 | ./Configure dist 30 | writehdr "./Configure dist" ../opensslbuild/opensslconf-dist.h 31 | tail -n+4 crypto/opensslconf.h >> ../opensslbuild/opensslconf-dist.h 32 | 33 | # x86_32 34 | git clean -dfx 35 | git reset --hard 36 | rm crypto/opensslconf.h 37 | ./Configure linux-elf 38 | writehdr "./Configure linux-elf" ../opensslbuild/opensslconf-x86.h 39 | tail -n+4 crypto/opensslconf.h | sed 's,#define OPENSSL_CPUID_OBJ,,' >> ../opensslbuild/opensslconf-x86.h 40 | 41 | # x86_64 42 | git clean -dfx 43 | git reset --hard 44 | rm crypto/opensslconf.h 45 | ./Configure linux-x86_64 46 | writehdr "./Configure linux-x86_64" ../opensslbuild/opensslconf-x86_64.h 47 | tail -n+4 crypto/opensslconf.h | sed 's,#define OPENSSL_CPUID_OBJ,,' >> ../opensslbuild/opensslconf-x86_64.h 48 | 49 | # x86_64 LLP64 50 | git clean -dfx 51 | git reset --hard 52 | rm crypto/opensslconf.h 53 | ./Configure mingw64 54 | writehdr "./Configure mingw64" ../opensslbuild/opensslconf-x86_64-llp64.h 55 | tail -n+4 crypto/opensslconf.h | sed 's,#define OPENSSL_CPUID_OBJ,,' >> ../opensslbuild/opensslconf-x86_64-llp64.h 56 | 57 | # ARM 58 | git clean -dfx 59 | git reset --hard 60 | rm crypto/opensslconf.h 61 | ./Configure linux-armv4 62 | writehdr "./Configure linux-armv4" ../opensslbuild/opensslconf-arm.h 63 | tail -n+4 crypto/opensslconf.h | sed 's,#define OPENSSL_CPUID_OBJ,,' >> ../opensslbuild/opensslconf-arm.h 64 | 65 | # final cleanup 66 | git clean -dfx 67 | git reset --hard 68 | 69 | -------------------------------------------------------------------------------- /src/X509Certificate_p.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 The libmumble Developers 2 | // The use of this source code is goverened by a BSD-style 3 | // license that can be found in the LICENSE-file. 4 | 5 | #ifndef MUMBLE_X509_CERTIFICATE_P_H_ 6 | #define MUMBLE_X509_CERTIFICATE_P_H_ 7 | 8 | #include 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | namespace mumble { 24 | 25 | class X509CertificatePrivate { 26 | public: 27 | X509CertificatePrivate(); 28 | void ExtractCertificateInfo(); 29 | 30 | static std::time_t ParseASN1Time(ASN1_TIME *time); 31 | static std::string StringFromDNAttributeType(ASN1_OBJECT *obj); 32 | static std::string StringFromASN1String(ASN1_STRING *str); 33 | static std::map ParseX509Name(X509_NAME *name); 34 | 35 | std::map subject_items_; 36 | std::map issuer_items_; 37 | 38 | std::list email_addrs_; 39 | std::list dns_names_; 40 | 41 | ByteArray cert_der_; 42 | ByteArray priv_der_; 43 | 44 | std::time_t not_before_; 45 | std::time_t not_after_; 46 | 47 | static X509Certificate GenerateSelfSignedCertificate(const std::string &name, const std::string &email); 48 | // ExportCertificateChainAsPKCs12 exports the certificate chain in chain as a PKCS12-encoded ByteArray. 49 | static ByteArray ExportCertificateChainAsPKCS12(std::vectorchain, const std::string &password); 50 | static std::vector FromPKCS12(const ByteArray &pkcs12, const std::string &password); 51 | 52 | X509 *AsOpenSSLX509() const; 53 | 54 | ByteArray Digest(const std::string &name) const; 55 | 56 | std::time_t NotBeforeTime() const; 57 | std::time_t NotAfterTime() const; 58 | 59 | bool IsSignedBy(const X509Certificate &parent) const; 60 | 61 | std::string SubjectName() const; 62 | std::string CommonName() const; 63 | std::string EmailAddress() const; 64 | std::vector DNSNames() const; 65 | std::string IssuerName() const; 66 | 67 | std::string LookupIssuerItem(const std::string &item) const; 68 | std::string LookupSubjectItem(const std::string &item) const; 69 | }; 70 | 71 | } 72 | 73 | #endif -------------------------------------------------------------------------------- /src/Compat_win_test.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 The libmumble Developers 2 | // The use of this source code is goverened by a BSD-style 3 | // license that can be found in the LICENSE-file. 4 | 5 | #include 6 | 7 | #include "Compat_win.h" 8 | #include 9 | 10 | TEST(CompatWindowsTest, InvalidStrptimeFormat) { 11 | struct tm tm; 12 | memset(&tm, 0, sizeof(tm)); 13 | 14 | const char *buf = "20121224"; 15 | EXPECT_EQ(nullptr, strptime(buf, "%Y%m%d", &tm)); 16 | } 17 | 18 | TEST(CompatWindowsTest, ValidStrptimeFormat) { 19 | struct tm tm; 20 | memset(&tm, 0, sizeof(tm)); 21 | 22 | const char *buf = "20130217181920"; 23 | char *ret = strptime(buf, "%Y%m%d%H%M%S", &tm); 24 | ASSERT_FALSE(ret == nullptr); 25 | 26 | EXPECT_EQ(2013-1900, tm.tm_year); 27 | EXPECT_EQ(1, tm.tm_mon); 28 | EXPECT_EQ(17, tm.tm_mday); 29 | EXPECT_EQ(18, tm.tm_hour); 30 | EXPECT_EQ(19, tm.tm_min); 31 | EXPECT_EQ(20, tm.tm_sec); 32 | 33 | EXPECT_EQ(0, tm.tm_isdst); 34 | EXPECT_EQ(0, tm.tm_wday); 35 | EXPECT_EQ(0, tm.tm_yday); 36 | } 37 | 38 | TEST(CompatWindowsTest, TimeGmConversion) { 39 | struct tm tm; 40 | memset(&tm, 0, sizeof(tm)); 41 | 42 | // 1st Jan 1970 00:00:00 UTC 43 | tm.tm_mday = 1; 44 | tm.tm_mon = 0; 45 | tm.tm_year = 70; 46 | tm.tm_hour = 0; 47 | tm.tm_min = 0; 48 | tm.tm_sec = 0; 49 | std::time_t ts = timegm(&tm); 50 | EXPECT_EQ(0, ts); 51 | 52 | tm.tm_year = 80; // 1 Jan 1980 00:00:00 UTC 53 | ts = timegm(&tm); 54 | EXPECT_EQ(315532800, ts); 55 | 56 | tm.tm_year = 90; // 1 Jan 1990 00:00:00 UTC 57 | ts = timegm(&tm); 58 | EXPECT_EQ(631152000, ts); 59 | 60 | tm.tm_year = 100; // 1 Jan 2000 00:00:00 UTC 61 | ts = timegm(&tm); 62 | EXPECT_EQ(946684800, ts); 63 | 64 | // 19 Jan 2038 03:14:07 UTC 65 | tm.tm_mday = 19; 66 | tm.tm_mon = 0; 67 | tm.tm_year = 138; 68 | tm.tm_hour = 3; 69 | tm.tm_min = 14; 70 | tm.tm_sec = 7; 71 | ts = timegm(&tm); 72 | EXPECT_EQ(2147483647, ts); 73 | 74 | // 13 December 1901 20:45:53 UTC 75 | // Error: Windows's _mkgmtime can't convert 76 | // to dates earlier than the Unix epoch. 77 | tm.tm_mday = 13; 78 | tm.tm_mon = 11; 79 | tm.tm_year = 1; 80 | tm.tm_hour = 20; 81 | tm.tm_min = 45; 82 | tm.tm_sec = 53; 83 | ts = timegm(&tm); 84 | EXPECT_EQ(-1, ts); 85 | 86 | // 13 December 1901 20:45:52 UTC 87 | // Error: Windows's _mkgmtime can't convert 88 | // to dates earlier than the Unix epoch. 89 | tm.tm_sec--; 90 | ts = timegm(&tm); 91 | EXPECT_EQ(-1, ts); 92 | } -------------------------------------------------------------------------------- /3rdparty/yasm/yasm_gnuas.gypi: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2013 The libmumble Developers 2 | # The use of this source code is goverened by a BSD-style 3 | # license that can be found in the LICENSE-file. 4 | # 5 | # This file is based on yasm_compile.gypi from Chromium: 6 | # 7 | # Copyright (c) 2012 The Chromium Authors. All rights reserved. 8 | # Use of this source code is governed by a BSD-style license that can be 9 | # found in the LICENSE.chromium file. 10 | 11 | # This is an gyp include to use YASM for compiling GNU AS assembly files on Windows. 12 | # Files to be compiled with YASM should have an extension of .S. 13 | # 14 | # Sample usage: 15 | # 'sources': [ 16 | # 'ultra_optimized_awesome.S', 17 | # ], 18 | # 'includes': [ 19 | # '3rdparty/yasm/yasm_gas.gypi' 20 | # ], 21 | 22 | { 23 | 'variables': { 24 | 'yasm_flags': [], 25 | 'yasm_includes': [], 26 | 'yasm_output_path': '<(SHARED_INTERMEDIATE_DIR)/project', 27 | 28 | # An ugly fix for some gyp brain damage. If we do 29 | # bla\bla\3rdparty here, gyp, or something, I don't 30 | # know what, will have the value escaped as an 31 | # ASCII decimal 3 once it hits the Visual Studio 32 | # project file. So we apply some escaping grease. 33 | # Yuck! 34 | 'yasm_path': '<(DEPTH)\\\x33rdparty\yasm\yasm.exe', 35 | 'asm_obj_extension': 'obj', 36 | 37 | 'conditions': [ 38 | [ 'OS=="win" and target_arch=="ia32"', { 39 | 'yasm_flags': [ 40 | '--prefix=_', 41 | '-fwin32', 42 | '-mx86', 43 | '-pgas', 44 | ], 45 | } ], 46 | [ 'OS=="win" and target_arch=="x64"', { 47 | 'yasm_flags': [ 48 | '-fwin64', 49 | '-mamd64', 50 | '-pgas' 51 | ], 52 | }], 53 | ], 54 | }, # variables 55 | 56 | 'rules': [ 57 | { 58 | 'rule_name': 'assemble', 59 | 'extension': 'S', 60 | 'inputs': [ '<(yasm_path)', '<@(yasm_includes)'], 61 | 'outputs': [ 62 | '<(yasm_output_path)/<(RULE_INPUT_ROOT).<(asm_obj_extension)', 63 | ], 64 | 'action': [ 65 | '<(yasm_path)', 66 | '<@(yasm_flags)', 67 | '-o', '<(yasm_output_path)/<(RULE_INPUT_ROOT).<(asm_obj_extension)', 68 | '<(RULE_INPUT_PATH)', 69 | ], 70 | 'process_outputs_as_sources': 1, 71 | 'message': 'Compile assembly <(RULE_INPUT_PATH).', 72 | 'msvs_cygwin_shell': 0, 73 | }, 74 | ], # rules 75 | } -------------------------------------------------------------------------------- /src/X509HostnameVerifier_test.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 The libmumble Developers 2 | // The use of this source code is goverened by a BSD-style 3 | // license that can be found in the LICENSE-file. 4 | 5 | #include 6 | 7 | #include "X509HostnameVerifier.h" 8 | 9 | #include 10 | #include 11 | 12 | TEST(X509HostnameVerifierTest, WildcardMatch) { 13 | std::string host("www.google.com"); 14 | std::string wexpr("*.google.com"); 15 | EXPECT_TRUE(mumble::X509HostnameVerifier::HostnameExprMatch(wexpr, host)); 16 | } 17 | 18 | TEST(X509HostnameVerifierTest, WildcardMismatch) { 19 | std::string host("a.b.example.com"); 20 | std::string wexpr("*.example.com"); 21 | EXPECT_FALSE(mumble::X509HostnameVerifier::HostnameExprMatch(wexpr, host)); 22 | } 23 | 24 | TEST(X509HostnameVerifierTest, GlobWildcardDisallowed) { 25 | std::string host("www.google.com"); 26 | std::string wexpr("w*.google.com"); 27 | EXPECT_FALSE(mumble::X509HostnameVerifier::HostnameExprMatch(wexpr, host)); 28 | } 29 | 30 | TEST(X509HostnameVerifierTest, MultiWildcardMatch) { 31 | std::string host("a.b.example.com"); 32 | std::string wexpr("*.*.example.com"); 33 | EXPECT_TRUE(mumble::X509HostnameVerifier::HostnameExprMatch(wexpr, host)); 34 | } 35 | 36 | TEST(X509HostnameVerifierTest, FQDNMismatch) { 37 | std::string host("www.google.com"); 38 | std::string wexpr("*.google.com."); 39 | EXPECT_FALSE(mumble::X509HostnameVerifier::HostnameExprMatch(wexpr, host)); 40 | } 41 | 42 | TEST(X509HostnameVerifierTest, HostVectorSize) { 43 | auto v1 = mumble::X509HostnameVerifier::LowerCaseHostnameVector(std::string("*.google.com")); 44 | auto v2 = mumble::X509HostnameVerifier::LowerCaseHostnameVector(std::string("a.b.example.com")); 45 | EXPECT_EQ(3, v1.size()); 46 | EXPECT_EQ(4, v2.size()); 47 | } 48 | 49 | TEST(X509HostnameVerifierTest, HostVectorLowerCase) { 50 | std::vector expected; 51 | expected.push_back(std::string("*")); 52 | expected.push_back(std::string("google")); 53 | expected.push_back(std::string("com")); 54 | auto actual = mumble::X509HostnameVerifier::LowerCaseHostnameVector(std::string("*.GooGlE.CoM")); 55 | EXPECT_TRUE(std::equal(expected.begin(), expected.end(), actual.begin())); 56 | } 57 | 58 | TEST(X509HostnameVerifierTest, HostVectorLowerCaseComprehensive) { 59 | std::vector expected; 60 | expected.push_back(std::string("abcdefghijklmopqrstuvwxyz")); 61 | auto actual = mumble::X509HostnameVerifier::LowerCaseHostnameVector(std::string("ABCDEFGHIJKLMOPQRSTUVWXYZ")); 62 | EXPECT_TRUE(std::equal(expected.begin(), expected.end(), actual.begin())); 63 | } -------------------------------------------------------------------------------- /include/mumble/Error.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 The libmumble Developers 2 | // The use of this source code is goverened by a BSD-style 3 | // license that can be found in the LICENSE-file. 4 | 5 | #ifndef MUMBLE_ERROR_H_ 6 | #define MUMBLE_ERROR_H_ 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | namespace mumble { 13 | 14 | struct ErrorPrivate; 15 | 16 | /// Error represents an error returned by a libmumble component. 17 | class Error { 18 | public: 19 | /// Constructs a new Error with the given domain, code and description. 20 | /// 21 | /// @param domain The error domain. This describes the context in which 22 | /// the error code is to be understood. For example, an 23 | /// error caused by libuv might have a domain of "uv". 24 | /// @param code An error code in the context of the given domain. 25 | /// @param description A description of the error code in the context of the given domain. 26 | /// 27 | /// @return Returns an Error described by domain, code and description. 28 | static Error ErrorFromDescription(std::string domain, long code, std::string description); 29 | 30 | /// Constructs an empty error signalling 31 | /// that the Error objects contains no error 32 | /// code. This is useful for signalling *success* 33 | /// rather than *failure* when using Error objects. 34 | /// 35 | /// This form of Error is typically used when 36 | /// an Error is used as a return value from a 37 | /// function. 38 | /// 39 | /// @return Returns an empty error. The HasError 40 | /// method on empty errors returns false. 41 | static Error NoError(); 42 | 43 | /// Constructs an empty Error. 44 | Error(); 45 | 46 | /// Copies the Error *err* into this Error. 47 | Error(const Error &err); 48 | 49 | /// Assigns the Error *err* to this Error. 50 | Error& operator=(Error err); 51 | 52 | /// Destroys this Error. 53 | ~Error(); 54 | 55 | /// HasError determines whether the Error represents an 56 | /// error state. This function is used to determine 57 | /// whether an Error returned by a function signals 58 | /// an error state, or successful execution. 59 | bool HasError() const; 60 | 61 | /// Domain returns a textual description of the domain. 62 | /// 63 | std::string Domain() const; 64 | long Code() const; 65 | std::string Description() const; 66 | 67 | /// String returns a textual description of the error. 68 | std::string String() const; 69 | 70 | private: 71 | friend class ErrorPrivate; 72 | std::unique_ptr priv_; 73 | }; 74 | 75 | } 76 | 77 | #endif -------------------------------------------------------------------------------- /src/OpenSSLUtils.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 The libmumble Developers 2 | // The use of this source code is goverened by a BSD-style 3 | // license that can be found in the LICENSE-file. 4 | 5 | #include "OpenSSLUtils.h" 6 | #include 7 | 8 | #include 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | #include 16 | 17 | static uv_once_t sslinit = UV_ONCE_INIT; 18 | 19 | static void InitializeOpenSSL() { 20 | SSL_library_init(); 21 | OpenSSL_add_all_algorithms(); 22 | ERR_load_crypto_strings(); 23 | SSL_load_error_strings(); 24 | } 25 | 26 | namespace mumble { 27 | 28 | void OpenSSLUtils::EnsureInitialized() { 29 | uv_once(&sslinit, InitializeOpenSSL); 30 | } 31 | 32 | static std::string SSLErrorToString(int SSLerr) { 33 | switch (SSLerr) { 34 | case SSL_ERROR_NONE: 35 | return std::string("SSL_ERROR_NONE - operation completed successfully"); 36 | case SSL_ERROR_ZERO_RETURN: 37 | return std::string("SSL_ERROR_ZERO_RETURN - connection closed by peer"); 38 | case SSL_ERROR_WANT_READ: 39 | return std::string("SSL_ERROR_WANT_READ - requires a read operation to continue"); 40 | case SSL_ERROR_WANT_WRITE: 41 | return std::string("SSL_ERROR_WANT_WRITE - requires a write operation to continue"); 42 | case SSL_ERROR_WANT_CONNECT: 43 | return std::string("SSL_ERROR_WANT_CONNECT - operation did not complete, call SSL_connect again later"); 44 | case SSL_ERROR_WANT_ACCEPT: 45 | return std::string("SSL_ERROR_WANT_ACCEPT - operation did not complete, call SSL_accept again laster"); 46 | case SSL_ERROR_WANT_X509_LOOKUP: 47 | return std::string("SSL_ERROR_WANT_X509_LOOKUP - operation did not complete, call the TLS I/O function again later"); 48 | case SSL_ERROR_SYSCALL: 49 | return std::string("SSL_ERROR_SYSCALL - system I/O error"); 50 | case SSL_ERROR_SSL: 51 | return std::string("SSL_ERROR_SSL - SSL library error, probably a protocol error"); 52 | } 53 | return std::string("(none)"); 54 | } 55 | 56 | Error OpenSSLUtils::ErrorFromOpenSSLErrorCode(int SSLerr) { 57 | return Error::ErrorFromDescription( 58 | std::string("libssl"), 59 | static_cast(SSLerr), 60 | SSLErrorToString(SSLerr) 61 | ); 62 | } 63 | 64 | Error OpenSSLUtils::ErrorFromLastCryptoError() { 65 | unsigned long cryptocode = ERR_get_error(); 66 | const char *error = ERR_lib_error_string(cryptocode); 67 | const char *func = ERR_func_error_string(cryptocode); 68 | const char *reason = ERR_func_error_string(cryptocode); 69 | 70 | std::stringstream ss; 71 | ss << error << "; " << reason << "; " << func; 72 | 73 | return Error::ErrorFromDescription( 74 | std::string("libcrypto"), 75 | static_cast(cryptocode), 76 | ss.str() 77 | ); 78 | } 79 | 80 | } 81 | -------------------------------------------------------------------------------- /src/Compat_android_test.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 The libmumble Developers 2 | // The use of this source code is goverened by a BSD-style 3 | // license that can be found in the LICENSE-file. 4 | 5 | #include 6 | 7 | #include "Compat_android.h" 8 | #include 9 | #include 10 | 11 | TEST(CompatAndroidTest, Before1970TimeGM64) { 12 | struct tm tm; 13 | memset(&tm, 0, sizeof(tm)); 14 | 15 | // 00:00:00 16 | tm.tm_sec = 0; 17 | tm.tm_min = 0; 18 | tm.tm_hour = 0; 19 | // 1st Jan 1969 00:00:00 UTC 20 | tm.tm_mday = 1; 21 | tm.tm_mon = 0; 22 | tm.tm_year = 69; 23 | 24 | time64_t ts = timegm64(&tm); 25 | EXPECT_EQ(-31536000, ts); 26 | } 27 | 28 | TEST(CompatAndroidTest, InvalidMonthTimeGM64) { 29 | struct tm tm; 30 | memset(&tm, 0, sizeof(tm)); 31 | 32 | tm.tm_sec = 0; 33 | tm.tm_min = 0; 34 | tm.tm_hour = 0; 35 | tm.tm_mday = 1; 36 | tm.tm_mon = 12; // An invalid month field is treated as 0. 37 | tm.tm_year = 69; 38 | 39 | time64_t ts = timegm64(&tm); 40 | EXPECT_EQ(-31536000, ts); 41 | } 42 | 43 | TEST(CompatAndroidTest, TestCompatTimeGM) { 44 | struct tm tm; 45 | memset(&tm, 0, sizeof(tm)); 46 | 47 | // 1st Jan 1970 00:00:00 UTC 48 | tm.tm_mday = 1; 49 | tm.tm_mon = 0; 50 | tm.tm_year = 70; 51 | tm.tm_hour = 0; 52 | tm.tm_min = 0; 53 | tm.tm_sec = 0; 54 | std::time_t ts = timegm(&tm); 55 | EXPECT_EQ(0, ts); 56 | 57 | tm.tm_year = 80; // 1 Jan 1980 00:00:00 UTC 58 | ts = timegm(&tm); 59 | EXPECT_EQ(315532800, ts); 60 | 61 | tm.tm_year = 90; // 1 Jan 1990 00:00:00 UTC 62 | ts = timegm(&tm); 63 | EXPECT_EQ(631152000, ts); 64 | 65 | tm.tm_year = 100; // 1 Jan 2000 00:00:00 UTC 66 | ts = timegm(&tm); 67 | EXPECT_EQ(946684800, ts); 68 | 69 | // 19 Jan 2038 03:14:07 UTC 70 | tm.tm_mday = 19; 71 | tm.tm_mon = 0; 72 | tm.tm_year = 138; 73 | tm.tm_hour = 3; 74 | tm.tm_min = 14; 75 | tm.tm_sec = 7; 76 | ts = timegm(&tm); 77 | EXPECT_EQ(2147483647, ts); 78 | 79 | // 19 Jan 2038 03:14:08 UTC 80 | // Error. Timestamp doesn't fit in signed 32-bit integer. 81 | tm.tm_sec++; 82 | ts = timegm(&tm); 83 | EXPECT_EQ(INT32_MIN, ts); 84 | tm.tm_sec++; 85 | ts = timegm(&tm); 86 | EXPECT_EQ(INT32_MIN, ts); 87 | 88 | // 13 December 1901 20:45:53 UTC 89 | tm.tm_mday = 13; 90 | tm.tm_mon = 11; 91 | tm.tm_year = 1; 92 | tm.tm_hour = 20; 93 | tm.tm_min = 45; 94 | tm.tm_sec = 53; 95 | ts = timegm(&tm); 96 | EXPECT_EQ(-2147483647, ts); 97 | 98 | // 13 December 1901 20:45:52 UTC 99 | tm.tm_sec--; 100 | ts = timegm(&tm); 101 | EXPECT_EQ(INT32_MIN, ts); // -2147483648 102 | 103 | // 13 December 1901 20:45:51 UTC 104 | // Error. Timestamp doesn't fit in signed 32-bit integer. 105 | tm.tm_sec--; 106 | ts = timegm(&tm); 107 | EXPECT_EQ(INT32_MIN, ts); 108 | 109 | // 13 December 1901 20:45:50 UTC 110 | // Error. Timestamp doesn't fit in signed 32-bit integer. 111 | tm.tm_sec--; 112 | ts = timegm(&tm); 113 | EXPECT_EQ(INT32_MIN, ts); 114 | } -------------------------------------------------------------------------------- /src/X509HostnameVerifier.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 The libmumble Developers 2 | // The use of this source code is goverened by a BSD-style 3 | // license that can be found in the LICENSE-file. 4 | 5 | #include "X509HostnameVerifier.h" 6 | #include 7 | 8 | namespace mumble { 9 | 10 | // VerifyHostname verifies that the certificate at cert is valid 11 | // for connections to the passed-in hostname. 12 | bool X509HostnameVerifier::VerifyHostname(const X509Certificate &cert, const std::string &hostname) { 13 | std::vector dns_names = cert.DNSNames(); 14 | if (dns_names.size() > 0) { 15 | for (auto dns_name : dns_names) { 16 | if (X509HostnameVerifier::HostnameExprMatch(dns_name, hostname)) 17 | return true; 18 | } 19 | } else { 20 | std::string cn = cert.CommonName(); 21 | if (X509HostnameVerifier::HostnameExprMatch(cn, hostname)) 22 | return true; 23 | } 24 | 25 | return false; 26 | } 27 | 28 | // HostnameExprMatch checks whether hostname matches hostexpr. While 29 | // hostname must be a valid DNS name, hostexpr may contain wildcards, 30 | // such as *.example.com. A wild card character matches a single 31 | // domain component. That is, a.b.example.com cannot match 32 | // *.example.com. 33 | // 34 | // The matching is done in a case-insensitive manner. The strings 35 | // in hostexpr and hostname must be ASCII strings. If IDNs are used, 36 | // this means they must be ACE-encoded. 37 | bool X509HostnameVerifier::HostnameExprMatch(const std::string &hostexpr, const std::string &hostname) { 38 | std::vector vhostexpr = X509HostnameVerifier::LowerCaseHostnameVector(hostexpr); 39 | std::vector vhostname = X509HostnameVerifier::LowerCaseHostnameVector(hostname); 40 | 41 | if (vhostexpr.size() == 0 || vhostname.size() == 0) { 42 | return false; 43 | } 44 | 45 | if (vhostexpr.size() != vhostname.size()) { 46 | return false; 47 | } 48 | 49 | for (int i = 0; i < vhostname.size(); i++) { 50 | const std::string &cexpr = vhostexpr.at(i); 51 | const std::string &chost = vhostname.at(i); 52 | 53 | if (cexpr.compare("*") == 0) { 54 | continue; 55 | } else { 56 | if (cexpr.compare(chost) != 0) { 57 | return false; 58 | } 59 | } 60 | } 61 | 62 | return true; 63 | } 64 | 65 | // LowerCaseHostnameVector splits the hostname into components separated by '.' 66 | // while ensuring that each component is represented as lower-case ASCII. 67 | std::vector X509HostnameVerifier::LowerCaseHostnameVector(const std::string &hostname) { 68 | std::vector components; 69 | std::string lower; 70 | 71 | for (int i = 0; i < hostname.size(); i++) { 72 | char c = hostname.at(i); 73 | if (c == '.') { 74 | components.push_back(lower); 75 | lower.erase(); 76 | continue; 77 | } 78 | if (c >= 'A' && c <= 'Z') { 79 | lower.append(1, c - 'A' + 'a'); 80 | } else { 81 | lower.append(1, c); 82 | } 83 | } 84 | components.push_back(lower); 85 | 86 | return components; 87 | } 88 | 89 | } -------------------------------------------------------------------------------- /3rdparty/opensslbuild/genasm-gnuas-x86.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) 2013 The libmumble Developers 3 | # The use of this source code is goverened by a BSD-style 4 | # license that can be found in the LICENSE-file. 5 | 6 | trap exit SIGINT SIGTERM 7 | 8 | FN=${BASH_SOURCE} 9 | type -P cygpath 2>&1 >/dev/null 10 | if [ $? -eq 0 ]; then 11 | FN=$(cygpath -u "${FN}") 12 | fi 13 | SCRIPT_DIR=$(dirname ${FN}) 14 | 15 | KIND="$1" 16 | 17 | mkdir -p ${SCRIPT_DIR}/asm/gnuas-x86-${KIND}/crypto/aes/asm 18 | mkdir -p ${SCRIPT_DIR}/asm/gnuas-x86-${KIND}/crypto/cast/asm 19 | mkdir -p ${SCRIPT_DIR}/asm/gnuas-x86-${KIND}/crypto/sha/asm 20 | mkdir -p ${SCRIPT_DIR}/asm/gnuas-x86-${KIND}/crypto/md5/asm 21 | mkdir -p ${SCRIPT_DIR}/asm/gnuas-x86-${KIND}/crypto/ripemd/asm 22 | mkdir -p ${SCRIPT_DIR}/asm/gnuas-x86-${KIND}/crypto/bf/asm 23 | mkdir -p ${SCRIPT_DIR}/asm/gnuas-x86-${KIND}/crypto/des/asm 24 | mkdir -p ${SCRIPT_DIR}/asm/gnuas-x86-${KIND}/crypto/rc4/asm 25 | mkdir -p ${SCRIPT_DIR}/asm/gnuas-x86-${KIND}/crypto/bn/asm 26 | 27 | perl ${SCRIPT_DIR}/../openssl/crypto/x86cpuid.pl ${KIND} > ${SCRIPT_DIR}/asm/gnuas-x86-${KIND}/crypto/x86cpuid.S # -DOPENSSL_IA32_SSE2 for SSE2 28 | perl ${SCRIPT_DIR}/../openssl/crypto/aes/asm/aes-586.pl ${KIND} 386 > ${SCRIPT_DIR}/asm/gnuas-x86-${KIND}/crypto/bn/asm/aes-586.S # remove 386 for SSE 29 | perl ${SCRIPT_DIR}/../openssl/crypto/cast/asm/cast-586.pl ${KIND} > ${SCRIPT_DIR}/asm/gnuas-x86-${KIND}/crypto/cast/asm/cast-586.S 30 | perl ${SCRIPT_DIR}/../openssl/crypto/sha/asm/sha1-586.pl ${KIND} > ${SCRIPT_DIR}/asm/gnuas-x86-${KIND}/crypto/sha/asm/sha1-586.S 31 | perl ${SCRIPT_DIR}/../openssl/crypto/sha/asm/sha256-586.pl ${KIND} > ${SCRIPT_DIR}/asm/gnuas-x86-${KIND}/crypto/sha/asm/sha256-586.S 32 | perl ${SCRIPT_DIR}/../openssl/crypto/sha/asm/sha512-586.pl ${KIND} > ${SCRIPT_DIR}/asm/gnuas-x86-${KIND}/crypto/sha/asm/sha512-586.S # -DOPENSSL_IA32_SSE2 for SSE2 33 | perl ${SCRIPT_DIR}/../openssl/crypto/md5/asm/md5-586.pl ${KIND} > ${SCRIPT_DIR}/asm/gnuas-x86-${KIND}/crypto/md5/asm/md5-586.S 34 | perl ${SCRIPT_DIR}/../openssl/crypto/ripemd/asm/rmd-586.pl ${KIND} > ${SCRIPT_DIR}/asm/gnuas-x86-${KIND}/crypto/md5/asm/rmd-586.S 35 | perl ${SCRIPT_DIR}/../openssl/crypto/bf/asm/bf-586.pl ${KIND} > ${SCRIPT_DIR}/asm/gnuas-x86-${KIND}/crypto/bf/asm/bf-586.S 36 | perl ${SCRIPT_DIR}/../openssl/crypto/des/asm/des-586.pl ${KIND} > ${SCRIPT_DIR}/asm/gnuas-x86-${KIND}/crypto/des/asm/des-586.S 37 | perl ${SCRIPT_DIR}/../openssl/crypto/des/asm/crypt586.pl ${KIND} > ${SCRIPT_DIR}/asm/gnuas-x86-${KIND}/crypto/des/asm/crypt586.S 38 | perl ${SCRIPT_DIR}/../openssl/crypto/rc4/asm/rc4-586.pl ${KIND} > ${SCRIPT_DIR}/asm/gnuas-x86-${KIND}/crypto/rc4/asm/rc4-586.S 39 | perl ${SCRIPT_DIR}/../openssl/crypto/bn/asm/bn-586.pl ${KIND} > ${SCRIPT_DIR}/asm/gnuas-x86-${KIND}/crypto/bn/asm/bn-586.S # -DOPENSSL_IA32_SSE2 for SSE2 40 | perl ${SCRIPT_DIR}/../openssl/crypto/bn/asm/co-586.pl ${KIND} > ${SCRIPT_DIR}/asm/gnuas-x86-${KIND}/crypto/bn/asm/co-586.S 41 | perl ${SCRIPT_DIR}/../openssl/crypto/bn/asm/x86-mont.pl ${KIND} > ${SCRIPT_DIR}/asm/gnuas-x86-${KIND}/crypto/bn/asm/x86-mont.S # -DOPENSSL_IA32_SSE2 for SSE2 42 | -------------------------------------------------------------------------------- /3rdparty/protobufbuild/protoc.gypi: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2013 The libmumble Developers 2 | # The use of this source code is goverened by a BSD-style 3 | # license that can be found in the LICENSE-file. 4 | # 5 | # This file is originally based on protoc.gypi from the 6 | # Chromium project, which is licensed under the following terms: 7 | # 8 | # Copyright (c) 2012 The Chromium Authors. All rights reserved. 9 | # Use of this source code is governed by a BSD-style license that can be 10 | # found in the LICENSE.chromium file. 11 | 12 | # This file is meant to be included into a target to provide a rule 13 | # which will invoke protoc on any *.proto files found in the target's 14 | # sources. This is needed when we're running with a system-installed 15 | # protobuf, and therefore cannot use our own pre-generated .pb.cc and 16 | # .pb.h files because we cannot be sure that they're compatible with 17 | # the sytem's libprotobuf. 18 | # 19 | # To use this generator to generate protoc products that are compatible 20 | # with the system's protobuf library, add this gypi file to the target's 21 | # includes, and add the .proto files you whish to process to the target's 22 | # sources like below: 23 | # 24 | # { 25 | # 'target_name': 'foo', 26 | # 'type': 'executable', 27 | # 'sources': [ 28 | # 'foo.proto', 29 | # 'bar.proto', 30 | # ], 31 | # 'includes': ['3rdparty/protobufbuild/protoc.gypi'], 32 | # } 33 | # 34 | # The generated products will automatically be added to the target's sources, 35 | # and the protoc compiler is guaranteed to run before compiling any other 36 | # sources of the target. 37 | 38 | { 39 | 'variables': { 40 | 'cc_dir': '<(SHARED_INTERMEDIATE_DIR)/protoc_out/', 41 | 'cc_generator_options%': '', 42 | 'cc_include%': '', 43 | 'protoc': ' 9 | #include 10 | 11 | #include "uv.h" 12 | 13 | #include 14 | 15 | #include 16 | #include "UVBio.h" 17 | 18 | namespace mumble { 19 | 20 | class TLSConnectionPrivate { 21 | public: 22 | enum TLSConnectionState { 23 | TLS_CONNECTION_STATE_INVALID, 24 | TLS_CONNECTION_STATE_PRE_CONNECT, // uv_connect has not yet succeeded. 25 | TLS_CONNECTION_STATE_STARVED_SSL_CONNECT, // SSL_connect has not yet succeded, but failed with a SSL_ERROR_WANT_READ 26 | TLS_CONNECTION_STATE_ESTABLISHED, 27 | TLS_CONNECTION_STATE_DISCONNECTED_ERROR, // We've been disconnected by an error. 28 | TLS_CONNECTION_STATE_DISCONNECTED_REMOTE, // Remote end closed the connection. 29 | TLS_CONNECTION_STATE_DISCONNECTED_LOCAL, // Disconnect was used to shut down the TLSConnection on our end. 30 | }; 31 | 32 | TLSConnectionPrivate(); 33 | ~TLSConnectionPrivate(); 34 | 35 | Error Connect(const std::string &ipaddr, int port, TLSConnectionOptions *opts); 36 | void Disconnect(); 37 | void Write(const ByteArray &buf); 38 | 39 | void Shutdown(TLSConnectionState state); 40 | void ShutdownRemote(); 41 | void ShutdownError(const Error &err); 42 | 43 | TLSConnectionState state_; 44 | 45 | uv_loop_t *loop_; 46 | uv_thread_t thread_; 47 | uv_tcp_t tcpsock_; 48 | uv_connect_t tcpconn_; 49 | 50 | std::atomic thread_id_; 51 | 52 | UVBioState *biostate_; 53 | 54 | SSL_CTX *ctx_; 55 | SSL *ssl_; 56 | BIO *bio_; 57 | 58 | uv_mutex_t wqlock_; 59 | uv_async_t wqasync_; 60 | std::queue wq_; 61 | 62 | uv_async_t dcasync_; 63 | 64 | Error err_; 65 | 66 | TLSConnectionChainVerifyHandler chain_verify_handler_; 67 | TLSConnectionEstablishedHandler established_handler_; 68 | TLSConnectionReadHandler read_handler_; 69 | TLSConnectionErrorHandler error_handler_; 70 | TLSConnectionDisconnectHandler disconnect_handler_; 71 | 72 | bool HandleStarvedConnectState(); 73 | void TransitionToConnectionEstablishedState(); 74 | 75 | static void InitializeSSL(); 76 | static void TLSConnectionThread(void *conn); 77 | static void OnConnect(uv_connect_t *conn, int status); 78 | static void OnRead(uv_stream_t *stream, ssize_t nread, uv_buf_t buf); 79 | static void OnDrainWriteQueue(uv_async_t *handle, int status); 80 | static void OnDisconnectRequest(uv_async_t *handle, int status); 81 | static uv_buf_t AllocCallback(uv_handle_t *handle, size_t suggested_size); 82 | static int SSLVerifyCallback(X509_STORE_CTX *store, void *udata); 83 | }; 84 | 85 | } 86 | 87 | #endif 88 | -------------------------------------------------------------------------------- /src/X509Certificate.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 The libmumble Developers 2 | // The use of this source code is goverened by a BSD-style 3 | // license that can be found in the LICENSE-file. 4 | 5 | #include 6 | #include "X509Certificate_p.h" 7 | #include 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | namespace mumble { 14 | 15 | X509Certificate X509Certificate::FromRawDERData(const ByteArray &cert, const ByteArray &pkey) { 16 | X509Certificate tmp; 17 | tmp.dptr_->cert_der_ = cert; 18 | tmp.dptr_->priv_der_ = pkey; 19 | tmp.dptr_->ExtractCertificateInfo(); 20 | return tmp; 21 | } 22 | 23 | X509Certificate X509Certificate::GenerateSelfSignedCertificate(const std::string &name, const std::string &email) { 24 | return X509CertificatePrivate::GenerateSelfSignedCertificate(name, email); 25 | } 26 | 27 | std::vector X509Certificate::FromPKCS12(const ByteArray &pkcs12, const std::string &password) { 28 | return X509CertificatePrivate::FromPKCS12(pkcs12, password); 29 | } 30 | 31 | ByteArray X509Certificate::ExportCertificateChainAsPKCS12(std::vector chain, const std::string &password) { 32 | return X509CertificatePrivate::ExportCertificateChainAsPKCS12(chain, password); 33 | } 34 | 35 | X509Certificate::X509Certificate() : dptr_(new X509CertificatePrivate) { 36 | } 37 | 38 | X509Certificate::~X509Certificate() { 39 | } 40 | 41 | X509Certificate::X509Certificate(const X509Certificate &cert) : dptr_(new X509CertificatePrivate) { 42 | dptr_->cert_der_ = cert.dptr_->cert_der_; 43 | dptr_->priv_der_ = cert.dptr_->priv_der_; 44 | dptr_->ExtractCertificateInfo(); 45 | } 46 | 47 | X509Certificate& X509Certificate::operator=(X509Certificate cert) { 48 | std::swap((*this).dptr_, cert.dptr_); 49 | return *this; 50 | } 51 | 52 | bool X509Certificate::HasCertificate() const { 53 | return !dptr_->cert_der_.IsNull(); 54 | } 55 | 56 | bool X509Certificate::HasPrivateKey() const { 57 | return !dptr_->priv_der_.IsNull(); 58 | } 59 | 60 | ByteArray X509Certificate::SHA1Digest() const { 61 | return dptr_->Digest(std::string("sha1")); 62 | } 63 | 64 | ByteArray X509Certificate::SHA256Digest() const { 65 | return dptr_->Digest(std::string("sha256")); 66 | } 67 | 68 | std::time_t X509Certificate::NotBeforeTime() const { 69 | return dptr_->NotBeforeTime(); 70 | } 71 | 72 | std::time_t X509Certificate::NotAfterTime() const { 73 | return dptr_->NotAfterTime(); 74 | } 75 | 76 | bool X509Certificate::IsSignedBy(const X509Certificate &parent) const { 77 | return dptr_->IsSignedBy(parent); 78 | } 79 | 80 | bool X509Certificate::IsValidAtTime(std::time_t time) const { 81 | return time >= NotBeforeTime() && time <= NotAfterTime(); 82 | } 83 | 84 | std::string X509Certificate::SubjectName() const { 85 | return dptr_->SubjectName(); 86 | } 87 | 88 | std::string X509Certificate::CommonName() const { 89 | return dptr_->CommonName(); 90 | } 91 | 92 | std::string X509Certificate::EmailAddress() const { 93 | return dptr_->EmailAddress(); 94 | } 95 | 96 | std::vector X509Certificate::DNSNames() const { 97 | return dptr_->DNSNames(); 98 | } 99 | 100 | std::string X509Certificate::IssuerName() const { 101 | return dptr_->IssuerName(); 102 | } 103 | 104 | std::string X509Certificate::LookupIssuerItem(const std::string &item) const{ 105 | return dptr_->LookupIssuerItem(item); 106 | } 107 | 108 | std::string X509Certificate::LookupSubjectItem(const std::string &item) const { 109 | return dptr_->LookupSubjectItem(item); 110 | } 111 | 112 | } 113 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/asm/gnuas-x86_64-macosx/crypto/bn/asm/x86_64-mont.S: -------------------------------------------------------------------------------- 1 | .text 2 | 3 | .globl _bn_mul_mont 4 | 5 | .p2align 4 6 | _bn_mul_mont: 7 | pushq %rbx 8 | pushq %rbp 9 | pushq %r12 10 | pushq %r13 11 | pushq %r14 12 | pushq %r15 13 | 14 | movl %r9d,%r9d 15 | leaq 2(%r9),%r10 16 | movq %rsp,%r11 17 | negq %r10 18 | leaq (%rsp,%r10,8),%rsp 19 | andq $-1024,%rsp 20 | 21 | movq %r11,8(%rsp,%r9,8) 22 | L$prologue: 23 | movq %rdx,%r12 24 | 25 | movq (%r8),%r8 26 | 27 | xorq %r14,%r14 28 | xorq %r15,%r15 29 | 30 | movq (%r12),%rbx 31 | movq (%rsi),%rax 32 | mulq %rbx 33 | movq %rax,%r10 34 | movq %rdx,%r11 35 | 36 | imulq %r8,%rax 37 | movq %rax,%rbp 38 | 39 | mulq (%rcx) 40 | addq %r10,%rax 41 | adcq $0,%rdx 42 | movq %rdx,%r13 43 | 44 | leaq 1(%r15),%r15 45 | L$1st: 46 | movq (%rsi,%r15,8),%rax 47 | mulq %rbx 48 | addq %r11,%rax 49 | adcq $0,%rdx 50 | movq %rax,%r10 51 | movq (%rcx,%r15,8),%rax 52 | movq %rdx,%r11 53 | 54 | mulq %rbp 55 | addq %r13,%rax 56 | leaq 1(%r15),%r15 57 | adcq $0,%rdx 58 | addq %r10,%rax 59 | adcq $0,%rdx 60 | movq %rax,-16(%rsp,%r15,8) 61 | cmpq %r9,%r15 62 | movq %rdx,%r13 63 | jl L$1st 64 | 65 | xorq %rdx,%rdx 66 | addq %r11,%r13 67 | adcq $0,%rdx 68 | movq %r13,-8(%rsp,%r9,8) 69 | movq %rdx,(%rsp,%r9,8) 70 | 71 | leaq 1(%r14),%r14 72 | .p2align 2 73 | L$outer: 74 | xorq %r15,%r15 75 | 76 | movq (%r12,%r14,8),%rbx 77 | movq (%rsi),%rax 78 | mulq %rbx 79 | addq (%rsp),%rax 80 | adcq $0,%rdx 81 | movq %rax,%r10 82 | movq %rdx,%r11 83 | 84 | imulq %r8,%rax 85 | movq %rax,%rbp 86 | 87 | mulq (%rcx,%r15,8) 88 | addq %r10,%rax 89 | movq 8(%rsp),%r10 90 | adcq $0,%rdx 91 | movq %rdx,%r13 92 | 93 | leaq 1(%r15),%r15 94 | .p2align 2 95 | L$inner: 96 | movq (%rsi,%r15,8),%rax 97 | mulq %rbx 98 | addq %r11,%rax 99 | adcq $0,%rdx 100 | addq %rax,%r10 101 | movq (%rcx,%r15,8),%rax 102 | adcq $0,%rdx 103 | movq %rdx,%r11 104 | 105 | mulq %rbp 106 | addq %r13,%rax 107 | leaq 1(%r15),%r15 108 | adcq $0,%rdx 109 | addq %r10,%rax 110 | adcq $0,%rdx 111 | movq (%rsp,%r15,8),%r10 112 | cmpq %r9,%r15 113 | movq %rax,-16(%rsp,%r15,8) 114 | movq %rdx,%r13 115 | jl L$inner 116 | 117 | xorq %rdx,%rdx 118 | addq %r11,%r13 119 | adcq $0,%rdx 120 | addq %r10,%r13 121 | adcq $0,%rdx 122 | movq %r13,-8(%rsp,%r9,8) 123 | movq %rdx,(%rsp,%r9,8) 124 | 125 | leaq 1(%r14),%r14 126 | cmpq %r9,%r14 127 | jl L$outer 128 | 129 | leaq (%rsp),%rsi 130 | leaq -1(%r9),%r15 131 | 132 | movq (%rsi),%rax 133 | xorq %r14,%r14 134 | jmp L$sub 135 | .p2align 4 136 | L$sub: sbbq (%rcx,%r14,8),%rax 137 | movq %rax,(%rdi,%r14,8) 138 | decq %r15 139 | movq 8(%rsi,%r14,8),%rax 140 | leaq 1(%r14),%r14 141 | jge L$sub 142 | 143 | sbbq $0,%rax 144 | andq %rax,%rsi 145 | notq %rax 146 | movq %rdi,%rcx 147 | andq %rax,%rcx 148 | leaq -1(%r9),%r15 149 | orq %rcx,%rsi 150 | .p2align 4 151 | L$copy: 152 | movq (%rsi,%r15,8),%rax 153 | movq %rax,(%rdi,%r15,8) 154 | movq %r14,(%rsp,%r15,8) 155 | decq %r15 156 | jge L$copy 157 | 158 | movq 8(%rsp,%r9,8),%rsi 159 | movq $1,%rax 160 | movq (%rsi),%r15 161 | movq 8(%rsi),%r14 162 | movq 16(%rsi),%r13 163 | movq 24(%rsi),%r12 164 | movq 32(%rsi),%rbp 165 | movq 40(%rsi),%rbx 166 | leaq 48(%rsi),%rsp 167 | L$epilogue: 168 | .byte 0xf3,0xc3 169 | 170 | .byte 77,111,110,116,103,111,109,101,114,121,32,77,117,108,116,105,112,108,105,99,97,116,105,111,110,32,102,111,114,32,120,56,54,95,54,52,44,32,67,82,89,80,84,79,71,65,77,83,32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111,114,103,62,0 171 | .p2align 4 172 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/asm/gnuas-x86_64-mingw64/crypto/x86_64cpuid.S: -------------------------------------------------------------------------------- 1 | 2 | .section .ctors 3 | .p2align 3 4 | .quad OPENSSL_cpuid_setup 5 | 6 | .text 7 | 8 | .globl OPENSSL_atomic_add 9 | .def OPENSSL_atomic_add; .scl 2; .type 32; .endef 10 | .p2align 4 11 | OPENSSL_atomic_add: 12 | movl (%rcx),%eax 13 | .Lspin: leaq (%rdx,%rax,1),%r8 14 | .byte 0xf0 15 | cmpxchgl %r8d,(%rcx) 16 | jne .Lspin 17 | movl %r8d,%eax 18 | .byte 0x48,0x98 19 | .byte 0xf3,0xc3 20 | 21 | 22 | .globl OPENSSL_rdtsc 23 | .def OPENSSL_rdtsc; .scl 2; .type 32; .endef 24 | .p2align 4 25 | OPENSSL_rdtsc: 26 | rdtsc 27 | shlq $32,%rdx 28 | orq %rdx,%rax 29 | .byte 0xf3,0xc3 30 | 31 | 32 | .globl OPENSSL_ia32_cpuid 33 | .def OPENSSL_ia32_cpuid; .scl 2; .type 32; .endef 34 | .p2align 4 35 | OPENSSL_ia32_cpuid: 36 | movq %rbx,%r8 37 | 38 | xorl %eax,%eax 39 | cpuid 40 | movl %eax,%r11d 41 | 42 | xorl %eax,%eax 43 | cmpl $1970169159,%ebx 44 | setne %al 45 | movl %eax,%r9d 46 | cmpl $1231384169,%edx 47 | setne %al 48 | orl %eax,%r9d 49 | cmpl $1818588270,%ecx 50 | setne %al 51 | orl %eax,%r9d 52 | jz .Lintel 53 | 54 | cmpl $1752462657,%ebx 55 | setne %al 56 | movl %eax,%r10d 57 | cmpl $1769238117,%edx 58 | setne %al 59 | orl %eax,%r10d 60 | cmpl $1145913699,%ecx 61 | setne %al 62 | orl %eax,%r10d 63 | jnz .Lintel 64 | 65 | 66 | movl $2147483648,%eax 67 | cpuid 68 | cmpl $2147483656,%eax 69 | jb .Lintel 70 | 71 | movl $2147483656,%eax 72 | cpuid 73 | movzbq %cl,%r10 74 | incq %r10 75 | 76 | movl $1,%eax 77 | cpuid 78 | btl $28,%edx 79 | jnc .Ldone 80 | shrl $16,%ebx 81 | cmpb %r10b,%bl 82 | ja .Ldone 83 | andl $4026531839,%edx 84 | jmp .Ldone 85 | 86 | .Lintel: 87 | cmpl $4,%r11d 88 | movl $-1,%r10d 89 | jb .Lnocacheinfo 90 | 91 | movl $4,%eax 92 | movl $0,%ecx 93 | cpuid 94 | movl %eax,%r10d 95 | shrl $14,%r10d 96 | andl $4095,%r10d 97 | 98 | .Lnocacheinfo: 99 | movl $1,%eax 100 | cpuid 101 | cmpl $0,%r9d 102 | jne .Lnotintel 103 | orl $1048576,%edx 104 | andb $15,%ah 105 | cmpb $15,%ah 106 | je .Lnotintel 107 | orl $1073741824,%edx 108 | .Lnotintel: 109 | btl $28,%edx 110 | jnc .Ldone 111 | andl $4026531839,%edx 112 | cmpl $0,%r10d 113 | je .Ldone 114 | 115 | orl $268435456,%edx 116 | shrl $16,%ebx 117 | cmpb $1,%bl 118 | ja .Ldone 119 | andl $4026531839,%edx 120 | .Ldone: 121 | shlq $32,%rcx 122 | movl %edx,%eax 123 | movq %r8,%rbx 124 | orq %rcx,%rax 125 | .byte 0xf3,0xc3 126 | 127 | 128 | .globl OPENSSL_cleanse 129 | .def OPENSSL_cleanse; .scl 2; .type 32; .endef 130 | .p2align 4 131 | OPENSSL_cleanse: 132 | xorq %rax,%rax 133 | cmpq $15,%rdx 134 | jae .Lot 135 | cmpq $0,%rdx 136 | je .Lret 137 | .Little: 138 | movb %al,(%rcx) 139 | subq $1,%rdx 140 | leaq 1(%rcx),%rcx 141 | jnz .Little 142 | .Lret: 143 | .byte 0xf3,0xc3 144 | .p2align 4 145 | .Lot: 146 | testq $7,%rcx 147 | jz .Laligned 148 | movb %al,(%rcx) 149 | leaq -1(%rdx),%rdx 150 | leaq 1(%rcx),%rcx 151 | jmp .Lot 152 | .Laligned: 153 | movq %rax,(%rcx) 154 | leaq -8(%rdx),%rdx 155 | testq $-8,%rdx 156 | leaq 8(%rcx),%rcx 157 | jnz .Laligned 158 | cmpq $0,%rdx 159 | jne .Little 160 | .byte 0xf3,0xc3 161 | 162 | .globl OPENSSL_wipe_cpu 163 | .def OPENSSL_wipe_cpu; .scl 2; .type 32; .endef 164 | .p2align 4 165 | OPENSSL_wipe_cpu: 166 | pxor %xmm0,%xmm0 167 | pxor %xmm1,%xmm1 168 | pxor %xmm2,%xmm2 169 | pxor %xmm3,%xmm3 170 | pxor %xmm4,%xmm4 171 | pxor %xmm5,%xmm5 172 | xorq %rcx,%rcx 173 | xorq %rdx,%rdx 174 | xorq %r8,%r8 175 | xorq %r9,%r9 176 | xorq %r10,%r10 177 | xorq %r11,%r11 178 | leaq 8(%rsp),%rax 179 | .byte 0xf3,0xc3 180 | 181 | -------------------------------------------------------------------------------- /testdata/x509/google.dk/wildcard-google.dk-chain.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIDhTCCAu6gAwIBAgIKUCbzKgAAAAB12jANBgkqhkiG9w0BAQUFADBGMQswCQYD 3 | VQQGEwJVUzETMBEGA1UEChMKR29vZ2xlIEluYzEiMCAGA1UEAxMZR29vZ2xlIElu 4 | dGVybmV0IEF1dGhvcml0eTAeFw0xMjEyMDYwODU2MDRaFw0xMzA2MDcxOTQzMjda 5 | MGUxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1N 6 | b3VudGFpbiBWaWV3MRMwEQYDVQQKEwpHb29nbGUgSW5jMRQwEgYDVQQDFAsqLmdv 7 | b2dsZS5kazCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA1VtV/MQPnCwnC8Ey 8 | 2El3QtrRKCYqbRqtYJxxKj/GqsFGRoWWf59Ton57FgIlIDEj/vPVu8QSpSF+Evlh 9 | 9OV5hzPViQ48qXwb6x+agP6C1EkRfyLv7zrgTY8yEyF6Vq37j1A6C3hekbPAXIlK 10 | AxpwPz+OWwjP4lH8GsT2jNOxz+0CAwEAAaOCAVkwggFVMB0GA1UdJQQWMBQGCCsG 11 | AQUFBwMBBggrBgEFBQcDAjAdBgNVHQ4EFgQUlqvdcZlgQFZxxP0iBs7t/UrIE8Aw 12 | HwYDVR0jBBgwFoAUv8Aw6/VDET5nup6R+/xq2uNrEiQwWwYDVR0fBFQwUjBQoE6g 13 | TIZKaHR0cDovL3d3dy5nc3RhdGljLmNvbS9Hb29nbGVJbnRlcm5ldEF1dGhvcml0 14 | eS9Hb29nbGVJbnRlcm5ldEF1dGhvcml0eS5jcmwwZgYIKwYBBQUHAQEEWjBYMFYG 15 | CCsGAQUFBzAChkpodHRwOi8vd3d3LmdzdGF0aWMuY29tL0dvb2dsZUludGVybmV0 16 | QXV0aG9yaXR5L0dvb2dsZUludGVybmV0QXV0aG9yaXR5LmNydDAMBgNVHRMBAf8E 17 | AjAAMCEGA1UdEQQaMBiCCyouZ29vZ2xlLmRrgglnb29nbGUuZGswDQYJKoZIhvcN 18 | AQEFBQADgYEAOHkCJyRXNS4tAQf4/2h6ODLR1X7HJ7Mb5nPFABYSalCDMbxh3ytG 19 | IOZYCudfLfAw5oB9+Cozt2B1F+pZBawXeSZmuNjYmsuBIJ9E+BjayHegoTuSlOPt 20 | sqCcsha50+UYEnKqbDoeK2XjbiXIKyKBR0NA28m3b3+Of6QWPI9zUmY= 21 | -----END CERTIFICATE----- 22 | -----BEGIN CERTIFICATE----- 23 | MIICsDCCAhmgAwIBAgIDC2dxMA0GCSqGSIb3DQEBBQUAME4xCzAJBgNVBAYTAlVT 24 | MRAwDgYDVQQKEwdFcXVpZmF4MS0wKwYDVQQLEyRFcXVpZmF4IFNlY3VyZSBDZXJ0 25 | aWZpY2F0ZSBBdXRob3JpdHkwHhcNMDkwNjA4MjA0MzI3WhcNMTMwNjA3MTk0MzI3 26 | WjBGMQswCQYDVQQGEwJVUzETMBEGA1UEChMKR29vZ2xlIEluYzEiMCAGA1UEAxMZ 27 | R29vZ2xlIEludGVybmV0IEF1dGhvcml0eTCBnzANBgkqhkiG9w0BAQEFAAOBjQAw 28 | gYkCgYEAye23pIucV+eEPkB9hPSP0XFjU5nneXQUr0SZMyCSjXvlKAy6rWxJfoNf 29 | NFlOCnowzdDXxFdF7dWq1nMmzq0yE7jXDx07393cCDaob1FEm8rWIFJztyaHNWrb 30 | qeXUWaUr/GcZOfqTGBhs3t0lig4zFEfC7wFQeeT9adGnwKziV28CAwEAAaOBozCB 31 | oDAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFL/AMOv1QxE+Z7qekfv8atrjaxIk 32 | MB8GA1UdIwQYMBaAFEjmaPkr0rKV10fYIyAQTzOYkJ/UMBIGA1UdEwEB/wQIMAYB 33 | Af8CAQAwOgYDVR0fBDMwMTAvoC2gK4YpaHR0cDovL2NybC5nZW90cnVzdC5jb20v 34 | Y3Jscy9zZWN1cmVjYS5jcmwwDQYJKoZIhvcNAQEFBQADgYEAuIojxkiWsRF8YHde 35 | BZqrocb6ghwYB8TrgbCoZutJqOkM0ymt9e8kTP3kS8p/XmOrmSfLnzYhLLkQYGfN 36 | 0rTw8Ktx5YtaiScRhKqOv5nwnQkhClIZmloJ0pC3+gz4fniisIWvXEyZ2VxVKfml 37 | UUIuOss4jHg7y/j7lYe8vJD5UDI= 38 | -----END CERTIFICATE----- 39 | -----BEGIN CERTIFICATE----- 40 | MIIDIDCCAomgAwIBAgIENd70zzANBgkqhkiG9w0BAQUFADBOMQswCQYDVQQGEwJV 41 | UzEQMA4GA1UEChMHRXF1aWZheDEtMCsGA1UECxMkRXF1aWZheCBTZWN1cmUgQ2Vy 42 | dGlmaWNhdGUgQXV0aG9yaXR5MB4XDTk4MDgyMjE2NDE1MVoXDTE4MDgyMjE2NDE1 43 | MVowTjELMAkGA1UEBhMCVVMxEDAOBgNVBAoTB0VxdWlmYXgxLTArBgNVBAsTJEVx 44 | dWlmYXggU2VjdXJlIENlcnRpZmljYXRlIEF1dGhvcml0eTCBnzANBgkqhkiG9w0B 45 | AQEFAAOBjQAwgYkCgYEAwV2xWGcIYu6gmi0fCG2RFGiYCh7+2gRvE4RiIcPRfM6f 46 | BeC4AfBONOziipUEZKzxa1NfBbPLZ4C/QgKO/t0BCezhABRP/PvwDN1Dulsr4R+A 47 | cJkVV5MW8Q+XarfCaCMczE1ZMKxRHjuvK9buY0V7xdlfUNLjUA86iOe/FP3gx7kC 48 | AwEAAaOCAQkwggEFMHAGA1UdHwRpMGcwZaBjoGGkXzBdMQswCQYDVQQGEwJVUzEQ 49 | MA4GA1UEChMHRXF1aWZheDEtMCsGA1UECxMkRXF1aWZheCBTZWN1cmUgQ2VydGlm 50 | aWNhdGUgQXV0aG9yaXR5MQ0wCwYDVQQDEwRDUkwxMBoGA1UdEAQTMBGBDzIwMTgw 51 | ODIyMTY0MTUxWjALBgNVHQ8EBAMCAQYwHwYDVR0jBBgwFoAUSOZo+SvSspXXR9gj 52 | IBBPM5iQn9QwHQYDVR0OBBYEFEjmaPkr0rKV10fYIyAQTzOYkJ/UMAwGA1UdEwQF 53 | MAMBAf8wGgYJKoZIhvZ9B0EABA0wCxsFVjMuMGMDAgbAMA0GCSqGSIb3DQEBBQUA 54 | A4GBAFjOKer89961zgK5F7WF0bnj4JXMJTENAKaSbn+2kmOeUJXRmm/kEd5jhW6Y 55 | 7qj/WsjTVbJmcVfewCHrPSqnI0kBBIZCe/zuf6IWUrVnZ9NA2zsmWLIodz2uFHdh 56 | 1voqZiegDfqnc1zqcPGUIWVEX/r87yloqaKHee9570+sB3c4 57 | -----END CERTIFICATE----- 58 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/asm/gnuas-x86_64-elf/crypto/bn/asm/x86_64-mont.S: -------------------------------------------------------------------------------- 1 | .text 2 | 3 | .globl bn_mul_mont 4 | .type bn_mul_mont,@function 5 | .align 16 6 | bn_mul_mont: 7 | pushq %rbx 8 | pushq %rbp 9 | pushq %r12 10 | pushq %r13 11 | pushq %r14 12 | pushq %r15 13 | 14 | movl %r9d,%r9d 15 | leaq 2(%r9),%r10 16 | movq %rsp,%r11 17 | negq %r10 18 | leaq (%rsp,%r10,8),%rsp 19 | andq $-1024,%rsp 20 | 21 | movq %r11,8(%rsp,%r9,8) 22 | .Lprologue: 23 | movq %rdx,%r12 24 | 25 | movq (%r8),%r8 26 | 27 | xorq %r14,%r14 28 | xorq %r15,%r15 29 | 30 | movq (%r12),%rbx 31 | movq (%rsi),%rax 32 | mulq %rbx 33 | movq %rax,%r10 34 | movq %rdx,%r11 35 | 36 | imulq %r8,%rax 37 | movq %rax,%rbp 38 | 39 | mulq (%rcx) 40 | addq %r10,%rax 41 | adcq $0,%rdx 42 | movq %rdx,%r13 43 | 44 | leaq 1(%r15),%r15 45 | .L1st: 46 | movq (%rsi,%r15,8),%rax 47 | mulq %rbx 48 | addq %r11,%rax 49 | adcq $0,%rdx 50 | movq %rax,%r10 51 | movq (%rcx,%r15,8),%rax 52 | movq %rdx,%r11 53 | 54 | mulq %rbp 55 | addq %r13,%rax 56 | leaq 1(%r15),%r15 57 | adcq $0,%rdx 58 | addq %r10,%rax 59 | adcq $0,%rdx 60 | movq %rax,-16(%rsp,%r15,8) 61 | cmpq %r9,%r15 62 | movq %rdx,%r13 63 | jl .L1st 64 | 65 | xorq %rdx,%rdx 66 | addq %r11,%r13 67 | adcq $0,%rdx 68 | movq %r13,-8(%rsp,%r9,8) 69 | movq %rdx,(%rsp,%r9,8) 70 | 71 | leaq 1(%r14),%r14 72 | .align 4 73 | .Louter: 74 | xorq %r15,%r15 75 | 76 | movq (%r12,%r14,8),%rbx 77 | movq (%rsi),%rax 78 | mulq %rbx 79 | addq (%rsp),%rax 80 | adcq $0,%rdx 81 | movq %rax,%r10 82 | movq %rdx,%r11 83 | 84 | imulq %r8,%rax 85 | movq %rax,%rbp 86 | 87 | mulq (%rcx,%r15,8) 88 | addq %r10,%rax 89 | movq 8(%rsp),%r10 90 | adcq $0,%rdx 91 | movq %rdx,%r13 92 | 93 | leaq 1(%r15),%r15 94 | .align 4 95 | .Linner: 96 | movq (%rsi,%r15,8),%rax 97 | mulq %rbx 98 | addq %r11,%rax 99 | adcq $0,%rdx 100 | addq %rax,%r10 101 | movq (%rcx,%r15,8),%rax 102 | adcq $0,%rdx 103 | movq %rdx,%r11 104 | 105 | mulq %rbp 106 | addq %r13,%rax 107 | leaq 1(%r15),%r15 108 | adcq $0,%rdx 109 | addq %r10,%rax 110 | adcq $0,%rdx 111 | movq (%rsp,%r15,8),%r10 112 | cmpq %r9,%r15 113 | movq %rax,-16(%rsp,%r15,8) 114 | movq %rdx,%r13 115 | jl .Linner 116 | 117 | xorq %rdx,%rdx 118 | addq %r11,%r13 119 | adcq $0,%rdx 120 | addq %r10,%r13 121 | adcq $0,%rdx 122 | movq %r13,-8(%rsp,%r9,8) 123 | movq %rdx,(%rsp,%r9,8) 124 | 125 | leaq 1(%r14),%r14 126 | cmpq %r9,%r14 127 | jl .Louter 128 | 129 | leaq (%rsp),%rsi 130 | leaq -1(%r9),%r15 131 | 132 | movq (%rsi),%rax 133 | xorq %r14,%r14 134 | jmp .Lsub 135 | .align 16 136 | .Lsub: sbbq (%rcx,%r14,8),%rax 137 | movq %rax,(%rdi,%r14,8) 138 | decq %r15 139 | movq 8(%rsi,%r14,8),%rax 140 | leaq 1(%r14),%r14 141 | jge .Lsub 142 | 143 | sbbq $0,%rax 144 | andq %rax,%rsi 145 | notq %rax 146 | movq %rdi,%rcx 147 | andq %rax,%rcx 148 | leaq -1(%r9),%r15 149 | orq %rcx,%rsi 150 | .align 16 151 | .Lcopy: 152 | movq (%rsi,%r15,8),%rax 153 | movq %rax,(%rdi,%r15,8) 154 | movq %r14,(%rsp,%r15,8) 155 | decq %r15 156 | jge .Lcopy 157 | 158 | movq 8(%rsp,%r9,8),%rsi 159 | movq $1,%rax 160 | movq (%rsi),%r15 161 | movq 8(%rsi),%r14 162 | movq 16(%rsi),%r13 163 | movq 24(%rsi),%r12 164 | movq 32(%rsi),%rbp 165 | movq 40(%rsi),%rbx 166 | leaq 48(%rsi),%rsp 167 | .Lepilogue: 168 | .byte 0xf3,0xc3 169 | .size bn_mul_mont,.-bn_mul_mont 170 | .byte 77,111,110,116,103,111,109,101,114,121,32,77,117,108,116,105,112,108,105,99,97,116,105,111,110,32,102,111,114,32,120,56,54,95,54,52,44,32,67,82,89,80,84,79,71,65,77,83,32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111,114,103,62,0 171 | .align 16 172 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/asm/gnuas-x86_64-macosx/crypto/x86_64cpuid.S: -------------------------------------------------------------------------------- 1 | 2 | .mod_init_func 3 | .p2align 3 4 | .quad _OPENSSL_cpuid_setup 5 | 6 | .text 7 | 8 | .globl _OPENSSL_atomic_add 9 | 10 | .p2align 4 11 | _OPENSSL_atomic_add: 12 | movl (%rdi),%eax 13 | L$spin: leaq (%rsi,%rax,1),%r8 14 | .byte 0xf0 15 | cmpxchgl %r8d,(%rdi) 16 | jne L$spin 17 | movl %r8d,%eax 18 | .byte 0x48,0x98 19 | .byte 0xf3,0xc3 20 | 21 | 22 | .globl _OPENSSL_rdtsc 23 | 24 | .p2align 4 25 | _OPENSSL_rdtsc: 26 | rdtsc 27 | shlq $32,%rdx 28 | orq %rdx,%rax 29 | .byte 0xf3,0xc3 30 | 31 | 32 | .globl _OPENSSL_ia32_cpuid 33 | 34 | .p2align 4 35 | _OPENSSL_ia32_cpuid: 36 | movq %rbx,%r8 37 | 38 | xorl %eax,%eax 39 | cpuid 40 | movl %eax,%r11d 41 | 42 | xorl %eax,%eax 43 | cmpl $1970169159,%ebx 44 | setne %al 45 | movl %eax,%r9d 46 | cmpl $1231384169,%edx 47 | setne %al 48 | orl %eax,%r9d 49 | cmpl $1818588270,%ecx 50 | setne %al 51 | orl %eax,%r9d 52 | jz L$intel 53 | 54 | cmpl $1752462657,%ebx 55 | setne %al 56 | movl %eax,%r10d 57 | cmpl $1769238117,%edx 58 | setne %al 59 | orl %eax,%r10d 60 | cmpl $1145913699,%ecx 61 | setne %al 62 | orl %eax,%r10d 63 | jnz L$intel 64 | 65 | 66 | movl $2147483648,%eax 67 | cpuid 68 | cmpl $2147483656,%eax 69 | jb L$intel 70 | 71 | movl $2147483656,%eax 72 | cpuid 73 | movzbq %cl,%r10 74 | incq %r10 75 | 76 | movl $1,%eax 77 | cpuid 78 | btl $28,%edx 79 | jnc L$done 80 | shrl $16,%ebx 81 | cmpb %r10b,%bl 82 | ja L$done 83 | andl $4026531839,%edx 84 | jmp L$done 85 | 86 | L$intel: 87 | cmpl $4,%r11d 88 | movl $-1,%r10d 89 | jb L$nocacheinfo 90 | 91 | movl $4,%eax 92 | movl $0,%ecx 93 | cpuid 94 | movl %eax,%r10d 95 | shrl $14,%r10d 96 | andl $4095,%r10d 97 | 98 | L$nocacheinfo: 99 | movl $1,%eax 100 | cpuid 101 | cmpl $0,%r9d 102 | jne L$notintel 103 | orl $1048576,%edx 104 | andb $15,%ah 105 | cmpb $15,%ah 106 | je L$notintel 107 | orl $1073741824,%edx 108 | L$notintel: 109 | btl $28,%edx 110 | jnc L$done 111 | andl $4026531839,%edx 112 | cmpl $0,%r10d 113 | je L$done 114 | 115 | orl $268435456,%edx 116 | shrl $16,%ebx 117 | cmpb $1,%bl 118 | ja L$done 119 | andl $4026531839,%edx 120 | L$done: 121 | shlq $32,%rcx 122 | movl %edx,%eax 123 | movq %r8,%rbx 124 | orq %rcx,%rax 125 | .byte 0xf3,0xc3 126 | 127 | 128 | .globl _OPENSSL_cleanse 129 | 130 | .p2align 4 131 | _OPENSSL_cleanse: 132 | xorq %rax,%rax 133 | cmpq $15,%rsi 134 | jae L$ot 135 | cmpq $0,%rsi 136 | je L$ret 137 | L$ittle: 138 | movb %al,(%rdi) 139 | subq $1,%rsi 140 | leaq 1(%rdi),%rdi 141 | jnz L$ittle 142 | L$ret: 143 | .byte 0xf3,0xc3 144 | .p2align 4 145 | L$ot: 146 | testq $7,%rdi 147 | jz L$aligned 148 | movb %al,(%rdi) 149 | leaq -1(%rsi),%rsi 150 | leaq 1(%rdi),%rdi 151 | jmp L$ot 152 | L$aligned: 153 | movq %rax,(%rdi) 154 | leaq -8(%rsi),%rsi 155 | testq $-8,%rsi 156 | leaq 8(%rdi),%rdi 157 | jnz L$aligned 158 | cmpq $0,%rsi 159 | jne L$ittle 160 | .byte 0xf3,0xc3 161 | 162 | .globl _OPENSSL_wipe_cpu 163 | 164 | .p2align 4 165 | _OPENSSL_wipe_cpu: 166 | pxor %xmm0,%xmm0 167 | pxor %xmm1,%xmm1 168 | pxor %xmm2,%xmm2 169 | pxor %xmm3,%xmm3 170 | pxor %xmm4,%xmm4 171 | pxor %xmm5,%xmm5 172 | pxor %xmm6,%xmm6 173 | pxor %xmm7,%xmm7 174 | pxor %xmm8,%xmm8 175 | pxor %xmm9,%xmm9 176 | pxor %xmm10,%xmm10 177 | pxor %xmm11,%xmm11 178 | pxor %xmm12,%xmm12 179 | pxor %xmm13,%xmm13 180 | pxor %xmm14,%xmm14 181 | pxor %xmm15,%xmm15 182 | xorq %rcx,%rcx 183 | xorq %rdx,%rdx 184 | xorq %rsi,%rsi 185 | xorq %rdi,%rdi 186 | xorq %r8,%r8 187 | xorq %r9,%r9 188 | xorq %r10,%r10 189 | xorq %r11,%r11 190 | leaq 8(%rsp),%rax 191 | .byte 0xf3,0xc3 192 | 193 | -------------------------------------------------------------------------------- /src/X509PEMVerifier.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 The libmumble Developers 2 | // The use of this source code is goverened by a BSD-style 3 | // license that can be found in the LICENSE-file. 4 | 5 | #include "X509PEMVerifier.h" 6 | #include "X509HostnameVerifier.h" 7 | #include 8 | #include "X509Certificate_p.h" 9 | #include 10 | #include "OpenSSLUtils.h" 11 | 12 | #include 13 | #include 14 | #include 15 | 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include "uv.h" 21 | 22 | namespace mumble { 23 | 24 | X509PEMVerifier::X509PEMVerifier() { 25 | OpenSSLUtils::EnsureInitialized(); 26 | store_ = X509_STORE_new(); 27 | } 28 | 29 | // Adds a buffer containing one or more PEM-encoded 30 | // root certificates to the X509PEMVerifier. 31 | // 32 | // If the certificate (or one of the certificates) could not be 33 | // parsed AddPEM will return immediately, resulting in all of the 34 | // certificates up to the bad certicate being added to the verifier. 35 | bool X509PEMVerifier::AddPEM(const ByteArray &buf) { 36 | BIO *mem = BIO_new_mem_buf(static_cast(const_cast(buf.ConstData())), buf.Length()); 37 | (void) BIO_set_close(mem, BIO_NOCLOSE); 38 | 39 | int ncerts = 0; 40 | while (1) { 41 | X509 *x = PEM_read_bio_X509_AUX(mem, nullptr, nullptr, nullptr); 42 | if (x == nullptr) { 43 | return false; 44 | } 45 | X509_STORE_add_cert(store_, x); 46 | X509_free(x); 47 | ncerts++; 48 | } 49 | 50 | return true; 51 | } 52 | 53 | // VerifyChain verifies the certificate chain in chain 54 | // according to the verification options given as opts. 55 | bool X509PEMVerifier::VerifyChain(const std::vector &chain, const X509VerifierOptions &opts) { 56 | bool status = false; 57 | X509_STORE_CTX *ctx = X509_STORE_CTX_new(); 58 | STACK_OF(X509) *untrusted = sk_X509_new_null(); 59 | 60 | // Ensure that we have a chain to check on. 61 | if (chain.empty()) { 62 | goto out; 63 | } 64 | 65 | // If we've been passed a DNS name in opts, 66 | // we should check whether the leaf certificate 67 | // matches that before doing the more expensive 68 | // checks. 69 | if (!opts.dns_name.empty()) { 70 | if (!X509HostnameVerifier::VerifyHostname(chain.at(0), opts.dns_name)) { 71 | std::cerr << "X509PEMVerifier - hostname verification failed" << std::endl; 72 | goto out; 73 | } 74 | } 75 | 76 | // Extract our chain into the format that OpenSSL 77 | // expects for verification. 78 | for (const X509Certificate &cert : chain) { 79 | X509 *cur = cert.dptr_->AsOpenSSLX509(); 80 | sk_X509_push(untrusted, cur); 81 | } 82 | 83 | // Set up the X509_STORE_CTX to verify according to opts. 84 | X509_STORE_CTX_init(ctx, store_, sk_X509_value(untrusted, 0), untrusted); 85 | // If a time is not specified in opts, use the current system time. 86 | if (opts.time == 0) { 87 | X509_STORE_CTX_set_time(ctx, 0, std::time(nullptr)); 88 | } else { 89 | X509_STORE_CTX_set_time(ctx, 0, opts.time); 90 | } 91 | // If a dns_name is specified in opts, use the SSL server policy. 92 | if (!opts.dns_name.empty()) { 93 | X509_STORE_CTX_set_purpose(ctx, X509_PURPOSE_SSL_SERVER); 94 | X509_STORE_CTX_set_trust(ctx, X509_TRUST_SSL_SERVER); 95 | } 96 | 97 | if (X509_verify_cert(ctx) == 1) { 98 | status = true; 99 | } else { 100 | std::cerr << "X509PEMVerifier - verification error: " << X509_verify_cert_error_string(ctx->error) << std::endl; 101 | } 102 | 103 | out: 104 | sk_X509_pop_free(untrusted, X509_free); 105 | X509_STORE_CTX_free(ctx); 106 | return status; 107 | } 108 | 109 | } -------------------------------------------------------------------------------- /test.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) 2012-2013 The libmumble Developers 3 | # The use of this source code is goverened by a BSD-style 4 | # license that can be found in the LICENSE-file. 5 | 6 | # This script builds libmumble and runs its test suite. 7 | # It's primarily meant to be used during development, 8 | # such that a developer can run ./test.bash from a 9 | # terminal while hacking on a piece of code, or tests. 10 | # 11 | # The script will use Xcode to build on Mac OS X, and 12 | # on other Unix-like systems it will attempt to use 13 | # ninja or make (if ninja is not available on the 14 | # system). 15 | 16 | GYP=./3rdparty/gyp/gyp 17 | GYPFLAGS="-I common.gypi" 18 | 19 | function xcode_build { 20 | ./build/mac/generate.bash 21 | xcodebuild -project build/mac/xcode/libmumble.xcodeproj/ -target ${EXECUTABLE} -configuration Default CONFIGURATION_BUILD_DIR=build/mac/products || exit 1 22 | ./build/mac/products/${EXECUTABLE} 23 | } 24 | 25 | function msvs_build { 26 | cmd /k test.bat 27 | } 28 | 29 | function ninja_build { 30 | ${GYP} libmumble.gyp ${GYPFLAGS} -f ninja --depth . -Dlibrary=static_library -Dopenssl_asm= --generator-out=test 31 | ninja -C test/out/Default || exit 1 32 | ./test/out/Default/${EXECUTABLE} 33 | } 34 | 35 | function make_build { 36 | ${GYP} libmumble.gyp ${GYPFLAGS} -f make --depth . -Dlibrary=static_library -Dopenssl_asm= --generator-out=test 37 | make -C test/ || exit 1 38 | ./test/out/Default/${EXECUTABLE} 39 | } 40 | 41 | function android_build { 42 | ./build/android/generate.bash 43 | # Ensure the generated Android.mk has the same timestamp 44 | # as our libmumble.gyp file. This is a simplistic remedy 45 | # for ndk-build/make rebuilding the whole project when 46 | # the build files are regenerated. This will possibly 47 | # result in weird behavior if new gyp files are added 48 | # to a project without touching the libmumble.gyp file, 49 | # but who knows. 50 | touch -r libmumble.gyp ./build/android/jni/Android.mk 51 | 52 | cd ./build/android/jni 53 | ndk-build V=1 || exit 1 54 | adb shell mkdir -p /sdcard/libmumble 55 | adb shell su -c "umount /sdcard/libmumble" 56 | adb shell su -c "mount -t tmpfs -o size=25m none /sdcard/libmumble" 57 | adb push "../libs/armeabi/${EXECUTABLE}" "/sdcard/libmumble/${EXECUTABLE}" 58 | adb push ../../../testdata /sdcard/libmumble/testdata 59 | adb shell "cd /sdcard/libmumble && ./${EXECUTABLE}" 60 | } 61 | 62 | function iphoneos_build { 63 | ./build/iphoneos/generate.bash 64 | cd ./build/iphoneos/xcode 65 | xcodebuild -project libmumble.xcodeproj -target ${EXECUTABLE} -configuration Default CONFIGURATION_BUILD_DIR=test/build 66 | } 67 | 68 | trap exit SIGINT SIGTERM 69 | 70 | EXECUTABLE="${1}" 71 | if [ "${EXECUTABLE}" == "" ]; then 72 | EXECUTABLE="libmumble-test" 73 | fi 74 | 75 | if [ "${2}" == "android" ]; then 76 | android_build 77 | exit 78 | fi 79 | 80 | if [ "${2}" == "iphoneos" ]; then 81 | iphoneos_build 82 | exit 83 | fi 84 | 85 | system=$(uname -s) 86 | case "$system" in 87 | Darwin) 88 | xcode_build 89 | exit 90 | ;; 91 | MINGW*) 92 | msvs_build 93 | exit 94 | ;; 95 | CYGWIN*) 96 | msvs_build 97 | exit 98 | ;; 99 | *) 100 | type -P ninja 2>&1 >/dev/null 101 | has_ninja=$? 102 | if [ $has_ninja -eq 0 ]; then 103 | ninja_build 104 | exit 105 | fi 106 | type -P gmake 2>&1 >/dev/null 107 | has_gmake=$? 108 | if [ $has_gmake -eq 0 ]; then 109 | make_build gmake 110 | exit 111 | fi 112 | type -P make 2>&1 >/dev/null 113 | has_make=$? 114 | if [ $has_make -eq 0 ]; then 115 | make_build make 116 | exit 117 | fi 118 | ;; 119 | esac 120 | 121 | echo "No supported build system found. Aborting." 122 | -------------------------------------------------------------------------------- /src/X509Verifier_android.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 The libmumble Developers 2 | // The use of this source code is goverened by a BSD-style 3 | // license that can be found in the LICENSE-file. 4 | 5 | #include 6 | #include "X509Verifier_android.h" 7 | #include "X509PEMVerifier.h" 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | #include 16 | 17 | #include 18 | #include 19 | #include "uv.h" 20 | 21 | namespace mumble { 22 | 23 | static uv_once_t system_verifier_once_ = UV_ONCE_INIT; 24 | static X509Verifier *system_verifier_ptr_; 25 | 26 | void X509VerifierPrivate::InitializeSystemVerifier() { 27 | system_verifier_ptr_ = new X509Verifier; 28 | } 29 | 30 | X509Verifier &X509Verifier::SystemVerifier() { 31 | uv_once(&system_verifier_once_, X509VerifierPrivate::InitializeSystemVerifier); 32 | return *system_verifier_ptr_; 33 | } 34 | 35 | X509Verifier::X509Verifier() : dptr_(new X509VerifierPrivate) { 36 | } 37 | 38 | X509Verifier::~X509Verifier() { 39 | } 40 | 41 | bool X509Verifier::VerifyChain(std::vector chain, const X509VerifierOptions &opts) { 42 | return dptr_->pem_verifier_.VerifyChain(chain, opts); 43 | } 44 | 45 | X509VerifierPrivate::X509VerifierPrivate() { 46 | ReadSystemRoots(); 47 | } 48 | 49 | // read_caroot_dir returns set set of root certificate hash-names for the caroot at path. 50 | std::set read_caroot_dir(const std::string &path) { 51 | std::set roots; 52 | DIR *dir = opendir(path.c_str()); 53 | if (dir != nullptr) { 54 | struct dirent *dent = nullptr; 55 | while (dent = readdir(dir)) { 56 | if (dent->d_name[0] == '.') 57 | continue; 58 | std::string name(const_cast(&dent->d_name[0])); 59 | roots.insert(name); 60 | } 61 | closedir(dir); 62 | } 63 | return roots; 64 | } 65 | 66 | // read_caroot_pem reads a CA certificate named fn from dir. 67 | ByteArray read_caroot_pem(const std::string &dir, const std::string &fn) { 68 | mumble::ByteArray ba; 69 | std::ifstream ifs; 70 | ifs.open(dir + std::string("/") + fn, std::ios::binary); 71 | while (ifs.good()) { 72 | mumble::ByteArray chunk(256); 73 | char *buf = chunk.Data(); 74 | ifs.read(buf, chunk.Length()); 75 | chunk.Truncate(ifs.gcount()); 76 | if (chunk.Length() > 0) { 77 | ba.Append(chunk); 78 | } 79 | } 80 | ifs.close(); 81 | return ba; 82 | } 83 | 84 | // ReadSystemRoots reads system CA store on Android 4.0 and greater. 85 | // It's not public API, so it's prone to fail in the future, but 86 | // it's better than the alternative (JNI) at the moment. 87 | void X509VerifierPrivate::ReadSystemRoots() { 88 | const std::string cacerts_path(std::string("/system/etc/security/cacerts")); 89 | const std::string cacerts_removed_path(std::string("/data/misc/keychain/cacerts-removed")); 90 | const std::string cacerts_added_path(std::string("/data/misc/keychain/cacerts-added")); 91 | 92 | std::set cacerts = read_caroot_dir(cacerts_path); 93 | std::set cacerts_removed = read_caroot_dir(cacerts_removed_path); 94 | std::set cacerts_added = read_caroot_dir(cacerts_added_path); 95 | 96 | std::set cacerts_filtered; 97 | std::set_difference(cacerts.begin(), cacerts.end(), 98 | cacerts_removed.begin(), cacerts_removed.end(), 99 | std::inserter(cacerts_filtered, cacerts_filtered.end())); 100 | 101 | for (const std::string &fn : cacerts_filtered) { 102 | ByteArray pem_bytes = read_caroot_pem(cacerts_path, fn); 103 | pem_verifier_.AddPEM(pem_bytes); 104 | } 105 | 106 | for (const std::string &fn : cacerts_added) { 107 | ByteArray pem_bytes = read_caroot_pem(cacerts_added_path, fn); 108 | pem_verifier_.AddPEM(pem_bytes); 109 | } 110 | } 111 | 112 | } -------------------------------------------------------------------------------- /3rdparty/opensslbuild/asm/gnuas-arm-macosx/crypto/bn/asm/armv4-mont.S: -------------------------------------------------------------------------------- 1 | 2 | .global _bn_mul_mont 3 | 4 | .align 2 5 | _bn_mul_mont: 6 | stmdb sp!,{r0,r2} @ sp points at argument block 7 | ldr r0,[sp,#3*4] @ load num 8 | cmp r0,#2 9 | movlt r0,#0 10 | addlt sp,sp,#2*4 11 | blt .Labrt 12 | 13 | stmdb sp!,{r4-r12,lr} @ save 10 registers 14 | 15 | mov r0,r0,lsl#2 @ rescale r0 for byte count 16 | sub sp,sp,r0 @ alloca(4*num) 17 | sub sp,sp,#4 @ +extra dword 18 | sub r0,r0,#4 @ "num=num-1" 19 | add r4,r2,r0 @ &bp[num-1] 20 | 21 | add r0,sp,r0 @ r0 to point at &tp[num-1] 22 | ldr r8,[r0,#14*4] @ &n0 23 | ldr r2,[r2] @ bp[0] 24 | ldr r5,[r1],#4 @ ap[0],ap++ 25 | ldr r6,[r3],#4 @ np[0],np++ 26 | ldr r8,[r8] @ *n0 27 | str r4,[r0,#15*4] @ save &bp[num] 28 | 29 | umull r10,r11,r5,r2 @ ap[0]*bp[0] 30 | str r8,[r0,#14*4] @ save n0 value 31 | mul r8,r10,r8 @ "tp[0]"*n0 32 | mov r12,#0 33 | umlal r10,r12,r6,r8 @ np[0]*n0+"t[0]" 34 | mov r4,sp 35 | 36 | .L1st: 37 | ldr r5,[r1],#4 @ ap[j],ap++ 38 | mov r10,r11 39 | mov r11,#0 40 | umlal r10,r11,r5,r2 @ ap[j]*bp[0] 41 | ldr r6,[r3],#4 @ np[j],np++ 42 | mov r14,#0 43 | umlal r12,r14,r6,r8 @ np[j]*n0 44 | adds r12,r12,r10 45 | str r12,[r4],#4 @ tp[j-1]=,tp++ 46 | adc r12,r14,#0 47 | cmp r4,r0 48 | bne .L1st 49 | 50 | adds r12,r12,r11 51 | mov r14,#0 52 | adc r14,r14,#0 53 | ldr r4,[r0,#13*4] @ restore bp 54 | str r12,[r0] @ tp[num-1]= 55 | ldr r8,[r0,#14*4] @ restore n0 56 | str r14,[r0,#4] @ tp[num]= 57 | 58 | .Louter: 59 | sub r7,r0,sp @ "original" r0-1 value 60 | sub r1,r1,r7 @ "rewind" ap to &ap[1] 61 | sub r3,r3,r7 @ "rewind" np to &np[1] 62 | ldr r2,[r4,#4]! @ *(++bp) 63 | ldr r5,[r1,#-4] @ ap[0] 64 | ldr r6,[r3,#-4] @ np[0] 65 | ldr r10,[sp] @ tp[0] 66 | ldr r7,[sp,#4] @ tp[1] 67 | 68 | mov r11,#0 69 | umlal r10,r11,r5,r2 @ ap[0]*bp[i]+tp[0] 70 | str r4,[r0,#13*4] @ save bp 71 | mul r8,r10,r8 72 | mov r12,#0 73 | umlal r10,r12,r6,r8 @ np[0]*n0+"tp[0]" 74 | mov r4,sp 75 | 76 | .Linner: 77 | ldr r5,[r1],#4 @ ap[j],ap++ 78 | adds r10,r11,r7 @ +=tp[j] 79 | mov r11,#0 80 | umlal r10,r11,r5,r2 @ ap[j]*bp[i] 81 | ldr r6,[r3],#4 @ np[j],np++ 82 | mov r14,#0 83 | umlal r12,r14,r6,r8 @ np[j]*n0 84 | ldr r7,[r4,#8] @ tp[j+1] 85 | adc r11,r11,#0 86 | adds r12,r12,r10 87 | str r12,[r4],#4 @ tp[j-1]=,tp++ 88 | adc r12,r14,#0 89 | cmp r4,r0 90 | bne .Linner 91 | 92 | adds r12,r12,r11 93 | mov r14,#0 94 | adc r14,r14,#0 95 | adds r12,r12,r7 96 | adc r14,r14,#0 97 | ldr r4,[r0,#13*4] @ restore bp 98 | ldr r7,[r0,#15*4] @ restore &bp[num] 99 | str r12,[r0] @ tp[num-1]= 100 | ldr r8,[r0,#14*4] @ restore n0 101 | str r14,[r0,#4] @ tp[num]= 102 | 103 | cmp r4,r7 104 | bne .Louter 105 | 106 | ldr r2,[r0,#12*4] @ pull rp 107 | add r0,r0,#4 @ r0 to point at &tp[num] 108 | sub r5,r0,sp @ "original" num value 109 | mov r4,sp @ "rewind" r4 110 | mov r1,r4 @ "borrow" r1 111 | sub r3,r3,r5 @ "rewind" r3 to &np[0] 112 | 113 | subs r7,r7,r7 @ "clear" carry flag 114 | .Lsub: ldr r7,[r4],#4 115 | ldr r6,[r3],#4 116 | sbcs r7,r7,r6 @ tp[j]-np[j] 117 | str r7,[r2],#4 @ rp[j]= 118 | teq r4,r0 @ preserve carry 119 | bne .Lsub 120 | sbcs r14,r14,#0 @ upmost carry 121 | mov r4,sp @ "rewind" r4 122 | sub r2,r2,r5 @ "rewind" r2 123 | 124 | and r1,r4,r14 125 | bic r3,r2,r14 126 | orr r1,r1,r3 @ ap=borrow?tp:rp 127 | 128 | .Lcopy: ldr r7,[r1],#4 @ copy or in-place refresh 129 | str sp,[r4],#4 @ zap tp 130 | str r7,[r2],#4 131 | cmp r4,r0 132 | bne .Lcopy 133 | 134 | add sp,r0,#4 @ skip over tp[num+1] 135 | ldmia sp!,{r4-r12,lr} @ restore registers 136 | add sp,sp,#2*4 @ skip over {r0,r2} 137 | mov r0,#1 138 | .Labrt: tst lr,#1 139 | moveq pc,lr @ be binary compatible with V4, yet 140 | .word 0xe12fff1e @ interoperable with Thumb ISA:-) 141 | .asciz "Montgomery multiplication for ARMv4, CRYPTOGAMS by " 142 | .align 2 143 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/asm/gnuas-x86_64-elf/crypto/x86_64cpuid.S: -------------------------------------------------------------------------------- 1 | 2 | .section .init 3 | call OPENSSL_cpuid_setup 4 | 5 | .text 6 | 7 | .globl OPENSSL_atomic_add 8 | .type OPENSSL_atomic_add,@function 9 | .align 16 10 | OPENSSL_atomic_add: 11 | movl (%rdi),%eax 12 | .Lspin: leaq (%rsi,%rax,1),%r8 13 | .byte 0xf0 14 | cmpxchgl %r8d,(%rdi) 15 | jne .Lspin 16 | movl %r8d,%eax 17 | .byte 0x48,0x98 18 | .byte 0xf3,0xc3 19 | .size OPENSSL_atomic_add,.-OPENSSL_atomic_add 20 | 21 | .globl OPENSSL_rdtsc 22 | .type OPENSSL_rdtsc,@function 23 | .align 16 24 | OPENSSL_rdtsc: 25 | rdtsc 26 | shlq $32,%rdx 27 | orq %rdx,%rax 28 | .byte 0xf3,0xc3 29 | .size OPENSSL_rdtsc,.-OPENSSL_rdtsc 30 | 31 | .globl OPENSSL_ia32_cpuid 32 | .type OPENSSL_ia32_cpuid,@function 33 | .align 16 34 | OPENSSL_ia32_cpuid: 35 | movq %rbx,%r8 36 | 37 | xorl %eax,%eax 38 | cpuid 39 | movl %eax,%r11d 40 | 41 | xorl %eax,%eax 42 | cmpl $1970169159,%ebx 43 | setne %al 44 | movl %eax,%r9d 45 | cmpl $1231384169,%edx 46 | setne %al 47 | orl %eax,%r9d 48 | cmpl $1818588270,%ecx 49 | setne %al 50 | orl %eax,%r9d 51 | jz .Lintel 52 | 53 | cmpl $1752462657,%ebx 54 | setne %al 55 | movl %eax,%r10d 56 | cmpl $1769238117,%edx 57 | setne %al 58 | orl %eax,%r10d 59 | cmpl $1145913699,%ecx 60 | setne %al 61 | orl %eax,%r10d 62 | jnz .Lintel 63 | 64 | 65 | movl $2147483648,%eax 66 | cpuid 67 | cmpl $2147483656,%eax 68 | jb .Lintel 69 | 70 | movl $2147483656,%eax 71 | cpuid 72 | movzbq %cl,%r10 73 | incq %r10 74 | 75 | movl $1,%eax 76 | cpuid 77 | btl $28,%edx 78 | jnc .Ldone 79 | shrl $16,%ebx 80 | cmpb %r10b,%bl 81 | ja .Ldone 82 | andl $4026531839,%edx 83 | jmp .Ldone 84 | 85 | .Lintel: 86 | cmpl $4,%r11d 87 | movl $-1,%r10d 88 | jb .Lnocacheinfo 89 | 90 | movl $4,%eax 91 | movl $0,%ecx 92 | cpuid 93 | movl %eax,%r10d 94 | shrl $14,%r10d 95 | andl $4095,%r10d 96 | 97 | .Lnocacheinfo: 98 | movl $1,%eax 99 | cpuid 100 | cmpl $0,%r9d 101 | jne .Lnotintel 102 | orl $1048576,%edx 103 | andb $15,%ah 104 | cmpb $15,%ah 105 | je .Lnotintel 106 | orl $1073741824,%edx 107 | .Lnotintel: 108 | btl $28,%edx 109 | jnc .Ldone 110 | andl $4026531839,%edx 111 | cmpl $0,%r10d 112 | je .Ldone 113 | 114 | orl $268435456,%edx 115 | shrl $16,%ebx 116 | cmpb $1,%bl 117 | ja .Ldone 118 | andl $4026531839,%edx 119 | .Ldone: 120 | shlq $32,%rcx 121 | movl %edx,%eax 122 | movq %r8,%rbx 123 | orq %rcx,%rax 124 | .byte 0xf3,0xc3 125 | .size OPENSSL_ia32_cpuid,.-OPENSSL_ia32_cpuid 126 | 127 | .globl OPENSSL_cleanse 128 | .type OPENSSL_cleanse,@function 129 | .align 16 130 | OPENSSL_cleanse: 131 | xorq %rax,%rax 132 | cmpq $15,%rsi 133 | jae .Lot 134 | cmpq $0,%rsi 135 | je .Lret 136 | .Little: 137 | movb %al,(%rdi) 138 | subq $1,%rsi 139 | leaq 1(%rdi),%rdi 140 | jnz .Little 141 | .Lret: 142 | .byte 0xf3,0xc3 143 | .align 16 144 | .Lot: 145 | testq $7,%rdi 146 | jz .Laligned 147 | movb %al,(%rdi) 148 | leaq -1(%rsi),%rsi 149 | leaq 1(%rdi),%rdi 150 | jmp .Lot 151 | .Laligned: 152 | movq %rax,(%rdi) 153 | leaq -8(%rsi),%rsi 154 | testq $-8,%rsi 155 | leaq 8(%rdi),%rdi 156 | jnz .Laligned 157 | cmpq $0,%rsi 158 | jne .Little 159 | .byte 0xf3,0xc3 160 | .size OPENSSL_cleanse,.-OPENSSL_cleanse 161 | .globl OPENSSL_wipe_cpu 162 | .type OPENSSL_wipe_cpu,@function 163 | .align 16 164 | OPENSSL_wipe_cpu: 165 | pxor %xmm0,%xmm0 166 | pxor %xmm1,%xmm1 167 | pxor %xmm2,%xmm2 168 | pxor %xmm3,%xmm3 169 | pxor %xmm4,%xmm4 170 | pxor %xmm5,%xmm5 171 | pxor %xmm6,%xmm6 172 | pxor %xmm7,%xmm7 173 | pxor %xmm8,%xmm8 174 | pxor %xmm9,%xmm9 175 | pxor %xmm10,%xmm10 176 | pxor %xmm11,%xmm11 177 | pxor %xmm12,%xmm12 178 | pxor %xmm13,%xmm13 179 | pxor %xmm14,%xmm14 180 | pxor %xmm15,%xmm15 181 | xorq %rcx,%rcx 182 | xorq %rdx,%rdx 183 | xorq %rsi,%rsi 184 | xorq %rdi,%rdi 185 | xorq %r8,%r8 186 | xorq %r9,%r9 187 | xorq %r10,%r10 188 | xorq %r11,%r11 189 | leaq 8(%rsp),%rax 190 | .byte 0xf3,0xc3 191 | .size OPENSSL_wipe_cpu,.-OPENSSL_wipe_cpu 192 | -------------------------------------------------------------------------------- /src/ByteArray.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 The libmumble Developers 2 | // The use of this source code is goverened by a BSD-style 3 | // license that can be found in the LICENSE-file. 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include "assert.h" 10 | 11 | namespace mumble { 12 | 13 | ByteArray::ByteArray() { 14 | buf_ = nullptr; 15 | len_ = 0; 16 | cap_ = 0; 17 | } 18 | 19 | ByteArray::ByteArray(int len) { 20 | buf_ = static_cast(malloc(len)); 21 | len_ = len; 22 | cap_ = len; 23 | } 24 | 25 | ByteArray::ByteArray(char *buf, int len, int cap) { 26 | if (buf == nullptr) { 27 | buf_ = nullptr; 28 | len_ = 0; 29 | cap_ = 0; 30 | } else { 31 | if (cap == -1) { 32 | cap = len; 33 | } else if (cap < len) { 34 | buf_ = nullptr; 35 | len_ = 0; 36 | cap_ = 0; 37 | return; 38 | } 39 | buf_ = static_cast(malloc(cap)); 40 | memcpy(buf_, buf, cap); 41 | len_ = len; 42 | cap_ = cap; 43 | } 44 | } 45 | 46 | ByteArray::ByteArray(const ByteArray &ba) { 47 | if (ba.buf_ != nullptr) { 48 | buf_ = static_cast(malloc(ba.cap_)); 49 | memcpy(buf_, ba.buf_, ba.cap_); 50 | len_ = ba.len_; 51 | cap_ = ba.cap_; 52 | } else { 53 | buf_ = nullptr; 54 | len_ = 0; 55 | cap_ = 0; 56 | } 57 | } 58 | 59 | ByteArray& ByteArray::operator=(ByteArray ba) { 60 | std::swap(buf_, ba.buf_); 61 | std::swap(len_, ba.len_); 62 | std::swap(cap_, ba.cap_); 63 | return *this; 64 | } 65 | 66 | ByteArray::~ByteArray() { 67 | free(buf_); 68 | } 69 | 70 | bool ByteArray::IsNull() const { 71 | return buf_ == nullptr; 72 | } 73 | 74 | int ByteArray::Capacity() const { 75 | return cap_; 76 | } 77 | 78 | int ByteArray::Length() const { 79 | return len_; 80 | } 81 | 82 | const char *ByteArray::ConstData() const { 83 | return buf_; 84 | } 85 | 86 | char *ByteArray::Data() { 87 | return buf_; 88 | } 89 | 90 | ByteArray ByteArray::Slice(int off, int len) const { 91 | int remain = len_ - off; 92 | // If len is -1, it simply means we should 93 | // copy all the remaining bytes. 94 | if (len == -1) { 95 | len = remain; 96 | } 97 | 98 | assert(len <= remain); 99 | 100 | char *tmp = static_cast(malloc(len)); 101 | memcpy(tmp, buf_+off, remain); 102 | return ByteArray(tmp, remain); 103 | } 104 | 105 | // Append appends chunk to the ByteArray. 106 | ByteArray &ByteArray::Append(const ByteArray &chunk) { 107 | // First, ensure we have space for the chunk. 108 | int remain = cap_ - len_; 109 | if (remain < chunk.Length()) { 110 | int larger_cap = Length() + chunk.Length(); 111 | char *larger_buf = static_cast(realloc(buf_, larger_cap)); 112 | buf_ = larger_buf; 113 | cap_ = larger_cap; 114 | } 115 | // Do the append. 116 | char *dst = buf_ + len_; 117 | memcpy(dst, chunk.ConstData(), chunk.Length()); 118 | len_ += chunk.Length(); 119 | 120 | return *this; 121 | } 122 | 123 | // Truncate truncates the length of the ByteArray to len. 124 | // The new length must be <= the current capacity. 125 | ByteArray &ByteArray::Truncate(int len) { 126 | assert(len <= cap_); 127 | len_ = len; 128 | return *this; 129 | } 130 | 131 | // Check whether the other ByteArray is equal to this. 132 | bool ByteArray::Equal(const ByteArray &other) const { 133 | if (Length() != other.Length()) { 134 | return false; 135 | } 136 | if (Length() == 0 && other.Length() == 0) { 137 | // If both are empty, ensure that they are either 138 | // both null, or both non-null. 139 | return IsNull() == other.IsNull(); 140 | } 141 | if (memcmp(ConstData(), other.ConstData(), Length()) == 0) { 142 | return true; 143 | } 144 | return false; 145 | } 146 | 147 | // Operator == is an alias for Equal. 148 | bool ByteArray::operator==(const ByteArray &other) const { 149 | return Equal(other); 150 | } 151 | 152 | // Operator != is an alias for !Equal. 153 | bool ByteArray::operator!=(const ByteArray &other) const { 154 | return !Equal(other); 155 | } 156 | 157 | } 158 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/asm/gnuas-arm-elf/crypto/bn/asm/armv4-mont.S: -------------------------------------------------------------------------------- 1 | .text 2 | 3 | .global bn_mul_mont 4 | .type bn_mul_mont,%function 5 | 6 | .align 2 7 | bn_mul_mont: 8 | stmdb sp!,{r0,r2} @ sp points at argument block 9 | ldr r0,[sp,#3*4] @ load num 10 | cmp r0,#2 11 | movlt r0,#0 12 | addlt sp,sp,#2*4 13 | blt .Labrt 14 | 15 | stmdb sp!,{r4-r12,lr} @ save 10 registers 16 | 17 | mov r0,r0,lsl#2 @ rescale r0 for byte count 18 | sub sp,sp,r0 @ alloca(4*num) 19 | sub sp,sp,#4 @ +extra dword 20 | sub r0,r0,#4 @ "num=num-1" 21 | add r4,r2,r0 @ &bp[num-1] 22 | 23 | add r0,sp,r0 @ r0 to point at &tp[num-1] 24 | ldr r8,[r0,#14*4] @ &n0 25 | ldr r2,[r2] @ bp[0] 26 | ldr r5,[r1],#4 @ ap[0],ap++ 27 | ldr r6,[r3],#4 @ np[0],np++ 28 | ldr r8,[r8] @ *n0 29 | str r4,[r0,#15*4] @ save &bp[num] 30 | 31 | umull r10,r11,r5,r2 @ ap[0]*bp[0] 32 | str r8,[r0,#14*4] @ save n0 value 33 | mul r8,r10,r8 @ "tp[0]"*n0 34 | mov r12,#0 35 | umlal r10,r12,r6,r8 @ np[0]*n0+"t[0]" 36 | mov r4,sp 37 | 38 | .L1st: 39 | ldr r5,[r1],#4 @ ap[j],ap++ 40 | mov r10,r11 41 | mov r11,#0 42 | umlal r10,r11,r5,r2 @ ap[j]*bp[0] 43 | ldr r6,[r3],#4 @ np[j],np++ 44 | mov r14,#0 45 | umlal r12,r14,r6,r8 @ np[j]*n0 46 | adds r12,r12,r10 47 | str r12,[r4],#4 @ tp[j-1]=,tp++ 48 | adc r12,r14,#0 49 | cmp r4,r0 50 | bne .L1st 51 | 52 | adds r12,r12,r11 53 | mov r14,#0 54 | adc r14,r14,#0 55 | ldr r4,[r0,#13*4] @ restore bp 56 | str r12,[r0] @ tp[num-1]= 57 | ldr r8,[r0,#14*4] @ restore n0 58 | str r14,[r0,#4] @ tp[num]= 59 | 60 | .Louter: 61 | sub r7,r0,sp @ "original" r0-1 value 62 | sub r1,r1,r7 @ "rewind" ap to &ap[1] 63 | sub r3,r3,r7 @ "rewind" np to &np[1] 64 | ldr r2,[r4,#4]! @ *(++bp) 65 | ldr r5,[r1,#-4] @ ap[0] 66 | ldr r6,[r3,#-4] @ np[0] 67 | ldr r10,[sp] @ tp[0] 68 | ldr r7,[sp,#4] @ tp[1] 69 | 70 | mov r11,#0 71 | umlal r10,r11,r5,r2 @ ap[0]*bp[i]+tp[0] 72 | str r4,[r0,#13*4] @ save bp 73 | mul r8,r10,r8 74 | mov r12,#0 75 | umlal r10,r12,r6,r8 @ np[0]*n0+"tp[0]" 76 | mov r4,sp 77 | 78 | .Linner: 79 | ldr r5,[r1],#4 @ ap[j],ap++ 80 | adds r10,r11,r7 @ +=tp[j] 81 | mov r11,#0 82 | umlal r10,r11,r5,r2 @ ap[j]*bp[i] 83 | ldr r6,[r3],#4 @ np[j],np++ 84 | mov r14,#0 85 | umlal r12,r14,r6,r8 @ np[j]*n0 86 | ldr r7,[r4,#8] @ tp[j+1] 87 | adc r11,r11,#0 88 | adds r12,r12,r10 89 | str r12,[r4],#4 @ tp[j-1]=,tp++ 90 | adc r12,r14,#0 91 | cmp r4,r0 92 | bne .Linner 93 | 94 | adds r12,r12,r11 95 | mov r14,#0 96 | adc r14,r14,#0 97 | adds r12,r12,r7 98 | adc r14,r14,#0 99 | ldr r4,[r0,#13*4] @ restore bp 100 | ldr r7,[r0,#15*4] @ restore &bp[num] 101 | str r12,[r0] @ tp[num-1]= 102 | ldr r8,[r0,#14*4] @ restore n0 103 | str r14,[r0,#4] @ tp[num]= 104 | 105 | cmp r4,r7 106 | bne .Louter 107 | 108 | ldr r2,[r0,#12*4] @ pull rp 109 | add r0,r0,#4 @ r0 to point at &tp[num] 110 | sub r5,r0,sp @ "original" num value 111 | mov r4,sp @ "rewind" r4 112 | mov r1,r4 @ "borrow" r1 113 | sub r3,r3,r5 @ "rewind" r3 to &np[0] 114 | 115 | subs r7,r7,r7 @ "clear" carry flag 116 | .Lsub: ldr r7,[r4],#4 117 | ldr r6,[r3],#4 118 | sbcs r7,r7,r6 @ tp[j]-np[j] 119 | str r7,[r2],#4 @ rp[j]= 120 | teq r4,r0 @ preserve carry 121 | bne .Lsub 122 | sbcs r14,r14,#0 @ upmost carry 123 | mov r4,sp @ "rewind" r4 124 | sub r2,r2,r5 @ "rewind" r2 125 | 126 | and r1,r4,r14 127 | bic r3,r2,r14 128 | orr r1,r1,r3 @ ap=borrow?tp:rp 129 | 130 | .Lcopy: ldr r7,[r1],#4 @ copy or in-place refresh 131 | str sp,[r4],#4 @ zap tp 132 | str r7,[r2],#4 133 | cmp r4,r0 134 | bne .Lcopy 135 | 136 | add sp,r0,#4 @ skip over tp[num+1] 137 | ldmia sp!,{r4-r12,lr} @ restore registers 138 | add sp,sp,#2*4 @ skip over {r0,r2} 139 | mov r0,#1 140 | .Labrt: tst lr,#1 141 | moveq pc,lr @ be binary compatible with V4, yet 142 | .word 0xe12fff1e @ interoperable with Thumb ISA:-) 143 | .size bn_mul_mont,.-bn_mul_mont 144 | .asciz "Montgomery multiplication for ARMv4, CRYPTOGAMS by " 145 | .align 2 146 | -------------------------------------------------------------------------------- /src/UVBio.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 The libmumble Developers 2 | // The use of this source code is goverened by a BSD-style 3 | // license that can be found in the LICENSE-file. 4 | 5 | #include 6 | #include "UVBio.h" 7 | 8 | #include "uv.h" 9 | #include 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | namespace mumble { 16 | 17 | BIO_METHOD UVBioState::method_ = { 18 | 100 | BIO_TYPE_SOURCE_SINK, 19 | "UVBioState", 20 | UVBioState::Write, 21 | UVBioState::Read, 22 | UVBioState::Puts, 23 | UVBioState::Gets, 24 | UVBioState::Ctrl, 25 | UVBioState::Create, 26 | UVBioState::Destroy, 27 | }; 28 | 29 | BIO_METHOD *UVBioState::GetMethod() { 30 | return &UVBioState::method_; 31 | } 32 | 33 | UVBioState::UVBioState(uv_connect_t *connect) { 34 | connect_ = connect; 35 | } 36 | 37 | UVBioState::~UVBioState() { 38 | } 39 | 40 | void UVBioState::PutNewBuffer(ByteArray ba) { 41 | bufs_.push_back(ba); 42 | } 43 | 44 | void UVBioState::PutOldBuffer(ByteArray ba) { 45 | bufs_.push_front(ba); 46 | } 47 | 48 | bool UVBioState::HasBuffers() { 49 | return bufs_.size() > 0; 50 | } 51 | 52 | ByteArray UVBioState::GetBuffer() { 53 | assert(bufs_.size() > 0); 54 | ByteArray front = bufs_.front(); 55 | bufs_.pop_front(); 56 | return front; 57 | } 58 | 59 | int UVBioState::Create(BIO *b) { 60 | b->init = 1; 61 | b->num = 0; 62 | b->ptr = NULL; 63 | b->flags = 0; 64 | return 1; 65 | } 66 | 67 | int UVBioState::Destroy(BIO *b) { 68 | if (b == nullptr) { 69 | return 0; 70 | } 71 | b->ptr = NULL; 72 | b->init = 0; 73 | b->flags = 0; 74 | return 1; 75 | } 76 | 77 | int UVBioState::Read(BIO *b, char *buf, int len) { 78 | UVBioState *state = static_cast(b->ptr); 79 | uv_connect_t *connect = state->connect_; 80 | uv_stream_t *stream = connect->handle; 81 | 82 | if (!state->HasBuffers()) { 83 | BIO_set_retry_read(b); 84 | return -1; 85 | } 86 | 87 | // Get the front-most buffer 88 | ByteArray ba = state->GetBuffer(); 89 | // Buffer is bigger than what the Read function 90 | // has space for in its buffer. Slice our buffer 91 | // up, and give the Read function what it can take. 92 | if (ba.Length() > len) { 93 | // Slice away the remaining part of the 94 | // buffer and put it back into the queue. 95 | ByteArray remain = ba.Slice(len); 96 | state->PutOldBuffer(remain); 97 | // Copy data from our original ByteArray 98 | // into the Read functions buffer. 99 | memcpy(buf, ba.Data(), len); 100 | return len; 101 | // We have less space in our buffer than the Read 102 | // function requested. Give the Read function what 103 | // we have. 104 | } else { 105 | memcpy(buf, ba.Data(), ba.Length()); 106 | return ba.Length(); 107 | } 108 | 109 | /* NOTREACHED */ 110 | assert(1 == 0); 111 | return -1; 112 | } 113 | 114 | void UVBioState::WriteCallback(uv_write_t *req, int status) { 115 | assert(req != NULL); 116 | 117 | // todo(mkrautz): should we propagate write errors as errors to the TLSConnection? 118 | if (status != 0) { 119 | std::cerr << "UVBioState::WriteCallback status = " << status << std::endl; 120 | return; 121 | } 122 | } 123 | 124 | int UVBioState::Write(BIO *b, const char *buf, int len) { 125 | UVBioState *state = static_cast(b->ptr); 126 | uv_connect_t *connect = state->connect_; 127 | uv_stream_t *stream = connect->handle; 128 | 129 | uv_write_t *req = static_cast(calloc(sizeof(*req), 1)); 130 | uv_buf_t uvbuf; 131 | uvbuf.base = const_cast(buf); 132 | #ifdef LIBMUMBLE_OS_WINDOWS 133 | uvbuf.len = static_cast(len); 134 | #else 135 | uvbuf.len = static_cast(len); 136 | #endif 137 | 138 | int err = uv_write(req, stream, &uvbuf, 1, UVBioState::WriteCallback); 139 | if (err != UV_OK) { 140 | std::cerr << "uv_write failed!" << std::endl; 141 | return -1; 142 | } 143 | 144 | return len; 145 | } 146 | 147 | int UVBioState::Puts(BIO *b, const char *str) { 148 | return -1; 149 | } 150 | 151 | int UVBioState::Gets(BIO *B, char *buf, int len) { 152 | return -1; 153 | } 154 | 155 | long UVBioState::Ctrl(BIO *b, int cmd, long num, void *ptr) { 156 | if (cmd == BIO_CTRL_FLUSH) { 157 | return 1; 158 | } 159 | return 0; 160 | } 161 | 162 | } -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | What is libmumble? 2 | ================== 3 | 4 | libmumble is an attempt at writing a cross-platform C++ library for 5 | implementing Mumble clients. The initial client of libmumble is 6 | MumbleKit, the Objective-C Mumble framework for iOS and Mac OS X. 7 | 8 | Building libmumble on Unix-like systems 9 | ======================================= 10 | 11 | To build libmumble and run its test suite (the only application 12 | that's really worth running right now), you can use the test.bash 13 | script in the root of the source tree. 14 | 15 | Running the test.bash script is simple: 16 | 17 | $ ./test.bash 18 | 19 | This will generate build scripts suitable for your environment (Ninja, 20 | Make or an Xcode project on Macs). It'll perform a build and execute 21 | the libmumble-test binary, which runs the libmumble test suite. 22 | 23 | Building libmumble for Windows 24 | ============================== 25 | 26 | To build libmumble on Windows, you'll need Bash, Perl and Python. 27 | 28 | * For Python, we recommend a native Windows install of Python 2.7, 29 | and C:\Python27 in your %PATH%. 30 | * For Bash and Perl, we recommend that they're acquired through Cygwin. 31 | * We also recommend that your Cygwin bin folder is in your global %PATH%, 32 | since the generated project files will depend on there being 'bash' and 33 | 'perl' executables readily available. 34 | 35 | Besides the above, you'll also need a copy of YASM to build OpenSSL with 36 | assembly optimizations. Download the appropriate Windows executable from 37 | http://yasm.tortall.net/Download.html and copy it to 3rdparty/yasm/yasm.exe. 38 | 39 | When you're ready, simply execute: 40 | 41 | c:\users\foo\libmumble> test.bat 42 | 43 | From the root of the source tree. This will generate the necessary Visual Studio 44 | projet files, run msbuild on the generated solution, and finally run the libmumble 45 | test suite. 46 | 47 | Note that by default, test.bat will build an x64 binary on Windows with OpenSSL 48 | assembly enabled. If you wish to target something else, you can change the values 49 | of -Dopenssl_asm=gnuas-x86_64 -Dtarget_arch=x64. For example, to build for 32-bit 50 | x86 with ASM, you can use the following set of options: 51 | 52 | -Dopenssl_asm= -Dtarget_arch=ia32 53 | 54 | Don't have Visual Studio 2012? For now, gyp's MSVS target is set in test.bat, 55 | but please be aware that we've only tested the build using Visual Studio 2012. 56 | 57 | Building libmumble for Android 58 | ============================== 59 | 60 | It's possible to build libmumble for Android. Currently, 61 | the only thing that really runs is the libmumble-test executable. 62 | 63 | Can you use the library in an app? Probably. But I don't know 64 | how to hook it up. Feel free to contribute, if this is something 65 | you need urgently. 66 | 67 | To build and test, run: 68 | $ ./test.bash libmumble-test android 69 | from the root of the source tree. 70 | 71 | This will build and run (via adb) the libmumble-test executable 72 | on a conneted Android device. You should probably only have a 73 | single device connected at a time for this to work - the script 74 | isn't too considerate of other scenarios. 75 | 76 | Prerequisites 77 | ------------- 78 | 79 | Running the libmumble-test binary on Android requires a device with 80 | a /usr/bin/su binary installed, allowing the test.bash script to gain 81 | root privileges in order to mount a tmpfs file system on which the 82 | libmumble test data and test executable will live and execute from. 83 | 84 | The test.bash script also expects that you have the 85 | /platform-tools and paths in your PATH 86 | environment variable. 87 | 88 | NDK prerequisites 89 | ----------------- 90 | 91 | If you're using NDK r8e, you will need to patch your local NDK with 92 | the following CL to be able to build libprotobuf-lite: 93 | 94 | https://android-review.googlesource.com/#/c/54201/ 95 | 96 | Building libmumble for iOS 97 | ========================== 98 | 99 | It's also possible to build libmumble for iOS. You can generate an 100 | .xcodeproj hierarchy by running ./build/iphoneos/generate.bash, and 101 | the generated Xcode project files will be written to 102 | 103 | build/iphoneos/xcode 104 | 105 | To build the libmumble-test app (the only app that really runs at the moment), 106 | simply open libmumble.xcodeproj, select the 'libmumble-test' target, and your 107 | target device in the target/device picker, and click Run. 108 | 109 | Note: You may need to ensure you have a provisioning profile for 'info.mumble.libmumble-test' 110 | installed before trying this. If you can't create a provisioning profile with that name, 111 | feel free to change the bundle identifier in build/iphoneos/test-bundle/Info.plist. -------------------------------------------------------------------------------- /3rdparty/protobufbuild/config.h: -------------------------------------------------------------------------------- 1 | /* config.h. Generated from config.h.in by configure. */ 2 | /* config.h.in. Generated from configure.ac by autoheader. */ 3 | 4 | /* the name of */ 5 | #define HASH_MAP_CLASS hash_map 6 | 7 | /* the location of */ 8 | #if defined(USE_STLPORT) 9 | #define HASH_MAP_H 10 | #else 11 | #define HASH_MAP_H 12 | #endif 13 | 14 | /* the namespace of hash_map/hash_set */ 15 | #if defined(USE_STLPORT) 16 | #define HASH_NAMESPACE std 17 | #else 18 | #define HASH_NAMESPACE __gnu_cxx 19 | #endif 20 | 21 | /* the name of */ 22 | #define HASH_SET_CLASS hash_set 23 | 24 | /* the location of */ 25 | #if defined(USE_STLPORT) 26 | #define HASH_SET_H 27 | #else 28 | #define HASH_SET_H 29 | #endif 30 | 31 | /* Define to 1 if you have the header file. */ 32 | #define HAVE_DLFCN_H 1 33 | 34 | /* Define to 1 if you have the header file. */ 35 | #define HAVE_FCNTL_H 1 36 | 37 | /* Define to 1 if you have the `ftruncate' function. */ 38 | #define HAVE_FTRUNCATE 1 39 | 40 | /* define if the compiler has hash_map */ 41 | #define HAVE_HASH_MAP 1 42 | 43 | /* define if the compiler has hash_set */ 44 | #define HAVE_HASH_SET 1 45 | 46 | /* Define to 1 if you have the header file. */ 47 | #define HAVE_INTTYPES_H 1 48 | 49 | /* Define to 1 if you have the header file. */ 50 | #define HAVE_LIMITS_H 1 51 | 52 | /* Define to 1 if you have the header file. */ 53 | #define HAVE_MEMORY_H 1 54 | 55 | /* Define to 1 if you have the `memset' function. */ 56 | #define HAVE_MEMSET 1 57 | 58 | /* Define to 1 if you have the `mkdir' function. */ 59 | #define HAVE_MKDIR 1 60 | 61 | /* Define if you have POSIX threads libraries and header files. */ 62 | #define HAVE_PTHREAD 1 63 | 64 | /* Define to 1 if you have the header file. */ 65 | #define HAVE_STDINT_H 1 66 | 67 | /* Define to 1 if you have the header file. */ 68 | #define HAVE_STDLIB_H 1 69 | 70 | /* Define to 1 if you have the `strchr' function. */ 71 | #define HAVE_STRCHR 1 72 | 73 | /* Define to 1 if you have the `strerror' function. */ 74 | #define HAVE_STRERROR 1 75 | 76 | /* Define to 1 if you have the header file. */ 77 | #define HAVE_STRINGS_H 1 78 | 79 | /* Define to 1 if you have the header file. */ 80 | #define HAVE_STRING_H 1 81 | 82 | /* Define to 1 if you have the `strtol' function. */ 83 | #define HAVE_STRTOL 1 84 | 85 | /* Define to 1 if you have the header file. */ 86 | #define HAVE_SYS_STAT_H 1 87 | 88 | /* Define to 1 if you have the header file. */ 89 | #define HAVE_SYS_TYPES_H 1 90 | 91 | /* Define to 1 if you have the header file. */ 92 | #define HAVE_UNISTD_H 1 93 | 94 | /* Enable classes using zlib compression. */ 95 | #define HAVE_ZLIB 1 96 | 97 | /* Name of package */ 98 | #define PACKAGE "protobuf" 99 | 100 | /* Define to the address where bug reports for this package should be sent. */ 101 | #define PACKAGE_BUGREPORT "protobuf@googlegroups.com" 102 | 103 | /* Define to the full name of this package. */ 104 | #define PACKAGE_NAME "Protocol Buffers" 105 | 106 | /* Define to the full name and version of this package. */ 107 | #define PACKAGE_STRING "Protocol Buffers 2.3.0" 108 | 109 | /* Define to the one symbol short name of this package. */ 110 | #define PACKAGE_TARNAME "protobuf" 111 | 112 | /* Define to the version of this package. */ 113 | #define PACKAGE_VERSION "2.3.0" 114 | 115 | /* Define to necessary symbol if this constant uses a non-standard name on 116 | your system. */ 117 | /* #undef PTHREAD_CREATE_JOINABLE */ 118 | 119 | /* Define to 1 if you have the ANSI C header files. */ 120 | #define STDC_HEADERS 1 121 | 122 | /* Version number of package */ 123 | #define VERSION "2.3.0" 124 | 125 | /* Define to 1 if on AIX 3. 126 | System headers sometimes define this. 127 | We just want to avoid a redefinition error message. */ 128 | #ifndef _ALL_SOURCE 129 | /* # undef _ALL_SOURCE */ 130 | #endif 131 | 132 | /* Enable GNU extensions on systems that have them. */ 133 | #ifndef _GNU_SOURCE 134 | # define _GNU_SOURCE 1 135 | #endif 136 | 137 | /* Define to 1 if on MINIX. */ 138 | /* #undef _MINIX */ 139 | 140 | /* Define to 2 if the system does not provide POSIX.1 features except with 141 | this defined. */ 142 | /* #undef _POSIX_1_SOURCE */ 143 | 144 | /* Define to 1 if you need to in order for `stat' and other things to work. */ 145 | /* #undef _POSIX_SOURCE */ 146 | 147 | /* Enable extensions on Solaris. */ 148 | #ifndef __EXTENSIONS__ 149 | # define __EXTENSIONS__ 1 150 | #endif 151 | #ifndef _POSIX_PTHREAD_SEMANTICS 152 | # define _POSIX_PTHREAD_SEMANTICS 1 153 | #endif 154 | #ifndef _TANDEM_SOURCE 155 | # define _TANDEM_SOURCE 1 156 | #endif 157 | -------------------------------------------------------------------------------- /src/X509Verifier_mac.mm: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 The libmumble Developers 2 | // The use of this source code is goverened by a BSD-style 3 | // license that can be found in the LICENSE-file. 4 | 5 | #include 6 | #include "X509Verifier_mac.h" 7 | #include "X509HostnameVerifier.h" 8 | #include 9 | #include "X509Certificate_p.h" 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | #include "uv.h" 16 | 17 | #include 18 | #import 19 | 20 | namespace mumble { 21 | 22 | static uv_once_t system_verifier_once_ = UV_ONCE_INIT; 23 | static X509Verifier *system_verifier_ptr_; 24 | 25 | void X509VerifierPrivate::InitializeSystemVerifier() { 26 | system_verifier_ptr_ = new X509Verifier; 27 | } 28 | 29 | X509Verifier &X509Verifier::SystemVerifier() { 30 | uv_once(&system_verifier_once_, X509VerifierPrivate::InitializeSystemVerifier); 31 | return *system_verifier_ptr_; 32 | } 33 | 34 | X509Verifier::X509Verifier() : dptr_(new X509VerifierPrivate) { 35 | } 36 | 37 | X509Verifier::~X509Verifier() { 38 | } 39 | 40 | bool X509Verifier::VerifyChain(std::vector chain, const mumble::X509VerifierOptions &opts) { 41 | @autoreleasepool { 42 | return dptr_->VerifyChain(chain, opts); 43 | } 44 | } 45 | 46 | X509VerifierPrivate::X509VerifierPrivate() { 47 | } 48 | 49 | // VerifyChain verifies the certificate chain in chain 50 | // according to the verification options given as opts. 51 | bool X509VerifierPrivate::VerifyChain(std::vector chain, const X509VerifierOptions &opts) { 52 | NSMutableArray *sec_chain = [NSMutableArray arrayWithCapacity:chain.size()]; 53 | SecTrustResultType trust_result = kSecTrustResultInvalid; 54 | SecPolicyRef policy = nullptr; 55 | SecTrustRef trust = nullptr; 56 | OSStatus err = noErr; 57 | bool status = false; 58 | 59 | // Check for the no-op condition. There's no knowing 60 | // how the Apple APIs treat an empty certificate chain. 61 | if (chain.empty()) { 62 | return false; 63 | } 64 | 65 | // If we have a DNS name set, verify the chain for 66 | // TLS server usage. 67 | if (!opts.dns_name.empty()) { 68 | NSString *hostname = [[NSString alloc] initWithBytesNoCopy:const_cast(opts.dns_name.data()) 69 | length:opts.dns_name.length() 70 | encoding:NSUTF8StringEncoding 71 | freeWhenDone:NO]; 72 | if (hostname == nullptr) { 73 | return false; 74 | } 75 | policy = SecPolicyCreateSSL(true, reinterpret_cast(hostname)); 76 | [hostname release]; 77 | } else { 78 | policy = SecPolicyCreateBasicX509(); 79 | } 80 | // Abort early if policy creation fails. The functions are 81 | // not documented as being able to return nullptr, but if 82 | // they do, we'll probably crash in SecTrustEvaluate. 83 | if (policy == nullptr) { 84 | return false; 85 | } 86 | [reinterpret_cast(policy) autorelease]; 87 | 88 | // Convert our X509Certificate objects in SecCertificateRefs 89 | // that are usable by the SecTrustRef APIs. 90 | for (auto cert : chain) { 91 | const ByteArray &ba = cert.dptr_->cert_der_; 92 | NSData *cert_der = [NSData dataWithBytesNoCopy:const_cast(ba.ConstData()) 93 | length:static_cast(ba.Length()) 94 | freeWhenDone:NO]; 95 | if (cert_der == nullptr) { 96 | return false; 97 | } 98 | SecCertificateRef sec_cert = SecCertificateCreateWithData(kCFAllocatorDefault, reinterpret_cast(cert_der)); 99 | if (sec_cert == nullptr) { 100 | // Unable to read one of the certificates 101 | // in the chain. Abort. 102 | return false; 103 | } 104 | [sec_chain addObject:reinterpret_cast(sec_cert)]; 105 | CFRelease(sec_cert); 106 | } 107 | 108 | err = SecTrustCreateWithCertificates(reinterpret_cast(sec_chain), policy, &trust); 109 | if (err != noErr || trust == nullptr) { 110 | return false; 111 | } 112 | [reinterpret_cast(trust) autorelease]; 113 | 114 | // If a time was specified in opts, use that for the verification. 115 | // If not time is set in the SecTrustRef, it will automatically 116 | // use the current sytem time. 117 | if (opts.time > 0) { 118 | NSTimeInterval ti = static_cast(opts.time); 119 | err = SecTrustSetVerifyDate(trust, reinterpret_cast([NSDate dateWithTimeIntervalSince1970:ti])); 120 | if (err != noErr) { 121 | return false; 122 | } 123 | } 124 | 125 | err = SecTrustEvaluate(trust, &trust_result); 126 | if (err != noErr) { 127 | return false; 128 | } 129 | 130 | switch (trust_result) { 131 | case kSecTrustResultProceed: // User trusts it. 132 | case kSecTrustResultUnspecified: // System trusts it. 133 | return true; 134 | } 135 | 136 | return false; 137 | } 138 | 139 | } 140 | -------------------------------------------------------------------------------- /src/ByteArray_test.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 The libmumble Developers 2 | // The use of this source code is goverened by a BSD-style 3 | // license that can be found in the LICENSE-file. 4 | 5 | #include 6 | 7 | #include 8 | 9 | #include 10 | #include 11 | 12 | TEST(ByteArrayTest, TakeOwnershipNoCap) { 13 | char *buf = static_cast(malloc(50)); 14 | memset(buf, 'x', 10); 15 | mumble::ByteArray b(buf, 10); 16 | 17 | EXPECT_EQ(10, b.Length()); 18 | EXPECT_EQ(10, b.Capacity()); 19 | } 20 | 21 | TEST(ByteArrayTest, TakeOwnershipCap) { 22 | char *buf = static_cast(malloc(50)); 23 | memset(buf, 'x', 10); 24 | mumble::ByteArray b(buf, 10, 50); 25 | 26 | EXPECT_EQ(10, b.Length()); 27 | EXPECT_EQ(50, b.Capacity()); 28 | } 29 | 30 | TEST(ByteArrayTest, Null) { 31 | mumble::ByteArray b; 32 | EXPECT_TRUE(b.IsNull()); 33 | EXPECT_EQ(0, b.Capacity()); 34 | EXPECT_EQ(0, b.Length()); 35 | } 36 | 37 | TEST(ByteArrayTest, Assignment) { 38 | char *buf = static_cast(malloc(50)); 39 | memset(buf, 'x', 10); 40 | mumble::ByteArray b(buf, 10, 50); 41 | 42 | mumble::ByteArray tmp; 43 | tmp = b; 44 | } 45 | 46 | TEST(ByteArrayTest, Slicing) { 47 | char *buf = static_cast(malloc(50)); 48 | memset(buf, 'x', 10); 49 | mumble::ByteArray b(buf, 10, 50); 50 | 51 | mumble::ByteArray lastfive = b.Slice(5); 52 | EXPECT_EQ(5, lastfive.Length()); 53 | EXPECT_EQ(5, lastfive.Capacity()); 54 | 55 | bool ok = true; 56 | const char *tmp = lastfive.Data(); 57 | for (int i = 0; i < 5; i++) { 58 | if (tmp[i] != 'x') { 59 | ok = false; 60 | break; 61 | } 62 | } 63 | EXPECT_TRUE(ok); 64 | } 65 | 66 | TEST(ByteArrayTest, SlicingContent) { 67 | char *buf = static_cast(malloc(50)); 68 | memset(buf, 'x', 10); 69 | mumble::ByteArray b(buf, 10, 50); 70 | 71 | mumble::ByteArray lastfive = b.Slice(5); 72 | EXPECT_EQ(5, lastfive.Length()); 73 | EXPECT_EQ(5, lastfive.Capacity()); 74 | } 75 | 76 | TEST(ByteArrayTest, TestEmptyAppend) { 77 | mumble::ByteArray b; // empty 78 | 79 | mumble::ByteArray a(10); // 'aaaaaaaaaa' 80 | memset(a.Data(), 'a', 10); 81 | 82 | b.Append(a); 83 | 84 | EXPECT_EQ(a.Length(), b.Length()); 85 | EXPECT_TRUE(memcmp(b.Data(), a.Data(), a.Length()) == 0); 86 | } 87 | 88 | TEST(ByteArrayTest, TestTruncate) { 89 | mumble::ByteArray b(10); 90 | b.Truncate(0); 91 | 92 | EXPECT_EQ(0, b.Length()); 93 | EXPECT_EQ(10, b.Capacity()); 94 | } 95 | 96 | TEST(ByteArrayTest, TestTruncateGrow) { 97 | mumble::ByteArray b(10); 98 | b.Truncate(0); 99 | b.Truncate(10); 100 | 101 | EXPECT_EQ(10, b.Length()); 102 | EXPECT_EQ(10, b.Capacity()); 103 | } 104 | 105 | TEST(ByteArrayTest, TestNoAllocAppend) { 106 | mumble::ByteArray b(50); 107 | b.Truncate(0); // set length to 0, keep cap at 50 108 | char *buf = b.Data(); // note the buffer ptr 109 | 110 | mumble::ByteArray a(10); // 'aaaaaaaaaa' 111 | memset(a.Data(), 'a', 10); 112 | 113 | for (int i = 0; i < 5; i++) { 114 | b.Append(a); 115 | } 116 | 117 | // Check for pointer equality. 118 | // ByteArray b should not have realloc'd it's buffer. 119 | EXPECT_EQ(buf, b.Data()); 120 | } 121 | 122 | TEST(ByteArrayTest, TestEqual) { 123 | mumble::ByteArray a(10); 124 | mumble::ByteArray b(10); 125 | mumble::ByteArray c(10); 126 | 127 | memset(a.Data(), 'a', a.Length()); 128 | memset(b.Data(), 'a', b.Length()); 129 | memset(c.Data(), 'c', c.Length()); 130 | 131 | EXPECT_TRUE(a.Equal(b)); 132 | EXPECT_TRUE(b.Equal(a)); 133 | 134 | EXPECT_FALSE(a.Equal(c)); 135 | EXPECT_FALSE(c.Equal(a)); 136 | } 137 | 138 | TEST(ByteArrayTest, TestOperatorEqual) { 139 | mumble::ByteArray a(10); 140 | mumble::ByteArray b(10); 141 | 142 | memset(a.Data(), 'a', a.Length()); 143 | memset(b.Data(), 'a', b.Length()); 144 | 145 | EXPECT_EQ(a, b); 146 | EXPECT_EQ(b, a); 147 | EXPECT_TRUE(a == b); 148 | EXPECT_TRUE(b == a); 149 | } 150 | 151 | TEST(ByteArrayTest, TestNullEqual) { 152 | mumble::ByteArray null1; 153 | mumble::ByteArray null2; 154 | 155 | EXPECT_EQ(null1, null2); 156 | } 157 | 158 | TEST(ByteArrayTest, TestEmptyEqual) { 159 | mumble::ByteArray empty1(1); 160 | mumble::ByteArray empty2(1); 161 | 162 | empty1.Truncate(0); 163 | empty2.Truncate(0); 164 | 165 | EXPECT_EQ(empty1, empty2); 166 | } 167 | 168 | TEST(ByteArrayTest, TestEqualNullEmpty) { 169 | mumble::ByteArray null1; 170 | mumble::ByteArray empty1(10); 171 | 172 | empty1.Truncate(0); // make empty 173 | 174 | EXPECT_NE(null1, empty1); 175 | } 176 | 177 | TEST(ByteArrayTest, TestEqualCapIndifference) { 178 | mumble::ByteArray a(15); 179 | mumble::ByteArray b(10); 180 | 181 | a.Truncate(10); 182 | memset(a.Data(), 'a', a.Length()); 183 | memset(b.Data(), 'a', b.Length()); 184 | 185 | EXPECT_EQ(a, b); 186 | } 187 | 188 | TEST(ByteArrayTest, ConstructorCapLessThanLen) { 189 | char *buf = "hello, world!"; 190 | mumble::ByteArray hw(buf, strlen(buf), 4); 191 | ASSERT_TRUE(hw.IsNull()); 192 | } 193 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/asm/gnuas-x86-macosx/crypto/rc4/asm/rc4-586.S: -------------------------------------------------------------------------------- 1 | .file "rc4-586.s" 2 | .text 3 | .globl _RC4 4 | .align 4 5 | _RC4: 6 | L_RC4_begin: 7 | pushl %ebp 8 | pushl %ebx 9 | pushl %esi 10 | pushl %edi 11 | movl 20(%esp),%edi 12 | movl 24(%esp),%edx 13 | movl 28(%esp),%esi 14 | movl 32(%esp),%ebp 15 | xorl %eax,%eax 16 | xorl %ebx,%ebx 17 | cmpl $0,%edx 18 | je L000abort 19 | movb (%edi),%al 20 | movb 4(%edi),%bl 21 | addl $8,%edi 22 | leal (%esi,%edx,1),%ecx 23 | subl %esi,%ebp 24 | movl %ecx,24(%esp) 25 | incb %al 26 | cmpl $-1,256(%edi) 27 | je L001RC4_CHAR 28 | movl (%edi,%eax,4),%ecx 29 | andl $-4,%edx 30 | jz L002loop1 31 | leal -4(%esi,%edx,1),%edx 32 | movl %edx,28(%esp) 33 | movl %ebp,32(%esp) 34 | .align 4,0x90 35 | L003loop4: 36 | addb %cl,%bl 37 | movl (%edi,%ebx,4),%edx 38 | movl %ecx,(%edi,%ebx,4) 39 | movl %edx,(%edi,%eax,4) 40 | addl %ecx,%edx 41 | incb %al 42 | andl $255,%edx 43 | movl (%edi,%eax,4),%ecx 44 | movl (%edi,%edx,4),%ebp 45 | addb %cl,%bl 46 | movl (%edi,%ebx,4),%edx 47 | movl %ecx,(%edi,%ebx,4) 48 | movl %edx,(%edi,%eax,4) 49 | addl %ecx,%edx 50 | incb %al 51 | andl $255,%edx 52 | rorl $8,%ebp 53 | movl (%edi,%eax,4),%ecx 54 | orl (%edi,%edx,4),%ebp 55 | addb %cl,%bl 56 | movl (%edi,%ebx,4),%edx 57 | movl %ecx,(%edi,%ebx,4) 58 | movl %edx,(%edi,%eax,4) 59 | addl %ecx,%edx 60 | incb %al 61 | andl $255,%edx 62 | rorl $8,%ebp 63 | movl (%edi,%eax,4),%ecx 64 | orl (%edi,%edx,4),%ebp 65 | addb %cl,%bl 66 | movl (%edi,%ebx,4),%edx 67 | movl %ecx,(%edi,%ebx,4) 68 | movl %edx,(%edi,%eax,4) 69 | addl %ecx,%edx 70 | incb %al 71 | andl $255,%edx 72 | rorl $8,%ebp 73 | movl 32(%esp),%ecx 74 | orl (%edi,%edx,4),%ebp 75 | rorl $8,%ebp 76 | xorl (%esi),%ebp 77 | cmpl 28(%esp),%esi 78 | movl %ebp,(%ecx,%esi,1) 79 | leal 4(%esi),%esi 80 | movl (%edi,%eax,4),%ecx 81 | jb L003loop4 82 | cmpl 24(%esp),%esi 83 | je L004done 84 | movl 32(%esp),%ebp 85 | .align 4,0x90 86 | L002loop1: 87 | addb %cl,%bl 88 | movl (%edi,%ebx,4),%edx 89 | movl %ecx,(%edi,%ebx,4) 90 | movl %edx,(%edi,%eax,4) 91 | addl %ecx,%edx 92 | incb %al 93 | andl $255,%edx 94 | movl (%edi,%edx,4),%edx 95 | xorb (%esi),%dl 96 | leal 1(%esi),%esi 97 | movl (%edi,%eax,4),%ecx 98 | cmpl 24(%esp),%esi 99 | movb %dl,-1(%ebp,%esi,1) 100 | jb L002loop1 101 | jmp L004done 102 | .align 4,0x90 103 | L001RC4_CHAR: 104 | movzbl (%edi,%eax,1),%ecx 105 | L005cloop1: 106 | addb %cl,%bl 107 | movzbl (%edi,%ebx,1),%edx 108 | movb %cl,(%edi,%ebx,1) 109 | movb %dl,(%edi,%eax,1) 110 | addb %cl,%dl 111 | movzbl (%edi,%edx,1),%edx 112 | addb $1,%al 113 | xorb (%esi),%dl 114 | leal 1(%esi),%esi 115 | movzbl (%edi,%eax,1),%ecx 116 | cmpl 24(%esp),%esi 117 | movb %dl,-1(%ebp,%esi,1) 118 | jb L005cloop1 119 | L004done: 120 | decb %al 121 | movb %bl,-4(%edi) 122 | movb %al,-8(%edi) 123 | L000abort: 124 | popl %edi 125 | popl %esi 126 | popl %ebx 127 | popl %ebp 128 | ret 129 | .globl _RC4_set_key 130 | .align 4 131 | _RC4_set_key: 132 | L_RC4_set_key_begin: 133 | pushl %ebp 134 | pushl %ebx 135 | pushl %esi 136 | pushl %edi 137 | movl 20(%esp),%edi 138 | movl 24(%esp),%ebp 139 | movl 28(%esp),%esi 140 | leal _OPENSSL_ia32cap_P,%edx 141 | leal 8(%edi),%edi 142 | leal (%esi,%ebp,1),%esi 143 | negl %ebp 144 | xorl %eax,%eax 145 | movl %ebp,-4(%edi) 146 | btl $20,(%edx) 147 | jc L006c1stloop 148 | .align 4,0x90 149 | L007w1stloop: 150 | movl %eax,(%edi,%eax,4) 151 | addb $1,%al 152 | jnc L007w1stloop 153 | xorl %ecx,%ecx 154 | xorl %edx,%edx 155 | .align 4,0x90 156 | L008w2ndloop: 157 | movl (%edi,%ecx,4),%eax 158 | addb (%esi,%ebp,1),%dl 159 | addb %al,%dl 160 | addl $1,%ebp 161 | movl (%edi,%edx,4),%ebx 162 | jnz L009wnowrap 163 | movl -4(%edi),%ebp 164 | L009wnowrap: 165 | movl %eax,(%edi,%edx,4) 166 | movl %ebx,(%edi,%ecx,4) 167 | addb $1,%cl 168 | jnc L008w2ndloop 169 | jmp L010exit 170 | .align 4,0x90 171 | L006c1stloop: 172 | movb %al,(%edi,%eax,1) 173 | addb $1,%al 174 | jnc L006c1stloop 175 | xorl %ecx,%ecx 176 | xorl %edx,%edx 177 | xorl %ebx,%ebx 178 | .align 4,0x90 179 | L011c2ndloop: 180 | movb (%edi,%ecx,1),%al 181 | addb (%esi,%ebp,1),%dl 182 | addb %al,%dl 183 | addl $1,%ebp 184 | movb (%edi,%edx,1),%bl 185 | jnz L012cnowrap 186 | movl -4(%edi),%ebp 187 | L012cnowrap: 188 | movb %al,(%edi,%edx,1) 189 | movb %bl,(%edi,%ecx,1) 190 | addb $1,%cl 191 | jnc L011c2ndloop 192 | movl $-1,256(%edi) 193 | L010exit: 194 | xorl %eax,%eax 195 | movl %eax,-8(%edi) 196 | movl %eax,-4(%edi) 197 | popl %edi 198 | popl %esi 199 | popl %ebx 200 | popl %ebp 201 | ret 202 | .globl _RC4_options 203 | .align 4 204 | _RC4_options: 205 | L_RC4_options_begin: 206 | call L013pic_point 207 | L013pic_point: 208 | popl %eax 209 | leal L014opts-L013pic_point(%eax),%eax 210 | leal _OPENSSL_ia32cap_P,%edx 211 | btl $20,(%edx) 212 | jnc L015skip 213 | addl $12,%eax 214 | L015skip: 215 | ret 216 | .align 6,0x90 217 | L014opts: 218 | .byte 114,99,52,40,52,120,44,105,110,116,41,0 219 | .byte 114,99,52,40,49,120,44,99,104,97,114,41,0 220 | .byte 82,67,52,32,102,111,114,32,120,56,54,44,32,67,82,89 221 | .byte 80,84,79,71,65,77,83,32,98,121,32,60,97,112,112,114 222 | .byte 111,64,111,112,101,110,115,115,108,46,111,114,103,62,0 223 | .align 6,0x90 224 | .comm _OPENSSL_ia32cap_P,4 225 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/asm/gnuas-x86-elf/crypto/rc4/asm/rc4-586.S: -------------------------------------------------------------------------------- 1 | .file "rc4-586.s" 2 | .text 3 | .globl RC4 4 | .type RC4,@function 5 | .align 16 6 | RC4: 7 | .L_RC4_begin: 8 | pushl %ebp 9 | pushl %ebx 10 | pushl %esi 11 | pushl %edi 12 | movl 20(%esp),%edi 13 | movl 24(%esp),%edx 14 | movl 28(%esp),%esi 15 | movl 32(%esp),%ebp 16 | xorl %eax,%eax 17 | xorl %ebx,%ebx 18 | cmpl $0,%edx 19 | je .L000abort 20 | movb (%edi),%al 21 | movb 4(%edi),%bl 22 | addl $8,%edi 23 | leal (%esi,%edx,1),%ecx 24 | subl %esi,%ebp 25 | movl %ecx,24(%esp) 26 | incb %al 27 | cmpl $-1,256(%edi) 28 | je .L001RC4_CHAR 29 | movl (%edi,%eax,4),%ecx 30 | andl $-4,%edx 31 | jz .L002loop1 32 | leal -4(%esi,%edx,1),%edx 33 | movl %edx,28(%esp) 34 | movl %ebp,32(%esp) 35 | .align 16 36 | .L003loop4: 37 | addb %cl,%bl 38 | movl (%edi,%ebx,4),%edx 39 | movl %ecx,(%edi,%ebx,4) 40 | movl %edx,(%edi,%eax,4) 41 | addl %ecx,%edx 42 | incb %al 43 | andl $255,%edx 44 | movl (%edi,%eax,4),%ecx 45 | movl (%edi,%edx,4),%ebp 46 | addb %cl,%bl 47 | movl (%edi,%ebx,4),%edx 48 | movl %ecx,(%edi,%ebx,4) 49 | movl %edx,(%edi,%eax,4) 50 | addl %ecx,%edx 51 | incb %al 52 | andl $255,%edx 53 | rorl $8,%ebp 54 | movl (%edi,%eax,4),%ecx 55 | orl (%edi,%edx,4),%ebp 56 | addb %cl,%bl 57 | movl (%edi,%ebx,4),%edx 58 | movl %ecx,(%edi,%ebx,4) 59 | movl %edx,(%edi,%eax,4) 60 | addl %ecx,%edx 61 | incb %al 62 | andl $255,%edx 63 | rorl $8,%ebp 64 | movl (%edi,%eax,4),%ecx 65 | orl (%edi,%edx,4),%ebp 66 | addb %cl,%bl 67 | movl (%edi,%ebx,4),%edx 68 | movl %ecx,(%edi,%ebx,4) 69 | movl %edx,(%edi,%eax,4) 70 | addl %ecx,%edx 71 | incb %al 72 | andl $255,%edx 73 | rorl $8,%ebp 74 | movl 32(%esp),%ecx 75 | orl (%edi,%edx,4),%ebp 76 | rorl $8,%ebp 77 | xorl (%esi),%ebp 78 | cmpl 28(%esp),%esi 79 | movl %ebp,(%ecx,%esi,1) 80 | leal 4(%esi),%esi 81 | movl (%edi,%eax,4),%ecx 82 | jb .L003loop4 83 | cmpl 24(%esp),%esi 84 | je .L004done 85 | movl 32(%esp),%ebp 86 | .align 16 87 | .L002loop1: 88 | addb %cl,%bl 89 | movl (%edi,%ebx,4),%edx 90 | movl %ecx,(%edi,%ebx,4) 91 | movl %edx,(%edi,%eax,4) 92 | addl %ecx,%edx 93 | incb %al 94 | andl $255,%edx 95 | movl (%edi,%edx,4),%edx 96 | xorb (%esi),%dl 97 | leal 1(%esi),%esi 98 | movl (%edi,%eax,4),%ecx 99 | cmpl 24(%esp),%esi 100 | movb %dl,-1(%ebp,%esi,1) 101 | jb .L002loop1 102 | jmp .L004done 103 | .align 16 104 | .L001RC4_CHAR: 105 | movzbl (%edi,%eax,1),%ecx 106 | .L005cloop1: 107 | addb %cl,%bl 108 | movzbl (%edi,%ebx,1),%edx 109 | movb %cl,(%edi,%ebx,1) 110 | movb %dl,(%edi,%eax,1) 111 | addb %cl,%dl 112 | movzbl (%edi,%edx,1),%edx 113 | addb $1,%al 114 | xorb (%esi),%dl 115 | leal 1(%esi),%esi 116 | movzbl (%edi,%eax,1),%ecx 117 | cmpl 24(%esp),%esi 118 | movb %dl,-1(%ebp,%esi,1) 119 | jb .L005cloop1 120 | .L004done: 121 | decb %al 122 | movb %bl,-4(%edi) 123 | movb %al,-8(%edi) 124 | .L000abort: 125 | popl %edi 126 | popl %esi 127 | popl %ebx 128 | popl %ebp 129 | ret 130 | .size RC4,.-.L_RC4_begin 131 | .globl RC4_set_key 132 | .type RC4_set_key,@function 133 | .align 16 134 | RC4_set_key: 135 | .L_RC4_set_key_begin: 136 | pushl %ebp 137 | pushl %ebx 138 | pushl %esi 139 | pushl %edi 140 | movl 20(%esp),%edi 141 | movl 24(%esp),%ebp 142 | movl 28(%esp),%esi 143 | leal OPENSSL_ia32cap_P,%edx 144 | leal 8(%edi),%edi 145 | leal (%esi,%ebp,1),%esi 146 | negl %ebp 147 | xorl %eax,%eax 148 | movl %ebp,-4(%edi) 149 | btl $20,(%edx) 150 | jc .L006c1stloop 151 | .align 16 152 | .L007w1stloop: 153 | movl %eax,(%edi,%eax,4) 154 | addb $1,%al 155 | jnc .L007w1stloop 156 | xorl %ecx,%ecx 157 | xorl %edx,%edx 158 | .align 16 159 | .L008w2ndloop: 160 | movl (%edi,%ecx,4),%eax 161 | addb (%esi,%ebp,1),%dl 162 | addb %al,%dl 163 | addl $1,%ebp 164 | movl (%edi,%edx,4),%ebx 165 | jnz .L009wnowrap 166 | movl -4(%edi),%ebp 167 | .L009wnowrap: 168 | movl %eax,(%edi,%edx,4) 169 | movl %ebx,(%edi,%ecx,4) 170 | addb $1,%cl 171 | jnc .L008w2ndloop 172 | jmp .L010exit 173 | .align 16 174 | .L006c1stloop: 175 | movb %al,(%edi,%eax,1) 176 | addb $1,%al 177 | jnc .L006c1stloop 178 | xorl %ecx,%ecx 179 | xorl %edx,%edx 180 | xorl %ebx,%ebx 181 | .align 16 182 | .L011c2ndloop: 183 | movb (%edi,%ecx,1),%al 184 | addb (%esi,%ebp,1),%dl 185 | addb %al,%dl 186 | addl $1,%ebp 187 | movb (%edi,%edx,1),%bl 188 | jnz .L012cnowrap 189 | movl -4(%edi),%ebp 190 | .L012cnowrap: 191 | movb %al,(%edi,%edx,1) 192 | movb %bl,(%edi,%ecx,1) 193 | addb $1,%cl 194 | jnc .L011c2ndloop 195 | movl $-1,256(%edi) 196 | .L010exit: 197 | xorl %eax,%eax 198 | movl %eax,-8(%edi) 199 | movl %eax,-4(%edi) 200 | popl %edi 201 | popl %esi 202 | popl %ebx 203 | popl %ebp 204 | ret 205 | .size RC4_set_key,.-.L_RC4_set_key_begin 206 | .globl RC4_options 207 | .type RC4_options,@function 208 | .align 16 209 | RC4_options: 210 | .L_RC4_options_begin: 211 | call .L013pic_point 212 | .L013pic_point: 213 | popl %eax 214 | leal .L014opts-.L013pic_point(%eax),%eax 215 | leal OPENSSL_ia32cap_P,%edx 216 | btl $20,(%edx) 217 | jnc .L015skip 218 | addl $12,%eax 219 | .L015skip: 220 | ret 221 | .align 64 222 | .L014opts: 223 | .byte 114,99,52,40,52,120,44,105,110,116,41,0 224 | .byte 114,99,52,40,49,120,44,99,104,97,114,41,0 225 | .byte 82,67,52,32,102,111,114,32,120,56,54,44,32,67,82,89 226 | .byte 80,84,79,71,65,77,83,32,98,121,32,60,97,112,112,114 227 | .byte 111,64,111,112,101,110,115,115,108,46,111,114,103,62,0 228 | .align 64 229 | .size RC4_options,.-.L_RC4_options_begin 230 | .comm OPENSSL_ia32cap_P,4,4 231 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/asm/gnuas-x86-macosx/crypto/x86cpuid.S: -------------------------------------------------------------------------------- 1 | .file "x86cpuid.s" 2 | .text 3 | .globl _OPENSSL_ia32_cpuid 4 | .align 4 5 | _OPENSSL_ia32_cpuid: 6 | L_OPENSSL_ia32_cpuid_begin: 7 | pushl %ebp 8 | pushl %ebx 9 | pushl %esi 10 | pushl %edi 11 | xorl %edx,%edx 12 | pushfl 13 | popl %eax 14 | movl %eax,%ecx 15 | xorl $2097152,%eax 16 | pushl %eax 17 | popfl 18 | pushfl 19 | popl %eax 20 | xorl %eax,%ecx 21 | btl $21,%ecx 22 | jnc L000done 23 | xorl %eax,%eax 24 | .byte 0x0f,0xa2 25 | movl %eax,%edi 26 | xorl %eax,%eax 27 | cmpl $1970169159,%ebx 28 | setne %al 29 | movl %eax,%ebp 30 | cmpl $1231384169,%edx 31 | setne %al 32 | orl %eax,%ebp 33 | cmpl $1818588270,%ecx 34 | setne %al 35 | orl %eax,%ebp 36 | jz L001intel 37 | cmpl $1752462657,%ebx 38 | setne %al 39 | movl %eax,%esi 40 | cmpl $1769238117,%edx 41 | setne %al 42 | orl %eax,%esi 43 | cmpl $1145913699,%ecx 44 | setne %al 45 | orl %eax,%esi 46 | jnz L001intel 47 | movl $2147483648,%eax 48 | .byte 0x0f,0xa2 49 | cmpl $2147483656,%eax 50 | jb L001intel 51 | movl $2147483656,%eax 52 | .byte 0x0f,0xa2 53 | movzbl %cl,%esi 54 | incl %esi 55 | movl $1,%eax 56 | .byte 0x0f,0xa2 57 | btl $28,%edx 58 | jnc L000done 59 | shrl $16,%ebx 60 | andl $255,%ebx 61 | cmpl %esi,%ebx 62 | ja L000done 63 | andl $4026531839,%edx 64 | jmp L000done 65 | L001intel: 66 | cmpl $4,%edi 67 | movl $-1,%edi 68 | jb L002nocacheinfo 69 | movl $4,%eax 70 | movl $0,%ecx 71 | .byte 0x0f,0xa2 72 | movl %eax,%edi 73 | shrl $14,%edi 74 | andl $4095,%edi 75 | L002nocacheinfo: 76 | movl $1,%eax 77 | .byte 0x0f,0xa2 78 | cmpl $0,%ebp 79 | jne L003notP4 80 | andb $15,%ah 81 | cmpb $15,%ah 82 | jne L003notP4 83 | orl $1048576,%edx 84 | L003notP4: 85 | btl $28,%edx 86 | jnc L000done 87 | andl $4026531839,%edx 88 | cmpl $0,%edi 89 | je L000done 90 | orl $268435456,%edx 91 | shrl $16,%ebx 92 | cmpb $1,%bl 93 | ja L000done 94 | andl $4026531839,%edx 95 | L000done: 96 | movl %edx,%eax 97 | movl %ecx,%edx 98 | popl %edi 99 | popl %esi 100 | popl %ebx 101 | popl %ebp 102 | ret 103 | .globl _OPENSSL_rdtsc 104 | .align 4 105 | _OPENSSL_rdtsc: 106 | L_OPENSSL_rdtsc_begin: 107 | xorl %eax,%eax 108 | xorl %edx,%edx 109 | leal _OPENSSL_ia32cap_P,%ecx 110 | btl $4,(%ecx) 111 | jnc L004notsc 112 | .byte 0x0f,0x31 113 | L004notsc: 114 | ret 115 | .globl _OPENSSL_instrument_halt 116 | .align 4 117 | _OPENSSL_instrument_halt: 118 | L_OPENSSL_instrument_halt_begin: 119 | leal _OPENSSL_ia32cap_P,%ecx 120 | btl $4,(%ecx) 121 | jnc L005nohalt 122 | .long 2421723150 123 | andl $3,%eax 124 | jnz L005nohalt 125 | pushfl 126 | popl %eax 127 | btl $9,%eax 128 | jnc L005nohalt 129 | .byte 0x0f,0x31 130 | pushl %edx 131 | pushl %eax 132 | hlt 133 | .byte 0x0f,0x31 134 | subl (%esp),%eax 135 | sbbl 4(%esp),%edx 136 | addl $8,%esp 137 | ret 138 | L005nohalt: 139 | xorl %eax,%eax 140 | xorl %edx,%edx 141 | ret 142 | .globl _OPENSSL_far_spin 143 | .align 4 144 | _OPENSSL_far_spin: 145 | L_OPENSSL_far_spin_begin: 146 | pushfl 147 | popl %eax 148 | btl $9,%eax 149 | jnc L006nospin 150 | movl 4(%esp),%eax 151 | movl 8(%esp),%ecx 152 | .long 2430111262 153 | xorl %eax,%eax 154 | movl (%ecx),%edx 155 | jmp L007spin 156 | .align 4,0x90 157 | L007spin: 158 | incl %eax 159 | cmpl (%ecx),%edx 160 | je L007spin 161 | .long 529567888 162 | ret 163 | L006nospin: 164 | xorl %eax,%eax 165 | xorl %edx,%edx 166 | ret 167 | .globl _OPENSSL_wipe_cpu 168 | .align 4 169 | _OPENSSL_wipe_cpu: 170 | L_OPENSSL_wipe_cpu_begin: 171 | xorl %eax,%eax 172 | xorl %edx,%edx 173 | leal _OPENSSL_ia32cap_P,%ecx 174 | movl (%ecx),%ecx 175 | btl $1,(%ecx) 176 | jnc L008no_x87 177 | .long 4007259865,4007259865,4007259865,4007259865,2430851995 178 | L008no_x87: 179 | leal 4(%esp),%eax 180 | ret 181 | .globl _OPENSSL_atomic_add 182 | .align 4 183 | _OPENSSL_atomic_add: 184 | L_OPENSSL_atomic_add_begin: 185 | movl 4(%esp),%edx 186 | movl 8(%esp),%ecx 187 | pushl %ebx 188 | nop 189 | movl (%edx),%eax 190 | L009spin: 191 | leal (%eax,%ecx,1),%ebx 192 | nop 193 | .long 447811568 194 | jne L009spin 195 | movl %ebx,%eax 196 | popl %ebx 197 | ret 198 | .globl _OPENSSL_indirect_call 199 | .align 4 200 | _OPENSSL_indirect_call: 201 | L_OPENSSL_indirect_call_begin: 202 | pushl %ebp 203 | movl %esp,%ebp 204 | subl $28,%esp 205 | movl 12(%ebp),%ecx 206 | movl %ecx,(%esp) 207 | movl 16(%ebp),%edx 208 | movl %edx,4(%esp) 209 | movl 20(%ebp),%eax 210 | movl %eax,8(%esp) 211 | movl 24(%ebp),%eax 212 | movl %eax,12(%esp) 213 | movl 28(%ebp),%eax 214 | movl %eax,16(%esp) 215 | movl 32(%ebp),%eax 216 | movl %eax,20(%esp) 217 | movl 36(%ebp),%eax 218 | movl %eax,24(%esp) 219 | call *8(%ebp) 220 | movl %ebp,%esp 221 | popl %ebp 222 | ret 223 | .globl _OPENSSL_cleanse 224 | .align 4 225 | _OPENSSL_cleanse: 226 | L_OPENSSL_cleanse_begin: 227 | movl 4(%esp),%edx 228 | movl 8(%esp),%ecx 229 | xorl %eax,%eax 230 | cmpl $7,%ecx 231 | jae L010lot 232 | cmpl $0,%ecx 233 | je L011ret 234 | L012little: 235 | movb %al,(%edx) 236 | subl $1,%ecx 237 | leal 1(%edx),%edx 238 | jnz L012little 239 | L011ret: 240 | ret 241 | .align 4,0x90 242 | L010lot: 243 | testl $3,%edx 244 | jz L013aligned 245 | movb %al,(%edx) 246 | leal -1(%ecx),%ecx 247 | leal 1(%edx),%edx 248 | jmp L010lot 249 | L013aligned: 250 | movl %eax,(%edx) 251 | leal -4(%ecx),%ecx 252 | testl $-4,%ecx 253 | leal 4(%edx),%edx 254 | jnz L013aligned 255 | cmpl $0,%ecx 256 | jne L012little 257 | ret 258 | .comm _OPENSSL_ia32cap_P,4 259 | .mod_init_func 260 | .align 2 261 | .long _OPENSSL_cpuid_setup 262 | -------------------------------------------------------------------------------- /src/X509Verifier_test.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 The libmumble Developers 2 | // The use of this source code is goverened by a BSD-style 3 | // license that can be found in the LICENSE-file. 4 | 5 | #include 6 | #include "mumble_test.h" 7 | 8 | #include 9 | #include 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | TEST(X509Verifier, TestGoogleDKFullChain) { 16 | mumble::X509Verifier &verifier = mumble::X509Verifier::SystemVerifier(); 17 | 18 | mumble::X509VerifierOptions opts; 19 | opts.dns_name = std::string("www.google.dk"); 20 | opts.time = 1356880850; // Sun, 30 Dec 2012 15:20:50 GMT 21 | 22 | mumble::ByteArray pk12 = LoadFile(std::string("testdata/x509/google.dk/wildcard-google.dk-chain.p12")); 23 | ASSERT_FALSE(pk12.IsNull()); 24 | 25 | std::vector chain = mumble::X509Certificate::FromPKCS12(pk12, std::string()); 26 | ASSERT_EQ(3, chain.size()); 27 | 28 | EXPECT_TRUE(verifier.VerifyChain(chain, opts)); 29 | } 30 | 31 | TEST(X509Verifier, TestGoogleDKLeafAndIntermediates) { 32 | mumble::X509Verifier &verifier = mumble::X509Verifier::SystemVerifier(); 33 | 34 | mumble::X509VerifierOptions opts; 35 | opts.dns_name = std::string("www.google.dk"); 36 | opts.time = 1356880850; // Sun, 30 Dec 2012 15:20:50 GMT 37 | 38 | mumble::ByteArray pk12 = LoadFile(std::string("testdata/x509/google.dk/wildcard-google.dk-chain.p12")); 39 | ASSERT_FALSE(pk12.IsNull()); 40 | 41 | std::vector chain = mumble::X509Certificate::FromPKCS12(pk12, std::string()); 42 | ASSERT_EQ(3, chain.size()); 43 | 44 | // Chop away the root certificate. 45 | chain.resize(2); 46 | ASSERT_EQ(2, chain.size()); 47 | 48 | EXPECT_TRUE(verifier.VerifyChain(chain, opts)); 49 | } 50 | 51 | TEST(X509Verifier, TestGoogleDKLeafAndIntermediatesTimeValidity) { 52 | mumble::X509Verifier &verifier = mumble::X509Verifier::SystemVerifier(); 53 | 54 | mumble::ByteArray pk12 = LoadFile(std::string("testdata/x509/google.dk/wildcard-google.dk-chain.p12")); 55 | ASSERT_FALSE(pk12.IsNull()); 56 | 57 | std::vector chain = mumble::X509Certificate::FromPKCS12(pk12, std::string()); 58 | ASSERT_EQ(3, chain.size()); 59 | 60 | // Chop away the root certificate. 61 | chain.resize(2); 62 | ASSERT_EQ(2, chain.size()); 63 | 64 | mumble::X509VerifierOptions opts; 65 | opts.dns_name = std::string("www.google.dk"); 66 | 67 | // Trigger a Not Before trap 68 | opts.time = 1324771931; // Sun, 25 Dec 2011 00:12:11 GMT 69 | EXPECT_FALSE(verifier.VerifyChain(chain, opts)); 70 | 71 | // Trigger a Not After trap 72 | opts.time = 1451002331; // Fri, 25 Dec 2015 00:12:11 GMT 73 | EXPECT_FALSE(verifier.VerifyChain(chain, opts)); 74 | } 75 | 76 | TEST(X509Verifier, TestGoogleDKLeafAndIntermediatesBadHostname) { 77 | mumble::X509Verifier &verifier = mumble::X509Verifier::SystemVerifier(); 78 | 79 | mumble::X509VerifierOptions opts; 80 | opts.dns_name = std::string("www.facebook.com"); 81 | opts.time = 1356880850; // Sun, 30 Dec 2012 15:20:50 GMT 82 | 83 | mumble::ByteArray pk12 = LoadFile(std::string("testdata/x509/google.dk/wildcard-google.dk-chain.p12")); 84 | ASSERT_FALSE(pk12.IsNull()); 85 | 86 | std::vector chain = mumble::X509Certificate::FromPKCS12(pk12, std::string()); 87 | ASSERT_EQ(3, chain.size()); 88 | 89 | // Chop away the root certificate. 90 | chain.resize(2); 91 | ASSERT_EQ(2, chain.size()); 92 | 93 | // Should trigger the hostname veriifer, or possibly 94 | // the system verifier. 95 | EXPECT_FALSE(verifier.VerifyChain(chain, opts)); 96 | } 97 | 98 | TEST(X509Verifier, TestSelfSignedClientCert) { 99 | mumble::X509Verifier &verifier = mumble::X509Verifier::SystemVerifier(); 100 | 101 | mumble::X509VerifierOptions opts; 102 | opts.dns_name = std::string("mumble.example.com"); 103 | opts.time = 1356880850; // Sun, 30 Dec 2012 15:20:50 GMT 104 | 105 | mumble::ByteArray cert_der = LoadFile(std::string("testdata/x509/selfsign/self.crt")); 106 | ASSERT_FALSE(cert_der.IsNull()); 107 | 108 | mumble::X509Certificate cert = mumble::X509Certificate::FromRawDERData(cert_der); 109 | std::vector chain; 110 | chain.push_back(cert); 111 | ASSERT_EQ(1, chain.size()); 112 | 113 | // This should generate a hostname failure, since we're trying with a client cert. 114 | EXPECT_FALSE(verifier.VerifyChain(chain, opts)); 115 | } 116 | 117 | TEST(X509Verifier, TestSelfSignedServerCert) { 118 | mumble::X509Verifier &verifier = mumble::X509Verifier::SystemVerifier(); 119 | 120 | mumble::X509VerifierOptions opts; 121 | opts.dns_name = std::string("mumble.example.com"); 122 | opts.time = 1356882805; // Sun, 30 Dec 2012 15:53:25 GMT 123 | 124 | mumble::ByteArray cert_der = LoadFile(std::string("testdata/x509/selfsign-server/selfsign-server.crt")); 125 | ASSERT_FALSE(cert_der.IsNull()); 126 | 127 | mumble::X509Certificate cert = mumble::X509Certificate::FromRawDERData(cert_der); 128 | std::vector chain; 129 | chain.push_back(cert); 130 | ASSERT_EQ(1, chain.size()); 131 | 132 | // The hostname verifier (or system verifier) should 133 | // let this one pass, triggering an actual X509 verification. 134 | EXPECT_FALSE(verifier.VerifyChain(chain, opts)); 135 | } 136 | 137 | TEST(X509Verifier, TestEmptyChain) { 138 | mumble::X509Verifier &verifier = mumble::X509Verifier::SystemVerifier(); 139 | mumble::X509VerifierOptions opts; 140 | EXPECT_FALSE(verifier.VerifyChain(std::vector(), opts)); 141 | } 142 | -------------------------------------------------------------------------------- /3rdparty/opensslbuild/asm/gnuas-x86_64-mingw64/crypto/bn/asm/x86_64-mont.S: -------------------------------------------------------------------------------- 1 | .text 2 | 3 | .globl bn_mul_mont 4 | .def bn_mul_mont; .scl 2; .type 32; .endef 5 | .p2align 4 6 | bn_mul_mont: 7 | movq %rdi,8(%rsp) 8 | movq %rsi,16(%rsp) 9 | movq %rsp,%rax 10 | .LSEH_begin_bn_mul_mont: 11 | movq %rcx,%rdi 12 | movq %rdx,%rsi 13 | movq %r8,%rdx 14 | movq %r9,%rcx 15 | movq 40(%rsp),%r8 16 | movq 48(%rsp),%r9 17 | 18 | pushq %rbx 19 | pushq %rbp 20 | pushq %r12 21 | pushq %r13 22 | pushq %r14 23 | pushq %r15 24 | 25 | movl %r9d,%r9d 26 | leaq 2(%r9),%r10 27 | movq %rsp,%r11 28 | negq %r10 29 | leaq (%rsp,%r10,8),%rsp 30 | andq $-1024,%rsp 31 | 32 | movq %r11,8(%rsp,%r9,8) 33 | .Lprologue: 34 | movq %rdx,%r12 35 | 36 | movq (%r8),%r8 37 | 38 | xorq %r14,%r14 39 | xorq %r15,%r15 40 | 41 | movq (%r12),%rbx 42 | movq (%rsi),%rax 43 | mulq %rbx 44 | movq %rax,%r10 45 | movq %rdx,%r11 46 | 47 | imulq %r8,%rax 48 | movq %rax,%rbp 49 | 50 | mulq (%rcx) 51 | addq %r10,%rax 52 | adcq $0,%rdx 53 | movq %rdx,%r13 54 | 55 | leaq 1(%r15),%r15 56 | .L1st: 57 | movq (%rsi,%r15,8),%rax 58 | mulq %rbx 59 | addq %r11,%rax 60 | adcq $0,%rdx 61 | movq %rax,%r10 62 | movq (%rcx,%r15,8),%rax 63 | movq %rdx,%r11 64 | 65 | mulq %rbp 66 | addq %r13,%rax 67 | leaq 1(%r15),%r15 68 | adcq $0,%rdx 69 | addq %r10,%rax 70 | adcq $0,%rdx 71 | movq %rax,-16(%rsp,%r15,8) 72 | cmpq %r9,%r15 73 | movq %rdx,%r13 74 | jl .L1st 75 | 76 | xorq %rdx,%rdx 77 | addq %r11,%r13 78 | adcq $0,%rdx 79 | movq %r13,-8(%rsp,%r9,8) 80 | movq %rdx,(%rsp,%r9,8) 81 | 82 | leaq 1(%r14),%r14 83 | .p2align 2 84 | .Louter: 85 | xorq %r15,%r15 86 | 87 | movq (%r12,%r14,8),%rbx 88 | movq (%rsi),%rax 89 | mulq %rbx 90 | addq (%rsp),%rax 91 | adcq $0,%rdx 92 | movq %rax,%r10 93 | movq %rdx,%r11 94 | 95 | imulq %r8,%rax 96 | movq %rax,%rbp 97 | 98 | mulq (%rcx,%r15,8) 99 | addq %r10,%rax 100 | movq 8(%rsp),%r10 101 | adcq $0,%rdx 102 | movq %rdx,%r13 103 | 104 | leaq 1(%r15),%r15 105 | .p2align 2 106 | .Linner: 107 | movq (%rsi,%r15,8),%rax 108 | mulq %rbx 109 | addq %r11,%rax 110 | adcq $0,%rdx 111 | addq %rax,%r10 112 | movq (%rcx,%r15,8),%rax 113 | adcq $0,%rdx 114 | movq %rdx,%r11 115 | 116 | mulq %rbp 117 | addq %r13,%rax 118 | leaq 1(%r15),%r15 119 | adcq $0,%rdx 120 | addq %r10,%rax 121 | adcq $0,%rdx 122 | movq (%rsp,%r15,8),%r10 123 | cmpq %r9,%r15 124 | movq %rax,-16(%rsp,%r15,8) 125 | movq %rdx,%r13 126 | jl .Linner 127 | 128 | xorq %rdx,%rdx 129 | addq %r11,%r13 130 | adcq $0,%rdx 131 | addq %r10,%r13 132 | adcq $0,%rdx 133 | movq %r13,-8(%rsp,%r9,8) 134 | movq %rdx,(%rsp,%r9,8) 135 | 136 | leaq 1(%r14),%r14 137 | cmpq %r9,%r14 138 | jl .Louter 139 | 140 | leaq (%rsp),%rsi 141 | leaq -1(%r9),%r15 142 | 143 | movq (%rsi),%rax 144 | xorq %r14,%r14 145 | jmp .Lsub 146 | .p2align 4 147 | .Lsub: sbbq (%rcx,%r14,8),%rax 148 | movq %rax,(%rdi,%r14,8) 149 | decq %r15 150 | movq 8(%rsi,%r14,8),%rax 151 | leaq 1(%r14),%r14 152 | jge .Lsub 153 | 154 | sbbq $0,%rax 155 | andq %rax,%rsi 156 | notq %rax 157 | movq %rdi,%rcx 158 | andq %rax,%rcx 159 | leaq -1(%r9),%r15 160 | orq %rcx,%rsi 161 | .p2align 4 162 | .Lcopy: 163 | movq (%rsi,%r15,8),%rax 164 | movq %rax,(%rdi,%r15,8) 165 | movq %r14,(%rsp,%r15,8) 166 | decq %r15 167 | jge .Lcopy 168 | 169 | movq 8(%rsp,%r9,8),%rsi 170 | movq $1,%rax 171 | movq (%rsi),%r15 172 | movq 8(%rsi),%r14 173 | movq 16(%rsi),%r13 174 | movq 24(%rsi),%r12 175 | movq 32(%rsi),%rbp 176 | movq 40(%rsi),%rbx 177 | leaq 48(%rsi),%rsp 178 | .Lepilogue: 179 | movq 8(%rsp),%rdi 180 | movq 16(%rsp),%rsi 181 | .byte 0xf3,0xc3 182 | .LSEH_end_bn_mul_mont: 183 | .byte 77,111,110,116,103,111,109,101,114,121,32,77,117,108,116,105,112,108,105,99,97,116,105,111,110,32,102,111,114,32,120,56,54,95,54,52,44,32,67,82,89,80,84,79,71,65,77,83,32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111,114,103,62,0 184 | .p2align 4 185 | 186 | .def se_handler; .scl 3; .type 32; .endef 187 | .p2align 4 188 | se_handler: 189 | pushq %rsi 190 | pushq %rdi 191 | pushq %rbx 192 | pushq %rbp 193 | pushq %r12 194 | pushq %r13 195 | pushq %r14 196 | pushq %r15 197 | pushfq 198 | subq $64,%rsp 199 | 200 | movq 120(%r8),%rax 201 | movq 248(%r8),%rbx 202 | 203 | leaq .Lprologue(%rip),%r10 204 | cmpq %r10,%rbx 205 | jb .Lin_prologue 206 | 207 | movq 152(%r8),%rax 208 | 209 | leaq .Lepilogue(%rip),%r10 210 | cmpq %r10,%rbx 211 | jae .Lin_prologue 212 | 213 | movq 192(%r8),%r10 214 | movq 8(%rax,%r10,8),%rax 215 | leaq 48(%rax),%rax 216 | 217 | movq -8(%rax),%rbx 218 | movq -16(%rax),%rbp 219 | movq -24(%rax),%r12 220 | movq -32(%rax),%r13 221 | movq -40(%rax),%r14 222 | movq -48(%rax),%r15 223 | movq %rbx,144(%r8) 224 | movq %rbp,160(%r8) 225 | movq %r12,216(%r8) 226 | movq %r13,224(%r8) 227 | movq %r14,232(%r8) 228 | movq %r15,240(%r8) 229 | 230 | .Lin_prologue: 231 | movq 8(%rax),%rdi 232 | movq 16(%rax),%rsi 233 | movq %rax,152(%r8) 234 | movq %rsi,168(%r8) 235 | movq %rdi,176(%r8) 236 | 237 | movq 40(%r9),%rdi 238 | movq %r8,%rsi 239 | movl $154,%ecx 240 | .long 0xa548f3fc 241 | 242 | movq %r9,%rsi 243 | xorq %rcx,%rcx 244 | movq 8(%rsi),%rdx 245 | movq 0(%rsi),%r8 246 | movq 16(%rsi),%r9 247 | movq 40(%rsi),%r10 248 | leaq 56(%rsi),%r11 249 | leaq 24(%rsi),%r12 250 | movq %r10,32(%rsp) 251 | movq %r11,40(%rsp) 252 | movq %r12,48(%rsp) 253 | movq %rcx,56(%rsp) 254 | call *__imp_RtlVirtualUnwind(%rip) 255 | 256 | movl $1,%eax 257 | addq $64,%rsp 258 | popfq 259 | popq %r15 260 | popq %r14 261 | popq %r13 262 | popq %r12 263 | popq %rbp 264 | popq %rbx 265 | popq %rdi 266 | popq %rsi 267 | .byte 0xf3,0xc3 268 | 269 | 270 | .section .pdata 271 | .p2align 2 272 | .rva .LSEH_begin_bn_mul_mont 273 | .rva .LSEH_end_bn_mul_mont 274 | .rva .LSEH_info_bn_mul_mont 275 | 276 | .section .xdata 277 | .p2align 3 278 | .LSEH_info_bn_mul_mont: 279 | .byte 9,0,0,0 280 | .rva se_handler 281 | --------------------------------------------------------------------------------