├── .gitignore ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── openssllib ├── .gitignore ├── TestOpenssl.jks ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── cn │ │ └── dabby │ │ └── openssllib │ │ └── ExampleInstrumentedTest.kt │ ├── main │ ├── AndroidManifest.xml │ ├── cpp │ │ ├── AesUtils.cpp │ │ ├── Base64Utils.cpp │ │ ├── CMakeLists.txt │ │ ├── CommonUtils.cpp │ │ ├── DesUtils.cpp │ │ ├── LogUtils.cpp │ │ ├── Md5Utils.cpp │ │ ├── RsaUtils.cpp │ │ ├── crypto │ │ │ ├── __DECC_INCLUDE_EPILOGUE.H │ │ │ ├── __DECC_INCLUDE_PROLOGUE.H │ │ │ ├── aria.h │ │ │ ├── asn1.h │ │ │ ├── async.h │ │ │ ├── bn.h │ │ │ ├── bn_conf.h │ │ │ ├── bn_conf.h.in │ │ │ ├── bn_dh.h │ │ │ ├── bn_srp.h │ │ │ ├── chacha.h │ │ │ ├── cryptlib.h │ │ │ ├── ctype.h │ │ │ ├── dso_conf.h │ │ │ ├── dso_conf.h.in │ │ │ ├── ec.h │ │ │ ├── engine.h │ │ │ ├── err.h │ │ │ ├── evp.h │ │ │ ├── lhash.h │ │ │ ├── md32_common.h │ │ │ ├── objects.h │ │ │ ├── poly1305.h │ │ │ ├── rand.h │ │ │ ├── sha.h │ │ │ ├── siphash.h │ │ │ ├── sm2.h │ │ │ ├── sm2err.h │ │ │ ├── sm3.h │ │ │ ├── sm4.h │ │ │ ├── store.h │ │ │ └── x509.h │ │ ├── crypto_lib.cpp │ │ ├── ctyptoHeader │ │ │ ├── AesUtils.h │ │ │ ├── Base64Utils.h │ │ │ ├── CommonUtils.h │ │ │ ├── DesUtils.h │ │ │ ├── Md5Utils.h │ │ │ └── RsaUtils.h │ │ ├── libs │ │ │ ├── arm64-v8a │ │ │ │ ├── libcrypto.a │ │ │ │ └── libssl.a │ │ │ └── armeabi-v7a │ │ │ │ ├── libcrypto.a │ │ │ │ └── libssl.a │ │ └── openssl │ │ │ ├── __DECC_INCLUDE_EPILOGUE.H │ │ │ ├── __DECC_INCLUDE_PROLOGUE.H │ │ │ ├── aes.h │ │ │ ├── asn1.h │ │ │ ├── asn1_mac.h │ │ │ ├── asn1err.h │ │ │ ├── asn1t.h │ │ │ ├── async.h │ │ │ ├── asyncerr.h │ │ │ ├── bio.h │ │ │ ├── bioerr.h │ │ │ ├── blowfish.h │ │ │ ├── bn.h │ │ │ ├── bnerr.h │ │ │ ├── buffer.h │ │ │ ├── buffererr.h │ │ │ ├── camellia.h │ │ │ ├── cast.h │ │ │ ├── cmac.h │ │ │ ├── cms.h │ │ │ ├── cmserr.h │ │ │ ├── comp.h │ │ │ ├── comperr.h │ │ │ ├── conf.h │ │ │ ├── conf_api.h │ │ │ ├── conferr.h │ │ │ ├── crypto.h │ │ │ ├── cryptoerr.h │ │ │ ├── ct.h │ │ │ ├── cterr.h │ │ │ ├── des.h │ │ │ ├── dh.h │ │ │ ├── dherr.h │ │ │ ├── dsa.h │ │ │ ├── dsaerr.h │ │ │ ├── dtls1.h │ │ │ ├── e_os2.h │ │ │ ├── ebcdic.h │ │ │ ├── ec.h │ │ │ ├── ecdh.h │ │ │ ├── ecdsa.h │ │ │ ├── ecerr.h │ │ │ ├── engine.h │ │ │ ├── engineerr.h │ │ │ ├── err.h │ │ │ ├── evp.h │ │ │ ├── evperr.h │ │ │ ├── hmac.h │ │ │ ├── idea.h │ │ │ ├── kdf.h │ │ │ ├── kdferr.h │ │ │ ├── lhash.h │ │ │ ├── md2.h │ │ │ ├── md4.h │ │ │ ├── md5.h │ │ │ ├── mdc2.h │ │ │ ├── modes.h │ │ │ ├── obj_mac.h │ │ │ ├── objects.h │ │ │ ├── objectserr.h │ │ │ ├── ocsp.h │ │ │ ├── ocsperr.h │ │ │ ├── opensslconf.h │ │ │ ├── opensslconf.h.in │ │ │ ├── opensslv.h │ │ │ ├── ossl_typ.h │ │ │ ├── pem.h │ │ │ ├── pem2.h │ │ │ ├── pemerr.h │ │ │ ├── pkcs12.h │ │ │ ├── pkcs12err.h │ │ │ ├── pkcs7.h │ │ │ ├── pkcs7err.h │ │ │ ├── rand.h │ │ │ ├── rand_drbg.h │ │ │ ├── randerr.h │ │ │ ├── rc2.h │ │ │ ├── rc4.h │ │ │ ├── rc5.h │ │ │ ├── ripemd.h │ │ │ ├── rsa.h │ │ │ ├── rsaerr.h │ │ │ ├── safestack.h │ │ │ ├── seed.h │ │ │ ├── sha.h │ │ │ ├── srp.h │ │ │ ├── srtp.h │ │ │ ├── ssl.h │ │ │ ├── ssl2.h │ │ │ ├── ssl3.h │ │ │ ├── sslerr.h │ │ │ ├── stack.h │ │ │ ├── store.h │ │ │ ├── storeerr.h │ │ │ ├── symhacks.h │ │ │ ├── tls1.h │ │ │ ├── ts.h │ │ │ ├── tserr.h │ │ │ ├── txt_db.h │ │ │ ├── ui.h │ │ │ ├── uierr.h │ │ │ ├── whrlpool.h │ │ │ ├── x509.h │ │ │ ├── x509_vfy.h │ │ │ ├── x509err.h │ │ │ ├── x509v3.h │ │ │ └── x509v3err.h │ ├── java │ │ └── cn │ │ │ └── dabby │ │ │ └── openssllib │ │ │ ├── AesActivity.kt │ │ │ ├── Base64Activity.kt │ │ │ ├── CryptographicUtils.kt │ │ │ ├── DESActivity.kt │ │ │ ├── MainActivity.kt │ │ │ ├── OpensslApp.kt │ │ │ ├── RsaActivity.kt │ │ │ ├── TTSActivity.kt │ │ │ ├── TestEntity.kt │ │ │ ├── TestH5AuthActivity.java │ │ │ ├── TestOther.kt │ │ │ └── utils │ │ │ ├── AesCbcUtil.java │ │ │ ├── AesEcbUtil.java │ │ │ ├── Des3Util.java │ │ │ ├── PhotoUtils.java │ │ │ ├── RSAUtil.java │ │ │ ├── StringTool.java │ │ │ ├── TestPrintln.java │ │ │ └── UtilTool.java │ └── res │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable │ │ └── ic_launcher_background.xml │ │ ├── layout │ │ ├── activity_aes.xml │ │ ├── activity_base_64.xml │ │ ├── activity_des.xml │ │ ├── activity_h5_auth.xml │ │ ├── activity_main.xml │ │ ├── activity_rsa.xml │ │ └── activity_tts.xml │ │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── values │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── styles.xml │ │ └── xml │ │ ├── badge_face_photo.xml │ │ └── network_security_config.xml │ └── test │ └── java │ └── cn │ └── dabby │ └── openssllib │ └── ExampleUnitTest.kt └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/caches 5 | /.idea/libraries 6 | /.idea/modules.xml 7 | /.idea/workspace.xml 8 | /.idea/navEditor.xml 9 | /.idea/assetWizardSettings.xml 10 | .DS_Store 11 | /build 12 | /captures 13 | .externalNativeBuild 14 | .cxx 15 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | buildscript { 3 | ext.kotlin_version = "1.4.10" 4 | repositories { 5 | google() 6 | jcenter() 7 | mavenCentral() 8 | } 9 | dependencies { 10 | classpath 'com.android.tools.build:gradle:4.0.1' 11 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 12 | 13 | // NOTE: Do not place your application dependencies here; they belong 14 | // in the individual module build.gradle files 15 | } 16 | } 17 | 18 | allprojects { 19 | repositories { 20 | google() 21 | jcenter() 22 | maven {url 'https://maven.google.com'} 23 | maven { url 'https://jitpack.io' } 24 | } 25 | } 26 | 27 | task clean(type: Delete) { 28 | delete rootProject.buildDir 29 | } -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx2048m 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | # Kotlin code style for this project: "official" or "obsolete": 15 | kotlin.code.style=official 16 | 17 | android.useAndroidX=true 18 | # Automatically convert third-party libraries to use AndroidX 19 | android.enableJetifier=true -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wgc0303/OpensslByAndroid/efec1101f506fa49822b80c5a5fa8b446d63acf6/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Jun 08 15:54:02 CST 2020 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip 7 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /openssllib/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /openssllib/TestOpenssl.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wgc0303/OpensslByAndroid/efec1101f506fa49822b80c5a5fa8b446d63acf6/openssllib/TestOpenssl.jks -------------------------------------------------------------------------------- /openssllib/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | apply plugin: 'kotlin-android' 3 | apply plugin: 'kotlin-android-extensions' 4 | 5 | android { 6 | compileSdkVersion 29 7 | buildToolsVersion "29.0.3" 8 | 9 | defaultConfig { 10 | applicationId "cn.dabby.openssllib" 11 | minSdkVersion 19 12 | targetSdkVersion 27 13 | versionCode 1 14 | versionName "1.0" 15 | 16 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 17 | ndk { 18 | abiFilters 'armeabi-v7a' /*,'arm64-v8a'*/ 19 | } 20 | externalNativeBuild { 21 | cmake { 22 | cppFlags "" 23 | abiFilters 'armeabi-v7a'/* ,'arm64-v8a'*/ 24 | } 25 | } 26 | 27 | } 28 | 29 | buildTypes { 30 | release { 31 | minifyEnabled false 32 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 33 | } 34 | } 35 | externalNativeBuild { 36 | cmake { 37 | path "/src/main/cpp/CMakeLists.txt" 38 | version "3.10.2" 39 | } 40 | } 41 | 42 | signingConfigs { 43 | release { 44 | storeFile file("\\TestOpenssl.jks") 45 | storePassword "openssltest." 46 | keyAlias "openssl" 47 | keyPassword "openssltest." 48 | } 49 | } 50 | 51 | buildTypes { 52 | release { 53 | minifyEnabled true 54 | shrinkResources true 55 | signingConfig signingConfigs.release 56 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 57 | buildConfigField("String", "BUILD_TIME", "\"" + new Date().format("yyyy/MM/dd HH:mm:ss") + "\"") 58 | } 59 | debug { 60 | minifyEnabled false 61 | shrinkResources false 62 | signingConfig signingConfigs.release 63 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 64 | buildConfigField("String", "BUILD_TIME", "\"" + new Date().format("yyyy/MM/dd HH:mm:ss") + "\"") 65 | } 66 | } 67 | 68 | } 69 | 70 | dependencies { 71 | implementation fileTree(dir: "libs", include: ["*.jar"]) 72 | implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" 73 | implementation 'androidx.core:core-ktx:1.3.0' 74 | implementation 'androidx.appcompat:appcompat:1.1.0' 75 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3' 76 | testImplementation 'junit:junit:4.12' 77 | androidTestImplementation 'androidx.test.ext:junit:1.1.1' 78 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' 79 | implementation 'com.blankj:utilcodex:1.29.0' 80 | 81 | } 82 | -------------------------------------------------------------------------------- /openssllib/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | 23 | # 保留R下面的资源 24 | -keep class **.R$* {*;} 25 | 26 | # 保留本地native方法不被混淆 27 | -keepclasseswithmembernames class * { 28 | native ; 29 | } -------------------------------------------------------------------------------- /openssllib/src/androidTest/java/cn/dabby/openssllib/ExampleInstrumentedTest.kt: -------------------------------------------------------------------------------- 1 | package cn.dabby.openssllib 2 | 3 | import androidx.test.platform.app.InstrumentationRegistry 4 | import androidx.test.ext.junit.runners.AndroidJUnit4 5 | 6 | import org.junit.Test 7 | import org.junit.runner.RunWith 8 | 9 | import org.junit.Assert.* 10 | 11 | /** 12 | * Instrumented test, which will execute on an Android device. 13 | * 14 | * See [testing documentation](http://d.android.com/tools/testing). 15 | */ 16 | @RunWith(AndroidJUnit4::class) 17 | class ExampleInstrumentedTest { 18 | @Test 19 | fun useAppContext() { 20 | // Context of the app under test. 21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext 22 | assertEquals("cn.dabby.openssllib", appContext.packageName) 23 | } 24 | } -------------------------------------------------------------------------------- /openssllib/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 19 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 32 | 33 | 36 | 37 | 40 | 41 | 44 | 45 | 48 | 49 | 51 | 52 | 57 | 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/Base64Utils.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | *
 3 |  *
 4 |  *     author : wgc
 5 |  *     time   : 2020/06/15
 6 |  *     desc   :
 7 |  *     version: 1.0
 8 |  * 
 9 |  * 
10 | */ 11 | 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | /** 21 | * base64编码 22 | * @param input 待编码内容 23 | * @param length 待编码内容长度 24 | * @param newLine 是否换行 25 | * @return 编码后内容 26 | */ 27 | char *base64Encode(const char *buffer, int length, bool newLine) { 28 | BIO *bmem = nullptr; 29 | BIO *b64 = nullptr; 30 | BUF_MEM *bptr; 31 | b64 = BIO_new(BIO_f_base64()); 32 | if (!newLine) { 33 | BIO_set_flags(b64, BIO_FLAGS_BASE64_NO_NL); 34 | } 35 | bmem = BIO_new(BIO_s_mem()); 36 | b64 = BIO_push(b64, bmem); 37 | BIO_write(b64, buffer, length); 38 | BIO_flush(b64); 39 | BIO_get_mem_ptr(b64, &bptr); 40 | BIO_set_close(b64, BIO_NOCLOSE); 41 | char *buff = (char *) malloc(bptr->length + 1); 42 | memcpy(buff, bptr->data, bptr->length); 43 | buff[bptr->length] = '\0'; 44 | BIO_free_all(b64); 45 | return buff; 46 | } 47 | 48 | /** 49 | * base64解码 50 | * @param input 待解码内容 51 | * @param length 待解码内容长度 52 | * @param newLine 是否换行 53 | * @return 解码后内容 54 | */ 55 | char *base64Decode(const char *input, int length, bool newLine) { 56 | BIO *b64 = nullptr; 57 | BIO *bmem = nullptr; 58 | char *buffer = (char *) malloc(length); 59 | memset(buffer, 0, length); 60 | b64 = BIO_new(BIO_f_base64()); 61 | if (!newLine) { 62 | BIO_set_flags(b64, BIO_FLAGS_BASE64_NO_NL); 63 | } 64 | bmem = BIO_new_mem_buf(input, length); 65 | bmem = BIO_push(b64, bmem); 66 | BIO_read(bmem, buffer, length); 67 | BIO_free_all(bmem); 68 | return buffer; 69 | } -------------------------------------------------------------------------------- /openssllib/src/main/cpp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # For more information about using CMake with Android Studio, read the 2 | # documentation: https://d.android.com/studio/projects/add-native-code.html 3 | 4 | # Sets the minimum version of CMake required to build the native library. 5 | #cmake可编译的最小版本 6 | cmake_minimum_required(VERSION 3.4.1) 7 | 8 | # Creates and names a library, sets it as either STATIC 9 | # or SHARED, and provides the relative paths to its source code. 10 | # You can define multiple libraries, and CMake builds them for you. 11 | # Gradle automatically packages shared libraries with your APK. 12 | 13 | 14 | 15 | 16 | #指定c++文件路徑 17 | file(GLOB SOURCE ${CMAKE_SOURCE_DIR}/*.cpp) 18 | 19 | ##表示把src/main/cpp加入到include目录,这样在代码中使用:#include <...>就能访问到头文件 20 | #include_directories(src/main/cpp) 21 | include_directories(${CMAKE_SOURCE_DIR}) 22 | 23 | 24 | #添加目标库 25 | add_library( # Sets the name of the library. 26 | crypto_lib 27 | 28 | # Sets the library as a shared library. 29 | SHARED 30 | 31 | # Provides a relative path to your source file(s). 32 | #目标库c++资源路径 33 | ${SOURCE}) 34 | 35 | 36 | 37 | #添加两个预编译库 38 | add_library(# Sets the name of the library. 39 | openssl-crypto 40 | # Sets the library as a static library. 41 | STATIC 42 | IMPORTED) 43 | 44 | set_target_properties( 45 | # Specifies the target library. 46 | openssl-crypto 47 | # Specifies the parameter you want to define. 48 | PROPERTIES IMPORTED_LOCATION 49 | # Provides the path to the library you want to import. 50 | ${CMAKE_SOURCE_DIR}/libs/${ANDROID_ABI}/libcrypto.a) 51 | 52 | add_library(# Sets the name of the library. 53 | openssl-ssl 54 | # Sets the library as a static library. 55 | STATIC 56 | IMPORTED) 57 | 58 | set_target_properties( 59 | # Specifies the target library. 60 | openssl-ssl 61 | # Specifies the parameter you want to define. 62 | PROPERTIES IMPORTED_LOCATION 63 | # Provides the path to the library you want to import. 64 | ${CMAKE_SOURCE_DIR}/libs/${ANDROID_ABI}/libssl.a) 65 | 66 | #查找android log库 67 | find_library( # Sets the name of the path variable. 68 | log-lib 69 | 70 | # Specifies the name of the NDK library that 71 | # you want CMake to locate. 72 | log) 73 | 74 | #编译关联目标库 75 | target_link_libraries( # Specifies the target library. 76 | crypto_lib 77 | # Links the target library to the log library 78 | # included in the NDK. 79 | #目标库与其他库关联 80 | ${log-lib} openssl-ssl openssl-crypto) 81 | 82 | 83 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/DesUtils.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | *
  3 |  *
  4 |  *     author : wgc
  5 |  *     time   : 2020/06/15
  6 |  *     desc   :
  7 |  *     version: 1.0
  8 |  * 
  9 |  * 
10 | */ 11 | 12 | #include "openssl/evp.h" 13 | #include "ctyptoHeader/DesUtils.h" 14 | #include "LogUtils.cpp" 15 | #include "openssl/des.h" 16 | #include "string" 17 | 18 | 19 | /** 20 | * des3cbc加密 21 | * @param env 22 | * @param keys_ 23 | * @param iv_ 24 | * @param src_ 25 | * @return 26 | */ 27 | jbyteArray des3CbcEncrypt(JNIEnv *env, jbyteArray keys_, jbyteArray iv_, jbyteArray src_) { 28 | LOGD("DES->对称密钥,也就是说加密和解密用的是同一个密钥"); 29 | jbyte *keys = env->GetByteArrayElements(keys_, nullptr); 30 | jbyte *src = env->GetByteArrayElements(src_, nullptr); 31 | jbyte *iv = env->GetByteArrayElements(iv_, nullptr); 32 | jsize src_Len = env->GetArrayLength(src_); 33 | 34 | int outlen = 0, cipherText_len = 0; 35 | //计算加密后数据长度并分配内存空间 36 | auto *out = (unsigned char *) malloc((src_Len / 8 + 1) * 8); 37 | //清空内存空间 38 | memset(out, 0, (src_Len / 8 + 1) * 8); 39 | 40 | EVP_CIPHER_CTX *ctx = EVP_CIPHER_CTX_new(); 41 | EVP_CIPHER_CTX_init(ctx); 42 | //设置padding 43 | //EVP_CIPHER_CTX_set_padding(ctx,EVP_PADDING_PKCS7); 44 | 45 | LOGD("DES->指定加密算法,初始化加密key/iv"); 46 | EVP_EncryptInit_ex(ctx, EVP_des_ede_cbc(), nullptr, (const unsigned char *) keys, 47 | reinterpret_cast(iv)); 48 | LOGD("DES->对数据进行加密运算"); 49 | EVP_EncryptUpdate(ctx, out, &outlen, (const unsigned char *) src, src_Len); 50 | cipherText_len = outlen; 51 | 52 | LOGD("DES->结束加密运算"); 53 | EVP_EncryptFinal_ex(ctx, out + outlen, &outlen); 54 | cipherText_len += outlen; 55 | 56 | LOGD("DES->EVP_CIPHER_CTX_cleanup"); 57 | EVP_CIPHER_CTX_cleanup(ctx); 58 | 59 | LOGD("DES->从jni释放数据指针"); 60 | env->ReleaseByteArrayElements(keys_, keys, 0); 61 | env->ReleaseByteArrayElements(src_, src, 0); 62 | env->ReleaseByteArrayElements(iv_, iv, 0); 63 | 64 | jbyteArray cipher = env->NewByteArray(cipherText_len); 65 | LOGD("DES->在堆中分配ByteArray数组对象成功,将拷贝数据到数组中"); 66 | env->SetByteArrayRegion(cipher, 0, cipherText_len, (jbyte *) out); 67 | LOGD("DES->释放内存"); 68 | free(out); 69 | return cipher; 70 | } 71 | 72 | /** 73 | * des3cbc解密 74 | * @param env 75 | * @param keys_ 76 | * @param iv_ 77 | * @param src_ 78 | * @return 79 | */ 80 | jbyteArray des3CbcDecrypt(JNIEnv *env, jbyteArray keys_, jbyteArray iv_, jbyteArray src_) { 81 | LOGD("DES->对称密钥,也就是说加密和解密用的是同一个密钥"); 82 | jbyte *keys = env->GetByteArrayElements(keys_, nullptr); 83 | jbyte *src = env->GetByteArrayElements(src_, nullptr); 84 | jbyte *iv = env->GetByteArrayElements(iv_, nullptr); 85 | jsize src_Len = env->GetArrayLength(src_); 86 | 87 | int outlen = 0, plaintext_len = 0; 88 | 89 | auto *out = (unsigned char *) malloc(src_Len); 90 | memset(out, 0, src_Len); 91 | 92 | EVP_CIPHER_CTX *ctx = EVP_CIPHER_CTX_new(); 93 | EVP_CIPHER_CTX_init(ctx); 94 | 95 | //设置padding 96 | //EVP_CIPHER_CTX_set_padding(ctx,EVP_PADDING_PKCS7); 97 | 98 | LOGD("DES->指定解密算法,初始化解密key/iv"); 99 | EVP_DecryptInit_ex(ctx, EVP_des_ede3_cbc(), nullptr, (const unsigned char *) keys, 100 | (const unsigned char *) iv); 101 | LOGD("DES->对数据进行解密运算"); 102 | EVP_DecryptUpdate(ctx, out, &outlen, (const unsigned char *) src, src_Len); 103 | plaintext_len = outlen; 104 | 105 | LOGD("DES->结束解密运算"); 106 | EVP_DecryptFinal_ex(ctx, out + outlen, &outlen); 107 | plaintext_len += outlen; 108 | 109 | LOGD("DES->EVP_CIPHER_CTX_cleanup"); 110 | EVP_CIPHER_CTX_cleanup(ctx); 111 | 112 | LOGD("DES->从jni释放数据指针"); 113 | env->ReleaseByteArrayElements(keys_, keys, 0); 114 | env->ReleaseByteArrayElements(src_, src, 0); 115 | env->ReleaseByteArrayElements(iv_, iv, 0); 116 | 117 | jbyteArray cipher = env->NewByteArray(plaintext_len); 118 | LOGD("DES->在堆中分配ByteArray数组对象成功,将拷贝数据到数组中"); 119 | env->SetByteArrayRegion(cipher, 0, plaintext_len, (jbyte *) out); 120 | LOGD("DES->释放内存"); 121 | free(out); 122 | 123 | return cipher; 124 | } 125 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/LogUtils.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | *
 3 |  *
 4 |  *     author : wgc
 5 |  *     time   : 2020/06/05
 6 |  *     desc   :
 7 |  *     version: 1.0
 8 |  * 
 9 |  * 
10 | */ 11 | 12 | #include 13 | 14 | #define DEBUG 1 //日志开关,1为开,其它为关 15 | #if(DEBUG==1) 16 | #define LOG_TAG "JNI" 17 | #define LOGV(...) __android_log_print(ANDROID_LOG_VERBOSE,LOG_TAG,__VA_ARGS__) 18 | #define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__) 19 | #define LOGI(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__) 20 | #define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__) 21 | #else 22 | #define LOGV(...) NULL 23 | #define LOGD(...) NULL 24 | #define LOGI(...) NULL 25 | #define LOGE(...) NULL 26 | #endif 27 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/Md5Utils.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | *
 3 |  *
 4 |  *     author : wgc
 5 |  *     time   : 2021/04/27
 6 |  *     desc   :
 7 |  *     version: 1.0
 8 |  * 
 9 |  * 
10 | */ 11 | 12 | #include "ctyptoHeader/Md5Utils.h" 13 | #include 14 | #include "LogUtils.cpp" 15 | #include "openssl/md5.h" 16 | 17 | /** 18 | * md5摘要 19 | * @param src_ 20 | * @return hexString 21 | */ 22 | jstring md5(JNIEnv *env, jbyteArray src_) { 23 | LOGD("MD5->信息摘要算法第五版"); 24 | jbyte *src = env->GetByteArrayElements(src_, nullptr); 25 | jsize src_Len = env->GetArrayLength(src_); 26 | 27 | char buff[3] = {'\0'}; 28 | char hex[33] = {'\0'}; 29 | unsigned char digest[MD5_DIGEST_LENGTH]; 30 | 31 | // MD5((const unsigned char *) src, src_Len, digest); 32 | 33 | MD5_CTX ctx; 34 | MD5_Init(&ctx); 35 | LOGD("MD5->进行MD5信息摘要运算"); 36 | MD5_Update(&ctx, src, src_Len); 37 | MD5_Final(digest, &ctx); 38 | 39 | strcpy(hex, ""); 40 | LOGD("MD5->把哈希值按%%02x格式定向到缓冲区"); 41 | for (int i = 0; i != sizeof(digest); i++) { 42 | sprintf(buff, "%02x", digest[i]); 43 | strcat(hex, buff); 44 | } 45 | LOGD("MD5->%s", hex); 46 | 47 | LOGD("MD5->从jni释放数据指针"); 48 | env->ReleaseByteArrayElements(src_, src, 0); 49 | 50 | return env->NewStringUTF(hex); 51 | } 52 | 53 | 54 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/crypto/__DECC_INCLUDE_EPILOGUE.H: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | /* 11 | * This file is only used by HP C on VMS, and is included automatically 12 | * after each header file from this directory 13 | */ 14 | 15 | /* restore state. Must correspond to the save in __decc_include_prologue.h */ 16 | #pragma names restore 17 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/crypto/__DECC_INCLUDE_PROLOGUE.H: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | /* 11 | * This file is only used by HP C on VMS, and is included automatically 12 | * after each header file from this directory 13 | */ 14 | 15 | /* save state */ 16 | #pragma names save 17 | /* have the compiler shorten symbols larger than 31 chars to 23 chars 18 | * followed by a 8 hex char CRC 19 | */ 20 | #pragma names as_is,shortened 21 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/crypto/aria.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2006-2018 The OpenSSL Project Authors. All Rights Reserved. 3 | * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. 4 | * 5 | * Licensed under the OpenSSL license (the "License"). You may not use 6 | * this file except in compliance with the License. You can obtain a copy 7 | * in the file LICENSE in the source distribution or at 8 | * https://www.openssl.org/source/license.html 9 | */ 10 | 11 | /* Copyright (c) 2017 National Security Research Institute. All rights reserved. */ 12 | 13 | #ifndef OSSL_CRYPTO_ARIA_H 14 | # define OSSL_CRYPTO_ARIA_H 15 | 16 | # include 17 | 18 | # ifdef OPENSSL_NO_ARIA 19 | # error ARIA is disabled. 20 | # endif 21 | 22 | # define ARIA_ENCRYPT 1 23 | # define ARIA_DECRYPT 0 24 | 25 | # define ARIA_BLOCK_SIZE 16 /* Size of each encryption/decryption block */ 26 | # define ARIA_MAX_KEYS 17 /* Number of keys needed in the worst case */ 27 | 28 | typedef union { 29 | unsigned char c[ARIA_BLOCK_SIZE]; 30 | unsigned int u[ARIA_BLOCK_SIZE / sizeof(unsigned int)]; 31 | } ARIA_u128; 32 | 33 | typedef unsigned char ARIA_c128[ARIA_BLOCK_SIZE]; 34 | 35 | struct aria_key_st { 36 | ARIA_u128 rd_key[ARIA_MAX_KEYS]; 37 | unsigned int rounds; 38 | }; 39 | typedef struct aria_key_st ARIA_KEY; 40 | 41 | 42 | int aria_set_encrypt_key(const unsigned char *userKey, const int bits, 43 | ARIA_KEY *key); 44 | int aria_set_decrypt_key(const unsigned char *userKey, const int bits, 45 | ARIA_KEY *key); 46 | 47 | void aria_encrypt(const unsigned char *in, unsigned char *out, 48 | const ARIA_KEY *key); 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/crypto/async.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #include 11 | 12 | int async_init(void); 13 | void async_deinit(void); 14 | void async_delete_thread_state(void); 15 | 16 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/crypto/bn.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2018 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef OSSL_CRYPTO_BN_H 11 | # define OSSL_CRYPTO_BN_H 12 | 13 | # include 14 | # include 15 | 16 | BIGNUM *bn_wexpand(BIGNUM *a, int words); 17 | BIGNUM *bn_expand2(BIGNUM *a, int words); 18 | 19 | void bn_correct_top(BIGNUM *a); 20 | 21 | /* 22 | * Determine the modified width-(w+1) Non-Adjacent Form (wNAF) of 'scalar'. 23 | * This is an array r[] of values that are either zero or odd with an 24 | * absolute value less than 2^w satisfying scalar = \sum_j r[j]*2^j where at 25 | * most one of any w+1 consecutive digits is non-zero with the exception that 26 | * the most significant digit may be only w-1 zeros away from that next 27 | * non-zero digit. 28 | */ 29 | signed char *bn_compute_wNAF(const BIGNUM *scalar, int w, size_t *ret_len); 30 | 31 | int bn_get_top(const BIGNUM *a); 32 | 33 | int bn_get_dmax(const BIGNUM *a); 34 | 35 | /* Set all words to zero */ 36 | void bn_set_all_zero(BIGNUM *a); 37 | 38 | /* 39 | * Copy the internal BIGNUM words into out which holds size elements (and size 40 | * must be bigger than top) 41 | */ 42 | int bn_copy_words(BN_ULONG *out, const BIGNUM *in, int size); 43 | 44 | BN_ULONG *bn_get_words(const BIGNUM *a); 45 | 46 | /* 47 | * Set the internal data words in a to point to words which contains size 48 | * elements. The BN_FLG_STATIC_DATA flag is set 49 | */ 50 | void bn_set_static_words(BIGNUM *a, const BN_ULONG *words, int size); 51 | 52 | /* 53 | * Copy words into the BIGNUM |a|, reallocating space as necessary. 54 | * The negative flag of |a| is not modified. 55 | * Returns 1 on success and 0 on failure. 56 | */ 57 | /* 58 | * |num_words| is int because bn_expand2 takes an int. This is an internal 59 | * function so we simply trust callers not to pass negative values. 60 | */ 61 | int bn_set_words(BIGNUM *a, const BN_ULONG *words, int num_words); 62 | 63 | /* 64 | * Some BIGNUM functions assume most significant limb to be non-zero, which 65 | * is customarily arranged by bn_correct_top. Output from below functions 66 | * is not processed with bn_correct_top, and for this reason it may not be 67 | * returned out of public API. It may only be passed internally into other 68 | * functions known to support non-minimal or zero-padded BIGNUMs. Even 69 | * though the goal is to facilitate constant-time-ness, not each subroutine 70 | * is constant-time by itself. They all have pre-conditions, consult source 71 | * code... 72 | */ 73 | int bn_mul_mont_fixed_top(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 74 | BN_MONT_CTX *mont, BN_CTX *ctx); 75 | int bn_to_mont_fixed_top(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont, 76 | BN_CTX *ctx); 77 | int bn_from_mont_fixed_top(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont, 78 | BN_CTX *ctx); 79 | int bn_mod_add_fixed_top(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 80 | const BIGNUM *m); 81 | int bn_mod_sub_fixed_top(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 82 | const BIGNUM *m); 83 | int bn_mul_fixed_top(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx); 84 | int bn_sqr_fixed_top(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx); 85 | int bn_lshift_fixed_top(BIGNUM *r, const BIGNUM *a, int n); 86 | int bn_rshift_fixed_top(BIGNUM *r, const BIGNUM *a, int n); 87 | int bn_div_fixed_top(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, 88 | const BIGNUM *d, BN_CTX *ctx); 89 | 90 | #endif 91 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/crypto/bn_conf.h: -------------------------------------------------------------------------------- 1 | /* WARNING: do not edit! */ 2 | /* Generated by Makefile from include/crypto/bn_conf.h.in */ 3 | /* 4 | * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved. 5 | * 6 | * Licensed under the OpenSSL license (the "License"). You may not use 7 | * this file except in compliance with the License. You can obtain a copy 8 | * in the file LICENSE in the source distribution or at 9 | * https://www.openssl.org/source/license.html 10 | */ 11 | 12 | #ifndef OSSL_CRYPTO_BN_CONF_H 13 | # define OSSL_CRYPTO_BN_CONF_H 14 | 15 | /* 16 | * The contents of this file are not used in the UEFI build, as 17 | * both 32-bit and 64-bit builds are supported from a single run 18 | * of the Configure script. 19 | */ 20 | 21 | /* Should we define BN_DIV2W here? */ 22 | 23 | /* Only one for the following should be defined */ 24 | #define SIXTY_FOUR_BIT_LONG 25 | #undef SIXTY_FOUR_BIT 26 | #undef THIRTY_TWO_BIT 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/crypto/bn_conf.h.in: -------------------------------------------------------------------------------- 1 | {- join("\n",map { "/* $_ */" } @autowarntext) -} 2 | /* 3 | * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved. 4 | * 5 | * Licensed under the OpenSSL license (the "License"). You may not use 6 | * this file except in compliance with the License. You can obtain a copy 7 | * in the file LICENSE in the source distribution or at 8 | * https://www.openssl.org/source/license.html 9 | */ 10 | 11 | #ifndef OSSL_CRYPTO_BN_CONF_H 12 | # define OSSL_CRYPTO_BN_CONF_H 13 | 14 | /* 15 | * The contents of this file are not used in the UEFI build, as 16 | * both 32-bit and 64-bit builds are supported from a single run 17 | * of the Configure script. 18 | */ 19 | 20 | /* Should we define BN_DIV2W here? */ 21 | 22 | /* Only one for the following should be defined */ 23 | {- $config{b64l} ? "#define" : "#undef" -} SIXTY_FOUR_BIT_LONG 24 | {- $config{b64} ? "#define" : "#undef" -} SIXTY_FOUR_BIT 25 | {- $config{b32} ? "#define" : "#undef" -} THIRTY_TWO_BIT 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/crypto/bn_dh.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #define declare_dh_bn(x) \ 11 | extern const BIGNUM _bignum_dh##x##_p; \ 12 | extern const BIGNUM _bignum_dh##x##_g; \ 13 | extern const BIGNUM _bignum_dh##x##_q; 14 | 15 | declare_dh_bn(1024_160) 16 | declare_dh_bn(2048_224) 17 | declare_dh_bn(2048_256) 18 | 19 | extern const BIGNUM _bignum_ffdhe2048_p; 20 | extern const BIGNUM _bignum_ffdhe3072_p; 21 | extern const BIGNUM _bignum_ffdhe4096_p; 22 | extern const BIGNUM _bignum_ffdhe6144_p; 23 | extern const BIGNUM _bignum_ffdhe8192_p; 24 | extern const BIGNUM _bignum_const_2; 25 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/crypto/bn_srp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef OPENSSL_NO_SRP 11 | 12 | extern const BIGNUM bn_group_1024; 13 | 14 | extern const BIGNUM bn_group_1536; 15 | 16 | extern const BIGNUM bn_group_2048; 17 | 18 | extern const BIGNUM bn_group_3072; 19 | 20 | extern const BIGNUM bn_group_4096; 21 | 22 | extern const BIGNUM bn_group_6144; 23 | 24 | extern const BIGNUM bn_group_8192; 25 | 26 | extern const BIGNUM bn_generator_19; 27 | 28 | extern const BIGNUM bn_generator_5; 29 | 30 | extern const BIGNUM bn_generator_2; 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/crypto/chacha.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015-2018 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef OSSL_CRYPTO_CHACHA_H 11 | #define OSSL_CRYPTO_CHACHA_H 12 | 13 | #include 14 | 15 | /* 16 | * ChaCha20_ctr32 encrypts |len| bytes from |inp| with the given key and 17 | * nonce and writes the result to |out|, which may be equal to |inp|. 18 | * The |key| is not 32 bytes of verbatim key material though, but the 19 | * said material collected into 8 32-bit elements array in host byte 20 | * order. Same approach applies to nonce: the |counter| argument is 21 | * pointer to concatenated nonce and counter values collected into 4 22 | * 32-bit elements. This, passing crypto material collected into 32-bit 23 | * elements as opposite to passing verbatim byte vectors, is chosen for 24 | * efficiency in multi-call scenarios. 25 | */ 26 | void ChaCha20_ctr32(unsigned char *out, const unsigned char *inp, 27 | size_t len, const unsigned int key[8], 28 | const unsigned int counter[4]); 29 | /* 30 | * You can notice that there is no key setup procedure. Because it's 31 | * as trivial as collecting bytes into 32-bit elements, it's reckoned 32 | * that below macro is sufficient. 33 | */ 34 | #define CHACHA_U8TOU32(p) ( \ 35 | ((unsigned int)(p)[0]) | ((unsigned int)(p)[1]<<8) | \ 36 | ((unsigned int)(p)[2]<<16) | ((unsigned int)(p)[3]<<24) ) 37 | 38 | #define CHACHA_KEY_SIZE 32 39 | #define CHACHA_CTR_SIZE 16 40 | #define CHACHA_BLK_SIZE 64 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/crypto/cryptlib.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #include "internal/cryptlib.h" 11 | 12 | /* This file is not scanned by mkdef.pl, whereas cryptlib.h is */ 13 | 14 | struct thread_local_inits_st { 15 | int async; 16 | int err_state; 17 | int rand; 18 | }; 19 | 20 | int ossl_init_thread_start(uint64_t opts); 21 | 22 | /* 23 | * OPENSSL_INIT flags. The primary list of these is in crypto.h. Flags below 24 | * are those omitted from crypto.h because they are "reserved for internal 25 | * use". 26 | */ 27 | # define OPENSSL_INIT_ZLIB 0x00010000L 28 | # define OPENSSL_INIT_BASE_ONLY 0x00040000L 29 | 30 | /* OPENSSL_INIT_THREAD flags */ 31 | # define OPENSSL_INIT_THREAD_ASYNC 0x01 32 | # define OPENSSL_INIT_THREAD_ERR_STATE 0x02 33 | # define OPENSSL_INIT_THREAD_RAND 0x04 34 | 35 | void ossl_malloc_setup_failures(void); 36 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/crypto/ctype.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2019 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | /* 11 | * This version of ctype.h provides a standardised and platform 12 | * independent implementation that supports seven bit ASCII characters. 13 | * The specific intent is to not pass extended ASCII characters (> 127) 14 | * even if the host operating system would. 15 | * 16 | * There is EBCDIC support included for machines which use this. However, 17 | * there are a number of concerns about how well EBCDIC is supported 18 | * throughout the rest of the source code. Refer to issue #4154 for 19 | * details. 20 | */ 21 | #ifndef OSSL_CRYPTO_CTYPE_H 22 | # define OSSL_CRYPTO_CTYPE_H 23 | 24 | # define CTYPE_MASK_lower 0x1 25 | # define CTYPE_MASK_upper 0x2 26 | # define CTYPE_MASK_digit 0x4 27 | # define CTYPE_MASK_space 0x8 28 | # define CTYPE_MASK_xdigit 0x10 29 | # define CTYPE_MASK_blank 0x20 30 | # define CTYPE_MASK_cntrl 0x40 31 | # define CTYPE_MASK_graph 0x80 32 | # define CTYPE_MASK_print 0x100 33 | # define CTYPE_MASK_punct 0x200 34 | # define CTYPE_MASK_base64 0x400 35 | # define CTYPE_MASK_asn1print 0x800 36 | 37 | # define CTYPE_MASK_alpha (CTYPE_MASK_lower | CTYPE_MASK_upper) 38 | # define CTYPE_MASK_alnum (CTYPE_MASK_alpha | CTYPE_MASK_digit) 39 | 40 | /* 41 | * The ascii mask assumes that any other classification implies that 42 | * the character is ASCII and that there are no ASCII characters 43 | * that aren't in any of the classifications. 44 | * 45 | * This assumption holds at the moment, but it might not in the future. 46 | */ 47 | # define CTYPE_MASK_ascii (~0) 48 | 49 | # ifdef CHARSET_EBCDIC 50 | int ossl_toascii(int c); 51 | int ossl_fromascii(int c); 52 | # else 53 | # define ossl_toascii(c) (c) 54 | # define ossl_fromascii(c) (c) 55 | # endif 56 | int ossl_ctype_check(int c, unsigned int mask); 57 | int ossl_tolower(int c); 58 | int ossl_toupper(int c); 59 | 60 | int ascii_isdigit(const char inchar); 61 | 62 | # define ossl_isalnum(c) (ossl_ctype_check((c), CTYPE_MASK_alnum)) 63 | # define ossl_isalpha(c) (ossl_ctype_check((c), CTYPE_MASK_alpha)) 64 | # ifdef CHARSET_EBCDIC 65 | # define ossl_isascii(c) (ossl_ctype_check((c), CTYPE_MASK_ascii)) 66 | # else 67 | # define ossl_isascii(c) (((c) & ~127) == 0) 68 | # endif 69 | # define ossl_isblank(c) (ossl_ctype_check((c), CTYPE_MASK_blank)) 70 | # define ossl_iscntrl(c) (ossl_ctype_check((c), CTYPE_MASK_cntrl)) 71 | # define ossl_isdigit(c) (ossl_ctype_check((c), CTYPE_MASK_digit)) 72 | # define ossl_isgraph(c) (ossl_ctype_check((c), CTYPE_MASK_graph)) 73 | # define ossl_islower(c) (ossl_ctype_check((c), CTYPE_MASK_lower)) 74 | # define ossl_isprint(c) (ossl_ctype_check((c), CTYPE_MASK_print)) 75 | # define ossl_ispunct(c) (ossl_ctype_check((c), CTYPE_MASK_punct)) 76 | # define ossl_isspace(c) (ossl_ctype_check((c), CTYPE_MASK_space)) 77 | # define ossl_isupper(c) (ossl_ctype_check((c), CTYPE_MASK_upper)) 78 | # define ossl_isxdigit(c) (ossl_ctype_check((c), CTYPE_MASK_xdigit)) 79 | # define ossl_isbase64(c) (ossl_ctype_check((c), CTYPE_MASK_base64)) 80 | # define ossl_isasn1print(c) (ossl_ctype_check((c), CTYPE_MASK_asn1print)) 81 | 82 | #endif 83 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/crypto/dso_conf.h: -------------------------------------------------------------------------------- 1 | /* WARNING: do not edit! */ 2 | /* Generated by Makefile from include/crypto/dso_conf.h.in */ 3 | /* 4 | * Copyright 2016-2019 The OpenSSL Project Authors. All Rights Reserved. 5 | * 6 | * Licensed under the OpenSSL license (the "License"). You may not use 7 | * this file except in compliance with the License. You can obtain a copy 8 | * in the file LICENSE in the source distribution or at 9 | * https://www.openssl.org/source/license.html 10 | */ 11 | 12 | #ifndef OSSL_CRYPTO_DSO_CONF_H 13 | # define OSSL_CRYPTO_DSO_CONF_H 14 | # define DSO_DLFCN 15 | # define HAVE_DLFCN_H 16 | # define DSO_EXTENSION ".so" 17 | #endif 18 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/crypto/dso_conf.h.in: -------------------------------------------------------------------------------- 1 | {- join("\n",map { "/* $_ */" } @autowarntext) -} 2 | /* 3 | * Copyright 2016-2019 The OpenSSL Project Authors. All Rights Reserved. 4 | * 5 | * Licensed under the OpenSSL license (the "License"). You may not use 6 | * this file except in compliance with the License. You can obtain a copy 7 | * in the file LICENSE in the source distribution or at 8 | * https://www.openssl.org/source/license.html 9 | */ 10 | 11 | #ifndef OSSL_CRYPTO_DSO_CONF_H 12 | # define OSSL_CRYPTO_DSO_CONF_H 13 | {- # The DSO code currently always implements all functions so that no 14 | # applications will have to worry about that from a compilation point 15 | # of view. However, the "method"s may return zero unless that platform 16 | # has support compiled in for them. Currently each method is enabled 17 | # by a define "DSO_" ... we translate the "dso_scheme" config 18 | # string entry into using the following logic; 19 | my $scheme = $disabled{dso} ? undef : uc $target{dso_scheme}; 20 | if (!$scheme) { 21 | $scheme = "NONE"; 22 | } 23 | my @macros = ( "DSO_$scheme" ); 24 | if ($scheme eq 'DLFCN') { 25 | @macros = ( "DSO_DLFCN", "HAVE_DLFCN_H" ); 26 | } elsif ($scheme eq "DLFCN_NO_H") { 27 | @macros = ( "DSO_DLFCN" ); 28 | } 29 | join("\n", map { "# define $_" } @macros); -} 30 | # define DSO_EXTENSION "{- $target{dso_extension} -}" 31 | #endif 32 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/crypto/ec.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | /* Internal EC functions for other submodules: not for application use */ 11 | 12 | #ifndef OSSL_CRYPTO_EC_H 13 | # define OSSL_CRYPTO_EC_H 14 | # include 15 | 16 | # ifndef OPENSSL_NO_EC 17 | 18 | # include 19 | 20 | /*- 21 | * Computes the multiplicative inverse of x in the range 22 | * [1,EC_GROUP::order), where EC_GROUP::order is the cardinality of the 23 | * subgroup generated by the generator G: 24 | * 25 | * res := x^(-1) (mod EC_GROUP::order). 26 | * 27 | * This function expects the following two conditions to hold: 28 | * - the EC_GROUP order is prime, and 29 | * - x is included in the range [1, EC_GROUP::order). 30 | * 31 | * This function returns 1 on success, 0 on error. 32 | * 33 | * If the EC_GROUP order is even, this function explicitly returns 0 as 34 | * an error. 35 | * In case any of the two conditions stated above is not satisfied, 36 | * the correctness of its output is not guaranteed, even if the return 37 | * value could still be 1 (as primality testing and a conditional modular 38 | * reduction round on the input can be omitted by the underlying 39 | * implementations for better SCA properties on regular input values). 40 | */ 41 | __owur int ec_group_do_inverse_ord(const EC_GROUP *group, BIGNUM *res, 42 | const BIGNUM *x, BN_CTX *ctx); 43 | 44 | /*- 45 | * ECDH Key Derivation Function as defined in ANSI X9.63 46 | */ 47 | int ecdh_KDF_X9_63(unsigned char *out, size_t outlen, 48 | const unsigned char *Z, size_t Zlen, 49 | const unsigned char *sinfo, size_t sinfolen, 50 | const EVP_MD *md); 51 | 52 | # endif /* OPENSSL_NO_EC */ 53 | #endif 54 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/crypto/engine.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #include 11 | 12 | void engine_load_openssl_int(void); 13 | void engine_load_devcrypto_int(void); 14 | void engine_load_rdrand_int(void); 15 | void engine_load_dynamic_int(void); 16 | void engine_load_padlock_int(void); 17 | void engine_load_capi_int(void); 18 | void engine_load_dasync_int(void); 19 | void engine_load_afalg_int(void); 20 | void engine_cleanup_int(void); 21 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/crypto/err.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef OSSL_CRYPTO_ERR_H 11 | # define OSSL_CRYPTO_ERR_H 12 | 13 | int err_load_crypto_strings_int(void); 14 | void err_cleanup(void); 15 | void err_delete_thread_state(void); 16 | int err_shelve_state(void **); 17 | void err_unshelve_state(void *); 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/crypto/lhash.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef OSSL_CRYPTO_LHASH_H 11 | # define OSSL_CRYPTO_LHASH_H 12 | 13 | unsigned long openssl_lh_strcasehash(const char *); 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/crypto/objects.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #include 11 | 12 | void obj_cleanup_int(void); 13 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/crypto/poly1305.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #include 11 | 12 | #define POLY1305_BLOCK_SIZE 16 13 | #define POLY1305_DIGEST_SIZE 16 14 | #define POLY1305_KEY_SIZE 32 15 | 16 | typedef struct poly1305_context POLY1305; 17 | 18 | size_t Poly1305_ctx_size(void); 19 | void Poly1305_Init(POLY1305 *ctx, const unsigned char key[32]); 20 | void Poly1305_Update(POLY1305 *ctx, const unsigned char *inp, size_t len); 21 | void Poly1305_Final(POLY1305 *ctx, unsigned char mac[16]); 22 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/crypto/sha.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 The OpenSSL Project Authors. All Rights Reserved. 3 | * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. 4 | * 5 | * Licensed under the OpenSSL license (the "License"). You may not use 6 | * this file except in compliance with the License. You can obtain a copy 7 | * in the file LICENSE in the source distribution or at 8 | * https://www.openssl.org/source/license.html 9 | */ 10 | 11 | #ifndef OSSL_CRYPTO_SHA_H 12 | # define OSSL_CRYPTO_SHA_H 13 | 14 | # include 15 | 16 | int sha512_224_init(SHA512_CTX *); 17 | int sha512_256_init(SHA512_CTX *); 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/crypto/siphash.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #include 11 | 12 | #define SIPHASH_BLOCK_SIZE 8 13 | #define SIPHASH_KEY_SIZE 16 14 | #define SIPHASH_MIN_DIGEST_SIZE 8 15 | #define SIPHASH_MAX_DIGEST_SIZE 16 16 | 17 | typedef struct siphash_st SIPHASH; 18 | 19 | size_t SipHash_ctx_size(void); 20 | size_t SipHash_hash_size(SIPHASH *ctx); 21 | int SipHash_set_hash_size(SIPHASH *ctx, size_t hash_size); 22 | int SipHash_Init(SIPHASH *ctx, const unsigned char *k, 23 | int crounds, int drounds); 24 | void SipHash_Update(SIPHASH *ctx, const unsigned char *in, size_t inlen); 25 | int SipHash_Final(SIPHASH *ctx, unsigned char *out, size_t outlen); 26 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/crypto/sm2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved. 3 | * Copyright 2017 Ribose Inc. All Rights Reserved. 4 | * Ported from Ribose contributions from Botan. 5 | * 6 | * Licensed under the OpenSSL license (the "License"). You may not use 7 | * this file except in compliance with the License. You can obtain a copy 8 | * in the file LICENSE in the source distribution or at 9 | * https://www.openssl.org/source/license.html 10 | */ 11 | 12 | #ifndef OSSL_CRYPTO_SM2_H 13 | # define OSSL_CRYPTO_SM2_H 14 | # include 15 | 16 | # ifndef OPENSSL_NO_SM2 17 | 18 | # include 19 | 20 | /* The default user id as specified in GM/T 0009-2012 */ 21 | # define SM2_DEFAULT_USERID "1234567812345678" 22 | 23 | int sm2_compute_z_digest(uint8_t *out, 24 | const EVP_MD *digest, 25 | const uint8_t *id, 26 | const size_t id_len, 27 | const EC_KEY *key); 28 | 29 | /* 30 | * SM2 signature operation. Computes Z and then signs H(Z || msg) using SM2 31 | */ 32 | ECDSA_SIG *sm2_do_sign(const EC_KEY *key, 33 | const EVP_MD *digest, 34 | const uint8_t *id, 35 | const size_t id_len, 36 | const uint8_t *msg, size_t msg_len); 37 | 38 | int sm2_do_verify(const EC_KEY *key, 39 | const EVP_MD *digest, 40 | const ECDSA_SIG *signature, 41 | const uint8_t *id, 42 | const size_t id_len, 43 | const uint8_t *msg, size_t msg_len); 44 | 45 | /* 46 | * SM2 signature generation. 47 | */ 48 | int sm2_sign(const unsigned char *dgst, int dgstlen, 49 | unsigned char *sig, unsigned int *siglen, EC_KEY *eckey); 50 | 51 | /* 52 | * SM2 signature verification. 53 | */ 54 | int sm2_verify(const unsigned char *dgst, int dgstlen, 55 | const unsigned char *sig, int siglen, EC_KEY *eckey); 56 | 57 | /* 58 | * SM2 encryption 59 | */ 60 | int sm2_ciphertext_size(const EC_KEY *key, const EVP_MD *digest, size_t msg_len, 61 | size_t *ct_size); 62 | 63 | int sm2_plaintext_size(const EC_KEY *key, const EVP_MD *digest, size_t msg_len, 64 | size_t *pt_size); 65 | 66 | int sm2_encrypt(const EC_KEY *key, 67 | const EVP_MD *digest, 68 | const uint8_t *msg, 69 | size_t msg_len, 70 | uint8_t *ciphertext_buf, size_t *ciphertext_len); 71 | 72 | int sm2_decrypt(const EC_KEY *key, 73 | const EVP_MD *digest, 74 | const uint8_t *ciphertext, 75 | size_t ciphertext_len, uint8_t *ptext_buf, size_t *ptext_len); 76 | 77 | # endif /* OPENSSL_NO_SM2 */ 78 | #endif 79 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/crypto/sm2err.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by util/mkerr.pl DO NOT EDIT 3 | * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. 4 | * 5 | * Licensed under the OpenSSL license (the "License"). You may not use 6 | * this file except in compliance with the License. You can obtain a copy 7 | * in the file LICENSE in the source distribution or at 8 | * https://www.openssl.org/source/license.html 9 | */ 10 | 11 | #ifndef OSSL_CRYPTO_SM2ERR_H 12 | # define OSSL_CRYPTO_SM2ERR_H 13 | 14 | # ifndef HEADER_SYMHACKS_H 15 | # include 16 | # endif 17 | 18 | # include 19 | 20 | # ifndef OPENSSL_NO_SM2 21 | 22 | # ifdef __cplusplus 23 | extern "C" 24 | # endif 25 | int ERR_load_SM2_strings(void); 26 | 27 | /* 28 | * SM2 function codes. 29 | */ 30 | # define SM2_F_PKEY_SM2_COPY 115 31 | # define SM2_F_PKEY_SM2_CTRL 109 32 | # define SM2_F_PKEY_SM2_CTRL_STR 110 33 | # define SM2_F_PKEY_SM2_DIGEST_CUSTOM 114 34 | # define SM2_F_PKEY_SM2_INIT 111 35 | # define SM2_F_PKEY_SM2_SIGN 112 36 | # define SM2_F_SM2_COMPUTE_MSG_HASH 100 37 | # define SM2_F_SM2_COMPUTE_USERID_DIGEST 101 38 | # define SM2_F_SM2_COMPUTE_Z_DIGEST 113 39 | # define SM2_F_SM2_DECRYPT 102 40 | # define SM2_F_SM2_ENCRYPT 103 41 | # define SM2_F_SM2_PLAINTEXT_SIZE 104 42 | # define SM2_F_SM2_SIGN 105 43 | # define SM2_F_SM2_SIG_GEN 106 44 | # define SM2_F_SM2_SIG_VERIFY 107 45 | # define SM2_F_SM2_VERIFY 108 46 | 47 | /* 48 | * SM2 reason codes. 49 | */ 50 | # define SM2_R_ASN1_ERROR 100 51 | # define SM2_R_BAD_SIGNATURE 101 52 | # define SM2_R_BUFFER_TOO_SMALL 107 53 | # define SM2_R_DIST_ID_TOO_LARGE 110 54 | # define SM2_R_ID_NOT_SET 112 55 | # define SM2_R_ID_TOO_LARGE 111 56 | # define SM2_R_INVALID_CURVE 108 57 | # define SM2_R_INVALID_DIGEST 102 58 | # define SM2_R_INVALID_DIGEST_TYPE 103 59 | # define SM2_R_INVALID_ENCODING 104 60 | # define SM2_R_INVALID_FIELD 105 61 | # define SM2_R_NO_PARAMETERS_SET 109 62 | # define SM2_R_USER_ID_TOO_LARGE 106 63 | 64 | # endif 65 | #endif 66 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/crypto/sm3.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 The OpenSSL Project Authors. All Rights Reserved. 3 | * Copyright 2017 Ribose Inc. All Rights Reserved. 4 | * 5 | * Licensed under the OpenSSL license (the "License"). You may not use 6 | * this file except in compliance with the License. You can obtain a copy 7 | * in the file LICENSE in the source distribution or at 8 | * https://www.openssl.org/source/license.html 9 | */ 10 | 11 | #ifndef OSSL_CRYPTO_SM3_H 12 | # define OSSL_CRYPTO_SM3_H 13 | 14 | # include 15 | 16 | # ifdef OPENSSL_NO_SM3 17 | # error SM3 is disabled. 18 | # endif 19 | 20 | # define SM3_DIGEST_LENGTH 32 21 | # define SM3_WORD unsigned int 22 | 23 | # define SM3_CBLOCK 64 24 | # define SM3_LBLOCK (SM3_CBLOCK/4) 25 | 26 | typedef struct SM3state_st { 27 | SM3_WORD A, B, C, D, E, F, G, H; 28 | SM3_WORD Nl, Nh; 29 | SM3_WORD data[SM3_LBLOCK]; 30 | unsigned int num; 31 | } SM3_CTX; 32 | 33 | int sm3_init(SM3_CTX *c); 34 | int sm3_update(SM3_CTX *c, const void *data, size_t len); 35 | int sm3_final(unsigned char *md, SM3_CTX *c); 36 | 37 | void sm3_block_data_order(SM3_CTX *c, const void *p, size_t num); 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/crypto/sm4.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 The OpenSSL Project Authors. All Rights Reserved. 3 | * Copyright 2017 Ribose Inc. All Rights Reserved. 4 | * 5 | * Licensed under the OpenSSL license (the "License"). You may not use 6 | * this file except in compliance with the License. You can obtain a copy 7 | * in the file LICENSE in the source distribution or at 8 | * https://www.openssl.org/source/license.html 9 | */ 10 | 11 | #ifndef OSSL_CRYPTO_SM4_H 12 | # define OSSL_CRYPTO_SM4_H 13 | 14 | # include 15 | # include 16 | 17 | # ifdef OPENSSL_NO_SM4 18 | # error SM4 is disabled. 19 | # endif 20 | 21 | # define SM4_ENCRYPT 1 22 | # define SM4_DECRYPT 0 23 | 24 | # define SM4_BLOCK_SIZE 16 25 | # define SM4_KEY_SCHEDULE 32 26 | 27 | typedef struct SM4_KEY_st { 28 | uint32_t rk[SM4_KEY_SCHEDULE]; 29 | } SM4_KEY; 30 | 31 | int SM4_set_key(const uint8_t *key, SM4_KEY *ks); 32 | 33 | void SM4_encrypt(const uint8_t *in, uint8_t *out, const SM4_KEY *ks); 34 | 35 | void SM4_decrypt(const uint8_t *in, uint8_t *out, const SM4_KEY *ks); 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/crypto/store.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016-2019 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef OSSL_CRYPTO_STORE_H 11 | # define OSSL_CRYPTO_STORE_H 12 | 13 | # include 14 | # include 15 | # include 16 | 17 | /* 18 | * Two functions to read PEM data off an already opened BIO. To be used 19 | * instead of OSSLSTORE_open() and OSSLSTORE_close(). Everything is done 20 | * as usual with OSSLSTORE_load() and OSSLSTORE_eof(). 21 | */ 22 | OSSL_STORE_CTX *ossl_store_attach_pem_bio(BIO *bp, const UI_METHOD *ui_method, 23 | void *ui_data); 24 | int ossl_store_detach_pem_bio(OSSL_STORE_CTX *ctx); 25 | 26 | void ossl_store_cleanup_int(void); 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/ctyptoHeader/AesUtils.h: -------------------------------------------------------------------------------- 1 | /** 2 | *
 3 |  *
 4 |  *     author : wgc
 5 |  *     time   : 2021/04/28
 6 |  *     desc   :
 7 |  *     version: 1.0
 8 |  * 
 9 |  * 
10 | */ 11 | 12 | 13 | #ifndef AES_UTILS_JNI_H 14 | #define AES_UTILS_JNI_H 15 | 16 | #include 17 | 18 | #ifdef __cplusplus 19 | extern "C" { 20 | #endif 21 | 22 | /** 23 | * AES-CBC-128加密 24 | */ 25 | jbyteArray aesCbcEncrypt(JNIEnv *env, jbyteArray keys_, jbyteArray iv_, jbyteArray src_); 26 | 27 | /** 28 | * AES-CBC-128解密 29 | */ 30 | jbyteArray aesCbcDecrypt(JNIEnv *env, jbyteArray keys_, jbyteArray iv_, jbyteArray src_); 31 | 32 | /** 33 | * AES-ECB-128加密 34 | */ 35 | jbyteArray aesEcbEncrypt(JNIEnv *env, jbyteArray keys_, jbyteArray src_); 36 | 37 | /** 38 | * AES-ECB-128解密 39 | */ 40 | jbyteArray aesEcbDecrypt(JNIEnv *env, jbyteArray keys_, jbyteArray src_); 41 | 42 | 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | 47 | #endif //AES_UTILS_JNI_H 48 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/ctyptoHeader/Base64Utils.h: -------------------------------------------------------------------------------- 1 | /** 2 | *
 3 |  *
 4 |  *     author : wgc
 5 |  *     time   : 2021/04/28
 6 |  *     desc   :
 7 |  *     version: 1.0
 8 |  * 
 9 |  * 
10 | */ 11 | 12 | 13 | #ifndef BASE64_UTILS_JNI_H 14 | #define BASE64_UTILS_JNI_H 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | /** 21 | * base64解码 22 | */ 23 | char *base64Decode(const char *input, int length, bool newLine); 24 | 25 | /** 26 | * base64 编码 27 | */ 28 | char *base64Encode(const char *buffer, int length, bool newLine); 29 | 30 | #ifdef __cplusplus 31 | } 32 | #endif 33 | 34 | #endif //BASE64_UTILS_JNI_H 35 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/ctyptoHeader/CommonUtils.h: -------------------------------------------------------------------------------- 1 | /** 2 | *
 3 |  *
 4 |  *     author : wgc
 5 |  *     time   : 2021/04/25
 6 |  *     desc   :
 7 |  *     version: 1.0
 8 |  * 
 9 |  * 
10 | */ 11 | 12 | #include 13 | #include 14 | 15 | #ifndef COMMON_UTILS_JNI_H 16 | #define COMMON_UTILS_JNI_H 17 | 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | char *javaPublicKey2OpensslPublicKey(std::string strPublicKey); 24 | 25 | char *javaPrivateKey2OpensslPrivateKey(std::string strPrivateKey); 26 | 27 | jstring str2jstring(JNIEnv *env, const char *pat); 28 | 29 | std::string jstring2str(JNIEnv *env, jstring jstr); 30 | 31 | jbyteArray intArray2jbyteArray(JNIEnv *env, const int array[], jsize keyLen); 32 | 33 | void printJniKey2JniIntArray(char *keyChar); 34 | 35 | bool checkPermission(JNIEnv *env, jobject context); 36 | 37 | char *convertJByteArrayToChars(JNIEnv *env, jbyteArray byteArray); 38 | 39 | jbyteArray convertCharToJByteArray(JNIEnv *env, const char *src); 40 | 41 | void hexStrToByte(const char *source, unsigned char *dest, int sourceLen); 42 | 43 | void byteToHexStr(const unsigned char *source, char *dest, int sourceLen); 44 | 45 | void HextoChar(uint8_t *u8, uint8_t len, char *ch); 46 | 47 | std::string arr2hex(const unsigned char *arr, size_t len); 48 | // 将16进制的string字符串,转成16进制的arr 49 | int hexCharStr2CharStr(const char *src, unsigned long lsrc, int flag, unsigned char *out, 50 | unsigned long *lout); 51 | #ifdef __cplusplus 52 | } 53 | #endif 54 | 55 | 56 | #endif //COMMON_UTILS_JNI_H 57 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/ctyptoHeader/DesUtils.h: -------------------------------------------------------------------------------- 1 | /** 2 | *
 3 |  *
 4 |  *     author : wgc
 5 |  *     time   : 2021/04/28
 6 |  *     desc   :
 7 |  *     version: 1.0
 8 |  * 
 9 |  * 
10 | */ 11 | 12 | 13 | #ifndef DES_UTILS_JNI_H 14 | #define DES_UTILS_JNI_H 15 | 16 | #include "jni.h" 17 | 18 | #ifdef __cplusplus 19 | extern "C" { 20 | #endif 21 | 22 | /** 23 | * des3cbc加密 24 | */ 25 | jbyteArray des3CbcEncrypt(JNIEnv *env, jbyteArray keys_, jbyteArray iv_, jbyteArray src_); 26 | 27 | /** 28 | * des3cbc解密 29 | */ 30 | jbyteArray des3CbcDecrypt(JNIEnv *env, jbyteArray keys_, jbyteArray iv_, jbyteArray src_); 31 | 32 | #ifdef __cplusplus 33 | } 34 | #endif 35 | 36 | #endif //DES_UTILS_JNI_H 37 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/ctyptoHeader/Md5Utils.h: -------------------------------------------------------------------------------- 1 | /** 2 | *
 3 |  *
 4 |  *     author : wgc
 5 |  *     time   : 2021/04/27
 6 |  *     desc   :
 7 |  *     version: 1.0
 8 |  * 
 9 |  * 
10 | */ 11 | 12 | #include 13 | 14 | #ifndef MD5_JNI_H 15 | #define MD5_JNI_H 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | /** 22 | * md5摘要 23 | */ 24 | jstring md5(JNIEnv *env, jbyteArray src_); 25 | 26 | 27 | #ifdef __cplusplus 28 | } 29 | #endif 30 | 31 | #endif //MD5_JNI_H 32 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/ctyptoHeader/RsaUtils.h: -------------------------------------------------------------------------------- 1 | /** 2 | *
 3 |  *
 4 |  *     author : wgc
 5 |  *     time   : 2021/04/27
 6 |  *     desc   :
 7 |  *     version: 1.0
 8 |  * 
 9 |  * 
10 | */ 11 | 12 | 13 | #ifndef RSA_JNI_H 14 | #define RSA_JNI_H 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | jbyteArray publicKeyEncrypt(JNIEnv *env, jbyteArray publicKeys_, jbyteArray src_); 21 | 22 | jbyteArray privateKeyEncrypt(JNIEnv *env, jbyteArray privateKeys_, jbyteArray src_); 23 | 24 | jbyteArray privateKeyDecrypt(JNIEnv *env, jbyteArray privateKeys_, jbyteArray src_); 25 | 26 | jbyteArray publicKeyDecrypt(JNIEnv *env, jbyteArray publicKeys_, jbyteArray src_); 27 | 28 | jbyteArray privateKeySign(JNIEnv *env, jbyteArray privateKeys_, jbyteArray src_); 29 | 30 | jint publicKeyVerify(JNIEnv *env, jbyteArray publicKeys_, jbyteArray src_, jbyteArray sign_); 31 | 32 | void generateRSAKey(); 33 | 34 | 35 | #ifdef __cplusplus 36 | } 37 | #endif 38 | 39 | #endif //RSA_JNI_H 40 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/libs/arm64-v8a/libcrypto.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wgc0303/OpensslByAndroid/efec1101f506fa49822b80c5a5fa8b446d63acf6/openssllib/src/main/cpp/libs/arm64-v8a/libcrypto.a -------------------------------------------------------------------------------- /openssllib/src/main/cpp/libs/arm64-v8a/libssl.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wgc0303/OpensslByAndroid/efec1101f506fa49822b80c5a5fa8b446d63acf6/openssllib/src/main/cpp/libs/arm64-v8a/libssl.a -------------------------------------------------------------------------------- /openssllib/src/main/cpp/libs/armeabi-v7a/libcrypto.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wgc0303/OpensslByAndroid/efec1101f506fa49822b80c5a5fa8b446d63acf6/openssllib/src/main/cpp/libs/armeabi-v7a/libcrypto.a -------------------------------------------------------------------------------- /openssllib/src/main/cpp/libs/armeabi-v7a/libssl.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wgc0303/OpensslByAndroid/efec1101f506fa49822b80c5a5fa8b446d63acf6/openssllib/src/main/cpp/libs/armeabi-v7a/libssl.a -------------------------------------------------------------------------------- /openssllib/src/main/cpp/openssl/__DECC_INCLUDE_EPILOGUE.H: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | /* 11 | * This file is only used by HP C/C++ on VMS, and is included automatically 12 | * after each header file from this directory 13 | */ 14 | 15 | /* 16 | * The C++ compiler doesn't understand these pragmas, even though it 17 | * understands the corresponding command line qualifier. 18 | */ 19 | #ifndef __cplusplus 20 | /* restore state. Must correspond to the save in __decc_include_prologue.h */ 21 | # pragma names restore 22 | #endif 23 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/openssl/__DECC_INCLUDE_PROLOGUE.H: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | /* 11 | * This file is only used by HP C/C++ on VMS, and is included automatically 12 | * after each header file from this directory 13 | */ 14 | 15 | /* 16 | * The C++ compiler doesn't understand these pragmas, even though it 17 | * understands the corresponding command line qualifier. 18 | */ 19 | #ifndef __cplusplus 20 | /* save state */ 21 | # pragma names save 22 | /* have the compiler shorten symbols larger than 31 chars to 23 chars 23 | * followed by a 8 hex char CRC 24 | */ 25 | # pragma names as_is,shortened 26 | #endif 27 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/openssl/aes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_AES_H 11 | # define HEADER_AES_H 12 | 13 | # include 14 | 15 | # include 16 | # ifdef __cplusplus 17 | extern "C" { 18 | # endif 19 | 20 | # define AES_ENCRYPT 1 21 | # define AES_DECRYPT 0 22 | 23 | /* 24 | * Because array size can't be a const in C, the following two are macros. 25 | * Both sizes are in bytes. 26 | */ 27 | # define AES_MAXNR 14 28 | # define AES_BLOCK_SIZE 16 29 | 30 | /* This should be a hidden type, but EVP requires that the size be known */ 31 | struct aes_key_st { 32 | # ifdef AES_LONG 33 | unsigned long rd_key[4 * (AES_MAXNR + 1)]; 34 | # else 35 | unsigned int rd_key[4 * (AES_MAXNR + 1)]; 36 | # endif 37 | int rounds; 38 | }; 39 | typedef struct aes_key_st AES_KEY; 40 | 41 | const char *AES_options(void); 42 | 43 | int AES_set_encrypt_key(const unsigned char *userKey, const int bits, 44 | AES_KEY *key); 45 | int AES_set_decrypt_key(const unsigned char *userKey, const int bits, 46 | AES_KEY *key); 47 | 48 | void AES_encrypt(const unsigned char *in, unsigned char *out, 49 | const AES_KEY *key); 50 | void AES_decrypt(const unsigned char *in, unsigned char *out, 51 | const AES_KEY *key); 52 | 53 | void AES_ecb_encrypt(const unsigned char *in, unsigned char *out, 54 | const AES_KEY *key, const int enc); 55 | void AES_cbc_encrypt(const unsigned char *in, unsigned char *out, 56 | size_t length, const AES_KEY *key, 57 | unsigned char *ivec, const int enc); 58 | void AES_cfb128_encrypt(const unsigned char *in, unsigned char *out, 59 | size_t length, const AES_KEY *key, 60 | unsigned char *ivec, int *num, const int enc); 61 | void AES_cfb1_encrypt(const unsigned char *in, unsigned char *out, 62 | size_t length, const AES_KEY *key, 63 | unsigned char *ivec, int *num, const int enc); 64 | void AES_cfb8_encrypt(const unsigned char *in, unsigned char *out, 65 | size_t length, const AES_KEY *key, 66 | unsigned char *ivec, int *num, const int enc); 67 | void AES_ofb128_encrypt(const unsigned char *in, unsigned char *out, 68 | size_t length, const AES_KEY *key, 69 | unsigned char *ivec, int *num); 70 | /* NB: the IV is _two_ blocks long */ 71 | void AES_ige_encrypt(const unsigned char *in, unsigned char *out, 72 | size_t length, const AES_KEY *key, 73 | unsigned char *ivec, const int enc); 74 | /* NB: the IV is _four_ blocks long */ 75 | void AES_bi_ige_encrypt(const unsigned char *in, unsigned char *out, 76 | size_t length, const AES_KEY *key, 77 | const AES_KEY *key2, const unsigned char *ivec, 78 | const int enc); 79 | 80 | int AES_wrap_key(AES_KEY *key, const unsigned char *iv, 81 | unsigned char *out, 82 | const unsigned char *in, unsigned int inlen); 83 | int AES_unwrap_key(AES_KEY *key, const unsigned char *iv, 84 | unsigned char *out, 85 | const unsigned char *in, unsigned int inlen); 86 | 87 | 88 | # ifdef __cplusplus 89 | } 90 | # endif 91 | 92 | #endif 93 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/openssl/asn1_mac.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #error "This file is obsolete; please update your software." 11 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/openssl/async.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015-2018 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #include 11 | 12 | #ifndef HEADER_ASYNC_H 13 | # define HEADER_ASYNC_H 14 | 15 | #if defined(_WIN32) 16 | # if defined(BASETYPES) || defined(_WINDEF_H) 17 | /* application has to include to use this */ 18 | #define OSSL_ASYNC_FD HANDLE 19 | #define OSSL_BAD_ASYNC_FD INVALID_HANDLE_VALUE 20 | # endif 21 | #else 22 | #define OSSL_ASYNC_FD int 23 | #define OSSL_BAD_ASYNC_FD -1 24 | #endif 25 | # include 26 | 27 | 28 | # ifdef __cplusplus 29 | extern "C" { 30 | # endif 31 | 32 | typedef struct async_job_st ASYNC_JOB; 33 | typedef struct async_wait_ctx_st ASYNC_WAIT_CTX; 34 | 35 | #define ASYNC_ERR 0 36 | #define ASYNC_NO_JOBS 1 37 | #define ASYNC_PAUSE 2 38 | #define ASYNC_FINISH 3 39 | 40 | int ASYNC_init_thread(size_t max_size, size_t init_size); 41 | void ASYNC_cleanup_thread(void); 42 | 43 | #ifdef OSSL_ASYNC_FD 44 | ASYNC_WAIT_CTX *ASYNC_WAIT_CTX_new(void); 45 | void ASYNC_WAIT_CTX_free(ASYNC_WAIT_CTX *ctx); 46 | int ASYNC_WAIT_CTX_set_wait_fd(ASYNC_WAIT_CTX *ctx, const void *key, 47 | OSSL_ASYNC_FD fd, 48 | void *custom_data, 49 | void (*cleanup)(ASYNC_WAIT_CTX *, const void *, 50 | OSSL_ASYNC_FD, void *)); 51 | int ASYNC_WAIT_CTX_get_fd(ASYNC_WAIT_CTX *ctx, const void *key, 52 | OSSL_ASYNC_FD *fd, void **custom_data); 53 | int ASYNC_WAIT_CTX_get_all_fds(ASYNC_WAIT_CTX *ctx, OSSL_ASYNC_FD *fd, 54 | size_t *numfds); 55 | int ASYNC_WAIT_CTX_get_changed_fds(ASYNC_WAIT_CTX *ctx, OSSL_ASYNC_FD *addfd, 56 | size_t *numaddfds, OSSL_ASYNC_FD *delfd, 57 | size_t *numdelfds); 58 | int ASYNC_WAIT_CTX_clear_fd(ASYNC_WAIT_CTX *ctx, const void *key); 59 | #endif 60 | 61 | int ASYNC_is_capable(void); 62 | 63 | int ASYNC_start_job(ASYNC_JOB **job, ASYNC_WAIT_CTX *ctx, int *ret, 64 | int (*func)(void *), void *args, size_t size); 65 | int ASYNC_pause_job(void); 66 | 67 | ASYNC_JOB *ASYNC_get_current_job(void); 68 | ASYNC_WAIT_CTX *ASYNC_get_wait_ctx(ASYNC_JOB *job); 69 | void ASYNC_block_pause(void); 70 | void ASYNC_unblock_pause(void); 71 | 72 | 73 | # ifdef __cplusplus 74 | } 75 | # endif 76 | #endif 77 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/openssl/asyncerr.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by util/mkerr.pl DO NOT EDIT 3 | * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. 4 | * 5 | * Licensed under the OpenSSL license (the "License"). You may not use 6 | * this file except in compliance with the License. You can obtain a copy 7 | * in the file LICENSE in the source distribution or at 8 | * https://www.openssl.org/source/license.html 9 | */ 10 | 11 | #ifndef HEADER_ASYNCERR_H 12 | # define HEADER_ASYNCERR_H 13 | 14 | # ifndef HEADER_SYMHACKS_H 15 | # include 16 | # endif 17 | 18 | # ifdef __cplusplus 19 | extern "C" 20 | # endif 21 | int ERR_load_ASYNC_strings(void); 22 | 23 | /* 24 | * ASYNC function codes. 25 | */ 26 | # define ASYNC_F_ASYNC_CTX_NEW 100 27 | # define ASYNC_F_ASYNC_INIT_THREAD 101 28 | # define ASYNC_F_ASYNC_JOB_NEW 102 29 | # define ASYNC_F_ASYNC_PAUSE_JOB 103 30 | # define ASYNC_F_ASYNC_START_FUNC 104 31 | # define ASYNC_F_ASYNC_START_JOB 105 32 | # define ASYNC_F_ASYNC_WAIT_CTX_SET_WAIT_FD 106 33 | 34 | /* 35 | * ASYNC reason codes. 36 | */ 37 | # define ASYNC_R_FAILED_TO_SET_POOL 101 38 | # define ASYNC_R_FAILED_TO_SWAP_CONTEXT 102 39 | # define ASYNC_R_INIT_FAILED 105 40 | # define ASYNC_R_INVALID_POOL_SIZE 103 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/openssl/blowfish.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_BLOWFISH_H 11 | # define HEADER_BLOWFISH_H 12 | 13 | # include 14 | 15 | # ifndef OPENSSL_NO_BF 16 | # include 17 | # ifdef __cplusplus 18 | extern "C" { 19 | # endif 20 | 21 | # define BF_ENCRYPT 1 22 | # define BF_DECRYPT 0 23 | 24 | /*- 25 | * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 26 | * ! BF_LONG has to be at least 32 bits wide. ! 27 | * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 28 | */ 29 | # define BF_LONG unsigned int 30 | 31 | # define BF_ROUNDS 16 32 | # define BF_BLOCK 8 33 | 34 | typedef struct bf_key_st { 35 | BF_LONG P[BF_ROUNDS + 2]; 36 | BF_LONG S[4 * 256]; 37 | } BF_KEY; 38 | 39 | void BF_set_key(BF_KEY *key, int len, const unsigned char *data); 40 | 41 | void BF_encrypt(BF_LONG *data, const BF_KEY *key); 42 | void BF_decrypt(BF_LONG *data, const BF_KEY *key); 43 | 44 | void BF_ecb_encrypt(const unsigned char *in, unsigned char *out, 45 | const BF_KEY *key, int enc); 46 | void BF_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, 47 | const BF_KEY *schedule, unsigned char *ivec, int enc); 48 | void BF_cfb64_encrypt(const unsigned char *in, unsigned char *out, 49 | long length, const BF_KEY *schedule, 50 | unsigned char *ivec, int *num, int enc); 51 | void BF_ofb64_encrypt(const unsigned char *in, unsigned char *out, 52 | long length, const BF_KEY *schedule, 53 | unsigned char *ivec, int *num); 54 | const char *BF_options(void); 55 | 56 | # ifdef __cplusplus 57 | } 58 | # endif 59 | # endif 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/openssl/buffer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_BUFFER_H 11 | # define HEADER_BUFFER_H 12 | 13 | # include 14 | # ifndef HEADER_CRYPTO_H 15 | # include 16 | # endif 17 | # include 18 | 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | # include 25 | # include 26 | 27 | /* 28 | * These names are outdated as of OpenSSL 1.1; a future release 29 | * will move them to be deprecated. 30 | */ 31 | # define BUF_strdup(s) OPENSSL_strdup(s) 32 | # define BUF_strndup(s, size) OPENSSL_strndup(s, size) 33 | # define BUF_memdup(data, size) OPENSSL_memdup(data, size) 34 | # define BUF_strlcpy(dst, src, size) OPENSSL_strlcpy(dst, src, size) 35 | # define BUF_strlcat(dst, src, size) OPENSSL_strlcat(dst, src, size) 36 | # define BUF_strnlen(str, maxlen) OPENSSL_strnlen(str, maxlen) 37 | 38 | struct buf_mem_st { 39 | size_t length; /* current number of bytes */ 40 | char *data; 41 | size_t max; /* size of buffer */ 42 | unsigned long flags; 43 | }; 44 | 45 | # define BUF_MEM_FLAG_SECURE 0x01 46 | 47 | BUF_MEM *BUF_MEM_new(void); 48 | BUF_MEM *BUF_MEM_new_ex(unsigned long flags); 49 | void BUF_MEM_free(BUF_MEM *a); 50 | size_t BUF_MEM_grow(BUF_MEM *str, size_t len); 51 | size_t BUF_MEM_grow_clean(BUF_MEM *str, size_t len); 52 | void BUF_reverse(unsigned char *out, const unsigned char *in, size_t siz); 53 | 54 | 55 | # ifdef __cplusplus 56 | } 57 | # endif 58 | #endif 59 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/openssl/buffererr.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by util/mkerr.pl DO NOT EDIT 3 | * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. 4 | * 5 | * Licensed under the OpenSSL license (the "License"). You may not use 6 | * this file except in compliance with the License. You can obtain a copy 7 | * in the file LICENSE in the source distribution or at 8 | * https://www.openssl.org/source/license.html 9 | */ 10 | 11 | #ifndef HEADER_BUFERR_H 12 | # define HEADER_BUFERR_H 13 | 14 | # ifndef HEADER_SYMHACKS_H 15 | # include 16 | # endif 17 | 18 | # ifdef __cplusplus 19 | extern "C" 20 | # endif 21 | int ERR_load_BUF_strings(void); 22 | 23 | /* 24 | * BUF function codes. 25 | */ 26 | # define BUF_F_BUF_MEM_GROW 100 27 | # define BUF_F_BUF_MEM_GROW_CLEAN 105 28 | # define BUF_F_BUF_MEM_NEW 101 29 | 30 | /* 31 | * BUF reason codes. 32 | */ 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/openssl/camellia.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2006-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_CAMELLIA_H 11 | # define HEADER_CAMELLIA_H 12 | 13 | # include 14 | 15 | # ifndef OPENSSL_NO_CAMELLIA 16 | # include 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | # define CAMELLIA_ENCRYPT 1 22 | # define CAMELLIA_DECRYPT 0 23 | 24 | /* 25 | * Because array size can't be a const in C, the following two are macros. 26 | * Both sizes are in bytes. 27 | */ 28 | 29 | /* This should be a hidden type, but EVP requires that the size be known */ 30 | 31 | # define CAMELLIA_BLOCK_SIZE 16 32 | # define CAMELLIA_TABLE_BYTE_LEN 272 33 | # define CAMELLIA_TABLE_WORD_LEN (CAMELLIA_TABLE_BYTE_LEN / 4) 34 | 35 | typedef unsigned int KEY_TABLE_TYPE[CAMELLIA_TABLE_WORD_LEN]; /* to match 36 | * with WORD */ 37 | 38 | struct camellia_key_st { 39 | union { 40 | double d; /* ensures 64-bit align */ 41 | KEY_TABLE_TYPE rd_key; 42 | } u; 43 | int grand_rounds; 44 | }; 45 | typedef struct camellia_key_st CAMELLIA_KEY; 46 | 47 | int Camellia_set_key(const unsigned char *userKey, const int bits, 48 | CAMELLIA_KEY *key); 49 | 50 | void Camellia_encrypt(const unsigned char *in, unsigned char *out, 51 | const CAMELLIA_KEY *key); 52 | void Camellia_decrypt(const unsigned char *in, unsigned char *out, 53 | const CAMELLIA_KEY *key); 54 | 55 | void Camellia_ecb_encrypt(const unsigned char *in, unsigned char *out, 56 | const CAMELLIA_KEY *key, const int enc); 57 | void Camellia_cbc_encrypt(const unsigned char *in, unsigned char *out, 58 | size_t length, const CAMELLIA_KEY *key, 59 | unsigned char *ivec, const int enc); 60 | void Camellia_cfb128_encrypt(const unsigned char *in, unsigned char *out, 61 | size_t length, const CAMELLIA_KEY *key, 62 | unsigned char *ivec, int *num, const int enc); 63 | void Camellia_cfb1_encrypt(const unsigned char *in, unsigned char *out, 64 | size_t length, const CAMELLIA_KEY *key, 65 | unsigned char *ivec, int *num, const int enc); 66 | void Camellia_cfb8_encrypt(const unsigned char *in, unsigned char *out, 67 | size_t length, const CAMELLIA_KEY *key, 68 | unsigned char *ivec, int *num, const int enc); 69 | void Camellia_ofb128_encrypt(const unsigned char *in, unsigned char *out, 70 | size_t length, const CAMELLIA_KEY *key, 71 | unsigned char *ivec, int *num); 72 | void Camellia_ctr128_encrypt(const unsigned char *in, unsigned char *out, 73 | size_t length, const CAMELLIA_KEY *key, 74 | unsigned char ivec[CAMELLIA_BLOCK_SIZE], 75 | unsigned char ecount_buf[CAMELLIA_BLOCK_SIZE], 76 | unsigned int *num); 77 | 78 | # ifdef __cplusplus 79 | } 80 | # endif 81 | # endif 82 | 83 | #endif 84 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/openssl/cast.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_CAST_H 11 | # define HEADER_CAST_H 12 | 13 | # include 14 | 15 | # ifndef OPENSSL_NO_CAST 16 | # ifdef __cplusplus 17 | extern "C" { 18 | # endif 19 | 20 | # define CAST_ENCRYPT 1 21 | # define CAST_DECRYPT 0 22 | 23 | # define CAST_LONG unsigned int 24 | 25 | # define CAST_BLOCK 8 26 | # define CAST_KEY_LENGTH 16 27 | 28 | typedef struct cast_key_st { 29 | CAST_LONG data[32]; 30 | int short_key; /* Use reduced rounds for short key */ 31 | } CAST_KEY; 32 | 33 | void CAST_set_key(CAST_KEY *key, int len, const unsigned char *data); 34 | void CAST_ecb_encrypt(const unsigned char *in, unsigned char *out, 35 | const CAST_KEY *key, int enc); 36 | void CAST_encrypt(CAST_LONG *data, const CAST_KEY *key); 37 | void CAST_decrypt(CAST_LONG *data, const CAST_KEY *key); 38 | void CAST_cbc_encrypt(const unsigned char *in, unsigned char *out, 39 | long length, const CAST_KEY *ks, unsigned char *iv, 40 | int enc); 41 | void CAST_cfb64_encrypt(const unsigned char *in, unsigned char *out, 42 | long length, const CAST_KEY *schedule, 43 | unsigned char *ivec, int *num, int enc); 44 | void CAST_ofb64_encrypt(const unsigned char *in, unsigned char *out, 45 | long length, const CAST_KEY *schedule, 46 | unsigned char *ivec, int *num); 47 | 48 | # ifdef __cplusplus 49 | } 50 | # endif 51 | # endif 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/openssl/cmac.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_CMAC_H 11 | # define HEADER_CMAC_H 12 | 13 | # ifndef OPENSSL_NO_CMAC 14 | 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | # include 20 | 21 | /* Opaque */ 22 | typedef struct CMAC_CTX_st CMAC_CTX; 23 | 24 | CMAC_CTX *CMAC_CTX_new(void); 25 | void CMAC_CTX_cleanup(CMAC_CTX *ctx); 26 | void CMAC_CTX_free(CMAC_CTX *ctx); 27 | EVP_CIPHER_CTX *CMAC_CTX_get0_cipher_ctx(CMAC_CTX *ctx); 28 | int CMAC_CTX_copy(CMAC_CTX *out, const CMAC_CTX *in); 29 | 30 | int CMAC_Init(CMAC_CTX *ctx, const void *key, size_t keylen, 31 | const EVP_CIPHER *cipher, ENGINE *impl); 32 | int CMAC_Update(CMAC_CTX *ctx, const void *data, size_t dlen); 33 | int CMAC_Final(CMAC_CTX *ctx, unsigned char *out, size_t *poutlen); 34 | int CMAC_resume(CMAC_CTX *ctx); 35 | 36 | #ifdef __cplusplus 37 | } 38 | #endif 39 | 40 | # endif 41 | #endif 42 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/openssl/comp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015-2018 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_COMP_H 11 | # define HEADER_COMP_H 12 | 13 | # include 14 | 15 | # ifndef OPENSSL_NO_COMP 16 | # include 17 | # include 18 | # ifdef __cplusplus 19 | extern "C" { 20 | # endif 21 | 22 | 23 | 24 | COMP_CTX *COMP_CTX_new(COMP_METHOD *meth); 25 | const COMP_METHOD *COMP_CTX_get_method(const COMP_CTX *ctx); 26 | int COMP_CTX_get_type(const COMP_CTX* comp); 27 | int COMP_get_type(const COMP_METHOD *meth); 28 | const char *COMP_get_name(const COMP_METHOD *meth); 29 | void COMP_CTX_free(COMP_CTX *ctx); 30 | 31 | int COMP_compress_block(COMP_CTX *ctx, unsigned char *out, int olen, 32 | unsigned char *in, int ilen); 33 | int COMP_expand_block(COMP_CTX *ctx, unsigned char *out, int olen, 34 | unsigned char *in, int ilen); 35 | 36 | COMP_METHOD *COMP_zlib(void); 37 | 38 | #if OPENSSL_API_COMPAT < 0x10100000L 39 | #define COMP_zlib_cleanup() while(0) continue 40 | #endif 41 | 42 | # ifdef HEADER_BIO_H 43 | # ifdef ZLIB 44 | const BIO_METHOD *BIO_f_zlib(void); 45 | # endif 46 | # endif 47 | 48 | 49 | # ifdef __cplusplus 50 | } 51 | # endif 52 | # endif 53 | #endif 54 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/openssl/comperr.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by util/mkerr.pl DO NOT EDIT 3 | * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. 4 | * 5 | * Licensed under the OpenSSL license (the "License"). You may not use 6 | * this file except in compliance with the License. You can obtain a copy 7 | * in the file LICENSE in the source distribution or at 8 | * https://www.openssl.org/source/license.html 9 | */ 10 | 11 | #ifndef HEADER_COMPERR_H 12 | # define HEADER_COMPERR_H 13 | 14 | # ifndef HEADER_SYMHACKS_H 15 | # include 16 | # endif 17 | 18 | # include 19 | 20 | # ifndef OPENSSL_NO_COMP 21 | 22 | # ifdef __cplusplus 23 | extern "C" 24 | # endif 25 | int ERR_load_COMP_strings(void); 26 | 27 | /* 28 | * COMP function codes. 29 | */ 30 | # define COMP_F_BIO_ZLIB_FLUSH 99 31 | # define COMP_F_BIO_ZLIB_NEW 100 32 | # define COMP_F_BIO_ZLIB_READ 101 33 | # define COMP_F_BIO_ZLIB_WRITE 102 34 | # define COMP_F_COMP_CTX_NEW 103 35 | 36 | /* 37 | * COMP reason codes. 38 | */ 39 | # define COMP_R_ZLIB_DEFLATE_ERROR 99 40 | # define COMP_R_ZLIB_INFLATE_ERROR 100 41 | # define COMP_R_ZLIB_NOT_SUPPORTED 101 42 | 43 | # endif 44 | #endif 45 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/openssl/conf_api.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_CONF_API_H 11 | # define HEADER_CONF_API_H 12 | 13 | # include 14 | # include 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | /* Up until OpenSSL 0.9.5a, this was new_section */ 21 | CONF_VALUE *_CONF_new_section(CONF *conf, const char *section); 22 | /* Up until OpenSSL 0.9.5a, this was get_section */ 23 | CONF_VALUE *_CONF_get_section(const CONF *conf, const char *section); 24 | /* Up until OpenSSL 0.9.5a, this was CONF_get_section */ 25 | STACK_OF(CONF_VALUE) *_CONF_get_section_values(const CONF *conf, 26 | const char *section); 27 | 28 | int _CONF_add_string(CONF *conf, CONF_VALUE *section, CONF_VALUE *value); 29 | char *_CONF_get_string(const CONF *conf, const char *section, 30 | const char *name); 31 | long _CONF_get_number(const CONF *conf, const char *section, 32 | const char *name); 33 | 34 | int _CONF_new_data(CONF *conf); 35 | void _CONF_free_data(CONF *conf); 36 | 37 | #ifdef __cplusplus 38 | } 39 | #endif 40 | #endif 41 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/openssl/conferr.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by util/mkerr.pl DO NOT EDIT 3 | * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. 4 | * 5 | * Licensed under the OpenSSL license (the "License"). You may not use 6 | * this file except in compliance with the License. You can obtain a copy 7 | * in the file LICENSE in the source distribution or at 8 | * https://www.openssl.org/source/license.html 9 | */ 10 | 11 | #ifndef HEADER_CONFERR_H 12 | # define HEADER_CONFERR_H 13 | 14 | # ifndef HEADER_SYMHACKS_H 15 | # include 16 | # endif 17 | 18 | # ifdef __cplusplus 19 | extern "C" 20 | # endif 21 | int ERR_load_CONF_strings(void); 22 | 23 | /* 24 | * CONF function codes. 25 | */ 26 | # define CONF_F_CONF_DUMP_FP 104 27 | # define CONF_F_CONF_LOAD 100 28 | # define CONF_F_CONF_LOAD_FP 103 29 | # define CONF_F_CONF_PARSE_LIST 119 30 | # define CONF_F_DEF_LOAD 120 31 | # define CONF_F_DEF_LOAD_BIO 121 32 | # define CONF_F_GET_NEXT_FILE 107 33 | # define CONF_F_MODULE_ADD 122 34 | # define CONF_F_MODULE_INIT 115 35 | # define CONF_F_MODULE_LOAD_DSO 117 36 | # define CONF_F_MODULE_RUN 118 37 | # define CONF_F_NCONF_DUMP_BIO 105 38 | # define CONF_F_NCONF_DUMP_FP 106 39 | # define CONF_F_NCONF_GET_NUMBER_E 112 40 | # define CONF_F_NCONF_GET_SECTION 108 41 | # define CONF_F_NCONF_GET_STRING 109 42 | # define CONF_F_NCONF_LOAD 113 43 | # define CONF_F_NCONF_LOAD_BIO 110 44 | # define CONF_F_NCONF_LOAD_FP 114 45 | # define CONF_F_NCONF_NEW 111 46 | # define CONF_F_PROCESS_INCLUDE 116 47 | # define CONF_F_SSL_MODULE_INIT 123 48 | # define CONF_F_STR_COPY 101 49 | 50 | /* 51 | * CONF reason codes. 52 | */ 53 | # define CONF_R_ERROR_LOADING_DSO 110 54 | # define CONF_R_LIST_CANNOT_BE_NULL 115 55 | # define CONF_R_MISSING_CLOSE_SQUARE_BRACKET 100 56 | # define CONF_R_MISSING_EQUAL_SIGN 101 57 | # define CONF_R_MISSING_INIT_FUNCTION 112 58 | # define CONF_R_MODULE_INITIALIZATION_ERROR 109 59 | # define CONF_R_NO_CLOSE_BRACE 102 60 | # define CONF_R_NO_CONF 105 61 | # define CONF_R_NO_CONF_OR_ENVIRONMENT_VARIABLE 106 62 | # define CONF_R_NO_SECTION 107 63 | # define CONF_R_NO_SUCH_FILE 114 64 | # define CONF_R_NO_VALUE 108 65 | # define CONF_R_NUMBER_TOO_LARGE 121 66 | # define CONF_R_RECURSIVE_DIRECTORY_INCLUDE 111 67 | # define CONF_R_SSL_COMMAND_SECTION_EMPTY 117 68 | # define CONF_R_SSL_COMMAND_SECTION_NOT_FOUND 118 69 | # define CONF_R_SSL_SECTION_EMPTY 119 70 | # define CONF_R_SSL_SECTION_NOT_FOUND 120 71 | # define CONF_R_UNABLE_TO_CREATE_NEW_SECTION 103 72 | # define CONF_R_UNKNOWN_MODULE_NAME 113 73 | # define CONF_R_VARIABLE_EXPANSION_TOO_LONG 116 74 | # define CONF_R_VARIABLE_HAS_NO_VALUE 104 75 | 76 | #endif 77 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/openssl/cryptoerr.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by util/mkerr.pl DO NOT EDIT 3 | * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. 4 | * 5 | * Licensed under the OpenSSL license (the "License"). You may not use 6 | * this file except in compliance with the License. You can obtain a copy 7 | * in the file LICENSE in the source distribution or at 8 | * https://www.openssl.org/source/license.html 9 | */ 10 | 11 | #ifndef HEADER_CRYPTOERR_H 12 | # define HEADER_CRYPTOERR_H 13 | 14 | # ifndef HEADER_SYMHACKS_H 15 | # include 16 | # endif 17 | 18 | # ifdef __cplusplus 19 | extern "C" 20 | # endif 21 | int ERR_load_CRYPTO_strings(void); 22 | 23 | /* 24 | * CRYPTO function codes. 25 | */ 26 | # define CRYPTO_F_CMAC_CTX_NEW 120 27 | # define CRYPTO_F_CRYPTO_DUP_EX_DATA 110 28 | # define CRYPTO_F_CRYPTO_FREE_EX_DATA 111 29 | # define CRYPTO_F_CRYPTO_GET_EX_NEW_INDEX 100 30 | # define CRYPTO_F_CRYPTO_MEMDUP 115 31 | # define CRYPTO_F_CRYPTO_NEW_EX_DATA 112 32 | # define CRYPTO_F_CRYPTO_OCB128_COPY_CTX 121 33 | # define CRYPTO_F_CRYPTO_OCB128_INIT 122 34 | # define CRYPTO_F_CRYPTO_SET_EX_DATA 102 35 | # define CRYPTO_F_FIPS_MODE_SET 109 36 | # define CRYPTO_F_GET_AND_LOCK 113 37 | # define CRYPTO_F_OPENSSL_ATEXIT 114 38 | # define CRYPTO_F_OPENSSL_BUF2HEXSTR 117 39 | # define CRYPTO_F_OPENSSL_FOPEN 119 40 | # define CRYPTO_F_OPENSSL_HEXSTR2BUF 118 41 | # define CRYPTO_F_OPENSSL_INIT_CRYPTO 116 42 | # define CRYPTO_F_OPENSSL_LH_NEW 126 43 | # define CRYPTO_F_OPENSSL_SK_DEEP_COPY 127 44 | # define CRYPTO_F_OPENSSL_SK_DUP 128 45 | # define CRYPTO_F_PKEY_HMAC_INIT 123 46 | # define CRYPTO_F_PKEY_POLY1305_INIT 124 47 | # define CRYPTO_F_PKEY_SIPHASH_INIT 125 48 | # define CRYPTO_F_SK_RESERVE 129 49 | 50 | /* 51 | * CRYPTO reason codes. 52 | */ 53 | # define CRYPTO_R_FIPS_MODE_NOT_SUPPORTED 101 54 | # define CRYPTO_R_ILLEGAL_HEX_DIGIT 102 55 | # define CRYPTO_R_ODD_NUMBER_OF_DIGITS 103 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/openssl/cterr.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by util/mkerr.pl DO NOT EDIT 3 | * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. 4 | * 5 | * Licensed under the OpenSSL license (the "License"). You may not use 6 | * this file except in compliance with the License. You can obtain a copy 7 | * in the file LICENSE in the source distribution or at 8 | * https://www.openssl.org/source/license.html 9 | */ 10 | 11 | #ifndef HEADER_CTERR_H 12 | # define HEADER_CTERR_H 13 | 14 | # ifndef HEADER_SYMHACKS_H 15 | # include 16 | # endif 17 | 18 | # include 19 | 20 | # ifndef OPENSSL_NO_CT 21 | 22 | # ifdef __cplusplus 23 | extern "C" 24 | # endif 25 | int ERR_load_CT_strings(void); 26 | 27 | /* 28 | * CT function codes. 29 | */ 30 | # define CT_F_CTLOG_NEW 117 31 | # define CT_F_CTLOG_NEW_FROM_BASE64 118 32 | # define CT_F_CTLOG_NEW_FROM_CONF 119 33 | # define CT_F_CTLOG_STORE_LOAD_CTX_NEW 122 34 | # define CT_F_CTLOG_STORE_LOAD_FILE 123 35 | # define CT_F_CTLOG_STORE_LOAD_LOG 130 36 | # define CT_F_CTLOG_STORE_NEW 131 37 | # define CT_F_CT_BASE64_DECODE 124 38 | # define CT_F_CT_POLICY_EVAL_CTX_NEW 133 39 | # define CT_F_CT_V1_LOG_ID_FROM_PKEY 125 40 | # define CT_F_I2O_SCT 107 41 | # define CT_F_I2O_SCT_LIST 108 42 | # define CT_F_I2O_SCT_SIGNATURE 109 43 | # define CT_F_O2I_SCT 110 44 | # define CT_F_O2I_SCT_LIST 111 45 | # define CT_F_O2I_SCT_SIGNATURE 112 46 | # define CT_F_SCT_CTX_NEW 126 47 | # define CT_F_SCT_CTX_VERIFY 128 48 | # define CT_F_SCT_NEW 100 49 | # define CT_F_SCT_NEW_FROM_BASE64 127 50 | # define CT_F_SCT_SET0_LOG_ID 101 51 | # define CT_F_SCT_SET1_EXTENSIONS 114 52 | # define CT_F_SCT_SET1_LOG_ID 115 53 | # define CT_F_SCT_SET1_SIGNATURE 116 54 | # define CT_F_SCT_SET_LOG_ENTRY_TYPE 102 55 | # define CT_F_SCT_SET_SIGNATURE_NID 103 56 | # define CT_F_SCT_SET_VERSION 104 57 | 58 | /* 59 | * CT reason codes. 60 | */ 61 | # define CT_R_BASE64_DECODE_ERROR 108 62 | # define CT_R_INVALID_LOG_ID_LENGTH 100 63 | # define CT_R_LOG_CONF_INVALID 109 64 | # define CT_R_LOG_CONF_INVALID_KEY 110 65 | # define CT_R_LOG_CONF_MISSING_DESCRIPTION 111 66 | # define CT_R_LOG_CONF_MISSING_KEY 112 67 | # define CT_R_LOG_KEY_INVALID 113 68 | # define CT_R_SCT_FUTURE_TIMESTAMP 116 69 | # define CT_R_SCT_INVALID 104 70 | # define CT_R_SCT_INVALID_SIGNATURE 107 71 | # define CT_R_SCT_LIST_INVALID 105 72 | # define CT_R_SCT_LOG_ID_MISMATCH 114 73 | # define CT_R_SCT_NOT_SET 106 74 | # define CT_R_SCT_UNSUPPORTED_VERSION 115 75 | # define CT_R_UNRECOGNIZED_SIGNATURE_NID 101 76 | # define CT_R_UNSUPPORTED_ENTRY_TYPE 102 77 | # define CT_R_UNSUPPORTED_VERSION 103 78 | 79 | # endif 80 | #endif 81 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/openssl/dherr.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by util/mkerr.pl DO NOT EDIT 3 | * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. 4 | * 5 | * Licensed under the OpenSSL license (the "License"). You may not use 6 | * this file except in compliance with the License. You can obtain a copy 7 | * in the file LICENSE in the source distribution or at 8 | * https://www.openssl.org/source/license.html 9 | */ 10 | 11 | #ifndef HEADER_DHERR_H 12 | # define HEADER_DHERR_H 13 | 14 | # ifndef HEADER_SYMHACKS_H 15 | # include 16 | # endif 17 | 18 | # include 19 | 20 | # ifndef OPENSSL_NO_DH 21 | 22 | # ifdef __cplusplus 23 | extern "C" 24 | # endif 25 | int ERR_load_DH_strings(void); 26 | 27 | /* 28 | * DH function codes. 29 | */ 30 | # define DH_F_COMPUTE_KEY 102 31 | # define DH_F_DHPARAMS_PRINT_FP 101 32 | # define DH_F_DH_BUILTIN_GENPARAMS 106 33 | # define DH_F_DH_CHECK_EX 121 34 | # define DH_F_DH_CHECK_PARAMS_EX 122 35 | # define DH_F_DH_CHECK_PUB_KEY_EX 123 36 | # define DH_F_DH_CMS_DECRYPT 114 37 | # define DH_F_DH_CMS_SET_PEERKEY 115 38 | # define DH_F_DH_CMS_SET_SHARED_INFO 116 39 | # define DH_F_DH_METH_DUP 117 40 | # define DH_F_DH_METH_NEW 118 41 | # define DH_F_DH_METH_SET1_NAME 119 42 | # define DH_F_DH_NEW_BY_NID 104 43 | # define DH_F_DH_NEW_METHOD 105 44 | # define DH_F_DH_PARAM_DECODE 107 45 | # define DH_F_DH_PKEY_PUBLIC_CHECK 124 46 | # define DH_F_DH_PRIV_DECODE 110 47 | # define DH_F_DH_PRIV_ENCODE 111 48 | # define DH_F_DH_PUB_DECODE 108 49 | # define DH_F_DH_PUB_ENCODE 109 50 | # define DH_F_DO_DH_PRINT 100 51 | # define DH_F_GENERATE_KEY 103 52 | # define DH_F_PKEY_DH_CTRL_STR 120 53 | # define DH_F_PKEY_DH_DERIVE 112 54 | # define DH_F_PKEY_DH_INIT 125 55 | # define DH_F_PKEY_DH_KEYGEN 113 56 | 57 | /* 58 | * DH reason codes. 59 | */ 60 | # define DH_R_BAD_GENERATOR 101 61 | # define DH_R_BN_DECODE_ERROR 109 62 | # define DH_R_BN_ERROR 106 63 | # define DH_R_CHECK_INVALID_J_VALUE 115 64 | # define DH_R_CHECK_INVALID_Q_VALUE 116 65 | # define DH_R_CHECK_PUBKEY_INVALID 122 66 | # define DH_R_CHECK_PUBKEY_TOO_LARGE 123 67 | # define DH_R_CHECK_PUBKEY_TOO_SMALL 124 68 | # define DH_R_CHECK_P_NOT_PRIME 117 69 | # define DH_R_CHECK_P_NOT_SAFE_PRIME 118 70 | # define DH_R_CHECK_Q_NOT_PRIME 119 71 | # define DH_R_DECODE_ERROR 104 72 | # define DH_R_INVALID_PARAMETER_NAME 110 73 | # define DH_R_INVALID_PARAMETER_NID 114 74 | # define DH_R_INVALID_PUBKEY 102 75 | # define DH_R_KDF_PARAMETER_ERROR 112 76 | # define DH_R_KEYS_NOT_SET 108 77 | # define DH_R_MISSING_PUBKEY 125 78 | # define DH_R_MODULUS_TOO_LARGE 103 79 | # define DH_R_NOT_SUITABLE_GENERATOR 120 80 | # define DH_R_NO_PARAMETERS_SET 107 81 | # define DH_R_NO_PRIVATE_VALUE 100 82 | # define DH_R_PARAMETER_ENCODING_ERROR 105 83 | # define DH_R_PEER_KEY_ERROR 111 84 | # define DH_R_SHARED_INFO_ERROR 113 85 | # define DH_R_UNABLE_TO_CHECK_GENERATOR 121 86 | 87 | # endif 88 | #endif 89 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/openssl/dsaerr.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by util/mkerr.pl DO NOT EDIT 3 | * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. 4 | * 5 | * Licensed under the OpenSSL license (the "License"). You may not use 6 | * this file except in compliance with the License. You can obtain a copy 7 | * in the file LICENSE in the source distribution or at 8 | * https://www.openssl.org/source/license.html 9 | */ 10 | 11 | #ifndef HEADER_DSAERR_H 12 | # define HEADER_DSAERR_H 13 | 14 | # ifndef HEADER_SYMHACKS_H 15 | # include 16 | # endif 17 | 18 | # include 19 | 20 | # ifndef OPENSSL_NO_DSA 21 | 22 | # ifdef __cplusplus 23 | extern "C" 24 | # endif 25 | int ERR_load_DSA_strings(void); 26 | 27 | /* 28 | * DSA function codes. 29 | */ 30 | # define DSA_F_DSAPARAMS_PRINT 100 31 | # define DSA_F_DSAPARAMS_PRINT_FP 101 32 | # define DSA_F_DSA_BUILTIN_PARAMGEN 125 33 | # define DSA_F_DSA_BUILTIN_PARAMGEN2 126 34 | # define DSA_F_DSA_DO_SIGN 112 35 | # define DSA_F_DSA_DO_VERIFY 113 36 | # define DSA_F_DSA_METH_DUP 127 37 | # define DSA_F_DSA_METH_NEW 128 38 | # define DSA_F_DSA_METH_SET1_NAME 129 39 | # define DSA_F_DSA_NEW_METHOD 103 40 | # define DSA_F_DSA_PARAM_DECODE 119 41 | # define DSA_F_DSA_PRINT_FP 105 42 | # define DSA_F_DSA_PRIV_DECODE 115 43 | # define DSA_F_DSA_PRIV_ENCODE 116 44 | # define DSA_F_DSA_PUB_DECODE 117 45 | # define DSA_F_DSA_PUB_ENCODE 118 46 | # define DSA_F_DSA_SIGN 106 47 | # define DSA_F_DSA_SIGN_SETUP 107 48 | # define DSA_F_DSA_SIG_NEW 102 49 | # define DSA_F_OLD_DSA_PRIV_DECODE 122 50 | # define DSA_F_PKEY_DSA_CTRL 120 51 | # define DSA_F_PKEY_DSA_CTRL_STR 104 52 | # define DSA_F_PKEY_DSA_KEYGEN 121 53 | 54 | /* 55 | * DSA reason codes. 56 | */ 57 | # define DSA_R_BAD_Q_VALUE 102 58 | # define DSA_R_BN_DECODE_ERROR 108 59 | # define DSA_R_BN_ERROR 109 60 | # define DSA_R_DECODE_ERROR 104 61 | # define DSA_R_INVALID_DIGEST_TYPE 106 62 | # define DSA_R_INVALID_PARAMETERS 112 63 | # define DSA_R_MISSING_PARAMETERS 101 64 | # define DSA_R_MISSING_PRIVATE_KEY 111 65 | # define DSA_R_MODULUS_TOO_LARGE 103 66 | # define DSA_R_NO_PARAMETERS_SET 107 67 | # define DSA_R_PARAMETER_ENCODING_ERROR 105 68 | # define DSA_R_Q_NOT_PRIME 113 69 | # define DSA_R_SEED_LEN_SMALL 110 70 | 71 | # endif 72 | #endif 73 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/openssl/dtls1.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2005-2018 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_DTLS1_H 11 | # define HEADER_DTLS1_H 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | # define DTLS1_VERSION 0xFEFF 18 | # define DTLS1_2_VERSION 0xFEFD 19 | # define DTLS_MIN_VERSION DTLS1_VERSION 20 | # define DTLS_MAX_VERSION DTLS1_2_VERSION 21 | # define DTLS1_VERSION_MAJOR 0xFE 22 | 23 | # define DTLS1_BAD_VER 0x0100 24 | 25 | /* Special value for method supporting multiple versions */ 26 | # define DTLS_ANY_VERSION 0x1FFFF 27 | 28 | /* lengths of messages */ 29 | /* 30 | * Actually the max cookie length in DTLS is 255. But we can't change this now 31 | * due to compatibility concerns. 32 | */ 33 | # define DTLS1_COOKIE_LENGTH 256 34 | 35 | # define DTLS1_RT_HEADER_LENGTH 13 36 | 37 | # define DTLS1_HM_HEADER_LENGTH 12 38 | 39 | # define DTLS1_HM_BAD_FRAGMENT -2 40 | # define DTLS1_HM_FRAGMENT_RETRY -3 41 | 42 | # define DTLS1_CCS_HEADER_LENGTH 1 43 | 44 | # define DTLS1_AL_HEADER_LENGTH 2 45 | 46 | /* Timeout multipliers */ 47 | # define DTLS1_TMO_READ_COUNT 2 48 | # define DTLS1_TMO_WRITE_COUNT 2 49 | 50 | # define DTLS1_TMO_ALERT_COUNT 12 51 | 52 | #ifdef __cplusplus 53 | } 54 | #endif 55 | #endif 56 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/openssl/ebcdic.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_EBCDIC_H 11 | # define HEADER_EBCDIC_H 12 | 13 | # include 14 | 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | /* Avoid name clashes with other applications */ 20 | # define os_toascii _openssl_os_toascii 21 | # define os_toebcdic _openssl_os_toebcdic 22 | # define ebcdic2ascii _openssl_ebcdic2ascii 23 | # define ascii2ebcdic _openssl_ascii2ebcdic 24 | 25 | extern const unsigned char os_toascii[256]; 26 | extern const unsigned char os_toebcdic[256]; 27 | void *ebcdic2ascii(void *dest, const void *srce, size_t count); 28 | void *ascii2ebcdic(void *dest, const void *srce, size_t count); 29 | 30 | #ifdef __cplusplus 31 | } 32 | #endif 33 | #endif 34 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/openssl/ecdh.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #include 11 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/openssl/ecdsa.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #include 11 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/openssl/hmac.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_HMAC_H 11 | # define HEADER_HMAC_H 12 | 13 | # include 14 | 15 | # include 16 | 17 | # if OPENSSL_API_COMPAT < 0x10200000L 18 | # define HMAC_MAX_MD_CBLOCK 128 /* Deprecated */ 19 | # endif 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | size_t HMAC_size(const HMAC_CTX *e); 26 | HMAC_CTX *HMAC_CTX_new(void); 27 | int HMAC_CTX_reset(HMAC_CTX *ctx); 28 | void HMAC_CTX_free(HMAC_CTX *ctx); 29 | 30 | DEPRECATEDIN_1_1_0(__owur int HMAC_Init(HMAC_CTX *ctx, const void *key, int len, 31 | const EVP_MD *md)) 32 | 33 | /*__owur*/ int HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len, 34 | const EVP_MD *md, ENGINE *impl); 35 | /*__owur*/ int HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, 36 | size_t len); 37 | /*__owur*/ int HMAC_Final(HMAC_CTX *ctx, unsigned char *md, 38 | unsigned int *len); 39 | unsigned char *HMAC(const EVP_MD *evp_md, const void *key, int key_len, 40 | const unsigned char *d, size_t n, unsigned char *md, 41 | unsigned int *md_len); 42 | __owur int HMAC_CTX_copy(HMAC_CTX *dctx, HMAC_CTX *sctx); 43 | 44 | void HMAC_CTX_set_flags(HMAC_CTX *ctx, unsigned long flags); 45 | const EVP_MD *HMAC_CTX_get_md(const HMAC_CTX *ctx); 46 | 47 | #ifdef __cplusplus 48 | } 49 | #endif 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/openssl/idea.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_IDEA_H 11 | # define HEADER_IDEA_H 12 | 13 | # include 14 | 15 | # ifndef OPENSSL_NO_IDEA 16 | # ifdef __cplusplus 17 | extern "C" { 18 | # endif 19 | 20 | typedef unsigned int IDEA_INT; 21 | 22 | # define IDEA_ENCRYPT 1 23 | # define IDEA_DECRYPT 0 24 | 25 | # define IDEA_BLOCK 8 26 | # define IDEA_KEY_LENGTH 16 27 | 28 | typedef struct idea_key_st { 29 | IDEA_INT data[9][6]; 30 | } IDEA_KEY_SCHEDULE; 31 | 32 | const char *IDEA_options(void); 33 | void IDEA_ecb_encrypt(const unsigned char *in, unsigned char *out, 34 | IDEA_KEY_SCHEDULE *ks); 35 | void IDEA_set_encrypt_key(const unsigned char *key, IDEA_KEY_SCHEDULE *ks); 36 | void IDEA_set_decrypt_key(IDEA_KEY_SCHEDULE *ek, IDEA_KEY_SCHEDULE *dk); 37 | void IDEA_cbc_encrypt(const unsigned char *in, unsigned char *out, 38 | long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv, 39 | int enc); 40 | void IDEA_cfb64_encrypt(const unsigned char *in, unsigned char *out, 41 | long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv, 42 | int *num, int enc); 43 | void IDEA_ofb64_encrypt(const unsigned char *in, unsigned char *out, 44 | long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv, 45 | int *num); 46 | void IDEA_encrypt(unsigned long *in, IDEA_KEY_SCHEDULE *ks); 47 | 48 | # if OPENSSL_API_COMPAT < 0x10100000L 49 | # define idea_options IDEA_options 50 | # define idea_ecb_encrypt IDEA_ecb_encrypt 51 | # define idea_set_encrypt_key IDEA_set_encrypt_key 52 | # define idea_set_decrypt_key IDEA_set_decrypt_key 53 | # define idea_cbc_encrypt IDEA_cbc_encrypt 54 | # define idea_cfb64_encrypt IDEA_cfb64_encrypt 55 | # define idea_ofb64_encrypt IDEA_ofb64_encrypt 56 | # define idea_encrypt IDEA_encrypt 57 | # endif 58 | 59 | # ifdef __cplusplus 60 | } 61 | # endif 62 | # endif 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/openssl/kdferr.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by util/mkerr.pl DO NOT EDIT 3 | * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. 4 | * 5 | * Licensed under the OpenSSL license (the "License"). You may not use 6 | * this file except in compliance with the License. You can obtain a copy 7 | * in the file LICENSE in the source distribution or at 8 | * https://www.openssl.org/source/license.html 9 | */ 10 | 11 | #ifndef HEADER_KDFERR_H 12 | # define HEADER_KDFERR_H 13 | 14 | # ifndef HEADER_SYMHACKS_H 15 | # include 16 | # endif 17 | 18 | # ifdef __cplusplus 19 | extern "C" 20 | # endif 21 | int ERR_load_KDF_strings(void); 22 | 23 | /* 24 | * KDF function codes. 25 | */ 26 | # define KDF_F_PKEY_HKDF_CTRL_STR 103 27 | # define KDF_F_PKEY_HKDF_DERIVE 102 28 | # define KDF_F_PKEY_HKDF_INIT 108 29 | # define KDF_F_PKEY_SCRYPT_CTRL_STR 104 30 | # define KDF_F_PKEY_SCRYPT_CTRL_UINT64 105 31 | # define KDF_F_PKEY_SCRYPT_DERIVE 109 32 | # define KDF_F_PKEY_SCRYPT_INIT 106 33 | # define KDF_F_PKEY_SCRYPT_SET_MEMBUF 107 34 | # define KDF_F_PKEY_TLS1_PRF_CTRL_STR 100 35 | # define KDF_F_PKEY_TLS1_PRF_DERIVE 101 36 | # define KDF_F_PKEY_TLS1_PRF_INIT 110 37 | # define KDF_F_TLS1_PRF_ALG 111 38 | 39 | /* 40 | * KDF reason codes. 41 | */ 42 | # define KDF_R_INVALID_DIGEST 100 43 | # define KDF_R_MISSING_ITERATION_COUNT 109 44 | # define KDF_R_MISSING_KEY 104 45 | # define KDF_R_MISSING_MESSAGE_DIGEST 105 46 | # define KDF_R_MISSING_PARAMETER 101 47 | # define KDF_R_MISSING_PASS 110 48 | # define KDF_R_MISSING_SALT 111 49 | # define KDF_R_MISSING_SECRET 107 50 | # define KDF_R_MISSING_SEED 106 51 | # define KDF_R_UNKNOWN_PARAMETER_TYPE 103 52 | # define KDF_R_VALUE_ERROR 108 53 | # define KDF_R_VALUE_MISSING 102 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/openssl/md2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_MD2_H 11 | # define HEADER_MD2_H 12 | 13 | # include 14 | 15 | # ifndef OPENSSL_NO_MD2 16 | # include 17 | # ifdef __cplusplus 18 | extern "C" { 19 | # endif 20 | 21 | typedef unsigned char MD2_INT; 22 | 23 | # define MD2_DIGEST_LENGTH 16 24 | # define MD2_BLOCK 16 25 | 26 | typedef struct MD2state_st { 27 | unsigned int num; 28 | unsigned char data[MD2_BLOCK]; 29 | MD2_INT cksm[MD2_BLOCK]; 30 | MD2_INT state[MD2_BLOCK]; 31 | } MD2_CTX; 32 | 33 | const char *MD2_options(void); 34 | int MD2_Init(MD2_CTX *c); 35 | int MD2_Update(MD2_CTX *c, const unsigned char *data, size_t len); 36 | int MD2_Final(unsigned char *md, MD2_CTX *c); 37 | unsigned char *MD2(const unsigned char *d, size_t n, unsigned char *md); 38 | 39 | # ifdef __cplusplus 40 | } 41 | # endif 42 | # endif 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/openssl/md4.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_MD4_H 11 | # define HEADER_MD4_H 12 | 13 | # include 14 | 15 | # ifndef OPENSSL_NO_MD4 16 | # include 17 | # include 18 | # ifdef __cplusplus 19 | extern "C" { 20 | # endif 21 | 22 | /*- 23 | * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 24 | * ! MD4_LONG has to be at least 32 bits wide. ! 25 | * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 26 | */ 27 | # define MD4_LONG unsigned int 28 | 29 | # define MD4_CBLOCK 64 30 | # define MD4_LBLOCK (MD4_CBLOCK/4) 31 | # define MD4_DIGEST_LENGTH 16 32 | 33 | typedef struct MD4state_st { 34 | MD4_LONG A, B, C, D; 35 | MD4_LONG Nl, Nh; 36 | MD4_LONG data[MD4_LBLOCK]; 37 | unsigned int num; 38 | } MD4_CTX; 39 | 40 | int MD4_Init(MD4_CTX *c); 41 | int MD4_Update(MD4_CTX *c, const void *data, size_t len); 42 | int MD4_Final(unsigned char *md, MD4_CTX *c); 43 | unsigned char *MD4(const unsigned char *d, size_t n, unsigned char *md); 44 | void MD4_Transform(MD4_CTX *c, const unsigned char *b); 45 | 46 | # ifdef __cplusplus 47 | } 48 | # endif 49 | # endif 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/openssl/md5.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_MD5_H 11 | # define HEADER_MD5_H 12 | 13 | # include 14 | 15 | # ifndef OPENSSL_NO_MD5 16 | # include 17 | # include 18 | # ifdef __cplusplus 19 | extern "C" { 20 | # endif 21 | 22 | /* 23 | * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 24 | * ! MD5_LONG has to be at least 32 bits wide. ! 25 | * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 26 | */ 27 | # define MD5_LONG unsigned int 28 | 29 | # define MD5_CBLOCK 64 30 | # define MD5_LBLOCK (MD5_CBLOCK/4) 31 | # define MD5_DIGEST_LENGTH 16 32 | 33 | typedef struct MD5state_st { 34 | MD5_LONG A, B, C, D; 35 | MD5_LONG Nl, Nh; 36 | MD5_LONG data[MD5_LBLOCK]; 37 | unsigned int num; 38 | } MD5_CTX; 39 | 40 | int MD5_Init(MD5_CTX *c); 41 | int MD5_Update(MD5_CTX *c, const void *data, size_t len); 42 | int MD5_Final(unsigned char *md, MD5_CTX *c); 43 | unsigned char *MD5(const unsigned char *d, size_t n, unsigned char *md); 44 | void MD5_Transform(MD5_CTX *c, const unsigned char *b); 45 | # ifdef __cplusplus 46 | } 47 | # endif 48 | # endif 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/openssl/mdc2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_MDC2_H 11 | # define HEADER_MDC2_H 12 | 13 | # include 14 | 15 | #ifndef OPENSSL_NO_MDC2 16 | # include 17 | # include 18 | # ifdef __cplusplus 19 | extern "C" { 20 | # endif 21 | 22 | # define MDC2_BLOCK 8 23 | # define MDC2_DIGEST_LENGTH 16 24 | 25 | typedef struct mdc2_ctx_st { 26 | unsigned int num; 27 | unsigned char data[MDC2_BLOCK]; 28 | DES_cblock h, hh; 29 | int pad_type; /* either 1 or 2, default 1 */ 30 | } MDC2_CTX; 31 | 32 | int MDC2_Init(MDC2_CTX *c); 33 | int MDC2_Update(MDC2_CTX *c, const unsigned char *data, size_t len); 34 | int MDC2_Final(unsigned char *md, MDC2_CTX *c); 35 | unsigned char *MDC2(const unsigned char *d, size_t n, unsigned char *md); 36 | 37 | # ifdef __cplusplus 38 | } 39 | # endif 40 | # endif 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/openssl/objectserr.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by util/mkerr.pl DO NOT EDIT 3 | * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. 4 | * 5 | * Licensed under the OpenSSL license (the "License"). You may not use 6 | * this file except in compliance with the License. You can obtain a copy 7 | * in the file LICENSE in the source distribution or at 8 | * https://www.openssl.org/source/license.html 9 | */ 10 | 11 | #ifndef HEADER_OBJERR_H 12 | # define HEADER_OBJERR_H 13 | 14 | # ifndef HEADER_SYMHACKS_H 15 | # include 16 | # endif 17 | 18 | # ifdef __cplusplus 19 | extern "C" 20 | # endif 21 | int ERR_load_OBJ_strings(void); 22 | 23 | /* 24 | * OBJ function codes. 25 | */ 26 | # define OBJ_F_OBJ_ADD_OBJECT 105 27 | # define OBJ_F_OBJ_ADD_SIGID 107 28 | # define OBJ_F_OBJ_CREATE 100 29 | # define OBJ_F_OBJ_DUP 101 30 | # define OBJ_F_OBJ_NAME_NEW_INDEX 106 31 | # define OBJ_F_OBJ_NID2LN 102 32 | # define OBJ_F_OBJ_NID2OBJ 103 33 | # define OBJ_F_OBJ_NID2SN 104 34 | # define OBJ_F_OBJ_TXT2OBJ 108 35 | 36 | /* 37 | * OBJ reason codes. 38 | */ 39 | # define OBJ_R_OID_EXISTS 102 40 | # define OBJ_R_UNKNOWN_NID 101 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/openssl/ocsperr.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by util/mkerr.pl DO NOT EDIT 3 | * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. 4 | * 5 | * Licensed under the OpenSSL license (the "License"). You may not use 6 | * this file except in compliance with the License. You can obtain a copy 7 | * in the file LICENSE in the source distribution or at 8 | * https://www.openssl.org/source/license.html 9 | */ 10 | 11 | #ifndef HEADER_OCSPERR_H 12 | # define HEADER_OCSPERR_H 13 | 14 | # ifndef HEADER_SYMHACKS_H 15 | # include 16 | # endif 17 | 18 | # include 19 | 20 | # ifndef OPENSSL_NO_OCSP 21 | 22 | # ifdef __cplusplus 23 | extern "C" 24 | # endif 25 | int ERR_load_OCSP_strings(void); 26 | 27 | /* 28 | * OCSP function codes. 29 | */ 30 | # define OCSP_F_D2I_OCSP_NONCE 102 31 | # define OCSP_F_OCSP_BASIC_ADD1_STATUS 103 32 | # define OCSP_F_OCSP_BASIC_SIGN 104 33 | # define OCSP_F_OCSP_BASIC_SIGN_CTX 119 34 | # define OCSP_F_OCSP_BASIC_VERIFY 105 35 | # define OCSP_F_OCSP_CERT_ID_NEW 101 36 | # define OCSP_F_OCSP_CHECK_DELEGATED 106 37 | # define OCSP_F_OCSP_CHECK_IDS 107 38 | # define OCSP_F_OCSP_CHECK_ISSUER 108 39 | # define OCSP_F_OCSP_CHECK_VALIDITY 115 40 | # define OCSP_F_OCSP_MATCH_ISSUERID 109 41 | # define OCSP_F_OCSP_PARSE_URL 114 42 | # define OCSP_F_OCSP_REQUEST_SIGN 110 43 | # define OCSP_F_OCSP_REQUEST_VERIFY 116 44 | # define OCSP_F_OCSP_RESPONSE_GET1_BASIC 111 45 | # define OCSP_F_PARSE_HTTP_LINE1 118 46 | 47 | /* 48 | * OCSP reason codes. 49 | */ 50 | # define OCSP_R_CERTIFICATE_VERIFY_ERROR 101 51 | # define OCSP_R_DIGEST_ERR 102 52 | # define OCSP_R_ERROR_IN_NEXTUPDATE_FIELD 122 53 | # define OCSP_R_ERROR_IN_THISUPDATE_FIELD 123 54 | # define OCSP_R_ERROR_PARSING_URL 121 55 | # define OCSP_R_MISSING_OCSPSIGNING_USAGE 103 56 | # define OCSP_R_NEXTUPDATE_BEFORE_THISUPDATE 124 57 | # define OCSP_R_NOT_BASIC_RESPONSE 104 58 | # define OCSP_R_NO_CERTIFICATES_IN_CHAIN 105 59 | # define OCSP_R_NO_RESPONSE_DATA 108 60 | # define OCSP_R_NO_REVOKED_TIME 109 61 | # define OCSP_R_NO_SIGNER_KEY 130 62 | # define OCSP_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE 110 63 | # define OCSP_R_REQUEST_NOT_SIGNED 128 64 | # define OCSP_R_RESPONSE_CONTAINS_NO_REVOCATION_DATA 111 65 | # define OCSP_R_ROOT_CA_NOT_TRUSTED 112 66 | # define OCSP_R_SERVER_RESPONSE_ERROR 114 67 | # define OCSP_R_SERVER_RESPONSE_PARSE_ERROR 115 68 | # define OCSP_R_SIGNATURE_FAILURE 117 69 | # define OCSP_R_SIGNER_CERTIFICATE_NOT_FOUND 118 70 | # define OCSP_R_STATUS_EXPIRED 125 71 | # define OCSP_R_STATUS_NOT_YET_VALID 126 72 | # define OCSP_R_STATUS_TOO_OLD 127 73 | # define OCSP_R_UNKNOWN_MESSAGE_DIGEST 119 74 | # define OCSP_R_UNKNOWN_NID 120 75 | # define OCSP_R_UNSUPPORTED_REQUESTORNAME_TYPE 129 76 | 77 | # endif 78 | #endif 79 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/openssl/opensslv.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2021 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_OPENSSLV_H 11 | # define HEADER_OPENSSLV_H 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | /*- 18 | * Numeric release version identifier: 19 | * MNNFFPPS: major minor fix patch status 20 | * The status nibble has one of the values 0 for development, 1 to e for betas 21 | * 1 to 14, and f for release. The patch level is exactly that. 22 | * For example: 23 | * 0.9.3-dev 0x00903000 24 | * 0.9.3-beta1 0x00903001 25 | * 0.9.3-beta2-dev 0x00903002 26 | * 0.9.3-beta2 0x00903002 (same as ...beta2-dev) 27 | * 0.9.3 0x0090300f 28 | * 0.9.3a 0x0090301f 29 | * 0.9.4 0x0090400f 30 | * 1.2.3z 0x102031af 31 | * 32 | * For continuity reasons (because 0.9.5 is already out, and is coded 33 | * 0x00905100), between 0.9.5 and 0.9.6 the coding of the patch level 34 | * part is slightly different, by setting the highest bit. This means 35 | * that 0.9.5a looks like this: 0x0090581f. At 0.9.6, we can start 36 | * with 0x0090600S... 37 | * 38 | * (Prior to 0.9.3-dev a different scheme was used: 0.9.2b is 0x0922.) 39 | * (Prior to 0.9.5a beta1, a different scheme was used: MMNNFFRBB for 40 | * major minor fix final patch/beta) 41 | */ 42 | # define OPENSSL_VERSION_NUMBER 0x101010bfL 43 | # define OPENSSL_VERSION_TEXT "OpenSSL 1.1.1k 25 Mar 2021" 44 | 45 | /*- 46 | * The macros below are to be used for shared library (.so, .dll, ...) 47 | * versioning. That kind of versioning works a bit differently between 48 | * operating systems. The most usual scheme is to set a major and a minor 49 | * number, and have the runtime loader check that the major number is equal 50 | * to what it was at application link time, while the minor number has to 51 | * be greater or equal to what it was at application link time. With this 52 | * scheme, the version number is usually part of the file name, like this: 53 | * 54 | * libcrypto.so.0.9 55 | * 56 | * Some unixen also make a softlink with the major version number only: 57 | * 58 | * libcrypto.so.0 59 | * 60 | * On Tru64 and IRIX 6.x it works a little bit differently. There, the 61 | * shared library version is stored in the file, and is actually a series 62 | * of versions, separated by colons. The rightmost version present in the 63 | * library when linking an application is stored in the application to be 64 | * matched at run time. When the application is run, a check is done to 65 | * see if the library version stored in the application matches any of the 66 | * versions in the version string of the library itself. 67 | * This version string can be constructed in any way, depending on what 68 | * kind of matching is desired. However, to implement the same scheme as 69 | * the one used in the other unixen, all compatible versions, from lowest 70 | * to highest, should be part of the string. Consecutive builds would 71 | * give the following versions strings: 72 | * 73 | * 3.0 74 | * 3.0:3.1 75 | * 3.0:3.1:3.2 76 | * 4.0 77 | * 4.0:4.1 78 | * 79 | * Notice how version 4 is completely incompatible with version, and 80 | * therefore give the breach you can see. 81 | * 82 | * There may be other schemes as well that I haven't yet discovered. 83 | * 84 | * So, here's the way it works here: first of all, the library version 85 | * number doesn't need at all to match the overall OpenSSL version. 86 | * However, it's nice and more understandable if it actually does. 87 | * The current library version is stored in the macro SHLIB_VERSION_NUMBER, 88 | * which is just a piece of text in the format "M.m.e" (Major, minor, edit). 89 | * For the sake of Tru64, IRIX, and any other OS that behaves in similar ways, 90 | * we need to keep a history of version numbers, which is done in the 91 | * macro SHLIB_VERSION_HISTORY. The numbers are separated by colons and 92 | * should only keep the versions that are binary compatible with the current. 93 | */ 94 | # define SHLIB_VERSION_HISTORY "" 95 | # define SHLIB_VERSION_NUMBER "1.1" 96 | 97 | 98 | #ifdef __cplusplus 99 | } 100 | #endif 101 | #endif /* HEADER_OPENSSLV_H */ 102 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/openssl/pem2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_PEM2_H 11 | # define HEADER_PEM2_H 12 | # include 13 | #endif 14 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/openssl/pkcs12err.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by util/mkerr.pl DO NOT EDIT 3 | * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. 4 | * 5 | * Licensed under the OpenSSL license (the "License"). You may not use 6 | * this file except in compliance with the License. You can obtain a copy 7 | * in the file LICENSE in the source distribution or at 8 | * https://www.openssl.org/source/license.html 9 | */ 10 | 11 | #ifndef HEADER_PKCS12ERR_H 12 | # define HEADER_PKCS12ERR_H 13 | 14 | # ifndef HEADER_SYMHACKS_H 15 | # include 16 | # endif 17 | 18 | # ifdef __cplusplus 19 | extern "C" 20 | # endif 21 | int ERR_load_PKCS12_strings(void); 22 | 23 | /* 24 | * PKCS12 function codes. 25 | */ 26 | # define PKCS12_F_OPENSSL_ASC2UNI 121 27 | # define PKCS12_F_OPENSSL_UNI2ASC 124 28 | # define PKCS12_F_OPENSSL_UNI2UTF8 127 29 | # define PKCS12_F_OPENSSL_UTF82UNI 129 30 | # define PKCS12_F_PKCS12_CREATE 105 31 | # define PKCS12_F_PKCS12_GEN_MAC 107 32 | # define PKCS12_F_PKCS12_INIT 109 33 | # define PKCS12_F_PKCS12_ITEM_DECRYPT_D2I 106 34 | # define PKCS12_F_PKCS12_ITEM_I2D_ENCRYPT 108 35 | # define PKCS12_F_PKCS12_ITEM_PACK_SAFEBAG 117 36 | # define PKCS12_F_PKCS12_KEY_GEN_ASC 110 37 | # define PKCS12_F_PKCS12_KEY_GEN_UNI 111 38 | # define PKCS12_F_PKCS12_KEY_GEN_UTF8 116 39 | # define PKCS12_F_PKCS12_NEWPASS 128 40 | # define PKCS12_F_PKCS12_PACK_P7DATA 114 41 | # define PKCS12_F_PKCS12_PACK_P7ENCDATA 115 42 | # define PKCS12_F_PKCS12_PARSE 118 43 | # define PKCS12_F_PKCS12_PBE_CRYPT 119 44 | # define PKCS12_F_PKCS12_PBE_KEYIVGEN 120 45 | # define PKCS12_F_PKCS12_SAFEBAG_CREATE0_P8INF 112 46 | # define PKCS12_F_PKCS12_SAFEBAG_CREATE0_PKCS8 113 47 | # define PKCS12_F_PKCS12_SAFEBAG_CREATE_PKCS8_ENCRYPT 133 48 | # define PKCS12_F_PKCS12_SETUP_MAC 122 49 | # define PKCS12_F_PKCS12_SET_MAC 123 50 | # define PKCS12_F_PKCS12_UNPACK_AUTHSAFES 130 51 | # define PKCS12_F_PKCS12_UNPACK_P7DATA 131 52 | # define PKCS12_F_PKCS12_VERIFY_MAC 126 53 | # define PKCS12_F_PKCS8_ENCRYPT 125 54 | # define PKCS12_F_PKCS8_SET0_PBE 132 55 | 56 | /* 57 | * PKCS12 reason codes. 58 | */ 59 | # define PKCS12_R_CANT_PACK_STRUCTURE 100 60 | # define PKCS12_R_CONTENT_TYPE_NOT_DATA 121 61 | # define PKCS12_R_DECODE_ERROR 101 62 | # define PKCS12_R_ENCODE_ERROR 102 63 | # define PKCS12_R_ENCRYPT_ERROR 103 64 | # define PKCS12_R_ERROR_SETTING_ENCRYPTED_DATA_TYPE 120 65 | # define PKCS12_R_INVALID_NULL_ARGUMENT 104 66 | # define PKCS12_R_INVALID_NULL_PKCS12_POINTER 105 67 | # define PKCS12_R_IV_GEN_ERROR 106 68 | # define PKCS12_R_KEY_GEN_ERROR 107 69 | # define PKCS12_R_MAC_ABSENT 108 70 | # define PKCS12_R_MAC_GENERATION_ERROR 109 71 | # define PKCS12_R_MAC_SETUP_ERROR 110 72 | # define PKCS12_R_MAC_STRING_SET_ERROR 111 73 | # define PKCS12_R_MAC_VERIFY_FAILURE 113 74 | # define PKCS12_R_PARSE_ERROR 114 75 | # define PKCS12_R_PKCS12_ALGOR_CIPHERINIT_ERROR 115 76 | # define PKCS12_R_PKCS12_CIPHERFINAL_ERROR 116 77 | # define PKCS12_R_PKCS12_PBE_CRYPT_ERROR 117 78 | # define PKCS12_R_UNKNOWN_DIGEST_ALGORITHM 118 79 | # define PKCS12_R_UNSUPPORTED_PKCS12_MODE 119 80 | 81 | #endif 82 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/openssl/rand.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_RAND_H 11 | # define HEADER_RAND_H 12 | 13 | # include 14 | # include 15 | # include 16 | # include 17 | 18 | #ifdef __cplusplus 19 | extern "C" { 20 | #endif 21 | 22 | struct rand_meth_st { 23 | int (*seed) (const void *buf, int num); 24 | int (*bytes) (unsigned char *buf, int num); 25 | void (*cleanup) (void); 26 | int (*add) (const void *buf, int num, double randomness); 27 | int (*pseudorand) (unsigned char *buf, int num); 28 | int (*status) (void); 29 | }; 30 | 31 | int RAND_set_rand_method(const RAND_METHOD *meth); 32 | const RAND_METHOD *RAND_get_rand_method(void); 33 | # ifndef OPENSSL_NO_ENGINE 34 | int RAND_set_rand_engine(ENGINE *engine); 35 | # endif 36 | 37 | RAND_METHOD *RAND_OpenSSL(void); 38 | 39 | # if OPENSSL_API_COMPAT < 0x10100000L 40 | # define RAND_cleanup() while(0) continue 41 | # endif 42 | int RAND_bytes(unsigned char *buf, int num); 43 | int RAND_priv_bytes(unsigned char *buf, int num); 44 | DEPRECATEDIN_1_1_0(int RAND_pseudo_bytes(unsigned char *buf, int num)) 45 | 46 | void RAND_seed(const void *buf, int num); 47 | void RAND_keep_random_devices_open(int keep); 48 | 49 | # if defined(__ANDROID__) && defined(__NDK_FPABI__) 50 | __NDK_FPABI__ /* __attribute__((pcs("aapcs"))) on ARM */ 51 | # endif 52 | void RAND_add(const void *buf, int num, double randomness); 53 | int RAND_load_file(const char *file, long max_bytes); 54 | int RAND_write_file(const char *file); 55 | const char *RAND_file_name(char *file, size_t num); 56 | int RAND_status(void); 57 | 58 | # ifndef OPENSSL_NO_EGD 59 | int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes); 60 | int RAND_egd(const char *path); 61 | int RAND_egd_bytes(const char *path, int bytes); 62 | # endif 63 | 64 | int RAND_poll(void); 65 | 66 | # if defined(_WIN32) && (defined(BASETYPES) || defined(_WINDEF_H)) 67 | /* application has to include in order to use these */ 68 | DEPRECATEDIN_1_1_0(void RAND_screen(void)) 69 | DEPRECATEDIN_1_1_0(int RAND_event(UINT, WPARAM, LPARAM)) 70 | # endif 71 | 72 | 73 | #ifdef __cplusplus 74 | } 75 | #endif 76 | 77 | #endif 78 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/openssl/rc2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_RC2_H 11 | # define HEADER_RC2_H 12 | 13 | # include 14 | 15 | # ifndef OPENSSL_NO_RC2 16 | # ifdef __cplusplus 17 | extern "C" { 18 | # endif 19 | 20 | typedef unsigned int RC2_INT; 21 | 22 | # define RC2_ENCRYPT 1 23 | # define RC2_DECRYPT 0 24 | 25 | # define RC2_BLOCK 8 26 | # define RC2_KEY_LENGTH 16 27 | 28 | typedef struct rc2_key_st { 29 | RC2_INT data[64]; 30 | } RC2_KEY; 31 | 32 | void RC2_set_key(RC2_KEY *key, int len, const unsigned char *data, int bits); 33 | void RC2_ecb_encrypt(const unsigned char *in, unsigned char *out, 34 | RC2_KEY *key, int enc); 35 | void RC2_encrypt(unsigned long *data, RC2_KEY *key); 36 | void RC2_decrypt(unsigned long *data, RC2_KEY *key); 37 | void RC2_cbc_encrypt(const unsigned char *in, unsigned char *out, long length, 38 | RC2_KEY *ks, unsigned char *iv, int enc); 39 | void RC2_cfb64_encrypt(const unsigned char *in, unsigned char *out, 40 | long length, RC2_KEY *schedule, unsigned char *ivec, 41 | int *num, int enc); 42 | void RC2_ofb64_encrypt(const unsigned char *in, unsigned char *out, 43 | long length, RC2_KEY *schedule, unsigned char *ivec, 44 | int *num); 45 | 46 | # ifdef __cplusplus 47 | } 48 | # endif 49 | # endif 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/openssl/rc4.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_RC4_H 11 | # define HEADER_RC4_H 12 | 13 | # include 14 | 15 | # ifndef OPENSSL_NO_RC4 16 | # include 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | typedef struct rc4_key_st { 22 | RC4_INT x, y; 23 | RC4_INT data[256]; 24 | } RC4_KEY; 25 | 26 | const char *RC4_options(void); 27 | void RC4_set_key(RC4_KEY *key, int len, const unsigned char *data); 28 | void RC4(RC4_KEY *key, size_t len, const unsigned char *indata, 29 | unsigned char *outdata); 30 | 31 | # ifdef __cplusplus 32 | } 33 | # endif 34 | # endif 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/openssl/rc5.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_RC5_H 11 | # define HEADER_RC5_H 12 | 13 | # include 14 | 15 | # ifndef OPENSSL_NO_RC5 16 | # ifdef __cplusplus 17 | extern "C" { 18 | # endif 19 | 20 | # define RC5_ENCRYPT 1 21 | # define RC5_DECRYPT 0 22 | 23 | # define RC5_32_INT unsigned int 24 | 25 | # define RC5_32_BLOCK 8 26 | # define RC5_32_KEY_LENGTH 16/* This is a default, max is 255 */ 27 | 28 | /* 29 | * This are the only values supported. Tweak the code if you want more The 30 | * most supported modes will be RC5-32/12/16 RC5-32/16/8 31 | */ 32 | # define RC5_8_ROUNDS 8 33 | # define RC5_12_ROUNDS 12 34 | # define RC5_16_ROUNDS 16 35 | 36 | typedef struct rc5_key_st { 37 | /* Number of rounds */ 38 | int rounds; 39 | RC5_32_INT data[2 * (RC5_16_ROUNDS + 1)]; 40 | } RC5_32_KEY; 41 | 42 | void RC5_32_set_key(RC5_32_KEY *key, int len, const unsigned char *data, 43 | int rounds); 44 | void RC5_32_ecb_encrypt(const unsigned char *in, unsigned char *out, 45 | RC5_32_KEY *key, int enc); 46 | void RC5_32_encrypt(unsigned long *data, RC5_32_KEY *key); 47 | void RC5_32_decrypt(unsigned long *data, RC5_32_KEY *key); 48 | void RC5_32_cbc_encrypt(const unsigned char *in, unsigned char *out, 49 | long length, RC5_32_KEY *ks, unsigned char *iv, 50 | int enc); 51 | void RC5_32_cfb64_encrypt(const unsigned char *in, unsigned char *out, 52 | long length, RC5_32_KEY *schedule, 53 | unsigned char *ivec, int *num, int enc); 54 | void RC5_32_ofb64_encrypt(const unsigned char *in, unsigned char *out, 55 | long length, RC5_32_KEY *schedule, 56 | unsigned char *ivec, int *num); 57 | 58 | # ifdef __cplusplus 59 | } 60 | # endif 61 | # endif 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/openssl/ripemd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_RIPEMD_H 11 | # define HEADER_RIPEMD_H 12 | 13 | # include 14 | 15 | #ifndef OPENSSL_NO_RMD160 16 | # include 17 | # include 18 | # ifdef __cplusplus 19 | extern "C" { 20 | # endif 21 | 22 | # define RIPEMD160_LONG unsigned int 23 | 24 | # define RIPEMD160_CBLOCK 64 25 | # define RIPEMD160_LBLOCK (RIPEMD160_CBLOCK/4) 26 | # define RIPEMD160_DIGEST_LENGTH 20 27 | 28 | typedef struct RIPEMD160state_st { 29 | RIPEMD160_LONG A, B, C, D, E; 30 | RIPEMD160_LONG Nl, Nh; 31 | RIPEMD160_LONG data[RIPEMD160_LBLOCK]; 32 | unsigned int num; 33 | } RIPEMD160_CTX; 34 | 35 | int RIPEMD160_Init(RIPEMD160_CTX *c); 36 | int RIPEMD160_Update(RIPEMD160_CTX *c, const void *data, size_t len); 37 | int RIPEMD160_Final(unsigned char *md, RIPEMD160_CTX *c); 38 | unsigned char *RIPEMD160(const unsigned char *d, size_t n, unsigned char *md); 39 | void RIPEMD160_Transform(RIPEMD160_CTX *c, const unsigned char *b); 40 | 41 | # ifdef __cplusplus 42 | } 43 | # endif 44 | # endif 45 | 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/openssl/seed.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2007-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | /* 11 | * Copyright (c) 2007 KISA(Korea Information Security Agency). All rights reserved. 12 | * 13 | * Redistribution and use in source and binary forms, with or without 14 | * modification, are permitted provided that the following conditions 15 | * are met: 16 | * 1. Redistributions of source code must retain the above copyright 17 | * notice, this list of conditions and the following disclaimer. 18 | * 2. Neither the name of author nor the names of its contributors may 19 | * be used to endorse or promote products derived from this software 20 | * without specific prior written permission. 21 | * 22 | * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND 23 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25 | * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE 26 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 | * SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef HEADER_SEED_H 36 | # define HEADER_SEED_H 37 | 38 | # include 39 | 40 | # ifndef OPENSSL_NO_SEED 41 | # include 42 | # include 43 | 44 | #ifdef __cplusplus 45 | extern "C" { 46 | #endif 47 | 48 | /* look whether we need 'long' to get 32 bits */ 49 | # ifdef AES_LONG 50 | # ifndef SEED_LONG 51 | # define SEED_LONG 1 52 | # endif 53 | # endif 54 | 55 | # include 56 | 57 | # define SEED_BLOCK_SIZE 16 58 | # define SEED_KEY_LENGTH 16 59 | 60 | typedef struct seed_key_st { 61 | # ifdef SEED_LONG 62 | unsigned long data[32]; 63 | # else 64 | unsigned int data[32]; 65 | # endif 66 | } SEED_KEY_SCHEDULE; 67 | 68 | void SEED_set_key(const unsigned char rawkey[SEED_KEY_LENGTH], 69 | SEED_KEY_SCHEDULE *ks); 70 | 71 | void SEED_encrypt(const unsigned char s[SEED_BLOCK_SIZE], 72 | unsigned char d[SEED_BLOCK_SIZE], 73 | const SEED_KEY_SCHEDULE *ks); 74 | void SEED_decrypt(const unsigned char s[SEED_BLOCK_SIZE], 75 | unsigned char d[SEED_BLOCK_SIZE], 76 | const SEED_KEY_SCHEDULE *ks); 77 | 78 | void SEED_ecb_encrypt(const unsigned char *in, unsigned char *out, 79 | const SEED_KEY_SCHEDULE *ks, int enc); 80 | void SEED_cbc_encrypt(const unsigned char *in, unsigned char *out, size_t len, 81 | const SEED_KEY_SCHEDULE *ks, 82 | unsigned char ivec[SEED_BLOCK_SIZE], int enc); 83 | void SEED_cfb128_encrypt(const unsigned char *in, unsigned char *out, 84 | size_t len, const SEED_KEY_SCHEDULE *ks, 85 | unsigned char ivec[SEED_BLOCK_SIZE], int *num, 86 | int enc); 87 | void SEED_ofb128_encrypt(const unsigned char *in, unsigned char *out, 88 | size_t len, const SEED_KEY_SCHEDULE *ks, 89 | unsigned char ivec[SEED_BLOCK_SIZE], int *num); 90 | 91 | # ifdef __cplusplus 92 | } 93 | # endif 94 | # endif 95 | 96 | #endif 97 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/openssl/sha.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_SHA_H 11 | # define HEADER_SHA_H 12 | 13 | # include 14 | # include 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | /*- 21 | * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 22 | * ! SHA_LONG has to be at least 32 bits wide. ! 23 | * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 24 | */ 25 | # define SHA_LONG unsigned int 26 | 27 | # define SHA_LBLOCK 16 28 | # define SHA_CBLOCK (SHA_LBLOCK*4)/* SHA treats input data as a 29 | * contiguous array of 32 bit wide 30 | * big-endian values. */ 31 | # define SHA_LAST_BLOCK (SHA_CBLOCK-8) 32 | # define SHA_DIGEST_LENGTH 20 33 | 34 | typedef struct SHAstate_st { 35 | SHA_LONG h0, h1, h2, h3, h4; 36 | SHA_LONG Nl, Nh; 37 | SHA_LONG data[SHA_LBLOCK]; 38 | unsigned int num; 39 | } SHA_CTX; 40 | 41 | int SHA1_Init(SHA_CTX *c); 42 | int SHA1_Update(SHA_CTX *c, const void *data, size_t len); 43 | int SHA1_Final(unsigned char *md, SHA_CTX *c); 44 | unsigned char *SHA1(const unsigned char *d, size_t n, unsigned char *md); 45 | void SHA1_Transform(SHA_CTX *c, const unsigned char *data); 46 | 47 | # define SHA256_CBLOCK (SHA_LBLOCK*4)/* SHA-256 treats input data as a 48 | * contiguous array of 32 bit wide 49 | * big-endian values. */ 50 | 51 | typedef struct SHA256state_st { 52 | SHA_LONG h[8]; 53 | SHA_LONG Nl, Nh; 54 | SHA_LONG data[SHA_LBLOCK]; 55 | unsigned int num, md_len; 56 | } SHA256_CTX; 57 | 58 | int SHA224_Init(SHA256_CTX *c); 59 | int SHA224_Update(SHA256_CTX *c, const void *data, size_t len); 60 | int SHA224_Final(unsigned char *md, SHA256_CTX *c); 61 | unsigned char *SHA224(const unsigned char *d, size_t n, unsigned char *md); 62 | int SHA256_Init(SHA256_CTX *c); 63 | int SHA256_Update(SHA256_CTX *c, const void *data, size_t len); 64 | int SHA256_Final(unsigned char *md, SHA256_CTX *c); 65 | unsigned char *SHA256(const unsigned char *d, size_t n, unsigned char *md); 66 | void SHA256_Transform(SHA256_CTX *c, const unsigned char *data); 67 | 68 | # define SHA224_DIGEST_LENGTH 28 69 | # define SHA256_DIGEST_LENGTH 32 70 | # define SHA384_DIGEST_LENGTH 48 71 | # define SHA512_DIGEST_LENGTH 64 72 | 73 | /* 74 | * Unlike 32-bit digest algorithms, SHA-512 *relies* on SHA_LONG64 75 | * being exactly 64-bit wide. See Implementation Notes in sha512.c 76 | * for further details. 77 | */ 78 | /* 79 | * SHA-512 treats input data as a 80 | * contiguous array of 64 bit 81 | * wide big-endian values. 82 | */ 83 | # define SHA512_CBLOCK (SHA_LBLOCK*8) 84 | # if (defined(_WIN32) || defined(_WIN64)) && !defined(__MINGW32__) 85 | # define SHA_LONG64 unsigned __int64 86 | # define U64(C) C##UI64 87 | # elif defined(__arch64__) 88 | # define SHA_LONG64 unsigned long 89 | # define U64(C) C##UL 90 | # else 91 | # define SHA_LONG64 unsigned long long 92 | # define U64(C) C##ULL 93 | # endif 94 | 95 | typedef struct SHA512state_st { 96 | SHA_LONG64 h[8]; 97 | SHA_LONG64 Nl, Nh; 98 | union { 99 | SHA_LONG64 d[SHA_LBLOCK]; 100 | unsigned char p[SHA512_CBLOCK]; 101 | } u; 102 | unsigned int num, md_len; 103 | } SHA512_CTX; 104 | 105 | int SHA384_Init(SHA512_CTX *c); 106 | int SHA384_Update(SHA512_CTX *c, const void *data, size_t len); 107 | int SHA384_Final(unsigned char *md, SHA512_CTX *c); 108 | unsigned char *SHA384(const unsigned char *d, size_t n, unsigned char *md); 109 | int SHA512_Init(SHA512_CTX *c); 110 | int SHA512_Update(SHA512_CTX *c, const void *data, size_t len); 111 | int SHA512_Final(unsigned char *md, SHA512_CTX *c); 112 | unsigned char *SHA512(const unsigned char *d, size_t n, unsigned char *md); 113 | void SHA512_Transform(SHA512_CTX *c, const unsigned char *data); 114 | 115 | #ifdef __cplusplus 116 | } 117 | #endif 118 | 119 | #endif 120 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/openssl/srp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2004-2018 The OpenSSL Project Authors. All Rights Reserved. 3 | * Copyright (c) 2004, EdelKey Project. All Rights Reserved. 4 | * 5 | * Licensed under the OpenSSL license (the "License"). You may not use 6 | * this file except in compliance with the License. You can obtain a copy 7 | * in the file LICENSE in the source distribution or at 8 | * https://www.openssl.org/source/license.html 9 | * 10 | * Originally written by Christophe Renou and Peter Sylvester, 11 | * for the EdelKey project. 12 | */ 13 | 14 | #ifndef HEADER_SRP_H 15 | # define HEADER_SRP_H 16 | 17 | #include 18 | 19 | #ifndef OPENSSL_NO_SRP 20 | # include 21 | # include 22 | # include 23 | # include 24 | # include 25 | 26 | # ifdef __cplusplus 27 | extern "C" { 28 | # endif 29 | 30 | typedef struct SRP_gN_cache_st { 31 | char *b64_bn; 32 | BIGNUM *bn; 33 | } SRP_gN_cache; 34 | 35 | 36 | DEFINE_STACK_OF(SRP_gN_cache) 37 | 38 | typedef struct SRP_user_pwd_st { 39 | /* Owned by us. */ 40 | char *id; 41 | BIGNUM *s; 42 | BIGNUM *v; 43 | /* Not owned by us. */ 44 | const BIGNUM *g; 45 | const BIGNUM *N; 46 | /* Owned by us. */ 47 | char *info; 48 | } SRP_user_pwd; 49 | 50 | void SRP_user_pwd_free(SRP_user_pwd *user_pwd); 51 | 52 | DEFINE_STACK_OF(SRP_user_pwd) 53 | 54 | typedef struct SRP_VBASE_st { 55 | STACK_OF(SRP_user_pwd) *users_pwd; 56 | STACK_OF(SRP_gN_cache) *gN_cache; 57 | /* to simulate a user */ 58 | char *seed_key; 59 | const BIGNUM *default_g; 60 | const BIGNUM *default_N; 61 | } SRP_VBASE; 62 | 63 | /* 64 | * Internal structure storing N and g pair 65 | */ 66 | typedef struct SRP_gN_st { 67 | char *id; 68 | const BIGNUM *g; 69 | const BIGNUM *N; 70 | } SRP_gN; 71 | 72 | DEFINE_STACK_OF(SRP_gN) 73 | 74 | SRP_VBASE *SRP_VBASE_new(char *seed_key); 75 | void SRP_VBASE_free(SRP_VBASE *vb); 76 | int SRP_VBASE_init(SRP_VBASE *vb, char *verifier_file); 77 | 78 | /* This method ignores the configured seed and fails for an unknown user. */ 79 | DEPRECATEDIN_1_1_0(SRP_user_pwd *SRP_VBASE_get_by_user(SRP_VBASE *vb, char *username)) 80 | /* NOTE: unlike in SRP_VBASE_get_by_user, caller owns the returned pointer.*/ 81 | SRP_user_pwd *SRP_VBASE_get1_by_user(SRP_VBASE *vb, char *username); 82 | 83 | char *SRP_create_verifier(const char *user, const char *pass, char **salt, 84 | char **verifier, const char *N, const char *g); 85 | int SRP_create_verifier_BN(const char *user, const char *pass, BIGNUM **salt, 86 | BIGNUM **verifier, const BIGNUM *N, 87 | const BIGNUM *g); 88 | 89 | # define SRP_NO_ERROR 0 90 | # define SRP_ERR_VBASE_INCOMPLETE_FILE 1 91 | # define SRP_ERR_VBASE_BN_LIB 2 92 | # define SRP_ERR_OPEN_FILE 3 93 | # define SRP_ERR_MEMORY 4 94 | 95 | # define DB_srptype 0 96 | # define DB_srpverifier 1 97 | # define DB_srpsalt 2 98 | # define DB_srpid 3 99 | # define DB_srpgN 4 100 | # define DB_srpinfo 5 101 | # undef DB_NUMBER 102 | # define DB_NUMBER 6 103 | 104 | # define DB_SRP_INDEX 'I' 105 | # define DB_SRP_VALID 'V' 106 | # define DB_SRP_REVOKED 'R' 107 | # define DB_SRP_MODIF 'v' 108 | 109 | /* see srp.c */ 110 | char *SRP_check_known_gN_param(const BIGNUM *g, const BIGNUM *N); 111 | SRP_gN *SRP_get_default_gN(const char *id); 112 | 113 | /* server side .... */ 114 | BIGNUM *SRP_Calc_server_key(const BIGNUM *A, const BIGNUM *v, const BIGNUM *u, 115 | const BIGNUM *b, const BIGNUM *N); 116 | BIGNUM *SRP_Calc_B(const BIGNUM *b, const BIGNUM *N, const BIGNUM *g, 117 | const BIGNUM *v); 118 | int SRP_Verify_A_mod_N(const BIGNUM *A, const BIGNUM *N); 119 | BIGNUM *SRP_Calc_u(const BIGNUM *A, const BIGNUM *B, const BIGNUM *N); 120 | 121 | /* client side .... */ 122 | BIGNUM *SRP_Calc_x(const BIGNUM *s, const char *user, const char *pass); 123 | BIGNUM *SRP_Calc_A(const BIGNUM *a, const BIGNUM *N, const BIGNUM *g); 124 | BIGNUM *SRP_Calc_client_key(const BIGNUM *N, const BIGNUM *B, const BIGNUM *g, 125 | const BIGNUM *x, const BIGNUM *a, const BIGNUM *u); 126 | int SRP_Verify_B_mod_N(const BIGNUM *B, const BIGNUM *N); 127 | 128 | # define SRP_MINIMAL_N 1024 129 | 130 | # ifdef __cplusplus 131 | } 132 | # endif 133 | # endif 134 | 135 | #endif 136 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/openssl/srtp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | /* 11 | * DTLS code by Eric Rescorla 12 | * 13 | * Copyright (C) 2006, Network Resonance, Inc. Copyright (C) 2011, RTFM, Inc. 14 | */ 15 | 16 | #ifndef HEADER_D1_SRTP_H 17 | # define HEADER_D1_SRTP_H 18 | 19 | # include 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | # define SRTP_AES128_CM_SHA1_80 0x0001 26 | # define SRTP_AES128_CM_SHA1_32 0x0002 27 | # define SRTP_AES128_F8_SHA1_80 0x0003 28 | # define SRTP_AES128_F8_SHA1_32 0x0004 29 | # define SRTP_NULL_SHA1_80 0x0005 30 | # define SRTP_NULL_SHA1_32 0x0006 31 | 32 | /* AEAD SRTP protection profiles from RFC 7714 */ 33 | # define SRTP_AEAD_AES_128_GCM 0x0007 34 | # define SRTP_AEAD_AES_256_GCM 0x0008 35 | 36 | # ifndef OPENSSL_NO_SRTP 37 | 38 | __owur int SSL_CTX_set_tlsext_use_srtp(SSL_CTX *ctx, const char *profiles); 39 | __owur int SSL_set_tlsext_use_srtp(SSL *ssl, const char *profiles); 40 | 41 | __owur STACK_OF(SRTP_PROTECTION_PROFILE) *SSL_get_srtp_profiles(SSL *ssl); 42 | __owur SRTP_PROTECTION_PROFILE *SSL_get_selected_srtp_profile(SSL *s); 43 | 44 | # endif 45 | 46 | #ifdef __cplusplus 47 | } 48 | #endif 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/openssl/ssl2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_SSL2_H 11 | # define HEADER_SSL2_H 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | # define SSL2_VERSION 0x0002 18 | 19 | # define SSL2_MT_CLIENT_HELLO 1 20 | 21 | #ifdef __cplusplus 22 | } 23 | #endif 24 | #endif 25 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/openssl/stack.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_STACK_H 11 | # define HEADER_STACK_H 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | typedef struct stack_st OPENSSL_STACK; /* Use STACK_OF(...) instead */ 18 | 19 | typedef int (*OPENSSL_sk_compfunc)(const void *, const void *); 20 | typedef void (*OPENSSL_sk_freefunc)(void *); 21 | typedef void *(*OPENSSL_sk_copyfunc)(const void *); 22 | 23 | int OPENSSL_sk_num(const OPENSSL_STACK *); 24 | void *OPENSSL_sk_value(const OPENSSL_STACK *, int); 25 | 26 | void *OPENSSL_sk_set(OPENSSL_STACK *st, int i, const void *data); 27 | 28 | OPENSSL_STACK *OPENSSL_sk_new(OPENSSL_sk_compfunc cmp); 29 | OPENSSL_STACK *OPENSSL_sk_new_null(void); 30 | OPENSSL_STACK *OPENSSL_sk_new_reserve(OPENSSL_sk_compfunc c, int n); 31 | int OPENSSL_sk_reserve(OPENSSL_STACK *st, int n); 32 | void OPENSSL_sk_free(OPENSSL_STACK *); 33 | void OPENSSL_sk_pop_free(OPENSSL_STACK *st, void (*func) (void *)); 34 | OPENSSL_STACK *OPENSSL_sk_deep_copy(const OPENSSL_STACK *, 35 | OPENSSL_sk_copyfunc c, 36 | OPENSSL_sk_freefunc f); 37 | int OPENSSL_sk_insert(OPENSSL_STACK *sk, const void *data, int where); 38 | void *OPENSSL_sk_delete(OPENSSL_STACK *st, int loc); 39 | void *OPENSSL_sk_delete_ptr(OPENSSL_STACK *st, const void *p); 40 | int OPENSSL_sk_find(OPENSSL_STACK *st, const void *data); 41 | int OPENSSL_sk_find_ex(OPENSSL_STACK *st, const void *data); 42 | int OPENSSL_sk_push(OPENSSL_STACK *st, const void *data); 43 | int OPENSSL_sk_unshift(OPENSSL_STACK *st, const void *data); 44 | void *OPENSSL_sk_shift(OPENSSL_STACK *st); 45 | void *OPENSSL_sk_pop(OPENSSL_STACK *st); 46 | void OPENSSL_sk_zero(OPENSSL_STACK *st); 47 | OPENSSL_sk_compfunc OPENSSL_sk_set_cmp_func(OPENSSL_STACK *sk, 48 | OPENSSL_sk_compfunc cmp); 49 | OPENSSL_STACK *OPENSSL_sk_dup(const OPENSSL_STACK *st); 50 | void OPENSSL_sk_sort(OPENSSL_STACK *st); 51 | int OPENSSL_sk_is_sorted(const OPENSSL_STACK *st); 52 | 53 | # if OPENSSL_API_COMPAT < 0x10100000L 54 | # define _STACK OPENSSL_STACK 55 | # define sk_num OPENSSL_sk_num 56 | # define sk_value OPENSSL_sk_value 57 | # define sk_set OPENSSL_sk_set 58 | # define sk_new OPENSSL_sk_new 59 | # define sk_new_null OPENSSL_sk_new_null 60 | # define sk_free OPENSSL_sk_free 61 | # define sk_pop_free OPENSSL_sk_pop_free 62 | # define sk_deep_copy OPENSSL_sk_deep_copy 63 | # define sk_insert OPENSSL_sk_insert 64 | # define sk_delete OPENSSL_sk_delete 65 | # define sk_delete_ptr OPENSSL_sk_delete_ptr 66 | # define sk_find OPENSSL_sk_find 67 | # define sk_find_ex OPENSSL_sk_find_ex 68 | # define sk_push OPENSSL_sk_push 69 | # define sk_unshift OPENSSL_sk_unshift 70 | # define sk_shift OPENSSL_sk_shift 71 | # define sk_pop OPENSSL_sk_pop 72 | # define sk_zero OPENSSL_sk_zero 73 | # define sk_set_cmp_func OPENSSL_sk_set_cmp_func 74 | # define sk_dup OPENSSL_sk_dup 75 | # define sk_sort OPENSSL_sk_sort 76 | # define sk_is_sorted OPENSSL_sk_is_sorted 77 | # endif 78 | 79 | #ifdef __cplusplus 80 | } 81 | #endif 82 | 83 | #endif 84 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/openssl/symhacks.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_SYMHACKS_H 11 | # define HEADER_SYMHACKS_H 12 | 13 | # include 14 | 15 | /* Case insensitive linking causes problems.... */ 16 | # if defined(OPENSSL_SYS_VMS) 17 | # undef ERR_load_CRYPTO_strings 18 | # define ERR_load_CRYPTO_strings ERR_load_CRYPTOlib_strings 19 | # undef OCSP_crlID_new 20 | # define OCSP_crlID_new OCSP_crlID2_new 21 | 22 | # undef d2i_ECPARAMETERS 23 | # define d2i_ECPARAMETERS d2i_UC_ECPARAMETERS 24 | # undef i2d_ECPARAMETERS 25 | # define i2d_ECPARAMETERS i2d_UC_ECPARAMETERS 26 | # undef d2i_ECPKPARAMETERS 27 | # define d2i_ECPKPARAMETERS d2i_UC_ECPKPARAMETERS 28 | # undef i2d_ECPKPARAMETERS 29 | # define i2d_ECPKPARAMETERS i2d_UC_ECPKPARAMETERS 30 | 31 | /* This one clashes with CMS_data_create */ 32 | # undef cms_Data_create 33 | # define cms_Data_create priv_cms_Data_create 34 | 35 | # endif 36 | 37 | #endif /* ! defined HEADER_VMS_IDHACKS_H */ 38 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/openssl/txt_db.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_TXT_DB_H 11 | # define HEADER_TXT_DB_H 12 | 13 | # include 14 | # include 15 | # include 16 | # include 17 | 18 | # define DB_ERROR_OK 0 19 | # define DB_ERROR_MALLOC 1 20 | # define DB_ERROR_INDEX_CLASH 2 21 | # define DB_ERROR_INDEX_OUT_OF_RANGE 3 22 | # define DB_ERROR_NO_INDEX 4 23 | # define DB_ERROR_INSERT_INDEX_CLASH 5 24 | # define DB_ERROR_WRONG_NUM_FIELDS 6 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | typedef OPENSSL_STRING *OPENSSL_PSTRING; 31 | DEFINE_SPECIAL_STACK_OF(OPENSSL_PSTRING, OPENSSL_STRING) 32 | 33 | typedef struct txt_db_st { 34 | int num_fields; 35 | STACK_OF(OPENSSL_PSTRING) *data; 36 | LHASH_OF(OPENSSL_STRING) **index; 37 | int (**qual) (OPENSSL_STRING *); 38 | long error; 39 | long arg1; 40 | long arg2; 41 | OPENSSL_STRING *arg_row; 42 | } TXT_DB; 43 | 44 | TXT_DB *TXT_DB_read(BIO *in, int num); 45 | long TXT_DB_write(BIO *out, TXT_DB *db); 46 | int TXT_DB_create_index(TXT_DB *db, int field, int (*qual) (OPENSSL_STRING *), 47 | OPENSSL_LH_HASHFUNC hash, OPENSSL_LH_COMPFUNC cmp); 48 | void TXT_DB_free(TXT_DB *db); 49 | OPENSSL_STRING *TXT_DB_get_by_index(TXT_DB *db, int idx, 50 | OPENSSL_STRING *value); 51 | int TXT_DB_insert(TXT_DB *db, OPENSSL_STRING *value); 52 | 53 | #ifdef __cplusplus 54 | } 55 | #endif 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/openssl/uierr.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated by util/mkerr.pl DO NOT EDIT 3 | * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. 4 | * 5 | * Licensed under the OpenSSL license (the "License"). You may not use 6 | * this file except in compliance with the License. You can obtain a copy 7 | * in the file LICENSE in the source distribution or at 8 | * https://www.openssl.org/source/license.html 9 | */ 10 | 11 | #ifndef HEADER_UIERR_H 12 | # define HEADER_UIERR_H 13 | 14 | # ifndef HEADER_SYMHACKS_H 15 | # include 16 | # endif 17 | 18 | # ifdef __cplusplus 19 | extern "C" 20 | # endif 21 | int ERR_load_UI_strings(void); 22 | 23 | /* 24 | * UI function codes. 25 | */ 26 | # define UI_F_CLOSE_CONSOLE 115 27 | # define UI_F_ECHO_CONSOLE 116 28 | # define UI_F_GENERAL_ALLOCATE_BOOLEAN 108 29 | # define UI_F_GENERAL_ALLOCATE_PROMPT 109 30 | # define UI_F_NOECHO_CONSOLE 117 31 | # define UI_F_OPEN_CONSOLE 114 32 | # define UI_F_UI_CONSTRUCT_PROMPT 121 33 | # define UI_F_UI_CREATE_METHOD 112 34 | # define UI_F_UI_CTRL 111 35 | # define UI_F_UI_DUP_ERROR_STRING 101 36 | # define UI_F_UI_DUP_INFO_STRING 102 37 | # define UI_F_UI_DUP_INPUT_BOOLEAN 110 38 | # define UI_F_UI_DUP_INPUT_STRING 103 39 | # define UI_F_UI_DUP_USER_DATA 118 40 | # define UI_F_UI_DUP_VERIFY_STRING 106 41 | # define UI_F_UI_GET0_RESULT 107 42 | # define UI_F_UI_GET_RESULT_LENGTH 119 43 | # define UI_F_UI_NEW_METHOD 104 44 | # define UI_F_UI_PROCESS 113 45 | # define UI_F_UI_SET_RESULT 105 46 | # define UI_F_UI_SET_RESULT_EX 120 47 | 48 | /* 49 | * UI reason codes. 50 | */ 51 | # define UI_R_COMMON_OK_AND_CANCEL_CHARACTERS 104 52 | # define UI_R_INDEX_TOO_LARGE 102 53 | # define UI_R_INDEX_TOO_SMALL 103 54 | # define UI_R_NO_RESULT_BUFFER 105 55 | # define UI_R_PROCESSING_ERROR 107 56 | # define UI_R_RESULT_TOO_LARGE 100 57 | # define UI_R_RESULT_TOO_SMALL 101 58 | # define UI_R_SYSASSIGN_ERROR 109 59 | # define UI_R_SYSDASSGN_ERROR 110 60 | # define UI_R_SYSQIOW_ERROR 111 61 | # define UI_R_UNKNOWN_CONTROL_COMMAND 106 62 | # define UI_R_UNKNOWN_TTYGET_ERRNO_VALUE 108 63 | # define UI_R_USER_DATA_DUPLICATION_UNSUPPORTED 112 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /openssllib/src/main/cpp/openssl/whrlpool.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2005-2016 The OpenSSL Project Authors. All Rights Reserved. 3 | * 4 | * Licensed under the OpenSSL license (the "License"). You may not use 5 | * this file except in compliance with the License. You can obtain a copy 6 | * in the file LICENSE in the source distribution or at 7 | * https://www.openssl.org/source/license.html 8 | */ 9 | 10 | #ifndef HEADER_WHRLPOOL_H 11 | # define HEADER_WHRLPOOL_H 12 | 13 | #include 14 | 15 | # ifndef OPENSSL_NO_WHIRLPOOL 16 | # include 17 | # include 18 | # ifdef __cplusplus 19 | extern "C" { 20 | # endif 21 | 22 | # define WHIRLPOOL_DIGEST_LENGTH (512/8) 23 | # define WHIRLPOOL_BBLOCK 512 24 | # define WHIRLPOOL_COUNTER (256/8) 25 | 26 | typedef struct { 27 | union { 28 | unsigned char c[WHIRLPOOL_DIGEST_LENGTH]; 29 | /* double q is here to ensure 64-bit alignment */ 30 | double q[WHIRLPOOL_DIGEST_LENGTH / sizeof(double)]; 31 | } H; 32 | unsigned char data[WHIRLPOOL_BBLOCK / 8]; 33 | unsigned int bitoff; 34 | size_t bitlen[WHIRLPOOL_COUNTER / sizeof(size_t)]; 35 | } WHIRLPOOL_CTX; 36 | 37 | int WHIRLPOOL_Init(WHIRLPOOL_CTX *c); 38 | int WHIRLPOOL_Update(WHIRLPOOL_CTX *c, const void *inp, size_t bytes); 39 | void WHIRLPOOL_BitUpdate(WHIRLPOOL_CTX *c, const void *inp, size_t bits); 40 | int WHIRLPOOL_Final(unsigned char *md, WHIRLPOOL_CTX *c); 41 | unsigned char *WHIRLPOOL(const void *inp, size_t bytes, unsigned char *md); 42 | 43 | # ifdef __cplusplus 44 | } 45 | # endif 46 | # endif 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /openssllib/src/main/java/cn/dabby/openssllib/Base64Activity.kt: -------------------------------------------------------------------------------- 1 | package cn.dabby.openssllib 2 | 3 | import android.os.Bundle 4 | import android.util.Base64 5 | import android.util.Log 6 | import androidx.appcompat.app.AppCompatActivity 7 | import kotlinx.android.synthetic.main.activity_base_64.* 8 | 9 | /** 10 | *
11 |  *
12 |  *     author : wgc
13 |  *     time   : 2020/06/15
14 |  *     desc   :
15 |  *     version: 1.0
16 |  *
17 |  * 
18 | */ 19 | class Base64Activity : AppCompatActivity() { 20 | 21 | private val cryptographicUtils = CryptographicUtils() 22 | private var jniBase64EncodeString: String? = "" 23 | override fun onCreate(savedInstanceState: Bundle?) { 24 | super.onCreate(savedInstanceState) 25 | setContentView(R.layout.activity_base_64) 26 | 27 | btnEncode.setOnClickListener { 28 | jniBase64EncodeString = cryptographicUtils.base64Encode(etContent.text.toString()) 29 | Log.d("wgc", "jnibase64Encode:$jniBase64EncodeString") 30 | val encodeJava = Base64.encodeToString( 31 | etContent.text.toString().toByteArray(), 32 | Base64.NO_WRAP 33 | ) 34 | Log.d( 35 | "wgc", 36 | "java ${encodeJava}" 37 | ) 38 | Log.d("wgc","${jniBase64EncodeString==encodeJava}") 39 | } 40 | 41 | btnDecode.setOnClickListener { 42 | val base64Decode = cryptographicUtils.base64Decode(jniBase64EncodeString) 43 | Log.d("wgc", "base64Decode:$base64Decode") 44 | val decodeJava = String( 45 | Base64.decode( 46 | jniBase64EncodeString?.toByteArray(), 47 | Base64.NO_WRAP 48 | ) 49 | ) 50 | Log.d( 51 | "wgc", 52 | "java $decodeJava" 53 | ) 54 | Log.d("wgc","${base64Decode==decodeJava}") 55 | } 56 | } 57 | } -------------------------------------------------------------------------------- /openssllib/src/main/java/cn/dabby/openssllib/CryptographicUtils.kt: -------------------------------------------------------------------------------- 1 | package cn.dabby.openssllib 2 | 3 | import android.content.Context 4 | 5 | /** 6 | *
  7 |  *
  8 |  *     author : wgc
  9 |  *     time   : 2020/06/08
 10 |  *     desc   :
 11 |  *     version: 1.0
 12 |  *
 13 |  * 
14 | */ 15 | class CryptographicUtils { 16 | companion object { 17 | init { 18 | System.loadLibrary("crypto_lib") 19 | } 20 | } 21 | 22 | /** 23 | * AES-ECB-128 加密 24 | * @param key 密钥 25 | * @param content 加密内容 26 | * @return 27 | */ 28 | external fun aesEcbEncrypt2ByteArray( 29 | key: ByteArray?, 30 | content: ByteArray? 31 | ): ByteArray? 32 | 33 | /** 34 | * AES-ECB-128 解密 35 | * @param key 密钥 36 | * @param content 待解密内容 37 | * @return 38 | */ 39 | external fun aesEcbDecrypt2ByteArray( 40 | key: ByteArray?, 41 | content: ByteArray? 42 | ): ByteArray? 43 | 44 | 45 | /** 46 | * AES-CBC-128 加密 47 | * @param key 密钥 48 | * @param iv 密钥偏移 49 | * @param content 加密内容 50 | * @return 51 | */ 52 | external fun aesCbcEncrypt2ByteArray( 53 | key: ByteArray?, 54 | iv: ByteArray?, 55 | content: ByteArray? 56 | ): ByteArray? 57 | 58 | /** 59 | * AES-CBC-128 解密 60 | * @param key 密钥 61 | * @param iv 密钥偏移 62 | * @param content 待解密内容 63 | * @return 64 | */ 65 | external fun aesCbcDecrypt2ByteArray( 66 | key: ByteArray?, 67 | iv: ByteArray?, 68 | content: ByteArray? 69 | ): ByteArray? 70 | 71 | 72 | /** 73 | * RSA 公钥加密 74 | * @param key 密钥 75 | * @param content 待加密内容 76 | * @return 77 | */ 78 | external fun rsaPublicKeyEncrypt2ByteArray( 79 | key: String?, 80 | content: ByteArray? 81 | ): ByteArray? 82 | 83 | 84 | /** 85 | * RSA 私钥解密 86 | * @param key 密钥 87 | * @param content 待解密内容 88 | * @return 89 | */ 90 | external fun rsaPrivateKeyDecrypt2ByteArray( 91 | key: String?, 92 | content: ByteArray? 93 | ): ByteArray? 94 | 95 | 96 | /** 97 | * RSA 私钥加密 98 | * @param key 密钥 99 | * @param content 待加密内容 100 | * @return 101 | */ 102 | external fun rsaPrivateKeyEncrypt2ByteArray( 103 | key: String?, 104 | content: ByteArray? 105 | ): ByteArray? 106 | 107 | 108 | /** 109 | * RSA 公钥解密 110 | * @param key 密钥 111 | * @param content 待解密内容 112 | * @return 113 | */ 114 | external fun rsaPublicKeyDecrypt2ByteArray( 115 | key: String?, 116 | content: ByteArray? 117 | ): ByteArray? 118 | 119 | /** 120 | * RSA 私钥签名 121 | * @param key 密钥 122 | * @param content 待签名内容 123 | * @return 124 | */ 125 | external fun rsaPrivateKeySign2ByteArray( 126 | key: String?, 127 | content: ByteArray? 128 | ): ByteArray? 129 | 130 | /** 131 | * RSA 公钥验签 132 | * @param key 密钥 133 | * @param content 待验签内容 134 | * @return 返回0失败 1成功 135 | */ 136 | external fun rsaPublicKeyVerify2Int( 137 | key: String?, 138 | content: ByteArray?, 139 | sign: ByteArray? 140 | ): Int 141 | 142 | /** 143 | * RSA 生成密钥对 144 | */ 145 | external fun generateRSAKey( 146 | 147 | ) 148 | 149 | 150 | external fun md52HexString( 151 | content: ByteArray? 152 | ): String? 153 | 154 | 155 | external fun checkUsePermission( 156 | context: Context 157 | ): Boolean 158 | 159 | /** 160 | * base解码 161 | * @param content String? 162 | * @return String? 163 | */ 164 | external fun base64Decode( 165 | content: String? 166 | ): String? 167 | 168 | /** 169 | * base64编码 170 | * @param content String? 171 | * @return String? 172 | */ 173 | external fun base64Encode( 174 | content: String? 175 | ): String? 176 | 177 | 178 | external fun des3CbcEncrypt2ByteArray( 179 | key: ByteArray?, 180 | iv: ByteArray?, 181 | content: ByteArray? 182 | ): ByteArray? 183 | 184 | external fun des3CbcDecrypt2ByteArray( 185 | key: ByteArray?, 186 | iv: ByteArray?, 187 | content: ByteArray? 188 | ): ByteArray? 189 | 190 | } -------------------------------------------------------------------------------- /openssllib/src/main/java/cn/dabby/openssllib/DESActivity.kt: -------------------------------------------------------------------------------- 1 | package cn.dabby.openssllib 2 | 3 | import android.os.Bundle 4 | import android.util.Log 5 | import androidx.appcompat.app.AppCompatActivity 6 | import cn.dabby.openssllib.utils.Des3Util 7 | import kotlinx.android.synthetic.main.activity_des.* 8 | 9 | /** 10 | *
11 |  *
12 |  *     author : wgc
13 |  *     time   : 2020/06/16
14 |  *     desc   :
15 |  *     version: 1.0
16 |  *
17 |  * 
18 | */ 19 | class DESActivity : AppCompatActivity() { 20 | private val cryptographicUtils = CryptographicUtils() 21 | private val key="d843o01ad843o01ad843o01a" 22 | private val iv="d843o01b" 23 | private var des3EncryptString = "" 24 | override fun onCreate(savedInstanceState: Bundle?) { 25 | super.onCreate(savedInstanceState) 26 | setContentView(R.layout.activity_des) 27 | btn_des3_cbc_encrypt.setOnClickListener { 28 | val des3CbcEncrypt2ByteArray = cryptographicUtils.des3CbcEncrypt2ByteArray( 29 | key.toByteArray(), 30 | iv.toByteArray(), 31 | etContent.text.toString().toByteArray() 32 | ) 33 | des3EncryptString = Des3Util.Base64.encode2String(des3CbcEncrypt2ByteArray) 34 | Log.d("wgc", "jni :$des3EncryptString") 35 | Log.d("wgc", "java :${Des3Util.encode(etContent.text.toString())}") 36 | Log.d( 37 | "wgc", 38 | "${des3EncryptString == Des3Util.encode( 39 | etContent.text.toString() 40 | )}" 41 | ) 42 | } 43 | 44 | btn_des3_cbc_decrypt.setOnClickListener { 45 | val des3CbcDecrypt2ByteArray = cryptographicUtils.des3CbcDecrypt2ByteArray( 46 | key.toByteArray(), 47 | iv.toByteArray(), 48 | Des3Util.Base64.decode2ByteArray(des3EncryptString) 49 | ) 50 | Log.d("wgc","jni des3解密:${String(des3CbcDecrypt2ByteArray!!)}") 51 | } 52 | } 53 | } -------------------------------------------------------------------------------- /openssllib/src/main/java/cn/dabby/openssllib/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package cn.dabby.openssllib 2 | 3 | import android.Manifest 4 | import android.content.Intent 5 | import android.content.pm.PackageInfo 6 | import android.content.pm.PackageManager 7 | import android.os.Build 8 | import android.os.Bundle 9 | import android.util.Log 10 | import androidx.appcompat.app.AppCompatActivity 11 | import androidx.core.content.ContextCompat 12 | import cn.dabby.openssllib.utils.StringTool 13 | import kotlinx.android.synthetic.main.activity_main.* 14 | import java.nio.charset.Charset 15 | import java.nio.charset.StandardCharsets 16 | 17 | /** 18 | *
 19 |  *
 20 |  *     author : wgc
 21 |  *     time   : 2020/06/09
 22 |  *     desc   :
 23 |  *     version: 1.0
 24 |  *
 25 |  * 
26 | */ 27 | @Suppress("DEPRECATED_IDENTITY_EQUALS") 28 | class MainActivity : AppCompatActivity() { 29 | private val permissions = arrayOf( 30 | Manifest.permission.CAMERA, 31 | Manifest.permission.WRITE_EXTERNAL_STORAGE, 32 | Manifest.permission.READ_EXTERNAL_STORAGE, 33 | Manifest.permission.RECORD_AUDIO 34 | ) 35 | 36 | override fun onCreate(savedInstanceState: Bundle?) { 37 | super.onCreate(savedInstanceState) 38 | setContentView(R.layout.activity_main) 39 | 40 | // val byteHexToSting = StringTool.byteHexToSting("encryption standard".toByteArray()) 41 | val byteHexToSting = StringTool.getStringByBytes("encryption standard".toByteArray()) 42 | Log.d("wgc","byteHexToSting $byteHexToSting" ) 43 | btnBase64.setOnClickListener { 44 | startActivity(Intent(this@MainActivity, Base64Activity::class.java)) 45 | } 46 | btnAES.setOnClickListener { 47 | startActivity(Intent(this@MainActivity, AesActivity::class.java)) 48 | } 49 | btnDES.setOnClickListener { 50 | startActivity(Intent(this@MainActivity, DESActivity::class.java)) 51 | } 52 | btnRSA.setOnClickListener { 53 | startActivity(Intent(this@MainActivity, RsaActivity::class.java)) 54 | } 55 | btnH5.setOnClickListener { 56 | startActivity(Intent(this@MainActivity, TestH5AuthActivity::class.java)) 57 | } 58 | 59 | btnTestPermission.setOnClickListener { 60 | for (index in 1 until 50) { 61 | Log.d("wgc", "checkUsePermission$index") 62 | synchronized(MainActivity::class.java) { 63 | val start = System.currentTimeMillis() 64 | val checkUsePermission = 65 | CryptographicUtils().checkUsePermission(this@MainActivity) 66 | Log.d( 67 | "wgc", 68 | "checkUsePermission:${checkUsePermission} 耗时 ${System.currentTimeMillis() - start}" 69 | ) 70 | } 71 | } 72 | 73 | } 74 | 75 | if (!checkPermissions(permissions)) { 76 | if (Build.VERSION.SDK_INT > Build.VERSION_CODES.M) { 77 | requestPermissions(permissions, 2222) 78 | } 79 | } 80 | 81 | var packageInfo: PackageInfo? = null 82 | try { 83 | packageInfo = 84 | packageManager.getPackageInfo(packageName, PackageManager.GET_SIGNATURES) 85 | val signs = packageInfo.signatures 86 | val sign = signs[0] 87 | val hashcode = sign.hashCode() 88 | Log.d("test", "hashCode : $hashcode") 89 | } catch (e: PackageManager.NameNotFoundException) { 90 | e.printStackTrace() 91 | } 92 | } 93 | 94 | 95 | private fun checkPermissions(permissions: Array): Boolean { 96 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { 97 | return true 98 | } 99 | var hasAllPermissions = true 100 | for (permission in permissions) { 101 | hasAllPermissions = ContextCompat.checkSelfPermission( 102 | this, 103 | permission 104 | ) === PackageManager.PERMISSION_GRANTED 105 | if (!hasAllPermissions) { 106 | break 107 | } 108 | } 109 | return hasAllPermissions 110 | } 111 | } -------------------------------------------------------------------------------- /openssllib/src/main/java/cn/dabby/openssllib/OpensslApp.kt: -------------------------------------------------------------------------------- 1 | package cn.dabby.openssllib 2 | 3 | import android.app.Application 4 | 5 | /** 6 | *
 7 |  *
 8 |  *     author : wgc
 9 |  *     time   : 2020/06/12
10 |  *     desc   :
11 |  *     version: 1.0
12 |  *
13 |  * 
14 | */ 15 | class OpensslApp :Application() { 16 | } -------------------------------------------------------------------------------- /openssllib/src/main/java/cn/dabby/openssllib/TTSActivity.kt: -------------------------------------------------------------------------------- 1 | package cn.dabby.openssllib 2 | 3 | import android.content.Context 4 | import android.content.res.AssetManager 5 | import android.os.Bundle 6 | import android.speech.tts.TextToSpeech 7 | import android.speech.tts.UtteranceProgressListener 8 | import android.text.TextUtils 9 | import android.widget.Toast 10 | import androidx.appcompat.app.AppCompatActivity 11 | import kotlinx.android.synthetic.main.activity_tts.* 12 | import java.io.BufferedReader 13 | import java.io.FileNotFoundException 14 | import java.io.IOException 15 | import java.io.InputStreamReader 16 | import java.util.* 17 | 18 | 19 | /** 20 | *
 21 |  *
 22 |  *     author : wgc
 23 |  *     time   : 2020/06/17
 24 |  *     desc   :
 25 |  *     version: 1.0
 26 |  *
 27 |  * 
28 | */ 29 | class TTSActivity : AppCompatActivity(), TextToSpeech.OnInitListener { 30 | private var textToSpeech: TextToSpeech? = null 31 | override fun onCreate(savedInstanceState: Bundle?) { 32 | super.onCreate(savedInstanceState) 33 | setContentView(R.layout.activity_tts) 34 | textToSpeech = TextToSpeech(this, this) // 参数Context,TextToSpeech.OnInitListener 35 | textToSpeech?.setOnUtteranceProgressListener(object:UtteranceProgressListener(){ 36 | override fun onDone(utteranceId: String?) { 37 | TODO("Not yet implemented") 38 | } 39 | 40 | override fun onError(utteranceId: String?) { 41 | TODO("Not yet implemented") 42 | } 43 | 44 | override fun onStart(utteranceId: String?) { 45 | TODO("Not yet implemented") 46 | } 47 | 48 | }) 49 | btnRead.setOnClickListener { 50 | // 设置音调,值越大声音越尖(女生),值越小则变成男声,1.0是常规 51 | textToSpeech?.setPitch(1.0f); 52 | //设定语速 ,默认1.0正常语速 53 | textToSpeech?.setSpeechRate(1.0f); 54 | //朗读,注意这里三个参数的added in API level 4 四个参数的added in API level 21 55 | textToSpeech?.speak("各个国家有各个国家的国歌,肥化肥,会挥发。", TextToSpeech.QUEUE_ADD, null); 56 | 57 | TestThread(assets).start() 58 | } 59 | 60 | } 61 | 62 | 63 | inner class TestThread(val assets: AssetManager) :Thread(){ 64 | override fun run() { 65 | super.run() 66 | var reader: BufferedReader? = null 67 | val inputStream =assets.open("xingchenbian.txt") 68 | var tempString: String? = null 69 | var line = 1 70 | try { 71 | reader = BufferedReader(InputStreamReader(inputStream,"utf-8")); 72 | 73 | do { 74 | tempString = reader.readLine() 75 | if (tempString != null) { 76 | line ++ 77 | if(line>=10000){ 78 | break 79 | } 80 | if(!TextUtils.isEmpty( tempString.trim())) { 81 | System.out.println("Line" + line + ":" + tempString) 82 | textToSpeech?.speak( 83 | tempString, 84 | TextToSpeech.QUEUE_ADD, 85 | null 86 | ) 87 | } 88 | } else { 89 | break 90 | } 91 | } while (true) 92 | 93 | reader.close(); 94 | } catch (e: FileNotFoundException) { 95 | e.printStackTrace(); 96 | } catch (e:IOException ) { 97 | e.printStackTrace(); 98 | }finally{ 99 | if(reader != null){ 100 | try { 101 | reader.close(); 102 | } catch (e: IOException) { 103 | e.printStackTrace(); 104 | } 105 | } 106 | } 107 | } 108 | } 109 | 110 | 111 | override fun onDestroy() { 112 | super.onDestroy() 113 | textToSpeech?.shutdown() 114 | } 115 | 116 | 117 | override fun onInit(status: Int) { 118 | if (status === TextToSpeech.SUCCESS) { 119 | val result: Int = textToSpeech?.setLanguage(Locale.CHINA)!! 120 | if (result == TextToSpeech.LANG_MISSING_DATA 121 | || result == TextToSpeech.LANG_NOT_SUPPORTED 122 | ) { 123 | Toast.makeText(this, "数据丢失或不支持", Toast.LENGTH_SHORT).show() 124 | } 125 | } 126 | } 127 | } -------------------------------------------------------------------------------- /openssllib/src/main/java/cn/dabby/openssllib/TestEntity.kt: -------------------------------------------------------------------------------- 1 | package cn.dabby.openssllib 2 | 3 | /** 4 | *
 5 |  *
 6 |  *     author : wgc
 7 |  *     time   : 2020/06/22
 8 |  *     desc   :
 9 |  *     version: 1.0
10 |  *
11 |  * 
12 | */ 13 | internal data class TestEntity( 14 | val mode: Int 15 | ) -------------------------------------------------------------------------------- /openssllib/src/main/java/cn/dabby/openssllib/TestOther.kt: -------------------------------------------------------------------------------- 1 | package cn.dabby.openssllib 2 | 3 | /** 4 | *
 5 |  *
 6 |  *     author : wgc
 7 |  *     time   : 2020/12/29
 8 |  *     desc   :
 9 |  *     version: 1.0
10 |  *
11 |  * 
12 | */ 13 | class TestOther { 14 | companion object { 15 | init { 16 | System.loadLibrary("testOther") 17 | } 18 | } 19 | external fun d() 20 | } -------------------------------------------------------------------------------- /openssllib/src/main/java/cn/dabby/openssllib/utils/AesEcbUtil.java: -------------------------------------------------------------------------------- 1 | package cn.dabby.openssllib.utils; 2 | 3 | import android.util.Base64; 4 | 5 | import java.nio.charset.StandardCharsets; 6 | 7 | import javax.crypto.Cipher; 8 | import javax.crypto.spec.SecretKeySpec; 9 | 10 | /** 11 | * @Description: AES-128-ECB加解密 12 | * @Author hzj 13 | * @Date:Created in 10:18 2019/10/15 14 | * @Version: 15 | */ 16 | public class AesEcbUtil { 17 | /** 18 | * 加密 19 | * 20 | * @param password 加密密码 21 | * @param content 需要加密的内容 22 | * @return 加密字符串 23 | */ 24 | public static String encrypt(String password, String content) throws Exception { 25 | SecretKeySpec skeySpec = new SecretKeySpec(password.getBytes(), "AES"); 26 | //"算法/模式/补码方式" 27 | Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding"); 28 | cipher.init(Cipher.ENCRYPT_MODE, skeySpec); 29 | byte[] result = cipher.doFinal(content.getBytes(StandardCharsets.UTF_8)); 30 | return Base64.encodeToString(result, Base64.NO_WRAP); 31 | } 32 | 33 | /** 34 | * 解密 35 | * 36 | * @param password 解密密钥 37 | * @param content 待解密内容 38 | * @return 解密内容 39 | */ 40 | public static String decrypt(String password, String content) throws Exception { 41 | if (content == null) { 42 | return null; 43 | } 44 | 45 | SecretKeySpec skeySpec = new SecretKeySpec(password.getBytes(), "AES"); 46 | Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding"); 47 | cipher.init(Cipher.DECRYPT_MODE, skeySpec); 48 | byte[] result = cipher.doFinal(Base64.decode(content, Base64.NO_WRAP)); 49 | return new String(result, StandardCharsets.UTF_8); 50 | } 51 | } -------------------------------------------------------------------------------- /openssllib/src/main/java/cn/dabby/openssllib/utils/StringTool.java: -------------------------------------------------------------------------------- 1 | package cn.dabby.openssllib.utils; 2 | 3 | /** 4 | * Created by lochy on 15/5/12. 5 | */ 6 | public class StringTool { 7 | public static String byteHexToSting(byte[] data) { 8 | if (data == null) { 9 | return null; 10 | } 11 | StringBuilder stringBuffer = new StringBuilder(); 12 | for (int aR_data : data) { 13 | // stringBuffer.append(Integer.toHexString(aR_data & 0x00ff)); 14 | stringBuffer.append(String.format("%02x", aR_data & 0x00ff)); 15 | } 16 | return stringBuffer.toString(); 17 | } 18 | 19 | /** 20 | * byte[]转变为16进制String字符, 每个字节2位, 不足补0 21 | */ 22 | public static String getStringByBytes(byte[] bytes) { 23 | if (bytes == null) { 24 | return null; 25 | } 26 | String result = null; 27 | String hex = null; 28 | if (bytes != null && bytes.length > 0) { 29 | final StringBuilder stringBuilder = new StringBuilder(bytes.length); 30 | for (byte byteChar : bytes) { 31 | hex = Integer.toHexString(byteChar & 0xFF); 32 | if (hex.length() == 1) { 33 | hex = '0' + hex; 34 | } 35 | stringBuilder.append(hex.toUpperCase()); 36 | } 37 | result = stringBuilder.toString(); 38 | } 39 | return result; 40 | } 41 | 42 | public static byte[] hexStringToBytes(String hexString) { 43 | if (hexString == null || hexString.equals("")) { 44 | return null; 45 | } 46 | hexString = hexString.toUpperCase(); 47 | int length = hexString.length() / 2; 48 | char[] hexChars = hexString.toCharArray(); 49 | byte[] d = new byte[length]; 50 | for (int i = 0; i < length; i++) { 51 | int pos = i * 2; 52 | d[i] = (byte) (charToByte(hexChars[pos]) << 4 | charToByte(hexChars[pos + 1])); 53 | } 54 | return d; 55 | } 56 | 57 | public static byte[] urlStringToBytes(String urlString) { 58 | StringBuilder stringBuilder = new StringBuilder(); 59 | for (int i = 0; i < urlString.length(); ) { 60 | if (urlString.charAt(i) == '%') { 61 | if ((i + 2) < urlString.length()) { 62 | stringBuilder.append(urlString.substring(i + 1, i + 3)); 63 | } 64 | i += 3; 65 | } else { 66 | stringBuilder.append(String.format("%02x", urlString.charAt(i) & 0xff)); 67 | i++; 68 | } 69 | } 70 | 71 | return hexStringToBytes(stringBuilder.toString()); 72 | } 73 | 74 | private static byte charToByte(char c) { 75 | return (byte) "0123456789ABCDEFabcdef".indexOf(c); 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /openssllib/src/main/java/cn/dabby/openssllib/utils/TestPrintln.java: -------------------------------------------------------------------------------- 1 | package cn.dabby.openssllib.utils; 2 | 3 | /** 4 | *
 5 |  *
 6 |  *     author : wgc
 7 |  *     time   : 2021/05/06
 8 |  *     desc   :
 9 |  *     version: 1.0
10 |  *
11 |  * 
12 | */ 13 | public class TestPrintln { 14 | public static void p(String content) { 15 | int length = content.length(); 16 | int offset = length / 2048; 17 | if (length % 2048 != 0) { 18 | offset += 1; 19 | } 20 | System.out.println("字符长度:" + length); 21 | int temp = 0; 22 | for (int i = 0; i < offset; i++) { 23 | 24 | if (i == offset - 1) { 25 | System.out.println(content.substring(temp, length)); 26 | } else { 27 | System.out.println(content.substring(temp, (i + 1) * 2048)); 28 | } 29 | 30 | temp = (i + 1) * 2048; 31 | 32 | } 33 | 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /openssllib/src/main/java/cn/dabby/openssllib/utils/UtilTool.java: -------------------------------------------------------------------------------- 1 | package cn.dabby.openssllib.utils; 2 | 3 | import java.util.Random; 4 | 5 | public class UtilTool { 6 | public static byte[] mergeByte(byte[] source, byte[] s, int begin, int end) { 7 | byte[] bytes = new byte[source.length + end - begin]; 8 | System.arraycopy(source, 0, bytes, 0, source.length); 9 | System.arraycopy(s, begin, bytes, source.length, end); 10 | 11 | return bytes; 12 | } 13 | 14 | public static byte[] shortToByte(short number) { 15 | int temp = number; 16 | byte[] b = new byte[2]; 17 | b[0] = (byte) (temp & 0xff); 18 | temp = temp >> 8; 19 | b[1] = (byte) (temp & 0xff); 20 | 21 | return b; 22 | } 23 | 24 | public static short byteToShort(byte[] b) { 25 | short s = 0; 26 | short s0 = (short) (b[0] & 0xff); 27 | short s1 = (short) (b[1] & 0xff); 28 | 29 | s1 <<= 8; 30 | s = (short) (s0 | s1); 31 | 32 | return s; 33 | } 34 | 35 | // 随机生成16位字符串 36 | public static String getRandomStr(int len) { 37 | String base = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; 38 | Random random = new Random(); 39 | StringBuffer sb = new StringBuffer(); 40 | for (int i = 0; i < len; i++) { 41 | int number = random.nextInt(base.length()); 42 | sb.append(base.charAt(number)); 43 | } 44 | return sb.toString(); 45 | } 46 | 47 | //异或和校验 48 | public static byte bcc_check(byte[] bytes) { 49 | byte bcc_sum = 0; 50 | for ( byte theByte : bytes ) { 51 | bcc_sum ^= theByte; 52 | } 53 | 54 | return bcc_sum; 55 | } 56 | 57 | //System.arraycopy()方法 58 | public static byte[] byteMergerAddShort(int len, byte[] cmd) { 59 | byte[] bytes = new byte[2]; 60 | bytes[0] = (byte) (len & 0xff); 61 | bytes[1] = (byte) ((len & 0xff00) >> 8); 62 | byte[] data = byteMerger(bytes, cmd); 63 | return data; 64 | } 65 | 66 | //System.arraycopy()方法 67 | public static byte[] byteMerger(byte[] bt1, byte[] bt2) { 68 | byte[] bt3 = new byte[bt1.length + bt2.length]; 69 | System.arraycopy(bt1, 0, bt3, 0, bt1.length); 70 | System.arraycopy(bt2, 0, bt3, bt1.length, bt2.length); 71 | return bt3; 72 | } 73 | 74 | public static int byteToInt(byte[] b) { 75 | int intValue = 0; 76 | for (int i = 0; i < b.length; i++) { 77 | intValue += (b[i] & 0xFF) << (8 * (3 - i)); 78 | } 79 | return intValue; 80 | } 81 | 82 | public static String bytes2HexString(byte[] b) { 83 | StringBuffer result = new StringBuffer(); 84 | String hex; 85 | for (int i = 0; i < b.length; i++) { 86 | hex = Integer.toHexString(b[i] & 0xFF); 87 | if (hex.length() == 1) { 88 | hex = '0' + hex; 89 | } 90 | result.append(hex.toUpperCase()); 91 | } 92 | return result.toString(); 93 | } 94 | 95 | public static String byteHexToSting(byte[] data) { 96 | if (data == null) { 97 | return null; 98 | } 99 | StringBuilder stringBuffer = new StringBuilder(); 100 | for (int aR_data : data) { 101 | // stringBuffer.append(Integer.toHexString(aR_data & 0x00ff)); 102 | stringBuffer.append(String.format("%02x", aR_data & 0x00ff)); 103 | } 104 | return stringBuffer.toString(); 105 | } 106 | 107 | public static byte[] hexStringToBytes(String hexString) { 108 | if (hexString == null || hexString.equals("")) { 109 | return null; 110 | } 111 | hexString = hexString.toUpperCase(); 112 | int length = hexString.length() / 2; 113 | char[] hexChars = hexString.toCharArray(); 114 | byte[] d = new byte[length]; 115 | for (int i = 0; i < length; i++) { 116 | int pos = i * 2; 117 | d[i] = (byte) (charToByte(hexChars[pos]) << 4 | charToByte(hexChars[pos + 1])); 118 | } 119 | return d; 120 | } 121 | 122 | public static byte charToByte(char c) { 123 | return (byte) "0123456789ABCDEFabcdef".indexOf(c); 124 | } 125 | } 126 | 127 | 128 | 129 | 130 | 131 | 132 | -------------------------------------------------------------------------------- /openssllib/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 15 | 18 | 21 | 22 | 23 | 24 | 30 | -------------------------------------------------------------------------------- /openssllib/src/main/res/layout/activity_base_64.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 16 | 17 | 18 |