Skip to content

Commit

Permalink
add ysp
Browse files Browse the repository at this point in the history
  • Loading branch information
lizongying committed Dec 15, 2023
1 parent a340ab7 commit 20cf300
Show file tree
Hide file tree
Showing 184 changed files with 77,475 additions and 162 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@
.externalNativeBuild
.cxx
local.properties
/path/
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Sets the minimum version of CMake required to build your native library.
# This ensures that a certain set of CMake features is available to
# your build.

cmake_minimum_required(VERSION 3.21.1)

add_subdirectory(app)
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.PHONY: all

all: info

branch := $(shell git rev-parse --abbrev-ref HEAD)
commit := $(shell git rev-parse --short HEAD)

info:
@echo 'SHELL='$(SHELL)
@echo 'branch='$(branch)
@echo 'commit='$(commit)
6 changes: 5 additions & 1 deletion app/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
/build
/release
/release
/cmake_install.cmake
/CMakeFiles/
/Makefile
/src/main/cpp/native-lib.c
100 changes: 100 additions & 0 deletions app/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# Sets the minimum version of CMake required to build your native library.
# This ensures that a certain set of CMake features is available to
# your build.
cmake_minimum_required(VERSION 3.21.1)

project(MyTV)

# Specifies a path to native header files.
include_directories(src/main/cpp/include)

if (IS_SO_BUILD)
# Specifies a library name, specifies whether the library is STATIC or
# SHARED, and provides relative paths to the source code. You can
# define multiple libraries by adding multiple add_library() commands,
# and CMake builds them for you. When you build your app, Gradle
# automatically packages shared libraries with your APK.
add_library( # Specifies the name of the library.
native-lib

# Sets the library as a shared library.
SHARED

# Provides a relative path to your source file(s).
src/main/cpp/native-lib.c)

# 设置编译输出路径
set_target_properties(
native-lib
PROPERTIES
LIBRARY_OUTPUT_DIRECTORY
${CMAKE_SOURCE_DIR}/src/main/cpp/${ANDROID_ABI}
)
else ()
add_library(
nothing
SHARED
src/main/cpp/nothing.c)

add_library(native-lib
SHARED
IMPORTED)

set_target_properties( # Specifies the target library.
native-lib

# Specifies the parameter you want to define.
PROPERTIES IMPORTED_LOCATION

# Provides the path to the library you want to import.
${CMAKE_SOURCE_DIR}/src/main/cpp/${ANDROID_ABI}/libnative-lib.so)
endif ()

add_library(libssl
SHARED
IMPORTED)

set_target_properties( # Specifies the target library.
libssl

# Specifies the parameter you want to define.
PROPERTIES IMPORTED_LOCATION

# Provides the path to the library you want to import.
${CMAKE_SOURCE_DIR}/src/main/cpp/${ANDROID_ABI}/libssl.so)

add_library(libcrypto
SHARED
IMPORTED)

set_target_properties( # Specifies the target library.
libcrypto

# Specifies the parameter you want to define.
PROPERTIES IMPORTED_LOCATION

# Provides the path to the library you want to import.
${CMAKE_SOURCE_DIR}/src/main/cpp/${ANDROID_ABI}/libcrypto.so)

find_library( # Defines the name of the path variable that stores the
# location of the NDK library.
log-lib

# Specifies the name of the NDK library that
# CMake needs to locate.
log)

