├── .classpath ├── .gitignore ├── .gitmodules ├── .project ├── AndroidManifest.xml ├── COPYING ├── INSTALL ├── Makefile ├── README ├── build.xml ├── jni ├── Android.mk ├── Application.mk ├── android-libs │ ├── README │ ├── arm │ │ ├── libcrypto.so │ │ ├── libsqlite.so │ │ └── libssl.so │ ├── dump-libs.sh │ ├── headers │ │ ├── openssl │ │ │ ├── aes.h │ │ │ ├── asn1.h │ │ │ ├── asn1_mac.h │ │ │ ├── asn1t.h │ │ │ ├── bio.h │ │ │ ├── blowfish.h │ │ │ ├── bn.h │ │ │ ├── buffer.h │ │ │ ├── cmac.h │ │ │ ├── comp.h │ │ │ ├── conf.h │ │ │ ├── conf_api.h │ │ │ ├── crypto.h │ │ │ ├── des.h │ │ │ ├── des_old.h │ │ │ ├── dh.h │ │ │ ├── dsa.h │ │ │ ├── dso.h │ │ │ ├── dtls1.h │ │ │ ├── e_os2.h │ │ │ ├── ebcdic.h │ │ │ ├── ec.h │ │ │ ├── ecdh.h │ │ │ ├── ecdsa.h │ │ │ ├── engine.h │ │ │ ├── err.h │ │ │ ├── evp.h │ │ │ ├── hmac.h │ │ │ ├── krb5_asn.h │ │ │ ├── kssl.h │ │ │ ├── lhash.h │ │ │ ├── md4.h │ │ │ ├── md5.h │ │ │ ├── modes.h │ │ │ ├── obj_mac.h │ │ │ ├── objects.h │ │ │ ├── ocsp.h │ │ │ ├── opensslconf.h │ │ │ ├── opensslv.h │ │ │ ├── ossl_typ.h │ │ │ ├── pem.h │ │ │ ├── pem2.h │ │ │ ├── pkcs12.h │ │ │ ├── pkcs7.h │ │ │ ├── pqueue.h │ │ │ ├── rand.h │ │ │ ├── rc2.h │ │ │ ├── rc4.h │ │ │ ├── ripemd.h │ │ │ ├── rsa.h │ │ │ ├── safestack.h │ │ │ ├── sha.h │ │ │ ├── srp.h │ │ │ ├── srtp.h │ │ │ ├── ssl.h │ │ │ ├── ssl2.h │ │ │ ├── ssl23.h │ │ │ ├── ssl3.h │ │ │ ├── stack.h │ │ │ ├── symhacks.h │ │ │ ├── tls1.h │ │ │ ├── ts.h │ │ │ ├── txt_db.h │ │ │ ├── ui.h │ │ │ ├── ui_compat.h │ │ │ ├── x509.h │ │ │ ├── x509_vfy.h │ │ │ └── x509v3.h │ │ └── sqlite │ │ │ ├── sqlite3.h │ │ │ └── sqlite3ext.h │ ├── mips │ │ ├── libcrypto.so │ │ ├── libsqlite.so │ │ └── libssl.so │ └── x86 │ │ ├── libcrypto.so │ │ ├── libsqlite.so │ │ └── libssl.so ├── cpufeatures_jni │ ├── Android.mk │ └── cpufeatures_jni.c └── mpd_jni │ ├── Android.mk │ └── mpd_jni.c ├── libs └── android-support-v4.jar ├── proguard-project.txt ├── project.properties ├── res ├── drawable-hdpi │ └── ic_launcher.png ├── drawable-mdpi │ └── ic_launcher.png ├── drawable-xhdpi │ └── ic_launcher.png ├── drawable │ └── ic_notification.png ├── values-ko │ └── strings.xml ├── values-sw600dp │ └── dimens.xml ├── values-sw720dp-land │ └── dimens.xml ├── values-v11 │ └── styles.xml ├── values-v14 │ └── styles.xml ├── values-v18 │ └── arrays.xml ├── values │ ├── arrays.xml │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml └── xml │ ├── pref_general.xml │ └── pref_headers.xml └── src └── be └── deadba └── ampd ├── CpuFeatures.java ├── IMPDService.aidl ├── IMPDServiceCallback.aidl ├── LibMPD.java ├── MPDConf.java ├── MPDReceiver.java ├── MPDService.java └── SettingsActivity.java /.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | bin 2 | gen 3 | obj 4 | *.keystore 5 | .settings/ 6 | ant.properties 7 | local.properties 8 | tests/.classpath 9 | tests/.project 10 | tests/project.properties 11 | libs/armeabi-v7a 12 | libs/armeabi 13 | libs/x86 14 | libs/mips 15 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "jni/curl"] 2 | path = jni/curl 3 | url = https://github.com/tguillem/android-curl.git 4 | [submodule "jni/mpd"] 5 | path = jni/mpd 6 | url = https://github.com/tguillem/android-mpd.git 7 | [submodule "jni/glib"] 8 | path = jni/glib 9 | url = https://github.com/tguillem/android-glib.git 10 | [submodule "jni/yajl"] 11 | path = jni/yajl 12 | url = https://github.com/tguillem/android-yajl.git 13 | [submodule "jni/libiconv"] 14 | path = jni/libiconv 15 | url = https://github.com/tguillem/android-libiconv.git 16 | [submodule "jni/libav"] 17 | path = jni/libav 18 | url = https://github.com/tguillem/android-libav.git 19 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | Ampd 4 | 5 | 6 | 7 | 8 | 9 | com.android.ide.eclipse.adt.ResourceManagerBuilder 10 | 11 | 12 | 13 | 14 | com.android.ide.eclipse.adt.PreCompilerBuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.jdt.core.javabuilder 20 | 21 | 22 | 23 | 24 | com.android.ide.eclipse.adt.ApkBuilder 25 | 26 | 27 | 28 | 29 | 30 | com.android.ide.eclipse.adt.AndroidNature 31 | org.eclipse.jdt.core.javanature 32 | 33 | 34 | -------------------------------------------------------------------------------- /AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 20 | 21 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /INSTALL: -------------------------------------------------------------------------------- 1 | android Music Player Daemon (aMPD) - INSTALL 2 | 3 | Dependencies 4 | ------------ 5 | 6 | Android SDK - http://developer.android.com/tools/sdk/tools-notes.html 7 | 8 | Android NDK - http://developer.android.com/tools/sdk/ndk/index.html 9 | 10 | Compile 11 | ------- 12 | 13 | $ ANDROID_NDK= ANDROID_SDK= make 14 | 15 | Install 16 | ------- 17 | 18 | $ adb install bin/aMPD-debug.apk 19 | 20 | Using MPD 21 | --------- 22 | 23 | You can download many different interfaces for MPD at 24 | 25 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | 2 | ifeq ($(ANDROID_NDK),) 3 | $(error ANDROID_NDK undefined) 4 | endif 5 | ifeq ($(ANDROID_SDK),) 6 | $(error ANDROID_SDK undefined) 7 | endif 8 | 9 | ndk_v:= 10 | ndk_debug:= 11 | ndk_arch_all:= 12 | build_type:= 13 | 14 | ifeq (1,$(VERBOSE)) 15 | ndk_v := V=1 16 | endif 17 | ifneq (,$(NDK_DEBUG)) 18 | ndk_debug := NDK_DEBUG=$(NDK_DEBUG) 19 | endif 20 | ifneq (,$(NDK_ARCH_ALL)) 21 | ndk_arch_all := NDK_ARCH_ALL=$(NDK_ARCH_ALL) 22 | endif 23 | 24 | ifeq (,$(BUILD)) 25 | build_type := debug 26 | endif 27 | ifeq (DEBUG,$(BUILD)) 28 | build_type :=debug 29 | endif 30 | ifeq (RELEASE,$(BUILD)) 31 | build_type := release 32 | ndk_arch_all := NDK_ARCH_ALL=1 33 | endif 34 | 35 | 36 | all: aMPD 37 | 38 | local.properties: 39 | $(ANDROID_SDK)/tools/android update project --path . 40 | 41 | jni/mpd/Android.mk: 42 | git submodule init 43 | git submodule update 44 | 45 | aMPD: jni/mpd/Android.mk local.properties 46 | + $(ANDROID_NDK)/ndk-build $(ndk_debug) $(ndk_v) $(ndk_arch_all) -C . 47 | ant $(build_type) 48 | clean: 49 | ant clean 50 | rm -rf obj libs/armeabi libs/armeabi-v7a libs/mips libs/x86 51 | 52 | gdb: 53 | $(ANDROID_NDK)/ndk-gdb 54 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | android Music Player Daemon (aMPD) 2 | 3 | Music Player Daemon (MPD) running on any Android device as a background Service. 4 | 5 | Simply run aMPD, choose your Music directory and choose if you want to run MPD 6 | automatically (at device boot). Then play a variety of audio files remotely 7 | with a MPD client. 8 | 9 | You can use any MPD client like MPDroid on Android 10 | (https://play.google.com/store/apps/details?id=com.namelessdev.mpdroid) or any 11 | other client on Linux/Windows/Mac (http://www.musicpd.org/clients/). 12 | 13 | Connect your client to MPD using the host and port shown when you run aMPD. 14 | 15 | See http://www.musicpd.org/ for more informations about the MPD protocol. 16 | 17 | For basic installation information see the INSTALL file. 18 | 19 | aMPD is released under the GNU General Public License version 3, which is 20 | distributed in the COPYING file. 21 | -------------------------------------------------------------------------------- /build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | 29 | 30 | 31 | 35 | 36 | 37 | 38 | 39 | 40 | 49 | 50 | 51 | 52 | 56 | 57 | 69 | 70 | 71 | 89 | 90 | 91 | 92 | 93 | -------------------------------------------------------------------------------- /jni/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | LIBAV_PATH := $(LOCAL_PATH)/libav 4 | ICONV_PATH := $(LOCAL_PATH)/libiconv 5 | GLIB_PATH := $(LOCAL_PATH)/glib 6 | CURL_PATH := $(LOCAL_PATH)/curl 7 | YAJL_PATH := $(LOCAL_PATH)/yajl 8 | MPD_PATH := $(LOCAL_PATH)/mpd 9 | MPDJNI_PATH := $(LOCAL_PATH)/mpd_jni 10 | CPUFEATURESJNI_PATH := $(LOCAL_PATH)/cpufeatures_jni 11 | ANDROID_LIBS_PATH := $(LOCAL_PATH)/android-libs 12 | 13 | include $(LIBAV_PATH)/Android.mk 14 | include $(ICONV_PATH)/Android.mk 15 | include $(GLIB_PATH)/Android.mk 16 | include $(CURL_PATH)/Android.mk 17 | include $(YAJL_PATH)/Android.mk 18 | include $(MPD_PATH)/Android.mk 19 | include $(CPUFEATURESJNI_PATH)/Android.mk 20 | include $(MPDJNI_PATH)/Android.mk 21 | -------------------------------------------------------------------------------- /jni/Application.mk: -------------------------------------------------------------------------------- 1 | #APP_CFLAGS := 2 | ifeq (1,$(NDK_ARCH_ALL)) 3 | APP_ABI := armeabi-v7a armeabi x86 mips 4 | else 5 | APP_ABI := armeabi-v7a 6 | endif 7 | APP_PLATFORM := android-14 8 | -------------------------------------------------------------------------------- /jni/android-libs/README: -------------------------------------------------------------------------------- 1 | Android lib dependencies: 2 | 3 | Generate fake android dynamic libraries (only function symbols). Used to get 4 | android dependencies during build process. True android libs will be linked 5 | with libs from device (/system/lib/*so). 6 | -------------------------------------------------------------------------------- /jni/android-libs/arm/libcrypto.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tguillem/android-ampd/2c0c940ee64072638099f01fb21e06cb02a096d9/jni/android-libs/arm/libcrypto.so -------------------------------------------------------------------------------- /jni/android-libs/arm/libsqlite.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tguillem/android-ampd/2c0c940ee64072638099f01fb21e06cb02a096d9/jni/android-libs/arm/libsqlite.so -------------------------------------------------------------------------------- /jni/android-libs/arm/libssl.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tguillem/android-ampd/2c0c940ee64072638099f01fb21e06cb02a096d9/jni/android-libs/arm/libssl.so -------------------------------------------------------------------------------- /jni/android-libs/dump-libs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -z "${ANDROID_NDK}" ];then 4 | echo "ANDROID_NDK not defined" 5 | exit 1 6 | fi 7 | 8 | dump_symbols() 9 | { 10 | nm -D $1 | awk '{print $3}' | grep -v '^__aeabi\|__FINI_ARRAY__\|__INIT_ARRAY__\|__dso_handle' 11 | } 12 | 13 | 14 | TARGET_CC_ARM="${ANDROID_NDK}/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc" 15 | TARGET_CC_X86="${ANDROID_NDK}/toolchains/x86-4.6/prebuilt/linux-x86/bin/i686-linux-android-gcc" 16 | TARGET_CC_MIPS="${ANDROID_NDK}/toolchains/mipsel-linux-android-4.6/prebuilt/linux-x86/bin/mipsel-linux-android-gcc" 17 | 18 | for i in *.so; do 19 | lib=`basename $i .so` 20 | echo "// generated C file; do not modify; see dump-libs.sh" > $lib.c 21 | for s in `dump_symbols $lib.so`; do 22 | echo "void $s() {}" >> $lib.c; 23 | done 24 | for arch in arm x86 mips; do 25 | cc= 26 | if [ "${arch}" = arm ];then 27 | cc=${TARGET_CC_ARM} 28 | elif [ "${arch}" = x86 ];then 29 | cc=${TARGET_CC_X86} 30 | else 31 | cc=${TARGET_CC_MIPS} 32 | fi 33 | mkdir -p ${arch} 34 | $cc $lib.c -shared -o ${arch}/$lib.so --sysroot=${ANDROID_NDK}/platforms/android-9/arch-${arch} 35 | done 36 | done 37 | -------------------------------------------------------------------------------- /jni/android-libs/headers/openssl/aes.h: -------------------------------------------------------------------------------- 1 | /* crypto/aes/aes.h -*- mode:C; c-file-style: "eay" -*- */ 2 | /* ==================================================================== 3 | * Copyright (c) 1998-2002 The OpenSSL Project. 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 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in 14 | * the documentation and/or other materials provided with the 15 | * distribution. 16 | * 17 | * 3. All advertising materials mentioning features or use of this 18 | * software must display the following acknowledgment: 19 | * "This product includes software developed by the OpenSSL Project 20 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" 21 | * 22 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 23 | * endorse or promote products derived from this software without 24 | * prior written permission. For written permission, please contact 25 | * openssl-core@openssl.org. 26 | * 27 | * 5. Products derived from this software may not be called "OpenSSL" 28 | * nor may "OpenSSL" appear in their names without prior written 29 | * permission of the OpenSSL Project. 30 | * 31 | * 6. Redistributions of any form whatsoever must retain the following 32 | * acknowledgment: 33 | * "This product includes software developed by the OpenSSL Project 34 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" 35 | * 36 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 37 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 38 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 39 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 40 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 41 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 42 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 43 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 44 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 45 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 46 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 47 | * OF THE POSSIBILITY OF SUCH DAMAGE. 48 | * ==================================================================== 49 | * 50 | */ 51 | 52 | #ifndef HEADER_AES_H 53 | #define HEADER_AES_H 54 | 55 | #include 56 | 57 | #ifdef OPENSSL_NO_AES 58 | #error AES is disabled. 59 | #endif 60 | 61 | #include 62 | 63 | #define AES_ENCRYPT 1 64 | #define AES_DECRYPT 0 65 | 66 | /* Because array size can't be a const in C, the following two are macros. 67 | Both sizes are in bytes. */ 68 | #define AES_MAXNR 14 69 | #define AES_BLOCK_SIZE 16 70 | 71 | #ifdef __cplusplus 72 | extern "C" { 73 | #endif 74 | 75 | /* This should be a hidden type, but EVP requires that the size be known */ 76 | struct aes_key_st { 77 | #ifdef AES_LONG 78 | unsigned long rd_key[4 *(AES_MAXNR + 1)]; 79 | #else 80 | unsigned int rd_key[4 *(AES_MAXNR + 1)]; 81 | #endif 82 | int rounds; 83 | }; 84 | typedef struct aes_key_st AES_KEY; 85 | 86 | const char *AES_options(void); 87 | 88 | int AES_set_encrypt_key(const unsigned char *userKey, const int bits, 89 | AES_KEY *key); 90 | int AES_set_decrypt_key(const unsigned char *userKey, const int bits, 91 | AES_KEY *key); 92 | 93 | int private_AES_set_encrypt_key(const unsigned char *userKey, const int bits, 94 | AES_KEY *key); 95 | int private_AES_set_decrypt_key(const unsigned char *userKey, const int bits, 96 | AES_KEY *key); 97 | 98 | void AES_encrypt(const unsigned char *in, unsigned char *out, 99 | const AES_KEY *key); 100 | void AES_decrypt(const unsigned char *in, unsigned char *out, 101 | const AES_KEY *key); 102 | 103 | void AES_ecb_encrypt(const unsigned char *in, unsigned char *out, 104 | const AES_KEY *key, const int enc); 105 | void AES_cbc_encrypt(const unsigned char *in, unsigned char *out, 106 | size_t length, const AES_KEY *key, 107 | unsigned char *ivec, const int enc); 108 | void AES_cfb128_encrypt(const unsigned char *in, unsigned char *out, 109 | size_t length, const AES_KEY *key, 110 | unsigned char *ivec, int *num, const int enc); 111 | void AES_cfb1_encrypt(const unsigned char *in, unsigned char *out, 112 | size_t length, const AES_KEY *key, 113 | unsigned char *ivec, int *num, const int enc); 114 | void AES_cfb8_encrypt(const unsigned char *in, unsigned char *out, 115 | size_t length, const AES_KEY *key, 116 | unsigned char *ivec, int *num, const int enc); 117 | void AES_ofb128_encrypt(const unsigned char *in, unsigned char *out, 118 | size_t length, const AES_KEY *key, 119 | unsigned char *ivec, int *num); 120 | void AES_ctr128_encrypt(const unsigned char *in, unsigned char *out, 121 | size_t length, const AES_KEY *key, 122 | unsigned char ivec[AES_BLOCK_SIZE], 123 | unsigned char ecount_buf[AES_BLOCK_SIZE], 124 | unsigned int *num); 125 | /* NB: the IV is _two_ blocks long */ 126 | void AES_ige_encrypt(const unsigned char *in, unsigned char *out, 127 | size_t length, const AES_KEY *key, 128 | unsigned char *ivec, const int enc); 129 | /* NB: the IV is _four_ blocks long */ 130 | void AES_bi_ige_encrypt(const unsigned char *in, unsigned char *out, 131 | size_t length, const AES_KEY *key, 132 | const AES_KEY *key2, const unsigned char *ivec, 133 | const int enc); 134 | 135 | int AES_wrap_key(AES_KEY *key, const unsigned char *iv, 136 | unsigned char *out, 137 | const unsigned char *in, unsigned int inlen); 138 | int AES_unwrap_key(AES_KEY *key, const unsigned char *iv, 139 | unsigned char *out, 140 | const unsigned char *in, unsigned int inlen); 141 | 142 | 143 | #ifdef __cplusplus 144 | } 145 | #endif 146 | 147 | #endif /* !HEADER_AES_H */ 148 | -------------------------------------------------------------------------------- /jni/android-libs/headers/openssl/blowfish.h: -------------------------------------------------------------------------------- 1 | /* crypto/bf/blowfish.h */ 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 | * All rights reserved. 4 | * 5 | * This package is an SSL implementation written 6 | * by Eric Young (eay@cryptsoft.com). 7 | * The implementation was written so as to conform with Netscapes SSL. 8 | * 9 | * This library is free for commercial and non-commercial use as long as 10 | * the following conditions are aheared to. The following conditions 11 | * apply to all code found in this distribution, be it the RC4, RSA, 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation 13 | * included with this distribution is covered by the same copyright terms 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15 | * 16 | * Copyright remains Eric Young's, and as such any Copyright notices in 17 | * the code are not to be removed. 18 | * If this package is used in a product, Eric Young should be given attribution 19 | * as the author of the parts of the library used. 20 | * This can be in the form of a textual message at program startup or 21 | * in documentation (online or textual) provided with the package. 22 | * 23 | * Redistribution and use in source and binary forms, with or without 24 | * modification, are permitted provided that the following conditions 25 | * are met: 26 | * 1. Redistributions of source code must retain the copyright 27 | * notice, this list of conditions and the following disclaimer. 28 | * 2. Redistributions in binary form must reproduce the above copyright 29 | * notice, this list of conditions and the following disclaimer in the 30 | * documentation and/or other materials provided with the distribution. 31 | * 3. All advertising materials mentioning features or use of this software 32 | * must display the following acknowledgement: 33 | * "This product includes cryptographic software written by 34 | * Eric Young (eay@cryptsoft.com)" 35 | * The word 'cryptographic' can be left out if the rouines from the library 36 | * being used are not cryptographic related :-). 37 | * 4. If you include any Windows specific code (or a derivative thereof) from 38 | * the apps directory (application code) you must include an acknowledgement: 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40 | * 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51 | * SUCH DAMAGE. 52 | * 53 | * The licence and distribution terms for any publically available version or 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be 55 | * copied and put under another distribution licence 56 | * [including the GNU Public Licence.] 57 | */ 58 | 59 | #ifndef HEADER_BLOWFISH_H 60 | #define HEADER_BLOWFISH_H 61 | 62 | #include 63 | 64 | #ifdef __cplusplus 65 | extern "C" { 66 | #endif 67 | 68 | #ifdef OPENSSL_NO_BF 69 | #error BF is disabled. 70 | #endif 71 | 72 | #define BF_ENCRYPT 1 73 | #define BF_DECRYPT 0 74 | 75 | /* 76 | * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 77 | * ! BF_LONG has to be at least 32 bits wide. If it's wider, then ! 78 | * ! BF_LONG_LOG2 has to be defined along. ! 79 | * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 80 | */ 81 | 82 | #if defined(__LP32__) 83 | #define BF_LONG unsigned long 84 | #elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__) 85 | #define BF_LONG unsigned long 86 | #define BF_LONG_LOG2 3 87 | /* 88 | * _CRAY note. I could declare short, but I have no idea what impact 89 | * does it have on performance on none-T3E machines. I could declare 90 | * int, but at least on C90 sizeof(int) can be chosen at compile time. 91 | * So I've chosen long... 92 | * 93 | */ 94 | #else 95 | #define BF_LONG unsigned int 96 | #endif 97 | 98 | #define BF_ROUNDS 16 99 | #define BF_BLOCK 8 100 | 101 | typedef struct bf_key_st 102 | { 103 | BF_LONG P[BF_ROUNDS+2]; 104 | BF_LONG S[4*256]; 105 | } BF_KEY; 106 | 107 | #ifdef OPENSSL_FIPS 108 | void private_BF_set_key(BF_KEY *key, int len, const unsigned char *data); 109 | #endif 110 | void BF_set_key(BF_KEY *key, int len, const unsigned char *data); 111 | 112 | void BF_encrypt(BF_LONG *data,const BF_KEY *key); 113 | void BF_decrypt(BF_LONG *data,const BF_KEY *key); 114 | 115 | void BF_ecb_encrypt(const unsigned char *in, unsigned char *out, 116 | const BF_KEY *key, int enc); 117 | void BF_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, 118 | const BF_KEY *schedule, unsigned char *ivec, int enc); 119 | void BF_cfb64_encrypt(const unsigned char *in, unsigned char *out, long length, 120 | const BF_KEY *schedule, unsigned char *ivec, int *num, int enc); 121 | void BF_ofb64_encrypt(const unsigned char *in, unsigned char *out, long length, 122 | const BF_KEY *schedule, unsigned char *ivec, int *num); 123 | const char *BF_options(void); 124 | 125 | #ifdef __cplusplus 126 | } 127 | #endif 128 | 129 | #endif 130 | -------------------------------------------------------------------------------- /jni/android-libs/headers/openssl/buffer.h: -------------------------------------------------------------------------------- 1 | /* crypto/buffer/buffer.h */ 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 | * All rights reserved. 4 | * 5 | * This package is an SSL implementation written 6 | * by Eric Young (eay@cryptsoft.com). 7 | * The implementation was written so as to conform with Netscapes SSL. 8 | * 9 | * This library is free for commercial and non-commercial use as long as 10 | * the following conditions are aheared to. The following conditions 11 | * apply to all code found in this distribution, be it the RC4, RSA, 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation 13 | * included with this distribution is covered by the same copyright terms 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15 | * 16 | * Copyright remains Eric Young's, and as such any Copyright notices in 17 | * the code are not to be removed. 18 | * If this package is used in a product, Eric Young should be given attribution 19 | * as the author of the parts of the library used. 20 | * This can be in the form of a textual message at program startup or 21 | * in documentation (online or textual) provided with the package. 22 | * 23 | * Redistribution and use in source and binary forms, with or without 24 | * modification, are permitted provided that the following conditions 25 | * are met: 26 | * 1. Redistributions of source code must retain the copyright 27 | * notice, this list of conditions and the following disclaimer. 28 | * 2. Redistributions in binary form must reproduce the above copyright 29 | * notice, this list of conditions and the following disclaimer in the 30 | * documentation and/or other materials provided with the distribution. 31 | * 3. All advertising materials mentioning features or use of this software 32 | * must display the following acknowledgement: 33 | * "This product includes cryptographic software written by 34 | * Eric Young (eay@cryptsoft.com)" 35 | * The word 'cryptographic' can be left out if the rouines from the library 36 | * being used are not cryptographic related :-). 37 | * 4. If you include any Windows specific code (or a derivative thereof) from 38 | * the apps directory (application code) you must include an acknowledgement: 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40 | * 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51 | * SUCH DAMAGE. 52 | * 53 | * The licence and distribution terms for any publically available version or 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be 55 | * copied and put under another distribution licence 56 | * [including the GNU Public Licence.] 57 | */ 58 | 59 | #ifndef HEADER_BUFFER_H 60 | #define HEADER_BUFFER_H 61 | 62 | #include 63 | 64 | #ifdef __cplusplus 65 | extern "C" { 66 | #endif 67 | 68 | #include 69 | 70 | #if !defined(NO_SYS_TYPES_H) 71 | #include 72 | #endif 73 | 74 | /* Already declared in ossl_typ.h */ 75 | /* typedef struct buf_mem_st BUF_MEM; */ 76 | 77 | struct buf_mem_st 78 | { 79 | size_t length; /* current number of bytes */ 80 | char *data; 81 | size_t max; /* size of buffer */ 82 | }; 83 | 84 | BUF_MEM *BUF_MEM_new(void); 85 | void BUF_MEM_free(BUF_MEM *a); 86 | int BUF_MEM_grow(BUF_MEM *str, size_t len); 87 | int BUF_MEM_grow_clean(BUF_MEM *str, size_t len); 88 | char * BUF_strdup(const char *str); 89 | char * BUF_strndup(const char *str, size_t siz); 90 | void * BUF_memdup(const void *data, size_t siz); 91 | void BUF_reverse(unsigned char *out, unsigned char *in, size_t siz); 92 | 93 | /* safe string functions */ 94 | size_t BUF_strlcpy(char *dst,const char *src,size_t siz); 95 | size_t BUF_strlcat(char *dst,const char *src,size_t siz); 96 | 97 | 98 | /* BEGIN ERROR CODES */ 99 | /* The following lines are auto generated by the script mkerr.pl. Any changes 100 | * made after this point may be overwritten when the script is next run. 101 | */ 102 | void ERR_load_BUF_strings(void); 103 | 104 | /* Error codes for the BUF functions. */ 105 | 106 | /* Function codes. */ 107 | #define BUF_F_BUF_MEMDUP 103 108 | #define BUF_F_BUF_MEM_GROW 100 109 | #define BUF_F_BUF_MEM_GROW_CLEAN 105 110 | #define BUF_F_BUF_MEM_NEW 101 111 | #define BUF_F_BUF_STRDUP 102 112 | #define BUF_F_BUF_STRNDUP 104 113 | 114 | /* Reason codes. */ 115 | 116 | #ifdef __cplusplus 117 | } 118 | #endif 119 | #endif 120 | -------------------------------------------------------------------------------- /jni/android-libs/headers/openssl/cmac.h: -------------------------------------------------------------------------------- 1 | /* crypto/cmac/cmac.h */ 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 3 | * project. 4 | */ 5 | /* ==================================================================== 6 | * Copyright (c) 2010 The OpenSSL Project. All rights reserved. 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions 10 | * are met: 11 | * 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 15 | * 2. Redistributions in binary form must reproduce the above copyright 16 | * notice, this list of conditions and the following disclaimer in 17 | * the documentation and/or other materials provided with the 18 | * distribution. 19 | * 20 | * 3. All advertising materials mentioning features or use of this 21 | * software must display the following acknowledgment: 22 | * "This product includes software developed by the OpenSSL Project 23 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" 24 | * 25 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 26 | * endorse or promote products derived from this software without 27 | * prior written permission. For written permission, please contact 28 | * licensing@OpenSSL.org. 29 | * 30 | * 5. Products derived from this software may not be called "OpenSSL" 31 | * nor may "OpenSSL" appear in their names without prior written 32 | * permission of the OpenSSL Project. 33 | * 34 | * 6. Redistributions of any form whatsoever must retain the following 35 | * acknowledgment: 36 | * "This product includes software developed by the OpenSSL Project 37 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" 38 | * 39 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 40 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 41 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 42 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 43 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 44 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 45 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 46 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 47 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 48 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 49 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 50 | * OF THE POSSIBILITY OF SUCH DAMAGE. 51 | * ==================================================================== 52 | */ 53 | 54 | 55 | #ifndef HEADER_CMAC_H 56 | #define HEADER_CMAC_H 57 | 58 | #ifdef __cplusplus 59 | extern "C" { 60 | #endif 61 | 62 | #include 63 | 64 | /* Opaque */ 65 | typedef struct CMAC_CTX_st CMAC_CTX; 66 | 67 | CMAC_CTX *CMAC_CTX_new(void); 68 | void CMAC_CTX_cleanup(CMAC_CTX *ctx); 69 | void CMAC_CTX_free(CMAC_CTX *ctx); 70 | EVP_CIPHER_CTX *CMAC_CTX_get0_cipher_ctx(CMAC_CTX *ctx); 71 | int CMAC_CTX_copy(CMAC_CTX *out, const CMAC_CTX *in); 72 | 73 | int CMAC_Init(CMAC_CTX *ctx, const void *key, size_t keylen, 74 | const EVP_CIPHER *cipher, ENGINE *impl); 75 | int CMAC_Update(CMAC_CTX *ctx, const void *data, size_t dlen); 76 | int CMAC_Final(CMAC_CTX *ctx, unsigned char *out, size_t *poutlen); 77 | int CMAC_resume(CMAC_CTX *ctx); 78 | 79 | #ifdef __cplusplus 80 | } 81 | #endif 82 | #endif 83 | -------------------------------------------------------------------------------- /jni/android-libs/headers/openssl/comp.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef HEADER_COMP_H 3 | #define HEADER_COMP_H 4 | 5 | #include 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | typedef struct comp_ctx_st COMP_CTX; 12 | 13 | typedef struct comp_method_st 14 | { 15 | int type; /* NID for compression library */ 16 | const char *name; /* A text string to identify the library */ 17 | int (*init)(COMP_CTX *ctx); 18 | void (*finish)(COMP_CTX *ctx); 19 | int (*compress)(COMP_CTX *ctx, 20 | unsigned char *out, unsigned int olen, 21 | unsigned char *in, unsigned int ilen); 22 | int (*expand)(COMP_CTX *ctx, 23 | unsigned char *out, unsigned int olen, 24 | unsigned char *in, unsigned int ilen); 25 | /* The following two do NOTHING, but are kept for backward compatibility */ 26 | long (*ctrl)(void); 27 | long (*callback_ctrl)(void); 28 | } COMP_METHOD; 29 | 30 | struct comp_ctx_st 31 | { 32 | COMP_METHOD *meth; 33 | unsigned long compress_in; 34 | unsigned long compress_out; 35 | unsigned long expand_in; 36 | unsigned long expand_out; 37 | 38 | CRYPTO_EX_DATA ex_data; 39 | }; 40 | 41 | 42 | COMP_CTX *COMP_CTX_new(COMP_METHOD *meth); 43 | void COMP_CTX_free(COMP_CTX *ctx); 44 | int COMP_compress_block(COMP_CTX *ctx, unsigned char *out, int olen, 45 | unsigned char *in, int ilen); 46 | int COMP_expand_block(COMP_CTX *ctx, unsigned char *out, int olen, 47 | unsigned char *in, int ilen); 48 | COMP_METHOD *COMP_rle(void ); 49 | COMP_METHOD *COMP_zlib(void ); 50 | void COMP_zlib_cleanup(void); 51 | 52 | #ifdef HEADER_BIO_H 53 | #ifdef ZLIB 54 | BIO_METHOD *BIO_f_zlib(void); 55 | #endif 56 | #endif 57 | 58 | /* BEGIN ERROR CODES */ 59 | /* The following lines are auto generated by the script mkerr.pl. Any changes 60 | * made after this point may be overwritten when the script is next run. 61 | */ 62 | void ERR_load_COMP_strings(void); 63 | 64 | /* Error codes for the COMP functions. */ 65 | 66 | /* Function codes. */ 67 | #define COMP_F_BIO_ZLIB_FLUSH 99 68 | #define COMP_F_BIO_ZLIB_NEW 100 69 | #define COMP_F_BIO_ZLIB_READ 101 70 | #define COMP_F_BIO_ZLIB_WRITE 102 71 | 72 | /* Reason codes. */ 73 | #define COMP_R_ZLIB_DEFLATE_ERROR 99 74 | #define COMP_R_ZLIB_INFLATE_ERROR 100 75 | #define COMP_R_ZLIB_NOT_SUPPORTED 101 76 | 77 | #ifdef __cplusplus 78 | } 79 | #endif 80 | #endif 81 | -------------------------------------------------------------------------------- /jni/android-libs/headers/openssl/conf_api.h: -------------------------------------------------------------------------------- 1 | /* conf_api.h */ 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 | * All rights reserved. 4 | * 5 | * This package is an SSL implementation written 6 | * by Eric Young (eay@cryptsoft.com). 7 | * The implementation was written so as to conform with Netscapes SSL. 8 | * 9 | * This library is free for commercial and non-commercial use as long as 10 | * the following conditions are aheared to. The following conditions 11 | * apply to all code found in this distribution, be it the RC4, RSA, 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation 13 | * included with this distribution is covered by the same copyright terms 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15 | * 16 | * Copyright remains Eric Young's, and as such any Copyright notices in 17 | * the code are not to be removed. 18 | * If this package is used in a product, Eric Young should be given attribution 19 | * as the author of the parts of the library used. 20 | * This can be in the form of a textual message at program startup or 21 | * in documentation (online or textual) provided with the package. 22 | * 23 | * Redistribution and use in source and binary forms, with or without 24 | * modification, are permitted provided that the following conditions 25 | * are met: 26 | * 1. Redistributions of source code must retain the copyright 27 | * notice, this list of conditions and the following disclaimer. 28 | * 2. Redistributions in binary form must reproduce the above copyright 29 | * notice, this list of conditions and the following disclaimer in the 30 | * documentation and/or other materials provided with the distribution. 31 | * 3. All advertising materials mentioning features or use of this software 32 | * must display the following acknowledgement: 33 | * "This product includes cryptographic software written by 34 | * Eric Young (eay@cryptsoft.com)" 35 | * The word 'cryptographic' can be left out if the rouines from the library 36 | * being used are not cryptographic related :-). 37 | * 4. If you include any Windows specific code (or a derivative thereof) from 38 | * the apps directory (application code) you must include an acknowledgement: 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40 | * 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51 | * SUCH DAMAGE. 52 | * 53 | * The licence and distribution terms for any publically available version or 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be 55 | * copied and put under another distribution licence 56 | * [including the GNU Public Licence.] 57 | */ 58 | 59 | #ifndef HEADER_CONF_API_H 60 | #define HEADER_CONF_API_H 61 | 62 | #include 63 | #include 64 | 65 | #ifdef __cplusplus 66 | extern "C" { 67 | #endif 68 | 69 | /* Up until OpenSSL 0.9.5a, this was new_section */ 70 | CONF_VALUE *_CONF_new_section(CONF *conf, const char *section); 71 | /* Up until OpenSSL 0.9.5a, this was get_section */ 72 | CONF_VALUE *_CONF_get_section(const CONF *conf, const char *section); 73 | /* Up until OpenSSL 0.9.5a, this was CONF_get_section */ 74 | STACK_OF(CONF_VALUE) *_CONF_get_section_values(const CONF *conf, 75 | const char *section); 76 | 77 | int _CONF_add_string(CONF *conf, CONF_VALUE *section, CONF_VALUE *value); 78 | char *_CONF_get_string(const CONF *conf, const char *section, 79 | const char *name); 80 | long _CONF_get_number(const CONF *conf, const char *section, const char *name); 81 | 82 | int _CONF_new_data(CONF *conf); 83 | void _CONF_free_data(CONF *conf); 84 | 85 | #ifdef __cplusplus 86 | } 87 | #endif 88 | #endif 89 | 90 | -------------------------------------------------------------------------------- /jni/android-libs/headers/openssl/dtls1.h: -------------------------------------------------------------------------------- 1 | /* ssl/dtls1.h */ 2 | /* 3 | * DTLS implementation written by Nagendra Modadugu 4 | * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. 5 | */ 6 | /* ==================================================================== 7 | * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 16 | * 2. Redistributions in binary form must reproduce the above copyright 17 | * notice, this list of conditions and the following disclaimer in 18 | * the documentation and/or other materials provided with the 19 | * distribution. 20 | * 21 | * 3. All advertising materials mentioning features or use of this 22 | * software must display the following acknowledgment: 23 | * "This product includes software developed by the OpenSSL Project 24 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" 25 | * 26 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 27 | * endorse or promote products derived from this software without 28 | * prior written permission. For written permission, please contact 29 | * openssl-core@OpenSSL.org. 30 | * 31 | * 5. Products derived from this software may not be called "OpenSSL" 32 | * nor may "OpenSSL" appear in their names without prior written 33 | * permission of the OpenSSL Project. 34 | * 35 | * 6. Redistributions of any form whatsoever must retain the following 36 | * acknowledgment: 37 | * "This product includes software developed by the OpenSSL Project 38 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" 39 | * 40 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 41 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 42 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 43 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 44 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 45 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 46 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 47 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 49 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 50 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 51 | * OF THE POSSIBILITY OF SUCH DAMAGE. 52 | * ==================================================================== 53 | * 54 | * This product includes cryptographic software written by Eric Young 55 | * (eay@cryptsoft.com). This product includes software written by Tim 56 | * Hudson (tjh@cryptsoft.com). 57 | * 58 | */ 59 | 60 | #ifndef HEADER_DTLS1_H 61 | #define HEADER_DTLS1_H 62 | 63 | #include 64 | #include 65 | #ifdef OPENSSL_SYS_VMS 66 | #include 67 | #include 68 | #endif 69 | #ifdef OPENSSL_SYS_WIN32 70 | /* Needed for struct timeval */ 71 | #include 72 | #elif defined(OPENSSL_SYS_NETWARE) && !defined(_WINSOCK2API_) 73 | #include 74 | #else 75 | #include 76 | #endif 77 | 78 | #ifdef __cplusplus 79 | extern "C" { 80 | #endif 81 | 82 | #define DTLS1_VERSION 0xFEFF 83 | #define DTLS1_BAD_VER 0x0100 84 | 85 | #if 0 86 | /* this alert description is not specified anywhere... */ 87 | #define DTLS1_AD_MISSING_HANDSHAKE_MESSAGE 110 88 | #endif 89 | 90 | /* lengths of messages */ 91 | #define DTLS1_COOKIE_LENGTH 256 92 | 93 | #define DTLS1_RT_HEADER_LENGTH 13 94 | 95 | #define DTLS1_HM_HEADER_LENGTH 12 96 | 97 | #define DTLS1_HM_BAD_FRAGMENT -2 98 | #define DTLS1_HM_FRAGMENT_RETRY -3 99 | 100 | #define DTLS1_CCS_HEADER_LENGTH 1 101 | 102 | #ifdef DTLS1_AD_MISSING_HANDSHAKE_MESSAGE 103 | #define DTLS1_AL_HEADER_LENGTH 7 104 | #else 105 | #define DTLS1_AL_HEADER_LENGTH 2 106 | #endif 107 | 108 | #ifndef OPENSSL_NO_SSL_INTERN 109 | 110 | #ifndef OPENSSL_NO_SCTP 111 | #define DTLS1_SCTP_AUTH_LABEL "EXPORTER_DTLS_OVER_SCTP" 112 | #endif 113 | 114 | typedef struct dtls1_bitmap_st 115 | { 116 | unsigned long map; /* track 32 packets on 32-bit systems 117 | and 64 - on 64-bit systems */ 118 | unsigned char max_seq_num[8]; /* max record number seen so far, 119 | 64-bit value in big-endian 120 | encoding */ 121 | } DTLS1_BITMAP; 122 | 123 | struct dtls1_retransmit_state 124 | { 125 | EVP_CIPHER_CTX *enc_write_ctx; /* cryptographic state */ 126 | EVP_MD_CTX *write_hash; /* used for mac generation */ 127 | #ifndef OPENSSL_NO_COMP 128 | COMP_CTX *compress; /* compression */ 129 | #else 130 | char *compress; 131 | #endif 132 | SSL_SESSION *session; 133 | unsigned short epoch; 134 | }; 135 | 136 | struct hm_header_st 137 | { 138 | unsigned char type; 139 | unsigned long msg_len; 140 | unsigned short seq; 141 | unsigned long frag_off; 142 | unsigned long frag_len; 143 | unsigned int is_ccs; 144 | struct dtls1_retransmit_state saved_retransmit_state; 145 | }; 146 | 147 | struct ccs_header_st 148 | { 149 | unsigned char type; 150 | unsigned short seq; 151 | }; 152 | 153 | struct dtls1_timeout_st 154 | { 155 | /* Number of read timeouts so far */ 156 | unsigned int read_timeouts; 157 | 158 | /* Number of write timeouts so far */ 159 | unsigned int write_timeouts; 160 | 161 | /* Number of alerts received so far */ 162 | unsigned int num_alerts; 163 | }; 164 | 165 | typedef struct record_pqueue_st 166 | { 167 | unsigned short epoch; 168 | pqueue q; 169 | } record_pqueue; 170 | 171 | typedef struct hm_fragment_st 172 | { 173 | struct hm_header_st msg_header; 174 | unsigned char *fragment; 175 | unsigned char *reassembly; 176 | } hm_fragment; 177 | 178 | typedef struct dtls1_state_st 179 | { 180 | unsigned int send_cookie; 181 | unsigned char cookie[DTLS1_COOKIE_LENGTH]; 182 | unsigned char rcvd_cookie[DTLS1_COOKIE_LENGTH]; 183 | unsigned int cookie_len; 184 | 185 | /* 186 | * The current data and handshake epoch. This is initially 187 | * undefined, and starts at zero once the initial handshake is 188 | * completed 189 | */ 190 | unsigned short r_epoch; 191 | unsigned short w_epoch; 192 | 193 | /* records being received in the current epoch */ 194 | DTLS1_BITMAP bitmap; 195 | 196 | /* renegotiation starts a new set of sequence numbers */ 197 | DTLS1_BITMAP next_bitmap; 198 | 199 | /* handshake message numbers */ 200 | unsigned short handshake_write_seq; 201 | unsigned short next_handshake_write_seq; 202 | 203 | unsigned short handshake_read_seq; 204 | 205 | /* save last sequence number for retransmissions */ 206 | unsigned char last_write_sequence[8]; 207 | 208 | /* Received handshake records (processed and unprocessed) */ 209 | record_pqueue unprocessed_rcds; 210 | record_pqueue processed_rcds; 211 | 212 | /* Buffered handshake messages */ 213 | pqueue buffered_messages; 214 | 215 | /* Buffered (sent) handshake records */ 216 | pqueue sent_messages; 217 | 218 | /* Buffered application records. 219 | * Only for records between CCS and Finished 220 | * to prevent either protocol violation or 221 | * unnecessary message loss. 222 | */ 223 | record_pqueue buffered_app_data; 224 | 225 | /* Is set when listening for new connections with dtls1_listen() */ 226 | unsigned int listen; 227 | 228 | unsigned int mtu; /* max DTLS packet size */ 229 | 230 | struct hm_header_st w_msg_hdr; 231 | struct hm_header_st r_msg_hdr; 232 | 233 | struct dtls1_timeout_st timeout; 234 | 235 | /* Indicates when the last handshake msg or heartbeat sent will timeout */ 236 | struct timeval next_timeout; 237 | 238 | /* Timeout duration */ 239 | unsigned short timeout_duration; 240 | 241 | /* storage for Alert/Handshake protocol data received but not 242 | * yet processed by ssl3_read_bytes: */ 243 | unsigned char alert_fragment[DTLS1_AL_HEADER_LENGTH]; 244 | unsigned int alert_fragment_len; 245 | unsigned char handshake_fragment[DTLS1_HM_HEADER_LENGTH]; 246 | unsigned int handshake_fragment_len; 247 | 248 | unsigned int retransmitting; 249 | unsigned int change_cipher_spec_ok; 250 | 251 | #ifndef OPENSSL_NO_SCTP 252 | /* used when SSL_ST_XX_FLUSH is entered */ 253 | int next_state; 254 | 255 | int shutdown_received; 256 | #endif 257 | 258 | } DTLS1_STATE; 259 | 260 | typedef struct dtls1_record_data_st 261 | { 262 | unsigned char *packet; 263 | unsigned int packet_length; 264 | SSL3_BUFFER rbuf; 265 | SSL3_RECORD rrec; 266 | #ifndef OPENSSL_NO_SCTP 267 | struct bio_dgram_sctp_rcvinfo recordinfo; 268 | #endif 269 | } DTLS1_RECORD_DATA; 270 | 271 | #endif 272 | 273 | /* Timeout multipliers (timeout slice is defined in apps/timeouts.h */ 274 | #define DTLS1_TMO_READ_COUNT 2 275 | #define DTLS1_TMO_WRITE_COUNT 2 276 | 277 | #define DTLS1_TMO_ALERT_COUNT 12 278 | 279 | #ifdef __cplusplus 280 | } 281 | #endif 282 | #endif 283 | 284 | -------------------------------------------------------------------------------- /jni/android-libs/headers/openssl/ebcdic.h: -------------------------------------------------------------------------------- 1 | /* crypto/ebcdic.h */ 2 | 3 | #ifndef HEADER_EBCDIC_H 4 | #define HEADER_EBCDIC_H 5 | 6 | #include 7 | 8 | /* Avoid name clashes with other applications */ 9 | #define os_toascii _openssl_os_toascii 10 | #define os_toebcdic _openssl_os_toebcdic 11 | #define ebcdic2ascii _openssl_ebcdic2ascii 12 | #define ascii2ebcdic _openssl_ascii2ebcdic 13 | 14 | extern const unsigned char os_toascii[256]; 15 | extern const unsigned char os_toebcdic[256]; 16 | void *ebcdic2ascii(void *dest, const void *srce, size_t count); 17 | void *ascii2ebcdic(void *dest, const void *srce, size_t count); 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /jni/android-libs/headers/openssl/ecdh.h: -------------------------------------------------------------------------------- 1 | /* crypto/ecdh/ecdh.h */ 2 | /* ==================================================================== 3 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. 4 | * 5 | * The Elliptic Curve Public-Key Crypto Library (ECC Code) included 6 | * herein is developed by SUN MICROSYSTEMS, INC., and is contributed 7 | * to the OpenSSL project. 8 | * 9 | * The ECC Code is licensed pursuant to the OpenSSL open source 10 | * license provided below. 11 | * 12 | * The ECDH software is originally written by Douglas Stebila of 13 | * Sun Microsystems Laboratories. 14 | * 15 | */ 16 | /* ==================================================================== 17 | * Copyright (c) 2000-2002 The OpenSSL Project. All rights reserved. 18 | * 19 | * Redistribution and use in source and binary forms, with or without 20 | * modification, are permitted provided that the following conditions 21 | * are met: 22 | * 23 | * 1. Redistributions of source code must retain the above copyright 24 | * notice, this list of conditions and the following disclaimer. 25 | * 26 | * 2. Redistributions in binary form must reproduce the above copyright 27 | * notice, this list of conditions and the following disclaimer in 28 | * the documentation and/or other materials provided with the 29 | * distribution. 30 | * 31 | * 3. All advertising materials mentioning features or use of this 32 | * software must display the following acknowledgment: 33 | * "This product includes software developed by the OpenSSL Project 34 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" 35 | * 36 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 37 | * endorse or promote products derived from this software without 38 | * prior written permission. For written permission, please contact 39 | * licensing@OpenSSL.org. 40 | * 41 | * 5. Products derived from this software may not be called "OpenSSL" 42 | * nor may "OpenSSL" appear in their names without prior written 43 | * permission of the OpenSSL Project. 44 | * 45 | * 6. Redistributions of any form whatsoever must retain the following 46 | * acknowledgment: 47 | * "This product includes software developed by the OpenSSL Project 48 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" 49 | * 50 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 51 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 52 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 53 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 54 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 55 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 56 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 57 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 58 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 59 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 60 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 61 | * OF THE POSSIBILITY OF SUCH DAMAGE. 62 | * ==================================================================== 63 | * 64 | * This product includes cryptographic software written by Eric Young 65 | * (eay@cryptsoft.com). This product includes software written by Tim 66 | * Hudson (tjh@cryptsoft.com). 67 | * 68 | */ 69 | #ifndef HEADER_ECDH_H 70 | #define HEADER_ECDH_H 71 | 72 | #include 73 | 74 | #ifdef OPENSSL_NO_ECDH 75 | #error ECDH is disabled. 76 | #endif 77 | 78 | #include 79 | #include 80 | #ifndef OPENSSL_NO_DEPRECATED 81 | #include 82 | #endif 83 | 84 | #ifdef __cplusplus 85 | extern "C" { 86 | #endif 87 | 88 | const ECDH_METHOD *ECDH_OpenSSL(void); 89 | 90 | void ECDH_set_default_method(const ECDH_METHOD *); 91 | const ECDH_METHOD *ECDH_get_default_method(void); 92 | int ECDH_set_method(EC_KEY *, const ECDH_METHOD *); 93 | 94 | int ECDH_compute_key(void *out, size_t outlen, const EC_POINT *pub_key, EC_KEY *ecdh, 95 | void *(*KDF)(const void *in, size_t inlen, void *out, size_t *outlen)); 96 | 97 | int ECDH_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new 98 | *new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); 99 | int ECDH_set_ex_data(EC_KEY *d, int idx, void *arg); 100 | void *ECDH_get_ex_data(EC_KEY *d, int idx); 101 | 102 | 103 | /* BEGIN ERROR CODES */ 104 | /* The following lines are auto generated by the script mkerr.pl. Any changes 105 | * made after this point may be overwritten when the script is next run. 106 | */ 107 | void ERR_load_ECDH_strings(void); 108 | 109 | /* Error codes for the ECDH functions. */ 110 | 111 | /* Function codes. */ 112 | #define ECDH_F_ECDH_CHECK 102 113 | #define ECDH_F_ECDH_COMPUTE_KEY 100 114 | #define ECDH_F_ECDH_DATA_NEW_METHOD 101 115 | 116 | /* Reason codes. */ 117 | #define ECDH_R_KDF_FAILED 102 118 | #define ECDH_R_NON_FIPS_METHOD 103 119 | #define ECDH_R_NO_PRIVATE_VALUE 100 120 | #define ECDH_R_POINT_ARITHMETIC_FAILURE 101 121 | 122 | #ifdef __cplusplus 123 | } 124 | #endif 125 | #endif 126 | -------------------------------------------------------------------------------- /jni/android-libs/headers/openssl/hmac.h: -------------------------------------------------------------------------------- 1 | /* crypto/hmac/hmac.h */ 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 | * All rights reserved. 4 | * 5 | * This package is an SSL implementation written 6 | * by Eric Young (eay@cryptsoft.com). 7 | * The implementation was written so as to conform with Netscapes SSL. 8 | * 9 | * This library is free for commercial and non-commercial use as long as 10 | * the following conditions are aheared to. The following conditions 11 | * apply to all code found in this distribution, be it the RC4, RSA, 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation 13 | * included with this distribution is covered by the same copyright terms 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15 | * 16 | * Copyright remains Eric Young's, and as such any Copyright notices in 17 | * the code are not to be removed. 18 | * If this package is used in a product, Eric Young should be given attribution 19 | * as the author of the parts of the library used. 20 | * This can be in the form of a textual message at program startup or 21 | * in documentation (online or textual) provided with the package. 22 | * 23 | * Redistribution and use in source and binary forms, with or without 24 | * modification, are permitted provided that the following conditions 25 | * are met: 26 | * 1. Redistributions of source code must retain the copyright 27 | * notice, this list of conditions and the following disclaimer. 28 | * 2. Redistributions in binary form must reproduce the above copyright 29 | * notice, this list of conditions and the following disclaimer in the 30 | * documentation and/or other materials provided with the distribution. 31 | * 3. All advertising materials mentioning features or use of this software 32 | * must display the following acknowledgement: 33 | * "This product includes cryptographic software written by 34 | * Eric Young (eay@cryptsoft.com)" 35 | * The word 'cryptographic' can be left out if the rouines from the library 36 | * being used are not cryptographic related :-). 37 | * 4. If you include any Windows specific code (or a derivative thereof) from 38 | * the apps directory (application code) you must include an acknowledgement: 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40 | * 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51 | * SUCH DAMAGE. 52 | * 53 | * The licence and distribution terms for any publically available version or 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be 55 | * copied and put under another distribution licence 56 | * [including the GNU Public Licence.] 57 | */ 58 | #ifndef HEADER_HMAC_H 59 | #define HEADER_HMAC_H 60 | 61 | #include 62 | 63 | #ifdef OPENSSL_NO_HMAC 64 | #error HMAC is disabled. 65 | #endif 66 | 67 | #include 68 | 69 | #define HMAC_MAX_MD_CBLOCK 128 /* largest known is SHA512 */ 70 | 71 | #ifdef __cplusplus 72 | extern "C" { 73 | #endif 74 | 75 | typedef struct hmac_ctx_st 76 | { 77 | const EVP_MD *md; 78 | EVP_MD_CTX md_ctx; 79 | EVP_MD_CTX i_ctx; 80 | EVP_MD_CTX o_ctx; 81 | unsigned int key_length; 82 | unsigned char key[HMAC_MAX_MD_CBLOCK]; 83 | } HMAC_CTX; 84 | 85 | #define HMAC_size(e) (EVP_MD_size((e)->md)) 86 | 87 | 88 | void HMAC_CTX_init(HMAC_CTX *ctx); 89 | void HMAC_CTX_cleanup(HMAC_CTX *ctx); 90 | 91 | #define HMAC_cleanup(ctx) HMAC_CTX_cleanup(ctx) /* deprecated */ 92 | 93 | int HMAC_Init(HMAC_CTX *ctx, const void *key, int len, 94 | const EVP_MD *md); /* deprecated */ 95 | int HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len, 96 | const EVP_MD *md, ENGINE *impl); 97 | int HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, size_t len); 98 | int HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len); 99 | unsigned char *HMAC(const EVP_MD *evp_md, const void *key, int key_len, 100 | const unsigned char *d, size_t n, unsigned char *md, 101 | unsigned int *md_len); 102 | int HMAC_CTX_copy(HMAC_CTX *dctx, HMAC_CTX *sctx); 103 | 104 | void HMAC_CTX_set_flags(HMAC_CTX *ctx, unsigned long flags); 105 | 106 | #ifdef __cplusplus 107 | } 108 | #endif 109 | 110 | #endif 111 | -------------------------------------------------------------------------------- /jni/android-libs/headers/openssl/krb5_asn.h: -------------------------------------------------------------------------------- 1 | /* krb5_asn.h */ 2 | /* Written by Vern Staats for the OpenSSL project, 3 | ** using ocsp/{*.h,*asn*.c} as a starting point 4 | */ 5 | 6 | /* ==================================================================== 7 | * Copyright (c) 1998-2000 The OpenSSL Project. All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 16 | * 2. Redistributions in binary form must reproduce the above copyright 17 | * notice, this list of conditions and the following disclaimer in 18 | * the documentation and/or other materials provided with the 19 | * distribution. 20 | * 21 | * 3. All advertising materials mentioning features or use of this 22 | * software must display the following acknowledgment: 23 | * "This product includes software developed by the OpenSSL Project 24 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" 25 | * 26 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 27 | * endorse or promote products derived from this software without 28 | * prior written permission. For written permission, please contact 29 | * openssl-core@openssl.org. 30 | * 31 | * 5. Products derived from this software may not be called "OpenSSL" 32 | * nor may "OpenSSL" appear in their names without prior written 33 | * permission of the OpenSSL Project. 34 | * 35 | * 6. Redistributions of any form whatsoever must retain the following 36 | * acknowledgment: 37 | * "This product includes software developed by the OpenSSL Project 38 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" 39 | * 40 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 41 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 42 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 43 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 44 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 45 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 46 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 47 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 49 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 50 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 51 | * OF THE POSSIBILITY OF SUCH DAMAGE. 52 | * ==================================================================== 53 | * 54 | * This product includes cryptographic software written by Eric Young 55 | * (eay@cryptsoft.com). This product includes software written by Tim 56 | * Hudson (tjh@cryptsoft.com). 57 | * 58 | */ 59 | 60 | #ifndef HEADER_KRB5_ASN_H 61 | #define HEADER_KRB5_ASN_H 62 | 63 | /* 64 | #include 65 | */ 66 | #include 67 | 68 | #ifdef __cplusplus 69 | extern "C" { 70 | #endif 71 | 72 | 73 | /* ASN.1 from Kerberos RFC 1510 74 | */ 75 | 76 | /* EncryptedData ::= SEQUENCE { 77 | ** etype[0] INTEGER, -- EncryptionType 78 | ** kvno[1] INTEGER OPTIONAL, 79 | ** cipher[2] OCTET STRING -- ciphertext 80 | ** } 81 | */ 82 | typedef struct krb5_encdata_st 83 | { 84 | ASN1_INTEGER *etype; 85 | ASN1_INTEGER *kvno; 86 | ASN1_OCTET_STRING *cipher; 87 | } KRB5_ENCDATA; 88 | 89 | DECLARE_STACK_OF(KRB5_ENCDATA) 90 | 91 | /* PrincipalName ::= SEQUENCE { 92 | ** name-type[0] INTEGER, 93 | ** name-string[1] SEQUENCE OF GeneralString 94 | ** } 95 | */ 96 | typedef struct krb5_princname_st 97 | { 98 | ASN1_INTEGER *nametype; 99 | STACK_OF(ASN1_GENERALSTRING) *namestring; 100 | } KRB5_PRINCNAME; 101 | 102 | DECLARE_STACK_OF(KRB5_PRINCNAME) 103 | 104 | 105 | /* Ticket ::= [APPLICATION 1] SEQUENCE { 106 | ** tkt-vno[0] INTEGER, 107 | ** realm[1] Realm, 108 | ** sname[2] PrincipalName, 109 | ** enc-part[3] EncryptedData 110 | ** } 111 | */ 112 | typedef struct krb5_tktbody_st 113 | { 114 | ASN1_INTEGER *tktvno; 115 | ASN1_GENERALSTRING *realm; 116 | KRB5_PRINCNAME *sname; 117 | KRB5_ENCDATA *encdata; 118 | } KRB5_TKTBODY; 119 | 120 | typedef STACK_OF(KRB5_TKTBODY) KRB5_TICKET; 121 | DECLARE_STACK_OF(KRB5_TKTBODY) 122 | 123 | 124 | /* AP-REQ ::= [APPLICATION 14] SEQUENCE { 125 | ** pvno[0] INTEGER, 126 | ** msg-type[1] INTEGER, 127 | ** ap-options[2] APOptions, 128 | ** ticket[3] Ticket, 129 | ** authenticator[4] EncryptedData 130 | ** } 131 | ** 132 | ** APOptions ::= BIT STRING { 133 | ** reserved(0), use-session-key(1), mutual-required(2) } 134 | */ 135 | typedef struct krb5_ap_req_st 136 | { 137 | ASN1_INTEGER *pvno; 138 | ASN1_INTEGER *msgtype; 139 | ASN1_BIT_STRING *apoptions; 140 | KRB5_TICKET *ticket; 141 | KRB5_ENCDATA *authenticator; 142 | } KRB5_APREQBODY; 143 | 144 | typedef STACK_OF(KRB5_APREQBODY) KRB5_APREQ; 145 | DECLARE_STACK_OF(KRB5_APREQBODY) 146 | 147 | 148 | /* Authenticator Stuff */ 149 | 150 | 151 | /* Checksum ::= SEQUENCE { 152 | ** cksumtype[0] INTEGER, 153 | ** checksum[1] OCTET STRING 154 | ** } 155 | */ 156 | typedef struct krb5_checksum_st 157 | { 158 | ASN1_INTEGER *ctype; 159 | ASN1_OCTET_STRING *checksum; 160 | } KRB5_CHECKSUM; 161 | 162 | DECLARE_STACK_OF(KRB5_CHECKSUM) 163 | 164 | 165 | /* EncryptionKey ::= SEQUENCE { 166 | ** keytype[0] INTEGER, 167 | ** keyvalue[1] OCTET STRING 168 | ** } 169 | */ 170 | typedef struct krb5_encryptionkey_st 171 | { 172 | ASN1_INTEGER *ktype; 173 | ASN1_OCTET_STRING *keyvalue; 174 | } KRB5_ENCKEY; 175 | 176 | DECLARE_STACK_OF(KRB5_ENCKEY) 177 | 178 | 179 | /* AuthorizationData ::= SEQUENCE OF SEQUENCE { 180 | ** ad-type[0] INTEGER, 181 | ** ad-data[1] OCTET STRING 182 | ** } 183 | */ 184 | typedef struct krb5_authorization_st 185 | { 186 | ASN1_INTEGER *adtype; 187 | ASN1_OCTET_STRING *addata; 188 | } KRB5_AUTHDATA; 189 | 190 | DECLARE_STACK_OF(KRB5_AUTHDATA) 191 | 192 | 193 | /* -- Unencrypted authenticator 194 | ** Authenticator ::= [APPLICATION 2] SEQUENCE { 195 | ** authenticator-vno[0] INTEGER, 196 | ** crealm[1] Realm, 197 | ** cname[2] PrincipalName, 198 | ** cksum[3] Checksum OPTIONAL, 199 | ** cusec[4] INTEGER, 200 | ** ctime[5] KerberosTime, 201 | ** subkey[6] EncryptionKey OPTIONAL, 202 | ** seq-number[7] INTEGER OPTIONAL, 203 | ** authorization-data[8] AuthorizationData OPTIONAL 204 | ** } 205 | */ 206 | typedef struct krb5_authenticator_st 207 | { 208 | ASN1_INTEGER *avno; 209 | ASN1_GENERALSTRING *crealm; 210 | KRB5_PRINCNAME *cname; 211 | KRB5_CHECKSUM *cksum; 212 | ASN1_INTEGER *cusec; 213 | ASN1_GENERALIZEDTIME *ctime; 214 | KRB5_ENCKEY *subkey; 215 | ASN1_INTEGER *seqnum; 216 | KRB5_AUTHDATA *authorization; 217 | } KRB5_AUTHENTBODY; 218 | 219 | typedef STACK_OF(KRB5_AUTHENTBODY) KRB5_AUTHENT; 220 | DECLARE_STACK_OF(KRB5_AUTHENTBODY) 221 | 222 | 223 | /* DECLARE_ASN1_FUNCTIONS(type) = DECLARE_ASN1_FUNCTIONS_name(type, type) = 224 | ** type *name##_new(void); 225 | ** void name##_free(type *a); 226 | ** DECLARE_ASN1_ENCODE_FUNCTIONS(type, name, name) = 227 | ** DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) = 228 | ** type *d2i_##name(type **a, const unsigned char **in, long len); 229 | ** int i2d_##name(type *a, unsigned char **out); 230 | ** DECLARE_ASN1_ITEM(itname) = OPENSSL_EXTERN const ASN1_ITEM itname##_it 231 | */ 232 | 233 | DECLARE_ASN1_FUNCTIONS(KRB5_ENCDATA) 234 | DECLARE_ASN1_FUNCTIONS(KRB5_PRINCNAME) 235 | DECLARE_ASN1_FUNCTIONS(KRB5_TKTBODY) 236 | DECLARE_ASN1_FUNCTIONS(KRB5_APREQBODY) 237 | DECLARE_ASN1_FUNCTIONS(KRB5_TICKET) 238 | DECLARE_ASN1_FUNCTIONS(KRB5_APREQ) 239 | 240 | DECLARE_ASN1_FUNCTIONS(KRB5_CHECKSUM) 241 | DECLARE_ASN1_FUNCTIONS(KRB5_ENCKEY) 242 | DECLARE_ASN1_FUNCTIONS(KRB5_AUTHDATA) 243 | DECLARE_ASN1_FUNCTIONS(KRB5_AUTHENTBODY) 244 | DECLARE_ASN1_FUNCTIONS(KRB5_AUTHENT) 245 | 246 | 247 | /* BEGIN ERROR CODES */ 248 | /* The following lines are auto generated by the script mkerr.pl. Any changes 249 | * made after this point may be overwritten when the script is next run. 250 | */ 251 | 252 | #ifdef __cplusplus 253 | } 254 | #endif 255 | #endif 256 | 257 | -------------------------------------------------------------------------------- /jni/android-libs/headers/openssl/kssl.h: -------------------------------------------------------------------------------- 1 | /* ssl/kssl.h -*- mode: C; c-file-style: "eay" -*- */ 2 | /* Written by Vern Staats for the OpenSSL project 2000. 3 | * project 2000. 4 | */ 5 | /* ==================================================================== 6 | * Copyright (c) 2000 The OpenSSL Project. All rights reserved. 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions 10 | * are met: 11 | * 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 15 | * 2. Redistributions in binary form must reproduce the above copyright 16 | * notice, this list of conditions and the following disclaimer in 17 | * the documentation and/or other materials provided with the 18 | * distribution. 19 | * 20 | * 3. All advertising materials mentioning features or use of this 21 | * software must display the following acknowledgment: 22 | * "This product includes software developed by the OpenSSL Project 23 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" 24 | * 25 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 26 | * endorse or promote products derived from this software without 27 | * prior written permission. For written permission, please contact 28 | * licensing@OpenSSL.org. 29 | * 30 | * 5. Products derived from this software may not be called "OpenSSL" 31 | * nor may "OpenSSL" appear in their names without prior written 32 | * permission of the OpenSSL Project. 33 | * 34 | * 6. Redistributions of any form whatsoever must retain the following 35 | * acknowledgment: 36 | * "This product includes software developed by the OpenSSL Project 37 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" 38 | * 39 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 40 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 41 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 42 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 43 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 44 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 45 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 46 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 47 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 48 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 49 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 50 | * OF THE POSSIBILITY OF SUCH DAMAGE. 51 | * ==================================================================== 52 | * 53 | * This product includes cryptographic software written by Eric Young 54 | * (eay@cryptsoft.com). This product includes software written by Tim 55 | * Hudson (tjh@cryptsoft.com). 56 | * 57 | */ 58 | 59 | /* 60 | ** 19990701 VRS Started. 61 | */ 62 | 63 | #ifndef KSSL_H 64 | #define KSSL_H 65 | 66 | #include 67 | 68 | #ifndef OPENSSL_NO_KRB5 69 | 70 | #include 71 | #include 72 | #include 73 | 74 | #ifdef __cplusplus 75 | extern "C" { 76 | #endif 77 | 78 | /* 79 | ** Depending on which KRB5 implementation used, some types from 80 | ** the other may be missing. Resolve that here and now 81 | */ 82 | #ifdef KRB5_HEIMDAL 83 | typedef unsigned char krb5_octet; 84 | #define FAR 85 | #else 86 | 87 | #ifndef FAR 88 | #define FAR 89 | #endif 90 | 91 | #endif 92 | 93 | /* Uncomment this to debug kssl problems or 94 | ** to trace usage of the Kerberos session key 95 | ** 96 | ** #define KSSL_DEBUG 97 | */ 98 | 99 | #ifndef KRB5SVC 100 | #define KRB5SVC "host" 101 | #endif 102 | 103 | #ifndef KRB5KEYTAB 104 | #define KRB5KEYTAB "/etc/krb5.keytab" 105 | #endif 106 | 107 | #ifndef KRB5SENDAUTH 108 | #define KRB5SENDAUTH 1 109 | #endif 110 | 111 | #ifndef KRB5CHECKAUTH 112 | #define KRB5CHECKAUTH 1 113 | #endif 114 | 115 | #ifndef KSSL_CLOCKSKEW 116 | #define KSSL_CLOCKSKEW 300; 117 | #endif 118 | 119 | #define KSSL_ERR_MAX 255 120 | typedef struct kssl_err_st { 121 | int reason; 122 | char text[KSSL_ERR_MAX+1]; 123 | } KSSL_ERR; 124 | 125 | 126 | /* Context for passing 127 | ** (1) Kerberos session key to SSL, and 128 | ** (2) Config data between application and SSL lib 129 | */ 130 | typedef struct kssl_ctx_st 131 | { 132 | /* used by: disposition: */ 133 | char *service_name; /* C,S default ok (kssl) */ 134 | char *service_host; /* C input, REQUIRED */ 135 | char *client_princ; /* S output from krb5 ticket */ 136 | char *keytab_file; /* S NULL (/etc/krb5.keytab) */ 137 | char *cred_cache; /* C NULL (default) */ 138 | krb5_enctype enctype; 139 | int length; 140 | krb5_octet FAR *key; 141 | } KSSL_CTX; 142 | 143 | #define KSSL_CLIENT 1 144 | #define KSSL_SERVER 2 145 | #define KSSL_SERVICE 3 146 | #define KSSL_KEYTAB 4 147 | 148 | #define KSSL_CTX_OK 0 149 | #define KSSL_CTX_ERR 1 150 | #define KSSL_NOMEM 2 151 | 152 | /* Public (for use by applications that use OpenSSL with Kerberos 5 support */ 153 | krb5_error_code kssl_ctx_setstring(KSSL_CTX *kssl_ctx, int which, char *text); 154 | KSSL_CTX *kssl_ctx_new(void); 155 | KSSL_CTX *kssl_ctx_free(KSSL_CTX *kssl_ctx); 156 | void kssl_ctx_show(KSSL_CTX *kssl_ctx); 157 | krb5_error_code kssl_ctx_setprinc(KSSL_CTX *kssl_ctx, int which, 158 | krb5_data *realm, krb5_data *entity, int nentities); 159 | krb5_error_code kssl_cget_tkt(KSSL_CTX *kssl_ctx, krb5_data **enc_tktp, 160 | krb5_data *authenp, KSSL_ERR *kssl_err); 161 | krb5_error_code kssl_sget_tkt(KSSL_CTX *kssl_ctx, krb5_data *indata, 162 | krb5_ticket_times *ttimes, KSSL_ERR *kssl_err); 163 | krb5_error_code kssl_ctx_setkey(KSSL_CTX *kssl_ctx, krb5_keyblock *session); 164 | void kssl_err_set(KSSL_ERR *kssl_err, int reason, char *text); 165 | void kssl_krb5_free_data_contents(krb5_context context, krb5_data *data); 166 | krb5_error_code kssl_build_principal_2(krb5_context context, 167 | krb5_principal *princ, int rlen, const char *realm, 168 | int slen, const char *svc, int hlen, const char *host); 169 | krb5_error_code kssl_validate_times(krb5_timestamp atime, 170 | krb5_ticket_times *ttimes); 171 | krb5_error_code kssl_check_authent(KSSL_CTX *kssl_ctx, krb5_data *authentp, 172 | krb5_timestamp *atimep, KSSL_ERR *kssl_err); 173 | unsigned char *kssl_skip_confound(krb5_enctype enctype, unsigned char *authn); 174 | 175 | void SSL_set0_kssl_ctx(SSL *s, KSSL_CTX *kctx); 176 | KSSL_CTX * SSL_get0_kssl_ctx(SSL *s); 177 | char *kssl_ctx_get0_client_princ(KSSL_CTX *kctx); 178 | 179 | #ifdef __cplusplus 180 | } 181 | #endif 182 | #endif /* OPENSSL_NO_KRB5 */ 183 | #endif /* KSSL_H */ 184 | -------------------------------------------------------------------------------- /jni/android-libs/headers/openssl/md4.h: -------------------------------------------------------------------------------- 1 | /* crypto/md4/md4.h */ 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 | * All rights reserved. 4 | * 5 | * This package is an SSL implementation written 6 | * by Eric Young (eay@cryptsoft.com). 7 | * The implementation was written so as to conform with Netscapes SSL. 8 | * 9 | * This library is free for commercial and non-commercial use as long as 10 | * the following conditions are aheared to. The following conditions 11 | * apply to all code found in this distribution, be it the RC4, RSA, 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation 13 | * included with this distribution is covered by the same copyright terms 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15 | * 16 | * Copyright remains Eric Young's, and as such any Copyright notices in 17 | * the code are not to be removed. 18 | * If this package is used in a product, Eric Young should be given attribution 19 | * as the author of the parts of the library used. 20 | * This can be in the form of a textual message at program startup or 21 | * in documentation (online or textual) provided with the package. 22 | * 23 | * Redistribution and use in source and binary forms, with or without 24 | * modification, are permitted provided that the following conditions 25 | * are met: 26 | * 1. Redistributions of source code must retain the copyright 27 | * notice, this list of conditions and the following disclaimer. 28 | * 2. Redistributions in binary form must reproduce the above copyright 29 | * notice, this list of conditions and the following disclaimer in the 30 | * documentation and/or other materials provided with the distribution. 31 | * 3. All advertising materials mentioning features or use of this software 32 | * must display the following acknowledgement: 33 | * "This product includes cryptographic software written by 34 | * Eric Young (eay@cryptsoft.com)" 35 | * The word 'cryptographic' can be left out if the rouines from the library 36 | * being used are not cryptographic related :-). 37 | * 4. If you include any Windows specific code (or a derivative thereof) from 38 | * the apps directory (application code) you must include an acknowledgement: 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40 | * 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51 | * SUCH DAMAGE. 52 | * 53 | * The licence and distribution terms for any publically available version or 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be 55 | * copied and put under another distribution licence 56 | * [including the GNU Public Licence.] 57 | */ 58 | 59 | #ifndef HEADER_MD4_H 60 | #define HEADER_MD4_H 61 | 62 | #include 63 | #include 64 | 65 | #ifdef __cplusplus 66 | extern "C" { 67 | #endif 68 | 69 | #ifdef OPENSSL_NO_MD4 70 | #error MD4 is disabled. 71 | #endif 72 | 73 | /* 74 | * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 75 | * ! MD4_LONG has to be at least 32 bits wide. If it's wider, then ! 76 | * ! MD4_LONG_LOG2 has to be defined along. ! 77 | * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 78 | */ 79 | 80 | #if defined(__LP32__) 81 | #define MD4_LONG unsigned long 82 | #elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__) 83 | #define MD4_LONG unsigned long 84 | #define MD4_LONG_LOG2 3 85 | /* 86 | * _CRAY note. I could declare short, but I have no idea what impact 87 | * does it have on performance on none-T3E machines. I could declare 88 | * int, but at least on C90 sizeof(int) can be chosen at compile time. 89 | * So I've chosen long... 90 | * 91 | */ 92 | #else 93 | #define MD4_LONG unsigned int 94 | #endif 95 | 96 | #define MD4_CBLOCK 64 97 | #define MD4_LBLOCK (MD4_CBLOCK/4) 98 | #define MD4_DIGEST_LENGTH 16 99 | 100 | typedef struct MD4state_st 101 | { 102 | MD4_LONG A,B,C,D; 103 | MD4_LONG Nl,Nh; 104 | MD4_LONG data[MD4_LBLOCK]; 105 | unsigned int num; 106 | } MD4_CTX; 107 | 108 | #ifdef OPENSSL_FIPS 109 | int private_MD4_Init(MD4_CTX *c); 110 | #endif 111 | int MD4_Init(MD4_CTX *c); 112 | int MD4_Update(MD4_CTX *c, const void *data, size_t len); 113 | int MD4_Final(unsigned char *md, MD4_CTX *c); 114 | unsigned char *MD4(const unsigned char *d, size_t n, unsigned char *md); 115 | void MD4_Transform(MD4_CTX *c, const unsigned char *b); 116 | #ifdef __cplusplus 117 | } 118 | #endif 119 | 120 | #endif 121 | -------------------------------------------------------------------------------- /jni/android-libs/headers/openssl/md5.h: -------------------------------------------------------------------------------- 1 | /* crypto/md5/md5.h */ 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 | * All rights reserved. 4 | * 5 | * This package is an SSL implementation written 6 | * by Eric Young (eay@cryptsoft.com). 7 | * The implementation was written so as to conform with Netscapes SSL. 8 | * 9 | * This library is free for commercial and non-commercial use as long as 10 | * the following conditions are aheared to. The following conditions 11 | * apply to all code found in this distribution, be it the RC4, RSA, 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation 13 | * included with this distribution is covered by the same copyright terms 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15 | * 16 | * Copyright remains Eric Young's, and as such any Copyright notices in 17 | * the code are not to be removed. 18 | * If this package is used in a product, Eric Young should be given attribution 19 | * as the author of the parts of the library used. 20 | * This can be in the form of a textual message at program startup or 21 | * in documentation (online or textual) provided with the package. 22 | * 23 | * Redistribution and use in source and binary forms, with or without 24 | * modification, are permitted provided that the following conditions 25 | * are met: 26 | * 1. Redistributions of source code must retain the copyright 27 | * notice, this list of conditions and the following disclaimer. 28 | * 2. Redistributions in binary form must reproduce the above copyright 29 | * notice, this list of conditions and the following disclaimer in the 30 | * documentation and/or other materials provided with the distribution. 31 | * 3. All advertising materials mentioning features or use of this software 32 | * must display the following acknowledgement: 33 | * "This product includes cryptographic software written by 34 | * Eric Young (eay@cryptsoft.com)" 35 | * The word 'cryptographic' can be left out if the rouines from the library 36 | * being used are not cryptographic related :-). 37 | * 4. If you include any Windows specific code (or a derivative thereof) from 38 | * the apps directory (application code) you must include an acknowledgement: 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40 | * 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51 | * SUCH DAMAGE. 52 | * 53 | * The licence and distribution terms for any publically available version or 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be 55 | * copied and put under another distribution licence 56 | * [including the GNU Public Licence.] 57 | */ 58 | 59 | #ifndef HEADER_MD5_H 60 | #define HEADER_MD5_H 61 | 62 | #include 63 | #include 64 | 65 | #ifdef __cplusplus 66 | extern "C" { 67 | #endif 68 | 69 | #ifdef OPENSSL_NO_MD5 70 | #error MD5 is disabled. 71 | #endif 72 | 73 | /* 74 | * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 75 | * ! MD5_LONG has to be at least 32 bits wide. If it's wider, then ! 76 | * ! MD5_LONG_LOG2 has to be defined along. ! 77 | * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 78 | */ 79 | 80 | #if defined(__LP32__) 81 | #define MD5_LONG unsigned long 82 | #elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__) 83 | #define MD5_LONG unsigned long 84 | #define MD5_LONG_LOG2 3 85 | /* 86 | * _CRAY note. I could declare short, but I have no idea what impact 87 | * does it have on performance on none-T3E machines. I could declare 88 | * int, but at least on C90 sizeof(int) can be chosen at compile time. 89 | * So I've chosen long... 90 | * 91 | */ 92 | #else 93 | #define MD5_LONG unsigned int 94 | #endif 95 | 96 | #define MD5_CBLOCK 64 97 | #define MD5_LBLOCK (MD5_CBLOCK/4) 98 | #define MD5_DIGEST_LENGTH 16 99 | 100 | typedef struct MD5state_st 101 | { 102 | MD5_LONG A,B,C,D; 103 | MD5_LONG Nl,Nh; 104 | MD5_LONG data[MD5_LBLOCK]; 105 | unsigned int num; 106 | } MD5_CTX; 107 | 108 | #ifdef OPENSSL_FIPS 109 | int private_MD5_Init(MD5_CTX *c); 110 | #endif 111 | int MD5_Init(MD5_CTX *c); 112 | int MD5_Update(MD5_CTX *c, const void *data, size_t len); 113 | int MD5_Final(unsigned char *md, MD5_CTX *c); 114 | unsigned char *MD5(const unsigned char *d, size_t n, unsigned char *md); 115 | void MD5_Transform(MD5_CTX *c, const unsigned char *b); 116 | #ifdef __cplusplus 117 | } 118 | #endif 119 | 120 | #endif 121 | -------------------------------------------------------------------------------- /jni/android-libs/headers/openssl/modes.h: -------------------------------------------------------------------------------- 1 | /* ==================================================================== 2 | * Copyright (c) 2008 The OpenSSL Project. All rights reserved. 3 | * 4 | * Rights for redistribution and usage in source and binary 5 | * forms are granted according to the OpenSSL license. 6 | */ 7 | 8 | #include 9 | 10 | typedef void (*block128_f)(const unsigned char in[16], 11 | unsigned char out[16], 12 | const void *key); 13 | 14 | typedef void (*cbc128_f)(const unsigned char *in, unsigned char *out, 15 | size_t len, const void *key, 16 | unsigned char ivec[16], int enc); 17 | 18 | typedef void (*ctr128_f)(const unsigned char *in, unsigned char *out, 19 | size_t blocks, const void *key, 20 | const unsigned char ivec[16]); 21 | 22 | typedef void (*ccm128_f)(const unsigned char *in, unsigned char *out, 23 | size_t blocks, const void *key, 24 | const unsigned char ivec[16],unsigned char cmac[16]); 25 | 26 | void CRYPTO_cbc128_encrypt(const unsigned char *in, unsigned char *out, 27 | size_t len, const void *key, 28 | unsigned char ivec[16], block128_f block); 29 | void CRYPTO_cbc128_decrypt(const unsigned char *in, unsigned char *out, 30 | size_t len, const void *key, 31 | unsigned char ivec[16], block128_f block); 32 | 33 | void CRYPTO_ctr128_encrypt(const unsigned char *in, unsigned char *out, 34 | size_t len, const void *key, 35 | unsigned char ivec[16], unsigned char ecount_buf[16], 36 | unsigned int *num, block128_f block); 37 | 38 | void CRYPTO_ctr128_encrypt_ctr32(const unsigned char *in, unsigned char *out, 39 | size_t len, const void *key, 40 | unsigned char ivec[16], unsigned char ecount_buf[16], 41 | unsigned int *num, ctr128_f ctr); 42 | 43 | void CRYPTO_ofb128_encrypt(const unsigned char *in, unsigned char *out, 44 | size_t len, const void *key, 45 | unsigned char ivec[16], int *num, 46 | block128_f block); 47 | 48 | void CRYPTO_cfb128_encrypt(const unsigned char *in, unsigned char *out, 49 | size_t len, const void *key, 50 | unsigned char ivec[16], int *num, 51 | int enc, block128_f block); 52 | void CRYPTO_cfb128_8_encrypt(const unsigned char *in, unsigned char *out, 53 | size_t length, const void *key, 54 | unsigned char ivec[16], int *num, 55 | int enc, block128_f block); 56 | void CRYPTO_cfb128_1_encrypt(const unsigned char *in, unsigned char *out, 57 | size_t bits, const void *key, 58 | unsigned char ivec[16], int *num, 59 | int enc, block128_f block); 60 | 61 | size_t CRYPTO_cts128_encrypt_block(const unsigned char *in, unsigned char *out, 62 | size_t len, const void *key, 63 | unsigned char ivec[16], block128_f block); 64 | size_t CRYPTO_cts128_encrypt(const unsigned char *in, unsigned char *out, 65 | size_t len, const void *key, 66 | unsigned char ivec[16], cbc128_f cbc); 67 | size_t CRYPTO_cts128_decrypt_block(const unsigned char *in, unsigned char *out, 68 | size_t len, const void *key, 69 | unsigned char ivec[16], block128_f block); 70 | size_t CRYPTO_cts128_decrypt(const unsigned char *in, unsigned char *out, 71 | size_t len, const void *key, 72 | unsigned char ivec[16], cbc128_f cbc); 73 | 74 | size_t CRYPTO_nistcts128_encrypt_block(const unsigned char *in, unsigned char *out, 75 | size_t len, const void *key, 76 | unsigned char ivec[16], block128_f block); 77 | size_t CRYPTO_nistcts128_encrypt(const unsigned char *in, unsigned char *out, 78 | size_t len, const void *key, 79 | unsigned char ivec[16], cbc128_f cbc); 80 | size_t CRYPTO_nistcts128_decrypt_block(const unsigned char *in, unsigned char *out, 81 | size_t len, const void *key, 82 | unsigned char ivec[16], block128_f block); 83 | size_t CRYPTO_nistcts128_decrypt(const unsigned char *in, unsigned char *out, 84 | size_t len, const void *key, 85 | unsigned char ivec[16], cbc128_f cbc); 86 | 87 | typedef struct gcm128_context GCM128_CONTEXT; 88 | 89 | GCM128_CONTEXT *CRYPTO_gcm128_new(void *key, block128_f block); 90 | void CRYPTO_gcm128_init(GCM128_CONTEXT *ctx,void *key,block128_f block); 91 | void CRYPTO_gcm128_setiv(GCM128_CONTEXT *ctx, const unsigned char *iv, 92 | size_t len); 93 | int CRYPTO_gcm128_aad(GCM128_CONTEXT *ctx, const unsigned char *aad, 94 | size_t len); 95 | int CRYPTO_gcm128_encrypt(GCM128_CONTEXT *ctx, 96 | const unsigned char *in, unsigned char *out, 97 | size_t len); 98 | int CRYPTO_gcm128_decrypt(GCM128_CONTEXT *ctx, 99 | const unsigned char *in, unsigned char *out, 100 | size_t len); 101 | int CRYPTO_gcm128_encrypt_ctr32(GCM128_CONTEXT *ctx, 102 | const unsigned char *in, unsigned char *out, 103 | size_t len, ctr128_f stream); 104 | int CRYPTO_gcm128_decrypt_ctr32(GCM128_CONTEXT *ctx, 105 | const unsigned char *in, unsigned char *out, 106 | size_t len, ctr128_f stream); 107 | int CRYPTO_gcm128_finish(GCM128_CONTEXT *ctx,const unsigned char *tag, 108 | size_t len); 109 | void CRYPTO_gcm128_tag(GCM128_CONTEXT *ctx, unsigned char *tag, size_t len); 110 | void CRYPTO_gcm128_release(GCM128_CONTEXT *ctx); 111 | 112 | typedef struct ccm128_context CCM128_CONTEXT; 113 | 114 | void CRYPTO_ccm128_init(CCM128_CONTEXT *ctx, 115 | unsigned int M, unsigned int L, void *key,block128_f block); 116 | int CRYPTO_ccm128_setiv(CCM128_CONTEXT *ctx, 117 | const unsigned char *nonce, size_t nlen, size_t mlen); 118 | void CRYPTO_ccm128_aad(CCM128_CONTEXT *ctx, 119 | const unsigned char *aad, size_t alen); 120 | int CRYPTO_ccm128_encrypt(CCM128_CONTEXT *ctx, 121 | const unsigned char *inp, unsigned char *out, size_t len); 122 | int CRYPTO_ccm128_decrypt(CCM128_CONTEXT *ctx, 123 | const unsigned char *inp, unsigned char *out, size_t len); 124 | int CRYPTO_ccm128_encrypt_ccm64(CCM128_CONTEXT *ctx, 125 | const unsigned char *inp, unsigned char *out, size_t len, 126 | ccm128_f stream); 127 | int CRYPTO_ccm128_decrypt_ccm64(CCM128_CONTEXT *ctx, 128 | const unsigned char *inp, unsigned char *out, size_t len, 129 | ccm128_f stream); 130 | size_t CRYPTO_ccm128_tag(CCM128_CONTEXT *ctx, unsigned char *tag, size_t len); 131 | 132 | typedef struct xts128_context XTS128_CONTEXT; 133 | 134 | int CRYPTO_xts128_encrypt(const XTS128_CONTEXT *ctx, const unsigned char iv[16], 135 | const unsigned char *inp, unsigned char *out, size_t len, int enc); 136 | -------------------------------------------------------------------------------- /jni/android-libs/headers/openssl/opensslconf.h: -------------------------------------------------------------------------------- 1 | /* opensslconf.h */ 2 | /* WARNING: Generated automatically from opensslconf.h.in by Configure. */ 3 | 4 | /* OpenSSL was configured with the following options: */ 5 | #ifndef OPENSSL_DOING_MAKEDEPEND 6 | 7 | 8 | #ifndef OPENSSL_NO_CAST 9 | # define OPENSSL_NO_CAST 10 | #endif 11 | #ifndef OPENSSL_NO_EC_NISTP_64_GCC_128 12 | # define OPENSSL_NO_EC_NISTP_64_GCC_128 13 | #endif 14 | #ifndef OPENSSL_NO_GMP 15 | # define OPENSSL_NO_GMP 16 | #endif 17 | #ifndef OPENSSL_NO_IDEA 18 | # define OPENSSL_NO_IDEA 19 | #endif 20 | #ifndef OPENSSL_NO_JPAKE 21 | # define OPENSSL_NO_JPAKE 22 | #endif 23 | #ifndef OPENSSL_NO_KRB5 24 | # define OPENSSL_NO_KRB5 25 | #endif 26 | #ifndef OPENSSL_NO_MD2 27 | # define OPENSSL_NO_MD2 28 | #endif 29 | #ifndef OPENSSL_NO_RC5 30 | # define OPENSSL_NO_RC5 31 | #endif 32 | #ifndef OPENSSL_NO_RFC3779 33 | # define OPENSSL_NO_RFC3779 34 | #endif 35 | #ifndef OPENSSL_NO_SCTP 36 | # define OPENSSL_NO_SCTP 37 | #endif 38 | #ifndef OPENSSL_NO_SEED 39 | # define OPENSSL_NO_SEED 40 | #endif 41 | #ifndef OPENSSL_NO_SHA0 42 | # define OPENSSL_NO_SHA0 43 | #endif 44 | #ifndef OPENSSL_NO_STORE 45 | # define OPENSSL_NO_STORE 46 | #endif 47 | #ifndef OPENSSL_NO_WHRLPOOL 48 | # define OPENSSL_NO_WHRLPOOL 49 | #endif 50 | 51 | #endif /* OPENSSL_DOING_MAKEDEPEND */ 52 | 53 | #ifndef OPENSSL_THREADS 54 | # define OPENSSL_THREADS 55 | #endif 56 | #ifndef OPENSSL_NO_DYNAMIC_ENGINE 57 | # define OPENSSL_NO_DYNAMIC_ENGINE 58 | #endif 59 | 60 | /* The OPENSSL_NO_* macros are also defined as NO_* if the application 61 | asks for it. This is a transient feature that is provided for those 62 | who haven't had the time to do the appropriate changes in their 63 | applications. */ 64 | #ifdef OPENSSL_ALGORITHM_DEFINES 65 | # if defined(OPENSSL_NO_CAST) && !defined(NO_CAST) 66 | # define NO_CAST 67 | # endif 68 | # if defined(OPENSSL_NO_EC_NISTP_64_GCC_128) && !defined(NO_EC_NISTP_64_GCC_128) 69 | # define NO_EC_NISTP_64_GCC_128 70 | # endif 71 | # if defined(OPENSSL_NO_GMP) && !defined(NO_GMP) 72 | # define NO_GMP 73 | # endif 74 | # if defined(OPENSSL_NO_IDEA) && !defined(NO_IDEA) 75 | # define NO_IDEA 76 | # endif 77 | # if defined(OPENSSL_NO_JPAKE) && !defined(NO_JPAKE) 78 | # define NO_JPAKE 79 | # endif 80 | # if defined(OPENSSL_NO_KRB5) && !defined(NO_KRB5) 81 | # define NO_KRB5 82 | # endif 83 | # if defined(OPENSSL_NO_MD2) && !defined(NO_MD2) 84 | # define NO_MD2 85 | # endif 86 | # if defined(OPENSSL_NO_RC5) && !defined(NO_RC5) 87 | # define NO_RC5 88 | # endif 89 | # if defined(OPENSSL_NO_RFC3779) && !defined(NO_RFC3779) 90 | # define NO_RFC3779 91 | # endif 92 | # if defined(OPENSSL_NO_SCTP) && !defined(NO_SCTP) 93 | # define NO_SCTP 94 | # endif 95 | # if defined(OPENSSL_NO_SEED) && !defined(NO_SEED) 96 | # define NO_SEED 97 | # endif 98 | # if defined(OPENSSL_NO_SHA0) && !defined(NO_SHA0) 99 | # define NO_SHA0 100 | # endif 101 | # if defined(OPENSSL_NO_STORE) && !defined(NO_STORE) 102 | # define NO_STORE 103 | # endif 104 | # if defined(OPENSSL_NO_WHRLPOOL) && !defined(NO_WHRLPOOL) 105 | # define NO_WHRLPOOL 106 | # endif 107 | #endif 108 | 109 | /* crypto/opensslconf.h.in */ 110 | 111 | /* Generate 80386 code? */ 112 | #undef I386_ONLY 113 | 114 | #if !(defined(VMS) || defined(__VMS)) /* VMS uses logical names instead */ 115 | #if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR) 116 | #define ENGINESDIR "/usr/local/ssl/lib/engines" 117 | #define OPENSSLDIR "/usr/local/ssl" 118 | #endif 119 | #endif 120 | 121 | #undef OPENSSL_UNISTD 122 | #define OPENSSL_UNISTD 123 | 124 | #undef OPENSSL_EXPORT_VAR_AS_FUNCTION 125 | 126 | #if defined(HEADER_IDEA_H) && !defined(IDEA_INT) 127 | #define IDEA_INT unsigned int 128 | #endif 129 | 130 | #if defined(HEADER_MD2_H) && !defined(MD2_INT) 131 | #define MD2_INT unsigned int 132 | #endif 133 | 134 | #if defined(HEADER_RC2_H) && !defined(RC2_INT) 135 | /* I need to put in a mod for the alpha - eay */ 136 | #define RC2_INT unsigned int 137 | #endif 138 | 139 | #if defined(HEADER_RC4_H) 140 | #if !defined(RC4_INT) 141 | /* using int types make the structure larger but make the code faster 142 | * on most boxes I have tested - up to %20 faster. */ 143 | /* 144 | * I don't know what does "most" mean, but declaring "int" is a must on: 145 | * - Intel P6 because partial register stalls are very expensive; 146 | * - elder Alpha because it lacks byte load/store instructions; 147 | */ 148 | #define RC4_INT unsigned char 149 | #endif 150 | #if !defined(RC4_CHUNK) 151 | /* 152 | * This enables code handling data aligned at natural CPU word 153 | * boundary. See crypto/rc4/rc4_enc.c for further details. 154 | */ 155 | #define RC4_CHUNK unsigned long 156 | #endif 157 | #endif 158 | 159 | #if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG) 160 | /* If this is set to 'unsigned int' on a DEC Alpha, this gives about a 161 | * %20 speed up (longs are 8 bytes, int's are 4). */ 162 | #ifndef DES_LONG 163 | #define DES_LONG unsigned int 164 | #endif 165 | #endif 166 | 167 | #if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H) 168 | #define CONFIG_HEADER_BN_H 169 | #define BN_LLONG 170 | 171 | /* Should we define BN_DIV2W here? */ 172 | 173 | /* Only one for the following should be defined */ 174 | #undef SIXTY_FOUR_BIT_LONG 175 | #undef SIXTY_FOUR_BIT 176 | #define THIRTY_TWO_BIT 177 | #endif 178 | 179 | #if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H) 180 | #define CONFIG_HEADER_RC4_LOCL_H 181 | /* if this is defined data[i] is used instead of *data, this is a %20 182 | * speedup on x86 */ 183 | #undef RC4_INDEX 184 | #endif 185 | 186 | #if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H) 187 | #define CONFIG_HEADER_BF_LOCL_H 188 | #define BF_PTR 189 | #endif /* HEADER_BF_LOCL_H */ 190 | 191 | #if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H) 192 | #define CONFIG_HEADER_DES_LOCL_H 193 | #ifndef DES_DEFAULT_OPTIONS 194 | /* the following is tweaked from a config script, that is why it is a 195 | * protected undef/define */ 196 | #ifndef DES_PTR 197 | #undef DES_PTR 198 | #endif 199 | 200 | /* This helps C compiler generate the correct code for multiple functional 201 | * units. It reduces register dependancies at the expense of 2 more 202 | * registers */ 203 | #ifndef DES_RISC1 204 | #undef DES_RISC1 205 | #endif 206 | 207 | #ifndef DES_RISC2 208 | #undef DES_RISC2 209 | #endif 210 | 211 | #if defined(DES_RISC1) && defined(DES_RISC2) 212 | YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!! 213 | #endif 214 | 215 | /* Unroll the inner loop, this sometimes helps, sometimes hinders. 216 | * Very mucy CPU dependant */ 217 | #ifndef DES_UNROLL 218 | #define DES_UNROLL 219 | #endif 220 | 221 | /* These default values were supplied by 222 | * Peter Gutman 223 | * They are only used if nothing else has been defined */ 224 | #if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL) 225 | /* Special defines which change the way the code is built depending on the 226 | CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find 227 | even newer MIPS CPU's, but at the moment one size fits all for 228 | optimization options. Older Sparc's work better with only UNROLL, but 229 | there's no way to tell at compile time what it is you're running on */ 230 | 231 | #if defined( sun ) /* Newer Sparc's */ 232 | # define DES_PTR 233 | # define DES_RISC1 234 | # define DES_UNROLL 235 | #elif defined( __ultrix ) /* Older MIPS */ 236 | # define DES_PTR 237 | # define DES_RISC2 238 | # define DES_UNROLL 239 | #elif defined( __osf1__ ) /* Alpha */ 240 | # define DES_PTR 241 | # define DES_RISC2 242 | #elif defined ( _AIX ) /* RS6000 */ 243 | /* Unknown */ 244 | #elif defined( __hpux ) /* HP-PA */ 245 | /* Unknown */ 246 | #elif defined( __aux ) /* 68K */ 247 | /* Unknown */ 248 | #elif defined( __dgux ) /* 88K (but P6 in latest boxes) */ 249 | # define DES_UNROLL 250 | #elif defined( __sgi ) /* Newer MIPS */ 251 | # define DES_PTR 252 | # define DES_RISC2 253 | # define DES_UNROLL 254 | #elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */ 255 | # define DES_PTR 256 | # define DES_RISC1 257 | # define DES_UNROLL 258 | #endif /* Systems-specific speed defines */ 259 | #endif 260 | 261 | #endif /* DES_DEFAULT_OPTIONS */ 262 | #endif /* HEADER_DES_LOCL_H */ 263 | -------------------------------------------------------------------------------- /jni/android-libs/headers/openssl/opensslv.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_OPENSSLV_H 2 | #define HEADER_OPENSSLV_H 3 | 4 | /* Numeric release version identifier: 5 | * MNNFFPPS: major minor fix patch status 6 | * The status nibble has one of the values 0 for development, 1 to e for betas 7 | * 1 to 14, and f for release. The patch level is exactly that. 8 | * For example: 9 | * 0.9.3-dev 0x00903000 10 | * 0.9.3-beta1 0x00903001 11 | * 0.9.3-beta2-dev 0x00903002 12 | * 0.9.3-beta2 0x00903002 (same as ...beta2-dev) 13 | * 0.9.3 0x0090300f 14 | * 0.9.3a 0x0090301f 15 | * 0.9.4 0x0090400f 16 | * 1.2.3z 0x102031af 17 | * 18 | * For continuity reasons (because 0.9.5 is already out, and is coded 19 | * 0x00905100), between 0.9.5 and 0.9.6 the coding of the patch level 20 | * part is slightly different, by setting the highest bit. This means 21 | * that 0.9.5a looks like this: 0x0090581f. At 0.9.6, we can start 22 | * with 0x0090600S... 23 | * 24 | * (Prior to 0.9.3-dev a different scheme was used: 0.9.2b is 0x0922.) 25 | * (Prior to 0.9.5a beta1, a different scheme was used: MMNNFFRBB for 26 | * major minor fix final patch/beta) 27 | */ 28 | #define OPENSSL_VERSION_NUMBER 0x1000103fL 29 | #ifdef OPENSSL_FIPS 30 | #define OPENSSL_VERSION_TEXT "OpenSSL 1.0.1c-fips 10 May 2012" 31 | #else 32 | #define OPENSSL_VERSION_TEXT "OpenSSL 1.0.1c 10 May 2012" 33 | #endif 34 | #define OPENSSL_VERSION_PTEXT " part of " OPENSSL_VERSION_TEXT 35 | 36 | 37 | /* The macros below are to be used for shared library (.so, .dll, ...) 38 | * versioning. That kind of versioning works a bit differently between 39 | * operating systems. The most usual scheme is to set a major and a minor 40 | * number, and have the runtime loader check that the major number is equal 41 | * to what it was at application link time, while the minor number has to 42 | * be greater or equal to what it was at application link time. With this 43 | * scheme, the version number is usually part of the file name, like this: 44 | * 45 | * libcrypto.so.0.9 46 | * 47 | * Some unixen also make a softlink with the major verson number only: 48 | * 49 | * libcrypto.so.0 50 | * 51 | * On Tru64 and IRIX 6.x it works a little bit differently. There, the 52 | * shared library version is stored in the file, and is actually a series 53 | * of versions, separated by colons. The rightmost version present in the 54 | * library when linking an application is stored in the application to be 55 | * matched at run time. When the application is run, a check is done to 56 | * see if the library version stored in the application matches any of the 57 | * versions in the version string of the library itself. 58 | * This version string can be constructed in any way, depending on what 59 | * kind of matching is desired. However, to implement the same scheme as 60 | * the one used in the other unixen, all compatible versions, from lowest 61 | * to highest, should be part of the string. Consecutive builds would 62 | * give the following versions strings: 63 | * 64 | * 3.0 65 | * 3.0:3.1 66 | * 3.0:3.1:3.2 67 | * 4.0 68 | * 4.0:4.1 69 | * 70 | * Notice how version 4 is completely incompatible with version, and 71 | * therefore give the breach you can see. 72 | * 73 | * There may be other schemes as well that I haven't yet discovered. 74 | * 75 | * So, here's the way it works here: first of all, the library version 76 | * number doesn't need at all to match the overall OpenSSL version. 77 | * However, it's nice and more understandable if it actually does. 78 | * The current library version is stored in the macro SHLIB_VERSION_NUMBER, 79 | * which is just a piece of text in the format "M.m.e" (Major, minor, edit). 80 | * For the sake of Tru64, IRIX, and any other OS that behaves in similar ways, 81 | * we need to keep a history of version numbers, which is done in the 82 | * macro SHLIB_VERSION_HISTORY. The numbers are separated by colons and 83 | * should only keep the versions that are binary compatible with the current. 84 | */ 85 | #define SHLIB_VERSION_HISTORY "" 86 | #define SHLIB_VERSION_NUMBER "1.0.0" 87 | 88 | 89 | #endif /* HEADER_OPENSSLV_H */ 90 | -------------------------------------------------------------------------------- /jni/android-libs/headers/openssl/ossl_typ.h: -------------------------------------------------------------------------------- 1 | /* ==================================================================== 2 | * Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in 13 | * the documentation and/or other materials provided with the 14 | * distribution. 15 | * 16 | * 3. All advertising materials mentioning features or use of this 17 | * software must display the following acknowledgment: 18 | * "This product includes software developed by the OpenSSL Project 19 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" 20 | * 21 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 22 | * endorse or promote products derived from this software without 23 | * prior written permission. For written permission, please contact 24 | * openssl-core@openssl.org. 25 | * 26 | * 5. Products derived from this software may not be called "OpenSSL" 27 | * nor may "OpenSSL" appear in their names without prior written 28 | * permission of the OpenSSL Project. 29 | * 30 | * 6. Redistributions of any form whatsoever must retain the following 31 | * acknowledgment: 32 | * "This product includes software developed by the OpenSSL Project 33 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" 34 | * 35 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 36 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 37 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 38 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 39 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 40 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 41 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 42 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 43 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 44 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 45 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 46 | * OF THE POSSIBILITY OF SUCH DAMAGE. 47 | * ==================================================================== 48 | * 49 | * This product includes cryptographic software written by Eric Young 50 | * (eay@cryptsoft.com). This product includes software written by Tim 51 | * Hudson (tjh@cryptsoft.com). 52 | * 53 | */ 54 | 55 | #ifndef HEADER_OPENSSL_TYPES_H 56 | #define HEADER_OPENSSL_TYPES_H 57 | 58 | #include 59 | 60 | #ifdef NO_ASN1_TYPEDEFS 61 | #define ASN1_INTEGER ASN1_STRING 62 | #define ASN1_ENUMERATED ASN1_STRING 63 | #define ASN1_BIT_STRING ASN1_STRING 64 | #define ASN1_OCTET_STRING ASN1_STRING 65 | #define ASN1_PRINTABLESTRING ASN1_STRING 66 | #define ASN1_T61STRING ASN1_STRING 67 | #define ASN1_IA5STRING ASN1_STRING 68 | #define ASN1_UTCTIME ASN1_STRING 69 | #define ASN1_GENERALIZEDTIME ASN1_STRING 70 | #define ASN1_TIME ASN1_STRING 71 | #define ASN1_GENERALSTRING ASN1_STRING 72 | #define ASN1_UNIVERSALSTRING ASN1_STRING 73 | #define ASN1_BMPSTRING ASN1_STRING 74 | #define ASN1_VISIBLESTRING ASN1_STRING 75 | #define ASN1_UTF8STRING ASN1_STRING 76 | #define ASN1_BOOLEAN int 77 | #define ASN1_NULL int 78 | #else 79 | typedef struct asn1_string_st ASN1_INTEGER; 80 | typedef struct asn1_string_st ASN1_ENUMERATED; 81 | typedef struct asn1_string_st ASN1_BIT_STRING; 82 | typedef struct asn1_string_st ASN1_OCTET_STRING; 83 | typedef struct asn1_string_st ASN1_PRINTABLESTRING; 84 | typedef struct asn1_string_st ASN1_T61STRING; 85 | typedef struct asn1_string_st ASN1_IA5STRING; 86 | typedef struct asn1_string_st ASN1_GENERALSTRING; 87 | typedef struct asn1_string_st ASN1_UNIVERSALSTRING; 88 | typedef struct asn1_string_st ASN1_BMPSTRING; 89 | typedef struct asn1_string_st ASN1_UTCTIME; 90 | typedef struct asn1_string_st ASN1_TIME; 91 | typedef struct asn1_string_st ASN1_GENERALIZEDTIME; 92 | typedef struct asn1_string_st ASN1_VISIBLESTRING; 93 | typedef struct asn1_string_st ASN1_UTF8STRING; 94 | typedef struct asn1_string_st ASN1_STRING; 95 | typedef int ASN1_BOOLEAN; 96 | typedef int ASN1_NULL; 97 | #endif 98 | 99 | typedef struct ASN1_ITEM_st ASN1_ITEM; 100 | typedef struct asn1_pctx_st ASN1_PCTX; 101 | 102 | #ifdef OPENSSL_SYS_WIN32 103 | #undef X509_NAME 104 | #undef X509_EXTENSIONS 105 | #undef X509_CERT_PAIR 106 | #undef PKCS7_ISSUER_AND_SERIAL 107 | #undef OCSP_REQUEST 108 | #undef OCSP_RESPONSE 109 | #endif 110 | 111 | #ifdef BIGNUM 112 | #undef BIGNUM 113 | #endif 114 | typedef struct bignum_st BIGNUM; 115 | typedef struct bignum_ctx BN_CTX; 116 | typedef struct bn_blinding_st BN_BLINDING; 117 | typedef struct bn_mont_ctx_st BN_MONT_CTX; 118 | typedef struct bn_recp_ctx_st BN_RECP_CTX; 119 | typedef struct bn_gencb_st BN_GENCB; 120 | 121 | typedef struct buf_mem_st BUF_MEM; 122 | 123 | typedef struct evp_cipher_st EVP_CIPHER; 124 | typedef struct evp_cipher_ctx_st EVP_CIPHER_CTX; 125 | typedef struct env_md_st EVP_MD; 126 | typedef struct env_md_ctx_st EVP_MD_CTX; 127 | typedef struct evp_pkey_st EVP_PKEY; 128 | 129 | typedef struct evp_pkey_asn1_method_st EVP_PKEY_ASN1_METHOD; 130 | 131 | typedef struct evp_pkey_method_st EVP_PKEY_METHOD; 132 | typedef struct evp_pkey_ctx_st EVP_PKEY_CTX; 133 | 134 | typedef struct dh_st DH; 135 | typedef struct dh_method DH_METHOD; 136 | 137 | typedef struct dsa_st DSA; 138 | typedef struct dsa_method DSA_METHOD; 139 | 140 | typedef struct rsa_st RSA; 141 | typedef struct rsa_meth_st RSA_METHOD; 142 | 143 | typedef struct rand_meth_st RAND_METHOD; 144 | 145 | typedef struct ecdh_method ECDH_METHOD; 146 | typedef struct ecdsa_method ECDSA_METHOD; 147 | 148 | typedef struct x509_st X509; 149 | typedef struct X509_algor_st X509_ALGOR; 150 | typedef struct X509_crl_st X509_CRL; 151 | typedef struct x509_crl_method_st X509_CRL_METHOD; 152 | typedef struct x509_revoked_st X509_REVOKED; 153 | typedef struct X509_name_st X509_NAME; 154 | typedef struct X509_pubkey_st X509_PUBKEY; 155 | typedef struct x509_store_st X509_STORE; 156 | typedef struct x509_store_ctx_st X509_STORE_CTX; 157 | 158 | typedef struct pkcs8_priv_key_info_st PKCS8_PRIV_KEY_INFO; 159 | 160 | typedef struct v3_ext_ctx X509V3_CTX; 161 | typedef struct conf_st CONF; 162 | 163 | typedef struct store_st STORE; 164 | typedef struct store_method_st STORE_METHOD; 165 | 166 | typedef struct ui_st UI; 167 | typedef struct ui_method_st UI_METHOD; 168 | 169 | typedef struct st_ERR_FNS ERR_FNS; 170 | 171 | typedef struct engine_st ENGINE; 172 | typedef struct ssl_st SSL; 173 | typedef struct ssl_ctx_st SSL_CTX; 174 | 175 | typedef struct X509_POLICY_NODE_st X509_POLICY_NODE; 176 | typedef struct X509_POLICY_LEVEL_st X509_POLICY_LEVEL; 177 | typedef struct X509_POLICY_TREE_st X509_POLICY_TREE; 178 | typedef struct X509_POLICY_CACHE_st X509_POLICY_CACHE; 179 | 180 | typedef struct AUTHORITY_KEYID_st AUTHORITY_KEYID; 181 | typedef struct DIST_POINT_st DIST_POINT; 182 | typedef struct ISSUING_DIST_POINT_st ISSUING_DIST_POINT; 183 | typedef struct NAME_CONSTRAINTS_st NAME_CONSTRAINTS; 184 | 185 | /* If placed in pkcs12.h, we end up with a circular depency with pkcs7.h */ 186 | #define DECLARE_PKCS12_STACK_OF(type) /* Nothing */ 187 | #define IMPLEMENT_PKCS12_STACK_OF(type) /* Nothing */ 188 | 189 | typedef struct crypto_ex_data_st CRYPTO_EX_DATA; 190 | /* Callback types for crypto.h */ 191 | typedef int CRYPTO_EX_new(void *parent, void *ptr, CRYPTO_EX_DATA *ad, 192 | int idx, long argl, void *argp); 193 | typedef void CRYPTO_EX_free(void *parent, void *ptr, CRYPTO_EX_DATA *ad, 194 | int idx, long argl, void *argp); 195 | typedef int CRYPTO_EX_dup(CRYPTO_EX_DATA *to, CRYPTO_EX_DATA *from, void *from_d, 196 | int idx, long argl, void *argp); 197 | 198 | typedef struct ocsp_req_ctx_st OCSP_REQ_CTX; 199 | typedef struct ocsp_response_st OCSP_RESPONSE; 200 | typedef struct ocsp_responder_id_st OCSP_RESPID; 201 | 202 | #endif /* def HEADER_OPENSSL_TYPES_H */ 203 | -------------------------------------------------------------------------------- /jni/android-libs/headers/openssl/pem2.h: -------------------------------------------------------------------------------- 1 | /* ==================================================================== 2 | * Copyright (c) 1999 The OpenSSL Project. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in 13 | * the documentation and/or other materials provided with the 14 | * distribution. 15 | * 16 | * 3. All advertising materials mentioning features or use of this 17 | * software must display the following acknowledgment: 18 | * "This product includes software developed by the OpenSSL Project 19 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" 20 | * 21 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 22 | * endorse or promote products derived from this software without 23 | * prior written permission. For written permission, please contact 24 | * licensing@OpenSSL.org. 25 | * 26 | * 5. Products derived from this software may not be called "OpenSSL" 27 | * nor may "OpenSSL" appear in their names without prior written 28 | * permission of the OpenSSL Project. 29 | * 30 | * 6. Redistributions of any form whatsoever must retain the following 31 | * acknowledgment: 32 | * "This product includes software developed by the OpenSSL Project 33 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" 34 | * 35 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 36 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 37 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 38 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 39 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 40 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 41 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 42 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 43 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 44 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 45 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 46 | * OF THE POSSIBILITY OF SUCH DAMAGE. 47 | * ==================================================================== 48 | * 49 | * This product includes cryptographic software written by Eric Young 50 | * (eay@cryptsoft.com). This product includes software written by Tim 51 | * Hudson (tjh@cryptsoft.com). 52 | * 53 | */ 54 | 55 | /* 56 | * This header only exists to break a circular dependency between pem and err 57 | * Ben 30 Jan 1999. 58 | */ 59 | 60 | #ifdef __cplusplus 61 | extern "C" { 62 | #endif 63 | 64 | #ifndef HEADER_PEM_H 65 | void ERR_load_PEM_strings(void); 66 | #endif 67 | 68 | #ifdef __cplusplus 69 | } 70 | #endif 71 | -------------------------------------------------------------------------------- /jni/android-libs/headers/openssl/pqueue.h: -------------------------------------------------------------------------------- 1 | /* crypto/pqueue/pqueue.h */ 2 | /* 3 | * DTLS implementation written by Nagendra Modadugu 4 | * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. 5 | */ 6 | /* ==================================================================== 7 | * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 16 | * 2. Redistributions in binary form must reproduce the above copyright 17 | * notice, this list of conditions and the following disclaimer in 18 | * the documentation and/or other materials provided with the 19 | * distribution. 20 | * 21 | * 3. All advertising materials mentioning features or use of this 22 | * software must display the following acknowledgment: 23 | * "This product includes software developed by the OpenSSL Project 24 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" 25 | * 26 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 27 | * endorse or promote products derived from this software without 28 | * prior written permission. For written permission, please contact 29 | * openssl-core@OpenSSL.org. 30 | * 31 | * 5. Products derived from this software may not be called "OpenSSL" 32 | * nor may "OpenSSL" appear in their names without prior written 33 | * permission of the OpenSSL Project. 34 | * 35 | * 6. Redistributions of any form whatsoever must retain the following 36 | * acknowledgment: 37 | * "This product includes software developed by the OpenSSL Project 38 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" 39 | * 40 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 41 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 42 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 43 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 44 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 45 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 46 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 47 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 49 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 50 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 51 | * OF THE POSSIBILITY OF SUCH DAMAGE. 52 | * ==================================================================== 53 | * 54 | * This product includes cryptographic software written by Eric Young 55 | * (eay@cryptsoft.com). This product includes software written by Tim 56 | * Hudson (tjh@cryptsoft.com). 57 | * 58 | */ 59 | 60 | #ifndef HEADER_PQUEUE_H 61 | #define HEADER_PQUEUE_H 62 | 63 | #include 64 | #include 65 | #include 66 | 67 | typedef struct _pqueue *pqueue; 68 | 69 | typedef struct _pitem 70 | { 71 | unsigned char priority[8]; /* 64-bit value in big-endian encoding */ 72 | void *data; 73 | struct _pitem *next; 74 | } pitem; 75 | 76 | typedef struct _pitem *piterator; 77 | 78 | pitem *pitem_new(unsigned char *prio64be, void *data); 79 | void pitem_free(pitem *item); 80 | 81 | pqueue pqueue_new(void); 82 | void pqueue_free(pqueue pq); 83 | 84 | pitem *pqueue_insert(pqueue pq, pitem *item); 85 | pitem *pqueue_peek(pqueue pq); 86 | pitem *pqueue_pop(pqueue pq); 87 | pitem *pqueue_find(pqueue pq, unsigned char *prio64be); 88 | pitem *pqueue_iterator(pqueue pq); 89 | pitem *pqueue_next(piterator *iter); 90 | 91 | void pqueue_print(pqueue pq); 92 | int pqueue_size(pqueue pq); 93 | 94 | #endif /* ! HEADER_PQUEUE_H */ 95 | -------------------------------------------------------------------------------- /jni/android-libs/headers/openssl/rand.h: -------------------------------------------------------------------------------- 1 | /* crypto/rand/rand.h */ 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 | * All rights reserved. 4 | * 5 | * This package is an SSL implementation written 6 | * by Eric Young (eay@cryptsoft.com). 7 | * The implementation was written so as to conform with Netscapes SSL. 8 | * 9 | * This library is free for commercial and non-commercial use as long as 10 | * the following conditions are aheared to. The following conditions 11 | * apply to all code found in this distribution, be it the RC4, RSA, 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation 13 | * included with this distribution is covered by the same copyright terms 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15 | * 16 | * Copyright remains Eric Young's, and as such any Copyright notices in 17 | * the code are not to be removed. 18 | * If this package is used in a product, Eric Young should be given attribution 19 | * as the author of the parts of the library used. 20 | * This can be in the form of a textual message at program startup or 21 | * in documentation (online or textual) provided with the package. 22 | * 23 | * Redistribution and use in source and binary forms, with or without 24 | * modification, are permitted provided that the following conditions 25 | * are met: 26 | * 1. Redistributions of source code must retain the copyright 27 | * notice, this list of conditions and the following disclaimer. 28 | * 2. Redistributions in binary form must reproduce the above copyright 29 | * notice, this list of conditions and the following disclaimer in the 30 | * documentation and/or other materials provided with the distribution. 31 | * 3. All advertising materials mentioning features or use of this software 32 | * must display the following acknowledgement: 33 | * "This product includes cryptographic software written by 34 | * Eric Young (eay@cryptsoft.com)" 35 | * The word 'cryptographic' can be left out if the rouines from the library 36 | * being used are not cryptographic related :-). 37 | * 4. If you include any Windows specific code (or a derivative thereof) from 38 | * the apps directory (application code) you must include an acknowledgement: 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40 | * 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51 | * SUCH DAMAGE. 52 | * 53 | * The licence and distribution terms for any publically available version or 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be 55 | * copied and put under another distribution licence 56 | * [including the GNU Public Licence.] 57 | */ 58 | 59 | #ifndef HEADER_RAND_H 60 | #define HEADER_RAND_H 61 | 62 | #include 63 | #include 64 | #include 65 | 66 | #if defined(OPENSSL_SYS_WINDOWS) 67 | #include 68 | #endif 69 | 70 | #ifdef __cplusplus 71 | extern "C" { 72 | #endif 73 | 74 | #if defined(OPENSSL_FIPS) 75 | #define FIPS_RAND_SIZE_T size_t 76 | #endif 77 | 78 | /* Already defined in ossl_typ.h */ 79 | /* typedef struct rand_meth_st RAND_METHOD; */ 80 | 81 | struct rand_meth_st 82 | { 83 | void (*seed)(const void *buf, int num); 84 | int (*bytes)(unsigned char *buf, int num); 85 | void (*cleanup)(void); 86 | void (*add)(const void *buf, int num, double entropy); 87 | int (*pseudorand)(unsigned char *buf, int num); 88 | int (*status)(void); 89 | }; 90 | 91 | #ifdef BN_DEBUG 92 | extern int rand_predictable; 93 | #endif 94 | 95 | int RAND_set_rand_method(const RAND_METHOD *meth); 96 | const RAND_METHOD *RAND_get_rand_method(void); 97 | #ifndef OPENSSL_NO_ENGINE 98 | int RAND_set_rand_engine(ENGINE *engine); 99 | #endif 100 | RAND_METHOD *RAND_SSLeay(void); 101 | void RAND_cleanup(void ); 102 | int RAND_bytes(unsigned char *buf,int num); 103 | int RAND_pseudo_bytes(unsigned char *buf,int num); 104 | void RAND_seed(const void *buf,int num); 105 | void RAND_add(const void *buf,int num,double entropy); 106 | int RAND_load_file(const char *file,long max_bytes); 107 | int RAND_write_file(const char *file); 108 | const char *RAND_file_name(char *file,size_t num); 109 | int RAND_status(void); 110 | int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes); 111 | int RAND_egd(const char *path); 112 | int RAND_egd_bytes(const char *path,int bytes); 113 | int RAND_poll(void); 114 | 115 | #if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32) 116 | 117 | void RAND_screen(void); 118 | int RAND_event(UINT, WPARAM, LPARAM); 119 | 120 | #endif 121 | 122 | #ifdef OPENSSL_FIPS 123 | void RAND_set_fips_drbg_type(int type, int flags); 124 | int RAND_init_fips(void); 125 | #endif 126 | 127 | /* BEGIN ERROR CODES */ 128 | /* The following lines are auto generated by the script mkerr.pl. Any changes 129 | * made after this point may be overwritten when the script is next run. 130 | */ 131 | void ERR_load_RAND_strings(void); 132 | 133 | /* Error codes for the RAND functions. */ 134 | 135 | /* Function codes. */ 136 | #define RAND_F_RAND_GET_RAND_METHOD 101 137 | #define RAND_F_RAND_INIT_FIPS 102 138 | #define RAND_F_SSLEAY_RAND_BYTES 100 139 | 140 | /* Reason codes. */ 141 | #define RAND_R_ERROR_INITIALISING_DRBG 102 142 | #define RAND_R_ERROR_INSTANTIATING_DRBG 103 143 | #define RAND_R_NO_FIPS_RANDOM_METHOD_SET 101 144 | #define RAND_R_PRNG_NOT_SEEDED 100 145 | 146 | #ifdef __cplusplus 147 | } 148 | #endif 149 | #endif 150 | -------------------------------------------------------------------------------- /jni/android-libs/headers/openssl/rc2.h: -------------------------------------------------------------------------------- 1 | /* crypto/rc2/rc2.h */ 2 | /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) 3 | * All rights reserved. 4 | * 5 | * This package is an SSL implementation written 6 | * by Eric Young (eay@cryptsoft.com). 7 | * The implementation was written so as to conform with Netscapes SSL. 8 | * 9 | * This library is free for commercial and non-commercial use as long as 10 | * the following conditions are aheared to. The following conditions 11 | * apply to all code found in this distribution, be it the RC4, RSA, 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation 13 | * included with this distribution is covered by the same copyright terms 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15 | * 16 | * Copyright remains Eric Young's, and as such any Copyright notices in 17 | * the code are not to be removed. 18 | * If this package is used in a product, Eric Young should be given attribution 19 | * as the author of the parts of the library used. 20 | * This can be in the form of a textual message at program startup or 21 | * in documentation (online or textual) provided with the package. 22 | * 23 | * Redistribution and use in source and binary forms, with or without 24 | * modification, are permitted provided that the following conditions 25 | * are met: 26 | * 1. Redistributions of source code must retain the copyright 27 | * notice, this list of conditions and the following disclaimer. 28 | * 2. Redistributions in binary form must reproduce the above copyright 29 | * notice, this list of conditions and the following disclaimer in the 30 | * documentation and/or other materials provided with the distribution. 31 | * 3. All advertising materials mentioning features or use of this software 32 | * must display the following acknowledgement: 33 | * "This product includes cryptographic software written by 34 | * Eric Young (eay@cryptsoft.com)" 35 | * The word 'cryptographic' can be left out if the rouines from the library 36 | * being used are not cryptographic related :-). 37 | * 4. If you include any Windows specific code (or a derivative thereof) from 38 | * the apps directory (application code) you must include an acknowledgement: 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40 | * 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51 | * SUCH DAMAGE. 52 | * 53 | * The licence and distribution terms for any publically available version or 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be 55 | * copied and put under another distribution licence 56 | * [including the GNU Public Licence.] 57 | */ 58 | 59 | #ifndef HEADER_RC2_H 60 | #define HEADER_RC2_H 61 | 62 | #include /* OPENSSL_NO_RC2, RC2_INT */ 63 | #ifdef OPENSSL_NO_RC2 64 | #error RC2 is disabled. 65 | #endif 66 | 67 | #define RC2_ENCRYPT 1 68 | #define RC2_DECRYPT 0 69 | 70 | #define RC2_BLOCK 8 71 | #define RC2_KEY_LENGTH 16 72 | 73 | #ifdef __cplusplus 74 | extern "C" { 75 | #endif 76 | 77 | typedef struct rc2_key_st 78 | { 79 | RC2_INT data[64]; 80 | } RC2_KEY; 81 | 82 | #ifdef OPENSSL_FIPS 83 | void private_RC2_set_key(RC2_KEY *key, int len, const unsigned char *data,int bits); 84 | #endif 85 | void RC2_set_key(RC2_KEY *key, int len, const unsigned char *data,int bits); 86 | void RC2_ecb_encrypt(const unsigned char *in,unsigned char *out,RC2_KEY *key, 87 | int enc); 88 | void RC2_encrypt(unsigned long *data,RC2_KEY *key); 89 | void RC2_decrypt(unsigned long *data,RC2_KEY *key); 90 | void RC2_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, 91 | RC2_KEY *ks, unsigned char *iv, int enc); 92 | void RC2_cfb64_encrypt(const unsigned char *in, unsigned char *out, 93 | long length, RC2_KEY *schedule, unsigned char *ivec, 94 | int *num, int enc); 95 | void RC2_ofb64_encrypt(const unsigned char *in, unsigned char *out, 96 | long length, RC2_KEY *schedule, unsigned char *ivec, 97 | int *num); 98 | 99 | #ifdef __cplusplus 100 | } 101 | #endif 102 | 103 | #endif 104 | -------------------------------------------------------------------------------- /jni/android-libs/headers/openssl/rc4.h: -------------------------------------------------------------------------------- 1 | /* crypto/rc4/rc4.h */ 2 | /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) 3 | * All rights reserved. 4 | * 5 | * This package is an SSL implementation written 6 | * by Eric Young (eay@cryptsoft.com). 7 | * The implementation was written so as to conform with Netscapes SSL. 8 | * 9 | * This library is free for commercial and non-commercial use as long as 10 | * the following conditions are aheared to. The following conditions 11 | * apply to all code found in this distribution, be it the RC4, RSA, 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation 13 | * included with this distribution is covered by the same copyright terms 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15 | * 16 | * Copyright remains Eric Young's, and as such any Copyright notices in 17 | * the code are not to be removed. 18 | * If this package is used in a product, Eric Young should be given attribution 19 | * as the author of the parts of the library used. 20 | * This can be in the form of a textual message at program startup or 21 | * in documentation (online or textual) provided with the package. 22 | * 23 | * Redistribution and use in source and binary forms, with or without 24 | * modification, are permitted provided that the following conditions 25 | * are met: 26 | * 1. Redistributions of source code must retain the copyright 27 | * notice, this list of conditions and the following disclaimer. 28 | * 2. Redistributions in binary form must reproduce the above copyright 29 | * notice, this list of conditions and the following disclaimer in the 30 | * documentation and/or other materials provided with the distribution. 31 | * 3. All advertising materials mentioning features or use of this software 32 | * must display the following acknowledgement: 33 | * "This product includes cryptographic software written by 34 | * Eric Young (eay@cryptsoft.com)" 35 | * The word 'cryptographic' can be left out if the rouines from the library 36 | * being used are not cryptographic related :-). 37 | * 4. If you include any Windows specific code (or a derivative thereof) from 38 | * the apps directory (application code) you must include an acknowledgement: 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40 | * 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51 | * SUCH DAMAGE. 52 | * 53 | * The licence and distribution terms for any publically available version or 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be 55 | * copied and put under another distribution licence 56 | * [including the GNU Public Licence.] 57 | */ 58 | 59 | #ifndef HEADER_RC4_H 60 | #define HEADER_RC4_H 61 | 62 | #include /* OPENSSL_NO_RC4, RC4_INT */ 63 | #ifdef OPENSSL_NO_RC4 64 | #error RC4 is disabled. 65 | #endif 66 | 67 | #include 68 | 69 | #ifdef __cplusplus 70 | extern "C" { 71 | #endif 72 | 73 | typedef struct rc4_key_st 74 | { 75 | RC4_INT x,y; 76 | RC4_INT data[256]; 77 | } RC4_KEY; 78 | 79 | 80 | const char *RC4_options(void); 81 | void RC4_set_key(RC4_KEY *key, int len, const unsigned char *data); 82 | void private_RC4_set_key(RC4_KEY *key, int len, const unsigned char *data); 83 | void RC4(RC4_KEY *key, size_t len, const unsigned char *indata, 84 | unsigned char *outdata); 85 | 86 | #ifdef __cplusplus 87 | } 88 | #endif 89 | 90 | #endif 91 | -------------------------------------------------------------------------------- /jni/android-libs/headers/openssl/ripemd.h: -------------------------------------------------------------------------------- 1 | /* crypto/ripemd/ripemd.h */ 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 | * All rights reserved. 4 | * 5 | * This package is an SSL implementation written 6 | * by Eric Young (eay@cryptsoft.com). 7 | * The implementation was written so as to conform with Netscapes SSL. 8 | * 9 | * This library is free for commercial and non-commercial use as long as 10 | * the following conditions are aheared to. The following conditions 11 | * apply to all code found in this distribution, be it the RC4, RSA, 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation 13 | * included with this distribution is covered by the same copyright terms 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15 | * 16 | * Copyright remains Eric Young's, and as such any Copyright notices in 17 | * the code are not to be removed. 18 | * If this package is used in a product, Eric Young should be given attribution 19 | * as the author of the parts of the library used. 20 | * This can be in the form of a textual message at program startup or 21 | * in documentation (online or textual) provided with the package. 22 | * 23 | * Redistribution and use in source and binary forms, with or without 24 | * modification, are permitted provided that the following conditions 25 | * are met: 26 | * 1. Redistributions of source code must retain the copyright 27 | * notice, this list of conditions and the following disclaimer. 28 | * 2. Redistributions in binary form must reproduce the above copyright 29 | * notice, this list of conditions and the following disclaimer in the 30 | * documentation and/or other materials provided with the distribution. 31 | * 3. All advertising materials mentioning features or use of this software 32 | * must display the following acknowledgement: 33 | * "This product includes cryptographic software written by 34 | * Eric Young (eay@cryptsoft.com)" 35 | * The word 'cryptographic' can be left out if the rouines from the library 36 | * being used are not cryptographic related :-). 37 | * 4. If you include any Windows specific code (or a derivative thereof) from 38 | * the apps directory (application code) you must include an acknowledgement: 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40 | * 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51 | * SUCH DAMAGE. 52 | * 53 | * The licence and distribution terms for any publically available version or 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be 55 | * copied and put under another distribution licence 56 | * [including the GNU Public Licence.] 57 | */ 58 | 59 | #ifndef HEADER_RIPEMD_H 60 | #define HEADER_RIPEMD_H 61 | 62 | #include 63 | #include 64 | 65 | #ifdef __cplusplus 66 | extern "C" { 67 | #endif 68 | 69 | #ifdef OPENSSL_NO_RIPEMD 70 | #error RIPEMD is disabled. 71 | #endif 72 | 73 | #if defined(__LP32__) 74 | #define RIPEMD160_LONG unsigned long 75 | #elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__) 76 | #define RIPEMD160_LONG unsigned long 77 | #define RIPEMD160_LONG_LOG2 3 78 | #else 79 | #define RIPEMD160_LONG unsigned int 80 | #endif 81 | 82 | #define RIPEMD160_CBLOCK 64 83 | #define RIPEMD160_LBLOCK (RIPEMD160_CBLOCK/4) 84 | #define RIPEMD160_DIGEST_LENGTH 20 85 | 86 | typedef struct RIPEMD160state_st 87 | { 88 | RIPEMD160_LONG A,B,C,D,E; 89 | RIPEMD160_LONG Nl,Nh; 90 | RIPEMD160_LONG data[RIPEMD160_LBLOCK]; 91 | unsigned int num; 92 | } RIPEMD160_CTX; 93 | 94 | #ifdef OPENSSL_FIPS 95 | int private_RIPEMD160_Init(RIPEMD160_CTX *c); 96 | #endif 97 | int RIPEMD160_Init(RIPEMD160_CTX *c); 98 | int RIPEMD160_Update(RIPEMD160_CTX *c, const void *data, size_t len); 99 | int RIPEMD160_Final(unsigned char *md, RIPEMD160_CTX *c); 100 | unsigned char *RIPEMD160(const unsigned char *d, size_t n, 101 | unsigned char *md); 102 | void RIPEMD160_Transform(RIPEMD160_CTX *c, const unsigned char *b); 103 | #ifdef __cplusplus 104 | } 105 | #endif 106 | 107 | #endif 108 | -------------------------------------------------------------------------------- /jni/android-libs/headers/openssl/sha.h: -------------------------------------------------------------------------------- 1 | /* crypto/sha/sha.h */ 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 | * All rights reserved. 4 | * 5 | * This package is an SSL implementation written 6 | * by Eric Young (eay@cryptsoft.com). 7 | * The implementation was written so as to conform with Netscapes SSL. 8 | * 9 | * This library is free for commercial and non-commercial use as long as 10 | * the following conditions are aheared to. The following conditions 11 | * apply to all code found in this distribution, be it the RC4, RSA, 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation 13 | * included with this distribution is covered by the same copyright terms 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15 | * 16 | * Copyright remains Eric Young's, and as such any Copyright notices in 17 | * the code are not to be removed. 18 | * If this package is used in a product, Eric Young should be given attribution 19 | * as the author of the parts of the library used. 20 | * This can be in the form of a textual message at program startup or 21 | * in documentation (online or textual) provided with the package. 22 | * 23 | * Redistribution and use in source and binary forms, with or without 24 | * modification, are permitted provided that the following conditions 25 | * are met: 26 | * 1. Redistributions of source code must retain the copyright 27 | * notice, this list of conditions and the following disclaimer. 28 | * 2. Redistributions in binary form must reproduce the above copyright 29 | * notice, this list of conditions and the following disclaimer in the 30 | * documentation and/or other materials provided with the distribution. 31 | * 3. All advertising materials mentioning features or use of this software 32 | * must display the following acknowledgement: 33 | * "This product includes cryptographic software written by 34 | * Eric Young (eay@cryptsoft.com)" 35 | * The word 'cryptographic' can be left out if the rouines from the library 36 | * being used are not cryptographic related :-). 37 | * 4. If you include any Windows specific code (or a derivative thereof) from 38 | * the apps directory (application code) you must include an acknowledgement: 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40 | * 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51 | * SUCH DAMAGE. 52 | * 53 | * The licence and distribution terms for any publically available version or 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be 55 | * copied and put under another distribution licence 56 | * [including the GNU Public Licence.] 57 | */ 58 | 59 | #ifndef HEADER_SHA_H 60 | #define HEADER_SHA_H 61 | 62 | #include 63 | #include 64 | 65 | #ifdef __cplusplus 66 | extern "C" { 67 | #endif 68 | 69 | #if defined(OPENSSL_NO_SHA) || (defined(OPENSSL_NO_SHA0) && defined(OPENSSL_NO_SHA1)) 70 | #error SHA is disabled. 71 | #endif 72 | 73 | #if defined(OPENSSL_FIPS) 74 | #define FIPS_SHA_SIZE_T size_t 75 | #endif 76 | 77 | /* 78 | * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 79 | * ! SHA_LONG has to be at least 32 bits wide. If it's wider, then ! 80 | * ! SHA_LONG_LOG2 has to be defined along. ! 81 | * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 82 | */ 83 | 84 | #if defined(__LP32__) 85 | #define SHA_LONG unsigned long 86 | #elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__) 87 | #define SHA_LONG unsigned long 88 | #define SHA_LONG_LOG2 3 89 | #else 90 | #define SHA_LONG unsigned int 91 | #endif 92 | 93 | #define SHA_LBLOCK 16 94 | #define SHA_CBLOCK (SHA_LBLOCK*4) /* SHA treats input data as a 95 | * contiguous array of 32 bit 96 | * wide big-endian values. */ 97 | #define SHA_LAST_BLOCK (SHA_CBLOCK-8) 98 | #define SHA_DIGEST_LENGTH 20 99 | 100 | typedef struct SHAstate_st 101 | { 102 | SHA_LONG h0,h1,h2,h3,h4; 103 | SHA_LONG Nl,Nh; 104 | SHA_LONG data[SHA_LBLOCK]; 105 | unsigned int num; 106 | } SHA_CTX; 107 | 108 | #ifndef OPENSSL_NO_SHA0 109 | #ifdef OPENSSL_FIPS 110 | int private_SHA_Init(SHA_CTX *c); 111 | #endif 112 | int SHA_Init(SHA_CTX *c); 113 | int SHA_Update(SHA_CTX *c, const void *data, size_t len); 114 | int SHA_Final(unsigned char *md, SHA_CTX *c); 115 | unsigned char *SHA(const unsigned char *d, size_t n, unsigned char *md); 116 | void SHA_Transform(SHA_CTX *c, const unsigned char *data); 117 | #endif 118 | #ifndef OPENSSL_NO_SHA1 119 | #ifdef OPENSSL_FIPS 120 | int private_SHA1_Init(SHA_CTX *c); 121 | #endif 122 | int SHA1_Init(SHA_CTX *c); 123 | int SHA1_Update(SHA_CTX *c, const void *data, size_t len); 124 | int SHA1_Final(unsigned char *md, SHA_CTX *c); 125 | unsigned char *SHA1(const unsigned char *d, size_t n, unsigned char *md); 126 | void SHA1_Transform(SHA_CTX *c, const unsigned char *data); 127 | #endif 128 | 129 | #define SHA256_CBLOCK (SHA_LBLOCK*4) /* SHA-256 treats input data as a 130 | * contiguous array of 32 bit 131 | * wide big-endian values. */ 132 | #define SHA224_DIGEST_LENGTH 28 133 | #define SHA256_DIGEST_LENGTH 32 134 | 135 | typedef struct SHA256state_st 136 | { 137 | SHA_LONG h[8]; 138 | SHA_LONG Nl,Nh; 139 | SHA_LONG data[SHA_LBLOCK]; 140 | unsigned int num,md_len; 141 | } SHA256_CTX; 142 | 143 | #ifndef OPENSSL_NO_SHA256 144 | #ifdef OPENSSL_FIPS 145 | int private_SHA224_Init(SHA256_CTX *c); 146 | int private_SHA256_Init(SHA256_CTX *c); 147 | #endif 148 | int SHA224_Init(SHA256_CTX *c); 149 | int SHA224_Update(SHA256_CTX *c, const void *data, size_t len); 150 | int SHA224_Final(unsigned char *md, SHA256_CTX *c); 151 | unsigned char *SHA224(const unsigned char *d, size_t n,unsigned char *md); 152 | int SHA256_Init(SHA256_CTX *c); 153 | int SHA256_Update(SHA256_CTX *c, const void *data, size_t len); 154 | int SHA256_Final(unsigned char *md, SHA256_CTX *c); 155 | unsigned char *SHA256(const unsigned char *d, size_t n,unsigned char *md); 156 | void SHA256_Transform(SHA256_CTX *c, const unsigned char *data); 157 | #endif 158 | 159 | #define SHA384_DIGEST_LENGTH 48 160 | #define SHA512_DIGEST_LENGTH 64 161 | 162 | #ifndef OPENSSL_NO_SHA512 163 | /* 164 | * Unlike 32-bit digest algorithms, SHA-512 *relies* on SHA_LONG64 165 | * being exactly 64-bit wide. See Implementation Notes in sha512.c 166 | * for further details. 167 | */ 168 | #define SHA512_CBLOCK (SHA_LBLOCK*8) /* SHA-512 treats input data as a 169 | * contiguous array of 64 bit 170 | * wide big-endian values. */ 171 | #if (defined(_WIN32) || defined(_WIN64)) && !defined(__MINGW32__) 172 | #define SHA_LONG64 unsigned __int64 173 | #define U64(C) C##UI64 174 | #elif defined(__arch64__) 175 | #define SHA_LONG64 unsigned long 176 | #define U64(C) C##UL 177 | #else 178 | #define SHA_LONG64 unsigned long long 179 | #define U64(C) C##ULL 180 | #endif 181 | 182 | typedef struct SHA512state_st 183 | { 184 | SHA_LONG64 h[8]; 185 | SHA_LONG64 Nl,Nh; 186 | union { 187 | SHA_LONG64 d[SHA_LBLOCK]; 188 | unsigned char p[SHA512_CBLOCK]; 189 | } u; 190 | unsigned int num,md_len; 191 | } SHA512_CTX; 192 | #endif 193 | 194 | #ifndef OPENSSL_NO_SHA512 195 | #ifdef OPENSSL_FIPS 196 | int private_SHA384_Init(SHA512_CTX *c); 197 | int private_SHA512_Init(SHA512_CTX *c); 198 | #endif 199 | int SHA384_Init(SHA512_CTX *c); 200 | int SHA384_Update(SHA512_CTX *c, const void *data, size_t len); 201 | int SHA384_Final(unsigned char *md, SHA512_CTX *c); 202 | unsigned char *SHA384(const unsigned char *d, size_t n,unsigned char *md); 203 | int SHA512_Init(SHA512_CTX *c); 204 | int SHA512_Update(SHA512_CTX *c, const void *data, size_t len); 205 | int SHA512_Final(unsigned char *md, SHA512_CTX *c); 206 | unsigned char *SHA512(const unsigned char *d, size_t n,unsigned char *md); 207 | void SHA512_Transform(SHA512_CTX *c, const unsigned char *data); 208 | #endif 209 | 210 | #ifdef __cplusplus 211 | } 212 | #endif 213 | 214 | #endif 215 | -------------------------------------------------------------------------------- /jni/android-libs/headers/openssl/srp.h: -------------------------------------------------------------------------------- 1 | /* crypto/srp/srp.h */ 2 | /* Written by Christophe Renou (christophe.renou@edelweb.fr) with 3 | * the precious help of Peter Sylvester (peter.sylvester@edelweb.fr) 4 | * for the EdelKey project and contributed to the OpenSSL project 2004. 5 | */ 6 | /* ==================================================================== 7 | * Copyright (c) 2004 The OpenSSL Project. All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 16 | * 2. Redistributions in binary form must reproduce the above copyright 17 | * notice, this list of conditions and the following disclaimer in 18 | * the documentation and/or other materials provided with the 19 | * distribution. 20 | * 21 | * 3. All advertising materials mentioning features or use of this 22 | * software must display the following acknowledgment: 23 | * "This product includes software developed by the OpenSSL Project 24 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" 25 | * 26 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 27 | * endorse or promote products derived from this software without 28 | * prior written permission. For written permission, please contact 29 | * licensing@OpenSSL.org. 30 | * 31 | * 5. Products derived from this software may not be called "OpenSSL" 32 | * nor may "OpenSSL" appear in their names without prior written 33 | * permission of the OpenSSL Project. 34 | * 35 | * 6. Redistributions of any form whatsoever must retain the following 36 | * acknowledgment: 37 | * "This product includes software developed by the OpenSSL Project 38 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" 39 | * 40 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 41 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 42 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 43 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 44 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 45 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 46 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 47 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 49 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 50 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 51 | * OF THE POSSIBILITY OF SUCH DAMAGE. 52 | * ==================================================================== 53 | * 54 | * This product includes cryptographic software written by Eric Young 55 | * (eay@cryptsoft.com). This product includes software written by Tim 56 | * Hudson (tjh@cryptsoft.com). 57 | * 58 | */ 59 | #ifndef __SRP_H__ 60 | #define __SRP_H__ 61 | 62 | #ifndef OPENSSL_NO_SRP 63 | 64 | #include 65 | #include 66 | 67 | #ifdef __cplusplus 68 | extern "C" { 69 | #endif 70 | 71 | #include 72 | #include 73 | #include 74 | 75 | typedef struct SRP_gN_cache_st 76 | { 77 | char *b64_bn; 78 | BIGNUM *bn; 79 | } SRP_gN_cache; 80 | 81 | 82 | DECLARE_STACK_OF(SRP_gN_cache) 83 | 84 | typedef struct SRP_user_pwd_st 85 | { 86 | char *id; 87 | BIGNUM *s; 88 | BIGNUM *v; 89 | const BIGNUM *g; 90 | const BIGNUM *N; 91 | char *info; 92 | } SRP_user_pwd; 93 | 94 | DECLARE_STACK_OF(SRP_user_pwd) 95 | 96 | typedef struct SRP_VBASE_st 97 | { 98 | STACK_OF(SRP_user_pwd) *users_pwd; 99 | STACK_OF(SRP_gN_cache) *gN_cache; 100 | /* to simulate a user */ 101 | char *seed_key; 102 | BIGNUM *default_g; 103 | BIGNUM *default_N; 104 | } SRP_VBASE; 105 | 106 | 107 | /*Structure interne pour retenir les couples N et g*/ 108 | typedef struct SRP_gN_st 109 | { 110 | char *id; 111 | BIGNUM *g; 112 | BIGNUM *N; 113 | } SRP_gN; 114 | 115 | DECLARE_STACK_OF(SRP_gN) 116 | 117 | SRP_VBASE *SRP_VBASE_new(char *seed_key); 118 | int SRP_VBASE_free(SRP_VBASE *vb); 119 | int SRP_VBASE_init(SRP_VBASE *vb, char * verifier_file); 120 | SRP_user_pwd *SRP_VBASE_get_by_user(SRP_VBASE *vb, char *username); 121 | char *SRP_create_verifier(const char *user, const char *pass, char **salt, 122 | char **verifier, const char *N, const char *g); 123 | int SRP_create_verifier_BN(const char *user, const char *pass, BIGNUM **salt, BIGNUM **verifier, BIGNUM *N, BIGNUM *g); 124 | 125 | 126 | #define SRP_NO_ERROR 0 127 | #define SRP_ERR_VBASE_INCOMPLETE_FILE 1 128 | #define SRP_ERR_VBASE_BN_LIB 2 129 | #define SRP_ERR_OPEN_FILE 3 130 | #define SRP_ERR_MEMORY 4 131 | 132 | #define DB_srptype 0 133 | #define DB_srpverifier 1 134 | #define DB_srpsalt 2 135 | #define DB_srpid 3 136 | #define DB_srpgN 4 137 | #define DB_srpinfo 5 138 | #undef DB_NUMBER 139 | #define DB_NUMBER 6 140 | 141 | #define DB_SRP_INDEX 'I' 142 | #define DB_SRP_VALID 'V' 143 | #define DB_SRP_REVOKED 'R' 144 | #define DB_SRP_MODIF 'v' 145 | 146 | 147 | /* see srp.c */ 148 | char * SRP_check_known_gN_param(BIGNUM* g, BIGNUM* N); 149 | SRP_gN *SRP_get_default_gN(const char * id) ; 150 | 151 | /* server side .... */ 152 | BIGNUM *SRP_Calc_server_key(BIGNUM *A, BIGNUM *v, BIGNUM *u, BIGNUM *b, BIGNUM *N); 153 | BIGNUM *SRP_Calc_B(BIGNUM *b, BIGNUM *N, BIGNUM *g, BIGNUM *v); 154 | int SRP_Verify_A_mod_N(BIGNUM *A, BIGNUM *N); 155 | BIGNUM *SRP_Calc_u(BIGNUM *A, BIGNUM *B, BIGNUM *N) ; 156 | 157 | 158 | 159 | /* client side .... */ 160 | BIGNUM *SRP_Calc_x(BIGNUM *s, const char *user, const char *pass); 161 | BIGNUM *SRP_Calc_A(BIGNUM *a, BIGNUM *N, BIGNUM *g); 162 | BIGNUM *SRP_Calc_client_key(BIGNUM *N, BIGNUM *B, BIGNUM *g, BIGNUM *x, BIGNUM *a, BIGNUM *u); 163 | int SRP_Verify_B_mod_N(BIGNUM *B, BIGNUM *N); 164 | 165 | #define SRP_MINIMAL_N 1024 166 | 167 | #ifdef __cplusplus 168 | } 169 | #endif 170 | 171 | #endif 172 | #endif 173 | -------------------------------------------------------------------------------- /jni/android-libs/headers/openssl/srtp.h: -------------------------------------------------------------------------------- 1 | /* ssl/tls1.h */ 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 | * All rights reserved. 4 | * 5 | * This package is an SSL implementation written 6 | * by Eric Young (eay@cryptsoft.com). 7 | * The implementation was written so as to conform with Netscapes SSL. 8 | * 9 | * This library is free for commercial and non-commercial use as long as 10 | * the following conditions are aheared to. The following conditions 11 | * apply to all code found in this distribution, be it the RC4, RSA, 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation 13 | * included with this distribution is covered by the same copyright terms 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15 | * 16 | * Copyright remains Eric Young's, and as such any Copyright notices in 17 | * the code are not to be removed. 18 | * If this package is used in a product, Eric Young should be given attribution 19 | * as the author of the parts of the library used. 20 | * This can be in the form of a textual message at program startup or 21 | * in documentation (online or textual) provided with the package. 22 | * 23 | * Redistribution and use in source and binary forms, with or without 24 | * modification, are permitted provided that the following conditions 25 | * are met: 26 | * 1. Redistributions of source code must retain the copyright 27 | * notice, this list of conditions and the following disclaimer. 28 | * 2. Redistributions in binary form must reproduce the above copyright 29 | * notice, this list of conditions and the following disclaimer in the 30 | * documentation and/or other materials provided with the distribution. 31 | * 3. All advertising materials mentioning features or use of this software 32 | * must display the following acknowledgement: 33 | * "This product includes cryptographic software written by 34 | * Eric Young (eay@cryptsoft.com)" 35 | * The word 'cryptographic' can be left out if the rouines from the library 36 | * being used are not cryptographic related :-). 37 | * 4. If you include any Windows specific code (or a derivative thereof) from 38 | * the apps directory (application code) you must include an acknowledgement: 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40 | * 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51 | * SUCH DAMAGE. 52 | * 53 | * The licence and distribution terms for any publically available version or 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be 55 | * copied and put under another distribution licence 56 | * [including the GNU Public Licence.] 57 | */ 58 | /* ==================================================================== 59 | * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved. 60 | * 61 | * Redistribution and use in source and binary forms, with or without 62 | * modification, are permitted provided that the following conditions 63 | * are met: 64 | * 65 | * 1. Redistributions of source code must retain the above copyright 66 | * notice, this list of conditions and the following disclaimer. 67 | * 68 | * 2. Redistributions in binary form must reproduce the above copyright 69 | * notice, this list of conditions and the following disclaimer in 70 | * the documentation and/or other materials provided with the 71 | * distribution. 72 | * 73 | * 3. All advertising materials mentioning features or use of this 74 | * software must display the following acknowledgment: 75 | * "This product includes software developed by the OpenSSL Project 76 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" 77 | * 78 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 79 | * endorse or promote products derived from this software without 80 | * prior written permission. For written permission, please contact 81 | * openssl-core@openssl.org. 82 | * 83 | * 5. Products derived from this software may not be called "OpenSSL" 84 | * nor may "OpenSSL" appear in their names without prior written 85 | * permission of the OpenSSL Project. 86 | * 87 | * 6. Redistributions of any form whatsoever must retain the following 88 | * acknowledgment: 89 | * "This product includes software developed by the OpenSSL Project 90 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" 91 | * 92 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 93 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 94 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 95 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 96 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 97 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 98 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 99 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 100 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 101 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 102 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 103 | * OF THE POSSIBILITY OF SUCH DAMAGE. 104 | * ==================================================================== 105 | * 106 | * This product includes cryptographic software written by Eric Young 107 | * (eay@cryptsoft.com). This product includes software written by Tim 108 | * Hudson (tjh@cryptsoft.com). 109 | * 110 | */ 111 | /* 112 | DTLS code by Eric Rescorla 113 | 114 | Copyright (C) 2006, Network Resonance, Inc. 115 | Copyright (C) 2011, RTFM, Inc. 116 | */ 117 | 118 | #ifndef HEADER_D1_SRTP_H 119 | #define HEADER_D1_SRTP_H 120 | 121 | #ifdef __cplusplus 122 | extern "C" { 123 | #endif 124 | 125 | 126 | #define SRTP_AES128_CM_SHA1_80 0x0001 127 | #define SRTP_AES128_CM_SHA1_32 0x0002 128 | #define SRTP_AES128_F8_SHA1_80 0x0003 129 | #define SRTP_AES128_F8_SHA1_32 0x0004 130 | #define SRTP_NULL_SHA1_80 0x0005 131 | #define SRTP_NULL_SHA1_32 0x0006 132 | 133 | int SSL_CTX_set_tlsext_use_srtp(SSL_CTX *ctx, const char *profiles); 134 | int SSL_set_tlsext_use_srtp(SSL *ctx, const char *profiles); 135 | SRTP_PROTECTION_PROFILE *SSL_get_selected_srtp_profile(SSL *s); 136 | 137 | STACK_OF(SRTP_PROTECTION_PROFILE) *SSL_get_srtp_profiles(SSL *ssl); 138 | SRTP_PROTECTION_PROFILE *SSL_get_selected_srtp_profile(SSL *s); 139 | 140 | #ifdef __cplusplus 141 | } 142 | #endif 143 | 144 | #endif 145 | 146 | -------------------------------------------------------------------------------- /jni/android-libs/headers/openssl/ssl23.h: -------------------------------------------------------------------------------- 1 | /* ssl/ssl23.h */ 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 | * All rights reserved. 4 | * 5 | * This package is an SSL implementation written 6 | * by Eric Young (eay@cryptsoft.com). 7 | * The implementation was written so as to conform with Netscapes SSL. 8 | * 9 | * This library is free for commercial and non-commercial use as long as 10 | * the following conditions are aheared to. The following conditions 11 | * apply to all code found in this distribution, be it the RC4, RSA, 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation 13 | * included with this distribution is covered by the same copyright terms 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15 | * 16 | * Copyright remains Eric Young's, and as such any Copyright notices in 17 | * the code are not to be removed. 18 | * If this package is used in a product, Eric Young should be given attribution 19 | * as the author of the parts of the library used. 20 | * This can be in the form of a textual message at program startup or 21 | * in documentation (online or textual) provided with the package. 22 | * 23 | * Redistribution and use in source and binary forms, with or without 24 | * modification, are permitted provided that the following conditions 25 | * are met: 26 | * 1. Redistributions of source code must retain the copyright 27 | * notice, this list of conditions and the following disclaimer. 28 | * 2. Redistributions in binary form must reproduce the above copyright 29 | * notice, this list of conditions and the following disclaimer in the 30 | * documentation and/or other materials provided with the distribution. 31 | * 3. All advertising materials mentioning features or use of this software 32 | * must display the following acknowledgement: 33 | * "This product includes cryptographic software written by 34 | * Eric Young (eay@cryptsoft.com)" 35 | * The word 'cryptographic' can be left out if the rouines from the library 36 | * being used are not cryptographic related :-). 37 | * 4. If you include any Windows specific code (or a derivative thereof) from 38 | * the apps directory (application code) you must include an acknowledgement: 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40 | * 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51 | * SUCH DAMAGE. 52 | * 53 | * The licence and distribution terms for any publically available version or 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be 55 | * copied and put under another distribution licence 56 | * [including the GNU Public Licence.] 57 | */ 58 | 59 | #ifndef HEADER_SSL23_H 60 | #define HEADER_SSL23_H 61 | 62 | #ifdef __cplusplus 63 | extern "C" { 64 | #endif 65 | 66 | /*client */ 67 | /* write to server */ 68 | #define SSL23_ST_CW_CLNT_HELLO_A (0x210|SSL_ST_CONNECT) 69 | #define SSL23_ST_CW_CLNT_HELLO_B (0x211|SSL_ST_CONNECT) 70 | /* read from server */ 71 | #define SSL23_ST_CR_SRVR_HELLO_A (0x220|SSL_ST_CONNECT) 72 | #define SSL23_ST_CR_SRVR_HELLO_B (0x221|SSL_ST_CONNECT) 73 | 74 | /* server */ 75 | /* read from client */ 76 | #define SSL23_ST_SR_CLNT_HELLO_A (0x210|SSL_ST_ACCEPT) 77 | #define SSL23_ST_SR_CLNT_HELLO_B (0x211|SSL_ST_ACCEPT) 78 | 79 | #ifdef __cplusplus 80 | } 81 | #endif 82 | #endif 83 | 84 | -------------------------------------------------------------------------------- /jni/android-libs/headers/openssl/stack.h: -------------------------------------------------------------------------------- 1 | /* crypto/stack/stack.h */ 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 | * All rights reserved. 4 | * 5 | * This package is an SSL implementation written 6 | * by Eric Young (eay@cryptsoft.com). 7 | * The implementation was written so as to conform with Netscapes SSL. 8 | * 9 | * This library is free for commercial and non-commercial use as long as 10 | * the following conditions are aheared to. The following conditions 11 | * apply to all code found in this distribution, be it the RC4, RSA, 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation 13 | * included with this distribution is covered by the same copyright terms 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15 | * 16 | * Copyright remains Eric Young's, and as such any Copyright notices in 17 | * the code are not to be removed. 18 | * If this package is used in a product, Eric Young should be given attribution 19 | * as the author of the parts of the library used. 20 | * This can be in the form of a textual message at program startup or 21 | * in documentation (online or textual) provided with the package. 22 | * 23 | * Redistribution and use in source and binary forms, with or without 24 | * modification, are permitted provided that the following conditions 25 | * are met: 26 | * 1. Redistributions of source code must retain the copyright 27 | * notice, this list of conditions and the following disclaimer. 28 | * 2. Redistributions in binary form must reproduce the above copyright 29 | * notice, this list of conditions and the following disclaimer in the 30 | * documentation and/or other materials provided with the distribution. 31 | * 3. All advertising materials mentioning features or use of this software 32 | * must display the following acknowledgement: 33 | * "This product includes cryptographic software written by 34 | * Eric Young (eay@cryptsoft.com)" 35 | * The word 'cryptographic' can be left out if the rouines from the library 36 | * being used are not cryptographic related :-). 37 | * 4. If you include any Windows specific code (or a derivative thereof) from 38 | * the apps directory (application code) you must include an acknowledgement: 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40 | * 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51 | * SUCH DAMAGE. 52 | * 53 | * The licence and distribution terms for any publically available version or 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be 55 | * copied and put under another distribution licence 56 | * [including the GNU Public Licence.] 57 | */ 58 | 59 | #ifndef HEADER_STACK_H 60 | #define HEADER_STACK_H 61 | 62 | #ifdef __cplusplus 63 | extern "C" { 64 | #endif 65 | 66 | typedef struct stack_st 67 | { 68 | int num; 69 | char **data; 70 | int sorted; 71 | 72 | int num_alloc; 73 | int (*comp)(const void *, const void *); 74 | } _STACK; /* Use STACK_OF(...) instead */ 75 | 76 | #define M_sk_num(sk) ((sk) ? (sk)->num:-1) 77 | #define M_sk_value(sk,n) ((sk) ? (sk)->data[n] : NULL) 78 | 79 | int sk_num(const _STACK *); 80 | void *sk_value(const _STACK *, int); 81 | 82 | void *sk_set(_STACK *, int, void *); 83 | 84 | _STACK *sk_new(int (*cmp)(const void *, const void *)); 85 | _STACK *sk_new_null(void); 86 | void sk_free(_STACK *); 87 | void sk_pop_free(_STACK *st, void (*func)(void *)); 88 | int sk_insert(_STACK *sk, void *data, int where); 89 | void *sk_delete(_STACK *st, int loc); 90 | void *sk_delete_ptr(_STACK *st, void *p); 91 | int sk_find(_STACK *st, void *data); 92 | int sk_find_ex(_STACK *st, void *data); 93 | int sk_push(_STACK *st, void *data); 94 | int sk_unshift(_STACK *st, void *data); 95 | void *sk_shift(_STACK *st); 96 | void *sk_pop(_STACK *st); 97 | void sk_zero(_STACK *st); 98 | int (*sk_set_cmp_func(_STACK *sk, int (*c)(const void *, const void *))) 99 | (const void *, const void *); 100 | _STACK *sk_dup(_STACK *st); 101 | void sk_sort(_STACK *st); 102 | int sk_is_sorted(const _STACK *st); 103 | 104 | #ifdef __cplusplus 105 | } 106 | #endif 107 | 108 | #endif 109 | -------------------------------------------------------------------------------- /jni/android-libs/headers/openssl/txt_db.h: -------------------------------------------------------------------------------- 1 | /* crypto/txt_db/txt_db.h */ 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 | * All rights reserved. 4 | * 5 | * This package is an SSL implementation written 6 | * by Eric Young (eay@cryptsoft.com). 7 | * The implementation was written so as to conform with Netscapes SSL. 8 | * 9 | * This library is free for commercial and non-commercial use as long as 10 | * the following conditions are aheared to. The following conditions 11 | * apply to all code found in this distribution, be it the RC4, RSA, 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation 13 | * included with this distribution is covered by the same copyright terms 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15 | * 16 | * Copyright remains Eric Young's, and as such any Copyright notices in 17 | * the code are not to be removed. 18 | * If this package is used in a product, Eric Young should be given attribution 19 | * as the author of the parts of the library used. 20 | * This can be in the form of a textual message at program startup or 21 | * in documentation (online or textual) provided with the package. 22 | * 23 | * Redistribution and use in source and binary forms, with or without 24 | * modification, are permitted provided that the following conditions 25 | * are met: 26 | * 1. Redistributions of source code must retain the copyright 27 | * notice, this list of conditions and the following disclaimer. 28 | * 2. Redistributions in binary form must reproduce the above copyright 29 | * notice, this list of conditions and the following disclaimer in the 30 | * documentation and/or other materials provided with the distribution. 31 | * 3. All advertising materials mentioning features or use of this software 32 | * must display the following acknowledgement: 33 | * "This product includes cryptographic software written by 34 | * Eric Young (eay@cryptsoft.com)" 35 | * The word 'cryptographic' can be left out if the rouines from the library 36 | * being used are not cryptographic related :-). 37 | * 4. If you include any Windows specific code (or a derivative thereof) from 38 | * the apps directory (application code) you must include an acknowledgement: 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40 | * 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51 | * SUCH DAMAGE. 52 | * 53 | * The licence and distribution terms for any publically available version or 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be 55 | * copied and put under another distribution licence 56 | * [including the GNU Public Licence.] 57 | */ 58 | 59 | #ifndef HEADER_TXT_DB_H 60 | #define HEADER_TXT_DB_H 61 | 62 | #include 63 | #ifndef OPENSSL_NO_BIO 64 | #include 65 | #endif 66 | #include 67 | #include 68 | 69 | #define DB_ERROR_OK 0 70 | #define DB_ERROR_MALLOC 1 71 | #define DB_ERROR_INDEX_CLASH 2 72 | #define DB_ERROR_INDEX_OUT_OF_RANGE 3 73 | #define DB_ERROR_NO_INDEX 4 74 | #define DB_ERROR_INSERT_INDEX_CLASH 5 75 | 76 | #ifdef __cplusplus 77 | extern "C" { 78 | #endif 79 | 80 | typedef OPENSSL_STRING *OPENSSL_PSTRING; 81 | DECLARE_SPECIAL_STACK_OF(OPENSSL_PSTRING, OPENSSL_STRING) 82 | 83 | typedef struct txt_db_st 84 | { 85 | int num_fields; 86 | STACK_OF(OPENSSL_PSTRING) *data; 87 | LHASH_OF(OPENSSL_STRING) **index; 88 | int (**qual)(OPENSSL_STRING *); 89 | long error; 90 | long arg1; 91 | long arg2; 92 | OPENSSL_STRING *arg_row; 93 | } TXT_DB; 94 | 95 | #ifndef OPENSSL_NO_BIO 96 | TXT_DB *TXT_DB_read(BIO *in, int num); 97 | long TXT_DB_write(BIO *out, TXT_DB *db); 98 | #else 99 | TXT_DB *TXT_DB_read(char *in, int num); 100 | long TXT_DB_write(char *out, TXT_DB *db); 101 | #endif 102 | int TXT_DB_create_index(TXT_DB *db,int field,int (*qual)(OPENSSL_STRING *), 103 | LHASH_HASH_FN_TYPE hash, LHASH_COMP_FN_TYPE cmp); 104 | void TXT_DB_free(TXT_DB *db); 105 | OPENSSL_STRING *TXT_DB_get_by_index(TXT_DB *db, int idx, OPENSSL_STRING *value); 106 | int TXT_DB_insert(TXT_DB *db, OPENSSL_STRING *value); 107 | 108 | #ifdef __cplusplus 109 | } 110 | #endif 111 | 112 | #endif 113 | -------------------------------------------------------------------------------- /jni/android-libs/headers/openssl/ui_compat.h: -------------------------------------------------------------------------------- 1 | /* crypto/ui/ui.h -*- mode:C; c-file-style: "eay" -*- */ 2 | /* Written by Richard Levitte (richard@levitte.org) for the OpenSSL 3 | * project 2001. 4 | */ 5 | /* ==================================================================== 6 | * Copyright (c) 2001 The OpenSSL Project. All rights reserved. 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions 10 | * are met: 11 | * 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 15 | * 2. Redistributions in binary form must reproduce the above copyright 16 | * notice, this list of conditions and the following disclaimer in 17 | * the documentation and/or other materials provided with the 18 | * distribution. 19 | * 20 | * 3. All advertising materials mentioning features or use of this 21 | * software must display the following acknowledgment: 22 | * "This product includes software developed by the OpenSSL Project 23 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" 24 | * 25 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 26 | * endorse or promote products derived from this software without 27 | * prior written permission. For written permission, please contact 28 | * openssl-core@openssl.org. 29 | * 30 | * 5. Products derived from this software may not be called "OpenSSL" 31 | * nor may "OpenSSL" appear in their names without prior written 32 | * permission of the OpenSSL Project. 33 | * 34 | * 6. Redistributions of any form whatsoever must retain the following 35 | * acknowledgment: 36 | * "This product includes software developed by the OpenSSL Project 37 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" 38 | * 39 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 40 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 41 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 42 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 43 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 44 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 45 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 46 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 47 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 48 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 49 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 50 | * OF THE POSSIBILITY OF SUCH DAMAGE. 51 | * ==================================================================== 52 | * 53 | * This product includes cryptographic software written by Eric Young 54 | * (eay@cryptsoft.com). This product includes software written by Tim 55 | * Hudson (tjh@cryptsoft.com). 56 | * 57 | */ 58 | 59 | #ifndef HEADER_UI_COMPAT_H 60 | #define HEADER_UI_COMPAT_H 61 | 62 | #include 63 | #include 64 | 65 | #ifdef __cplusplus 66 | extern "C" { 67 | #endif 68 | 69 | /* The following functions were previously part of the DES section, 70 | and are provided here for backward compatibility reasons. */ 71 | 72 | #define des_read_pw_string(b,l,p,v) \ 73 | _ossl_old_des_read_pw_string((b),(l),(p),(v)) 74 | #define des_read_pw(b,bf,s,p,v) \ 75 | _ossl_old_des_read_pw((b),(bf),(s),(p),(v)) 76 | 77 | int _ossl_old_des_read_pw_string(char *buf,int length,const char *prompt,int verify); 78 | int _ossl_old_des_read_pw(char *buf,char *buff,int size,const char *prompt,int verify); 79 | 80 | #ifdef __cplusplus 81 | } 82 | #endif 83 | #endif 84 | -------------------------------------------------------------------------------- /jni/android-libs/mips/libcrypto.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tguillem/android-ampd/2c0c940ee64072638099f01fb21e06cb02a096d9/jni/android-libs/mips/libcrypto.so -------------------------------------------------------------------------------- /jni/android-libs/mips/libsqlite.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tguillem/android-ampd/2c0c940ee64072638099f01fb21e06cb02a096d9/jni/android-libs/mips/libsqlite.so -------------------------------------------------------------------------------- /jni/android-libs/mips/libssl.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tguillem/android-ampd/2c0c940ee64072638099f01fb21e06cb02a096d9/jni/android-libs/mips/libssl.so -------------------------------------------------------------------------------- /jni/android-libs/x86/libcrypto.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tguillem/android-ampd/2c0c940ee64072638099f01fb21e06cb02a096d9/jni/android-libs/x86/libcrypto.so -------------------------------------------------------------------------------- /jni/android-libs/x86/libsqlite.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tguillem/android-ampd/2c0c940ee64072638099f01fb21e06cb02a096d9/jni/android-libs/x86/libsqlite.so -------------------------------------------------------------------------------- /jni/android-libs/x86/libssl.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tguillem/android-ampd/2c0c940ee64072638099f01fb21e06cb02a096d9/jni/android-libs/x86/libssl.so -------------------------------------------------------------------------------- /jni/cpufeatures_jni/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | 5 | LOCAL_C_INCLUDES := 6 | 7 | LOCAL_SRC_FILES := \ 8 | cpufeatures_jni.c 9 | 10 | LOCAL_MODULE := cpufeatures_jni 11 | 12 | LOCAL_STATIC_LIBRARIES := cpufeatures 13 | 14 | include $(BUILD_SHARED_LIBRARY) 15 | 16 | $(call import-module,cpufeatures) 17 | -------------------------------------------------------------------------------- /jni/cpufeatures_jni/cpufeatures_jni.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | #include 5 | 6 | jboolean 7 | Java_be_deadba_ampd_CpuFeatures_isArm(JNIEnv *env) 8 | { 9 | return android_getCpuFamily() == ANDROID_CPU_FAMILY_ARM; 10 | } 11 | 12 | jboolean 13 | Java_be_deadba_ampd_CpuFeatures_isArmv7a(JNIEnv *env) 14 | { 15 | return android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_ARMv7; 16 | } 17 | 18 | jboolean 19 | Java_be_deadba_ampd_CpuFeatures_hasNeon(JNIEnv *env) 20 | { 21 | return android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON; 22 | } 23 | 24 | jint JNI_OnLoad(JavaVM* vm, void* reserved) 25 | { 26 | JNIEnv* env = NULL; 27 | jint result = -1; 28 | jclass clazz; 29 | 30 | if ((*vm)->GetEnv(vm, (void**) &env, JNI_VERSION_1_4) != JNI_OK) { 31 | goto bail; 32 | } 33 | if (!env) { 34 | goto bail; 35 | } 36 | 37 | result = JNI_VERSION_1_4; 38 | bail: 39 | return result; 40 | } 41 | 42 | void JNI_OnUnload(JavaVM* vm, void* reserved) 43 | { 44 | } 45 | -------------------------------------------------------------------------------- /jni/mpd_jni/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | 5 | LOCAL_C_INCLUDES := 6 | 7 | LOCAL_SRC_FILES := \ 8 | mpd_jni.c 9 | 10 | LOCAL_MODULE := libmpd_jni 11 | 12 | LOCAL_SHARED_LIBRARIES := libmpd 13 | 14 | LOCAL_LDLIBS := -llog 15 | 16 | ifeq ($(TARGET_ARCH_ABI),armeabi-v7a) 17 | LOCAL_ARM_NEON:= true 18 | endif 19 | 20 | include $(BUILD_SHARED_LIBRARY) 21 | -------------------------------------------------------------------------------- /jni/mpd_jni/mpd_jni.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 Thomas Guillem 3 | * 4 | * This file is part of aMPD. 5 | * 6 | * aMPD is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * aMPD is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with aMPD. If not, see . 18 | */ 19 | 20 | #include 21 | 22 | #include 23 | #include 24 | 25 | #define LOG_NDEBUG 0 26 | #define LOG_TAG "mpd_jni" 27 | 28 | #define LOGD(format, args...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, format, ##args); 29 | #define LOGE(format, args...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, format, ##args); 30 | 31 | void libmpd_init(); 32 | void libmpd_deinit(); 33 | int libmpd_run(int argc, char *argv[]); 34 | void libmpd_quit(void); 35 | 36 | #define MPD_ARGC 2 37 | 38 | void 39 | Java_be_deadba_ampd_LibMPD_init(JNIEnv *env) 40 | { 41 | libmpd_init(); 42 | } 43 | 44 | void 45 | Java_be_deadba_ampd_LibMPD_deinit(JNIEnv *env) 46 | { 47 | libmpd_deinit(); 48 | } 49 | 50 | int 51 | Java_be_deadba_ampd_LibMPD_run(JNIEnv *env, jobject thiz, jstring mpd_conf) 52 | { 53 | int ret; 54 | const char *c_mpd_conf = (*env)->GetStringUTFChars(env, mpd_conf, NULL); 55 | const char *mpd_argv[MPD_ARGC]; 56 | 57 | mpd_argv[0] = "libmpd"; 58 | mpd_argv[1] = c_mpd_conf; 59 | 60 | mpd_argv[1] = c_mpd_conf; 61 | return libmpd_run(MPD_ARGC, mpd_argv); 62 | } 63 | 64 | void 65 | Java_be_deadba_ampd_LibMPD_quit(JNIEnv *env) 66 | { 67 | libmpd_quit(); 68 | } 69 | 70 | jint 71 | JNI_OnLoad(JavaVM* vm, void* reserved) 72 | { 73 | JNIEnv* env = NULL; 74 | jint result = -1; 75 | jclass clazz; 76 | 77 | if ((*vm)->GetEnv(vm, (void**) &env, JNI_VERSION_1_4) != JNI_OK) { 78 | LOGE("GetEnv failed"); 79 | goto bail; 80 | } 81 | if (!env) { 82 | LOGE("!env"); 83 | goto bail; 84 | } 85 | 86 | result = JNI_VERSION_1_4; 87 | bail: 88 | return result; 89 | } 90 | 91 | void 92 | JNI_OnUnload(JavaVM* vm, void* reserved) 93 | { 94 | } 95 | -------------------------------------------------------------------------------- /libs/android-support-v4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tguillem/android-ampd/2c0c940ee64072638099f01fb21e06cb02a096d9/libs/android-support-v4.jar -------------------------------------------------------------------------------- /proguard-project.txt: -------------------------------------------------------------------------------- 1 | # To enable ProGuard in your project, edit project.properties 2 | # to define the proguard.config property as described in that file. 3 | # 4 | # Add project specific ProGuard rules here. 5 | # By default, the flags in this file are appended to flags specified 6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt 7 | # You can edit the include path and order by changing the ProGuard 8 | # include property in project.properties. 9 | # 10 | # For more details, see 11 | # http://developer.android.com/guide/developing/tools/proguard.html 12 | 13 | # Add any project specific keep options here: 14 | 15 | # If your project uses WebView with JS, uncomment the following 16 | # and specify the fully qualified class name to the JavaScript interface 17 | # class: 18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 19 | # public *; 20 | #} 21 | -------------------------------------------------------------------------------- /project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system edit 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | # 10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): 11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt 12 | 13 | # Project target. 14 | target=android-17 15 | -------------------------------------------------------------------------------- /res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tguillem/android-ampd/2c0c940ee64072638099f01fb21e06cb02a096d9/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tguillem/android-ampd/2c0c940ee64072638099f01fb21e06cb02a096d9/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tguillem/android-ampd/2c0c940ee64072638099f01fb21e06cb02a096d9/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /res/drawable/ic_notification.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tguillem/android-ampd/2c0c940ee64072638099f01fb21e06cb02a096d9/res/drawable/ic_notification.png -------------------------------------------------------------------------------- /res/values-ko/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | aMPD 5 | MPD 실행 중 6 | 누르면 mpd 설정. 7 | 오류: 포트가 잘못되었습니다 (반드시 1024와 65535의 사이에 있고, 기본값은: 6600) 8 | 오류: 음악 디렉터리가 잘못되었습니다. 9 | 10 | MPD 실행 중 11 | MPD가 실행 중입니다 %1$s 12 | MPD 실행 안 됨 13 | 14 | 일반 15 | 16 | MPD 실행 17 | 18 | MPD 자동 실행 19 | MPD 서비스가 부팅 시에 시작됩니다 20 | 21 | 깨어있기 22 | MPD가 실행 중이면 절전상태로 들어가지 않습니다 (Wakelock) 23 | 24 | 포트 25 | 음악 디렉터리 26 | 27 | 오디오출력 28 | 소리에 문제가 있으면 오디오출력을 바꿉니다 29 | 30 | 믹서사용 31 | 음량조절을 허용합니다 (음질 열화 가능성) 32 | 33 | 34 | -------------------------------------------------------------------------------- /res/values-sw600dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /res/values-sw720dp-land/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 128dp 8 | 9 | 10 | -------------------------------------------------------------------------------- /res/values-v11/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /res/values-v14/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /res/values-v18/arrays.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | OpenSL ES on Android 4 | 5 | 6 | 7 | opensles_android 8 | 9 | 10 | -------------------------------------------------------------------------------- /res/values/arrays.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | OpenSL ES on Android 4 | Android AudioTrack 5 | 6 | 7 | 8 | opensles_android 9 | audiotrack 10 | 11 | 12 | -------------------------------------------------------------------------------- /res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 16dp 5 | 16dp 6 | 7 | 8 | -------------------------------------------------------------------------------- /res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | aMPD 5 | MPD is running 6 | Touch for mpd options. 7 | Error: The port is invalid (must be between 1024 and 65535, default: 6600) 8 | Error: The music directory is invalid. 9 | 10 | MPD is running 11 | MPD is running on %1$s 12 | MPD is not running 13 | 14 | General 15 | 16 | Run MPD 17 | 18 | Run MPD automatically 19 | MPD Service will be launched on boot 20 | 21 | Stay awake 22 | Prevent device suspend when MPD is running (Wakelock) 23 | 24 | Port 25 | Music directory 26 | 27 | Audio output 28 | Change audio output in case of audio glitches 29 | 30 | Use mixer 31 | Allow volume control (may deteriorate sound quality) 32 | 33 | 6600 34 | opensles_android 35 | 36 | -------------------------------------------------------------------------------- /res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 14 | 15 | 16 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /res/xml/pref_general.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 15 | 16 | 22 | 23 | 32 | 33 | 43 | 44 | 51 | 52 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /res/xml/pref_headers.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
8 | 9 | 10 | -------------------------------------------------------------------------------- /src/be/deadba/ampd/CpuFeatures.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 Thomas Guillem 3 | * 4 | * This file is part of aMPD. 5 | * 6 | * aMPD is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * aMPD is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with aMPD. If not, see . 18 | */ 19 | 20 | package be.deadba.ampd; 21 | 22 | import android.util.Log; 23 | 24 | public class CpuFeatures { 25 | private static final String TAG = "CpuFeatures"; 26 | 27 | static { 28 | try { 29 | System.loadLibrary("cpufeatures_jni"); 30 | } catch (UnsatisfiedLinkError ule) { 31 | Log.e(TAG, "Can't load library: " + ule); 32 | } catch (SecurityException se) { 33 | Log.e(TAG, "Encountered a security issue when loading library: " + se); 34 | } 35 | } 36 | public native static boolean isArm(); 37 | public native static boolean isArmv7a(); 38 | public native static boolean hasNeon(); 39 | } 40 | -------------------------------------------------------------------------------- /src/be/deadba/ampd/IMPDService.aidl: -------------------------------------------------------------------------------- 1 | package be.deadba.ampd; 2 | import be.deadba.ampd.IMPDServiceCallback; 3 | 4 | interface IMPDService 5 | { 6 | void start(); 7 | void stop(); 8 | void kill(); 9 | boolean isRunning(); 10 | void registerCallback(IMPDServiceCallback cb); 11 | void unregisterCallback(IMPDServiceCallback cb); 12 | } 13 | -------------------------------------------------------------------------------- /src/be/deadba/ampd/IMPDServiceCallback.aidl: -------------------------------------------------------------------------------- 1 | package be.deadba.ampd; 2 | 3 | interface IMPDServiceCallback 4 | { 5 | void onStart(); 6 | void onStop(boolean error); 7 | } 8 | -------------------------------------------------------------------------------- /src/be/deadba/ampd/LibMPD.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 Thomas Guillem 3 | * 4 | * This file is part of aMPD. 5 | * 6 | * aMPD is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * aMPD is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with aMPD. If not, see . 18 | */ 19 | 20 | package be.deadba.ampd; 21 | 22 | import java.io.File; 23 | import java.io.FileNotFoundException; 24 | import java.io.FileOutputStream; 25 | import java.io.IOException; 26 | import java.io.InputStream; 27 | import java.util.zip.ZipEntry; 28 | import java.util.zip.ZipFile; 29 | 30 | import android.content.Context; 31 | import android.util.Log; 32 | 33 | public class LibMPD { 34 | private static final String TAG = "LibMPD"; 35 | 36 | public interface OnErrorListener { 37 | public void onError(int ret); 38 | } 39 | 40 | private static LibMPD sLibMPD = null; 41 | 42 | private MPDThread mMPDThread; 43 | private final Context mContext; 44 | private final OnErrorListener mOnErrorListener; 45 | private boolean mInit = false; 46 | 47 | private static final String sLibList[] = new String[] { 48 | "avutil", 49 | "avcodec", 50 | "avformat", 51 | "curl", 52 | "yajl", 53 | "iconv", 54 | "glib", 55 | "gthread", 56 | "mpd", 57 | "mpd_jni" 58 | }; 59 | 60 | private void initLib() { 61 | String libPath = null; 62 | 63 | if (CpuFeatures.isArm() && CpuFeatures.isArmv7a() && !CpuFeatures.hasNeon()) { 64 | /* 65 | * Rase case: cpu is armeabi-v7a but without Neon (like tegra 2). 66 | * Don't try to link with armeabi-v7a libs that are built with NEON. 67 | * Instead, copy armeabi libs from apk (zip) into files folder and link with them. 68 | */ 69 | libPath = mContext.getFilesDir() + "/armeabi"; 70 | 71 | File apk = new File(mContext.getPackageCodePath()); 72 | File outDir = new File(libPath); 73 | 74 | if (!outDir.exists() || apk.lastModified() > outDir.lastModified()) { 75 | Log.d(TAG, "Armv7a without neon: copying armeabi libs from apk"); 76 | 77 | ZipFile zf = null; 78 | FileOutputStream fos = null; 79 | InputStream is = null; 80 | 81 | try { 82 | zf = new ZipFile(apk); 83 | byte[] buffer = new byte[16*1024]; 84 | 85 | if (!outDir.exists()) 86 | outDir.mkdir(); 87 | else 88 | outDir.setLastModified(System.currentTimeMillis()); 89 | 90 | for (String lib : sLibList) { 91 | ZipEntry ze = zf.getEntry("lib/armeabi/lib"+lib+".so"); 92 | fos = new FileOutputStream(outDir.getPath() +"/lib"+lib+".so"); 93 | is = zf.getInputStream(ze); 94 | 95 | int read; 96 | while ((read = is.read(buffer)) != -1) 97 | fos.write(buffer, 0, read); 98 | fos.close(); 99 | fos = null; 100 | is.close(); 101 | is = null; 102 | } 103 | zf.close(); 104 | zf = null; 105 | } catch (FileNotFoundException e) { 106 | e.printStackTrace(); 107 | } catch (IOException e) { 108 | e.printStackTrace(); 109 | } 110 | try { 111 | if (fos != null) 112 | fos.close(); 113 | if (is != null) 114 | is.close(); 115 | if (zf != null) 116 | zf.close(); 117 | } catch (IOException e) { 118 | e.printStackTrace(); 119 | } 120 | } 121 | } 122 | 123 | try { 124 | if (libPath == null) { 125 | // links with libs from lib/ 126 | for (String lib : sLibList) 127 | System.loadLibrary(lib); 128 | } else { 129 | // links with libs from files/armebi/ 130 | for (String lib : sLibList) 131 | System.load(libPath + "/lib" + lib + ".so"); 132 | } 133 | init(); 134 | mInit = true; 135 | } catch (UnsatisfiedLinkError ule) { 136 | Log.e(TAG, "Can't load library: " + ule); 137 | } catch (SecurityException se) { 138 | Log.e(TAG, "Encountered a security issue when loading library: " + se); 139 | } 140 | } 141 | 142 | final private class MPDThread extends Thread { 143 | @Override 144 | public void run() { 145 | int ret = LibMPD.run(MPDConf.getPath(mContext)); 146 | Log.d(TAG, "mpd terminated: " + ret); 147 | if (ret != 0 && mOnErrorListener != null) 148 | mOnErrorListener.onError(ret); 149 | } 150 | 151 | public void finish() { 152 | LibMPD.quit(); 153 | try { 154 | join(); 155 | } catch (InterruptedException e) { 156 | } 157 | } 158 | } 159 | 160 | private LibMPD(Context ctx, OnErrorListener listener) { 161 | mContext = ctx; 162 | mOnErrorListener = listener; 163 | initLib(); 164 | } 165 | 166 | @Override 167 | protected void finalize() throws Throwable { 168 | super.finalize(); 169 | deinit(); 170 | } 171 | 172 | private boolean start() { 173 | if (mInit && mMPDThread == null) { 174 | mMPDThread = new MPDThread(); 175 | mMPDThread.start(); 176 | return true; 177 | } else { 178 | return false; 179 | } 180 | } 181 | 182 | private void finish() { 183 | if (mInit && mMPDThread != null) { 184 | mMPDThread.finish(); 185 | mMPDThread = null; 186 | } 187 | } 188 | 189 | private boolean isThreadRunning() { 190 | return mMPDThread != null && mMPDThread.isAlive(); 191 | } 192 | 193 | public static synchronized boolean start(Context ctx, OnErrorListener listener) { 194 | if (sLibMPD != null) { 195 | /* 196 | * mpd can be run only one time 197 | */ 198 | return false; 199 | } 200 | sLibMPD = new LibMPD(ctx, listener); 201 | return sLibMPD.start(); 202 | } 203 | 204 | public static synchronized boolean stop() { 205 | if (sLibMPD == null) 206 | return false; 207 | sLibMPD.finish(); 208 | return true; 209 | } 210 | 211 | public static synchronized boolean isRunning() { 212 | return sLibMPD != null && sLibMPD.isThreadRunning(); 213 | } 214 | 215 | private native static void init(); 216 | private native static void deinit(); 217 | private native static int run(String mpdConf); 218 | private native static void quit(); 219 | } 220 | -------------------------------------------------------------------------------- /src/be/deadba/ampd/MPDConf.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 Thomas Guillem 3 | * 4 | * This file is part of aMPD. 5 | * 6 | * aMPD is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * aMPD is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with aMPD. If not, see . 18 | */ 19 | 20 | package be.deadba.ampd; 21 | 22 | import java.io.File; 23 | import java.io.FileNotFoundException; 24 | import java.io.FileOutputStream; 25 | import java.io.IOException; 26 | import java.util.ArrayList; 27 | import java.util.Iterator; 28 | 29 | import android.content.Context; 30 | import android.content.SharedPreferences; 31 | import android.content.SharedPreferences.Editor; 32 | import android.os.Environment; 33 | import android.util.Log; 34 | 35 | public class MPDConf { 36 | private final static String TAG = "MPDConf"; 37 | private final static String CONF_FILE = "mpd.conf"; 38 | private final static String STATE_FILE = "state"; 39 | private final static String DB_FILE = "database"; 40 | private final static String STICKER_FILE = "sticker.sql"; 41 | private final static String PLAYLISTS_FILE = "playlists"; 42 | private final static String LOG_FILE_DEFAULT = "androidlog"; 43 | private final static String LOG_LEVEL_DEFAULT = "default"; 44 | private final static String RESTORE_PAUSED_DEFAULT = "yes"; 45 | private final static String PORT_DEFAULT = "6600"; 46 | private final static String AUTO_UPDATE_DEFAULT = "no"; 47 | 48 | 49 | public final static String DEFAULT_MUSIC_DIRECTORY = Environment. 50 | getExternalStoragePublicDirectory(Environment.DIRECTORY_MUSIC).getAbsolutePath(); 51 | 52 | private static abstract class Entry { 53 | private final String key; 54 | 55 | public Entry(String key) { 56 | this.key = key; 57 | } 58 | public String getKey() { 59 | return this.key; 60 | } 61 | public abstract String getString(); 62 | public abstract Entries getBlock(); 63 | } 64 | 65 | private static class SimpleEntry extends Entry { 66 | private final String entry; 67 | public SimpleEntry(String key, String entry) { 68 | super(key); 69 | this.entry = entry; 70 | } 71 | @Override 72 | public String getString() { 73 | return entry; 74 | } 75 | @Override 76 | public Entries getBlock() { 77 | return null; 78 | } 79 | } 80 | 81 | private static class BlockEntry extends Entry { 82 | private final Entries entries; 83 | public BlockEntry(String key, Entries entries) { 84 | super(key); 85 | this.entries = entries; 86 | } 87 | @Override 88 | public String getString() { 89 | return null; 90 | } 91 | @Override 92 | public Entries getBlock() { 93 | return this.entries; 94 | } 95 | } 96 | 97 | private static class Entries extends ArrayList { 98 | private static final long serialVersionUID = 1L; 99 | public void put(String key, String entry) { 100 | add(new MPDConf.SimpleEntry(key, entry)); 101 | } 102 | public void put(String key, Entries entries) { 103 | add(new MPDConf.BlockEntry(key, entries)); 104 | } 105 | } 106 | 107 | private static boolean write(Context ctx, Entries entries) { 108 | boolean success = false; 109 | StringBuilder conf = new StringBuilder(); 110 | 111 | Iterator it = entries.iterator(); 112 | while (it.hasNext()) { 113 | MPDConf.Entry entry = it.next(); 114 | conf.append(entry.getKey()); 115 | if (entry.getString() != null) { 116 | conf.append(" \"").append(entry.getString()).append("\"\n"); 117 | } else { 118 | conf.append(" {\n"); 119 | Entries blockEntries = entry.getBlock(); 120 | Iterator blockIt = blockEntries.iterator(); 121 | while (blockIt.hasNext()) { 122 | MPDConf.Entry blockEntry = blockIt.next(); 123 | if (blockEntry.getString() == null) { 124 | return false; 125 | } 126 | conf.append(" ").append(blockEntry.getKey()) 127 | .append(" \"").append(blockEntry.getString()).append("\"\n"); 128 | blockIt.remove(); 129 | } 130 | conf.append("}\n"); 131 | } 132 | it.remove(); 133 | } 134 | try { 135 | FileOutputStream fos = ctx.openFileOutput(CONF_FILE, 0); 136 | fos.write(conf.toString().getBytes()); 137 | fos.close(); 138 | success = true; 139 | } catch (FileNotFoundException e) { 140 | e.printStackTrace(); 141 | } catch (IOException e) { 142 | e.printStackTrace(); 143 | } 144 | 145 | return success; 146 | } 147 | 148 | public static synchronized void reload(Context ctx) { 149 | Entries entries = new Entries(); 150 | 151 | SharedPreferences sp = getSharedPreferences(ctx); 152 | String musicDirectory = sp.getString("mpd_music_directory", MPDConf.DEFAULT_MUSIC_DIRECTORY); 153 | String lastMusicDirectory = sp.getString("last_music_directory", null); 154 | boolean useMixer = sp.getBoolean("mpd_mixer", true); 155 | String audioOutput = sp.getString("mpd_output", ctx.getString(R.string.mpd_default_output)); 156 | String port = sp.getString("mpd_port", MPDConf.PORT_DEFAULT); 157 | 158 | Log.d(TAG, "musicDirectory: " + musicDirectory); 159 | if (lastMusicDirectory == null || !musicDirectory.equals(lastMusicDirectory)) { 160 | Editor editor = sp.edit(); 161 | editor.putString("last_music_directory", musicDirectory); 162 | editor.commit(); 163 | Log.d(TAG, "music directory changed: clean db & state"); 164 | 165 | File file = ctx.getFileStreamPath(STATE_FILE); 166 | if (file.exists()) 167 | file.delete(); 168 | file = ctx.getFileStreamPath(DB_FILE); 169 | if (file.exists()) 170 | file.delete(); 171 | } 172 | 173 | String appPath = ctx.getFilesDir().getAbsolutePath() + "/"; 174 | File f = new File(appPath+PLAYLISTS_FILE); 175 | if (f.mkdirs() || f.isDirectory()) 176 | entries.put("playlist_directory", appPath+PLAYLISTS_FILE); 177 | entries.put("db_file", appPath+DB_FILE); 178 | entries.put("sticker_file", appPath+STICKER_FILE); 179 | entries.put("state_file",appPath+STATE_FILE); 180 | entries.put("log_file", LOG_FILE_DEFAULT); 181 | 182 | entries.put("log_level", LOG_LEVEL_DEFAULT); 183 | entries.put("restore_paused", RESTORE_PAUSED_DEFAULT); 184 | entries.put("auto_update", AUTO_UPDATE_DEFAULT); 185 | 186 | entries.put("music_directory", musicDirectory); 187 | entries.put("port", port); 188 | 189 | Entries audioOutputBlock = new Entries(); 190 | audioOutputBlock.put("type", audioOutput); 191 | if (!useMixer) 192 | audioOutputBlock.put("mixer_type", "none"); 193 | audioOutputBlock.put("name", audioOutput); 194 | entries.put("audio_output", audioOutputBlock); 195 | 196 | Entries inputBlock = new Entries(); 197 | inputBlock.put("plugin", "curl"); 198 | entries.put("input", inputBlock); 199 | 200 | Entries soundcloudBlock = new Entries(); 201 | soundcloudBlock.put("name", "soundcloud"); 202 | soundcloudBlock.put("enabled", "true"); 203 | soundcloudBlock.put("apikey", "c4c979fd6f241b5b30431d722af212e8"); 204 | entries.put("playlist_plugin", soundcloudBlock); 205 | 206 | write(ctx, entries); 207 | } 208 | 209 | /** 210 | * Return a SharedPreferences that can be read/write by different processes. 211 | * (Main Activity process and MPDService process) 212 | */ 213 | public static SharedPreferences getSharedPreferences(Context ctx) { 214 | return ctx.getSharedPreferences("mpdconf", Context.MODE_PRIVATE|Context.MODE_MULTI_PROCESS); 215 | } 216 | 217 | public static String getPath(Context ctx) { 218 | return ctx.getFilesDir()+"/"+CONF_FILE; 219 | } 220 | } 221 | -------------------------------------------------------------------------------- /src/be/deadba/ampd/MPDReceiver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 Thomas Guillem 3 | * 4 | * This file is part of aMPD. 5 | * 6 | * aMPD is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * aMPD is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with aMPD. If not, see . 18 | */ 19 | 20 | package be.deadba.ampd; 21 | 22 | import android.content.BroadcastReceiver; 23 | import android.content.Context; 24 | import android.content.Intent; 25 | import android.content.SharedPreferences; 26 | import android.util.Log; 27 | 28 | public class MPDReceiver extends BroadcastReceiver { 29 | @Override 30 | public void onReceive(Context context, Intent intent) { 31 | Log.d("MPDReceiver", "onReceive: " + intent); 32 | if (intent.getAction() == "android.intent.action.BOOT_COMPLETED") { 33 | SharedPreferences prefs = MPDConf.getSharedPreferences(context); 34 | if (prefs != null && prefs.getBoolean("run_on_boot", false)) 35 | MPDService.start(context); 36 | } 37 | } 38 | } 39 | --------------------------------------------------------------------------------