if (IS_SO_BUILD)
# Links your native library against one or more other native libraries.
target_link_libraries( # Specifies the target library.
native-lib
libssl
libcrypto

# Links the log library to the target library.
${log-lib})
else ()
target_link_libraries( # Specifies the target library.
nothing
native-lib)
endif ()
44 changes: 43 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,38 @@ android {
namespace 'com.lizongying.mytv'
compileSdk 33

viewBinding {
enabled = true
}

defaultConfig {
applicationId "com.lizongying.mytv"
minSdk 23
minSdk 21
targetSdk 33
versionCode VersionCode()
versionName VersionName()

// This block is different from the one you use to link Gradle
// to your CMake or ndk-build script.
externalNativeBuild {

// For ndk-build, instead use the ndkBuild block.
cmake {
// arguments "-DIS_SO_BUILD=${project.hasProperty('IS_SO_BUILD') ? project.IS_SO_BUILD : false}"
arguments "-DIS_SO_BUILD=${false}"

abiFilters "armeabi-v7a", "arm64-v8a"
}
}

// Similar to other properties in the defaultConfig block,
// you can configure the ndk block for each product flavor
// in your build configuration.
ndk {
// Specifies the ABI configurations of your native
// libraries Gradle should build and package with your app.
abiFilters "armeabi-v7a", "arm64-v8a"
}
}

buildTypes {
Expand All @@ -30,6 +56,17 @@ android {
kotlinOptions {
jvmTarget=17
}

// Encapsulates your external native build configurations.
externalNativeBuild {

// Encapsulates your CMake build configurations.
cmake {

// Provides a relative path to your CMake build script.
path = file("CMakeLists.txt")
}
}
}

static def VersionCode() {
Expand All @@ -53,6 +90,11 @@ static def VersionName() {
}

dependencies {
implementation 'com.google.protobuf:protobuf-kotlin:3.25.1'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation 'com.squareup.retrofit2:converter-protobuf:2.9.0'
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.2"
implementation 'androidx.core:core-ktx:1.11.0-beta02'
implementation 'androidx.leanback:leanback:1.0.0'
implementation 'com.github.bumptech.glide:glide:4.11.0'
Expand Down
Binary file added app/src/main/cpp/arm64-v8a/libcrypto.so
Binary file not shown.
Binary file added app/src/main/cpp/arm64-v8a/libnative-lib.so
Binary file not shown.
Binary file added app/src/main/cpp/arm64-v8a/libnative.so
Binary file not shown.
Binary file added app/src/main/cpp/arm64-v8a/libssl.so
Binary file not shown.
Binary file added app/src/main/cpp/armeabi-v7a/libcrypto.so
Binary file not shown.
Binary file added app/src/main/cpp/armeabi-v7a/libnative-lib.so
Binary file not shown.
Binary file added app/src/main/cpp/armeabi-v7a/libnative.so
Binary file not shown.
Binary file added app/src/main/cpp/armeabi-v7a/libssl.so
Binary file not shown.
111 changes: 111 additions & 0 deletions app/src/main/cpp/include/openssl/aes.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
/*
* Copyright 2002-2020 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
* in the file LICENSE in the source distribution or at
* https://www.openssl.org/source/license.html
*/

#ifndef OPENSSL_AES_H
# define OPENSSL_AES_H
# pragma once

# include <openssl/macros.h>
# ifndef OPENSSL_NO_DEPRECATED_3_0
# define HEADER_AES_H
# endif

# include <openssl/opensslconf.h>

# include <stddef.h>
# ifdef __cplusplus
extern "C" {
# endif

# define AES_BLOCK_SIZE 16

# ifndef OPENSSL_NO_DEPRECATED_3_0

# define AES_ENCRYPT 1
# define AES_DECRYPT 0

# define AES_MAXNR 14


/* This should be a hidden type, but EVP requires that the size be known */
struct aes_key_st {
# ifdef AES_LONG
unsigned long rd_key[4 * (AES_MAXNR + 1)];
# else
unsigned int rd_key[4 * (AES_MAXNR + 1)];
# endif
int rounds;
};
typedef struct aes_key_st AES_KEY;

# endif
# ifndef OPENSSL_NO_DEPRECATED_3_0
OSSL_DEPRECATEDIN_3_0 const char *AES_options(void);
OSSL_DEPRECATEDIN_3_0
int AES_set_encrypt_key(const unsigned char *userKey, const int bits,
AES_KEY *key);
OSSL_DEPRECATEDIN_3_0
int AES_set_decrypt_key(const unsigned char *userKey, const int bits,
AES_KEY *key);
OSSL_DEPRECATEDIN_3_0
void AES_encrypt(const unsigned char *in, unsigned char *out,
const AES_KEY *key);
OSSL_DEPRECATEDIN_3_0
void AES_decrypt(const unsigned char *in, unsigned char *out,
const AES_KEY *key);
OSSL_DEPRECATEDIN_3_0
void AES_ecb_encrypt(const unsigned char *in, unsigned char *out,
const AES_KEY *key, const int enc);
OSSL_DEPRECATEDIN_3_0
void AES_cbc_encrypt(const unsigned char *in, unsigned char *out,
size_t length, const AES_KEY *key,
unsigned char *ivec, const int enc);
OSSL_DEPRECATEDIN_3_0
void AES_cfb128_encrypt(const unsigned char *in, unsigned char *out,
size_t length, const AES_KEY *key,
unsigned char *ivec, int *num, const int enc);
OSSL_DEPRECATEDIN_3_0
void AES_cfb1_encrypt(const unsigned char *in, unsigned char *out,
size_t length, const AES_KEY *key,
unsigned char *ivec, int *num, const int enc);
OSSL_DEPRECATEDIN_3_0
void AES_cfb8_encrypt(const unsigned char *in, unsigned char *out,
size_t length, const AES_KEY *key,
unsigned char *ivec, int *num, const int enc);
OSSL_DEPRECATEDIN_3_0
void AES_ofb128_encrypt(const unsigned char *in, unsigned char *out,
size_t length, const AES_KEY *key,
unsigned char *ivec, int *num);

/* NB: the IV is _two_ blocks long */
OSSL_DEPRECATEDIN_3_0
void AES_ige_encrypt(const unsigned char *in, unsigned char *out,
size_t length, const AES_KEY *key,
unsigned char *ivec, const int enc);
/* NB: the IV is _four_ blocks long */
OSSL_DEPRECATEDIN_3_0
void AES_bi_ige_encrypt(const unsigned char *in, unsigned char *out,
size_t length, const AES_KEY *key, const AES_KEY *key2,
const unsigned char *ivec, const int enc);
OSSL_DEPRECATEDIN_3_0
int AES_wrap_key(AES_KEY *key, const unsigned char *iv,
unsigned char *out, const unsigned char *in,
unsigned int inlen);
OSSL_DEPRECATEDIN_3_0
int AES_unwrap_key(AES_KEY *key, const unsigned char *iv,
unsigned char *out, const unsigned char *in,
unsigned int inlen);
# endif


# ifdef __cplusplus
}
# endif

#endif
Loading

0 comments on commit 20cf300

Please sign in to comment.