mirror of
https://github.com/estkme-group/lpac
synced 2025-06-29 16:22:57 +02:00
Compare commits
180 commits
Author | SHA1 | Date | |
---|---|---|---|
|
187c42dfde | ||
|
35d54c5904 | ||
|
e45395f527 | ||
c979f67348 | |||
|
f180f7ef7d | ||
|
4d6ca410fa | ||
93ddaf4ae8 | |||
|
5e5e3f2e8a | ||
|
a6c5365455 | ||
|
eeae8d1a87 | ||
|
84ba3962d7 | ||
|
f9263ad734 | ||
|
15b7572fbc | ||
|
208c80ef29 | ||
|
f7abb97e59 | ||
|
b599e5ab9f | ||
|
182e2e4e03 | ||
|
8f43334888 | ||
901bff8c6c | |||
24b7078a56 | |||
37ec17eeab | |||
7290736c73 | |||
26bde74517 | |||
9760a16b63 | |||
e5297f304d | |||
ae3a87803c | |||
3423b0939c | |||
1d18766142 | |||
90f7104847 | |||
|
3d173b94b2 | ||
|
0b81e8ab14 | ||
|
62eb766d14 | ||
|
b21406da8c | ||
da3d2a8e7a | |||
|
0fa28bb172 | ||
|
79034c665e | ||
|
1f947173eb | ||
|
5987dfa815 | ||
|
63f29b4c9f | ||
|
8d92e5a853 | ||
a5a0516f08 | |||
|
0dcc94905e | ||
|
9e0612b68d | ||
|
1304ca107e | ||
|
0499a3a977 | ||
|
fd58ad7dc2 | ||
|
319f55fe70 | ||
|
da1cf1a555 | ||
|
cee7190751 | ||
|
b11878fd0a | ||
|
e6b32e106c | ||
|
302984f7d5 | ||
|
56352c51c8 | ||
|
19df5532f6 | ||
|
c86edd5998 | ||
|
3bde4a1d3d | ||
|
0011ea6cc4 | ||
d508b28beb | |||
f5956dd6d5 | |||
|
dace6558b8 | ||
|
2cc0ba0e92 | ||
6e295dbeaf | |||
|
b6362be60e | ||
|
f43c70c293 | ||
|
c7a2f5d6c3 | ||
|
979ccc8e8f | ||
75cbfa16ce | |||
09756a834b | |||
|
e7445eea41 | ||
8294307f8f | |||
|
176cca4b6b | ||
|
380b91325c | ||
|
9690320fea | ||
|
d41c2f8446 | ||
|
49bf6a5df5 | ||
|
66c45959c3 | ||
|
25506d5d64 | ||
|
c3758fca7f | ||
|
c4ce98c527 | ||
|
14e07fa9b4 | ||
|
1e299ef51e | ||
|
57e5e31ce9 | ||
06cbc3778c | |||
f521c455dc | |||
|
e19e5ee3f9 | ||
db5dc14fb6 | |||
|
c8c3c4fdb7 | ||
08ba0c280e | |||
4cbadb5d5d | |||
|
c632f86b22 | ||
|
2eb3e45e0b | ||
3a32229c1c | |||
baee77210f | |||
|
5b98993af4 | ||
|
8ca9e1d3de | ||
|
c52258d6be | ||
2c805916dc | |||
|
6e468944cf | ||
ee4b208186 | |||
|
e3bae10048 | ||
|
d85537a909 | ||
603883b794 | |||
ac1d343006 | |||
faef813b17 | |||
|
c33781300b | ||
c90607b225 | |||
|
459bb15a99 | ||
|
0bb196977e | ||
edeb2be8bb | |||
|
94be1bc039 | ||
|
b8fedaa6e7 | ||
|
7c59a102c5 | ||
|
ce179ea485 | ||
|
5912d2d43a | ||
|
2e51c42080 | ||
|
c1370bd3fc | ||
|
596e78be71 | ||
41697ab8f6 | |||
|
7a9ebecfb0 | ||
|
96f47f2d52 | ||
|
76d771f56c | ||
4095ab5a15 | |||
780d7920cd | |||
43291498ba | |||
4f725f9540 | |||
77ca2683da | |||
695b72f183 | |||
3a879e86a5 | |||
4fcd691d10 | |||
|
814d7e1766 | ||
|
d2bb1f5eff | ||
|
707bd3a1e0 | ||
|
ea84ded680 | ||
|
dc09c3e668 | ||
|
f7fc947048 | ||
|
5fc860b85d | ||
|
5708da488d | ||
|
2c1950704f | ||
|
346a26935f | ||
|
8029d28294 | ||
5fb3360ca0 | |||
|
5a7fcc3c2f | ||
|
ae4cc35dac | ||
|
7fec42ce80 | ||
|
d7dc73c5da | ||
|
c798995d6d | ||
|
dfac5a477c | ||
|
921390dce5 | ||
|
abdf1e9bbf | ||
|
47f44f9110 | ||
|
d06a2a0e1f | ||
|
820aca8dc3 | ||
|
15f9d6013c | ||
|
736751bf8e | ||
|
52e4ab6b99 | ||
|
14441b14be | ||
|
7e47d21ebb | ||
|
e3a05fba53 | ||
|
9829bbb79a | ||
|
17c3bf3955 | ||
|
7e79cd30bb | ||
|
6c92f9cf76 | ||
|
7131ade3ce | ||
|
dc2128b30e | ||
|
99760b5844 | ||
|
3f5a7ebb13 | ||
|
218a9d2186 | ||
|
ef9f34baee | ||
|
56707800cc | ||
|
1cce9d5d91 | ||
|
f9b5baac03 | ||
|
1ad2b5d6e4 | ||
|
9270e9f9d0 | ||
|
6792baa978 | ||
|
8f3fa04211 | ||
|
653eeb253f | ||
|
c918053916 | ||
|
04bd397ea4 | ||
|
086e8fb029 | ||
|
aa80656212 |
762 changed files with 8751 additions and 65932 deletions
12
.editorconfig
Normal file
12
.editorconfig
Normal file
|
@ -0,0 +1,12 @@
|
|||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
indent_size = 4
|
||||
indent_style = space
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.md]
|
||||
indent_size = 2
|
125
.github/workflows/build.yaml
vendored
125
.github/workflows/build.yaml
vendored
|
@ -1,84 +1,77 @@
|
|||
name: Release
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "v*"
|
||||
workflow_dispatch:
|
||||
name: Build
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: [main]
|
||||
tags: [v*]
|
||||
pull_request:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build for ${{ matrix.build.name }}
|
||||
runs-on: ${{ matrix.build.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [windows-latest, ubuntu-latest, macos-14]
|
||||
build:
|
||||
- {os: ubuntu-24.04, variant: make, name: Linux, artifact: linux-x64}
|
||||
- {os: ubuntu-24.04-arm, variant: make, name: Linux ARM, artifact: linux-arm}
|
||||
- {os: ubuntu-24.04, variant: make-without-lto, name: Linux (w/o LTO), artifact: linux-x64-without-lto}
|
||||
- {os: ubuntu-24.04-arm, variant: make-without-lto, name: Linux ARM (w/o LTO), artifact: linux-arm-without-lto}
|
||||
- {os: ubuntu-24.04, variant: debian, name: Debian, artifact: debian-x64}
|
||||
- {os: ubuntu-24.04-arm, variant: debian, name: Debian ARM, artifact: debian-arm}
|
||||
- {os: ubuntu-24.04, variant: mingw, name: Windows with MinGW, artifact: windows-x64}
|
||||
- {os: ubuntu-24.04, variant: woa-mingw, name: Windows on ARM with MinGW, artifact: windows-arm64}
|
||||
- {os: macos-15, variant: make, name: macOS, artifact: macos-universal}
|
||||
- {os: macos-15, variant: make-without-lto, name: macOS (w/o LTO), artifact: macos-universal-without-lto}
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup toolchain
|
||||
- name: Setup Toolchain
|
||||
run: sudo ./scripts/setup-debian.sh ${{ matrix.build.variant }}
|
||||
if: runner.os == 'Linux'
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y libpcsclite-dev libcurl4-openssl-dev gcc make cmake gcc-mingw-w64 g++-mingw-w64 unzip
|
||||
|
||||
- name: Setup toolchain for Windows(Cygwin)
|
||||
if: runner.os == 'Windows'
|
||||
uses: egor-tensin/setup-cygwin@v4
|
||||
with:
|
||||
packages: cmake gcc-g++ make zip wget
|
||||
- name: Build for ${{ matrix.build.name }}
|
||||
run: ./scripts/build-ci.sh ${{ matrix.build.variant }}
|
||||
|
||||
- name: Build for Windows(Cygwin)
|
||||
if: runner.os == 'Windows'
|
||||
run: |
|
||||
mkdir build-cygwin && cd build-cygwin && cmake -DCYGWIN=ON .. && make
|
||||
wget https://curl.se/windows/dl-8.5.0_3/curl-8.5.0_3-win64-mingw.zip -O curl.zip && unzip curl.zip && mv curl-8.5.0_3-win64-mingw/bin/libcurl-x64.dll output/libcurl.dll
|
||||
cp C:\tools\cygwin\bin\cygwin1.dll output
|
||||
zip -r -j lpac-windows-x86_64-cygwin.zip output/*
|
||||
- name: Get short SHA
|
||||
run: echo "SHA7=$(echo ${GITHUB_SHA} | cut -c1-7)" >> $GITHUB_ENV
|
||||
|
||||
- name: Build for Linux
|
||||
if: runner.os == 'Linux'
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir build && cd build && cmake .. && make -j$(nproc)
|
||||
chmod +x output/lpac
|
||||
zip -r -j lpac-linux-x86_64.zip output/*
|
||||
|
||||
- name: Build for Windows(MinGW)
|
||||
if: runner.os == 'Linux'
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir build-mingw && cd build-mingw && cmake -DLINUX_MINGW32=ON .. && make -j$(nproc)
|
||||
wget https://curl.se/windows/dl-8.5.0_3/curl-8.5.0_3-win64-mingw.zip -O curl.zip && unzip curl.zip && mv curl-8.5.0_3-win64-mingw/bin/libcurl-x64.dll output/libcurl.dll
|
||||
zip -r -j lpac-windows-x86_64-mingw.zip output/*
|
||||
|
||||
- name: Build for macOS
|
||||
if: runner.os == 'macOS'
|
||||
run: |
|
||||
mkdir build && cd build && cmake .. && make -j$(sysctl -n hw.ncpu)
|
||||
chmod +x output/lpac
|
||||
zip -r -j lpac-macos-universal.zip output/*
|
||||
shell: bash
|
||||
|
||||
- name: Upload Artifact
|
||||
- name: Upload ${{ matrix.build.name }} to Artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: artifact-${{ matrix.os }}
|
||||
path: |
|
||||
build-mingw/lpac-windows-x86_64-mingw.zip
|
||||
build-cygwin/lpac-windows-x86_64-cygwin.zip
|
||||
build/lpac-linux-x86_64.zip
|
||||
build/lpac-macos-universal.zip
|
||||
name: lpac-${{ env.SHA7 }}-${{ matrix.build.artifact }}
|
||||
path: ${{ github.workspace }}/build/*.*
|
||||
|
||||
- name: Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
release:
|
||||
name: Release
|
||||
runs-on: ubuntu-24.04
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
needs: build
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- name: Download Artifact
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
files: |
|
||||
build-mingw/lpac-windows-x86_64-mingw.zip
|
||||
build-cygwin/lpac-windows-x86_64-cygwin.zip
|
||||
build/lpac-linux-x86_64.zip
|
||||
build/lpac-macos-universal.zip
|
||||
merge-multiple: true
|
||||
pattern: '*'
|
||||
- name: Run SHA1SUM
|
||||
id: checksum
|
||||
run: |
|
||||
echo 'sha1sum<<EOF' >> $GITHUB_OUTPUT
|
||||
sha1sum * >> $GITHUB_OUTPUT
|
||||
echo 'EOF' >> $GITHUB_OUTPUT
|
||||
- name: Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
body: |
|
||||
```plain
|
||||
${{ steps.checksum.outputs.sha1sum }}
|
||||
```
|
||||
append_body: true
|
||||
files: '*'
|
||||
|
|
12
.gitignore
vendored
12
.gitignore
vendored
|
@ -9,6 +9,16 @@ install_manifest.txt
|
|||
compile_commands.json
|
||||
CTestTestfile.cmake
|
||||
_deps
|
||||
build
|
||||
.vscode*
|
||||
.DS_Store
|
||||
|
||||
# version
|
||||
/src/version.h
|
||||
|
||||
# for package files
|
||||
lpac_*.deb
|
||||
lpac-*.zip
|
||||
|
||||
# for clion ignores
|
||||
.idea
|
||||
cmake-build-*
|
||||
|
|
|
@ -1,45 +1,71 @@
|
|||
option(LINUX_MINGW32 "Build for windows on Linux" OFF)
|
||||
cmake_minimum_required (VERSION 3.15)
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||
project (lpac
|
||||
VERSION 2.1.0
|
||||
HOMEPAGE_URL "https://github.com/estkme-group/lpac"
|
||||
DESCRIPTION "C-based eUICC LPA."
|
||||
LANGUAGES C)
|
||||
set(CMAKE_C_STANDARD 99)
|
||||
set(CMAKE_C_STANDARD_REQUIRED ON)
|
||||
|
||||
set(LPAC_CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||
list(APPEND CMAKE_MODULE_PATH ${LPAC_CMAKE_MODULE_PATH})
|
||||
|
||||
if(NOT PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR)
|
||||
# Git auto-ignore out-of-source build directory
|
||||
file(GENERATE OUTPUT .gitignore CONTENT "*")
|
||||
endif()
|
||||
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
# add_compile_options(-Wall -Wextra -Wpedantic)
|
||||
|
||||
# Enable LTO when possible.
|
||||
include(CheckIPOSupported)
|
||||
check_ipo_supported(RESULT result OUTPUT output)
|
||||
if(result)
|
||||
if(NOT DEFINED CMAKE_INTERPROCEDURAL_OPTIMIZATION)
|
||||
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
|
||||
endif()
|
||||
else()
|
||||
message(INFO "IPO is not supported: ${output}")
|
||||
endif()
|
||||
|
||||
if (APPLE)
|
||||
message(STATUS "Building for macOS")
|
||||
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64")
|
||||
set(CMAKE_SYSTEM_NAME Darwin)
|
||||
endif()
|
||||
|
||||
if(LINUX_MINGW32)
|
||||
set(CMAKE_SYSTEM_NAME Windows)
|
||||
|
||||
set(TOOLCHAIN_PREFIX x86_64-w64-mingw32)
|
||||
|
||||
set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc)
|
||||
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++)
|
||||
set(CMAKE_Fortran_COMPILER ${TOOLCHAIN_PREFIX}-gfortran)
|
||||
set(CMAKE_RC_COMPILER ${TOOLCHAIN_PREFIX}-windres)
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX})
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
if(UNIX)
|
||||
include(GNUInstallDirs)
|
||||
if(NOT CMAKE_INSTALL_RPATH)
|
||||
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_FULL_LIBDIR}/lpac")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(CYGWIN)
|
||||
set(CMAKE_SYSTEM_NAME Windows)
|
||||
message(STATUS "Building for Cygwin")
|
||||
add_definitions(-DHAVE_TIMEGM=1)
|
||||
if(WIN32)
|
||||
add_subdirectory(dlfcn-win32)
|
||||
set(DL_LIBRARY dlfcn-win32)
|
||||
else()
|
||||
set(DL_LIBRARY dl)
|
||||
endif()
|
||||
|
||||
cmake_minimum_required (VERSION 3.8)
|
||||
project (lpac)
|
||||
if(CPACK_GENERATOR)
|
||||
set(CPACK_PACKAGE_VENDOR "eSTK.me Group")
|
||||
|
||||
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "eSTK.me Group")
|
||||
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6")
|
||||
set(CPACK_DEBIAN_PACKAGE_RECOMMENDS "libcurl, libpcsclite, pcscd")
|
||||
|
||||
set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT)
|
||||
|
||||
set(CPACK_RPM_PACKAGE_LICENSE "AGPL-3.0-only AND LGPL-2.0-only")
|
||||
set(CPACK_RPM_PACKAGE_AUTOREQ "yes")
|
||||
set(CPACK_RPM_PACKAGE_REQUIRES "libcurl, libpcsclite, pcscd")
|
||||
|
||||
include(CPack)
|
||||
endif()
|
||||
|
||||
include_directories(.)
|
||||
add_subdirectory(cjson)
|
||||
add_subdirectory(euicc)
|
||||
add_subdirectory(interface)
|
||||
add_subdirectory(driver)
|
||||
add_subdirectory(src)
|
||||
if(LINUX_MINGW32)
|
||||
add_subdirectory(dlfcn-win32)
|
||||
endif()
|
||||
|
|
455
README.md
455
README.md
|
@ -1,450 +1,51 @@
|
|||
# lpac
|
||||
|
||||
|
||||
lpac is a cross platform local profile agent program.
|
||||
lpac is a cross-platform local profile agent program, compatible with [SGP.22 version 2.2.2](https://www.gsma.com/solutions-and-impact/technologies/esim/wp-content/uploads/2020/06/SGP.22-v2.2.2.pdf).
|
||||
|
||||
Features:
|
||||
- Support Activate Code and Confirm Code
|
||||
- Support custom IMEI sent to server
|
||||
|
||||
- Support Activation Code and Confirmation Code
|
||||
- Support Custom IMEI sent to server
|
||||
- Support Profile Discovery (SM-DS)
|
||||
- Profile management: list, enable, disable, delete and nickname
|
||||
- Notification management: list, send and delete
|
||||
- Lookup eUICC chip info
|
||||
- etc
|
||||
|
||||
Download:
|
||||
[Github Release](https://github.com/estkme-group/lpac/releases/latest)
|
||||
## Usage
|
||||
|
||||
lpac is dynamic-linked, Release is built by Github action, if you can't run it you need to compile by yourself
|
||||
You can download lpac from [GitHub Release][latest], and read [USAGE](docs/USAGE.md) to use it.
|
||||
If you can't run it you need to compile by yourself, see also [DEVELOPERS](docs/DEVELOPERS.md).
|
||||
If you want to known which Linux distributions include lpac, see also [LINUX-DIST](docs/LINUX-DIST.md).
|
||||
If you have any issue, please read [FAQ](docs/FAQ.md) first.
|
||||
|
||||
## GUI Frontend
|
||||
[latest]: https://github.com/estkme-group/lpac/releases/latest
|
||||
|
||||
- [EasyLPAC](https://github.com/creamlike1024/EasyLPAC)
|
||||
## Software Ecosystem
|
||||
|
||||
# Compile
|
||||
- [EasyLPAC] (Windows, Linux and macOS)
|
||||
- [{Open,Easy}EUICC][openeuicc] ([Mirror][openeuicc-mirror], Android)
|
||||
- [eSIM Manager (lpa-gtk)](https://codeberg.org/lucaweiss/lpa-gtk) (Linux Mobile)
|
||||
- [rlpa-server](https://github.com/estkme-group/rlpa-server) for eSTK.me Cloud Enhance function
|
||||
|
||||
<details>
|
||||
<summary>Linux</summary>
|
||||
|
||||
- Debian/Ubuntu
|
||||
|
||||
```bash
|
||||
sudo apt install build-essential cmake git g++ libpcsclite-dev libcurl4-openssl-dev
|
||||
git clone --depth=1 https://github.com/estkme-group/lpac
|
||||
cd lpac && mkdir build && cd build
|
||||
cmake ..
|
||||
make
|
||||
```
|
||||
|
||||
then execute `./output/lpac` to use.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>macOS</summary>
|
||||
|
||||
- Install [Homebrew](https://brew.sh/).
|
||||
|
||||
```bash
|
||||
git clone --depth=1 https://github.com/estkme-group/lpac
|
||||
cd lpac && mkdir build && cd build
|
||||
cmake ..
|
||||
make
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>Windows</summary>
|
||||
|
||||
Due to a [bug in asn1c](https://github.com/vlm/asn1c/issues/196), the MinGW version of lpac cannot send notification successfully. Building with Cygwin seems to avoid it.
|
||||
|
||||
Windows need prebuilt libcurl.dll, you can replace the download link to newest curl version.
|
||||
|
||||
- Build on Windows(Cygwin)
|
||||
|
||||
With `gcc-core` `gcc-g++` `make` `cmake` `unzip` `wget` installed
|
||||
|
||||
```bash
|
||||
git clone --depth=1 https://github.com/estkme-group/lpac
|
||||
cd lpac && mkdir build && cd build
|
||||
cmake -DCYGWIN=ON .. && make
|
||||
# Download libcurl
|
||||
wget https://curl.se/windows/dl-8.4.0_6/curl-8.4.0_6-win64-mingw.zip -O curl.zip && unzip curl.zip && mv curl-8.4.0_6-win64-mingw/bin/libcurl-x64.dll output/libcurl.dll
|
||||
```
|
||||
To run it outside Cygwin shell, you need copy `cygwin1.dll` to the program folder to distribute.
|
||||
`cygwin1.dll` is located in `C:\cygwin64\bin\cygwin1.dll` (Default Cygwin installation location)
|
||||
|
||||
- Build on Linux(MINGW)
|
||||
|
||||
```bash
|
||||
sudo apt install build-essential cmake git g++ libpcsclite-dev libcurl4-openssl-dev gcc-mingw-w64 g++-mingw-w64
|
||||
git clone --depth=1 https://github.com/estkme-group/lpac
|
||||
cd lpac && mkdir build && cd build
|
||||
cmake -DLINUX_MINGW32=ON .. && make
|
||||
# Download libcurl
|
||||
wget https://curl.se/windows/dl-8.4.0_6/curl-8.4.0_6-win64-mingw.zip -O curl.zip && unzip curl.zip && mv curl-8.4.0_6-win64-mingw/bin/libcurl-x64.dll output/libcurl.dll
|
||||
```
|
||||
|
||||
- Build on Windows(MSYS2)
|
||||
|
||||
```bash
|
||||
pacman -S mingw-w64-x86_64-cmake mingw-w64-x86_64-ninja mingw-w64-x86_64-gcc
|
||||
git clone --depth=1 https://github.com/estkme-group/lpac
|
||||
cd lpac && mkdir build && cd build
|
||||
cmake -DLINUX_MINGW32=ON .. && ninja
|
||||
# Download libcurl
|
||||
wget https://curl.se/windows/dl-8.4.0_6/curl-8.4.0_6-win64-mingw.zip -O curl.zip && unzip curl.zip && mv curl-8.4.0_6-win64-mingw/bin/libcurl-x64.dll output/libcurl.dll
|
||||
```
|
||||
</details>
|
||||
|
||||
# Usage
|
||||
|
||||
In Linux, you need install `pcscd`, `pcsclite` and `libcurl`.
|
||||
|
||||
APDU and HTTP interfaces of lpac has serval backends, you need specify `$APDU_INTERFACE` and `$HTTP_INTERFACE` environment variable to interface library path. If not specified, it will use `libapduinterface_pcsc` and `libhttpinterface_curl`.
|
||||
|
||||
APDU Backends:
|
||||
- `libapduinterface_at`: use AT commands interface used by LTE module
|
||||
- `libapduinterface_pcsc`: use PC/SC Smart Card API
|
||||
- `libapduinterface_stdio`: use standard input/output
|
||||
|
||||
Using `libapduinterface_at` need access permission to serial port (normally `/dev/ttyUSBx`). On Arch Linux, you can add yourself to `uucp` group by `sudo usermod -aG uucp $USER`. On other distro, you may need add yourself into `dialout` group.
|
||||
|
||||
HTTP Backends:
|
||||
- `libhttpinterface_curl`: use libcurl
|
||||
- `libhttpinterface_stdio`: use standard input/ouput
|
||||
|
||||
## CLI
|
||||
|
||||
### Command format
|
||||
```
|
||||
lpac <subcommand> [subcommand] [parameters]
|
||||
subcommand:
|
||||
chip View and manage information about your eUICC card itself
|
||||
profile Manage the profile of your eUICC card
|
||||
notification Manage notifications within your eUICC card
|
||||
driver View libXXXXinterface info
|
||||
subcommand 2:
|
||||
Please refer to the detailed instructions below
|
||||
```
|
||||
|
||||
### Return value
|
||||
|
||||
The return contents of lpac instructions are all in json format, and the returns of all instructions comply with the following format.
|
||||
```json
|
||||
{
|
||||
"type": "lpa",
|
||||
"payload": {
|
||||
"code": 0,
|
||||
"message": "success",
|
||||
"data": {[]}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
- `"type": "lpa"`: fixed content
|
||||
- `code`: if is 0, indicating successful execution, and other values are error codes.
|
||||
- `message`: is success if the operation is successful, or the error type is returned if an error occurs.
|
||||
- `data`: returns the returned content when the operation is successful, and is empty (but not NULL) when there is an error.
|
||||
|
||||
### Subcommand
|
||||
|
||||
#### chip
|
||||
|
||||
View the EID, default SM-DP+ server and SM-DS server of eUICC. euicc_info2 is also supported.
|
||||
|
||||
```
|
||||
lpac chip <subcommand> [parameters]
|
||||
subcommand:
|
||||
info View information about your eUICC card itself
|
||||
defaultsmdp Modify the default SM-DP+ server address of your eUICC card
|
||||
Example: lpac chip defaultsmdp <the address of the SM-DP+ server you want to modify>
|
||||
purge Reset the eUICC and will clear all profiles. Use with caution!
|
||||
```
|
||||
|
||||
<details>
|
||||
|
||||
<summary>Return value example</summary>
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "lpa",
|
||||
"payload": {
|
||||
"code": 0,
|
||||
"message": "success",
|
||||
"data": {
|
||||
"eidValue": "[EID]",
|
||||
"EuiccConfiguredAddresses": {
|
||||
"defaultDpAddress": null,
|
||||
"rootDsAddress": "testrootsmds.gsma.com"
|
||||
},
|
||||
"EUICCInfo2": {
|
||||
"profileVersion": "2.1.0",
|
||||
"svn": "2.2.0",
|
||||
"euiccFirmwareVer": "4.6.0",
|
||||
"extCardResource": {
|
||||
"installedApplication": 0,
|
||||
"freeNonVolatileMemory": 291666,
|
||||
"freeVolatileMemory": 5970
|
||||
},
|
||||
"uiccCapability": [
|
||||
"usimSupport",
|
||||
"isimSupport",
|
||||
"csimSupport",
|
||||
"akaMilenage",
|
||||
"akaCave",
|
||||
"akaTuak128",
|
||||
"akaTuak256",
|
||||
"gbaAuthenUsim",
|
||||
"gbaAuthenISim",
|
||||
"eapClient",
|
||||
"javacard",
|
||||
"multipleUsimSupport",
|
||||
"multipleIsimSupport"
|
||||
],
|
||||
"javacardVersion": "9.2.0",
|
||||
"globalplatformVersion": "2.3.0",
|
||||
"rspCapability": [
|
||||
"additionalProfile",
|
||||
"testProfileSupport"
|
||||
],
|
||||
"euiccCiPKIdListForVerification": [
|
||||
"81370f5125d0b1d408d4c3b232e6d25e795bebfb"
|
||||
],
|
||||
"euiccCiPKIdListForSigning": [
|
||||
"81370f5125d0b1d408d4c3b232e6d25e795bebfb"
|
||||
],
|
||||
"euiccCategory": null,
|
||||
"forbiddenProfilePolicyRules": [
|
||||
"pprUpdateControl",
|
||||
"ppr1"
|
||||
],
|
||||
"ppVersion": "0.0.1",
|
||||
"sasAcreditationNumber": "GI-BA-UP-0419",
|
||||
"certificationDataObject": {
|
||||
"platformLabel": "1.2.840.1234567/myPlatformLabel",
|
||||
"discoveryBaseURL": "https://mycompany.com/myDLOARegistrar"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
</details>
|
||||
|
||||
#### profile
|
||||
|
||||
Profile management, you can list, set alias (nickname), enable, disable, delete, download and discovery Profiles.
|
||||
```
|
||||
lpac profile <subcommand> [parameters]
|
||||
subcommand:
|
||||
list enumerates your eUICC Profile
|
||||
nickname sets an alias for the specified Profile
|
||||
Example: lpac profile nickname <ICCID of Profile> <alias>
|
||||
enable enables the specified Profile. The RefreshFlag status is enabled by default and can be omitted.
|
||||
Example: lpac profile enable <ICCID/AID of Profile> [1/0]
|
||||
disable disables the specified Profile. The RefreshFlag state is enabled by default and can be omitted.
|
||||
Example: lpac profile disable <ICCID/AID of Profile> [1/0]
|
||||
delete deletes the specified Profile
|
||||
Example: lpac profile delete <ICCID/AID of Profile>
|
||||
download Download profile from SM-DP server
|
||||
discovery Detect available profile registered on SM-DS server
|
||||
```
|
||||
|
||||
> [!NOTE]
|
||||
> Some eUICC chip have trouble when enable profile (e.g. These removeable eUICC cards from ECP), try AID, ICCID, refreshFlag with 1 or 0 to find out the working way for these chips.
|
||||
|
||||
There is no secondary confirmation for deleting a Profile, so please perform it with caution.
|
||||
> [!NOTE]
|
||||
> This function will only delete the Profile and issue a Notification, but it will not be sent automatically. You need to send it manually.
|
||||
|
||||
##### Download requires connection to SM-DP+ server and the following additional parameters:
|
||||
- `-s`: SM-DP+ server, optional, if not provided, it will try to read the defaultsmdp attribute.
|
||||
- `-m`: Matching ID, activation code. optional.
|
||||
- `-c`: Confirmation Code, optional.
|
||||
- `-i`: The IMEI of the device to which Profile is to be downloaded, optional.
|
||||
|
||||
|
||||
<details>
|
||||
|
||||
<summary>Example</summary>
|
||||
|
||||
```bash
|
||||
./lpac profile download -s rsp.truphone.com -m "QR-G-5C-1LS-1W1Z9P7"
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
##### Discovery requires connecting to the SM-DS server to query registered profile
|
||||
|
||||
The following parameters can be used to customize the IMEI and SM-DS server:
|
||||
- `-s`: SM-DS server. If not provided, it will be gsma official server "lpa.ds.gsma.com"
|
||||
- `-i`: IMEI of the device to which Profile is to be downloaded, optional
|
||||
|
||||
<details>
|
||||
|
||||
<summary>Return value example of lpac profile list</summary>
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "lpa",
|
||||
"payload": {
|
||||
"code": 0,
|
||||
"message": "success",
|
||||
"data": [
|
||||
{
|
||||
"iccid": "89353...",
|
||||
"isdpAid": "A0000005591010FFFFFFFF8900001000",
|
||||
"profileState": "disabled",
|
||||
"profileNickname": null,
|
||||
"serviceProviderName": "Vodafone IE",
|
||||
"profileName": "Vodafone IE eSIM",
|
||||
"iconType": "png",
|
||||
"icon": "iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAAMFBMVEUAAADgp6booKDoeXfrZ2Xn0tLsUE3sOjbtLCjtHhnvoaDpwsLvdHH1y8r57u7///9RHT9XAAAADHRSTlMASX2gyyX3/////lKi+t6IAAACOUlEQVR42pWX27KsIAxE5SLpIOD//+0ua86ZNtSI0A++9SJprm6Pcj7Ej0LwblvT7mMSAKrXB4Ck6Pdpu49yOeWri6SQfMzZExRCQSEl19ZaLfEdcSRV49aUazsv5Ysc3bj3YOyiKPX8qH7qUoTx8DD23M5/yor/NcXHND1s9aWd9N+48pBE6Iav51e1a8xP+FOjvwnkLqh/9Rfa2cCI4K0/n3exABKOLn88jm8TYJK7mX9R0z/N7KAnxDsgqoGfVkXlh+4xHDaA1gG4vO4C2ERSG2CnWkQxasLf/WADVKsF2gOA42cBlT5bhuKhhGMwAwbRFwE4TsGoAK7ojqDhswZgE5gnIDFCTsGQAFiCW+iAq9r2sCfTQTvHKtrPg4NQ4C6aKgFp37wB5PNNyabgtoC3CEZbU73NEO+ABtNDWAcIOgAsYC0E7QAyASgjAFYBEi1A8wxgFGJZBwQDSNMhEmDntS2uA8+lzBBW9qPbnMhSD0W7zbQlW0Jd6UAjDxSWsLSXeKQxhYUzDY6HKi/uNn8gJR7rFOS9AXbAi4VSaXN+yM6rzRDQHvz4cbUxRgqoP/IrDzcbU7BvxM6eRcVKg30hWamW2owdg1cSt6RBSMk515pzgmL0xGGOVrh8EKW7T5BygCxJ0z54aE74cdC7RuBDdUBYHJ8EXfZbHaJz+dHfE+KojcEvDxWgL3bx21BHhA7sCBx+hMDD6PHYZuRCggLWrEgc/VW7C1FEAf57Bw4+DfHh+/f/PPYfW1Z8RhpATXMAAAAASUVORK5CYII=",
|
||||
"profileClass": "operational"
|
||||
},
|
||||
{
|
||||
"iccid": "89012...",
|
||||
"isdpAid": "A0000005591010FFFFFFFF8900001100",
|
||||
"profileState": "disabled",
|
||||
"profileNickname": null,
|
||||
"serviceProviderName": "T-Mobile",
|
||||
"profileName": "CONVSIM5G_Adaptive",
|
||||
"iconType": "png",
|
||||
"icon": "iVBORw0KGgoAAAANSUhEUgAAADkAAABABAMAAABSG8K/AAAAMFBMVEXcAVrgir3VTpvXKYvXA33NGH7uAY7qAXztAYrvzebkcbL7/f3jq8/EGXHaMpThAW+lJAaXAAAACXBIWXMAAA7EAAAOxAGVKw4bAAACIklEQVR4nL3UMWsUQRQA4O1UtEhtKrGSFCrXCEIsRM9OEX/AFeHt6w6i3GxnCPr2VZ69WFgJgmDOHEfYmAVbCysLsVSIlaRyQZFz5s3s7szcJoWKrzh25pvZe/NmdhI+JEDHIPkXSoDUpaQk5kpVfaXuq75tj1gUz7yw8Ux+T7vWc+YNrcMnRVeUKDro1sehvr1iHp7efmebr5xKY/dCNTZa5gcXF3TnVsZWEfKPsS4BoNN7vLEc6tZ3ZLCqh/EPL2f9+J6ASZY20zUitRxoH8AtfIamjj99nYyYAl33tSQK5w59PS/b49T8Ca9oJbMLelyfI4WT+n3g9BhGev1EsV3r1iieS5utTnBBrxbTWt8sqO6c2pwfmvQixUHxGkSvdWi6VuxloumH/XRhbv75jjlXgKhPK3h1Ng0E0zlIdLeGPMu8SmbmfDsFkzGGu6AJyc5VMjZQZqWcfuv1Vle/tJqf7en4aquxKUdw2ig9kI6JXdEjaWy3OpaOvUM095SOVL5rlbDOSv0ftVnNGkWn7OVcNjnXand/PaoVk1+r9CDRUbVz80Q67LkCG61KD+INURvotMT2fgtuwr/WWaAATVbjeq7tOFoh1GHx55qKQocikf4YC7l+ICM5742m+sDnp4zuHifz6XAwVw+tVmRvljLgWLP5r3OCxc7LeZVhoPip8ONSqHA50P1IbyZ+xG9G8AIxUva2BsyV6q8X2I+FWnXrb4Q67QSVBN1hAAAAAElFTkSuQmCC",
|
||||
"profileClass": "operational"
|
||||
},
|
||||
{
|
||||
"iccid": "89444...",
|
||||
"isdpAid": "A0000005591010FFFFFFFF8900001200",
|
||||
"profileState": "enabled",
|
||||
"profileNickname": null,
|
||||
"serviceProviderName": "BetterRoaming",
|
||||
"profileName": "BetterRoaming",
|
||||
"iconType": "none",
|
||||
"icon": null,
|
||||
"profileClass": "operational"
|
||||
},
|
||||
{
|
||||
"iccid": "89852...",
|
||||
"isdpAid": "A0000005591010FFFFFFFF8900001300",
|
||||
"profileState": "disabled",
|
||||
"profileNickname": null,
|
||||
"serviceProviderName": "Redtea Mobile",
|
||||
"profileName": "RedteaGO",
|
||||
"iconType": "none",
|
||||
"icon": null,
|
||||
"profileClass": "operational"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
- `iccid`: ICCID of Profile
|
||||
- `isdpAid`: Aid of Profile
|
||||
- `profileState`: State of Profile, "Enabled" or "Disabled"
|
||||
- `profileNickname`: Nickname of Profile
|
||||
- `serviceProviderName`: Telecom operators of Profile
|
||||
- `profileName`: Name of Profile
|
||||
- `iconType`: Profile icon data struct, "none", "png", "jpg"
|
||||
- `icon`: Profile icon data in base64
|
||||
- `profileClass`: Type of Profile
|
||||
|
||||
</details>
|
||||
|
||||
#### notification
|
||||
|
||||
Used for the management of Notifications, which are sent by telecom operators during Profile operations. You can enumerate (list), send (process), and remove (remove) Notifications.
|
||||
```
|
||||
lpac notification <subcommand> [parameters]
|
||||
subcommand:
|
||||
list Enumerates your eUICC pending Notification list
|
||||
process Send Notification
|
||||
Example: lpac notification process <sequence ID>
|
||||
remove Remove Notification
|
||||
Example: lpac notification remove <sequence ID>
|
||||
```
|
||||
> [!NOTE]
|
||||
> Downstream developers or end users should process Notification as soon as possible when they exist to comply with GSMA specifications. lpac will not automatically delete the Notification after sending it, and you need to delete it manually.
|
||||
|
||||
<details>
|
||||
|
||||
<summary>Return value example of lpac notification list</summary>
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "lpa",
|
||||
"payload": {
|
||||
"code": 0,
|
||||
"message": "success",
|
||||
"data": [
|
||||
{
|
||||
"seqNumber": 178,
|
||||
"profileManagementOperation": "install",
|
||||
"notificationAddress": "rsp-eu.redteamobile.com",
|
||||
"iccid": "89852..."
|
||||
},
|
||||
{
|
||||
"seqNumber": 215,
|
||||
"profileManagementOperation": "disable",
|
||||
"notificationAddress": "cust-005-v4-prod-atl2.gdsb.net",
|
||||
"iccid": "89012..."
|
||||
},
|
||||
{
|
||||
"seqNumber": 216,
|
||||
"profileManagementOperation": "enable",
|
||||
"notificationAddress": "rsp.truphone.com",
|
||||
"iccid": "89444..."
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
- `seqNumber`: Sequence ID
|
||||
- `profileManagementOperation`: Which operation generated this notification
|
||||
- `notificationAddress`: Profile's notification reporting server address
|
||||
|
||||
</details>
|
||||
|
||||
#### driver
|
||||
|
||||
Now there is only one command: `lpac driver apdu list` to get card reader list.
|
||||
|
||||
## FAQ
|
||||
|
||||
<details>
|
||||
<summary>Q: Any subcommand of lpac will get error message like "SCardListReaders() failed:" and 8-digits error code, such as 80100069, 80100066, 8010002E, 8010000F and so on.</summary>
|
||||
|
||||
A:
|
||||
- 80100069 means your UICC is not plugged correctly
|
||||
- 80100066 means your card has no response, please clean the pin and plug in again
|
||||
- 8010002E means communication error
|
||||
- 8010000F means the card is not a eUICC, or detect wrong card reader like Yubikey. For latter one, you can use `lpac driver apdu list` to list all reader and use `$DRIVER_IFID` to specify correct card reader
|
||||
- for others, Google is your friend.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>Q: I can't download eSIM profile of xxx.</summary>
|
||||
|
||||
A: The verification of SM-DP+ servers of telecom operators is diverse. Please check whether the parameters you enter are consistent with those provided to you by the telecom operators. Some telecom operators issue profiles in the form of push, which may require the use of lpac's discovery and custom IMEI function.
|
||||
|
||||
</details>
|
||||
[easylpac]: https://github.com/creamlike1024/EasyLPAC/releases/latest
|
||||
[openeuicc]: https://gitea.angry.im/PeterCxy/OpenEUICC
|
||||
[openeuicc-mirror]: https://github.com/estkme-group/openeuicc
|
||||
|
||||
## Thanks
|
||||
|
||||
<a href="https://github.com/estkme-group/lpac/graphs/contributors">
|
||||
<img src="https://contrib.rocks/image?repo=estkme-group/lpac" alt=""/>
|
||||
</a>
|
||||
[![Contributors][contrib]][contributors]
|
||||
|
||||
[contrib]: https://contrib.rocks/image?repo=estkme-group/lpac
|
||||
[contributors]: https://github.com/estkme-group/lpac/graphs/contributors
|
||||
|
||||
---
|
||||
|
||||
## License
|
||||
- lpac (/src): AGPL-3.0
|
||||
- libeuicc (/euicc): LGPL-v2
|
||||
- interfaces (/interface): MIT
|
||||
|
||||
Copyright (c) 2023-2024 eSTKme Group
|
||||
- lpac ([/src](src), [/driver](driver)): AGPL-v3.0-only
|
||||
- libeuicc ([/euicc](euicc)): LGPL-v2.1-only or Commercial License Agreement with ESTKME TECHNOLOGY LIMITED, Hong Kong
|
||||
- cjson ([/cjson](cjson)): MIT
|
||||
- dlfcn-win32 ([/dlfcn-win32](dlfcn-win32)): MIT
|
||||
|
||||
Copyright © 2023-2025 ESTKME TECHNOLOGY LIMITED, Hong Kong
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
asn1c -fwide-types -fcompound-names -fincludes-quoted -no-gen-example ../../../asn1/PKIXExplicit88.asn ../../../asn1/PKIXImplicit88.asn ../../../asn1/rsp.asn
|
||||
|
||||
find "." -type f \( -name "*.c" -o -name "*.h" \) | while read -r file; do for header in $(find "." -type f -name "*.h"); do header_file=$(basename "$header"); sed -i "/#include <${header_file}>/c\#include \"${header_file}\"" "$file"; done; done
|
|
@ -1,3 +1,3 @@
|
|||
include_directories(.)
|
||||
aux_source_directory(. LIB_CJSON_SRCS)
|
||||
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR} LIB_CJSON_SRCS)
|
||||
add_library(cjson-static STATIC ${LIB_CJSON_SRCS})
|
||||
target_include_directories(cjson-static PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>)
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2023 estkme-group
|
||||
Copyright (c) 2009-2017 Dave Gamble and cJSON contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -9,13 +7,13 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
15
cmake/aarch64-windows-zig.cmake
Normal file
15
cmake/aarch64-windows-zig.cmake
Normal file
|
@ -0,0 +1,15 @@
|
|||
set(CMAKE_SYSTEM_NAME Windows)
|
||||
set(CMAKE_SYSTEM_PROCESSOR "aarch64")
|
||||
set(CMAKE_C_COMPILER "zig" cc -target aarch64-windows-gnu)
|
||||
set(CMAKE_CXX_COMPILER "zig" c++ -target aarch64-windows-gnu)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2 -s")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -s")
|
||||
|
||||
if(WIN32)
|
||||
set(SCRIPT_SUFFIX ".cmd")
|
||||
else()
|
||||
set(SCRIPT_SUFFIX ".sh")
|
||||
endif()
|
||||
|
||||
set(CMAKE_AR "${CMAKE_CURRENT_LIST_DIR}/zig-ar${SCRIPT_SUFFIX}")
|
||||
set(CMAKE_RANLIB "${CMAKE_CURRENT_LIST_DIR}/zig-ranlib${SCRIPT_SUFFIX}")
|
25
cmake/git-version.cmake
Normal file
25
cmake/git-version.cmake
Normal file
|
@ -0,0 +1,25 @@
|
|||
# from https://github.com/nocnokneo/cmake-git-versioning-example
|
||||
|
||||
if(GIT_EXECUTABLE)
|
||||
get_filename_component(SRC_DIR ${SRC} DIRECTORY)
|
||||
# Generate a git-describe version string from Git repository tags
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} describe --always --tags --dirty --match "v*"
|
||||
WORKING_DIRECTORY ${SRC_DIR}
|
||||
OUTPUT_VARIABLE GIT_DESCRIBE_VERSION
|
||||
RESULT_VARIABLE GIT_DESCRIBE_ERROR_CODE
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
if(NOT GIT_DESCRIBE_ERROR_CODE)
|
||||
set(LPAC_VERSION ${GIT_DESCRIBE_VERSION})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Final fallback: Just use a bogus version string that is semantically older
|
||||
# than anything else and spit out a warning to the developer.
|
||||
if(NOT DEFINED LPAC_VERSION)
|
||||
set(LPAC_VERSION v0.0.0-unknown)
|
||||
message(WARNING "Failed to determine LPAC_VERSION from Git tags. Using default version \"${LPAC_VERSION}\".")
|
||||
endif()
|
||||
|
||||
configure_file(${SRC} ${DST} @ONLY)
|
15
cmake/linux-mingw32.cmake
Normal file
15
cmake/linux-mingw32.cmake
Normal file
|
@ -0,0 +1,15 @@
|
|||
set(CMAKE_SYSTEM_NAME Windows)
|
||||
|
||||
set(TOOLCHAIN_PREFIX i686-w64-mingw32)
|
||||
|
||||
set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc)
|
||||
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++)
|
||||
set(CMAKE_Fortran_COMPILER ${TOOLCHAIN_PREFIX}-gfortran)
|
||||
set(CMAKE_RC_COMPILER ${TOOLCHAIN_PREFIX}-windres)
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX})
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
|
13
cmake/linux-mingw64-woa.cmake
Normal file
13
cmake/linux-mingw64-woa.cmake
Normal file
|
@ -0,0 +1,13 @@
|
|||
set(CMAKE_SYSTEM_NAME Windows)
|
||||
|
||||
set(TOOLCHAIN_PREFIX ${TOOLCHAIN_BIN_PATH}/aarch64-w64-mingw32)
|
||||
|
||||
set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc)
|
||||
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++)
|
||||
set(CMAKE_Fortran_COMPILER ${TOOLCHAIN_PREFIX}-gfortran)
|
||||
set(CMAKE_RC_COMPILER ${TOOLCHAIN_PREFIX}-windres)
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
|
15
cmake/linux-mingw64.cmake
Normal file
15
cmake/linux-mingw64.cmake
Normal file
|
@ -0,0 +1,15 @@
|
|||
set(CMAKE_SYSTEM_NAME Windows)
|
||||
|
||||
set(TOOLCHAIN_PREFIX x86_64-w64-mingw32)
|
||||
|
||||
set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc)
|
||||
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++)
|
||||
set(CMAKE_Fortran_COMPILER ${TOOLCHAIN_PREFIX}-gfortran)
|
||||
set(CMAKE_RC_COMPILER ${TOOLCHAIN_PREFIX}-windres)
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX})
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
|
2
cmake/zig-ar.cmd
Executable file
2
cmake/zig-ar.cmd
Executable file
|
@ -0,0 +1,2 @@
|
|||
@echo off
|
||||
zig ar %*
|
2
cmake/zig-ar.sh
Executable file
2
cmake/zig-ar.sh
Executable file
|
@ -0,0 +1,2 @@
|
|||
#!/bin/sh
|
||||
zig ar "$@"
|
2
cmake/zig-ranlib.cmd
Executable file
2
cmake/zig-ranlib.cmd
Executable file
|
@ -0,0 +1,2 @@
|
|||
@echo off
|
||||
zig ranlib %*
|
2
cmake/zig-ranlib.sh
Executable file
2
cmake/zig-ranlib.sh
Executable file
|
@ -0,0 +1,2 @@
|
|||
#!/bin/sh
|
||||
zig ranlib "$@"
|
|
@ -1,3 +1,3 @@
|
|||
include_directories(.)
|
||||
aux_source_directory(. LIB_DLFCN_SRCS)
|
||||
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR} LIB_DLFCN_SRCS)
|
||||
add_library(dlfcn-win32 STATIC ${LIB_DLFCN_SRCS})
|
||||
target_include_directories(dlfcn-win32 PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>)
|
||||
|
|
17
dlfcn-win32/LICENSE
Normal file
17
dlfcn-win32/LICENSE
Normal file
|
@ -0,0 +1,17 @@
|
|||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
|
@ -418,7 +418,7 @@ void *dlopen( const char *file, int mode )
|
|||
* Behavior and doesn't provide expected search paths.
|
||||
* See also: https://github.com/dlfcn-win32/dlfcn-win32/issues/104
|
||||
*/
|
||||
hModule = LoadLibraryExA( lpFileName, NULL, NULL );
|
||||
hModule = LoadLibraryExA( lpFileName, NULL, 0 );
|
||||
|
||||
if( !hModule )
|
||||
{
|
||||
|
@ -758,7 +758,7 @@ static BOOL is_import_thunk( const void *addr )
|
|||
#endif
|
||||
}
|
||||
|
||||
/* Return adress from the import address table (iat),
|
||||
/* Return address from the import address table (iat),
|
||||
* if the original address points to a thunk table entry.
|
||||
*/
|
||||
static void *get_address_from_import_address_table( void *iat, DWORD iat_size, const void *addr )
|
||||
|
|
90
docs/DEVELOPERS.md
Normal file
90
docs/DEVELOPERS.md
Normal file
|
@ -0,0 +1,90 @@
|
|||
# Developer Manual
|
||||
|
||||
## Coding Standard
|
||||
|
||||
lpac is written with C99 and compatible with [SGP.22 version 2.2.2](https://www.gsma.com/solutions-and-impact/technologies/esim/wp-content/uploads/2020/06/SGP.22-v2.2.2.pdf).
|
||||
|
||||
## How to Compile
|
||||
|
||||
### Linux
|
||||
|
||||
#### Debian/Ubuntu
|
||||
|
||||
``` bash
|
||||
# clone this repo in the top-level folder
|
||||
|
||||
# install dependencies
|
||||
./scripts/setup-debian.sh
|
||||
```
|
||||
|
||||
Run `cmake` and `make`, compiled output will be in `output` directory.
|
||||
If you want to get a Deb package, run `cmake -DCPACK_GENERATOR=DEB` then `make`.
|
||||
|
||||
#### Droidian
|
||||
|
||||
Same as normal Debian/Ubuntu, however, in order to build the GBinder backends, you will need `libgbinder-dev`, `glib2.0-dev`, and you will have to pass `-DLPAC_WITH_APDU_GBINDER=ON` when invoking `cmake`.
|
||||
|
||||
---
|
||||
|
||||
### macOS
|
||||
|
||||
Install [Homebrew](https://brew.sh/).
|
||||
Run `cmake` and `make`, compiled output will be in `output` directory.
|
||||
|
||||
---
|
||||
|
||||
### Windows(x86_64)
|
||||
|
||||
Windows need libcurl.dll to run.
|
||||
Download libcurl from <https://curl.se/download.html> and place it as `libcurl.dll` in `output` directory.
|
||||
|
||||
Install prerequisites, run `cmake` and `make`, compiled output will be in `output` directory.
|
||||
|
||||
#### Build on Linux(MINGW)
|
||||
|
||||
Require `build-essential` `cmake` `git` `g++` `libpcsclite-dev` `libcurl4-openssl-dev` `gcc-mingw-w64` `g++-mingw-w64` installed.
|
||||
|
||||
#### Build on Windows(MSYS2)
|
||||
|
||||
Require `mingw-w64-x86_64-cmake` `mingw-w64-x86_64-gcc` installed.
|
||||
|
||||
#### Build on Windows(Cygwin)
|
||||
|
||||
Require `gcc-core` `gcc-g++` `make` `cmake` `unzip` `wget` installed.
|
||||
|
||||
To run it outside Cygwin shell, you need copy `cygwin1.dll` to the program folder to distribute.
|
||||
`cygwin1.dll` is located in `C:\cygwin64\bin\cygwin1.dll` (Default Cygwin installation location)
|
||||
|
||||
---
|
||||
|
||||
### Windows on ARM
|
||||
|
||||
#### Cross compile on Windows/Linux host(arm64,x86_64 and more architecture) with zig
|
||||
|
||||
Install [zig](https://ziglang.org/download/)
|
||||
|
||||
```bash
|
||||
# clone this repo in the top-level folder
|
||||
|
||||
./scripts/build-woa.sh zig
|
||||
```
|
||||
|
||||
#### Cross compile on Linux x86_64 host(GNU toolchain)
|
||||
|
||||
```bash
|
||||
# clone this repo in the top-level folder
|
||||
|
||||
./scripts/build-woa.sh mingw
|
||||
```
|
||||
|
||||
#### Build on Native Windows on ARM(MSYS2)
|
||||
|
||||
It is possible to build on **WoA devices** with [MSYS2 ARM64 Support](https://www.msys2.org/wiki/arm64/)
|
||||
|
||||
You may need to install `mingw-w64-clang-aarch64-cmake`, `mingw-w64-clang-aarch64-clang` and modify `cmake/linux-mingw64.cmake`(replace toolchain).
|
||||
|
||||
Download prebuilt curl dll is also needed. Refer to the previous compilation steps.
|
||||
|
||||
## Debug
|
||||
|
||||
Please see [debug environment variables](ENVVARS.md#debug)
|
31
docs/ENVVARS.md
Normal file
31
docs/ENVVARS.md
Normal file
|
@ -0,0 +1,31 @@
|
|||
# Environment Variables
|
||||
|
||||
## General
|
||||
|
||||
* `LPAC_CUSTOM_ES10X_MSS`: specify maximum segment size for ES10x APDU backend. (default: 120, min: 6, max: 255)
|
||||
* `LPAC_CUSTOM_ISD_R_AID`: specify which AID will be used to open the logic channel. (hex string, 32 chars)
|
||||
* `LPAC_APDU`: specify which APDU backend will be used. Values:
|
||||
- `at`: use AT commands interface used by LTE module
|
||||
- `pcsc`: use PC/SC Smart Card API
|
||||
- `stdio`: use standard input/output
|
||||
- `qmi`: use QMI
|
||||
- `qmi_qrtr`: use QMI over QRTR
|
||||
- `mbim`: use MBIM
|
||||
- GBinder-based backends for `libhybris` (Halium) distributions:
|
||||
- `gbinder_hidl`: use HIDL IRadio (SoC launched before Android 13)
|
||||
* `LPAC_HTTP`: specify which HTTP backend will be used.
|
||||
- `curl`: use libcurl
|
||||
- `stdio`: use standard input/output
|
||||
* `AT_DEVICE`: specify which serial port device will be used by AT APDU backend.
|
||||
* `QMI_DEVICE`: specify which QMI device will be used by QMI APDU backend.
|
||||
* `UIM_SLOT`: specify which UIM slot will be used by QMI and MBIM APDU backends. (default: 1, slot number starts from 1)
|
||||
* `DRIVER_IFID`: specify which PC/SC interface will be used by PC/SC APDU backend.
|
||||
* `MBIM_DEVICE`: specify which MBIM device will be used by MBIM APDU backend. (default: `/dev/cdc-wdm0`)
|
||||
* `MBIM_USE_PROXY`: tell the MBIM APDU backend to use the mbim-proxy. (default: 0, anything other than 0 means true)
|
||||
|
||||
## Debug
|
||||
|
||||
* `LIBEUICC_DEBUG_APDU`: enable debug output for APDU.
|
||||
* `LIBEUICC_DEBUG_HTTP`: enable debug output for HTTP.
|
||||
* `AT_DEBUG`: enable debug output for AT APDU backend.
|
||||
* `GBINDER_APDU_DEBUG`: enable debug output for GBinder APDU backend. MUST be `true` to take effect.
|
18
docs/FAQ.md
Normal file
18
docs/FAQ.md
Normal file
|
@ -0,0 +1,18 @@
|
|||
## FAQ
|
||||
|
||||
### Any subcommand of lpac will get error message like "SCardListReaders() failed:" and 8-digits error code, such as 80100069, 80100066, 8010002E, 8010000F and so on.
|
||||
|
||||
- [80100069] means your UICC is not plugged correctly
|
||||
- [80100066] means your card has no response, please clean the pin and plug in again
|
||||
- [8010002E] means communication error
|
||||
- [8010000F] means the card is not a eUICC, or detect wrong card reader like Yubikey. For latter one, you can use `lpac driver apdu list` to list all reader and use `$DRIVER_IFID` to specify correct card reader
|
||||
- for others, Google is your friend.
|
||||
|
||||
[80100069]: https://pcsclite.apdu.fr/api/group__ErrorCodes.html#gaa2efd953946973972b1afc5d0343820c
|
||||
[80100066]: https://pcsclite.apdu.fr/api/group__ErrorCodes.html#ga359a9e85e3b7c83c76507a096452b74f
|
||||
[8010002E]: https://pcsclite.apdu.fr/api/group__ErrorCodes.html#ga81b59e9319d3fcd0d957d98781b3ebd2
|
||||
[8010000F]: https://pcsclite.apdu.fr/api/group__ErrorCodes.html#ga36d821a0458f935ddbe345f10408a988
|
||||
|
||||
### I can't download eSIM profile of xxx.
|
||||
|
||||
The verification of SM-DP+ servers of telecom operators is diverse. Please check whether the parameters you enter are consistent with those provided to you by the telecom operators. Some telecom operators issue profiles in the form of push, which may require the use of lpac's discovery and custom IMEI function.
|
59
docs/LINUX-DIST.md
Normal file
59
docs/LINUX-DIST.md
Normal file
|
@ -0,0 +1,59 @@
|
|||
# Linux distributions
|
||||
|
||||
> [!CAUTION]
|
||||
>
|
||||
> **All Linux distribution packages are unofficially maintained.**
|
||||
|
||||
## OpenWrt
|
||||
|
||||
> Minimum available release: Snapshot
|
||||
> (Added on 2024-05-15)
|
||||
|
||||
```shell
|
||||
opkg install lpac
|
||||
```
|
||||
|
||||
see <https://github.com/openwrt/packages/blob/master/utils/lpac/Makefile>
|
||||
|
||||
## Alpine
|
||||
|
||||
> Minimum available release: [v3.20.0](https://pkgs.alpinelinux.org/packages?name=lpac&branch=v3.20)
|
||||
> (Release date: 2024-05-22).
|
||||
|
||||
```shell
|
||||
pkg install lpac
|
||||
```
|
||||
|
||||
see <https://github.com/alpinelinux/aports/blob/master/community/lpac/APKBUILD>
|
||||
|
||||
## Arch Linux
|
||||
|
||||
> Need to enable [archlinuxcn repo](https://github.com/archlinuxcn/repo#readme) first
|
||||
>
|
||||
> If you want to use AUR, the package name is [lpac-git](https://aur.archlinux.org/packages/lpac-git)
|
||||
|
||||
```shell
|
||||
pacman -S lpac
|
||||
# or
|
||||
pacman -S lpac-git
|
||||
```
|
||||
|
||||
see <https://github.com/archlinuxcn/repo/blob/master/archlinuxcn/lpac/PKGBUILD> \
|
||||
see <https://github.com/archlinuxcn/repo/blob/master/archlinuxcn/lpac-git/PKGBUILD>
|
||||
|
||||
## Nix OS
|
||||
|
||||
> Need to enable [NUR](https://github.com/nix-community/NUR#readme "Nix User Repository") first
|
||||
|
||||
```shell
|
||||
nix-env -i lpac
|
||||
```
|
||||
|
||||
see <https://github.com/nix-community/nur-combined/blob/master/repos/linyinfeng/pkgs/lpac/default.nix>
|
||||
|
||||
## Ubuntu and Debian/Devuan
|
||||
|
||||
> Minimum available release: Ubuntu [14.04 Trusty Tahr](https://releases.ubuntu.com/14.04/)
|
||||
> (Published on 2024-09-01)
|
||||
|
||||
see <https://launchpad.net/~daniel-gimpelevich/+archive/ubuntu/ssl/+sourcepub/17063242/+listing-archive-extra>
|
333
docs/USAGE.md
Normal file
333
docs/USAGE.md
Normal file
|
@ -0,0 +1,333 @@
|
|||
## Usage
|
||||
|
||||
In Linux, you need to install `pcscd`, `pcsclite` and `libcurl`.
|
||||
|
||||
APDU and HTTP interfaces of lpac has several backends, you need to specify `$LPAC_APDU` and `$LPAC_HTTP` environment variables to interface library path. If not specified, it will use `pcsc` and `curl`. See also [environment variables](ENVVARS.md).
|
||||
|
||||
Using `at` APDU backend need access permission to serial port (normally `/dev/ttyUSBx`). On Arch Linux, you can add yourself to `uucp` group by `sudo usermod -aG uucp $USER`. On other distro, you may need to add yourself into `dialout` group. If your serial port is not `/dev/ttyUSB0`, please use `$AT_DEVICE` to specify which one you want to use.
|
||||
|
||||
## CLI
|
||||
|
||||
### Command format
|
||||
|
||||
```plain
|
||||
lpac <subcommand> [subcommand] [parameters]
|
||||
subcommand:
|
||||
chip View and manage information about your eUICC card itself
|
||||
profile Manage the profile of your eUICC card
|
||||
notification Manage notifications within your eUICC card
|
||||
driver View libXXXXinterface info
|
||||
subcommand 2:
|
||||
Please refer to the detailed instructions below
|
||||
```
|
||||
|
||||
### Return value
|
||||
|
||||
The return contents of lpac instructions are all in json format, and the returns of all instructions comply with the following format.
|
||||
|
||||
```jsonc
|
||||
{
|
||||
"type": "lpa",
|
||||
"payload": {
|
||||
"code": 0,
|
||||
"message": "success",
|
||||
"data": {/* .... */}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
- `"type": "lpa"`: fixed content
|
||||
- `code`: if is 0, indicating successful execution, and other values are error codes.
|
||||
- `message`: is success if the operation is successful, or the error type is returned if an error occurs.
|
||||
- `data`: returns the returned content when the operation is successful, and is empty (but not NULL) when there is an error.
|
||||
|
||||
### Subcommand
|
||||
|
||||
#### chip
|
||||
|
||||
View the EID, default SM-DP+ server and SM-DS server of eUICC. euicc_info2 is also supported.
|
||||
|
||||
```plain
|
||||
lpac chip <subcommand> [parameters]
|
||||
subcommand:
|
||||
info View information about your eUICC card itself
|
||||
defaultsmdp Modify the default SM-DP+ server address of your eUICC card
|
||||
Example: lpac chip defaultsmdp <the address of the SM-DP+ server you want to modify>
|
||||
purge Reset the eUICC and will clear all profiles. Use with caution!
|
||||
```
|
||||
|
||||
<details>
|
||||
|
||||
<summary>Return value example</summary>
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "lpa",
|
||||
"payload": {
|
||||
"code": 0,
|
||||
"message": "success",
|
||||
"data": {
|
||||
"eidValue": "[EID]",
|
||||
"EuiccConfiguredAddresses": {
|
||||
"defaultDpAddress": null,
|
||||
"rootDsAddress": "testrootsmds.gsma.com"
|
||||
},
|
||||
"EUICCInfo2": {
|
||||
"profileVersion": "2.1.0",
|
||||
"svn": "2.2.0",
|
||||
"euiccFirmwareVer": "4.6.0",
|
||||
"extCardResource": {
|
||||
"installedApplication": 0,
|
||||
"freeNonVolatileMemory": 291666,
|
||||
"freeVolatileMemory": 5970
|
||||
},
|
||||
"uiccCapability": [
|
||||
"usimSupport",
|
||||
"isimSupport",
|
||||
"csimSupport",
|
||||
"akaMilenage",
|
||||
"akaCave",
|
||||
"akaTuak128",
|
||||
"akaTuak256",
|
||||
"gbaAuthenUsim",
|
||||
"gbaAuthenISim",
|
||||
"eapClient",
|
||||
"javacard",
|
||||
"multipleUsimSupport",
|
||||
"multipleIsimSupport"
|
||||
],
|
||||
"ts102241Version": "9.2.0",
|
||||
"globalplatformVersion": "2.3.0",
|
||||
"rspCapability": [
|
||||
"additionalProfile",
|
||||
"testProfileSupport"
|
||||
],
|
||||
"euiccCiPKIdListForVerification": [
|
||||
"81370f5125d0b1d408d4c3b232e6d25e795bebfb"
|
||||
],
|
||||
"euiccCiPKIdListForSigning": [
|
||||
"81370f5125d0b1d408d4c3b232e6d25e795bebfb"
|
||||
],
|
||||
"euiccCategory": null,
|
||||
"forbiddenProfilePolicyRules": [
|
||||
"pprUpdateControl",
|
||||
"ppr1"
|
||||
],
|
||||
"ppVersion": "0.0.1",
|
||||
"sasAcreditationNumber": "GI-BA-UP-0419",
|
||||
"certificationDataObject": {
|
||||
"platformLabel": "1.2.840.1234567/myPlatformLabel",
|
||||
"discoveryBaseURL": "https://mycompany.com/myDLOARegistrar"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
\* Starting from SGP.22 v2.1, `javacardVersion` is renamed to `ts102241Version` \
|
||||
\*\* SGP.22 has been a typo, `sasAcreditationNumber` should be `sasAccreditationNumber`
|
||||
|
||||
</details>
|
||||
|
||||
#### profile
|
||||
|
||||
Profile management, you can list, set alias (nickname), enable, disable, delete, download and discovery Profiles.
|
||||
|
||||
```plain
|
||||
lpac profile <subcommand> [parameters]
|
||||
subcommand:
|
||||
list enumerates your eUICC Profile
|
||||
nickname sets an alias for the specified Profile
|
||||
Example: lpac profile nickname <ICCID of Profile> <alias>
|
||||
enable enables the specified Profile. The RefreshFlag status is enabled by default and can be omitted.
|
||||
Example: lpac profile enable <ICCID/AID of Profile> [1/0]
|
||||
disable disables the specified Profile. The RefreshFlag state is enabled by default and can be omitted.
|
||||
Example: lpac profile disable <ICCID/AID of Profile> [1/0]
|
||||
delete deletes the specified Profile
|
||||
Example: lpac profile delete <ICCID/AID of Profile>
|
||||
download Download profile from SM-DP server
|
||||
discovery Detect available profile registered on SM-DS server
|
||||
```
|
||||
|
||||
> [!NOTE]
|
||||
> Some eUICC chips have trouble when enabling profile (e.g. These removable eUICC cards from ECP), try AID, ICCID, refreshFlag with 1 or 0 to find out the working way for these chips.
|
||||
|
||||
There is no secondary confirmation for deleting a Profile, so please perform it with caution.
|
||||
> [!NOTE]
|
||||
> This function will only delete the Profile and issue a Notification, but it will not be sent automatically. You need to send it manually.
|
||||
|
||||
##### Download requires connection to SM-DP+ server and the following additional parameters:
|
||||
|
||||
- `-s`: SM-DP+ server, optional, if not provided, it will try to read the default sm-dp+ attribute.
|
||||
- `-m`: Matching ID, activation code. optional.
|
||||
- `-c`: Confirmation Code, optional.
|
||||
- `-i`: The IMEI of the device to which Profile is to be downloaded, optional.
|
||||
- `-a`: LPA qrcode activation code string, e.g: `LPA:1$<sm-dp+ domain>$<matching id>`, if provided, this option takes precedence over the `-s` and `-m` options, optional.
|
||||
- `-p`: Interactive preview mode, optional.
|
||||
|
||||
<details>
|
||||
|
||||
<summary>Example</summary>
|
||||
|
||||
```bash
|
||||
./lpac profile download -s rsp.truphone.com -m "QR-G-5C-1LS-1W1Z9P7"
|
||||
|
||||
# LPA qrcode activation code string
|
||||
./lpac profile download -a 'LPA:1$rsp.truphone.com$QR-G-5C-1LS-1W1Z9P7'
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
##### Discovery requires connecting to the SM-DS server to query registered profile
|
||||
|
||||
The following parameters can be used to customize the IMEI and SM-DS server:
|
||||
|
||||
- `-s`: SM-DS server. If not provided, it will be gsma official server "lpa.ds.gsma.com"
|
||||
- `-i`: IMEI of the device to which Profile is to be downloaded, optional
|
||||
|
||||
<details>
|
||||
|
||||
<summary>Return value example of lpac profile list</summary>
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "lpa",
|
||||
"payload": {
|
||||
"code": 0,
|
||||
"message": "success",
|
||||
"data": [
|
||||
{
|
||||
"iccid": "89353...",
|
||||
"isdpAid": "A0000005591010FFFFFFFF8900001000",
|
||||
"profileState": "disabled",
|
||||
"profileNickname": null,
|
||||
"serviceProviderName": "Vodafone IE",
|
||||
"profileName": "Vodafone IE eSIM",
|
||||
"iconType": "png",
|
||||
"icon": "iVBO...",
|
||||
"profileClass": "operational"
|
||||
},
|
||||
{
|
||||
"iccid": "89012...",
|
||||
"isdpAid": "A0000005591010FFFFFFFF8900001100",
|
||||
"profileState": "disabled",
|
||||
"profileNickname": null,
|
||||
"serviceProviderName": "T-Mobile",
|
||||
"profileName": "CONVSIM5G_Adaptive",
|
||||
"iconType": "png",
|
||||
"icon": "iVBO...",
|
||||
"profileClass": "operational"
|
||||
},
|
||||
{
|
||||
"iccid": "89444...",
|
||||
"isdpAid": "A0000005591010FFFFFFFF8900001200",
|
||||
"profileState": "enabled",
|
||||
"profileNickname": null,
|
||||
"serviceProviderName": "BetterRoaming",
|
||||
"profileName": "BetterRoaming",
|
||||
"iconType": "none",
|
||||
"icon": null,
|
||||
"profileClass": "operational"
|
||||
},
|
||||
{
|
||||
"iccid": "89852...",
|
||||
"isdpAid": "A0000005591010FFFFFFFF8900001300",
|
||||
"profileState": "disabled",
|
||||
"profileNickname": null,
|
||||
"serviceProviderName": "Redtea Mobile",
|
||||
"profileName": "RedteaGO",
|
||||
"iconType": "none",
|
||||
"icon": null,
|
||||
"profileClass": "operational"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
- `iccid`: ICCID of Profile
|
||||
- `isdpAid`: Aid of Profile
|
||||
- `profileState`: State of Profile, "Enabled" or "Disabled"
|
||||
- `profileNickname`: Nickname of Profile
|
||||
- `serviceProviderName`: Telecom operators of Profile
|
||||
- `profileName`: Name of Profile
|
||||
- `iconType`: Profile icon data struct, "none", "png", "jpg"
|
||||
- `icon`: Profile icon data in base64
|
||||
- `profileClass`: Type of Profile
|
||||
|
||||
</details>
|
||||
|
||||
#### notification
|
||||
|
||||
Used for the management of Notifications, which are sent by telecom operators during Profile operations. You can enumerate (list), send (process), and remove (remove) Notifications.
|
||||
|
||||
```plain
|
||||
lpac notification <subcommand> [parameters]
|
||||
subcommand:
|
||||
list Enumerates your eUICC pending Notification list
|
||||
process Send Notification
|
||||
Example: lpac notification process <sequence ID>
|
||||
remove Remove Notification
|
||||
Example: lpac notification remove <sequence ID>
|
||||
```
|
||||
|
||||
> [!NOTE]
|
||||
> Downstream developers or end users should process Notification as soon as possible when they exist to comply with GSMA specifications. lpac will not automatically delete the Notification after sending it. You can pass `-r` to `notification process` or you need to delete it manually.
|
||||
|
||||
<details>
|
||||
|
||||
<summary>Return value example of lpac notification list</summary>
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "lpa",
|
||||
"payload": {
|
||||
"code": 0,
|
||||
"message": "success",
|
||||
"data": [
|
||||
{
|
||||
"seqNumber": 178,
|
||||
"profileManagementOperation": "install",
|
||||
"notificationAddress": "rsp-eu.redteamobile.com",
|
||||
"iccid": "89852..."
|
||||
},
|
||||
{
|
||||
"seqNumber": 215,
|
||||
"profileManagementOperation": "disable",
|
||||
"notificationAddress": "cust-005-v4-prod-atl2.gdsb.net",
|
||||
"iccid": "89012..."
|
||||
},
|
||||
{
|
||||
"seqNumber": 216,
|
||||
"profileManagementOperation": "enable",
|
||||
"notificationAddress": "rsp.truphone.com",
|
||||
"iccid": "89444..."
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
- `seqNumber`: Sequence ID
|
||||
- `profileManagementOperation`: Which operation generated this notification
|
||||
- `notificationAddress`: Profile's notification reporting server address
|
||||
|
||||
</details>
|
||||
|
||||
##### Processing requires connection to server and the following optional parameters:
|
||||
|
||||
The following parameters can be used to customize the behavior of `notification process`:
|
||||
|
||||
- `-a`: Process all notifications
|
||||
- `-r`: Automatically remove processed notifications
|
||||
|
||||
##### Removing supports the following optional parameters:
|
||||
|
||||
The following parameters can be used to customize the behavior of `notification remove`:
|
||||
|
||||
- `-a`: Remove all notifications
|
||||
|
||||
#### driver
|
||||
|
||||
Now, there is only one command: `lpac driver apdu list` to get the card reader list.
|
|
@ -3,45 +3,48 @@ DEFINITIONS
|
|||
AUTOMATIC TAGS
|
||||
EXTENSIBILITY IMPLIED ::=
|
||||
BEGIN
|
||||
|
||||
|
||||
IMPORTS Certificate, CertificateList, Time FROM PKIX1Explicit88 {iso(1) identified-organization(3) dod(6) internet(1) security(5) mechanisms(5) pkix(7) id-mod(0) id-pkix1-explicit(18)}
|
||||
SubjectKeyIdentifier FROM PKIX1Implicit88 {iso(1) identified-organization(3) dod(6) internet(1) security(5) mechanisms(5) pkix(7) id-mod(0) id-pkix1-implicit(19)};
|
||||
|
||||
|
||||
id-rsp OBJECT IDENTIFIER ::= {joint-iso-itu-t(2) international-organizations(23) gsma(146) rsp(1)}
|
||||
|
||||
|
||||
-- Basic types, for size constraints
|
||||
Octet8 ::= OCTET STRING (SIZE(8))
|
||||
Octet4 ::= OCTET STRING (SIZE(4))
|
||||
Octet16 ::= OCTET STRING (SIZE(16))
|
||||
OctetTo16 ::= OCTET STRING (SIZE(1..16))
|
||||
Octet32 ::= OCTET STRING (SIZE(32))
|
||||
Octet1 ::= OCTET STRING(SIZE(1))
|
||||
Octet2 ::= OCTET STRING (SIZE(2))
|
||||
VersionType ::= OCTET STRING(SIZE(3)) -- major/minor/revision version are coded as binary value on byte 1/2/3, e.g. '02 00 0C' for v2.0.12.
|
||||
-- If revision is not used (e.g. v2.1), byte 3 SHALL be set to '00'.
|
||||
|
||||
Iccid ::= [APPLICATION 26] OCTET STRING (SIZE(10)) -- ICCID as coded in EFiccid, corresponding tag is '5A'
|
||||
RemoteOpId ::= [2] INTEGER {installBoundProfilePackage(1)}
|
||||
TransactionId ::= OCTET STRING (SIZE(1..16))
|
||||
|
||||
|
||||
-- Definition of EUICCInfo1 --------------------------
|
||||
GetEuiccInfo1Request ::= [32] SEQUENCE { -- Tag 'BF20'
|
||||
}
|
||||
|
||||
|
||||
EUICCInfo1 ::= [32] SEQUENCE { -- Tag 'BF20'
|
||||
svn [2] VersionType, -- GSMA SGP.22 version supported (SVN)
|
||||
euiccCiPKIdListForVerification [9] SEQUENCE OF SubjectKeyIdentifier, -- List of CI Public Key Identifiers supported on the eUICC for signature verification
|
||||
euiccCiPKIdListForSigning [10] SEQUENCE OF SubjectKeyIdentifier -- List of CI Public Key Identifier supported on the eUICC for signature creation
|
||||
}
|
||||
|
||||
|
||||
-- Definition of EUICCInfo2 --------------------------
|
||||
GetEuiccInfo2Request ::= [34] SEQUENCE { -- Tag 'BF22'
|
||||
}
|
||||
|
||||
|
||||
EUICCInfo2 ::= [34] SEQUENCE { -- Tag 'BF22'
|
||||
profileVersion [1] VersionType, -- SIMAlliance Profile package version supported
|
||||
svn [2] VersionType, -- GSMA SGP.22 version supported (SVN)
|
||||
euiccFirmwareVer [3] VersionType, -- eUICC Firmware version
|
||||
extCardResource [4] OCTET STRING, -- Extended Card Resource Information according to ETSI TS 102 226
|
||||
uiccCapability [5] UICCCapability,
|
||||
javacardVersion [6] VersionType OPTIONAL,
|
||||
ts102241Version [6] VersionType OPTIONAL,
|
||||
globalplatformVersion [7] VersionType OPTIONAL,
|
||||
rspCapability [8] RspCapability,
|
||||
euiccCiPKIdListForVerification [9] SEQUENCE OF SubjectKeyIdentifier, -- List of CI Public Key Identifiers supported on the eUICC for signature verification
|
||||
|
@ -57,23 +60,24 @@ EUICCInfo2 ::= [34] SEQUENCE { -- Tag 'BF22'
|
|||
sasAcreditationNumber UTF8String (SIZE(0..64)),
|
||||
certificationDataObject [12] CertificationDataObject OPTIONAL
|
||||
}
|
||||
|
||||
|
||||
-- Definition of RspCapability
|
||||
RspCapability ::= BIT STRING {
|
||||
additionalProfile(0), -- at least one more Profile can be installed
|
||||
crlSupport(1), -- CRL
|
||||
rpmSupport(2), -- Remote Profile Management
|
||||
testProfileSupport (3) -- support for test profile
|
||||
testProfileSupport (3), -- support for test profile
|
||||
deviceInfoExtensibilitySupport (4) -- support for ASN.1 extensibility in the Device Info
|
||||
}
|
||||
|
||||
|
||||
-- Definition of CertificationDataObject
|
||||
CertificationDataObject ::= SEQUENCE {
|
||||
platformLabel UTF8String, -- Platform_Label as defined in GlobalPlatform DLOA specification [57]
|
||||
platformLabel UTF8String, -- Platform_Label as defined in GlobalPlatform DLOA specification [57]
|
||||
discoveryBaseURL UTF8String -- Discovery Base URL of the SE default DLOA Registrar as defined in GlobalPlatform DLOA specification [57]
|
||||
}
|
||||
|
||||
|
||||
CertificateInfo ::= BIT STRING {
|
||||
|
||||
|
||||
reserved(0), -- eUICC has a CERT.EUICC.ECDSA in GlobalPlatform format. The use of this bit is deprecated.
|
||||
certSigningX509(1), -- eUICC has a CERT.EUICC.ECDSA in X.509 format
|
||||
rfu2(2),
|
||||
|
@ -81,42 +85,49 @@ CertificateInfo ::= BIT STRING {
|
|||
reserved2(4), -- Handling of Certificate in GlobalPlatform format. The use of this bit is deprecated.
|
||||
certVerificationX509(5)-- Handling of Certificate in X.509 format
|
||||
}
|
||||
|
||||
|
||||
-- Definition of UICCCapability
|
||||
UICCCapability ::= BIT STRING {
|
||||
/* Sequence is derived from ServicesList[] defined in SIMalliance PEDefinitions*/
|
||||
/* Sequence is derived from ServicesList[] defined in SIMalliance PEDefinitions*/
|
||||
contactlessSupport(0), -- Contactless (SWP, HCI and associated APIs)
|
||||
usimSupport(1), -- USIM as defined by 3GPP
|
||||
isimSupport(2), -- ISIM as defined by 3GPP
|
||||
csimSupport(3), -- CSIM as defined by 3GPP2
|
||||
|
||||
|
||||
akaMilenage(4), -- Milenage as AKA algorithm
|
||||
akaCave(5), -- CAVE as authentication algorithm
|
||||
akaTuak128(6), -- TUAK as AKA algorithm with 128 bit key length
|
||||
akaTuak256(7), -- TUAK as AKA algorithm with 256 bit key length
|
||||
rfu1(8), -- reserved for further algorithms
|
||||
rfu2(9), -- reserved for further algorithms
|
||||
|
||||
|
||||
gbaAuthenUsim(10), -- GBA authentication in the context of USIM
|
||||
gbaAuthenISim(11), -- GBA authentication in the context of ISIM
|
||||
mbmsAuthenUsim(12), -- MBMS authentication in the context of USIM
|
||||
eapClient(13), -- EAP client
|
||||
|
||||
|
||||
javacard(14), -- Javacard support
|
||||
multos(15), -- Multos support
|
||||
|
||||
|
||||
multipleUsimSupport(16), -- Multiple USIM applications are supported within the same Profile
|
||||
multipleIsimSupport(17), -- Multiple ISIM applications are supported within the same Profile
|
||||
multipleCsimSupport(18) -- Multiple CSIM applications are supported within the same Profile
|
||||
multipleCsimSupport(18), -- Multiple CSIM applications are supported within the same Profile
|
||||
|
||||
berTlvFileSupport(19), -- BER TLV files
|
||||
dfLinkSupport(20), -- Linked Directory Files
|
||||
catTp(21), -- Support of CAT TP
|
||||
getIdentity(22), -- Support of the GET IDENTITY command as defined in ETSI TS 102 221 [6]
|
||||
profile-a-x25519(23), -- Support of ECIES Profile A as defined in 3GPP TS 33.501 [87]
|
||||
profile-b-p256(24), -- Support of ECIES Profile B as defined in 3GPP TS 33.501 [87]
|
||||
suciCalculatorApi(25) -- Support of the associated API for SUCI derivation as defined in 3GPP 31.130 [88]
|
||||
}
|
||||
|
||||
-- Definition of DeviceInfo
|
||||
DeviceInfo ::= SEQUENCE {
|
||||
tac Octet8,
|
||||
tac Octet4,
|
||||
deviceCapabilities DeviceCapabilities,
|
||||
imei Octet8 OPTIONAL
|
||||
}
|
||||
|
||||
|
||||
DeviceCapabilities ::= SEQUENCE { -- Highest fully supported release for each definition
|
||||
-- The device SHALL set all the capabilities it supports
|
||||
gsmSupportedRelease VersionType OPTIONAL,
|
||||
|
@ -124,12 +135,14 @@ DeviceCapabilities ::= SEQUENCE { -- Highest fully supported release for each de
|
|||
cdma2000onexSupportedRelease VersionType OPTIONAL,
|
||||
cdma2000hrpdSupportedRelease VersionType OPTIONAL,
|
||||
cdma2000ehrpdSupportedRelease VersionType OPTIONAL,
|
||||
eutranSupportedRelease VersionType OPTIONAL,
|
||||
eutranEpcSupportedRelease VersionType OPTIONAL,
|
||||
contactlessSupportedRelease VersionType OPTIONAL,
|
||||
rspCrlSupportedVersion VersionType OPTIONAL,
|
||||
rspRpmSupportedVersion VersionType OPTIONAL
|
||||
nrEpcSupportedRelease VersionType OPTIONAL,
|
||||
nr5gcSupportedRelease VersionType OPTIONAL,
|
||||
eutran5gcSupportedRelease VersionType OPTIONAL
|
||||
}
|
||||
|
||||
|
||||
ProfileInfoListRequest ::= [45] SEQUENCE { -- Tag 'BF2D'
|
||||
searchCriteria [0] CHOICE {
|
||||
isdpAid [APPLICATION 15] OctetTo16, -- AID of the ISD-P, tag '4F'
|
||||
|
@ -138,13 +151,13 @@ ProfileInfoListRequest ::= [45] SEQUENCE { -- Tag 'BF2D'
|
|||
} OPTIONAL,
|
||||
tagList [APPLICATION 28] OCTET STRING OPTIONAL -- tag '5C'
|
||||
}
|
||||
|
||||
|
||||
-- Definition of ProfileInfoList
|
||||
ProfileInfoListResponse ::= [45] CHOICE { -- Tag 'BF2D'
|
||||
profileInfoListOk SEQUENCE OF ProfileInfo,
|
||||
profileInfoListError ProfileInfoListError
|
||||
}
|
||||
|
||||
|
||||
ProfileInfo ::= [PRIVATE 3] SEQUENCE { -- Tag 'E3'
|
||||
iccid Iccid OPTIONAL,
|
||||
isdpAid [APPLICATION 15] OctetTo16 OPTIONAL, -- AID of the ISD-P containing the Profile, tag '4F'
|
||||
|
@ -154,14 +167,14 @@ ProfileInfo ::= [PRIVATE 3] SEQUENCE { -- Tag 'E3'
|
|||
profileName [18] UTF8String (SIZE(0..64)) OPTIONAL, -- Tag '92'
|
||||
iconType [19] IconType OPTIONAL, -- Tag '93'
|
||||
icon [20] OCTET STRING (SIZE(0..1024)) OPTIONAL, -- Tag '94', see condition in ES10c:GetProfilesInfo
|
||||
profileClass [21] ProfileClass DEFAULT operational, -- Tag '95'
|
||||
profileClass [21] ProfileClass OPTIONAL, -- Tag '95'
|
||||
notificationConfigurationInfo [22] SEQUENCE OF NotificationConfigurationInformation OPTIONAL, -- Tag 'B6'
|
||||
profileOwner [23] OperatorID OPTIONAL, -- Tag 'B7'
|
||||
profileOwner [23] OperatorId OPTIONAL, -- Tag 'B7'
|
||||
dpProprietaryData [24] DpProprietaryData OPTIONAL, -- Tag 'B8'
|
||||
profilePolicyRules [25] PprIds OPTIONAL, -- Tag '99'
|
||||
refArDo [118] SEQUENCE OF RefArDo OPTIONAL -- Tag 'BF76'
|
||||
}
|
||||
|
||||
|
||||
RefArDo ::= [PRIVATE 2] SEQUENCE { -- Tag 'E2'
|
||||
refDo [PRIVATE 1] SEQUENCE { -- Tag 'E1'
|
||||
deviceAppIdRefDo [PRIVATE 1] OCTET STRING (SIZE(20|32)), -- Tag 'C1'
|
||||
|
@ -171,52 +184,51 @@ RefArDo ::= [PRIVATE 2] SEQUENCE { -- Tag 'E2'
|
|||
permArDo [PRIVATE 27] OCTET STRING (SIZE(8)) -- Tag 'DB'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
PprIds ::= BIT STRING {-- Definition of Profile Policy Rules identifiers
|
||||
pprUpdateControl(0), -- defines how to update PPRs via ES6
|
||||
ppr1(1), -- Indicator for PPR1 'Disabling of this Profile is not allowed'
|
||||
ppr2(2), -- Indicator for PPR2 'Deletion of this Profile is not allowed'
|
||||
ppr3(3) -- Indicator for PPR3 'Deletion of this Profile is required upon its successful disabling'
|
||||
ppr2(2) -- Indicator for PPR2 'Deletion of this Profile is not allowed'
|
||||
}
|
||||
|
||||
OperatorID ::= SEQUENCE {
|
||||
|
||||
OperatorId ::= SEQUENCE {
|
||||
mccMnc OCTET STRING (SIZE(3)), -- MCC and MNC coded as defined in 3GPP TS 24.008 [32]
|
||||
gid1 OCTET STRING OPTIONAL, -- referring to content of EF GID1 (file identifier '6F3E') as defined in 3GPP TS 31.102 [54]
|
||||
gid2 OCTET STRING OPTIONAL -- referring to content of EF GID2 (file identifier '6F3F') as defined in 3GPP TS 31.102 [54]
|
||||
}
|
||||
|
||||
|
||||
ProfileInfoListError ::= INTEGER {incorrectInputValues(1), undefinedError(127)}
|
||||
|
||||
|
||||
-- Definition of StoreMetadata request
|
||||
|
||||
|
||||
StoreMetadataRequest ::= [37] SEQUENCE { -- Tag 'BF25'
|
||||
iccid Iccid,
|
||||
serviceProviderName [17] UTF8String (SIZE(0..32)), -- Tag '91'
|
||||
profileName [18] UTF8String (SIZE(0..64)), -- Tag '92' (corresponds to 'Short Description' defined in SGP.21 [2])
|
||||
iconType [19] IconType OPTIONAL, -- Tag '93' (JPG or PNG)
|
||||
icon [20] OCTET STRING (SIZE(0..1024)) OPTIONAL, -- Tag '94'(Data of the icon. Size 64 x 64 pixel. This field SHALL only be present if iconType is present)
|
||||
profileClass [21] ProfileClass OPTIONAL, -- Tag '95' (default if absent: 'operational')
|
||||
profileClass [21] ProfileClass DEFAULT operational, -- Tag '95'
|
||||
notificationConfigurationInfo [22] SEQUENCE OF NotificationConfigurationInformation OPTIONAL,
|
||||
profileOwner [23] OperatorID OPTIONAL, -- Tag 'B7'
|
||||
profileOwner [23] OperatorId OPTIONAL, -- Tag 'B7'
|
||||
profilePolicyRules [25] PprIds OPTIONAL -- Tag '99'
|
||||
}
|
||||
|
||||
|
||||
NotificationEvent ::= BIT STRING {
|
||||
notificationInstall (0),
|
||||
notificationEnable(1),
|
||||
notificationDisable(2),
|
||||
notificationDelete(3)
|
||||
}
|
||||
|
||||
|
||||
NotificationConfigurationInformation ::= SEQUENCE {
|
||||
profileManagementOperation NotificationEvent,
|
||||
notificationAddress UTF8String -- FQDN to forward the notification
|
||||
}
|
||||
|
||||
|
||||
IconType ::= INTEGER {jpg(0), png(1)}
|
||||
ProfileState ::= INTEGER {disabled(0), enabled(1)}
|
||||
ProfileClass ::= INTEGER {test(0), provisioning(1), operational(2)}
|
||||
|
||||
|
||||
-- Definition of UpdateMetadata request
|
||||
UpdateMetadataRequest ::= [42] SEQUENCE { -- Tag 'BF2A'
|
||||
serviceProviderName [17] UTF8String (SIZE(0..32)) OPTIONAL, -- Tag '91'
|
||||
|
@ -225,7 +237,7 @@ UpdateMetadataRequest ::= [42] SEQUENCE { -- Tag 'BF2A'
|
|||
icon [20] OCTET STRING (SIZE(0..1024)) OPTIONAL, -- Tag '94'
|
||||
profilePolicyRules [25] PprIds OPTIONAL -- Tag '99'
|
||||
}
|
||||
|
||||
|
||||
-- Definition of data objects for command PrepareDownload -------------------------
|
||||
PrepareDownloadRequest ::= [33] SEQUENCE { -- Tag 'BF21'
|
||||
smdpSigned2 SmdpSigned2, -- Signed information
|
||||
|
@ -233,73 +245,73 @@ PrepareDownloadRequest ::= [33] SEQUENCE { -- Tag 'BF21'
|
|||
hashCc Octet32 OPTIONAL, -- Hash of confirmation code
|
||||
smdpCertificate Certificate -- CERT.DPpb.ECDSA
|
||||
}
|
||||
|
||||
|
||||
SmdpSigned2 ::= SEQUENCE {
|
||||
transactionId [0] TransactionId, -- The TransactionID generated by the SM DP+
|
||||
transactionId [0] TransactionId, -- The TransactionID generated by the SM-DP+
|
||||
ccRequiredFlag BOOLEAN, --Indicates if the Confirmation Code is required
|
||||
bppEuiccOtpk [APPLICATION 73] OCTET STRING OPTIONAL -- otPK.EUICC.ECKA already used for binding the BPP, tag '5F49'
|
||||
}
|
||||
|
||||
|
||||
PrepareDownloadResponse ::= [33] CHOICE { -- Tag 'BF21'
|
||||
downloadResponseOk PrepareDownloadResponseOk,
|
||||
downloadResponseError PrepareDownloadResponseError
|
||||
}
|
||||
|
||||
|
||||
PrepareDownloadResponseOk ::= SEQUENCE {
|
||||
euiccSigned2 EUICCSigned2, -- Signed information
|
||||
euiccSignature2 [APPLICATION 55] OCTET STRING -- tag '5F37'
|
||||
}
|
||||
|
||||
|
||||
EUICCSigned2 ::= SEQUENCE {
|
||||
transactionId [0] TransactionId,
|
||||
euiccOtpk [APPLICATION 73] OCTET STRING, -- otPK.EUICC.ECKA, tag '5F49'
|
||||
hashCc Octet32 OPTIONAL -- Hash of confirmation code
|
||||
}
|
||||
|
||||
|
||||
PrepareDownloadResponseError ::= SEQUENCE {
|
||||
transactionId [0] TransactionId,
|
||||
downloadErrorCode DownloadErrorCode
|
||||
}
|
||||
|
||||
|
||||
DownloadErrorCode ::= INTEGER {invalidCertificate(1), invalidSignature(2), unsupportedCurve(3), noSessionContext(4), invalidTransactionId(5), undefinedError(127)}
|
||||
|
||||
|
||||
-- Definition of data objects for command AuthenticateServer--------------------
|
||||
AuthenticateServerRequest ::= [56] SEQUENCE { -- Tag 'BF38'
|
||||
serverSigned1 ServerSigned1, -- Signed information
|
||||
serverSignature1 [APPLICATION 55] OCTET STRING, -- tag ?5F37?
|
||||
serverSignature1 [APPLICATION 55] OCTET STRING, -- tag ‘5F37’
|
||||
euiccCiPKIdToBeUsed SubjectKeyIdentifier, -- CI Public Key Identifier to be used
|
||||
serverCertificate Certificate, -- RSP Server Certificate CERT.XXauth.ECDSA
|
||||
ctxParams1 CtxParams1
|
||||
}
|
||||
|
||||
|
||||
ServerSigned1 ::= SEQUENCE {
|
||||
transactionId [0] TransactionId, -- The Transaction ID generated by the RSP Server
|
||||
euiccChallenge [1] Octet16, -- The eUICC Challenge
|
||||
serverAddress [3] UTF8String, -- The RSP Server address
|
||||
serverChallenge [4] Octet16 -- The RSP Server Challenge
|
||||
}
|
||||
|
||||
|
||||
CtxParams1 ::= CHOICE {
|
||||
ctxParamsForCommonAuthentication CtxParamsForCommonAuthentication -- New contextual data objects may be defined for extensibility
|
||||
ctxParamsForCommonAuthentication CtxParamsForCommonAuthentication -- New contextual data objects MAY be defined for extensibility
|
||||
}
|
||||
|
||||
|
||||
CtxParamsForCommonAuthentication ::= SEQUENCE {
|
||||
matchingId UTF8String OPTIONAL,-- The MatchingId could be the Activation code token or EventID or empty
|
||||
deviceInfo DeviceInfo -- The Device information
|
||||
}
|
||||
|
||||
|
||||
AuthenticateServerResponse ::= [56] CHOICE { -- Tag 'BF38'
|
||||
authenticateResponseOk AuthenticateResponseOk,
|
||||
authenticateResponseError AuthenticateResponseError
|
||||
}
|
||||
|
||||
|
||||
AuthenticateResponseOk ::= SEQUENCE {
|
||||
euiccSigned1 EuiccSigned1, -- Signed information
|
||||
euiccSignature1 [APPLICATION 55] OCTET STRING, --EUICC_Sign1, tag 5F37
|
||||
euiccCertificate Certificate, -- eUICC Certificate (CERT.EUICC.ECDSA) signed by the EUM
|
||||
eumCertificate Certificate -- EUM Certificate (CERT.EUM.ECDSA) signed by the requested CI
|
||||
}
|
||||
|
||||
|
||||
EuiccSigned1 ::= SEQUENCE {
|
||||
transactionId [0] TransactionId,
|
||||
serverAddress [3] UTF8String,
|
||||
|
@ -307,96 +319,86 @@ EuiccSigned1 ::= SEQUENCE {
|
|||
euiccInfo2 [34] EUICCInfo2,
|
||||
ctxParams1 CtxParams1
|
||||
}
|
||||
|
||||
|
||||
AuthenticateResponseError ::= SEQUENCE {
|
||||
transactionId [0] TransactionId,
|
||||
authenticateErrorCode AuthenticateErrorCode
|
||||
}
|
||||
|
||||
|
||||
AuthenticateErrorCode ::= INTEGER {invalidCertificate(1), invalidSignature(2), unsupportedCurve(3), noSessionContext(4), invalidOid(5), euiccChallengeMismatch(6), ciPKUnknown(7), undefinedError(127)}
|
||||
|
||||
|
||||
-- Definition of Cancel Session------------------------------
|
||||
CancelSessionRequest ::= [65] SEQUENCE { -- Tag 'BF41'
|
||||
transactionId TransactionId, -- The TransactionID generated by the RSP Server
|
||||
reason CancelSessionReason
|
||||
}
|
||||
|
||||
CancelSessionReason ::= INTEGER {endUserRejection(0), postponed(1), timeout(2), pprNotAllowed(3)}
|
||||
|
||||
|
||||
CancelSessionReason ::= INTEGER {endUserRejection(0), postponed(1), timeout(2), pprNotAllowed(3), metadataMismatch(4), loadBppExecutionError(5), undefinedReason(127)}
|
||||
|
||||
CancelSessionResponse ::= [65] CHOICE { -- Tag 'BF41'
|
||||
cancelSessionResponseOk CancelSessionResponseOk,
|
||||
cancelSessionResponseError INTEGER {invalidTransactionId(5), undefinedError(127)}
|
||||
}
|
||||
|
||||
|
||||
CancelSessionResponseOk ::= SEQUENCE {
|
||||
euiccCancelSessionSigned EuiccCancelSessionSigned, -- Signed information
|
||||
euiccCancelSessionSignature [APPLICATION 55] OCTET STRING -- tag '5F37
|
||||
}
|
||||
|
||||
|
||||
EuiccCancelSessionSigned ::= SEQUENCE {
|
||||
transactionId TransactionId,
|
||||
smdpOid OBJECT IDENTIFIER, -- SM-DP+ OID as contained in CERT.DPauth.ECDSA
|
||||
reason CancelSessionReason
|
||||
}
|
||||
|
||||
-- asn1c caused some bug when process nested id, so workaround here
|
||||
BoundProfilePackageTLV87 ::= [7] OCTET STRING
|
||||
BoundProfilePackageTLV88 ::= [8] OCTET STRING
|
||||
BoundProfilePackageTLV86 ::= [6] OCTET STRING
|
||||
|
||||
SeqBoundProfilePackageTLV87 ::= [0] SEQUENCE OF BoundProfilePackageTLV87
|
||||
SeqBoundProfilePackageTLV88 ::= [1] SEQUENCE OF BoundProfilePackageTLV88
|
||||
SeqSecondBoundProfilePackageTLV87 ::= [2] SEQUENCE OF BoundProfilePackageTLV87
|
||||
SeqBoundProfilePackageTLV86 ::= [3] SEQUENCE OF BoundProfilePackageTLV86
|
||||
|
||||
-- Definition of Bound Profile Package --------------------------
|
||||
BoundProfilePackage ::= [54] SEQUENCE { -- Tag 'BF36'
|
||||
initialiseSecureChannelRequest [35] InitialiseSecureChannelRequest, -- Tag 'BF23'
|
||||
firstSequenceOf87 SeqBoundProfilePackageTLV87, -- sequence of '87' TLVs
|
||||
sequenceOf88 SeqBoundProfilePackageTLV88, -- sequence of '88' TLVs
|
||||
secondSequenceOf87 SeqSecondBoundProfilePackageTLV87 OPTIONAL, -- sequence of '87' TLVs
|
||||
sequenceOf86 SeqBoundProfilePackageTLV86 -- sequence of '86' TLVs
|
||||
firstSequenceOf87 [0] SEQUENCE OF [7] OCTET STRING, -- sequence of '87' TLVs
|
||||
sequenceOf88 [1] SEQUENCE OF [8] OCTET STRING, -- sequence of '88' TLVs
|
||||
secondSequenceOf87 [2] SEQUENCE OF [7] OCTET STRING OPTIONAL, -- sequence of '87' TLVs
|
||||
sequenceOf86 [3] SEQUENCE OF [6] OCTET STRING -- sequence of '86' TLVs
|
||||
}
|
||||
|
||||
|
||||
-- Definition of Get eUICC Challenge --------------------------
|
||||
GetEuiccChallengeRequest ::= [46] SEQUENCE { -- Tag 'BF2E'
|
||||
}
|
||||
|
||||
|
||||
GetEuiccChallengeResponse ::= [46] SEQUENCE { -- Tag 'BF2E'
|
||||
euiccChallenge Octet16 -- random eUICC challenge
|
||||
}
|
||||
|
||||
-- Definition of Profile Installation Resulceipt
|
||||
|
||||
-- Definition of Profile Installation Result
|
||||
ProfileInstallationResult ::= [55] SEQUENCE { -- Tag 'BF37'
|
||||
profileInstallationResultData [39] ProfileInstallationResultData,
|
||||
euiccSignPIR EuiccSignPIR
|
||||
}
|
||||
|
||||
|
||||
ProfileInstallationResultData ::= [39] SEQUENCE { -- Tag 'BF27'
|
||||
transactionId[0] TransactionId, -- The TransactionID generated by the SM-DP+
|
||||
notificationMetadata[47] NotificationMetadata,
|
||||
smdpOid OBJECT IDENTIFIER OPTIONAL, -- SM-DP+ OID (same value as in CERT.DPpb.ECDSA)
|
||||
smdpOid OBJECT IDENTIFIER, -- SM-DP+ OID (same value as in CERT.DPpb.ECDSA)
|
||||
finalResult [2] CHOICE {
|
||||
successResult SuccessResult,
|
||||
errorResult ErrorResult
|
||||
}
|
||||
}
|
||||
|
||||
EuiccSignPIR ::= [APPLICATION 55] OCTET STRING -- Tag '5F37', eUICC?s signature
|
||||
|
||||
|
||||
EuiccSignPIR ::= [APPLICATION 55] OCTET STRING -- Tag '5F37', eUICC’s signature
|
||||
|
||||
SuccessResult ::= SEQUENCE {
|
||||
aid [APPLICATION 15] OCTET STRING (SIZE (5..16)), -- AID of ISD-P
|
||||
simaResponse OCTET STRING -- contains (multiple) 'EUICCResponse' as defined in [5]
|
||||
}
|
||||
|
||||
|
||||
ErrorResult ::= SEQUENCE {
|
||||
bppCommandId BppCommandId,
|
||||
errorReason ErrorReason,
|
||||
simaResponse OCTET STRING OPTIONAL -- contains (multiple) 'EUICCResponse' as defined in [5]
|
||||
}
|
||||
|
||||
|
||||
BppCommandId ::= INTEGER {initialiseSecureChannel(0), configureISDP(1), storeMetadata(2), storeMetadata2(3), replaceSessionKeys(4), loadProfileElements(5)}
|
||||
|
||||
|
||||
ErrorReason ::= INTEGER {
|
||||
incorrectInputValues(1),
|
||||
invalidSignature(2),
|
||||
|
@ -409,44 +411,44 @@ ErrorReason ::= INTEGER {
|
|||
installFailedDueToIccidAlreadyExistsOnEuicc(9), installFailedDueToInsufficientMemoryForProfile(10),
|
||||
installFailedDueToInterruption(11),
|
||||
installFailedDueToPEProcessingError (12),
|
||||
installFailedDueToIccidMismatch(13),
|
||||
installFailedDueToDataMismatch(13),
|
||||
testProfileInstallFailedDueToInvalidNaaKey(14),
|
||||
pprNotAllowed(15),
|
||||
installFailedDueToUnknownError(127)
|
||||
}
|
||||
|
||||
|
||||
ListNotificationRequest ::= [40] SEQUENCE { -- Tag 'BF28'
|
||||
profileManagementOperation [1] NotificationEvent OPTIONAL
|
||||
}
|
||||
|
||||
|
||||
ListNotificationResponse ::= [40] CHOICE { -- Tag 'BF28'
|
||||
notificationMetadataList SEQUENCE OF NotificationMetadata,
|
||||
listNotificationsResultError INTEGER {undefinedError(127)}
|
||||
}
|
||||
|
||||
|
||||
NotificationMetadata ::= [47] SEQUENCE { -- Tag 'BF2F'
|
||||
seqNumber [0] INTEGER,
|
||||
profileManagementOperation [1] NotificationEvent, --Only one bit set to 1
|
||||
profileManagementOperation [1] NotificationEvent, --Only one bit SHALL be set to 1
|
||||
notificationAddress UTF8String, -- FQDN to forward the notification
|
||||
iccid Iccid OPTIONAL
|
||||
}
|
||||
|
||||
|
||||
-- Definition of Profile Nickname Information
|
||||
SetNicknameRequest ::= [41] SEQUENCE { -- Tag 'BF29'
|
||||
iccid Iccid,
|
||||
profileNickname [16] UTF8String (SIZE(0..64))
|
||||
}
|
||||
|
||||
|
||||
SetNicknameResponse ::= [41] SEQUENCE { -- Tag 'BF29'
|
||||
setNicknameResult INTEGER {ok(0), iccidNotFound (1), undefinedError(127)}
|
||||
}
|
||||
|
||||
|
||||
id-rsp-cert-objects OBJECT IDENTIFIER ::= { id-rsp cert-objects(2)}
|
||||
|
||||
|
||||
id-rspExt OBJECT IDENTIFIER ::= {id-rsp-cert-objects 0}
|
||||
|
||||
|
||||
id-rspRole OBJECT IDENTIFIER ::= {id-rsp-cert-objects 1}
|
||||
|
||||
|
||||
-- Definition of OIDs for role identification
|
||||
id-rspRole-ci OBJECT IDENTIFIER ::= {id-rspRole 0}
|
||||
id-rspRole-euicc OBJECT IDENTIFIER ::= {id-rspRole 1}
|
||||
|
@ -456,7 +458,7 @@ id-rspRole-dp-auth OBJECT IDENTIFIER ::= {id-rspRole 4}
|
|||
id-rspRole-dp-pb OBJECT IDENTIFIER ::= {id-rspRole 5}
|
||||
id-rspRole-ds-tls OBJECT IDENTIFIER ::= {id-rspRole 6}
|
||||
id-rspRole-ds-auth OBJECT IDENTIFIER ::= {id-rspRole 7}
|
||||
|
||||
|
||||
--Definition of data objects for InitialiseSecureChannel Request
|
||||
InitialiseSecureChannelRequest ::= [35] SEQUENCE { -- Tag 'BF23'
|
||||
remoteOpId RemoteOpId, -- Remote Operation Type Identifier (value SHALL be set to installBoundProfilePackage)
|
||||
|
@ -465,23 +467,23 @@ InitialiseSecureChannelRequest ::= [35] SEQUENCE { -- Tag 'BF23'
|
|||
smdpOtpk [APPLICATION 73] OCTET STRING, ---otPK.DP.ECKA as specified in GlobalPlatform Card Specification [8] section 6.4.2.3 for ePK.OCE.ECKA, tag '5F49'
|
||||
smdpSign [APPLICATION 55] OCTET STRING -- SM-DP's signature, tag '5F37'
|
||||
}
|
||||
|
||||
|
||||
ControlRefTemplate ::= SEQUENCE {
|
||||
keyType[0] Octet1, -- Key type according to GlobalPlatform Card Specification [8] Table 11-16, AES= '88', Tag '80'
|
||||
keyLen[1] Octet1, --Key length in number of bytes. For current specification key length SHALL by 0x10 bytes, Tag '81'
|
||||
hostId[4] OctetTo16 -- Host ID value , Tag '84'
|
||||
keyType[0] Octet1, -- Key type according to GlobalPlatform Card Specification [8] Table 11-16, AES= '88', Tag '80'
|
||||
keyLen[1] Octet1, --Key length in number of bytes. For current specification key length SHALL by 0x10 bytes, Tag '81'
|
||||
hostId[4] OctetTo16 -- Host ID value , Tag '84'
|
||||
}
|
||||
|
||||
|
||||
--Definition of data objects for ConfigureISDPRequest
|
||||
ConfigureISDPRequest ::= [36] SEQUENCE { -- Tag 'BF24'
|
||||
dpProprietaryData [24] DpProprietaryData OPTIONAL -- Tag 'B8'
|
||||
}
|
||||
|
||||
|
||||
DpProprietaryData ::= SEQUENCE { -- maximum size including tag and length field: 128 bytes
|
||||
dpOid OBJECT IDENTIFIER -- OID in the tree of the SM-DP+ that created the Profile
|
||||
-- additional data objects defined by the SM-DP+ MAY follow
|
||||
-- additional data objects defined by the SM-DP+ MAY follow
|
||||
}
|
||||
|
||||
|
||||
-- Definition of request message for command ReplaceSessionKeys
|
||||
ReplaceSessionKeysRequest ::= [38] SEQUENCE { -- tag 'BF26'
|
||||
/*The new initial MAC chaining value*/
|
||||
|
@ -491,7 +493,7 @@ ReplaceSessionKeysRequest ::= [38] SEQUENCE { -- tag 'BF26'
|
|||
/*New session key value of the session key C-MAC computation/verification (PPK-MAC)*/
|
||||
ppkCmac OCTET STRING
|
||||
}
|
||||
|
||||
|
||||
-- Definition of data objects for RetrieveNotificationsList
|
||||
RetrieveNotificationsListRequest ::= [43] SEQUENCE { -- Tag 'BF2B'
|
||||
searchCriteria CHOICE {
|
||||
|
@ -499,33 +501,33 @@ RetrieveNotificationsListRequest ::= [43] SEQUENCE { -- Tag 'BF2B'
|
|||
profileManagementOperation [1] NotificationEvent
|
||||
} OPTIONAL
|
||||
}
|
||||
|
||||
|
||||
RetrieveNotificationsListResponse ::= [43] CHOICE { -- Tag 'BF2B'
|
||||
notificationList SEQUENCE OF PendingNotification,
|
||||
notificationsListResultError INTEGER {noResultAvailable(1), undefinedError(127)}
|
||||
}
|
||||
|
||||
|
||||
PendingNotification ::= CHOICE {
|
||||
profileInstallationResult [55] ProfileInstallationResult, -- tag 'BF37'
|
||||
otherSignedNotification OtherSignedNotification
|
||||
}
|
||||
|
||||
|
||||
OtherSignedNotification ::= SEQUENCE {
|
||||
tbsOtherNotification NotificationMetadata,
|
||||
euiccNotificationSignature [APPLICATION 55] OCTET STRING, -- eUICC signature of tbsOtherNotification, Tag '5F37'
|
||||
euiccCertificate Certificate, -- eUICC Certificate (CERT.EUICC.ECDSA) signed by the EUM
|
||||
eumCertificate Certificate -- EUM Certificate (CERT.EUM.ECDSA) signed by the requested CI
|
||||
}
|
||||
|
||||
|
||||
-- Definition of notificationSent
|
||||
NotificationSentRequest ::= [48] SEQUENCE { -- Tag 'BF30'
|
||||
seqNumber [0] INTEGER
|
||||
}
|
||||
|
||||
|
||||
NotificationSentResponse ::= [48] SEQUENCE { -- Tag 'BF30'
|
||||
deleteNotificationStatus INTEGER {ok(0), nothingToDelete(1), undefinedError(127)}
|
||||
}
|
||||
|
||||
|
||||
-- Definition of Enable Profile --------------------------
|
||||
EnableProfileRequest ::= [49] SEQUENCE { -- Tag 'BF31'
|
||||
profileIdentifier CHOICE {
|
||||
|
@ -534,11 +536,11 @@ EnableProfileRequest ::= [49] SEQUENCE { -- Tag 'BF31'
|
|||
},
|
||||
refreshFlag BOOLEAN -- indicating whether REFRESH is required
|
||||
}
|
||||
|
||||
|
||||
EnableProfileResponse ::= [49] SEQUENCE { -- Tag 'BF31'
|
||||
enableResult INTEGER {ok(0), iccidOrAidNotFound (1), profileNotInDisabledState(2), disallowedByPolicy(3), wrongProfileReenabling(4), undefinedError(127)}
|
||||
enableResult INTEGER {ok(0), iccidOrAidNotFound (1), profileNotInDisabledState(2), disallowedByPolicy(3), wrongProfileReenabling(4), catBusy(5), undefinedError(127)}
|
||||
}
|
||||
|
||||
|
||||
-- Definition of Disable Profile --------------------------
|
||||
DisableProfileRequest ::= [50] SEQUENCE { -- Tag 'BF32'
|
||||
profileIdentifier CHOICE {
|
||||
|
@ -547,21 +549,21 @@ DisableProfileRequest ::= [50] SEQUENCE { -- Tag 'BF32'
|
|||
},
|
||||
refreshFlag BOOLEAN -- indicating whether REFRESH is required
|
||||
}
|
||||
|
||||
|
||||
DisableProfileResponse ::= [50] SEQUENCE { -- Tag 'BF32'
|
||||
disableResult INTEGER {ok(0), iccidOrAidNotFound (1), profileNotInEnabledState(2), disallowedByPolicy(3), undefinedError(127)}
|
||||
disableResult INTEGER {ok(0), iccidOrAidNotFound (1), profileNotInEnabledState(2), disallowedByPolicy(3), catBusy(5), undefinedError(127)}
|
||||
}
|
||||
|
||||
|
||||
-- Definition of Delete Profile --------------------------
|
||||
DeleteProfileRequest ::= [51] CHOICE { -- Tag 'BF33'
|
||||
isdpAid [APPLICATION 15] OctetTo16, -- AID, tag '4F'
|
||||
iccid Iccid -- ICCID, tag '5A'
|
||||
}
|
||||
|
||||
|
||||
DeleteProfileResponse ::= [51] SEQUENCE { -- Tag 'BF33'
|
||||
deleteResult INTEGER {ok(0), iccidOrAidNotFound (1), profileNotInDisabledState(2), disallowedByPolicy(3), undefinedError(127)}
|
||||
}
|
||||
|
||||
|
||||
-- Definition of Memory Reset --------------------------
|
||||
EuiccMemoryResetRequest ::= [52] SEQUENCE { -- Tag 'BF34'
|
||||
resetOptions [2] BIT STRING {
|
||||
|
@ -569,70 +571,70 @@ EuiccMemoryResetRequest ::= [52] SEQUENCE { -- Tag 'BF34'
|
|||
deleteFieldLoadedTestProfiles(1),
|
||||
resetDefaultSmdpAddress(2)}
|
||||
}
|
||||
|
||||
|
||||
EuiccMemoryResetResponse ::= [52] SEQUENCE { -- Tag 'BF34'
|
||||
resetResult INTEGER {ok(0), nothingToDelete(1), undefinedError(127)}
|
||||
resetResult INTEGER {ok(0), nothingToDelete(1), catBusy(5), undefinedError(127)}
|
||||
}
|
||||
|
||||
|
||||
-- Definition of Get EID --------------------------
|
||||
GetEuiccDataRequest ::= [62] SEQUENCE { -- Tag 'BF3E'
|
||||
tagList [APPLICATION 28] Octet1 -- tag '5C', the value SHALL be set to '5A'
|
||||
}
|
||||
|
||||
|
||||
GetEuiccDataResponse ::= [62] SEQUENCE { -- Tag 'BF3E'
|
||||
eidValue [APPLICATION 26] Octet16 -- tag '5A'
|
||||
}
|
||||
|
||||
|
||||
-- Definition of Get Rat
|
||||
|
||||
|
||||
GetRatRequest ::= [67] SEQUENCE { -- Tag ' BF43'
|
||||
-- No input data
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
GetRatResponse ::= [67] SEQUENCE { -- Tag 'BF43'
|
||||
rat RulesAuthorisationTable
|
||||
}
|
||||
|
||||
|
||||
RulesAuthorisationTable ::= SEQUENCE OF ProfilePolicyAuthorisationRule
|
||||
ProfilePolicyAuthorisationRule ::= SEQUENCE {
|
||||
pprIds PprIds,
|
||||
allowedOperators SEQUENCE OF OperatorID,
|
||||
allowedOperators SEQUENCE OF OperatorId,
|
||||
pprFlags BIT STRING {consentRequired(0)}
|
||||
}
|
||||
|
||||
|
||||
-- Definition of data structure containing the list of CRL segments
|
||||
SegmentedCrlList ::= SEQUENCE OF CertificateList
|
||||
-- Definition of data structure command for loading a CRL
|
||||
LoadCRLRequest ::= [53] SEQUENCE { -- Tag 'BF35'
|
||||
-- A CRL-A
|
||||
-- A CRL
|
||||
crl CertificateList
|
||||
}
|
||||
|
||||
|
||||
-- Definition of data structure response for loading a CRL
|
||||
LoadCRLResponse ::= [53] CHOICE { -- Tag 'BF35'
|
||||
loadCRLResponseOk LoadCRLResponseOk,
|
||||
loadCRLResponseError LoadCRLResponseError
|
||||
}
|
||||
|
||||
|
||||
LoadCRLResponseOk ::= SEQUENCE {
|
||||
missingParts SEQUENCE OF SEQUENCE {
|
||||
number INTEGER (0..MAX)
|
||||
} OPTIONAL
|
||||
missingParts SEQUENCE OF INTEGER OPTIONAL
|
||||
}
|
||||
LoadCRLResponseError ::= INTEGER {invalidSignature(1), invalidCRLFormat(2), notEnoughMemorySpace(3), verificationKeyNotFound(4), undefinedError(127)}
|
||||
|
||||
LoadCRLResponseError ::= INTEGER {invalidSignature(1), invalidCRLFormat(2), notEnoughMemorySpace(3), verificationKeyNotFound(4), fresherCrlAlreadyLoaded(5), baseCrlMissing(6), undefinedError(127)}
|
||||
|
||||
-- Definition of the extension for Certificate Expiration Date
|
||||
id-rsp-expDate OBJECT IDENTIFIER ::= {id-rspExt 1}
|
||||
ExpirationDate ::= Time
|
||||
|
||||
|
||||
-- Definition of the extension id for total partial-CRL number
|
||||
id-rsp-totalPartialCrlNumber OBJECT IDENTIFIER ::= {id-rspExt 2}
|
||||
TotalPartialCrlNumber ::= INTEGER
|
||||
|
||||
|
||||
|
||||
|
||||
-- Definition of the extension id for the partial-CRL number
|
||||
id-rsp-partialCrlNumber OBJECT IDENTIFIER ::= {id-rspExt 3}
|
||||
PartialCrlNumber ::= INTEGER
|
||||
|
||||
|
||||
-- Definition for ES9+ ASN.1 Binding --------------------------
|
||||
RemoteProfileProvisioningRequest ::= [2] CHOICE { -- Tag 'A2'
|
||||
initiateAuthenticationRequest [57] InitiateAuthenticationRequest, -- Tag 'BF39'
|
||||
|
@ -641,7 +643,7 @@ RemoteProfileProvisioningRequest ::= [2] CHOICE { -- Tag 'A2'
|
|||
cancelSessionRequestEs9 [65] CancelSessionRequestEs9, -- Tag 'BF41'
|
||||
handleNotification [61] HandleNotification -- tag 'BF3D'
|
||||
}
|
||||
|
||||
|
||||
RemoteProfileProvisioningResponse ::= [2] CHOICE { -- Tag 'A2'
|
||||
initiateAuthenticationResponse [57] InitiateAuthenticationResponse, -- Tag 'BF39'
|
||||
authenticateClientResponseEs9 [59] AuthenticateClientResponseEs9, -- Tag 'BF3B'
|
||||
|
@ -649,13 +651,13 @@ RemoteProfileProvisioningResponse ::= [2] CHOICE { -- Tag 'A2'
|
|||
cancelSessionResponseEs9 [65] CancelSessionResponseEs9, -- Tag 'BF41'
|
||||
authenticateClientResponseEs11 [64] AuthenticateClientResponseEs11 -- Tag 'BF40'
|
||||
}
|
||||
|
||||
|
||||
InitiateAuthenticationRequest ::= [57] SEQUENCE { -- Tag 'BF39'
|
||||
euiccChallenge [1] Octet16, -- random eUICC challenge
|
||||
smdpAddress [3] UTF8String,
|
||||
euiccInfo1 EUICCInfo1
|
||||
}
|
||||
|
||||
|
||||
InitiateAuthenticationResponse ::= [57] CHOICE { -- Tag 'BF39'
|
||||
initiateAuthenticationOk InitiateAuthenticationOkEs9,
|
||||
initiateAuthenticationError INTEGER {
|
||||
|
@ -664,7 +666,7 @@ InitiateAuthenticationResponse ::= [57] CHOICE { -- Tag 'BF39'
|
|||
ciPKNotSupported(3)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
InitiateAuthenticationOkEs9 ::= SEQUENCE {
|
||||
transactionId [0] TransactionId, -- The TransactionID generated by the SM-DP+
|
||||
serverSigned1 ServerSigned1, -- Signed information
|
||||
|
@ -672,12 +674,12 @@ InitiateAuthenticationOkEs9 ::= SEQUENCE {
|
|||
euiccCiPKIdToBeUsed SubjectKeyIdentifier, -- The curve CI Public Key to be used as required by ES10b.AuthenticateServer
|
||||
serverCertificate Certificate
|
||||
}
|
||||
|
||||
|
||||
AuthenticateClientRequest ::= [59] SEQUENCE { -- Tag 'BF3B'
|
||||
transactionId [0] TransactionId,
|
||||
authenticateServerResponse [56] AuthenticateServerResponse -- This is the response from ES10b.AuthenticateServer
|
||||
}
|
||||
|
||||
|
||||
AuthenticateClientResponseEs9 ::= [59] CHOICE { -- Tag 'BF3B'
|
||||
authenticateClientOk AuthenticateClientOk,
|
||||
authenticateClientError INTEGER {
|
||||
|
@ -691,21 +693,24 @@ AuthenticateClientResponseEs9 ::= [59] CHOICE { -- Tag 'BF3B'
|
|||
noEligibleProfile(8),
|
||||
ciPKUnknown(9),
|
||||
invalidTransactionId(10),
|
||||
insufficientMemory(11),
|
||||
undefinedError(127)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
AuthenticateClientOk ::= SEQUENCE {
|
||||
transactionId [0] TransactionId,
|
||||
profileMetaData [37] StoreMetadataRequest,
|
||||
prepareDownloadRequest [33] PrepareDownloadRequest
|
||||
smdpSigned2 SmdpSigned2, -- Signed information
|
||||
smdpSignature2 [APPLICATION 55] OCTET STRING, -- tag '5F37'
|
||||
smdpCertificate Certificate -- CERT.DPpb.ECDSA
|
||||
}
|
||||
|
||||
|
||||
GetBoundProfilePackageRequest ::= [58] SEQUENCE { -- Tag 'BF3A'
|
||||
transactionId [0] TransactionId,
|
||||
prepareDownloadResponse [33] PrepareDownloadResponse
|
||||
}
|
||||
|
||||
|
||||
GetBoundProfilePackageResponse ::= [58] CHOICE { -- Tag 'BF3A'
|
||||
getBoundProfilePackageOk GetBoundProfilePackageOk,
|
||||
getBoundProfilePackageError INTEGER {
|
||||
|
@ -713,25 +718,27 @@ GetBoundProfilePackageResponse ::= [58] CHOICE { -- Tag 'BF3A'
|
|||
confirmationCodeMissing(2),
|
||||
confirmationCodeRefused(3),
|
||||
confirmationCodeRetriesExceeded(4),
|
||||
bppRebindingRefused(5),
|
||||
downloadOrderExpired(6),
|
||||
invalidTransactionId(95),
|
||||
undefinedError(127)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GetBoundProfilePackageOk ::= SEQUENCE {
|
||||
transactionId [0] TransactionId,
|
||||
boundProfilePackage [54] BoundProfilePackage
|
||||
}
|
||||
|
||||
|
||||
HandleNotification ::= [61] SEQUENCE { -- Tag 'BF3D'
|
||||
pendingNotification PendingNotification
|
||||
}
|
||||
|
||||
|
||||
CancelSessionRequestEs9 ::= [65] SEQUENCE { -- Tag 'BF41'
|
||||
transactionId TransactionId,
|
||||
cancelSessionResponse CancelSessionResponse -- data structure defined for ES10b.CancelSession function
|
||||
}
|
||||
|
||||
|
||||
CancelSessionResponseEs9 ::= [65] CHOICE { -- Tag 'BF41'
|
||||
cancelSessionOk CancelSessionOk,
|
||||
cancelSessionError INTEGER {
|
||||
|
@ -740,45 +747,45 @@ CancelSessionResponseEs9 ::= [65] CHOICE { -- Tag 'BF41'
|
|||
undefinedError(127)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
CancelSessionOk ::= SEQUENCE { -- This function has no output data
|
||||
}
|
||||
|
||||
|
||||
EuiccConfiguredAddressesRequest ::= [60] SEQUENCE { -- Tag 'BF3C'
|
||||
}
|
||||
|
||||
|
||||
EuiccConfiguredAddressesResponse ::= [60] SEQUENCE { -- Tag 'BF3C'
|
||||
defaultDpAddress UTF8String OPTIONAL, -- Default SM-DP+ address as an FQDN
|
||||
rootDsAddress UTF8String -- Root SM-DS address as an FQDN
|
||||
}
|
||||
|
||||
ISDRProprietaryApplicationTemplate ::= [PRIVATE 0] SEQUENCE { -- Tag 'E0'
|
||||
|
||||
ISDRProprietaryApplicationTemplate ::= [PRIVATE 0] SEQUENCE { -- Tag 'E0'
|
||||
svn [2] VersionType, -- GSMA SGP.22 version supported (SVN)
|
||||
lpaeSupport BIT STRING {
|
||||
lpaeUsingCat(0), -- LPA in the eUICC using Card Application Toolkit
|
||||
lpaeUsingScws(1) -- LPA in the eUICC using Smartcard Web Server
|
||||
} OPTIONAL
|
||||
}
|
||||
|
||||
|
||||
LpaeActivationRequest ::= [66] SEQUENCE { -- Tag 'BF42'
|
||||
lpaeOption BIT STRING {
|
||||
activateCatBasedLpae(0), -- LPAe with LUIe based on CAT
|
||||
activateScwsBasedLpae(1) -- LPAe with LUIe based on SCWS
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
LpaeActivationResponse ::= [66] SEQUENCE { -- Tag 'BF42'
|
||||
lpaeActivationResult INTEGER {ok(0), notSupported(1)}
|
||||
}
|
||||
|
||||
|
||||
SetDefaultDpAddressRequest ::= [63] SEQUENCE { -- Tag 'BF3F'
|
||||
defaultDpAddress UTF8String -- Default SM-DP+ address as an FQDN
|
||||
}
|
||||
|
||||
|
||||
SetDefaultDpAddressResponse ::= [63] SEQUENCE { -- Tag 'BF3F'
|
||||
setDefaultDpAddressResult INTEGER { ok (0), undefinedError (127)}
|
||||
}
|
||||
|
||||
|
||||
AuthenticateClientResponseEs11 ::= [64] CHOICE { -- Tag 'BF40'
|
||||
authenticateClientOk AuthenticateClientOkEs11,
|
||||
authenticateClientError INTEGER {
|
||||
|
@ -792,15 +799,15 @@ AuthenticateClientResponseEs11 ::= [64] CHOICE { -- Tag 'BF40'
|
|||
undefinedError(127)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
AuthenticateClientOkEs11 ::= SEQUENCE {
|
||||
transactionId TransactionId,
|
||||
eventEntries SEQUENCE OF EventEntries
|
||||
}
|
||||
|
||||
|
||||
EventEntries ::= SEQUENCE {
|
||||
eventId UTF8String,
|
||||
rspServerAddress UTF8String
|
||||
}
|
||||
|
||||
|
||||
END
|
144
driver/CMakeLists.txt
Normal file
144
driver/CMakeLists.txt
Normal file
|
@ -0,0 +1,144 @@
|
|||
include(CMakeDependentOption)
|
||||
cmake_dependent_option(LPAC_DYNAMIC_DRIVERS "Build lpac/libeuicc driver backends as a dynamic library" OFF "LPAC_DYNAMIC_LIBEUICC" OFF)
|
||||
|
||||
option(LPAC_WITH_APDU_PCSC "Build APDU PCSC Backend (requires PCSC libraries)" ON)
|
||||
if(LINUX)
|
||||
option(LPAC_WITH_APDU_AT "Build APDU AT Backend" ON)
|
||||
else()
|
||||
option(LPAC_WITH_APDU_AT "Build APDU AT Backend" OFF)
|
||||
endif()
|
||||
option(LPAC_WITH_APDU_GBINDER "Build APDU Gbinder backend for libhybris devices (requires gbinder headers)" OFF)
|
||||
option(LPAC_WITH_APDU_QMI "Build QMI backend for Qualcomm devices (requires libqmi)" OFF)
|
||||
option(LPAC_WITH_APDU_QMI_QRTR "Build QMI-over-QRTR backend for Qualcomm devices (requires libqrtr and libqmi headers)" OFF)
|
||||
option(LPAC_WITH_APDU_MBIM "Build MBIM backend for MBIM devices (requires libmbim)" OFF)
|
||||
|
||||
option(LPAC_WITH_HTTP_CURL "Build HTTP Curl interface" ON)
|
||||
|
||||
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR} DIR_INTERFACE_SRCS)
|
||||
if(LPAC_DYNAMIC_DRIVERS)
|
||||
add_library(euicc-drivers SHARED ${DIR_INTERFACE_SRCS})
|
||||
list(APPEND LIBEUICC_DRIVERS_REQUIRES "libeuicc = ${PROJECT_VERSION}")
|
||||
else()
|
||||
add_library(euicc-drivers STATIC ${DIR_INTERFACE_SRCS})
|
||||
endif()
|
||||
target_link_libraries(euicc-drivers euicc cjson-static)
|
||||
target_include_directories(euicc-drivers PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
target_sources(euicc-drivers PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/apdu/stdio.c)
|
||||
target_sources(euicc-drivers PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/http/stdio.c)
|
||||
|
||||
if(LPAC_WITH_APDU_PCSC)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DLPAC_WITH_APDU_PCSC")
|
||||
target_sources(euicc-drivers PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/apdu/pcsc.c)
|
||||
if(WIN32)
|
||||
target_sources(euicc-drivers PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/apdu/pcsc_win32.c)
|
||||
target_link_libraries(euicc-drivers winscard)
|
||||
elseif(APPLE)
|
||||
target_link_libraries(euicc-drivers "-framework PCSC")
|
||||
if(LPAC_DYNAMIC_DRIVERS)
|
||||
# for pkg-config
|
||||
set(LIBEUICC_DRIVERS_EXTRA_CFLAGS "-framework PCSC")
|
||||
endif()
|
||||
else()
|
||||
find_package(PCSCLite)
|
||||
target_link_libraries(euicc-drivers PCSCLite::PCSCLite)
|
||||
if(LPAC_DYNAMIC_DRIVERS)
|
||||
list(APPEND LIBEUICC_DRIVERS_REQUIRES "libpcsclite")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(LPAC_WITH_APDU_AT)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DLPAC_WITH_APDU_AT")
|
||||
target_sources(euicc-drivers PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/apdu/at.c)
|
||||
endif()
|
||||
|
||||
if(LPAC_WITH_APDU_GBINDER)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DLPAC_WITH_APDU_GBINDER")
|
||||
target_sources(euicc-drivers PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/apdu/gbinder_hidl.c)
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(GBINDER REQUIRED IMPORTED_TARGET libgbinder)
|
||||
pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0)
|
||||
target_link_libraries(euicc-drivers PkgConfig::GBINDER PkgConfig::GLIB)
|
||||
if(LPAC_DYNAMIC_DRIVERS)
|
||||
list(APPEND LIBEUICC_DRIVERS_REQUIRES "libgbinder")
|
||||
list(APPEND LIBEUICC_DRIVERS_REQUIRES "glib-2.0")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(LPAC_WITH_APDU_QMI)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DLPAC_WITH_APDU_QMI")
|
||||
target_sources(euicc-drivers PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/apdu/qmi.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/apdu/qmi_helpers.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/apdu/qmi_common.c)
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(QMI_GLIB REQUIRED IMPORTED_TARGET qmi-glib>=1.35.5)
|
||||
target_link_libraries(euicc-drivers PkgConfig::QMI_GLIB)
|
||||
if(LPAC_DYNAMIC_DRIVERS)
|
||||
list(APPEND LIBEUICC_DRIVERS_REQUIRES "qmi-glib")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(LPAC_WITH_APDU_QMI_QRTR)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DLPAC_WITH_APDU_QMI_QRTR")
|
||||
target_sources(euicc-drivers PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/apdu/qmi_qrtr.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/apdu/qmi_helpers.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/apdu/qmi_common.c)
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(QRTR_GLIB REQUIRED IMPORTED_TARGET qrtr-glib)
|
||||
pkg_check_modules(QMI_GLIB REQUIRED IMPORTED_TARGET qmi-glib>=1.35.5)
|
||||
target_link_libraries(euicc-drivers PkgConfig::QRTR_GLIB PkgConfig::QMI_GLIB)
|
||||
if(LPAC_DYNAMIC_DRIVERS)
|
||||
list(APPEND LIBEUICC_DRIVERS_REQUIRES "qrtr-glib")
|
||||
list(APPEND LIBEUICC_DRIVERS_REQUIRES "qmi-glib")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(LPAC_WITH_APDU_MBIM)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DLPAC_WITH_APDU_MBIM")
|
||||
target_sources(euicc-drivers PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/apdu/mbim.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/apdu/mbim_helpers.c)
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(MBIM_GLIB REQUIRED IMPORTED_TARGET mbim-glib)
|
||||
target_link_libraries(euicc-drivers PkgConfig::MBIM_GLIB PkgConfig::MBIM_GLIB)
|
||||
if(LPAC_DYNAMIC_DRIVERS)
|
||||
list(APPEND LIBEUICC_DRIVERS_REQUIRES "mbim-glib")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(LPAC_WITH_HTTP_CURL)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DLPAC_WITH_HTTP_CURL")
|
||||
target_sources(euicc-drivers PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/http/curl.c)
|
||||
if(WIN32)
|
||||
target_link_libraries(euicc-drivers ${DL_LIBRARY})
|
||||
else()
|
||||
find_package(CURL REQUIRED)
|
||||
target_link_libraries(euicc-drivers curl)
|
||||
if(LPAC_DYNAMIC_DRIVERS)
|
||||
list(APPEND LIBEUICC_DRIVERS_REQUIRES "libcurl")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(LPAC_DYNAMIC_DRIVERS)
|
||||
# Install headers
|
||||
file(GLOB ALL_HEADERS "*.h")
|
||||
foreach(header ${ALL_HEADERS})
|
||||
if(${header} MATCHES "^.*\.private\.h$")
|
||||
list(REMOVE_ITEM ALL_HEADERS ${header})
|
||||
endif()
|
||||
endforeach()
|
||||
set_target_properties(euicc-drivers PROPERTIES PUBLIC_HEADER "${ALL_HEADERS}")
|
||||
# Install a pkg-config file (mainly for Linux; macOS is untested; Win32 is not supported)
|
||||
if(UNIX)
|
||||
list(JOIN LIBEUICC_DRIVERS_REQUIRES ", " LIBEUICC_DRIVERS_REQUIRES)
|
||||
configure_file(libeuicc-drivers.pc.in libeuicc-drivers.pc @ONLY)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libeuicc-drivers.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
||||
endif()
|
||||
set_target_properties(euicc-drivers PROPERTIES SOVERSION ${PROJECT_VERSION_MAJOR})
|
||||
install(TARGETS euicc-drivers LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/euicc)
|
||||
endif()
|
661
driver/LICENSE
Normal file
661
driver/LICENSE
Normal file
|
@ -0,0 +1,661 @@
|
|||
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
Version 3, 19 November 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU Affero General Public License is a free, copyleft license for
|
||||
software and other kinds of works, specifically designed to ensure
|
||||
cooperation with the community in the case of network server software.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
our General Public Licenses are intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
Developers that use our General Public Licenses protect your rights
|
||||
with two steps: (1) assert copyright on the software, and (2) offer
|
||||
you this License which gives you legal permission to copy, distribute
|
||||
and/or modify the software.
|
||||
|
||||
A secondary benefit of defending all users' freedom is that
|
||||
improvements made in alternate versions of the program, if they
|
||||
receive widespread use, become available for other developers to
|
||||
incorporate. Many developers of free software are heartened and
|
||||
encouraged by the resulting cooperation. However, in the case of
|
||||
software used on network servers, this result may fail to come about.
|
||||
The GNU General Public License permits making a modified version and
|
||||
letting the public access it on a server without ever releasing its
|
||||
source code to the public.
|
||||
|
||||
The GNU Affero General Public License is designed specifically to
|
||||
ensure that, in such cases, the modified source code becomes available
|
||||
to the community. It requires the operator of a network server to
|
||||
provide the source code of the modified version running there to the
|
||||
users of that server. Therefore, public use of a modified version, on
|
||||
a publicly accessible server, gives the public access to the source
|
||||
code of the modified version.
|
||||
|
||||
An older license, called the Affero General Public License and
|
||||
published by Affero, was designed to accomplish similar goals. This is
|
||||
a different license, not a version of the Affero GPL, but Affero has
|
||||
released a new version of the Affero GPL which permits relicensing under
|
||||
this license.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU Affero General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Remote Network Interaction; Use with the GNU General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, if you modify the
|
||||
Program, your modified version must prominently offer all users
|
||||
interacting with it remotely through a computer network (if your version
|
||||
supports such interaction) an opportunity to receive the Corresponding
|
||||
Source of your version by providing access to the Corresponding Source
|
||||
from a network server at no charge, through some standard or customary
|
||||
means of facilitating copying of software. This Corresponding Source
|
||||
shall include the Corresponding Source for any work covered by version 3
|
||||
of the GNU General Public License that is incorporated pursuant to the
|
||||
following paragraph.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the work with which it is combined will remain governed by version
|
||||
3 of the GNU General Public License.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU Affero General Public License from time to time. Such new versions
|
||||
will be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU Affero General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU Affero General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU Affero General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If your software can interact with users remotely through a computer
|
||||
network, you should also make sure that it provides a way for users to
|
||||
get its source. For example, if your program is a web application, its
|
||||
interface could display a "Source" link that leads users to an archive
|
||||
of the code. There are many ways you could offer source, and different
|
||||
solutions will be better for different programs; see section 13 for the
|
||||
specific requirements.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU AGPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
|
@ -1,3 +1,5 @@
|
|||
#include "at.h"
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
@ -5,83 +7,26 @@
|
|||
#include <unistd.h>
|
||||
|
||||
#include <euicc/interface.h>
|
||||
#include <euicc/hexutil.h>
|
||||
|
||||
#define AT_BUFFER_SIZE 20480
|
||||
static FILE *fuart;
|
||||
static int logic_channel = 0;
|
||||
|
||||
static int hexutil_hex2bin(unsigned char *output, unsigned output_len, const char *str, unsigned str_len)
|
||||
{
|
||||
int length;
|
||||
|
||||
if (!str || !output || str_len % 2 != 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
length = str_len / 2;
|
||||
if (length > output_len)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (int i = 0; i < length; ++i)
|
||||
{
|
||||
char high = str[2 * i];
|
||||
char low = str[2 * i + 1];
|
||||
|
||||
if (high >= '0' && high <= '9')
|
||||
{
|
||||
high -= '0';
|
||||
}
|
||||
else if (high >= 'a' && high <= 'f')
|
||||
{
|
||||
high = high - 'a' + 10;
|
||||
}
|
||||
else if (high >= 'A' && high <= 'F')
|
||||
{
|
||||
high = high - 'A' + 10;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (low >= '0' && low <= '9')
|
||||
{
|
||||
low -= '0';
|
||||
}
|
||||
else if (low >= 'a' && low <= 'f')
|
||||
{
|
||||
low = low - 'a' + 10;
|
||||
}
|
||||
else if (low >= 'A' && low <= 'F')
|
||||
{
|
||||
low = low - 'A' + 10;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
output[i] = (high << 4) + low;
|
||||
}
|
||||
|
||||
return length;
|
||||
}
|
||||
static char *buffer;
|
||||
|
||||
static int at_expect(char **response, const char *expected)
|
||||
{
|
||||
char buffer[1024];
|
||||
memset(buffer, 0, AT_BUFFER_SIZE);
|
||||
|
||||
if (response)
|
||||
*response = NULL;
|
||||
|
||||
while (1)
|
||||
{
|
||||
fgets(buffer, sizeof(buffer), fuart);
|
||||
fgets(buffer, AT_BUFFER_SIZE, fuart);
|
||||
buffer[strcspn(buffer, "\r\n")] = 0;
|
||||
if (getenv("AT_DEBUG"))
|
||||
printf("AT_DEBUG: %s\r\n", buffer);
|
||||
printf("AT_DEBUG: %s\n", buffer);
|
||||
if (strcmp(buffer, "ERROR") == 0)
|
||||
{
|
||||
return -1;
|
||||
|
@ -116,6 +61,7 @@ static int apdu_interface_connect(struct euicc_ctx *ctx)
|
|||
fprintf(stderr, "Failed to open device: %s\n", device);
|
||||
return -1;
|
||||
}
|
||||
setbuf(fuart, NULL);
|
||||
|
||||
fprintf(fuart, "AT+CCHO=?\r\n");
|
||||
if (at_expect(NULL, NULL))
|
||||
|
@ -162,12 +108,12 @@ static int apdu_interface_transmit(struct euicc_ctx *ctx, uint8_t **rx, uint32_t
|
|||
}
|
||||
|
||||
fprintf(fuart, "AT+CGLA=%d,%u,\"", logic_channel, tx_len * 2);
|
||||
for (int i = 0; i < tx_len; i++)
|
||||
for (uint32_t i = 0; i < tx_len; i++)
|
||||
{
|
||||
fprintf(fuart, "%02X", (uint8_t)(tx[i] & 0xFF));
|
||||
}
|
||||
fprintf(fuart, "\"\r\n");
|
||||
if (at_expect(&response, "+CGLA: "))
|
||||
if (at_expect(&response, "+CGLA:"))
|
||||
{
|
||||
goto err;
|
||||
}
|
||||
|
@ -195,7 +141,7 @@ static int apdu_interface_transmit(struct euicc_ctx *ctx, uint8_t **rx, uint32_t
|
|||
goto err;
|
||||
}
|
||||
|
||||
ret = hexutil_hex2bin(*rx, *rx_len, hexstr, strlen(hexstr));
|
||||
ret = euicc_hexutil_hex2bin_r(*rx, *rx_len, hexstr, strlen(hexstr));
|
||||
if (ret < 0)
|
||||
{
|
||||
goto err;
|
||||
|
@ -257,7 +203,7 @@ static void apdu_interface_logic_channel_close(struct euicc_ctx *ctx, uint8_t ch
|
|||
at_expect(NULL, NULL);
|
||||
}
|
||||
|
||||
int libapduinterface_init(struct euicc_apdu_interface *ifstruct)
|
||||
static int libapduinterface_init(struct euicc_apdu_interface *ifstruct)
|
||||
{
|
||||
memset(ifstruct, 0, sizeof(struct euicc_apdu_interface));
|
||||
|
||||
|
@ -267,10 +213,30 @@ int libapduinterface_init(struct euicc_apdu_interface *ifstruct)
|
|||
ifstruct->logic_channel_close = apdu_interface_logic_channel_close;
|
||||
ifstruct->transmit = apdu_interface_transmit;
|
||||
|
||||
buffer = malloc(AT_BUFFER_SIZE);
|
||||
if (!buffer)
|
||||
{
|
||||
fprintf(stderr, "Failed to allocate memory\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int libapduinterface_main(int argc, char **argv)
|
||||
static int libapduinterface_main(int argc, char **argv)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void libapduinterface_fini(struct euicc_apdu_interface *ifstruct)
|
||||
{
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
const struct euicc_driver driver_apdu_at = {
|
||||
.type = DRIVER_APDU,
|
||||
.name = "at",
|
||||
.init = (int (*)(void *))libapduinterface_init,
|
||||
.main = libapduinterface_main,
|
||||
.fini = (void (*)(void *))libapduinterface_fini,
|
||||
};
|
4
driver/apdu/at.h
Normal file
4
driver/apdu/at.h
Normal file
|
@ -0,0 +1,4 @@
|
|||
#pragma once
|
||||
#include <driver.private.h>
|
||||
|
||||
extern const struct euicc_driver driver_apdu_at;
|
328
driver/apdu/gbinder_hidl.c
Normal file
328
driver/apdu/gbinder_hidl.c
Normal file
|
@ -0,0 +1,328 @@
|
|||
// vim: expandtab sw=4 ts=4:
|
||||
#include "gbinder_hidl.h"
|
||||
|
||||
#include <euicc/euicc.h>
|
||||
#include <euicc/hexutil.h>
|
||||
#include <euicc/interface.h>
|
||||
#include <gbinder.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define DEBUG (getenv("GBINDER_APDU_DEBUG") != NULL && strcmp("true", getenv("GBINDER_APDU_DEBUG")) == 0)
|
||||
|
||||
#define HIDL_SERVICE_DEVICE "/dev/hwbinder"
|
||||
#define HIDL_SERVICE_IFACE "android.hardware.radio@1.0::IRadio"
|
||||
#define HIDL_SERVICE_IFACE_CALLBACK "android.hardware.radio@1.0::IRadioResponse"
|
||||
|
||||
// ref: IRadio
|
||||
#define HIDL_SERVICE_SET_RESPONSE_FUNCTIONS GBINDER_FIRST_CALL_TRANSACTION
|
||||
#define HIDL_SERVICE_ICC_OPEN_LOGICAL_CHANNEL (GBINDER_FIRST_CALL_TRANSACTION + 105)
|
||||
#define HIDL_SERVICE_ICC_CLOSE_LOGICAL_CHANNEL (GBINDER_FIRST_CALL_TRANSACTION + 106)
|
||||
#define HIDL_SERVICE_ICC_TRANSMIT_APDU_LOGICAL_CHANNEL (GBINDER_FIRST_CALL_TRANSACTION + 107)
|
||||
|
||||
// ref: IRadioResponse
|
||||
#define HIDL_SERVICE_ICC_OPEN_LOGICAL_CHANNEL_CALLBACK (GBINDER_FIRST_CALL_TRANSACTION + 104)
|
||||
#define HIDL_SERVICE_ICC_CLOSE_LOGICAL_CHANNEL_CALLBACK (GBINDER_FIRST_CALL_TRANSACTION + 105)
|
||||
#define HIDL_SERVICE_ICC_TRANSMIT_APDU_LOGICAL_CHANNEL_CALLBACK (GBINDER_FIRST_CALL_TRANSACTION + 106)
|
||||
|
||||
static int lastChannelId = -1;
|
||||
|
||||
struct radio_response_info {
|
||||
int32_t type;
|
||||
int32_t serial;
|
||||
int32_t error;
|
||||
};
|
||||
|
||||
struct icc_io_result {
|
||||
int32_t sw1;
|
||||
int32_t sw2;
|
||||
GBinderHidlString simResponse;
|
||||
};
|
||||
|
||||
struct sim_apdu {
|
||||
int32_t sessionId;
|
||||
int32_t cla;
|
||||
int32_t instruction;
|
||||
int32_t p1;
|
||||
int32_t p2;
|
||||
int32_t p3;
|
||||
GBinderHidlString data;
|
||||
};
|
||||
|
||||
static const GBinderWriterField sim_apdu_f[] = {
|
||||
GBINDER_WRITER_FIELD_HIDL_STRING(struct sim_apdu, data),
|
||||
GBINDER_WRITER_FIELD_END()
|
||||
};
|
||||
|
||||
static const GBinderWriterType sim_apdu_t = {
|
||||
GBINDER_WRITER_STRUCT_NAME_AND_SIZE(struct sim_apdu), sim_apdu_f
|
||||
};
|
||||
|
||||
static GBinderServiceManager *sm;
|
||||
// IRadioResponse
|
||||
static GBinderLocalObject *response_callback;
|
||||
// IRadio
|
||||
static GBinderRemoteObject *remote;
|
||||
static GBinderClient *client;
|
||||
|
||||
static GMainLoop *binder_loop;
|
||||
|
||||
static int lastIntResp = -1;
|
||||
static int lastRadioErr = 0;
|
||||
static struct icc_io_result lastIccIoResult = {0};
|
||||
|
||||
static GBinderLocalReply *radio_response_transact(
|
||||
GBinderLocalObject *obj,
|
||||
GBinderRemoteRequest *req,
|
||||
guint code, guint flags, int *status, void *user_data)
|
||||
{
|
||||
GBinderReader reader;
|
||||
|
||||
gbinder_remote_request_init_reader(req, &reader);
|
||||
const struct radio_response_info *resp =
|
||||
gbinder_reader_read_hidl_struct(&reader, struct radio_response_info);
|
||||
lastRadioErr = resp->error;
|
||||
|
||||
if (lastRadioErr != 0)
|
||||
goto out;
|
||||
|
||||
switch (code) {
|
||||
case HIDL_SERVICE_ICC_OPEN_LOGICAL_CHANNEL_CALLBACK:
|
||||
gbinder_reader_read_int32(&reader, &lastIntResp);
|
||||
break;
|
||||
case HIDL_SERVICE_ICC_TRANSMIT_APDU_LOGICAL_CHANNEL_CALLBACK: {
|
||||
const struct icc_io_result *icc_io_res = gbinder_reader_read_hidl_struct(&reader, struct icc_io_result);
|
||||
// We cannot rely on the *req pointer being valid after we return
|
||||
lastIccIoResult.sw1 = icc_io_res->sw1;
|
||||
lastIccIoResult.sw2 = icc_io_res->sw2;
|
||||
lastIccIoResult.simResponse.data.str = strndup(icc_io_res->simResponse.data.str, icc_io_res->simResponse.len);
|
||||
lastIccIoResult.simResponse.len = icc_io_res->simResponse.len;
|
||||
lastIccIoResult.simResponse.owns_buffer = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
out:
|
||||
g_main_loop_quit(binder_loop);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void cleanup_channel(int id)
|
||||
{
|
||||
GBinderLocalRequest *req = gbinder_client_new_request(client);
|
||||
GBinderWriter writer;
|
||||
gbinder_local_request_init_writer(req, &writer);
|
||||
gbinder_writer_append_int32(&writer, 1000);
|
||||
gbinder_writer_append_int32(&writer, id);
|
||||
gbinder_client_transact_sync_oneway(client, HIDL_SERVICE_ICC_CLOSE_LOGICAL_CHANNEL, req);
|
||||
gbinder_local_request_unref(req);
|
||||
g_main_loop_run(binder_loop);
|
||||
}
|
||||
|
||||
static void cleanup(void)
|
||||
{
|
||||
if (lastChannelId != -1) {
|
||||
fprintf(stderr, "Cleaning up leaked APDU channel %d\n", lastChannelId);
|
||||
cleanup_channel(lastChannelId);
|
||||
lastChannelId = -1;
|
||||
}
|
||||
}
|
||||
|
||||
static void sighandler(int sig)
|
||||
{
|
||||
// This would trigger atexit() hooks
|
||||
exit(0);
|
||||
}
|
||||
|
||||
static int try_open_slot(int slotId, const uint8_t *aid, uint32_t aid_len)
|
||||
{
|
||||
// First, try to connect to the HIDL service for this slot
|
||||
char fqname[255];
|
||||
snprintf(fqname, 255, "%s/slot%d", HIDL_SERVICE_IFACE, slotId);
|
||||
fprintf(stderr, "Attempting to connect to %s\n", fqname);
|
||||
|
||||
int status = 0;
|
||||
sm = gbinder_servicemanager_new(HIDL_SERVICE_DEVICE);
|
||||
remote = gbinder_remote_object_ref(
|
||||
gbinder_servicemanager_get_service_sync(sm, fqname, &status));
|
||||
client = gbinder_client_new(remote, HIDL_SERVICE_IFACE);
|
||||
|
||||
if (!client) {
|
||||
fprintf(stderr, "Failed to connect to IRadio\n");
|
||||
gbinder_client_unref(client);
|
||||
gbinder_remote_object_unref(remote);
|
||||
gbinder_servicemanager_unref(sm);
|
||||
return -1;
|
||||
}
|
||||
|
||||
response_callback = gbinder_servicemanager_new_local_object(
|
||||
sm, HIDL_SERVICE_IFACE_CALLBACK, radio_response_transact, NULL);
|
||||
|
||||
GBinderLocalRequest *req = gbinder_client_new_request(client);
|
||||
GBinderWriter writer;
|
||||
gbinder_local_request_init_writer(req, &writer);
|
||||
gbinder_writer_append_local_object(&writer, response_callback);
|
||||
gbinder_writer_append_local_object(&writer, NULL);
|
||||
gbinder_client_transact_sync_reply(client, HIDL_SERVICE_SET_RESPONSE_FUNCTIONS, req, &status);
|
||||
gbinder_local_request_unref(req);
|
||||
|
||||
if (status < 0) {
|
||||
fprintf(stderr, "Failed to call IRadio::setResponseFunctions");
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Now, try to open the AID
|
||||
uint8_t aid_hex[255];
|
||||
euicc_hexutil_bin2hex(aid_hex, 255, aid, aid_len);
|
||||
|
||||
req = gbinder_client_new_request(client);
|
||||
gbinder_local_request_init_writer(req, &writer);
|
||||
gbinder_writer_append_int32(&writer, 1000);
|
||||
gbinder_writer_append_hidl_string_copy(&writer, aid_hex);
|
||||
gbinder_writer_append_int32(&writer, 0);
|
||||
status = gbinder_client_transact_sync_oneway(client, HIDL_SERVICE_ICC_OPEN_LOGICAL_CHANNEL, req);
|
||||
gbinder_local_request_unref(req);
|
||||
|
||||
if (status < 0) {
|
||||
fprintf(stderr, "Failed to call IRadio::iccOpenLogicalChannel: %d\n", status);
|
||||
return status;
|
||||
}
|
||||
|
||||
g_main_loop_run(binder_loop);
|
||||
|
||||
if (lastRadioErr != 0) {
|
||||
fprintf(stderr, "Failed to open APDU logical channel: %d\n", lastRadioErr);
|
||||
return -lastRadioErr;
|
||||
}
|
||||
fprintf(stderr, "opened logical channel id: %d\n", lastIntResp);
|
||||
|
||||
return lastIntResp;
|
||||
}
|
||||
|
||||
static int apdu_interface_connect(struct euicc_ctx *ctx)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void apdu_interface_disconnect(struct euicc_ctx *ctx)
|
||||
{
|
||||
cleanup();
|
||||
}
|
||||
|
||||
static int apdu_interface_logic_channel_open(struct euicc_ctx *ctx, const uint8_t *aid, uint8_t aid_len)
|
||||
{
|
||||
// We only start to use gbinder connection here, because only now can we detect whether
|
||||
// a given slot is a valid eSIM slot. This way we can automatically fall back in the case
|
||||
// where a device has only one eSIM -- we don't want to force the user to choose in this case.
|
||||
int res = try_open_slot(1, aid, aid_len);
|
||||
if (res < 0)
|
||||
res = try_open_slot(2, aid, aid_len);
|
||||
if (res >= 0)
|
||||
lastChannelId = res;
|
||||
return res;
|
||||
}
|
||||
|
||||
static void apdu_interface_logic_channel_close(struct euicc_ctx *ctx, uint8_t channel)
|
||||
{
|
||||
cleanup_channel(channel);
|
||||
if (lastChannelId == channel)
|
||||
lastChannelId = -1;
|
||||
|
||||
// Only do this cleanup here, because on exit these objects will be destroyed anyway
|
||||
gbinder_client_unref(client);
|
||||
gbinder_remote_object_unref(remote);
|
||||
gbinder_servicemanager_unref(sm);
|
||||
}
|
||||
|
||||
static int apdu_interface_transmit(struct euicc_ctx *ctx, uint8_t **rx, uint32_t *rx_len, const uint8_t *tx, uint32_t tx_len)
|
||||
{
|
||||
GBinderLocalRequest *req = gbinder_client_new_request(client);
|
||||
GBinderWriter writer;
|
||||
gbinder_local_request_init_writer(req, &writer);
|
||||
gbinder_writer_append_int32(&writer, 1000);
|
||||
|
||||
uint8_t tx_hex[4096] = {0};
|
||||
euicc_hexutil_bin2hex(tx_hex, 4096, &tx[5], tx_len - 5);
|
||||
|
||||
if (DEBUG)
|
||||
fprintf(stderr, "APDU req: %s\n", tx_hex);
|
||||
|
||||
struct sim_apdu apdu = {
|
||||
.sessionId = lastChannelId,
|
||||
.cla = tx[0],
|
||||
.instruction = tx[1],
|
||||
.p1 = tx[2],
|
||||
.p2 = tx[3],
|
||||
.p3 = tx[4],
|
||||
.data = {
|
||||
.data = {
|
||||
.str = (const char *) tx_hex
|
||||
},
|
||||
.len = strlen(tx_hex) + 1,
|
||||
.owns_buffer = FALSE,
|
||||
},
|
||||
};
|
||||
gbinder_writer_append_struct(&writer, &apdu, &sim_apdu_t, NULL);
|
||||
int status = gbinder_client_transact_sync_oneway(client, HIDL_SERVICE_ICC_TRANSMIT_APDU_LOGICAL_CHANNEL, req);
|
||||
gbinder_local_request_unref(req);
|
||||
|
||||
if (status < 0) {
|
||||
fprintf(stderr, "Failed to call IRadio::iccTransmitApduLogicalChannel: %d\n", status);
|
||||
return status;
|
||||
}
|
||||
|
||||
g_main_loop_run(binder_loop);
|
||||
|
||||
if (lastRadioErr != 0) {
|
||||
return -lastRadioErr;
|
||||
}
|
||||
|
||||
if (DEBUG)
|
||||
fprintf(stderr, "APDU resp: %d%d %d %s\n", lastIccIoResult.sw1, lastIccIoResult.sw2, lastIccIoResult.simResponse.len, lastIccIoResult.simResponse.data.str);
|
||||
|
||||
*rx_len = lastIccIoResult.simResponse.len / 2 + 2;
|
||||
*rx = calloc(*rx_len, sizeof(uint8_t));
|
||||
euicc_hexutil_hex2bin_r(*rx, *rx_len, lastIccIoResult.simResponse.data.str, lastIccIoResult.simResponse.len);
|
||||
(*rx)[*rx_len - 2] = lastIccIoResult.sw1;
|
||||
(*rx)[*rx_len - 1] = lastIccIoResult.sw2;
|
||||
|
||||
// see radio_response_transact -- this is our buffer.
|
||||
free((void *) lastIccIoResult.simResponse.data.str);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int libapduinterface_init(struct euicc_apdu_interface *ifstruct)
|
||||
{
|
||||
ifstruct->connect = apdu_interface_connect;
|
||||
ifstruct->disconnect = apdu_interface_disconnect;
|
||||
ifstruct->logic_channel_open = apdu_interface_logic_channel_open;
|
||||
ifstruct->logic_channel_close = apdu_interface_logic_channel_close;
|
||||
ifstruct->transmit = apdu_interface_transmit;
|
||||
|
||||
// Install cleanup routine
|
||||
atexit(cleanup);
|
||||
signal(SIGINT, sighandler);
|
||||
|
||||
// The glib loop is detached from any client object, so create it here.
|
||||
binder_loop = g_main_loop_new(NULL, FALSE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int libapduinterface_main(int argc, char **argv)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void libapduinterface_fini(struct euicc_apdu_interface *ifstruct)
|
||||
{
|
||||
}
|
||||
|
||||
const struct euicc_driver driver_apdu_gbinder_hidl = {
|
||||
.type = DRIVER_APDU,
|
||||
.name = "gbinder_hidl",
|
||||
.init = (int (*)(void *))libapduinterface_init,
|
||||
.main = libapduinterface_main,
|
||||
.fini = (void (*)(void *))libapduinterface_fini,
|
||||
};
|
4
driver/apdu/gbinder_hidl.h
Normal file
4
driver/apdu/gbinder_hidl.h
Normal file
|
@ -0,0 +1,4 @@
|
|||
#pragma once
|
||||
#include <driver.private.h>
|
||||
|
||||
extern const struct euicc_driver driver_apdu_gbinder_hidl;
|
367
driver/apdu/mbim.c
Normal file
367
driver/apdu/mbim.c
Normal file
|
@ -0,0 +1,367 @@
|
|||
// SPDX-License-Identifier: MIT
|
||||
/*
|
||||
* Copyright (c) 2024, Frans Klaver <frans.klaver@vislink.com>
|
||||
*/
|
||||
#include "mbim.h"
|
||||
|
||||
#include <libmbim-glib.h>
|
||||
#include <stdio.h>
|
||||
#include <euicc/interface.h>
|
||||
#include <euicc/euicc.h>
|
||||
#include "mbim_helpers.h"
|
||||
|
||||
struct mbim_data {
|
||||
const char *device_path;
|
||||
int last_channel_id;
|
||||
gboolean use_proxy;
|
||||
guint32 uim_slot;
|
||||
GMainContext *context;
|
||||
MbimDevice *device;
|
||||
};
|
||||
|
||||
static gboolean is_sim_available(struct mbim_data *mbim_priv)
|
||||
{
|
||||
MbimMessage *request = mbim_message_subscriber_ready_status_query_new(NULL);
|
||||
g_autoptr(MbimMessage) response = mbim_device_command_sync(
|
||||
mbim_priv->device, mbim_priv->context, request, NULL
|
||||
);
|
||||
if (!response)
|
||||
return FALSE;
|
||||
|
||||
MbimSubscriberReadyState ready_state;
|
||||
if (!mbim_message_subscriber_ready_status_response_parse(
|
||||
response, &ready_state, NULL, NULL, NULL, NULL, NULL, NULL
|
||||
)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
switch (ready_state) {
|
||||
case MBIM_SUBSCRIBER_READY_STATE_NO_ESIM_PROFILE:
|
||||
case MBIM_SUBSCRIBER_READY_STATE_INITIALIZED:
|
||||
return TRUE;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static int select_sim_slot(struct mbim_data *mbim_priv)
|
||||
{
|
||||
g_autoptr(GError) error = NULL;
|
||||
|
||||
MbimMessage *current_slot_request =
|
||||
mbim_message_ms_basic_connect_extensions_device_slot_mappings_query_new(NULL);
|
||||
|
||||
g_autoptr(MbimMessage) current_slot_response = mbim_device_command_sync(
|
||||
mbim_priv->device, mbim_priv->context, current_slot_request, &error
|
||||
);
|
||||
if (!current_slot_response) {
|
||||
fprintf(stderr, "error: device didn't respond: %s\n", error->message);
|
||||
return -1;
|
||||
}
|
||||
|
||||
guint32 current_slot_count;
|
||||
g_autoptr(MbimSlotArray) current_slots = NULL;
|
||||
if (!mbim_message_ms_basic_connect_extensions_device_slot_mappings_response_parse(
|
||||
current_slot_response, ¤t_slot_count, ¤t_slots, &error
|
||||
)) {
|
||||
fprintf(stderr, "error: sim select response could not be parsed: %s\n", error->message);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (current_slot_count && current_slots[0]->slot == mbim_priv->uim_slot) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
g_autoptr(GPtrArray) new_slot_array = g_ptr_array_new_with_free_func(g_free);
|
||||
MbimSlot *new_slot = g_new(MbimSlot, 1);
|
||||
new_slot->slot = mbim_priv->uim_slot;
|
||||
g_ptr_array_add(new_slot_array, new_slot);
|
||||
|
||||
MbimMessage *update_slot_request = mbim_message_ms_basic_connect_extensions_device_slot_mappings_set_new(
|
||||
new_slot_array->len, (const MbimSlot **)new_slot_array->pdata, &error
|
||||
);
|
||||
if (!update_slot_request) {
|
||||
fprintf(stderr, "error: unable to select sim slot: %s\n", error->message);
|
||||
return -1;
|
||||
}
|
||||
|
||||
g_autoptr(MbimMessage) update_slot_response = mbim_device_command_sync(
|
||||
mbim_priv->device, mbim_priv->context, update_slot_request, &error
|
||||
);
|
||||
if (!update_slot_response) {
|
||||
fprintf(stderr, "error: device didn't respond: %s\n", error->message);
|
||||
return -1;
|
||||
}
|
||||
|
||||
guint32 slot_count;
|
||||
g_autoptr(MbimSlotArray) updated_slots = NULL;
|
||||
if (!mbim_message_ms_basic_connect_extensions_device_slot_mappings_response_parse(
|
||||
update_slot_response, &slot_count, &updated_slots, &error
|
||||
)) {
|
||||
fprintf(stderr, "error: sim select response could not be parsed: %s\n", error->message);
|
||||
return -1;
|
||||
}
|
||||
|
||||
int retries = 20;
|
||||
while (retries--) {
|
||||
if (is_sim_available(mbim_priv)) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(stderr, "sim did not become available\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int apdu_interface_connect(struct euicc_ctx *ctx)
|
||||
{
|
||||
struct mbim_data *mbim_priv = ctx->apdu.interface->userdata;
|
||||
g_autoptr(GError) error = NULL;
|
||||
GFile *file;
|
||||
|
||||
file = g_file_new_for_path(mbim_priv->device_path);
|
||||
|
||||
mbim_priv->context = g_main_context_new();
|
||||
|
||||
mbim_priv->device = mbim_device_new_from_path(file, mbim_priv->context, &error);
|
||||
if (!mbim_priv->device) {
|
||||
fprintf(stderr, "error: create mbim device from path failed: %s\n", error->message);
|
||||
return -1;
|
||||
}
|
||||
|
||||
MbimDeviceOpenFlags open_flags = MBIM_DEVICE_OPEN_FLAGS_NONE;
|
||||
if (mbim_priv->use_proxy)
|
||||
open_flags |= MBIM_DEVICE_OPEN_FLAGS_PROXY;
|
||||
|
||||
mbim_device_open_sync(mbim_priv->device, open_flags, mbim_priv->context, &error);
|
||||
if (error) {
|
||||
fprintf(stderr, "error: open mbim device failed: %s\n", error->message);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return select_sim_slot(mbim_priv);
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocate storage in rx and copy the contents of response_data there. Also
|
||||
* tack the status at the end, as the MBIM protocol separates the status from
|
||||
* the rest of the response.
|
||||
*/
|
||||
static int copy_data_with_status(
|
||||
uint8_t **rx, uint32_t *rx_len,
|
||||
const guint8 *response_data, guint32 response_size,
|
||||
guint32 status)
|
||||
{
|
||||
*rx_len = response_size + 2;
|
||||
*rx = malloc(*rx_len);
|
||||
if (!*rx)
|
||||
return -1;
|
||||
|
||||
memcpy(*rx, response_data, response_size);
|
||||
(*rx)[*rx_len - 2] = status & 0xff;
|
||||
(*rx)[*rx_len - 1] = (status >> 8) & 0xff;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mbim_apdu_interface_transmit(
|
||||
struct euicc_ctx *ctx,
|
||||
uint8_t **rx, uint32_t *rx_len,
|
||||
const uint8_t *tx, uint32_t tx_len)
|
||||
{
|
||||
struct mbim_data *mbim_priv = ctx->apdu.interface->userdata;
|
||||
g_autoptr(GError) error = NULL;
|
||||
|
||||
MbimMessage *request = mbim_message_ms_uicc_low_level_access_apdu_set_new(
|
||||
mbim_priv->last_channel_id,
|
||||
MBIM_UICC_SECURE_MESSAGING_NONE,
|
||||
MBIM_UICC_CLASS_BYTE_TYPE_INTER_INDUSTRY,
|
||||
tx_len,
|
||||
tx,
|
||||
&error
|
||||
);
|
||||
if (!request) {
|
||||
fprintf(stderr, "error: creating apdu message failed: %s\n", error->message);
|
||||
return -1;
|
||||
}
|
||||
|
||||
g_autoptr(MbimMessage) response = mbim_device_command_sync(
|
||||
mbim_priv->device, mbim_priv->context, request, &error
|
||||
);
|
||||
if (!response) {
|
||||
fprintf(stderr, "error: no apdu response received: %s\n", error->message);
|
||||
return -1;
|
||||
}
|
||||
|
||||
guint32 status = 0;
|
||||
guint32 response_size = 0;
|
||||
const guint8 *response_data = NULL;
|
||||
|
||||
if (!mbim_message_ms_uicc_low_level_access_apdu_response_parse(
|
||||
response, &status, &response_size, &response_data, &error
|
||||
)) {
|
||||
fprintf(stderr, "error: unable to parse apdu response: %s\n", error->message);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return copy_data_with_status(rx, rx_len, response_data, response_size, status);
|
||||
}
|
||||
|
||||
static int mbim_apdu_interface_logic_channel_open(
|
||||
struct euicc_ctx *ctx,
|
||||
const uint8_t *aid,
|
||||
uint8_t aid_len)
|
||||
{
|
||||
struct mbim_data *mbim_priv = ctx->apdu.interface->userdata;
|
||||
g_autoptr(GError) error = NULL;
|
||||
guint8 channel_id;
|
||||
|
||||
MbimMessage *request = mbim_message_ms_uicc_low_level_access_open_channel_set_new(
|
||||
aid_len, aid, 0, 1, &error
|
||||
);
|
||||
if (!request) {
|
||||
fprintf(stderr, "error: creating channel message failed: %s\n", error->message);
|
||||
return -1;
|
||||
}
|
||||
|
||||
g_autoptr(MbimMessage) response = mbim_device_command_sync(
|
||||
mbim_priv->device, mbim_priv->context, request, &error
|
||||
);
|
||||
if (!response) {
|
||||
fprintf(stderr, "error: no channel response received: %s\n", error->message);
|
||||
return -1;
|
||||
}
|
||||
|
||||
guint32 status = 0;
|
||||
guint32 channel = -1;
|
||||
guint32 response_size = 0;
|
||||
const guint8 *response_data = NULL;
|
||||
|
||||
if (!mbim_message_ms_uicc_low_level_access_open_channel_response_parse(
|
||||
response, &status, &channel, &response_size, &response_data, &error
|
||||
)) {
|
||||
fprintf(stderr, "error: unable to parse channel response: %s\n", error->message);
|
||||
return -1;
|
||||
}
|
||||
|
||||
mbim_priv->last_channel_id = channel;
|
||||
return channel;
|
||||
}
|
||||
|
||||
static void mbim_apdu_interface_logic_channel_close(struct euicc_ctx *ctx, uint8_t channel)
|
||||
{
|
||||
struct mbim_data *mbim_priv = ctx->apdu.interface->userdata;
|
||||
g_autoptr(GError) error = NULL;
|
||||
|
||||
MbimMessage *request = mbim_message_ms_uicc_low_level_access_close_channel_set_new(
|
||||
channel, 1, &error
|
||||
);
|
||||
if (!request) {
|
||||
fprintf(stderr, "error: creating channel message failed: %s\n", error->message);
|
||||
return;
|
||||
}
|
||||
|
||||
g_autoptr(MbimMessage) response = mbim_device_command_sync(
|
||||
mbim_priv->device, mbim_priv->context, request, &error
|
||||
);
|
||||
if (!response) {
|
||||
fprintf(stderr, "error: no channel response received: %s\n", error->message);
|
||||
return;
|
||||
}
|
||||
|
||||
guint32 status = 0;
|
||||
|
||||
if (!mbim_message_ms_uicc_low_level_access_close_channel_response_parse(
|
||||
response, &status, &error
|
||||
)) {
|
||||
fprintf(stderr, "error: unable to parse channel response: %s\n", error->message);
|
||||
return;
|
||||
}
|
||||
|
||||
if (channel == mbim_priv->last_channel_id)
|
||||
mbim_priv->last_channel_id = -1;
|
||||
}
|
||||
|
||||
static void mbim_apdu_interface_disconnect(struct euicc_ctx *ctx)
|
||||
{
|
||||
struct mbim_data *mbim_priv = ctx->apdu.interface->userdata;
|
||||
g_autoptr(GError) error = NULL;
|
||||
|
||||
if (mbim_priv->last_channel_id > 0)
|
||||
{
|
||||
fprintf(stderr, "Cleaning up leaked APDU channel %d\n", mbim_priv->last_channel_id);
|
||||
mbim_apdu_interface_logic_channel_close(NULL, mbim_priv->last_channel_id);
|
||||
mbim_priv->last_channel_id = -1;
|
||||
}
|
||||
|
||||
mbim_device_close_sync(mbim_priv->device, mbim_priv->context, &error);
|
||||
|
||||
g_main_context_unref(mbim_priv->context);
|
||||
mbim_priv->context = NULL;
|
||||
}
|
||||
|
||||
static int libapduinterface_init(struct euicc_apdu_interface *ifstruct)
|
||||
{
|
||||
struct mbim_data *mbim_priv;
|
||||
|
||||
guint32 uim_slot = 0;
|
||||
/*
|
||||
* We're using the same UIM_SLOT environment variable as the QMI backends.
|
||||
* QMI uses 1-based indexing for the sim slots. MBIM uses 0-based indexing,
|
||||
* so account for that.
|
||||
*/
|
||||
const char *env_uim_slot = getenv("UIM_SLOT");
|
||||
if (env_uim_slot) {
|
||||
uim_slot = atoi(env_uim_slot);
|
||||
if (uim_slot == 0) {
|
||||
fprintf(stderr, "error: Invalid UIM_SLOT: '%s'\n", env_uim_slot);
|
||||
return -1;
|
||||
}
|
||||
uim_slot--;
|
||||
}
|
||||
|
||||
mbim_priv = malloc(sizeof(struct mbim_data));
|
||||
if (!mbim_priv) {
|
||||
fprintf(stderr, "Failed allocating memory\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
mbim_priv->uim_slot = uim_slot;
|
||||
|
||||
const char *use_proxy = getenv("MBIM_USE_PROXY");
|
||||
if (use_proxy && strcmp(use_proxy, "0") != 0) {
|
||||
mbim_priv->use_proxy = TRUE;
|
||||
}
|
||||
|
||||
if (!(mbim_priv->device_path = getenv("MBIM_DEVICE"))) {
|
||||
mbim_priv->device_path = "/dev/cdc-wdm0";
|
||||
}
|
||||
|
||||
memset(ifstruct, 0, sizeof(struct euicc_apdu_interface));
|
||||
ifstruct->connect = apdu_interface_connect;
|
||||
ifstruct->disconnect = mbim_apdu_interface_disconnect;
|
||||
ifstruct->logic_channel_open = mbim_apdu_interface_logic_channel_open;
|
||||
ifstruct->logic_channel_close = mbim_apdu_interface_logic_channel_close;
|
||||
ifstruct->transmit = mbim_apdu_interface_transmit;
|
||||
ifstruct->userdata = mbim_priv;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int libapduinterface_main(int argc, char **argv)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void libapduinterface_fini(struct euicc_apdu_interface *ifstruct)
|
||||
{
|
||||
g_free(ifstruct->userdata);
|
||||
}
|
||||
|
||||
const struct euicc_driver driver_apdu_mbim = {
|
||||
.type = DRIVER_APDU,
|
||||
.name = "mbim",
|
||||
.init = (int (*)(void *))libapduinterface_init,
|
||||
.main = libapduinterface_main,
|
||||
.fini = (void (*)(void *))libapduinterface_fini,
|
||||
};
|
8
driver/apdu/mbim.h
Normal file
8
driver/apdu/mbim.h
Normal file
|
@ -0,0 +1,8 @@
|
|||
// SPDX-License-Identifier: MIT
|
||||
/*
|
||||
* Copyright (c) 2024, Frans Klaver <frans.klaver@vislink.com>
|
||||
*/
|
||||
#pragma once
|
||||
#include <driver.private.h>
|
||||
|
||||
extern const struct euicc_driver driver_apdu_mbim;
|
111
driver/apdu/mbim_helpers.c
Normal file
111
driver/apdu/mbim_helpers.c
Normal file
|
@ -0,0 +1,111 @@
|
|||
// SPDX-License-Identifier: MIT
|
||||
/*
|
||||
Copyright (c) 2024, Frans Klaver <frans.klaver@vislink.com>
|
||||
*/
|
||||
|
||||
#include "mbim_helpers.h"
|
||||
#include <libmbim-glib.h>
|
||||
|
||||
static void
|
||||
async_result_ready(GObject *source_object,
|
||||
GAsyncResult *res,
|
||||
gpointer user_data)
|
||||
{
|
||||
GAsyncResult **result_out = user_data;
|
||||
|
||||
g_assert(*result_out == NULL);
|
||||
*result_out = g_object_ref(res);
|
||||
}
|
||||
|
||||
MbimDevice *
|
||||
mbim_device_new_from_path(GFile *file,
|
||||
GMainContext *context,
|
||||
GError **error)
|
||||
{
|
||||
g_autoptr(GMainContextPusher) pusher = NULL;
|
||||
g_autoptr(GAsyncResult) result = NULL;
|
||||
g_autofree gchar *id = NULL;
|
||||
|
||||
pusher = g_main_context_pusher_new(context);
|
||||
|
||||
id = g_file_get_path (file);
|
||||
if (id)
|
||||
mbim_device_new(file,
|
||||
NULL,
|
||||
async_result_ready,
|
||||
&result);
|
||||
|
||||
while (!result)
|
||||
g_main_context_iteration(context, TRUE);
|
||||
|
||||
return mbim_device_new_finish(result, error);
|
||||
}
|
||||
|
||||
gboolean
|
||||
mbim_device_open_sync(MbimDevice *device,
|
||||
MbimDeviceOpenFlags open_flags,
|
||||
GMainContext *context,
|
||||
GError **error)
|
||||
{
|
||||
g_autoptr(GMainContextPusher) pusher = NULL;
|
||||
g_autoptr(GAsyncResult) result = NULL;
|
||||
|
||||
pusher = g_main_context_pusher_new(context);
|
||||
|
||||
mbim_device_open_full(device,
|
||||
open_flags,
|
||||
15,
|
||||
NULL,
|
||||
async_result_ready,
|
||||
&result);
|
||||
|
||||
while (!result)
|
||||
g_main_context_iteration(context, TRUE);
|
||||
|
||||
return mbim_device_open_finish(device, result, error);
|
||||
}
|
||||
|
||||
MbimMessage *
|
||||
mbim_device_command_sync(MbimDevice *device, GMainContext *context, MbimMessage *request, GError **error)
|
||||
{
|
||||
g_autoptr(GMainContextPusher) pusher = NULL;
|
||||
g_autoptr(GAsyncResult) result = NULL;
|
||||
|
||||
pusher = g_main_context_pusher_new(context);
|
||||
|
||||
mbim_device_command(device, request, 10, NULL, async_result_ready, &result);
|
||||
mbim_message_unref(request);
|
||||
|
||||
while (result == NULL)
|
||||
g_main_context_iteration(context, TRUE);
|
||||
|
||||
MbimMessage *response = mbim_device_command_finish(device, result, error);
|
||||
if (!response) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!mbim_message_response_get_result(response, MBIM_MESSAGE_TYPE_COMMAND_DONE, error)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
gboolean
|
||||
mbim_device_close_sync(
|
||||
MbimDevice *device,
|
||||
GMainContext *context,
|
||||
GError **error)
|
||||
{
|
||||
g_autoptr(GMainContextPusher) pusher = NULL;
|
||||
g_autoptr(GAsyncResult) result = NULL;
|
||||
|
||||
pusher = g_main_context_pusher_new(context);
|
||||
|
||||
mbim_device_close(device, 20, NULL, async_result_ready, &result);
|
||||
|
||||
while (result == NULL)
|
||||
g_main_context_iteration(context, TRUE);
|
||||
|
||||
return mbim_device_close_finish(device, result, error);
|
||||
}
|
32
driver/apdu/mbim_helpers.h
Normal file
32
driver/apdu/mbim_helpers.h
Normal file
|
@ -0,0 +1,32 @@
|
|||
// SPDX-License-Identifier: MIT
|
||||
/*
|
||||
* Copyright (c) 2024, Frans Klaver <frans.klaver@vislink.com>
|
||||
*/
|
||||
#pragma once
|
||||
#include <libmbim-glib.h>
|
||||
|
||||
MbimDevice *
|
||||
mbim_device_new_from_path(
|
||||
GFile *file,
|
||||
GMainContext *context,
|
||||
GError **error);
|
||||
|
||||
gboolean
|
||||
mbim_device_open_sync(
|
||||
MbimDevice *device,
|
||||
MbimDeviceOpenFlags open_flags,
|
||||
GMainContext *context,
|
||||
GError **error);
|
||||
|
||||
gboolean
|
||||
mbim_device_close_sync(
|
||||
MbimDevice *device,
|
||||
GMainContext *context,
|
||||
GError **error);
|
||||
|
||||
MbimMessage *
|
||||
mbim_device_command_sync(
|
||||
MbimDevice *device,
|
||||
GMainContext *context,
|
||||
MbimMessage *request,
|
||||
GError **error);
|
|
@ -1,21 +1,20 @@
|
|||
#include "pcsc.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef __MINGW32__
|
||||
#ifdef _WIN32
|
||||
#include <winscard.h>
|
||||
#elif defined(__CYGWIN__)
|
||||
#include "/usr/include/w32api/winscard.h"
|
||||
#include "/usr/include/w32api/wtypes.h"
|
||||
#include "pcsc_win32.h"
|
||||
#else
|
||||
#include <PCSC/wintypes.h>
|
||||
#include <PCSC/winscard.h>
|
||||
#endif
|
||||
|
||||
#include <euicc/interface.h>
|
||||
|
||||
#include <cjson/cJSON_ex.h>
|
||||
#include <euicc/interface.h>
|
||||
|
||||
#define INTERFACE_SELECT_ENV "DRIVER_IFID"
|
||||
|
||||
|
@ -31,6 +30,10 @@ static SCARDCONTEXT pcsc_ctx;
|
|||
static SCARDHANDLE pcsc_hCard;
|
||||
static LPSTR pcsc_mszReaders;
|
||||
|
||||
static void pcsc_error(const char *method, const int32_t code) {
|
||||
fprintf(stderr, "%s failed: %08X (%s)\n", method, code, pcsc_stringify_error(code));
|
||||
}
|
||||
|
||||
static int pcsc_ctx_open(void)
|
||||
{
|
||||
int ret;
|
||||
|
@ -43,7 +46,7 @@ static int pcsc_ctx_open(void)
|
|||
ret = SCardEstablishContext(SCARD_SCOPE_SYSTEM, NULL, NULL, &pcsc_ctx);
|
||||
if (ret != SCARD_S_SUCCESS)
|
||||
{
|
||||
fprintf(stderr, "SCardEstablishContext() failed: %08X\n", ret);
|
||||
pcsc_error("SCardEstablishContext()", ret);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -56,7 +59,7 @@ static int pcsc_ctx_open(void)
|
|||
ret = SCardListReaders(pcsc_ctx, NULL, NULL, &dwReaders);
|
||||
if (ret != SCARD_S_SUCCESS)
|
||||
{
|
||||
fprintf(stderr, "SCardListReaders() failed: %08X\n", ret);
|
||||
pcsc_error("SCardListReaders()", ret);
|
||||
return -1;
|
||||
}
|
||||
pcsc_mszReaders = malloc(sizeof(char) * dwReaders);
|
||||
|
@ -69,7 +72,7 @@ static int pcsc_ctx_open(void)
|
|||
#endif
|
||||
if (ret != SCARD_S_SUCCESS)
|
||||
{
|
||||
fprintf(stderr, "SCardListReaders() failed: %08X\n", ret);
|
||||
pcsc_error("SCardListReaders()", ret);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -123,7 +126,7 @@ static int pcsc_open_hCard_iter(int index, const char *reader, void *userdata)
|
|||
ret = SCardConnect(pcsc_ctx, reader, SCARD_SHARE_EXCLUSIVE, SCARD_PROTOCOL_T0, &pcsc_hCard, &dwActiveProtocol);
|
||||
if (ret != SCARD_S_SUCCESS)
|
||||
{
|
||||
fprintf(stderr, "SCardConnect() failed: %08X\n", ret);
|
||||
pcsc_error("SCardConnect()", ret);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -170,7 +173,7 @@ static int pcsc_transmit_lowlevel(uint8_t *rx, uint32_t *rx_len, const uint8_t *
|
|||
ret = SCardTransmit(pcsc_hCard, SCARD_PCI_T0, tx, tx_len, NULL, rx, &rx_len_merged);
|
||||
if (ret != SCARD_S_SUCCESS)
|
||||
{
|
||||
fprintf(stderr, "SCardTransmit() failed: %08X\n", ret);
|
||||
pcsc_error("SCardTransmit()", ret);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -392,7 +395,7 @@ static int pcsc_list_iter(int index, const char *reader, void *userdata)
|
|||
return 0;
|
||||
}
|
||||
|
||||
EUICC_SHARED_EXPORT int libapduinterface_init(struct euicc_apdu_interface *ifstruct)
|
||||
static int libapduinterface_init(struct euicc_apdu_interface *ifstruct)
|
||||
{
|
||||
memset(ifstruct, 0, sizeof(struct euicc_apdu_interface));
|
||||
|
||||
|
@ -410,7 +413,7 @@ EUICC_SHARED_EXPORT int libapduinterface_init(struct euicc_apdu_interface *ifstr
|
|||
return 0;
|
||||
}
|
||||
|
||||
EUICC_SHARED_EXPORT int libapduinterface_main(int argc, char **argv)
|
||||
static int libapduinterface_main(int argc, char **argv)
|
||||
{
|
||||
if (argc < 2)
|
||||
{
|
||||
|
@ -454,3 +457,16 @@ EUICC_SHARED_EXPORT int libapduinterface_main(int argc, char **argv)
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void libapduinterface_fini(struct euicc_apdu_interface *ifstruct)
|
||||
{
|
||||
}
|
||||
|
||||
const struct euicc_driver driver_apdu_pcsc = {
|
||||
.type = DRIVER_APDU,
|
||||
.name = "pcsc",
|
||||
.init = (int (*)(void *))libapduinterface_init,
|
||||
.main = libapduinterface_main,
|
||||
.fini = (void (*)(void *))libapduinterface_fini,
|
||||
};
|
||||
|
4
driver/apdu/pcsc.h
Normal file
4
driver/apdu/pcsc.h
Normal file
|
@ -0,0 +1,4 @@
|
|||
#pragma once
|
||||
#include <driver.private.h>
|
||||
|
||||
extern const struct euicc_driver driver_apdu_pcsc;
|
83
driver/apdu/pcsc_win32.c
Normal file
83
driver/apdu/pcsc_win32.c
Normal file
|
@ -0,0 +1,83 @@
|
|||
#ifdef _WIN32
|
||||
#include "pcsc_win32.h"
|
||||
|
||||
#define PCSC_ERROR_CASE(NAME) case NAME: return #NAME
|
||||
|
||||
const char *pcsc_stringify_error(const LONG err) {
|
||||
switch (err) {
|
||||
PCSC_ERROR_CASE(SCARD_S_SUCCESS);
|
||||
PCSC_ERROR_CASE(SCARD_F_INTERNAL_ERROR);
|
||||
PCSC_ERROR_CASE(SCARD_E_CANCELLED);
|
||||
PCSC_ERROR_CASE(SCARD_E_INVALID_HANDLE);
|
||||
PCSC_ERROR_CASE(SCARD_E_INVALID_PARAMETER);
|
||||
PCSC_ERROR_CASE(SCARD_E_INVALID_TARGET);
|
||||
PCSC_ERROR_CASE(SCARD_E_NO_MEMORY);
|
||||
PCSC_ERROR_CASE(SCARD_F_WAITED_TOO_LONG);
|
||||
PCSC_ERROR_CASE(SCARD_E_INSUFFICIENT_BUFFER);
|
||||
PCSC_ERROR_CASE(SCARD_E_UNKNOWN_READER);
|
||||
PCSC_ERROR_CASE(SCARD_E_TIMEOUT);
|
||||
PCSC_ERROR_CASE(SCARD_E_SHARING_VIOLATION);
|
||||
PCSC_ERROR_CASE(SCARD_E_NO_SMARTCARD);
|
||||
PCSC_ERROR_CASE(SCARD_E_UNKNOWN_CARD);
|
||||
PCSC_ERROR_CASE(SCARD_E_CANT_DISPOSE);
|
||||
PCSC_ERROR_CASE(SCARD_E_PROTO_MISMATCH);
|
||||
PCSC_ERROR_CASE(SCARD_E_NOT_READY);
|
||||
PCSC_ERROR_CASE(SCARD_E_INVALID_VALUE);
|
||||
PCSC_ERROR_CASE(SCARD_E_SYSTEM_CANCELLED);
|
||||
PCSC_ERROR_CASE(SCARD_F_COMM_ERROR);
|
||||
PCSC_ERROR_CASE(SCARD_F_UNKNOWN_ERROR);
|
||||
PCSC_ERROR_CASE(SCARD_E_INVALID_ATR);
|
||||
PCSC_ERROR_CASE(SCARD_E_NOT_TRANSACTED);
|
||||
PCSC_ERROR_CASE(SCARD_E_READER_UNAVAILABLE);
|
||||
PCSC_ERROR_CASE(SCARD_P_SHUTDOWN);
|
||||
PCSC_ERROR_CASE(SCARD_E_PCI_TOO_SMALL);
|
||||
PCSC_ERROR_CASE(SCARD_E_READER_UNSUPPORTED);
|
||||
PCSC_ERROR_CASE(SCARD_E_DUPLICATE_READER);
|
||||
PCSC_ERROR_CASE(SCARD_E_CARD_UNSUPPORTED);
|
||||
PCSC_ERROR_CASE(SCARD_E_NO_SERVICE);
|
||||
PCSC_ERROR_CASE(SCARD_E_SERVICE_STOPPED);
|
||||
PCSC_ERROR_CASE(SCARD_E_UNEXPECTED);
|
||||
PCSC_ERROR_CASE(SCARD_E_ICC_INSTALLATION);
|
||||
PCSC_ERROR_CASE(SCARD_E_ICC_CREATEORDER);
|
||||
PCSC_ERROR_CASE(SCARD_E_UNSUPPORTED_FEATURE);
|
||||
PCSC_ERROR_CASE(SCARD_E_DIR_NOT_FOUND);
|
||||
PCSC_ERROR_CASE(SCARD_E_FILE_NOT_FOUND);
|
||||
PCSC_ERROR_CASE(SCARD_E_NO_DIR);
|
||||
PCSC_ERROR_CASE(SCARD_E_NO_FILE);
|
||||
PCSC_ERROR_CASE(SCARD_E_NO_ACCESS);
|
||||
PCSC_ERROR_CASE(SCARD_E_WRITE_TOO_MANY);
|
||||
PCSC_ERROR_CASE(SCARD_E_BAD_SEEK);
|
||||
PCSC_ERROR_CASE(SCARD_E_INVALID_CHV);
|
||||
PCSC_ERROR_CASE(SCARD_E_UNKNOWN_RES_MNG);
|
||||
PCSC_ERROR_CASE(SCARD_E_NO_SUCH_CERTIFICATE);
|
||||
PCSC_ERROR_CASE(SCARD_E_CERTIFICATE_UNAVAILABLE);
|
||||
PCSC_ERROR_CASE(SCARD_E_NO_READERS_AVAILABLE);
|
||||
PCSC_ERROR_CASE(SCARD_E_COMM_DATA_LOST);
|
||||
PCSC_ERROR_CASE(SCARD_E_NO_KEY_CONTAINER);
|
||||
PCSC_ERROR_CASE(SCARD_E_SERVER_TOO_BUSY);
|
||||
PCSC_ERROR_CASE(SCARD_E_PIN_CACHE_EXPIRED);
|
||||
PCSC_ERROR_CASE(SCARD_E_NO_PIN_CACHE);
|
||||
PCSC_ERROR_CASE(SCARD_E_READ_ONLY_CARD);
|
||||
PCSC_ERROR_CASE(SCARD_W_UNSUPPORTED_CARD);
|
||||
PCSC_ERROR_CASE(SCARD_W_UNRESPONSIVE_CARD);
|
||||
PCSC_ERROR_CASE(SCARD_W_UNPOWERED_CARD);
|
||||
PCSC_ERROR_CASE(SCARD_W_RESET_CARD);
|
||||
PCSC_ERROR_CASE(SCARD_W_REMOVED_CARD);
|
||||
PCSC_ERROR_CASE(SCARD_W_SECURITY_VIOLATION);
|
||||
PCSC_ERROR_CASE(SCARD_W_WRONG_CHV);
|
||||
PCSC_ERROR_CASE(SCARD_W_CHV_BLOCKED);
|
||||
PCSC_ERROR_CASE(SCARD_W_EOF);
|
||||
PCSC_ERROR_CASE(SCARD_W_CANCELLED_BY_USER);
|
||||
PCSC_ERROR_CASE(SCARD_W_CARD_NOT_AUTHENTICATED);
|
||||
PCSC_ERROR_CASE(SCARD_W_CACHE_ITEM_NOT_FOUND);
|
||||
PCSC_ERROR_CASE(SCARD_W_CACHE_ITEM_STALE);
|
||||
PCSC_ERROR_CASE(ERROR_IO_DEVICE);
|
||||
PCSC_ERROR_CASE(ERROR_BROKEN_PIPE);
|
||||
default:
|
||||
return "Unknown error";
|
||||
}
|
||||
}
|
||||
|
||||
#undef PCSC_ERROR_CASE
|
||||
|
||||
#endif
|
6
driver/apdu/pcsc_win32.h
Normal file
6
driver/apdu/pcsc_win32.h
Normal file
|
@ -0,0 +1,6 @@
|
|||
#pragma once
|
||||
#ifdef _WIN32
|
||||
#include <winscard.h>
|
||||
|
||||
const char *pcsc_stringify_error(LONG);
|
||||
#endif
|
101
driver/apdu/qmi.c
Normal file
101
driver/apdu/qmi.c
Normal file
|
@ -0,0 +1,101 @@
|
|||
// SPDX-License-Identifier: MIT
|
||||
/*
|
||||
* Copyright (c) 2024, Robert Marko <robert.marko@sartura.hr>
|
||||
*/
|
||||
#include "qmi.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include "qmi_common.h"
|
||||
|
||||
static int apdu_interface_connect(struct euicc_ctx *ctx)
|
||||
{
|
||||
struct qmi_data *qmi_priv = ctx->apdu.interface->userdata;
|
||||
g_autoptr(GError) error = NULL;
|
||||
QmiDevice *device = NULL;
|
||||
QmiClient *client = NULL;
|
||||
const char *device_path;
|
||||
GFile *file;
|
||||
|
||||
if (!(device_path = getenv("QMI_DEVICE"))) {
|
||||
fprintf(stderr, "No QMI device path specified!\n");
|
||||
return -1;
|
||||
}
|
||||
file = g_file_new_for_path(device_path);
|
||||
|
||||
qmi_priv->context = g_main_context_new();
|
||||
|
||||
device = qmi_device_new_from_path(file, qmi_priv->context, &error);
|
||||
if (!device) {
|
||||
fprintf(stderr, "error: create QMI device from path failed: %s\n", error->message);
|
||||
return -1;
|
||||
}
|
||||
|
||||
qmi_device_open_sync(device, QMI_DEVICE_OPEN_FLAGS_PROXY, qmi_priv->context, &error);
|
||||
if (error) {
|
||||
fprintf(stderr, "error: open QMI device failed: %s\n", error->message);
|
||||
return -1;
|
||||
}
|
||||
|
||||
client = qmi_device_allocate_client_sync(device, qmi_priv->context, &error);
|
||||
if (!client) {
|
||||
fprintf(stderr, "error: allocate QMI client failed: %s\n", error->message);
|
||||
return -1;
|
||||
}
|
||||
|
||||
qmi_priv->uimClient = QMI_CLIENT_UIM(client);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int libapduinterface_init(struct euicc_apdu_interface *ifstruct)
|
||||
{
|
||||
struct qmi_data *qmi_priv;
|
||||
|
||||
qmi_priv = calloc(1, sizeof(struct qmi_data));
|
||||
if(!qmi_priv) {
|
||||
fprintf(stderr, "Failed allocating memory\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
memset(ifstruct, 0, sizeof(struct euicc_apdu_interface));
|
||||
ifstruct->connect = apdu_interface_connect;
|
||||
ifstruct->disconnect = qmi_apdu_interface_disconnect;
|
||||
ifstruct->logic_channel_open = qmi_apdu_interface_logic_channel_open;
|
||||
ifstruct->logic_channel_close = qmi_apdu_interface_logic_channel_close;
|
||||
ifstruct->transmit = qmi_apdu_interface_transmit;
|
||||
|
||||
/*
|
||||
* Allow the user to select the SIM card slot via environment variable.
|
||||
* Use the primary SIM slot if not set.
|
||||
*/
|
||||
if (getenv("UIM_SLOT"))
|
||||
qmi_priv->uimSlot = atoi(getenv("UIM_SLOT"));
|
||||
else
|
||||
qmi_priv->uimSlot = 1;
|
||||
|
||||
ifstruct->userdata = qmi_priv;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int libapduinterface_main(int argc, char **argv)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void libapduinterface_fini(struct euicc_apdu_interface *ifstruct)
|
||||
{
|
||||
struct qmi_data *qmi_priv = ifstruct->userdata;
|
||||
|
||||
qmi_cleanup(qmi_priv);
|
||||
|
||||
free(qmi_priv);
|
||||
}
|
||||
|
||||
const struct euicc_driver driver_apdu_qmi = {
|
||||
.type = DRIVER_APDU,
|
||||
.name = "qmi",
|
||||
.init = (int (*)(void *))libapduinterface_init,
|
||||
.main = libapduinterface_main,
|
||||
.fini = (void (*)(void *))libapduinterface_fini,
|
||||
};
|
8
driver/apdu/qmi.h
Normal file
8
driver/apdu/qmi.h
Normal file
|
@ -0,0 +1,8 @@
|
|||
// SPDX-License-Identifier: MIT
|
||||
/*
|
||||
* Copyright (c) 2024, Robert Marko <robert.marko@sartura.hr>
|
||||
*/
|
||||
#pragma once
|
||||
#include <driver.private.h>
|
||||
|
||||
extern const struct euicc_driver driver_apdu_qmi;
|
163
driver/apdu/qmi_common.c
Normal file
163
driver/apdu/qmi_common.c
Normal file
|
@ -0,0 +1,163 @@
|
|||
// SPDX-License-Identifier: MIT
|
||||
/*
|
||||
* Copyright (c) 2024, Luca Weiss <luca.weiss@fairphone.com>
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "qmi_common.h"
|
||||
|
||||
int qmi_apdu_interface_transmit(struct euicc_ctx *ctx, uint8_t **rx, uint32_t *rx_len, const uint8_t *tx, uint32_t tx_len)
|
||||
{
|
||||
struct qmi_data *qmi_priv = ctx->apdu.interface->userdata;
|
||||
g_autoptr(GError) error = NULL;
|
||||
g_autoptr(GArray) apdu_data = NULL;
|
||||
|
||||
/* Convert tx into request GArray */
|
||||
apdu_data = g_array_new(FALSE, FALSE, sizeof(guint8));
|
||||
for (uint32_t i = 0; i < tx_len; i++)
|
||||
g_array_append_val(apdu_data, tx[i]);
|
||||
|
||||
QmiMessageUimSendApduInput *input;
|
||||
input = qmi_message_uim_send_apdu_input_new();
|
||||
qmi_message_uim_send_apdu_input_set_slot(input, qmi_priv->uimSlot, NULL);
|
||||
qmi_message_uim_send_apdu_input_set_channel_id(input, qmi_priv->lastChannelId, NULL);
|
||||
qmi_message_uim_send_apdu_input_set_apdu(input, apdu_data, NULL);
|
||||
|
||||
QmiMessageUimSendApduOutput *output;
|
||||
output = qmi_client_uim_send_apdu_sync(qmi_priv->uimClient, input, qmi_priv->context, &error);
|
||||
|
||||
qmi_message_uim_send_apdu_input_unref(input);
|
||||
|
||||
if (!qmi_message_uim_send_apdu_output_get_result(output, &error))
|
||||
{
|
||||
fprintf(stderr, "error: send apdu operation failed: %s\n", error->message);
|
||||
return -1;
|
||||
}
|
||||
|
||||
GArray *apdu_res = NULL;
|
||||
if (!qmi_message_uim_send_apdu_output_get_apdu_response(output, &apdu_res, &error))
|
||||
{
|
||||
fprintf(stderr, "error: get apdu response operation failed: %s\n", error->message);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Convert response GArray into rx */
|
||||
*rx_len = apdu_res->len;
|
||||
*rx = malloc(*rx_len);
|
||||
if (!*rx)
|
||||
return -1;
|
||||
for (guint i = 0; i < apdu_res->len; i++)
|
||||
(*rx)[i] = apdu_res->data[i];
|
||||
|
||||
qmi_message_uim_send_apdu_output_unref(output);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int qmi_apdu_interface_logic_channel_open(struct euicc_ctx *ctx, const uint8_t *aid, uint8_t aid_len)
|
||||
{
|
||||
struct qmi_data *qmi_priv = ctx->apdu.interface->userdata;
|
||||
g_autoptr(GError) error = NULL;
|
||||
guint8 channel_id;
|
||||
|
||||
GArray *aid_data = g_array_new(FALSE, FALSE, sizeof(guint8));
|
||||
for (int i = 0; i < aid_len; i++)
|
||||
g_array_append_val(aid_data, aid[i]);
|
||||
|
||||
QmiMessageUimOpenLogicalChannelInput *input;
|
||||
input = qmi_message_uim_open_logical_channel_input_new();
|
||||
qmi_message_uim_open_logical_channel_input_set_slot(input, qmi_priv->uimSlot, NULL);
|
||||
qmi_message_uim_open_logical_channel_input_set_aid(input, aid_data, NULL);
|
||||
|
||||
QmiMessageUimOpenLogicalChannelOutput *output;
|
||||
output = qmi_client_uim_open_logical_channel_sync(qmi_priv->uimClient, input, qmi_priv->context, &error);
|
||||
|
||||
qmi_message_uim_open_logical_channel_input_unref(input);
|
||||
g_array_unref(aid_data);
|
||||
|
||||
if (!output)
|
||||
{
|
||||
fprintf(stderr, "error: send Open Logical Channel command failed: %s\n", error->message);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!qmi_message_uim_open_logical_channel_output_get_result(output, &error))
|
||||
{
|
||||
fprintf(stderr, "error: open logical channel operation failed: %s\n", error->message);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!qmi_message_uim_open_logical_channel_output_get_channel_id(output, &channel_id, &error))
|
||||
{
|
||||
fprintf(stderr, "error: get channel id operation failed: %s\n", error->message);
|
||||
return -1;
|
||||
}
|
||||
qmi_priv->lastChannelId = channel_id;
|
||||
|
||||
g_debug("Opened logical channel with id %d", channel_id);
|
||||
|
||||
qmi_message_uim_open_logical_channel_output_unref(output);
|
||||
|
||||
return channel_id;
|
||||
}
|
||||
|
||||
void qmi_apdu_interface_logic_channel_close(struct euicc_ctx *ctx, uint8_t channel)
|
||||
{
|
||||
struct qmi_data *qmi_priv = ctx->apdu.interface->userdata;
|
||||
g_autoptr(GError) error = NULL;
|
||||
|
||||
QmiMessageUimLogicalChannelInput *input;
|
||||
input = qmi_message_uim_logical_channel_input_new();
|
||||
qmi_message_uim_logical_channel_input_set_slot(input, qmi_priv->uimSlot, NULL);
|
||||
qmi_message_uim_logical_channel_input_set_channel_id(input, channel, NULL);
|
||||
|
||||
QmiMessageUimLogicalChannelOutput *output;
|
||||
output = qmi_client_uim_logical_channel_sync(qmi_priv->uimClient, input, qmi_priv->context, &error);
|
||||
|
||||
qmi_message_uim_logical_channel_input_unref(input);
|
||||
|
||||
if (error)
|
||||
{
|
||||
fprintf(stderr, "error: send Close Logical Channel command failed: %s\n", error->message);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!qmi_message_uim_logical_channel_output_get_result(output, &error))
|
||||
{
|
||||
fprintf(stderr, "error: logical channel operation failed: %s\n", error->message);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Mark channel as having been cleaned up */
|
||||
if (channel == qmi_priv->lastChannelId)
|
||||
qmi_priv->lastChannelId = -1;
|
||||
|
||||
g_debug("Closed logical channel with id %d", channel);
|
||||
|
||||
qmi_message_uim_logical_channel_output_unref(output);
|
||||
}
|
||||
|
||||
void qmi_apdu_interface_disconnect(struct euicc_ctx *ctx)
|
||||
{
|
||||
struct qmi_data *qmi_priv = ctx->apdu.interface->userdata;
|
||||
g_autoptr(GError) error = NULL;
|
||||
QmiClient *client = QMI_CLIENT(qmi_priv->uimClient);
|
||||
QmiDevice *device = QMI_DEVICE(qmi_client_get_device(client));
|
||||
|
||||
qmi_device_release_client_sync(device, client, qmi_priv->context, &error);
|
||||
qmi_priv->uimClient = NULL;
|
||||
|
||||
g_main_context_unref(qmi_priv->context);
|
||||
qmi_priv->context = NULL;
|
||||
}
|
||||
|
||||
void qmi_cleanup(struct qmi_data *qmi_priv)
|
||||
{
|
||||
if (qmi_priv->lastChannelId > 0)
|
||||
{
|
||||
fprintf(stderr, "Cleaning up leaked APDU channel %d\n", qmi_priv->lastChannelId);
|
||||
qmi_apdu_interface_logic_channel_close(NULL, qmi_priv->lastChannelId);
|
||||
qmi_priv->lastChannelId = -1;
|
||||
}
|
||||
}
|
21
driver/apdu/qmi_common.h
Normal file
21
driver/apdu/qmi_common.h
Normal file
|
@ -0,0 +1,21 @@
|
|||
// SPDX-License-Identifier: MIT
|
||||
/*
|
||||
* Copyright (c) 2024, Luca Weiss <luca.weiss@fairphone.com>
|
||||
*/
|
||||
#pragma once
|
||||
#include <euicc/interface.h>
|
||||
#include <euicc/euicc.h>
|
||||
#include "qmi_helpers.h"
|
||||
|
||||
struct qmi_data {
|
||||
int lastChannelId;
|
||||
int uimSlot;
|
||||
GMainContext *context;
|
||||
QmiClientUim *uimClient;
|
||||
};
|
||||
|
||||
int qmi_apdu_interface_transmit(struct euicc_ctx *ctx, uint8_t **rx, uint32_t *rx_len, const uint8_t *tx, uint32_t tx_len);
|
||||
int qmi_apdu_interface_logic_channel_open(struct euicc_ctx *ctx, const uint8_t *aid, uint8_t aid_len);
|
||||
void qmi_apdu_interface_logic_channel_close(struct euicc_ctx *ctx, uint8_t channel);
|
||||
void qmi_apdu_interface_disconnect(struct euicc_ctx *ctx);
|
||||
void qmi_cleanup(struct qmi_data *qmi_priv);
|
234
driver/apdu/qmi_helpers.c
Normal file
234
driver/apdu/qmi_helpers.c
Normal file
|
@ -0,0 +1,234 @@
|
|||
// SPDX-License-Identifier: MIT
|
||||
/*
|
||||
* Copyright (c) 2024, Luca Weiss <luca.weiss@fairphone.com>
|
||||
*/
|
||||
|
||||
#include "qmi_helpers.h"
|
||||
|
||||
static void
|
||||
async_result_ready(GObject *source_object,
|
||||
GAsyncResult *res,
|
||||
gpointer user_data)
|
||||
{
|
||||
GAsyncResult **result_out = user_data;
|
||||
|
||||
g_assert(*result_out == NULL);
|
||||
*result_out = g_object_ref(res);
|
||||
}
|
||||
|
||||
#ifdef LPAC_WITH_APDU_QMI_QRTR
|
||||
QrtrBus *
|
||||
qrtr_bus_new_sync(GMainContext *context,
|
||||
GError **error)
|
||||
{
|
||||
g_autoptr(GMainContextPusher) pusher = NULL;
|
||||
g_autoptr(GAsyncResult) result = NULL;
|
||||
|
||||
pusher = g_main_context_pusher_new(context);
|
||||
|
||||
qrtr_bus_new(1000, /* ms */
|
||||
NULL,
|
||||
async_result_ready,
|
||||
&result);
|
||||
|
||||
while (result == NULL)
|
||||
g_main_context_iteration(context, TRUE);
|
||||
|
||||
return qrtr_bus_new_finish(result, error);
|
||||
}
|
||||
|
||||
QmiDevice *
|
||||
qmi_device_new_from_node_sync(QrtrNode *node,
|
||||
GMainContext *context,
|
||||
GError **error)
|
||||
{
|
||||
g_autoptr(GMainContextPusher) pusher = NULL;
|
||||
g_autoptr(GAsyncResult) result = NULL;
|
||||
|
||||
pusher = g_main_context_pusher_new(context);
|
||||
|
||||
qmi_device_new_from_node(node,
|
||||
NULL,
|
||||
async_result_ready,
|
||||
&result);
|
||||
|
||||
while (result == NULL)
|
||||
g_main_context_iteration(context, TRUE);
|
||||
|
||||
return qmi_device_new_from_node_finish(result, error);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef LPAC_WITH_APDU_QMI
|
||||
QmiDevice *
|
||||
qmi_device_new_from_path(GFile *file,
|
||||
GMainContext *context,
|
||||
GError **error)
|
||||
{
|
||||
g_autoptr(GMainContextPusher) pusher = NULL;
|
||||
g_autoptr(GAsyncResult) result = NULL;
|
||||
g_autofree gchar *id = NULL;
|
||||
|
||||
pusher = g_main_context_pusher_new(context);
|
||||
|
||||
id = g_file_get_path (file);
|
||||
if (id)
|
||||
qmi_device_new(file,
|
||||
NULL,
|
||||
async_result_ready,
|
||||
&result);
|
||||
|
||||
while (result == NULL)
|
||||
g_main_context_iteration(context, TRUE);
|
||||
|
||||
return qmi_device_new_finish(result, error);
|
||||
}
|
||||
#endif
|
||||
|
||||
gboolean
|
||||
qmi_device_open_sync(QmiDevice *device,
|
||||
QmiDeviceOpenFlags flags,
|
||||
GMainContext *context,
|
||||
GError **error)
|
||||
{
|
||||
g_autoptr(GMainContextPusher) pusher = NULL;
|
||||
g_autoptr(GAsyncResult) result = NULL;
|
||||
|
||||
pusher = g_main_context_pusher_new(context);
|
||||
|
||||
qmi_device_open(device,
|
||||
flags,
|
||||
15,
|
||||
NULL,
|
||||
async_result_ready,
|
||||
&result);
|
||||
|
||||
while (result == NULL)
|
||||
g_main_context_iteration(context, TRUE);
|
||||
|
||||
return qmi_device_open_finish(device, result, error);
|
||||
}
|
||||
|
||||
QmiClient *
|
||||
qmi_device_allocate_client_sync(QmiDevice *device,
|
||||
GMainContext *context,
|
||||
GError **error)
|
||||
{
|
||||
g_autoptr(GMainContextPusher) pusher = NULL;
|
||||
g_autoptr(GAsyncResult) result = NULL;
|
||||
|
||||
pusher = g_main_context_pusher_new(context);
|
||||
|
||||
qmi_device_allocate_client(device,
|
||||
QMI_SERVICE_UIM,
|
||||
QMI_CID_NONE,
|
||||
10,
|
||||
NULL,
|
||||
async_result_ready,
|
||||
&result);
|
||||
|
||||
while (result == NULL)
|
||||
g_main_context_iteration(context, TRUE);
|
||||
|
||||
return qmi_device_allocate_client_finish(device, result, error);
|
||||
}
|
||||
|
||||
gboolean
|
||||
qmi_device_release_client_sync(QmiDevice *device,
|
||||
QmiClient *client,
|
||||
GMainContext *context,
|
||||
GError **error)
|
||||
{
|
||||
g_autoptr(GMainContextPusher) pusher = NULL;
|
||||
g_autoptr(GAsyncResult) result = NULL;
|
||||
|
||||
pusher = g_main_context_pusher_new(context);
|
||||
|
||||
qmi_device_release_client(device,
|
||||
client,
|
||||
QMI_DEVICE_RELEASE_CLIENT_FLAGS_RELEASE_CID,
|
||||
10,
|
||||
NULL,
|
||||
async_result_ready,
|
||||
&result);
|
||||
|
||||
while (result == NULL)
|
||||
g_main_context_iteration(context, TRUE);
|
||||
|
||||
return qmi_device_release_client_finish(device, result, error);
|
||||
}
|
||||
|
||||
QmiMessageUimOpenLogicalChannelOutput *
|
||||
qmi_client_uim_open_logical_channel_sync(
|
||||
QmiClientUim *client,
|
||||
QmiMessageUimOpenLogicalChannelInput *input,
|
||||
GMainContext *context,
|
||||
GError **error)
|
||||
{
|
||||
g_autoptr(GMainContextPusher) pusher = NULL;
|
||||
g_autoptr(GAsyncResult) result = NULL;
|
||||
|
||||
pusher = g_main_context_pusher_new(context);
|
||||
|
||||
qmi_client_uim_open_logical_channel(client,
|
||||
input,
|
||||
10,
|
||||
NULL,
|
||||
async_result_ready,
|
||||
&result);
|
||||
|
||||
while (result == NULL)
|
||||
g_main_context_iteration(context, TRUE);
|
||||
|
||||
return qmi_client_uim_open_logical_channel_finish(client, result, error);
|
||||
}
|
||||
|
||||
QmiMessageUimLogicalChannelOutput *
|
||||
qmi_client_uim_logical_channel_sync(
|
||||
QmiClientUim *client,
|
||||
QmiMessageUimLogicalChannelInput *input,
|
||||
GMainContext *context,
|
||||
GError **error)
|
||||
{
|
||||
g_autoptr(GMainContextPusher) pusher = NULL;
|
||||
g_autoptr(GAsyncResult) result = NULL;
|
||||
|
||||
pusher = g_main_context_pusher_new(context);
|
||||
|
||||
qmi_client_uim_logical_channel(client,
|
||||
input,
|
||||
10,
|
||||
NULL,
|
||||
async_result_ready,
|
||||
&result);
|
||||
|
||||
while (result == NULL)
|
||||
g_main_context_iteration(context, TRUE);
|
||||
|
||||
return qmi_client_uim_logical_channel_finish(client, result, error);
|
||||
}
|
||||
|
||||
QmiMessageUimSendApduOutput *
|
||||
qmi_client_uim_send_apdu_sync(
|
||||
QmiClientUim *client,
|
||||
QmiMessageUimSendApduInput *input,
|
||||
GMainContext *context,
|
||||
GError **error)
|
||||
{
|
||||
g_autoptr(GMainContextPusher) pusher = NULL;
|
||||
g_autoptr(GAsyncResult) result = NULL;
|
||||
|
||||
pusher = g_main_context_pusher_new(context);
|
||||
|
||||
qmi_client_uim_send_apdu(client,
|
||||
input,
|
||||
10,
|
||||
NULL,
|
||||
async_result_ready,
|
||||
&result);
|
||||
|
||||
while (result == NULL)
|
||||
g_main_context_iteration(context, TRUE);
|
||||
|
||||
return qmi_client_uim_send_apdu_finish(client, result, error);
|
||||
}
|
69
driver/apdu/qmi_helpers.h
Normal file
69
driver/apdu/qmi_helpers.h
Normal file
|
@ -0,0 +1,69 @@
|
|||
// SPDX-License-Identifier: MIT
|
||||
/*
|
||||
* Copyright (c) 2024, Luca Weiss <luca.weiss@fairphone.com>
|
||||
*/
|
||||
#pragma once
|
||||
#include <libqmi-glib.h>
|
||||
|
||||
#ifdef LPAC_WITH_APDU_QMI_QRTR
|
||||
#include <libqrtr-glib.h>
|
||||
|
||||
QrtrBus *qrtr_bus_new_sync(
|
||||
GMainContext *context,
|
||||
GError **error);
|
||||
|
||||
QmiDevice *
|
||||
qmi_device_new_from_node_sync(
|
||||
QrtrNode *node,
|
||||
GMainContext *context,
|
||||
GError **error);
|
||||
#endif
|
||||
|
||||
#ifdef LPAC_WITH_APDU_QMI
|
||||
QmiDevice *
|
||||
qmi_device_new_from_path(
|
||||
GFile *file,
|
||||
GMainContext *context,
|
||||
GError **error);
|
||||
#endif
|
||||
|
||||
gboolean
|
||||
qmi_device_open_sync(
|
||||
QmiDevice *device,
|
||||
QmiDeviceOpenFlags flags,
|
||||
GMainContext *context,
|
||||
GError **error);
|
||||
|
||||
QmiClient *
|
||||
qmi_device_allocate_client_sync(
|
||||
QmiDevice *device,
|
||||
GMainContext *context,
|
||||
GError **error);
|
||||
|
||||
gboolean
|
||||
qmi_device_release_client_sync(
|
||||
QmiDevice *device,
|
||||
QmiClient *client,
|
||||
GMainContext *context,
|
||||
GError **error);
|
||||
|
||||
QmiMessageUimOpenLogicalChannelOutput *
|
||||
qmi_client_uim_open_logical_channel_sync(
|
||||
QmiClientUim *client,
|
||||
QmiMessageUimOpenLogicalChannelInput *input,
|
||||
GMainContext *context,
|
||||
GError **error);
|
||||
|
||||
QmiMessageUimLogicalChannelOutput *
|
||||
qmi_client_uim_logical_channel_sync(
|
||||
QmiClientUim *client,
|
||||
QmiMessageUimLogicalChannelInput *input,
|
||||
GMainContext *context,
|
||||
GError **error);
|
||||
|
||||
QmiMessageUimSendApduOutput *
|
||||
qmi_client_uim_send_apdu_sync(
|
||||
QmiClientUim *client,
|
||||
QmiMessageUimSendApduInput *input,
|
||||
GMainContext *context,
|
||||
GError **error);
|
136
driver/apdu/qmi_qrtr.c
Normal file
136
driver/apdu/qmi_qrtr.c
Normal file
|
@ -0,0 +1,136 @@
|
|||
// SPDX-License-Identifier: MIT
|
||||
/*
|
||||
* Copyright (c) 2024, Luca Weiss <luca.weiss@fairphone.com>
|
||||
*/
|
||||
#include "qmi_qrtr.h"
|
||||
|
||||
#include <euicc/interface.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
#include <libqrtr-glib.h>
|
||||
#include "qmi_common.h"
|
||||
|
||||
static QrtrBus *bus = NULL;
|
||||
|
||||
static int apdu_interface_connect(struct euicc_ctx *ctx)
|
||||
{
|
||||
struct qmi_data *qmi_priv = ctx->apdu.interface->userdata;
|
||||
g_autoptr(GError) error = NULL;
|
||||
QrtrNode *node = NULL;
|
||||
QmiDevice *device = NULL;
|
||||
QmiClient *client = NULL;
|
||||
bool found = false;
|
||||
|
||||
qmi_priv->context = g_main_context_new();
|
||||
|
||||
bus = qrtr_bus_new_sync(qmi_priv->context, &error);
|
||||
if (bus == NULL)
|
||||
{
|
||||
fprintf(stderr, "error: connect to QRTR bus failed: %s\n", error->message);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Find QRTR node for UIM service */
|
||||
for (GList *l = qrtr_bus_peek_nodes(bus); l != NULL; l = l->next)
|
||||
{
|
||||
node = l->data;
|
||||
|
||||
if (node && qrtr_node_lookup_port(node, QMI_SERVICE_UIM) >= 0)
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found)
|
||||
{
|
||||
fprintf(stderr, "error: find QRTR node with UIM service failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
device = qmi_device_new_from_node_sync(node, qmi_priv->context, &error);
|
||||
if (!device)
|
||||
{
|
||||
fprintf(stderr, "error: create QMI device from QRTR node failed: %s\n", error->message);
|
||||
return -1;
|
||||
}
|
||||
|
||||
qmi_device_open_sync(device, QMI_DEVICE_OPEN_FLAGS_NONE, qmi_priv->context, &error);
|
||||
if (error)
|
||||
{
|
||||
fprintf(stderr, "error: open QMI device failed: %s\n", error->message);
|
||||
return -1;
|
||||
}
|
||||
|
||||
client = qmi_device_allocate_client_sync(device, qmi_priv->context, &error);
|
||||
if (!client)
|
||||
{
|
||||
fprintf(stderr, "error: allocate QMI client failed: %s\n", error->message);
|
||||
return -1;
|
||||
}
|
||||
|
||||
qmi_priv->uimClient = QMI_CLIENT_UIM(client);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int libapduinterface_init(struct euicc_apdu_interface *ifstruct)
|
||||
{
|
||||
struct qmi_data *qmi_priv;
|
||||
|
||||
qmi_priv = malloc(sizeof(struct qmi_data));
|
||||
if(!qmi_priv) {
|
||||
fprintf(stderr, "Failed allocating memory\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
memset(ifstruct, 0, sizeof(struct euicc_apdu_interface));
|
||||
|
||||
ifstruct->connect = apdu_interface_connect;
|
||||
ifstruct->disconnect = qmi_apdu_interface_disconnect;
|
||||
ifstruct->logic_channel_open = qmi_apdu_interface_logic_channel_open;
|
||||
ifstruct->logic_channel_close = qmi_apdu_interface_logic_channel_close;
|
||||
ifstruct->transmit = qmi_apdu_interface_transmit;
|
||||
|
||||
/*
|
||||
* Allow the user to select the SIM card slot via environment variable.
|
||||
* Use the primary SIM slot if not set.
|
||||
*/
|
||||
if (getenv("UIM_SLOT"))
|
||||
{
|
||||
qmi_priv->uimSlot = atoi(getenv("UIM_SLOT"));
|
||||
}
|
||||
else
|
||||
{
|
||||
qmi_priv->uimSlot = 1;
|
||||
}
|
||||
|
||||
ifstruct->userdata = qmi_priv;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int libapduinterface_main(int argc, char **argv)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void libapduinterface_fini(struct euicc_apdu_interface *ifstruct)
|
||||
{
|
||||
struct qmi_data *qmi_priv = ifstruct->userdata;
|
||||
|
||||
qmi_cleanup(qmi_priv);
|
||||
|
||||
free(qmi_priv);
|
||||
}
|
||||
|
||||
const struct euicc_driver driver_apdu_qmi_qrtr = {
|
||||
.type = DRIVER_APDU,
|
||||
.name = "qmi_qrtr",
|
||||
.init = (int (*)(void *))libapduinterface_init,
|
||||
.main = libapduinterface_main,
|
||||
.fini = (void (*)(void *))libapduinterface_fini,
|
||||
};
|
8
driver/apdu/qmi_qrtr.h
Normal file
8
driver/apdu/qmi_qrtr.h
Normal file
|
@ -0,0 +1,8 @@
|
|||
// SPDX-License-Identifier: MIT
|
||||
/*
|
||||
* Copyright (c) 2024, Luca Weiss <luca.weiss@fairphone.com>
|
||||
*/
|
||||
#pragma once
|
||||
#include <driver.private.h>
|
||||
|
||||
extern const struct euicc_driver driver_apdu_qmi_qrtr;
|
|
@ -1,3 +1,5 @@
|
|||
#include "stdio.h"
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -5,98 +7,13 @@
|
|||
#include <unistd.h>
|
||||
|
||||
#include <cjson/cJSON_ex.h>
|
||||
|
||||
#include <euicc/interface.h>
|
||||
|
||||
static int hexutil_bin2hex(char *output, unsigned output_len, const unsigned char *bin, int bin_len)
|
||||
{
|
||||
const char hexDigits[] = "0123456789abcdef";
|
||||
|
||||
if (!bin || !output)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (output_len < 2 * bin_len + 1)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (int i = 0; i < bin_len; ++i)
|
||||
{
|
||||
char byte = bin[i];
|
||||
output[2 * i] = hexDigits[(byte >> 4) & 0x0F];
|
||||
output[2 * i + 1] = hexDigits[byte & 0x0F];
|
||||
}
|
||||
output[2 * bin_len] = '\0';
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int hexutil_hex2bin(unsigned char *output, unsigned output_len, const char *str, unsigned str_len)
|
||||
{
|
||||
int length;
|
||||
|
||||
if (!str || !output || str_len % 2 != 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
length = str_len / 2;
|
||||
if (length > output_len)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (int i = 0; i < length; ++i)
|
||||
{
|
||||
char high = str[2 * i];
|
||||
char low = str[2 * i + 1];
|
||||
|
||||
if (high >= '0' && high <= '9')
|
||||
{
|
||||
high -= '0';
|
||||
}
|
||||
else if (high >= 'a' && high <= 'f')
|
||||
{
|
||||
high = high - 'a' + 10;
|
||||
}
|
||||
else if (high >= 'A' && high <= 'F')
|
||||
{
|
||||
high = high - 'A' + 10;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (low >= '0' && low <= '9')
|
||||
{
|
||||
low -= '0';
|
||||
}
|
||||
else if (low >= 'a' && low <= 'f')
|
||||
{
|
||||
low = low - 'a' + 10;
|
||||
}
|
||||
else if (low >= 'A' && low <= 'F')
|
||||
{
|
||||
low = low - 'A' + 10;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
output[i] = (high << 4) + low;
|
||||
}
|
||||
|
||||
return length;
|
||||
}
|
||||
#include <euicc/hexutil.h>
|
||||
|
||||
// getline is a GNU extension, Mingw32 macOS and FreeBSD don't have (a working) one
|
||||
static int afgets(char **obuf, FILE *fp)
|
||||
{
|
||||
unsigned int len = 0;
|
||||
uint32_t len = 0;
|
||||
char buffer[2];
|
||||
char *obuf_new = NULL;
|
||||
|
||||
|
@ -109,7 +26,7 @@ static int afgets(char **obuf, FILE *fp)
|
|||
|
||||
while (fgets(buffer, sizeof(buffer), fp) != NULL)
|
||||
{
|
||||
unsigned int fgets_len = strlen(buffer);
|
||||
uint32_t fgets_len = strlen(buffer);
|
||||
|
||||
len += fgets_len + 1;
|
||||
obuf_new = realloc(*obuf, len);
|
||||
|
@ -126,7 +43,7 @@ static int afgets(char **obuf, FILE *fp)
|
|||
}
|
||||
}
|
||||
|
||||
(*obuf)[strcspn(*obuf, "\r\n")] = 0;
|
||||
(*obuf)[strcspn(*obuf, "\n")] = 0;
|
||||
|
||||
return 0;
|
||||
|
||||
|
@ -184,12 +101,11 @@ err:
|
|||
return -1;
|
||||
}
|
||||
|
||||
static int json_request(const char *func, const unsigned char *param, unsigned param_len)
|
||||
static int json_request(const char *func, const uint8_t *param, unsigned param_len)
|
||||
{
|
||||
int fret = 0;
|
||||
char *param_hex = NULL;
|
||||
cJSON *jpayload = NULL;
|
||||
cJSON *jheaders = NULL;
|
||||
|
||||
if (param && param_len)
|
||||
{
|
||||
|
@ -198,7 +114,7 @@ static int json_request(const char *func, const unsigned char *param, unsigned p
|
|||
{
|
||||
goto err;
|
||||
}
|
||||
if (hexutil_bin2hex(param_hex, (2 * param_len) + 1, param, param_len) < 0)
|
||||
if (euicc_hexutil_bin2hex(param_hex, (2 * param_len) + 1, param, param_len) < 0)
|
||||
{
|
||||
goto err;
|
||||
}
|
||||
|
@ -307,7 +223,7 @@ static int json_response(int *ecode, uint8_t **data, uint32_t *data_len)
|
|||
{
|
||||
goto err;
|
||||
}
|
||||
if (hexutil_hex2bin(*data, *data_len, jtmp->valuestring, strlen(jtmp->valuestring)) < 0)
|
||||
if (euicc_hexutil_hex2bin_r(*data, *data_len, jtmp->valuestring, strlen(jtmp->valuestring)) < 0)
|
||||
{
|
||||
goto err;
|
||||
}
|
||||
|
@ -408,7 +324,7 @@ static int apdu_interface_transmit(struct euicc_ctx *ctx, uint8_t **rx, uint32_t
|
|||
return ecode;
|
||||
}
|
||||
|
||||
EUICC_SHARED_EXPORT int libapduinterface_init(struct euicc_apdu_interface *ifstruct)
|
||||
static int libapduinterface_init(struct euicc_apdu_interface *ifstruct)
|
||||
{
|
||||
ifstruct->connect = apdu_interface_connect;
|
||||
ifstruct->disconnect = apdu_interface_disconnect;
|
||||
|
@ -419,7 +335,19 @@ EUICC_SHARED_EXPORT int libapduinterface_init(struct euicc_apdu_interface *ifstr
|
|||
return 0;
|
||||
}
|
||||
|
||||
EUICC_SHARED_EXPORT int libapduinterface_main(int argc, char **argv)
|
||||
static int libapduinterface_main(int argc, char **argv)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void libapduinterface_fini(struct euicc_apdu_interface *ifstruct)
|
||||
{
|
||||
}
|
||||
|
||||
const struct euicc_driver driver_apdu_stdio = {
|
||||
.type = DRIVER_APDU,
|
||||
.name = "stdio",
|
||||
.init = (int (*)(void *))libapduinterface_init,
|
||||
.main = libapduinterface_main,
|
||||
.fini = (void (*)(void *))libapduinterface_fini,
|
||||
};
|
4
driver/apdu/stdio.h
Normal file
4
driver/apdu/stdio.h
Normal file
|
@ -0,0 +1,4 @@
|
|||
#pragma once
|
||||
#include <driver.private.h>
|
||||
|
||||
extern const struct euicc_driver driver_apdu_stdio;
|
135
driver/driver.c
Normal file
135
driver/driver.c
Normal file
|
@ -0,0 +1,135 @@
|
|||
#include "driver.h"
|
||||
#include "driver.private.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef LPAC_WITH_APDU_GBINDER
|
||||
#include "driver/apdu/gbinder_hidl.h"
|
||||
#endif
|
||||
|
||||
#ifdef LPAC_WITH_APDU_MBIM
|
||||
#include "driver/apdu/mbim.h"
|
||||
#endif
|
||||
|
||||
#ifdef LPAC_WITH_APDU_QMI
|
||||
#include "driver/apdu/qmi.h"
|
||||
#endif
|
||||
|
||||
#ifdef LPAC_WITH_APDU_QMI_QRTR
|
||||
#include "driver/apdu/qmi_qrtr.h"
|
||||
#endif
|
||||
|
||||
#ifdef LPAC_WITH_APDU_PCSC
|
||||
#include "driver/apdu/pcsc.h"
|
||||
#endif
|
||||
#ifdef LPAC_WITH_APDU_AT
|
||||
#include "driver/apdu/at.h"
|
||||
#endif
|
||||
#ifdef LPAC_WITH_HTTP_CURL
|
||||
#include "driver/http/curl.h"
|
||||
#endif
|
||||
#include "driver/apdu/stdio.h"
|
||||
#include "driver/http/stdio.h"
|
||||
|
||||
static const struct euicc_driver *drivers[] = {
|
||||
#ifdef LPAC_WITH_APDU_GBINDER
|
||||
&driver_apdu_gbinder_hidl,
|
||||
#endif
|
||||
#ifdef LPAC_WITH_APDU_MBIM
|
||||
&driver_apdu_mbim,
|
||||
#endif
|
||||
#ifdef LPAC_WITH_APDU_QMI
|
||||
&driver_apdu_qmi,
|
||||
#endif
|
||||
#ifdef LPAC_WITH_APDU_QMI_QRTR
|
||||
&driver_apdu_qmi_qrtr,
|
||||
#endif
|
||||
#ifdef LPAC_WITH_APDU_PCSC
|
||||
&driver_apdu_pcsc,
|
||||
#endif
|
||||
#ifdef LPAC_WITH_APDU_AT
|
||||
&driver_apdu_at,
|
||||
#endif
|
||||
#ifdef LPAC_WITH_HTTP_CURL
|
||||
&driver_http_curl,
|
||||
#endif
|
||||
&driver_apdu_stdio,
|
||||
&driver_http_stdio,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static const struct euicc_driver *_driver_apdu = NULL;
|
||||
static const struct euicc_driver *_driver_http = NULL;
|
||||
|
||||
struct euicc_apdu_interface euicc_driver_interface_apdu;
|
||||
struct euicc_http_interface euicc_driver_interface_http;
|
||||
int (*euicc_driver_main_apdu)(int argc, char **argv) = NULL;
|
||||
int (*euicc_driver_main_http)(int argc, char **argv) = NULL;
|
||||
|
||||
static const struct euicc_driver *_find_driver(enum euicc_driver_type type, const char *name)
|
||||
{
|
||||
for (int i = 0; drivers[i] != NULL; i++)
|
||||
{
|
||||
const struct euicc_driver *d = drivers[i];
|
||||
if (d->type != type)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (name == NULL)
|
||||
{
|
||||
return d;
|
||||
}
|
||||
if (strcmp(d->name, name) == 0)
|
||||
{
|
||||
return d;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int euicc_driver_init(const char *apdu_driver_name, const char *http_driver_name)
|
||||
{
|
||||
_driver_apdu = _find_driver(DRIVER_APDU, apdu_driver_name);
|
||||
if (_driver_apdu == NULL)
|
||||
{
|
||||
fprintf(stderr, "No APDU driver found\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
_driver_http = _find_driver(DRIVER_HTTP, http_driver_name);
|
||||
if (_driver_http == NULL)
|
||||
{
|
||||
fprintf(stderr, "No HTTP driver found\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (_driver_apdu->init(&euicc_driver_interface_apdu))
|
||||
{
|
||||
fprintf(stderr, "APDU driver init failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (_driver_http->init(&euicc_driver_interface_http))
|
||||
{
|
||||
fprintf(stderr, "HTTP driver init failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
euicc_driver_main_apdu = _driver_apdu->main;
|
||||
euicc_driver_main_http = _driver_http->main;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void euicc_driver_fini()
|
||||
{
|
||||
if (_driver_apdu != NULL)
|
||||
{
|
||||
_driver_apdu->fini(&euicc_driver_interface_apdu);
|
||||
}
|
||||
if (_driver_http != NULL)
|
||||
{
|
||||
_driver_http->fini(&euicc_driver_interface_http);
|
||||
}
|
||||
}
|
12
driver/driver.h
Normal file
12
driver/driver.h
Normal file
|
@ -0,0 +1,12 @@
|
|||
#pragma once
|
||||
#include <stddef.h>
|
||||
#include <inttypes.h>
|
||||
#include <euicc/interface.h>
|
||||
|
||||
extern struct euicc_apdu_interface euicc_driver_interface_apdu;
|
||||
extern struct euicc_http_interface euicc_driver_interface_http;
|
||||
extern int (*euicc_driver_main_apdu)(int argc, char **argv);
|
||||
extern int (*euicc_driver_main_http)(int argc, char **argv);
|
||||
|
||||
int euicc_driver_init(const char *apdu_driver_name, const char *http_driver_name);
|
||||
void euicc_driver_fini(void);
|
16
driver/driver.private.h
Normal file
16
driver/driver.private.h
Normal file
|
@ -0,0 +1,16 @@
|
|||
#pragma once
|
||||
|
||||
enum euicc_driver_type
|
||||
{
|
||||
DRIVER_APDU,
|
||||
DRIVER_HTTP,
|
||||
};
|
||||
|
||||
struct euicc_driver
|
||||
{
|
||||
enum euicc_driver_type type;
|
||||
const char *name;
|
||||
int (*init)(void *interface);
|
||||
int (*main)(int argc, char **argv);
|
||||
void (*fini)(void *interface);
|
||||
};
|
205
driver/http/curl.c
Normal file
205
driver/http/curl.c
Normal file
|
@ -0,0 +1,205 @@
|
|||
#include "curl.h"
|
||||
#include <inttypes.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <euicc/interface.h>
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <curl/curl.h>
|
||||
#else
|
||||
#include <dlfcn-win32/dlfcn.h>
|
||||
#define CURL_GLOBAL_DEFAULT ((1 << 0) | (1 << 1))
|
||||
#define CURLE_OK 0
|
||||
#define CURLOPT_URL 10002
|
||||
#define CURLOPT_WRITEFUNCTION 20011
|
||||
#define CURLOPT_WRITEDATA 10001
|
||||
#define CURLOPT_SSL_VERIFYPEER 64
|
||||
#define CURLOPT_SSL_VERIFYHOST 81
|
||||
#define CURLOPT_HTTPHEADER 10023
|
||||
#define CURLOPT_POSTFIELDS 10015
|
||||
#define CURLOPT_POSTFIELDSIZE 60
|
||||
#define CURLINFO_RESPONSE_CODE 2097154
|
||||
|
||||
typedef void CURL;
|
||||
typedef int CURLcode;
|
||||
typedef int CURLoption;
|
||||
typedef int CURLINFO;
|
||||
|
||||
static void *libcurl_interface_dlhandle = NULL;
|
||||
#endif
|
||||
|
||||
struct http_trans_response_data
|
||||
{
|
||||
uint8_t *data;
|
||||
size_t size;
|
||||
};
|
||||
|
||||
static struct libcurl_interface
|
||||
{
|
||||
CURLcode (*_curl_global_init)(long flags);
|
||||
CURL *(*_curl_easy_init)(void);
|
||||
CURLcode (*_curl_easy_setopt)(CURL *curl, CURLoption option, ...);
|
||||
CURLcode (*_curl_easy_perform)(CURL *curl);
|
||||
CURLcode (*_curl_easy_getinfo)(CURL *curl, CURLINFO info, ...);
|
||||
const char *(*_curl_easy_strerror)(CURLcode);
|
||||
void (*_curl_easy_cleanup)(CURL *curl);
|
||||
|
||||
struct curl_slist *(*_curl_slist_append)(struct curl_slist *list, const char *data);
|
||||
void (*_curl_slist_free_all)(struct curl_slist *list);
|
||||
} libcurl;
|
||||
|
||||
static size_t http_trans_write_callback(void *contents, size_t size, size_t nmemb, void *userp)
|
||||
{
|
||||
size_t realsize = size * nmemb;
|
||||
struct http_trans_response_data *mem = (struct http_trans_response_data *)userp;
|
||||
|
||||
mem->data = realloc(mem->data, mem->size + realsize + 1);
|
||||
if (mem->data == NULL)
|
||||
{
|
||||
/* out of memory! */
|
||||
printf("not enough memory (realloc returned NULL)\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
memcpy(&(mem->data[mem->size]), contents, realsize);
|
||||
mem->size += realsize;
|
||||
mem->data[mem->size] = 0;
|
||||
|
||||
return realsize;
|
||||
}
|
||||
|
||||
static int http_interface_transmit(struct euicc_ctx *ctx, const char *url, uint32_t *rcode, uint8_t **rx, uint32_t *rx_len, const uint8_t *tx, uint32_t tx_len, const char **h)
|
||||
{
|
||||
int fret = 0;
|
||||
CURL *curl;
|
||||
CURLcode res;
|
||||
struct http_trans_response_data responseData = {0};
|
||||
struct curl_slist *headers = NULL, *nheaders = NULL;
|
||||
long response_code;
|
||||
|
||||
(*rx) = NULL;
|
||||
(*rcode) = 0;
|
||||
|
||||
curl = libcurl._curl_easy_init();
|
||||
if (!curl)
|
||||
{
|
||||
goto err;
|
||||
}
|
||||
|
||||
libcurl._curl_easy_setopt(curl, CURLOPT_URL, url);
|
||||
libcurl._curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, http_trans_write_callback);
|
||||
libcurl._curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)&responseData);
|
||||
libcurl._curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
|
||||
libcurl._curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
|
||||
for (int i = 0; h[i] != NULL; i++)
|
||||
{
|
||||
nheaders = libcurl._curl_slist_append(headers, h[i]);
|
||||
if (nheaders == NULL)
|
||||
{
|
||||
goto err;
|
||||
}
|
||||
headers = nheaders;
|
||||
}
|
||||
libcurl._curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
|
||||
|
||||
if (tx != NULL)
|
||||
{
|
||||
libcurl._curl_easy_setopt(curl, CURLOPT_POSTFIELDS, tx);
|
||||
libcurl._curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, tx_len);
|
||||
}
|
||||
|
||||
res = libcurl._curl_easy_perform(curl);
|
||||
|
||||
if (res != CURLE_OK)
|
||||
{
|
||||
fprintf(stderr, "curl_easy_perform() failed: %s\n", libcurl._curl_easy_strerror(res));
|
||||
goto err;
|
||||
}
|
||||
|
||||
libcurl._curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &response_code);
|
||||
*rcode = response_code;
|
||||
*rx = responseData.data;
|
||||
*rx_len = responseData.size;
|
||||
|
||||
fret = 0;
|
||||
goto exit;
|
||||
|
||||
err:
|
||||
fret = -1;
|
||||
free(responseData.data);
|
||||
exit:
|
||||
libcurl._curl_easy_cleanup(curl);
|
||||
libcurl._curl_slist_free_all(headers);
|
||||
return fret;
|
||||
}
|
||||
|
||||
static int _init_libcurl(void)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
if (!(libcurl_interface_dlhandle = dlopen("libcurl.dll", RTLD_LAZY)))
|
||||
{
|
||||
fprintf(stderr, "libcurl init err: %s\n", dlerror());
|
||||
return -1;
|
||||
}
|
||||
|
||||
libcurl._curl_global_init = dlsym(libcurl_interface_dlhandle, "curl_global_init");
|
||||
libcurl._curl_easy_init = dlsym(libcurl_interface_dlhandle, "curl_easy_init");
|
||||
libcurl._curl_easy_setopt = dlsym(libcurl_interface_dlhandle, "curl_easy_setopt");
|
||||
libcurl._curl_easy_perform = dlsym(libcurl_interface_dlhandle, "curl_easy_perform");
|
||||
libcurl._curl_easy_getinfo = dlsym(libcurl_interface_dlhandle, "curl_easy_getinfo");
|
||||
libcurl._curl_easy_strerror = dlsym(libcurl_interface_dlhandle, "curl_easy_strerror");
|
||||
libcurl._curl_easy_cleanup = dlsym(libcurl_interface_dlhandle, "curl_easy_cleanup");
|
||||
libcurl._curl_slist_append = dlsym(libcurl_interface_dlhandle, "curl_slist_append");
|
||||
libcurl._curl_slist_free_all = dlsym(libcurl_interface_dlhandle, "curl_slist_free_all");
|
||||
#else
|
||||
libcurl._curl_global_init = curl_global_init;
|
||||
libcurl._curl_easy_init = curl_easy_init;
|
||||
libcurl._curl_easy_setopt = curl_easy_setopt;
|
||||
libcurl._curl_easy_perform = curl_easy_perform;
|
||||
libcurl._curl_easy_getinfo = curl_easy_getinfo;
|
||||
libcurl._curl_easy_strerror = curl_easy_strerror;
|
||||
libcurl._curl_easy_cleanup = curl_easy_cleanup;
|
||||
libcurl._curl_slist_append = curl_slist_append;
|
||||
libcurl._curl_slist_free_all = curl_slist_free_all;
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int libhttpinterface_init(struct euicc_http_interface *ifstruct)
|
||||
{
|
||||
memset(ifstruct, 0, sizeof(struct euicc_http_interface));
|
||||
|
||||
if (_init_libcurl() != 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (libcurl._curl_global_init(CURL_GLOBAL_DEFAULT) != CURLE_OK)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
ifstruct->transmit = http_interface_transmit;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int libhttpinterface_main(int argc, char **argv)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void libhttpinterface_fini(struct euicc_http_interface *ifstruct)
|
||||
{
|
||||
}
|
||||
|
||||
const struct euicc_driver driver_http_curl = {
|
||||
.type = DRIVER_HTTP,
|
||||
.name = "curl",
|
||||
.init = (int (*)(void *))libhttpinterface_init,
|
||||
.main = libhttpinterface_main,
|
||||
.fini = (void (*)(void *))libhttpinterface_fini,
|
||||
};
|
4
driver/http/curl.h
Normal file
4
driver/http/curl.h
Normal file
|
@ -0,0 +1,4 @@
|
|||
#pragma once
|
||||
#include <driver.private.h>
|
||||
|
||||
extern const struct euicc_driver driver_http_curl;
|
|
@ -1,3 +1,5 @@
|
|||
#include "stdio.h"
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -5,98 +7,13 @@
|
|||
#include <unistd.h>
|
||||
|
||||
#include <cjson/cJSON_ex.h>
|
||||
|
||||
#include <euicc/interface.h>
|
||||
|
||||
static int hexutil_bin2hex(char *output, unsigned output_len, const unsigned char *bin, int bin_len)
|
||||
{
|
||||
const char hexDigits[] = "0123456789abcdef";
|
||||
|
||||
if (!bin || !output)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (output_len < 2 * bin_len + 1)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (int i = 0; i < bin_len; ++i)
|
||||
{
|
||||
char byte = bin[i];
|
||||
output[2 * i] = hexDigits[(byte >> 4) & 0x0F];
|
||||
output[2 * i + 1] = hexDigits[byte & 0x0F];
|
||||
}
|
||||
output[2 * bin_len] = '\0';
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int hexutil_hex2bin(unsigned char *output, unsigned output_len, const char *str, unsigned str_len)
|
||||
{
|
||||
int length;
|
||||
|
||||
if (!str || !output || str_len % 2 != 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
length = str_len / 2;
|
||||
if (length > output_len)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (int i = 0; i < length; ++i)
|
||||
{
|
||||
char high = str[2 * i];
|
||||
char low = str[2 * i + 1];
|
||||
|
||||
if (high >= '0' && high <= '9')
|
||||
{
|
||||
high -= '0';
|
||||
}
|
||||
else if (high >= 'a' && high <= 'f')
|
||||
{
|
||||
high = high - 'a' + 10;
|
||||
}
|
||||
else if (high >= 'A' && high <= 'F')
|
||||
{
|
||||
high = high - 'A' + 10;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (low >= '0' && low <= '9')
|
||||
{
|
||||
low -= '0';
|
||||
}
|
||||
else if (low >= 'a' && low <= 'f')
|
||||
{
|
||||
low = low - 'a' + 10;
|
||||
}
|
||||
else if (low >= 'A' && low <= 'F')
|
||||
{
|
||||
low = low - 'A' + 10;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
output[i] = (high << 4) + low;
|
||||
}
|
||||
|
||||
return length;
|
||||
}
|
||||
#include <euicc/hexutil.h>
|
||||
|
||||
// getline is a GNU extension, Mingw32 macOS and FreeBSD don't have (a working) one
|
||||
static int afgets(char **obuf, FILE *fp)
|
||||
{
|
||||
unsigned int len = 0;
|
||||
uint32_t len = 0;
|
||||
char buffer[2];
|
||||
char *obuf_new = NULL;
|
||||
|
||||
|
@ -109,7 +26,7 @@ static int afgets(char **obuf, FILE *fp)
|
|||
|
||||
while (fgets(buffer, sizeof(buffer), fp) != NULL)
|
||||
{
|
||||
unsigned int fgets_len = strlen(buffer);
|
||||
uint32_t fgets_len = strlen(buffer);
|
||||
|
||||
len += fgets_len + 1;
|
||||
obuf_new = realloc(*obuf, len);
|
||||
|
@ -126,7 +43,7 @@ static int afgets(char **obuf, FILE *fp)
|
|||
}
|
||||
}
|
||||
|
||||
(*obuf)[strcspn(*obuf, "\r\n")] = 0;
|
||||
(*obuf)[strcspn(*obuf, "\n")] = 0;
|
||||
|
||||
return 0;
|
||||
|
||||
|
@ -196,7 +113,7 @@ static int json_request(const char *url, const uint8_t *tx, uint32_t tx_len, con
|
|||
{
|
||||
goto err;
|
||||
}
|
||||
if (hexutil_bin2hex(tx_hex, (2 * tx_len) + 1, tx, tx_len) < 0)
|
||||
if (euicc_hexutil_bin2hex(tx_hex, (2 * tx_len) + 1, tx, tx_len) < 0)
|
||||
{
|
||||
goto err;
|
||||
}
|
||||
|
@ -321,7 +238,7 @@ static int http_interface_transmit(struct euicc_ctx *ctx, const char *url, uint3
|
|||
{
|
||||
goto err;
|
||||
}
|
||||
if (hexutil_hex2bin(*rx, *rx_len, jtmp->valuestring, strlen(jtmp->valuestring)) < 0)
|
||||
if (euicc_hexutil_hex2bin_r(*rx, *rx_len, jtmp->valuestring, strlen(jtmp->valuestring)) < 0)
|
||||
{
|
||||
goto err;
|
||||
}
|
||||
|
@ -341,7 +258,7 @@ exit:
|
|||
return fret;
|
||||
}
|
||||
|
||||
EUICC_SHARED_EXPORT int libhttpinterface_init(struct euicc_http_interface *ifstruct)
|
||||
static int libhttpinterface_init(struct euicc_http_interface *ifstruct)
|
||||
{
|
||||
memset(ifstruct, 0, sizeof(struct euicc_http_interface));
|
||||
|
||||
|
@ -350,7 +267,19 @@ EUICC_SHARED_EXPORT int libhttpinterface_init(struct euicc_http_interface *ifstr
|
|||
return 0;
|
||||
}
|
||||
|
||||
EUICC_SHARED_EXPORT int libhttpinterface_main(int argc, char **argv)
|
||||
static int libhttpinterface_main(int argc, char **argv)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void libhttpinterface_fini(struct euicc_http_interface *ifstruct)
|
||||
{
|
||||
}
|
||||
|
||||
const struct euicc_driver driver_http_stdio = {
|
||||
.type = DRIVER_HTTP,
|
||||
.name = "stdio",
|
||||
.init = (int (*)(void *))libhttpinterface_init,
|
||||
.main = libhttpinterface_main,
|
||||
.fini = (void (*)(void *))libhttpinterface_fini,
|
||||
};
|
4
driver/http/stdio.h
Normal file
4
driver/http/stdio.h
Normal file
|
@ -0,0 +1,4 @@
|
|||
#pragma once
|
||||
#include <driver.private.h>
|
||||
|
||||
extern const struct euicc_driver driver_http_stdio;
|
11
driver/libeuicc-drivers.pc.in
Normal file
11
driver/libeuicc-drivers.pc.in
Normal file
|
@ -0,0 +1,11 @@
|
|||
prefix="@CMAKE_INSTALL_PREFIX@"
|
||||
exec_prefix="${prefix}"
|
||||
libdir="${prefix}/lib"
|
||||
includedir="${prefix}/include"
|
||||
|
||||
Name: libeuicc-drivers
|
||||
Description: An "official" collection of drivers (backends) and their loader for use with libeuicc
|
||||
Version: @PROJECT_VERSION@
|
||||
Requires: @LIBEUICC_DRIVERS_REQUIRES@
|
||||
Cflags: -I${includedir} @LIBEUICC_DRIVERS_EXTRA_CFLAGS@
|
||||
Libs: -L${libdir} -leuicc-drivers
|
|
@ -1,7 +1,30 @@
|
|||
add_subdirectory(asn1c)
|
||||
include_directories(asn1c)
|
||||
include_directories(asn1c/asn1)
|
||||
aux_source_directory(. LIB_EUICC_SRCS)
|
||||
add_library (euicc STATIC ${LIB_EUICC_SRCS})
|
||||
target_link_libraries(euicc euiccasn1)
|
||||
option(LPAC_DYNAMIC_LIBEUICC "Build and install libeuicc as a dynamic library" OFF)
|
||||
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR} LIB_EUICC_SRCS)
|
||||
if(LPAC_DYNAMIC_LIBEUICC)
|
||||
add_library(euicc SHARED ${LIB_EUICC_SRCS})
|
||||
else()
|
||||
add_library(euicc STATIC ${LIB_EUICC_SRCS})
|
||||
endif()
|
||||
target_link_libraries(euicc cjson-static)
|
||||
target_include_directories(euicc PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>)
|
||||
if(LPAC_DYNAMIC_LIBEUICC)
|
||||
# Install headers
|
||||
file(GLOB ALL_HEADERS "*.h")
|
||||
foreach(header ${ALL_HEADERS})
|
||||
if(${header} MATCHES "^.*\.private\.h$")
|
||||
list(REMOVE_ITEM ALL_HEADERS ${header})
|
||||
endif()
|
||||
endforeach()
|
||||
set_target_properties(euicc PROPERTIES PUBLIC_HEADER "${ALL_HEADERS}")
|
||||
# Only useful on Windows, and will lead to invalid arguments on ld.gold.
|
||||
if(WIN32)
|
||||
set_target_properties(euicc PROPERTIES LINK_FLAGS "-Wl,--export-all-symbols")
|
||||
endif()
|
||||
# Install a pkg-config file
|
||||
configure_file(libeuicc.pc.in libeuicc.pc @ONLY)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libeuicc.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
||||
# Configure libeuicc.so installation
|
||||
set_target_properties(euicc PROPERTIES SOVERSION ${PROJECT_VERSION_MAJOR})
|
||||
install(TARGETS euicc LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/euicc)
|
||||
endif()
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
include_directories(.)
|
||||
aux_source_directory(asn1 LIB_EUICC_ASN1_SRCS)
|
||||
add_library (euiccasn1 STATIC ${LIB_EUICC_ASN1_SRCS})
|
||||
target_compile_definitions(euiccasn1 PRIVATE HAVE_CONFIG_H)
|
||||
|
||||
option(LINUX_MINGW32 "Build for windows on Linux" OFF)
|
||||
if(LINUX_MINGW32)
|
||||
add_subdirectory(mingw32)
|
||||
target_link_libraries(euiccasn1 euiccasn1mingw32)
|
||||
endif()
|
|
@ -1,277 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
|
||||
* Redistribution and modifications are permitted subject to BSD license.
|
||||
*/
|
||||
#include "asn_internal.h"
|
||||
#include "ANY.h"
|
||||
#include <errno.h>
|
||||
|
||||
asn_OCTET_STRING_specifics_t asn_SPC_ANY_specs = {
|
||||
sizeof(ANY_t),
|
||||
offsetof(ANY_t, _asn_ctx),
|
||||
ASN_OSUBV_ANY
|
||||
};
|
||||
asn_TYPE_operation_t asn_OP_ANY = {
|
||||
OCTET_STRING_free,
|
||||
OCTET_STRING_print,
|
||||
OCTET_STRING_compare,
|
||||
OCTET_STRING_decode_ber,
|
||||
OCTET_STRING_encode_der,
|
||||
OCTET_STRING_decode_xer_hex,
|
||||
ANY_encode_xer,
|
||||
#ifdef ASN_DISABLE_OER_SUPPORT
|
||||
0,
|
||||
0,
|
||||
#else
|
||||
0,
|
||||
0,
|
||||
#endif /* ASN_DISABLE_OER_SUPPORT */
|
||||
#ifdef ASN_DISABLE_PER_SUPPORT
|
||||
0, 0,
|
||||
#else
|
||||
ANY_decode_uper,
|
||||
ANY_encode_uper,
|
||||
#endif /* ASN_DISABLE_PER_SUPPORT */
|
||||
0, /* Random fill is not defined for ANY type */
|
||||
0 /* Use generic outmost tag fetcher */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_ANY = {
|
||||
"ANY",
|
||||
"ANY",
|
||||
&asn_OP_ANY,
|
||||
0, 0, 0, 0,
|
||||
{ 0, 0, asn_generic_no_constraint }, /* No constraints */
|
||||
0, 0, /* No members */
|
||||
&asn_SPC_ANY_specs,
|
||||
};
|
||||
|
||||
#undef RETURN
|
||||
#define RETURN(_code) \
|
||||
do { \
|
||||
asn_dec_rval_t tmprval; \
|
||||
tmprval.code = _code; \
|
||||
tmprval.consumed = consumed_myself; \
|
||||
return tmprval; \
|
||||
} while(0)
|
||||
|
||||
asn_enc_rval_t
|
||||
ANY_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
|
||||
enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb,
|
||||
void *app_key) {
|
||||
if(flags & XER_F_CANONICAL) {
|
||||
/*
|
||||
* Canonical XER-encoding of ANY type is not supported.
|
||||
*/
|
||||
ASN__ENCODE_FAILED;
|
||||
}
|
||||
|
||||
/* Dump as binary */
|
||||
return OCTET_STRING_encode_xer(td, sptr, ilevel, flags, cb, app_key);
|
||||
}
|
||||
|
||||
struct _callback_arg {
|
||||
uint8_t *buffer;
|
||||
size_t offset;
|
||||
size_t size;
|
||||
};
|
||||
|
||||
static int ANY__consume_bytes(const void *buffer, size_t size, void *key);
|
||||
|
||||
int
|
||||
ANY_fromType(ANY_t *st, asn_TYPE_descriptor_t *td, void *sptr) {
|
||||
struct _callback_arg arg;
|
||||
asn_enc_rval_t erval;
|
||||
|
||||
if(!st || !td) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(!sptr) {
|
||||
if(st->buf) FREEMEM(st->buf);
|
||||
st->size = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
arg.offset = arg.size = 0;
|
||||
arg.buffer = 0;
|
||||
|
||||
erval = der_encode(td, sptr, ANY__consume_bytes, &arg);
|
||||
if(erval.encoded == -1) {
|
||||
if(arg.buffer) FREEMEM(arg.buffer);
|
||||
return -1;
|
||||
}
|
||||
assert((size_t)erval.encoded == arg.offset);
|
||||
|
||||
if(st->buf) FREEMEM(st->buf);
|
||||
st->buf = arg.buffer;
|
||||
st->size = arg.offset;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
ANY_t *
|
||||
ANY_new_fromType(asn_TYPE_descriptor_t *td, void *sptr) {
|
||||
ANY_t tmp;
|
||||
ANY_t *st;
|
||||
|
||||
if(!td || !sptr) {
|
||||
errno = EINVAL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
memset(&tmp, 0, sizeof(tmp));
|
||||
|
||||
if(ANY_fromType(&tmp, td, sptr)) return 0;
|
||||
|
||||
st = (ANY_t *)CALLOC(1, sizeof(ANY_t));
|
||||
if(st) {
|
||||
*st = tmp;
|
||||
return st;
|
||||
} else {
|
||||
FREEMEM(tmp.buf);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
ANY_to_type(ANY_t *st, asn_TYPE_descriptor_t *td, void **struct_ptr) {
|
||||
asn_dec_rval_t rval;
|
||||
void *newst = 0;
|
||||
|
||||
if(!st || !td || !struct_ptr) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(st->buf == 0) {
|
||||
/* Nothing to convert, make it empty. */
|
||||
*struct_ptr = (void *)0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
rval = ber_decode(0, td, (void **)&newst, st->buf, st->size);
|
||||
if(rval.code == RC_OK) {
|
||||
*struct_ptr = newst;
|
||||
return 0;
|
||||
} else {
|
||||
/* Remove possibly partially decoded data. */
|
||||
ASN_STRUCT_FREE(*td, newst);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
static int ANY__consume_bytes(const void *buffer, size_t size, void *key) {
|
||||
struct _callback_arg *arg = (struct _callback_arg *)key;
|
||||
|
||||
if((arg->offset + size) >= arg->size) {
|
||||
size_t nsize = (arg->size ? arg->size << 2 : 16) + size;
|
||||
void *p = REALLOC(arg->buffer, nsize);
|
||||
if(!p) return -1;
|
||||
arg->buffer = (uint8_t *)p;
|
||||
arg->size = nsize;
|
||||
}
|
||||
|
||||
memcpy(arg->buffer + arg->offset, buffer, size);
|
||||
arg->offset += size;
|
||||
assert(arg->offset < arg->size);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifndef ASN_DISABLE_PER_SUPPORT
|
||||
|
||||
asn_dec_rval_t
|
||||
ANY_decode_uper(const asn_codec_ctx_t *opt_codec_ctx,
|
||||
const asn_TYPE_descriptor_t *td,
|
||||
const asn_per_constraints_t *constraints, void **sptr,
|
||||
asn_per_data_t *pd) {
|
||||
const asn_OCTET_STRING_specifics_t *specs =
|
||||
td->specifics ? (const asn_OCTET_STRING_specifics_t *)td->specifics
|
||||
: &asn_SPC_ANY_specs;
|
||||
size_t consumed_myself = 0;
|
||||
int repeat;
|
||||
ANY_t *st = (ANY_t *)*sptr;
|
||||
|
||||
(void)opt_codec_ctx;
|
||||
(void)constraints;
|
||||
|
||||
/*
|
||||
* Allocate the structure.
|
||||
*/
|
||||
if(!st) {
|
||||
st = (ANY_t *)(*sptr = CALLOC(1, specs->struct_size));
|
||||
if(!st) RETURN(RC_FAIL);
|
||||
}
|
||||
|
||||
ASN_DEBUG("PER Decoding ANY type");
|
||||
|
||||
|
||||
st->size = 0;
|
||||
do {
|
||||
ssize_t raw_len;
|
||||
ssize_t len_bytes;
|
||||
ssize_t len_bits;
|
||||
void *p;
|
||||
int ret;
|
||||
|
||||
/* Get the PER length */
|
||||
raw_len = uper_get_length(pd, -1, 0, &repeat);
|
||||
if(raw_len < 0) RETURN(RC_WMORE);
|
||||
if(raw_len == 0 && st->buf) break;
|
||||
|
||||
ASN_DEBUG("Got PER length len %" ASN_PRI_SIZE ", %s (%s)", raw_len,
|
||||
repeat ? "repeat" : "once", td->name);
|
||||
len_bytes = raw_len;
|
||||
len_bits = len_bytes * 8;
|
||||
|
||||
p = REALLOC(st->buf, st->size + len_bytes + 1);
|
||||
if(!p) RETURN(RC_FAIL);
|
||||
st->buf = (uint8_t *)p;
|
||||
|
||||
ret = per_get_many_bits(pd, &st->buf[st->size], 0, len_bits);
|
||||
if(ret < 0) RETURN(RC_WMORE);
|
||||
consumed_myself += len_bits;
|
||||
st->size += len_bytes;
|
||||
} while(repeat);
|
||||
st->buf[st->size] = 0; /* nul-terminate */
|
||||
|
||||
RETURN(RC_OK);
|
||||
}
|
||||
|
||||
asn_enc_rval_t
|
||||
ANY_encode_uper(const asn_TYPE_descriptor_t *td,
|
||||
const asn_per_constraints_t *constraints, const void *sptr,
|
||||
asn_per_outp_t *po) {
|
||||
const ANY_t *st = (const ANY_t *)sptr;
|
||||
asn_enc_rval_t er = {0, 0, 0};
|
||||
const uint8_t *buf;
|
||||
size_t size;
|
||||
int ret;
|
||||
|
||||
(void)constraints;
|
||||
|
||||
if(!st || (!st->buf && st->size)) ASN__ENCODE_FAILED;
|
||||
|
||||
buf = st->buf;
|
||||
size = st->size;
|
||||
do {
|
||||
int need_eom = 0;
|
||||
ssize_t may_save = uper_put_length(po, size, &need_eom);
|
||||
if(may_save < 0) ASN__ENCODE_FAILED;
|
||||
|
||||
ret = per_put_many_bits(po, buf, may_save * 8);
|
||||
if(ret) ASN__ENCODE_FAILED;
|
||||
|
||||
buf += may_save;
|
||||
size -= may_save;
|
||||
assert(!(may_save & 0x07) || !size);
|
||||
if(need_eom && uper_put_length(po, 0, 0))
|
||||
ASN__ENCODE_FAILED; /* End of Message length */
|
||||
} while(size);
|
||||
|
||||
ASN__ENCODED_OK(er);
|
||||
}
|
||||
|
||||
#endif /* ASN_DISABLE_PER_SUPPORT */
|
||||
|
|
@ -1,60 +0,0 @@
|
|||
/*-
|
||||
* Copyright (c) 2004-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
|
||||
* Redistribution and modifications are permitted subject to BSD license.
|
||||
*/
|
||||
#ifndef ASN_TYPE_ANY_H
|
||||
#define ASN_TYPE_ANY_H
|
||||
|
||||
#include "OCTET_STRING.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct ANY {
|
||||
uint8_t *buf; /* BER-encoded ANY contents */
|
||||
int size; /* Size of the above buffer */
|
||||
|
||||
asn_struct_ctx_t _asn_ctx; /* Parsing across buffer boundaries */
|
||||
} ANY_t;
|
||||
|
||||
extern asn_TYPE_descriptor_t asn_DEF_ANY;
|
||||
extern asn_TYPE_operation_t asn_OP_ANY;
|
||||
extern asn_OCTET_STRING_specifics_t asn_SPC_ANY_specs;
|
||||
|
||||
asn_struct_free_f ANY_free;
|
||||
asn_struct_print_f ANY_print;
|
||||
ber_type_decoder_f ANY_decode_ber;
|
||||
der_type_encoder_f ANY_encode_der;
|
||||
xer_type_encoder_f ANY_encode_xer;
|
||||
per_type_decoder_f ANY_decode_uper;
|
||||
per_type_encoder_f ANY_encode_uper;
|
||||
|
||||
#define ANY_free OCTET_STRING_free
|
||||
#define ANY_print OCTET_STRING_print
|
||||
#define ANY_compare OCTET_STRING_compare
|
||||
#define ANY_constraint asn_generic_no_constraint
|
||||
#define ANY_decode_ber OCTET_STRING_decode_ber
|
||||
#define ANY_encode_der OCTET_STRING_encode_der
|
||||
#define ANY_decode_xer OCTET_STRING_decode_xer_hex
|
||||
|
||||
/******************************
|
||||
* Handy conversion routines. *
|
||||
******************************/
|
||||
|
||||
/* Convert another ASN.1 type into the ANY. This implies DER encoding. */
|
||||
int ANY_fromType(ANY_t *, asn_TYPE_descriptor_t *td, void *struct_ptr);
|
||||
ANY_t *ANY_new_fromType(asn_TYPE_descriptor_t *td, void *struct_ptr);
|
||||
|
||||
/* Convert the contents of the ANY type into the specified type. */
|
||||
int ANY_to_type(ANY_t *, asn_TYPE_descriptor_t *td, void **struct_ptr);
|
||||
|
||||
#define ANY_fromBuf(s, buf, size) OCTET_STRING_fromBuf((s), (buf), (size))
|
||||
#define ANY_new_fromBuf(buf, size) OCTET_STRING_new_fromBuf( \
|
||||
&asn_DEF_ANY, (buf), (size))
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ASN_TYPE_ANY_H */
|
|
@ -1,68 +0,0 @@
|
|||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "PKIX1Implicit88"
|
||||
* found in "../../../asn1/PKIXImplicit88.asn"
|
||||
* `asn1c -fwide-types -fcompound-names -fincludes-quoted -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "AccessDescription.h"
|
||||
|
||||
asn_TYPE_member_t asn_MBR_AccessDescription_1[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct AccessDescription, accessMethod),
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (6 << 2)),
|
||||
0,
|
||||
&asn_DEF_OBJECT_IDENTIFIER,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"accessMethod"
|
||||
},
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct AccessDescription, accessLocation),
|
||||
-1 /* Ambiguous tag (CHOICE?) */,
|
||||
0,
|
||||
&asn_DEF_GeneralName,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"accessLocation"
|
||||
},
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_AccessDescription_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_AccessDescription_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), 0, 0, 0 }, /* accessMethod */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 1, 0, 0 }, /* otherName */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 }, /* rfc822Name */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (2 << 2)), 1, 0, 0 }, /* dNSName */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (3 << 2)), 1, 0, 0 }, /* x400Address */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (4 << 2)), 1, 0, 0 }, /* directoryName */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (5 << 2)), 1, 0, 0 }, /* ediPartyName */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (6 << 2)), 1, 0, 0 }, /* uniformResourceIdentifier */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (7 << 2)), 1, 0, 0 }, /* iPAddress */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (8 << 2)), 1, 0, 0 } /* registeredID */
|
||||
};
|
||||
asn_SEQUENCE_specifics_t asn_SPC_AccessDescription_specs_1 = {
|
||||
sizeof(struct AccessDescription),
|
||||
offsetof(struct AccessDescription, _asn_ctx),
|
||||
asn_MAP_AccessDescription_tag2el_1,
|
||||
10, /* Count of tags in the map */
|
||||
0, 0, 0, /* Optional elements (not needed) */
|
||||
-1, /* First extension addition */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_AccessDescription = {
|
||||
"AccessDescription",
|
||||
"AccessDescription",
|
||||
&asn_OP_SEQUENCE,
|
||||
asn_DEF_AccessDescription_tags_1,
|
||||
sizeof(asn_DEF_AccessDescription_tags_1)
|
||||
/sizeof(asn_DEF_AccessDescription_tags_1[0]), /* 1 */
|
||||
asn_DEF_AccessDescription_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_AccessDescription_tags_1)
|
||||
/sizeof(asn_DEF_AccessDescription_tags_1[0]), /* 1 */
|
||||
{ 0, 0, SEQUENCE_constraint },
|
||||
asn_MBR_AccessDescription_1,
|
||||
2, /* Elements count */
|
||||
&asn_SPC_AccessDescription_specs_1 /* Additional specs */
|
||||
};
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "PKIX1Implicit88"
|
||||
* found in "../../../asn1/PKIXImplicit88.asn"
|
||||
* `asn1c -fwide-types -fcompound-names -fincludes-quoted -no-gen-example`
|
||||
*/
|
||||
|
||||
#ifndef _AccessDescription_H_
|
||||
#define _AccessDescription_H_
|
||||
|
||||
|
||||
#include "asn_application.h"
|
||||
|
||||
/* Including external dependencies */
|
||||
#include "OBJECT_IDENTIFIER.h"
|
||||
#include "GeneralName.h"
|
||||
#include "constr_SEQUENCE.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* AccessDescription */
|
||||
typedef struct AccessDescription {
|
||||
OBJECT_IDENTIFIER_t accessMethod;
|
||||
GeneralName_t accessLocation;
|
||||
|
||||
/* Context for parsing across buffer boundaries */
|
||||
asn_struct_ctx_t _asn_ctx;
|
||||
} AccessDescription_t;
|
||||
|
||||
/* Implementation */
|
||||
extern asn_TYPE_descriptor_t asn_DEF_AccessDescription;
|
||||
extern asn_SEQUENCE_specifics_t asn_SPC_AccessDescription_specs_1;
|
||||
extern asn_TYPE_member_t asn_MBR_AccessDescription_1[2];
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _AccessDescription_H_ */
|
||||
#include "asn_internal.h"
|
|
@ -1,218 +0,0 @@
|
|||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "PKIX1Explicit88"
|
||||
* found in "../../../asn1/PKIXExplicit88.asn"
|
||||
* `asn1c -fwide-types -fcompound-names -fincludes-quoted -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "AdministrationDomainName.h"
|
||||
|
||||
static const int permitted_alphabet_table_2[256] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
|
||||
1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* . */
|
||||
2, 3, 4, 5, 6, 7, 8, 9,10,11, 0, 0, 0, 0, 0, 0, /* 0123456789 */
|
||||
};
|
||||
static const int permitted_alphabet_code2value_2[11] = {
|
||||
32,48,49,50,51,52,53,54,55,56,57,};
|
||||
|
||||
|
||||
static int check_permitted_alphabet_2(const void *sptr) {
|
||||
const int *table = permitted_alphabet_table_2;
|
||||
/* The underlying type is NumericString */
|
||||
const NumericString_t *st = (const NumericString_t *)sptr;
|
||||
const uint8_t *ch = st->buf;
|
||||
const uint8_t *end = ch + st->size;
|
||||
|
||||
for(; ch < end; ch++) {
|
||||
uint8_t cv = *ch;
|
||||
if(!table[cv]) return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const int permitted_alphabet_table_3[256] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
|
||||
1, 0, 0, 0, 0, 0, 0, 2, 3, 4, 0, 5, 6, 7, 8, 9, /* . '() +,-./ */
|
||||
10,11,12,13,14,15,16,17,18,19,20, 0, 0,21, 0,22, /* 0123456789: = ? */
|
||||
0,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37, /* ABCDEFGHIJKLMNO */
|
||||
38,39,40,41,42,43,44,45,46,47,48, 0, 0, 0, 0, 0, /* PQRSTUVWXYZ */
|
||||
0,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63, /* abcdefghijklmno */
|
||||
64,65,66,67,68,69,70,71,72,73,74, 0, 0, 0, 0, 0, /* pqrstuvwxyz */
|
||||
};
|
||||
static const int permitted_alphabet_code2value_3[74] = {
|
||||
32,39,40,41,43,44,45,46,47,48,49,50,51,52,53,54,
|
||||
55,56,57,58,61,63,65,66,67,68,69,70,71,72,73,74,
|
||||
75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,
|
||||
97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,
|
||||
113,114,115,116,117,118,119,120,121,122,};
|
||||
|
||||
|
||||
static int check_permitted_alphabet_3(const void *sptr) {
|
||||
const int *table = permitted_alphabet_table_3;
|
||||
/* The underlying type is PrintableString */
|
||||
const PrintableString_t *st = (const PrintableString_t *)sptr;
|
||||
const uint8_t *ch = st->buf;
|
||||
const uint8_t *end = ch + st->size;
|
||||
|
||||
for(; ch < end; ch++) {
|
||||
uint8_t cv = *ch;
|
||||
if(!table[cv]) return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
memb_numeric_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
|
||||
const NumericString_t *st = (const NumericString_t *)sptr;
|
||||
size_t size;
|
||||
|
||||
if(!sptr) {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: value not given (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
size = st->size;
|
||||
|
||||
if((size <= 16)
|
||||
&& !check_permitted_alphabet_2(st)) {
|
||||
/* Constraint check succeeded */
|
||||
return 0;
|
||||
} else {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: constraint failed (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
static int asn_PER_MAP_numeric_2_v2c(unsigned int value) {
|
||||
if(value >= sizeof(permitted_alphabet_table_2)/sizeof(permitted_alphabet_table_2[0]))
|
||||
return -1;
|
||||
return permitted_alphabet_table_2[value] - 1;
|
||||
}
|
||||
static int asn_PER_MAP_numeric_2_c2v(unsigned int code) {
|
||||
if(code >= sizeof(permitted_alphabet_code2value_2)/sizeof(permitted_alphabet_code2value_2[0]))
|
||||
return -1;
|
||||
return permitted_alphabet_code2value_2[code];
|
||||
}
|
||||
static int
|
||||
memb_printable_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
|
||||
const PrintableString_t *st = (const PrintableString_t *)sptr;
|
||||
size_t size;
|
||||
|
||||
if(!sptr) {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: value not given (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
size = st->size;
|
||||
|
||||
if((size <= 16)
|
||||
&& !check_permitted_alphabet_3(st)) {
|
||||
/* Constraint check succeeded */
|
||||
return 0;
|
||||
} else {
|
||||
ASN__CTFAIL(app_key, td, sptr,
|
||||
"%s: constraint failed (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
static int asn_PER_MAP_printable_3_v2c(unsigned int value) {
|
||||
if(value >= sizeof(permitted_alphabet_table_3)/sizeof(permitted_alphabet_table_3[0]))
|
||||
return -1;
|
||||
return permitted_alphabet_table_3[value] - 1;
|
||||
}
|
||||
static int asn_PER_MAP_printable_3_c2v(unsigned int code) {
|
||||
if(code >= sizeof(permitted_alphabet_code2value_3)/sizeof(permitted_alphabet_code2value_3[0]))
|
||||
return -1;
|
||||
return permitted_alphabet_code2value_3[code];
|
||||
}
|
||||
static asn_oer_constraints_t asn_OER_memb_numeric_constr_2 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1 /* (SIZE(0..16)) */};
|
||||
static asn_per_constraints_t asn_PER_memb_numeric_constr_2 CC_NOTUSED = {
|
||||
{ APC_CONSTRAINED, 4, 4, 32, 57 } /* (32..57) */,
|
||||
{ APC_CONSTRAINED, 5, 5, 0, 16 } /* (SIZE(0..16)) */,
|
||||
asn_PER_MAP_numeric_2_v2c, /* Value to PER code map */
|
||||
asn_PER_MAP_numeric_2_c2v /* PER code to value map */
|
||||
};
|
||||
static asn_oer_constraints_t asn_OER_memb_printable_constr_3 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1 /* (SIZE(0..16)) */};
|
||||
static asn_per_constraints_t asn_PER_memb_printable_constr_3 CC_NOTUSED = {
|
||||
{ APC_CONSTRAINED, 7, 7, 32, 122 } /* (32..122) */,
|
||||
{ APC_CONSTRAINED, 5, 5, 0, 16 } /* (SIZE(0..16)) */,
|
||||
asn_PER_MAP_printable_3_v2c, /* Value to PER code map */
|
||||
asn_PER_MAP_printable_3_c2v /* PER code to value map */
|
||||
};
|
||||
static asn_oer_constraints_t asn_OER_type_AdministrationDomainName_constr_1 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1};
|
||||
asn_per_constraints_t asn_PER_type_AdministrationDomainName_constr_1 CC_NOTUSED = {
|
||||
{ APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */,
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
asn_TYPE_member_t asn_MBR_AdministrationDomainName_1[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct AdministrationDomainName, choice.numeric),
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (18 << 2)),
|
||||
0,
|
||||
&asn_DEF_NumericString,
|
||||
0,
|
||||
{ &asn_OER_memb_numeric_constr_2, &asn_PER_memb_numeric_constr_2, memb_numeric_constraint_1 },
|
||||
0, 0, /* No default value */
|
||||
"numeric"
|
||||
},
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct AdministrationDomainName, choice.printable),
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (19 << 2)),
|
||||
0,
|
||||
&asn_DEF_PrintableString,
|
||||
0,
|
||||
{ &asn_OER_memb_printable_constr_3, &asn_PER_memb_printable_constr_3, memb_printable_constraint_1 },
|
||||
0, 0, /* No default value */
|
||||
"printable"
|
||||
},
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_AdministrationDomainName_tags_1[] = {
|
||||
(ASN_TAG_CLASS_APPLICATION | (2 << 2))
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_AdministrationDomainName_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_UNIVERSAL | (18 << 2)), 0, 0, 0 }, /* numeric */
|
||||
{ (ASN_TAG_CLASS_UNIVERSAL | (19 << 2)), 1, 0, 0 } /* printable */
|
||||
};
|
||||
asn_CHOICE_specifics_t asn_SPC_AdministrationDomainName_specs_1 = {
|
||||
sizeof(struct AdministrationDomainName),
|
||||
offsetof(struct AdministrationDomainName, _asn_ctx),
|
||||
offsetof(struct AdministrationDomainName, present),
|
||||
sizeof(((struct AdministrationDomainName *)0)->present),
|
||||
asn_MAP_AdministrationDomainName_tag2el_1,
|
||||
2, /* Count of tags in the map */
|
||||
0, 0,
|
||||
-1 /* Extensions start */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_AdministrationDomainName = {
|
||||
"AdministrationDomainName",
|
||||
"AdministrationDomainName",
|
||||
&asn_OP_CHOICE,
|
||||
asn_DEF_AdministrationDomainName_tags_1,
|
||||
sizeof(asn_DEF_AdministrationDomainName_tags_1)
|
||||
/sizeof(asn_DEF_AdministrationDomainName_tags_1[0]), /* 1 */
|
||||
asn_DEF_AdministrationDomainName_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_AdministrationDomainName_tags_1)
|
||||
/sizeof(asn_DEF_AdministrationDomainName_tags_1[0]), /* 1 */
|
||||
{ &asn_OER_type_AdministrationDomainName_constr_1, &asn_PER_type_AdministrationDomainName_constr_1, CHOICE_constraint },
|
||||
asn_MBR_AdministrationDomainName_1,
|
||||
2, /* Elements count */
|
||||
&asn_SPC_AdministrationDomainName_specs_1 /* Additional specs */
|
||||
};
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "PKIX1Explicit88"
|
||||
* found in "../../../asn1/PKIXExplicit88.asn"
|
||||
* `asn1c -fwide-types -fcompound-names -fincludes-quoted -no-gen-example`
|
||||
*/
|
||||
|
||||
#ifndef _AdministrationDomainName_H_
|
||||
#define _AdministrationDomainName_H_
|
||||
|
||||
|
||||
#include "asn_application.h"
|
||||
|
||||
/* Including external dependencies */
|
||||
#include "NumericString.h"
|
||||
#include "PrintableString.h"
|
||||
#include "constr_CHOICE.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Dependencies */
|
||||
typedef enum AdministrationDomainName_PR {
|
||||
AdministrationDomainName_PR_NOTHING, /* No components present */
|
||||
AdministrationDomainName_PR_numeric,
|
||||
AdministrationDomainName_PR_printable
|
||||
} AdministrationDomainName_PR;
|
||||
|
||||
/* AdministrationDomainName */
|
||||
typedef struct AdministrationDomainName {
|
||||
AdministrationDomainName_PR present;
|
||||
union AdministrationDomainName_u {
|
||||
NumericString_t numeric;
|
||||
PrintableString_t printable;
|
||||
} choice;
|
||||
|
||||
/* Context for parsing across buffer boundaries */
|
||||
asn_struct_ctx_t _asn_ctx;
|
||||
} AdministrationDomainName_t;
|
||||
|
||||
/* Implementation */
|
||||
extern asn_TYPE_descriptor_t asn_DEF_AdministrationDomainName;
|
||||
extern asn_CHOICE_specifics_t asn_SPC_AdministrationDomainName_specs_1;
|
||||
extern asn_TYPE_member_t asn_MBR_AdministrationDomainName_1[2];
|
||||
extern asn_per_constraints_t asn_PER_type_AdministrationDomainName_constr_1;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _AdministrationDomainName_H_ */
|
||||
#include "asn_internal.h"
|
|
@ -1,61 +0,0 @@
|
|||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "PKIX1Explicit88"
|
||||
* found in "../../../asn1/PKIXExplicit88.asn"
|
||||
* `asn1c -fwide-types -fcompound-names -fincludes-quoted -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "AlgorithmIdentifier.h"
|
||||
|
||||
asn_TYPE_member_t asn_MBR_AlgorithmIdentifier_1[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct AlgorithmIdentifier, algorithm),
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (6 << 2)),
|
||||
0,
|
||||
&asn_DEF_OBJECT_IDENTIFIER,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"algorithm"
|
||||
},
|
||||
{ ATF_ANY_TYPE | ATF_POINTER, 1, offsetof(struct AlgorithmIdentifier, parameters),
|
||||
-1 /* Ambiguous tag (ANY?) */,
|
||||
0,
|
||||
&asn_DEF_ANY,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"parameters"
|
||||
},
|
||||
};
|
||||
static const int asn_MAP_AlgorithmIdentifier_oms_1[] = { 1 };
|
||||
static const ber_tlv_tag_t asn_DEF_AlgorithmIdentifier_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_AlgorithmIdentifier_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), 0, 0, 0 } /* algorithm */
|
||||
};
|
||||
asn_SEQUENCE_specifics_t asn_SPC_AlgorithmIdentifier_specs_1 = {
|
||||
sizeof(struct AlgorithmIdentifier),
|
||||
offsetof(struct AlgorithmIdentifier, _asn_ctx),
|
||||
asn_MAP_AlgorithmIdentifier_tag2el_1,
|
||||
1, /* Count of tags in the map */
|
||||
asn_MAP_AlgorithmIdentifier_oms_1, /* Optional members */
|
||||
1, 0, /* Root/Additions */
|
||||
-1, /* First extension addition */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_AlgorithmIdentifier = {
|
||||
"AlgorithmIdentifier",
|
||||
"AlgorithmIdentifier",
|
||||
&asn_OP_SEQUENCE,
|
||||
asn_DEF_AlgorithmIdentifier_tags_1,
|
||||
sizeof(asn_DEF_AlgorithmIdentifier_tags_1)
|
||||
/sizeof(asn_DEF_AlgorithmIdentifier_tags_1[0]), /* 1 */
|
||||
asn_DEF_AlgorithmIdentifier_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_AlgorithmIdentifier_tags_1)
|
||||
/sizeof(asn_DEF_AlgorithmIdentifier_tags_1[0]), /* 1 */
|
||||
{ 0, 0, SEQUENCE_constraint },
|
||||
asn_MBR_AlgorithmIdentifier_1,
|
||||
2, /* Elements count */
|
||||
&asn_SPC_AlgorithmIdentifier_specs_1 /* Additional specs */
|
||||
};
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "PKIX1Explicit88"
|
||||
* found in "../../../asn1/PKIXExplicit88.asn"
|
||||
* `asn1c -fwide-types -fcompound-names -fincludes-quoted -no-gen-example`
|
||||
*/
|
||||
|
||||
#ifndef _AlgorithmIdentifier_H_
|
||||
#define _AlgorithmIdentifier_H_
|
||||
|
||||
|
||||
#include "asn_application.h"
|
||||
|
||||
/* Including external dependencies */
|
||||
#include "OBJECT_IDENTIFIER.h"
|
||||
#include "ANY.h"
|
||||
#include "constr_SEQUENCE.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* AlgorithmIdentifier */
|
||||
typedef struct AlgorithmIdentifier {
|
||||
OBJECT_IDENTIFIER_t algorithm;
|
||||
ANY_t *parameters /* OPTIONAL */;
|
||||
|
||||
/* Context for parsing across buffer boundaries */
|
||||
asn_struct_ctx_t _asn_ctx;
|
||||
} AlgorithmIdentifier_t;
|
||||
|
||||
/* Implementation */
|
||||
extern asn_TYPE_descriptor_t asn_DEF_AlgorithmIdentifier;
|
||||
extern asn_SEQUENCE_specifics_t asn_SPC_AlgorithmIdentifier_specs_1;
|
||||
extern asn_TYPE_member_t asn_MBR_AlgorithmIdentifier_1[2];
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _AlgorithmIdentifier_H_ */
|
||||
#include "asn_internal.h"
|
|
@ -1,60 +0,0 @@
|
|||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "PKIX1Implicit88"
|
||||
* found in "../../../asn1/PKIXImplicit88.asn"
|
||||
* `asn1c -fwide-types -fcompound-names -fincludes-quoted -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "AnotherName.h"
|
||||
|
||||
asn_TYPE_member_t asn_MBR_AnotherName_1[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct AnotherName, type_id),
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (6 << 2)),
|
||||
0,
|
||||
&asn_DEF_OBJECT_IDENTIFIER,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"type-id"
|
||||
},
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct AnotherName, value),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
+1, /* EXPLICIT tag at current level */
|
||||
&asn_DEF_ANY,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"value"
|
||||
},
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_AnotherName_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_AnotherName_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), 0, 0, 0 }, /* type-id */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 1, 0, 0 } /* value */
|
||||
};
|
||||
asn_SEQUENCE_specifics_t asn_SPC_AnotherName_specs_1 = {
|
||||
sizeof(struct AnotherName),
|
||||
offsetof(struct AnotherName, _asn_ctx),
|
||||
asn_MAP_AnotherName_tag2el_1,
|
||||
2, /* Count of tags in the map */
|
||||
0, 0, 0, /* Optional elements (not needed) */
|
||||
-1, /* First extension addition */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_AnotherName = {
|
||||
"AnotherName",
|
||||
"AnotherName",
|
||||
&asn_OP_SEQUENCE,
|
||||
asn_DEF_AnotherName_tags_1,
|
||||
sizeof(asn_DEF_AnotherName_tags_1)
|
||||
/sizeof(asn_DEF_AnotherName_tags_1[0]), /* 1 */
|
||||
asn_DEF_AnotherName_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_AnotherName_tags_1)
|
||||
/sizeof(asn_DEF_AnotherName_tags_1[0]), /* 1 */
|
||||
{ 0, 0, SEQUENCE_constraint },
|
||||
asn_MBR_AnotherName_1,
|
||||
2, /* Elements count */
|
||||
&asn_SPC_AnotherName_specs_1 /* Additional specs */
|
||||
};
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "PKIX1Implicit88"
|
||||
* found in "../../../asn1/PKIXImplicit88.asn"
|
||||
* `asn1c -fwide-types -fcompound-names -fincludes-quoted -no-gen-example`
|
||||
*/
|
||||
|
||||
#ifndef _AnotherName_H_
|
||||
#define _AnotherName_H_
|
||||
|
||||
|
||||
#include "asn_application.h"
|
||||
|
||||
/* Including external dependencies */
|
||||
#include "OBJECT_IDENTIFIER.h"
|
||||
#include "ANY.h"
|
||||
#include "constr_SEQUENCE.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* AnotherName */
|
||||
typedef struct AnotherName {
|
||||
OBJECT_IDENTIFIER_t type_id;
|
||||
ANY_t value;
|
||||
|
||||
/* Context for parsing across buffer boundaries */
|
||||
asn_struct_ctx_t _asn_ctx;
|
||||
} AnotherName_t;
|
||||
|
||||
/* Implementation */
|
||||
extern asn_TYPE_descriptor_t asn_DEF_AnotherName;
|
||||
extern asn_SEQUENCE_specifics_t asn_SPC_AnotherName_specs_1;
|
||||
extern asn_TYPE_member_t asn_MBR_AnotherName_1[2];
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _AnotherName_H_ */
|
||||
#include "asn_internal.h"
|
|
@ -1,96 +0,0 @@
|
|||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "PKIX1Explicit88"
|
||||
* found in "../../../asn1/PKIXExplicit88.asn"
|
||||
* `asn1c -fwide-types -fcompound-names -fincludes-quoted -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "Attribute.h"
|
||||
|
||||
static asn_TYPE_member_t asn_MBR_values_3[] = {
|
||||
{ ATF_ANY_TYPE | ATF_POINTER, 0, 0,
|
||||
-1 /* Ambiguous tag (ANY?) */,
|
||||
0,
|
||||
&asn_DEF_AttributeValue,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
""
|
||||
},
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_values_tags_3[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (17 << 2))
|
||||
};
|
||||
static asn_SET_OF_specifics_t asn_SPC_values_specs_3 = {
|
||||
sizeof(struct Attribute__values),
|
||||
offsetof(struct Attribute__values, _asn_ctx),
|
||||
0, /* XER encoding is XMLDelimitedItemList */
|
||||
};
|
||||
static /* Use -fall-defs-global to expose */
|
||||
asn_TYPE_descriptor_t asn_DEF_values_3 = {
|
||||
"values",
|
||||
"values",
|
||||
&asn_OP_SET_OF,
|
||||
asn_DEF_values_tags_3,
|
||||
sizeof(asn_DEF_values_tags_3)
|
||||
/sizeof(asn_DEF_values_tags_3[0]), /* 1 */
|
||||
asn_DEF_values_tags_3, /* Same as above */
|
||||
sizeof(asn_DEF_values_tags_3)
|
||||
/sizeof(asn_DEF_values_tags_3[0]), /* 1 */
|
||||
{ 0, 0, SET_OF_constraint },
|
||||
asn_MBR_values_3,
|
||||
1, /* Single element */
|
||||
&asn_SPC_values_specs_3 /* Additional specs */
|
||||
};
|
||||
|
||||
asn_TYPE_member_t asn_MBR_Attribute_1[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct Attribute, type),
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (6 << 2)),
|
||||
0,
|
||||
&asn_DEF_AttributeType,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"type"
|
||||
},
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct Attribute, values),
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (17 << 2)),
|
||||
0,
|
||||
&asn_DEF_values_3,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"values"
|
||||
},
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_Attribute_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_Attribute_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), 0, 0, 0 }, /* type */
|
||||
{ (ASN_TAG_CLASS_UNIVERSAL | (17 << 2)), 1, 0, 0 } /* values */
|
||||
};
|
||||
asn_SEQUENCE_specifics_t asn_SPC_Attribute_specs_1 = {
|
||||
sizeof(struct Attribute),
|
||||
offsetof(struct Attribute, _asn_ctx),
|
||||
asn_MAP_Attribute_tag2el_1,
|
||||
2, /* Count of tags in the map */
|
||||
0, 0, 0, /* Optional elements (not needed) */
|
||||
-1, /* First extension addition */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_Attribute = {
|
||||
"Attribute",
|
||||
"Attribute",
|
||||
&asn_OP_SEQUENCE,
|
||||
asn_DEF_Attribute_tags_1,
|
||||
sizeof(asn_DEF_Attribute_tags_1)
|
||||
/sizeof(asn_DEF_Attribute_tags_1[0]), /* 1 */
|
||||
asn_DEF_Attribute_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_Attribute_tags_1)
|
||||
/sizeof(asn_DEF_Attribute_tags_1[0]), /* 1 */
|
||||
{ 0, 0, SEQUENCE_constraint },
|
||||
asn_MBR_Attribute_1,
|
||||
2, /* Elements count */
|
||||
&asn_SPC_Attribute_specs_1 /* Additional specs */
|
||||
};
|
||||
|
|
@ -1,49 +0,0 @@
|
|||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "PKIX1Explicit88"
|
||||
* found in "../../../asn1/PKIXExplicit88.asn"
|
||||
* `asn1c -fwide-types -fcompound-names -fincludes-quoted -no-gen-example`
|
||||
*/
|
||||
|
||||
#ifndef _Attribute_H_
|
||||
#define _Attribute_H_
|
||||
|
||||
|
||||
#include "asn_application.h"
|
||||
|
||||
/* Including external dependencies */
|
||||
#include "AttributeType.h"
|
||||
#include "AttributeValue.h"
|
||||
#include "asn_SET_OF.h"
|
||||
#include "constr_SET_OF.h"
|
||||
#include "constr_SEQUENCE.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Attribute */
|
||||
typedef struct Attribute {
|
||||
AttributeType_t type;
|
||||
struct Attribute__values {
|
||||
A_SET_OF(AttributeValue_t) list;
|
||||
|
||||
/* Context for parsing across buffer boundaries */
|
||||
asn_struct_ctx_t _asn_ctx;
|
||||
} values;
|
||||
|
||||
/* Context for parsing across buffer boundaries */
|
||||
asn_struct_ctx_t _asn_ctx;
|
||||
} Attribute_t;
|
||||
|
||||
/* Implementation */
|
||||
extern asn_TYPE_descriptor_t asn_DEF_Attribute;
|
||||
extern asn_SEQUENCE_specifics_t asn_SPC_Attribute_specs_1;
|
||||
extern asn_TYPE_member_t asn_MBR_Attribute_1[2];
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _Attribute_H_ */
|
||||
#include "asn_internal.h"
|
|
@ -1,31 +0,0 @@
|
|||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "PKIX1Explicit88"
|
||||
* found in "../../../asn1/PKIXExplicit88.asn"
|
||||
* `asn1c -fwide-types -fcompound-names -fincludes-quoted -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "AttributeType.h"
|
||||
|
||||
/*
|
||||
* This type is implemented using OBJECT_IDENTIFIER,
|
||||
* so here we adjust the DEF accordingly.
|
||||
*/
|
||||
static const ber_tlv_tag_t asn_DEF_AttributeType_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (6 << 2))
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_AttributeType = {
|
||||
"AttributeType",
|
||||
"AttributeType",
|
||||
&asn_OP_OBJECT_IDENTIFIER,
|
||||
asn_DEF_AttributeType_tags_1,
|
||||
sizeof(asn_DEF_AttributeType_tags_1)
|
||||
/sizeof(asn_DEF_AttributeType_tags_1[0]), /* 1 */
|
||||
asn_DEF_AttributeType_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_AttributeType_tags_1)
|
||||
/sizeof(asn_DEF_AttributeType_tags_1[0]), /* 1 */
|
||||
{ 0, 0, OBJECT_IDENTIFIER_constraint },
|
||||
0, 0, /* No members */
|
||||
0 /* No specifics */
|
||||
};
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "PKIX1Explicit88"
|
||||
* found in "../../../asn1/PKIXExplicit88.asn"
|
||||
* `asn1c -fwide-types -fcompound-names -fincludes-quoted -no-gen-example`
|
||||
*/
|
||||
|
||||
#ifndef _AttributeType_H_
|
||||
#define _AttributeType_H_
|
||||
|
||||
|
||||
#include "asn_application.h"
|
||||
|
||||
/* Including external dependencies */
|
||||
#include "OBJECT_IDENTIFIER.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* AttributeType */
|
||||
typedef OBJECT_IDENTIFIER_t AttributeType_t;
|
||||
|
||||
/* Implementation */
|
||||
extern asn_TYPE_descriptor_t asn_DEF_AttributeType;
|
||||
asn_struct_free_f AttributeType_free;
|
||||
asn_struct_print_f AttributeType_print;
|
||||
asn_constr_check_f AttributeType_constraint;
|
||||
ber_type_decoder_f AttributeType_decode_ber;
|
||||
der_type_encoder_f AttributeType_encode_der;
|
||||
xer_type_decoder_f AttributeType_decode_xer;
|
||||
xer_type_encoder_f AttributeType_encode_xer;
|
||||
oer_type_decoder_f AttributeType_decode_oer;
|
||||
oer_type_encoder_f AttributeType_encode_oer;
|
||||
per_type_decoder_f AttributeType_decode_uper;
|
||||
per_type_encoder_f AttributeType_encode_uper;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _AttributeType_H_ */
|
||||
#include "asn_internal.h"
|
|
@ -1,59 +0,0 @@
|
|||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "PKIX1Explicit88"
|
||||
* found in "../../../asn1/PKIXExplicit88.asn"
|
||||
* `asn1c -fwide-types -fcompound-names -fincludes-quoted -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "AttributeTypeAndValue.h"
|
||||
|
||||
asn_TYPE_member_t asn_MBR_AttributeTypeAndValue_1[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct AttributeTypeAndValue, type),
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (6 << 2)),
|
||||
0,
|
||||
&asn_DEF_AttributeType,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"type"
|
||||
},
|
||||
{ ATF_ANY_TYPE | ATF_NOFLAGS, 0, offsetof(struct AttributeTypeAndValue, value),
|
||||
-1 /* Ambiguous tag (ANY?) */,
|
||||
0,
|
||||
&asn_DEF_AttributeValue,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"value"
|
||||
},
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_AttributeTypeAndValue_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_AttributeTypeAndValue_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_UNIVERSAL | (6 << 2)), 0, 0, 0 } /* type */
|
||||
};
|
||||
asn_SEQUENCE_specifics_t asn_SPC_AttributeTypeAndValue_specs_1 = {
|
||||
sizeof(struct AttributeTypeAndValue),
|
||||
offsetof(struct AttributeTypeAndValue, _asn_ctx),
|
||||
asn_MAP_AttributeTypeAndValue_tag2el_1,
|
||||
1, /* Count of tags in the map */
|
||||
0, 0, 0, /* Optional elements (not needed) */
|
||||
-1, /* First extension addition */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_AttributeTypeAndValue = {
|
||||
"AttributeTypeAndValue",
|
||||
"AttributeTypeAndValue",
|
||||
&asn_OP_SEQUENCE,
|
||||
asn_DEF_AttributeTypeAndValue_tags_1,
|
||||
sizeof(asn_DEF_AttributeTypeAndValue_tags_1)
|
||||
/sizeof(asn_DEF_AttributeTypeAndValue_tags_1[0]), /* 1 */
|
||||
asn_DEF_AttributeTypeAndValue_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_AttributeTypeAndValue_tags_1)
|
||||
/sizeof(asn_DEF_AttributeTypeAndValue_tags_1[0]), /* 1 */
|
||||
{ 0, 0, SEQUENCE_constraint },
|
||||
asn_MBR_AttributeTypeAndValue_1,
|
||||
2, /* Elements count */
|
||||
&asn_SPC_AttributeTypeAndValue_specs_1 /* Additional specs */
|
||||
};
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "PKIX1Explicit88"
|
||||
* found in "../../../asn1/PKIXExplicit88.asn"
|
||||
* `asn1c -fwide-types -fcompound-names -fincludes-quoted -no-gen-example`
|
||||
*/
|
||||
|
||||
#ifndef _AttributeTypeAndValue_H_
|
||||
#define _AttributeTypeAndValue_H_
|
||||
|
||||
|
||||
#include "asn_application.h"
|
||||
|
||||
/* Including external dependencies */
|
||||
#include "AttributeType.h"
|
||||
#include "AttributeValue.h"
|
||||
#include "constr_SEQUENCE.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* AttributeTypeAndValue */
|
||||
typedef struct AttributeTypeAndValue {
|
||||
AttributeType_t type;
|
||||
AttributeValue_t value;
|
||||
|
||||
/* Context for parsing across buffer boundaries */
|
||||
asn_struct_ctx_t _asn_ctx;
|
||||
} AttributeTypeAndValue_t;
|
||||
|
||||
/* Implementation */
|
||||
extern asn_TYPE_descriptor_t asn_DEF_AttributeTypeAndValue;
|
||||
extern asn_SEQUENCE_specifics_t asn_SPC_AttributeTypeAndValue_specs_1;
|
||||
extern asn_TYPE_member_t asn_MBR_AttributeTypeAndValue_1[2];
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _AttributeTypeAndValue_H_ */
|
||||
#include "asn_internal.h"
|
|
@ -1,26 +0,0 @@
|
|||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "PKIX1Explicit88"
|
||||
* found in "../../../asn1/PKIXExplicit88.asn"
|
||||
* `asn1c -fwide-types -fcompound-names -fincludes-quoted -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "AttributeValue.h"
|
||||
|
||||
/*
|
||||
* This type is implemented using ANY,
|
||||
* so here we adjust the DEF accordingly.
|
||||
*/
|
||||
asn_TYPE_descriptor_t asn_DEF_AttributeValue = {
|
||||
"AttributeValue",
|
||||
"AttributeValue",
|
||||
&asn_OP_ANY,
|
||||
0, /* No effective tags (pointer) */
|
||||
0, /* No effective tags (count) */
|
||||
0, /* No tags (pointer) */
|
||||
0, /* No tags (count) */
|
||||
{ 0, 0, ANY_constraint },
|
||||
0, 0, /* No members */
|
||||
&asn_SPC_ANY_specs /* Additional specs */
|
||||
};
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "PKIX1Explicit88"
|
||||
* found in "../../../asn1/PKIXExplicit88.asn"
|
||||
* `asn1c -fwide-types -fcompound-names -fincludes-quoted -no-gen-example`
|
||||
*/
|
||||
|
||||
#ifndef _AttributeValue_H_
|
||||
#define _AttributeValue_H_
|
||||
|
||||
|
||||
#include "asn_application.h"
|
||||
|
||||
/* Including external dependencies */
|
||||
#include "ANY.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* AttributeValue */
|
||||
typedef ANY_t AttributeValue_t;
|
||||
|
||||
/* Implementation */
|
||||
extern asn_TYPE_descriptor_t asn_DEF_AttributeValue;
|
||||
asn_struct_free_f AttributeValue_free;
|
||||
asn_struct_print_f AttributeValue_print;
|
||||
asn_constr_check_f AttributeValue_constraint;
|
||||
ber_type_decoder_f AttributeValue_decode_ber;
|
||||
der_type_encoder_f AttributeValue_encode_der;
|
||||
xer_type_decoder_f AttributeValue_decode_xer;
|
||||
xer_type_encoder_f AttributeValue_encode_xer;
|
||||
oer_type_decoder_f AttributeValue_decode_oer;
|
||||
oer_type_encoder_f AttributeValue_encode_oer;
|
||||
per_type_decoder_f AttributeValue_decode_uper;
|
||||
per_type_encoder_f AttributeValue_encode_uper;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _AttributeValue_H_ */
|
||||
#include "asn_internal.h"
|
|
@ -1,70 +0,0 @@
|
|||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "RSPDefinitions"
|
||||
* found in "../../../asn1/rsp.asn"
|
||||
* `asn1c -fwide-types -fcompound-names -fincludes-quoted -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "AuthenticateClientOk.h"
|
||||
|
||||
asn_TYPE_member_t asn_MBR_AuthenticateClientOk_1[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct AuthenticateClientOk, transactionId),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_TransactionId,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"transactionId"
|
||||
},
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct AuthenticateClientOk, profileMetaData),
|
||||
(ASN_TAG_CLASS_CONTEXT | (37 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_StoreMetadataRequest,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"profileMetaData"
|
||||
},
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct AuthenticateClientOk, prepareDownloadRequest),
|
||||
(ASN_TAG_CLASS_CONTEXT | (33 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_PrepareDownloadRequest,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"prepareDownloadRequest"
|
||||
},
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_AuthenticateClientOk_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_AuthenticateClientOk_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* transactionId */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (33 << 2)), 2, 0, 0 }, /* prepareDownloadRequest */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (37 << 2)), 1, 0, 0 } /* profileMetaData */
|
||||
};
|
||||
asn_SEQUENCE_specifics_t asn_SPC_AuthenticateClientOk_specs_1 = {
|
||||
sizeof(struct AuthenticateClientOk),
|
||||
offsetof(struct AuthenticateClientOk, _asn_ctx),
|
||||
asn_MAP_AuthenticateClientOk_tag2el_1,
|
||||
3, /* Count of tags in the map */
|
||||
0, 0, 0, /* Optional elements (not needed) */
|
||||
3, /* First extension addition */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_AuthenticateClientOk = {
|
||||
"AuthenticateClientOk",
|
||||
"AuthenticateClientOk",
|
||||
&asn_OP_SEQUENCE,
|
||||
asn_DEF_AuthenticateClientOk_tags_1,
|
||||
sizeof(asn_DEF_AuthenticateClientOk_tags_1)
|
||||
/sizeof(asn_DEF_AuthenticateClientOk_tags_1[0]), /* 1 */
|
||||
asn_DEF_AuthenticateClientOk_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_AuthenticateClientOk_tags_1)
|
||||
/sizeof(asn_DEF_AuthenticateClientOk_tags_1[0]), /* 1 */
|
||||
{ 0, 0, SEQUENCE_constraint },
|
||||
asn_MBR_AuthenticateClientOk_1,
|
||||
3, /* Elements count */
|
||||
&asn_SPC_AuthenticateClientOk_specs_1 /* Additional specs */
|
||||
};
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "RSPDefinitions"
|
||||
* found in "../../../asn1/rsp.asn"
|
||||
* `asn1c -fwide-types -fcompound-names -fincludes-quoted -no-gen-example`
|
||||
*/
|
||||
|
||||
#ifndef _AuthenticateClientOk_H_
|
||||
#define _AuthenticateClientOk_H_
|
||||
|
||||
|
||||
#include "asn_application.h"
|
||||
|
||||
/* Including external dependencies */
|
||||
#include "TransactionId.h"
|
||||
#include "StoreMetadataRequest.h"
|
||||
#include "PrepareDownloadRequest.h"
|
||||
#include "constr_SEQUENCE.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* AuthenticateClientOk */
|
||||
typedef struct AuthenticateClientOk {
|
||||
TransactionId_t transactionId;
|
||||
StoreMetadataRequest_t profileMetaData;
|
||||
PrepareDownloadRequest_t prepareDownloadRequest;
|
||||
/*
|
||||
* This type is extensible,
|
||||
* possible extensions are below.
|
||||
*/
|
||||
|
||||
/* Context for parsing across buffer boundaries */
|
||||
asn_struct_ctx_t _asn_ctx;
|
||||
} AuthenticateClientOk_t;
|
||||
|
||||
/* Implementation */
|
||||
extern asn_TYPE_descriptor_t asn_DEF_AuthenticateClientOk;
|
||||
extern asn_SEQUENCE_specifics_t asn_SPC_AuthenticateClientOk_specs_1;
|
||||
extern asn_TYPE_member_t asn_MBR_AuthenticateClientOk_1[3];
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _AuthenticateClientOk_H_ */
|
||||
#include "asn_internal.h"
|
|
@ -1,97 +0,0 @@
|
|||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "RSPDefinitions"
|
||||
* found in "../../../asn1/rsp.asn"
|
||||
* `asn1c -fwide-types -fcompound-names -fincludes-quoted -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "AuthenticateClientOkEs11.h"
|
||||
|
||||
static asn_TYPE_member_t asn_MBR_eventEntries_3[] = {
|
||||
{ ATF_POINTER, 0, 0,
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2)),
|
||||
0,
|
||||
&asn_DEF_EventEntries,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
""
|
||||
},
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_eventEntries_tags_3[] = {
|
||||
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static asn_SET_OF_specifics_t asn_SPC_eventEntries_specs_3 = {
|
||||
sizeof(struct AuthenticateClientOkEs11__eventEntries),
|
||||
offsetof(struct AuthenticateClientOkEs11__eventEntries, _asn_ctx),
|
||||
0, /* XER encoding is XMLDelimitedItemList */
|
||||
};
|
||||
static /* Use -fall-defs-global to expose */
|
||||
asn_TYPE_descriptor_t asn_DEF_eventEntries_3 = {
|
||||
"eventEntries",
|
||||
"eventEntries",
|
||||
&asn_OP_SEQUENCE_OF,
|
||||
asn_DEF_eventEntries_tags_3,
|
||||
sizeof(asn_DEF_eventEntries_tags_3)
|
||||
/sizeof(asn_DEF_eventEntries_tags_3[0]) - 1, /* 1 */
|
||||
asn_DEF_eventEntries_tags_3, /* Same as above */
|
||||
sizeof(asn_DEF_eventEntries_tags_3)
|
||||
/sizeof(asn_DEF_eventEntries_tags_3[0]), /* 2 */
|
||||
{ 0, 0, SEQUENCE_OF_constraint },
|
||||
asn_MBR_eventEntries_3,
|
||||
1, /* Single element */
|
||||
&asn_SPC_eventEntries_specs_3 /* Additional specs */
|
||||
};
|
||||
|
||||
asn_TYPE_member_t asn_MBR_AuthenticateClientOkEs11_1[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct AuthenticateClientOkEs11, transactionId),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_TransactionId,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"transactionId"
|
||||
},
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct AuthenticateClientOkEs11, eventEntries),
|
||||
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
|
||||
0,
|
||||
&asn_DEF_eventEntries_3,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"eventEntries"
|
||||
},
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_AuthenticateClientOkEs11_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_AuthenticateClientOkEs11_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* transactionId */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* eventEntries */
|
||||
};
|
||||
asn_SEQUENCE_specifics_t asn_SPC_AuthenticateClientOkEs11_specs_1 = {
|
||||
sizeof(struct AuthenticateClientOkEs11),
|
||||
offsetof(struct AuthenticateClientOkEs11, _asn_ctx),
|
||||
asn_MAP_AuthenticateClientOkEs11_tag2el_1,
|
||||
2, /* Count of tags in the map */
|
||||
0, 0, 0, /* Optional elements (not needed) */
|
||||
2, /* First extension addition */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_AuthenticateClientOkEs11 = {
|
||||
"AuthenticateClientOkEs11",
|
||||
"AuthenticateClientOkEs11",
|
||||
&asn_OP_SEQUENCE,
|
||||
asn_DEF_AuthenticateClientOkEs11_tags_1,
|
||||
sizeof(asn_DEF_AuthenticateClientOkEs11_tags_1)
|
||||
/sizeof(asn_DEF_AuthenticateClientOkEs11_tags_1[0]), /* 1 */
|
||||
asn_DEF_AuthenticateClientOkEs11_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_AuthenticateClientOkEs11_tags_1)
|
||||
/sizeof(asn_DEF_AuthenticateClientOkEs11_tags_1[0]), /* 1 */
|
||||
{ 0, 0, SEQUENCE_constraint },
|
||||
asn_MBR_AuthenticateClientOkEs11_1,
|
||||
2, /* Elements count */
|
||||
&asn_SPC_AuthenticateClientOkEs11_specs_1 /* Additional specs */
|
||||
};
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "RSPDefinitions"
|
||||
* found in "../../../asn1/rsp.asn"
|
||||
* `asn1c -fwide-types -fcompound-names -fincludes-quoted -no-gen-example`
|
||||
*/
|
||||
|
||||
#ifndef _AuthenticateClientOkEs11_H_
|
||||
#define _AuthenticateClientOkEs11_H_
|
||||
|
||||
|
||||
#include "asn_application.h"
|
||||
|
||||
/* Including external dependencies */
|
||||
#include "TransactionId.h"
|
||||
#include "asn_SEQUENCE_OF.h"
|
||||
#include "constr_SEQUENCE_OF.h"
|
||||
#include "constr_SEQUENCE.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Forward declarations */
|
||||
struct EventEntries;
|
||||
|
||||
/* AuthenticateClientOkEs11 */
|
||||
typedef struct AuthenticateClientOkEs11 {
|
||||
TransactionId_t transactionId;
|
||||
struct AuthenticateClientOkEs11__eventEntries {
|
||||
A_SEQUENCE_OF(struct EventEntries) list;
|
||||
|
||||
/* Context for parsing across buffer boundaries */
|
||||
asn_struct_ctx_t _asn_ctx;
|
||||
} eventEntries;
|
||||
/*
|
||||
* This type is extensible,
|
||||
* possible extensions are below.
|
||||
*/
|
||||
|
||||
/* Context for parsing across buffer boundaries */
|
||||
asn_struct_ctx_t _asn_ctx;
|
||||
} AuthenticateClientOkEs11_t;
|
||||
|
||||
/* Implementation */
|
||||
extern asn_TYPE_descriptor_t asn_DEF_AuthenticateClientOkEs11;
|
||||
extern asn_SEQUENCE_specifics_t asn_SPC_AuthenticateClientOkEs11_specs_1;
|
||||
extern asn_TYPE_member_t asn_MBR_AuthenticateClientOkEs11_1[2];
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Referred external types */
|
||||
#include "EventEntries.h"
|
||||
|
||||
#endif /* _AuthenticateClientOkEs11_H_ */
|
||||
#include "asn_internal.h"
|
|
@ -1,61 +0,0 @@
|
|||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "RSPDefinitions"
|
||||
* found in "../../../asn1/rsp.asn"
|
||||
* `asn1c -fwide-types -fcompound-names -fincludes-quoted -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "AuthenticateClientRequest.h"
|
||||
|
||||
asn_TYPE_member_t asn_MBR_AuthenticateClientRequest_1[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct AuthenticateClientRequest, transactionId),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_TransactionId,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"transactionId"
|
||||
},
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct AuthenticateClientRequest, authenticateServerResponse),
|
||||
(ASN_TAG_CLASS_CONTEXT | (56 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_AuthenticateServerResponse,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"authenticateServerResponse"
|
||||
},
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_AuthenticateClientRequest_tags_1[] = {
|
||||
(ASN_TAG_CLASS_CONTEXT | (59 << 2)),
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_AuthenticateClientRequest_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* transactionId */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (56 << 2)), 1, 0, 0 } /* authenticateServerResponse */
|
||||
};
|
||||
asn_SEQUENCE_specifics_t asn_SPC_AuthenticateClientRequest_specs_1 = {
|
||||
sizeof(struct AuthenticateClientRequest),
|
||||
offsetof(struct AuthenticateClientRequest, _asn_ctx),
|
||||
asn_MAP_AuthenticateClientRequest_tag2el_1,
|
||||
2, /* Count of tags in the map */
|
||||
0, 0, 0, /* Optional elements (not needed) */
|
||||
2, /* First extension addition */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_AuthenticateClientRequest = {
|
||||
"AuthenticateClientRequest",
|
||||
"AuthenticateClientRequest",
|
||||
&asn_OP_SEQUENCE,
|
||||
asn_DEF_AuthenticateClientRequest_tags_1,
|
||||
sizeof(asn_DEF_AuthenticateClientRequest_tags_1)
|
||||
/sizeof(asn_DEF_AuthenticateClientRequest_tags_1[0]) - 1, /* 1 */
|
||||
asn_DEF_AuthenticateClientRequest_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_AuthenticateClientRequest_tags_1)
|
||||
/sizeof(asn_DEF_AuthenticateClientRequest_tags_1[0]), /* 2 */
|
||||
{ 0, 0, SEQUENCE_constraint },
|
||||
asn_MBR_AuthenticateClientRequest_1,
|
||||
2, /* Elements count */
|
||||
&asn_SPC_AuthenticateClientRequest_specs_1 /* Additional specs */
|
||||
};
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "RSPDefinitions"
|
||||
* found in "../../../asn1/rsp.asn"
|
||||
* `asn1c -fwide-types -fcompound-names -fincludes-quoted -no-gen-example`
|
||||
*/
|
||||
|
||||
#ifndef _AuthenticateClientRequest_H_
|
||||
#define _AuthenticateClientRequest_H_
|
||||
|
||||
|
||||
#include "asn_application.h"
|
||||
|
||||
/* Including external dependencies */
|
||||
#include "TransactionId.h"
|
||||
#include "AuthenticateServerResponse.h"
|
||||
#include "constr_SEQUENCE.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* AuthenticateClientRequest */
|
||||
typedef struct AuthenticateClientRequest {
|
||||
TransactionId_t transactionId;
|
||||
AuthenticateServerResponse_t authenticateServerResponse;
|
||||
/*
|
||||
* This type is extensible,
|
||||
* possible extensions are below.
|
||||
*/
|
||||
|
||||
/* Context for parsing across buffer boundaries */
|
||||
asn_struct_ctx_t _asn_ctx;
|
||||
} AuthenticateClientRequest_t;
|
||||
|
||||
/* Implementation */
|
||||
extern asn_TYPE_descriptor_t asn_DEF_AuthenticateClientRequest;
|
||||
extern asn_SEQUENCE_specifics_t asn_SPC_AuthenticateClientRequest_specs_1;
|
||||
extern asn_TYPE_member_t asn_MBR_AuthenticateClientRequest_1[2];
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _AuthenticateClientRequest_H_ */
|
||||
#include "asn_internal.h"
|
|
@ -1,70 +0,0 @@
|
|||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "RSPDefinitions"
|
||||
* found in "../../../asn1/rsp.asn"
|
||||
* `asn1c -fwide-types -fcompound-names -fincludes-quoted -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "AuthenticateClientResponseEs11.h"
|
||||
|
||||
static asn_oer_constraints_t asn_OER_type_AuthenticateClientResponseEs11_constr_1 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1};
|
||||
asn_per_constraints_t asn_PER_type_AuthenticateClientResponseEs11_constr_1 CC_NOTUSED = {
|
||||
{ APC_CONSTRAINED | APC_EXTENSIBLE, 1, 1, 0, 1 } /* (0..1,...) */,
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
asn_TYPE_member_t asn_MBR_AuthenticateClientResponseEs11_1[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct AuthenticateClientResponseEs11, choice.authenticateClientOk),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_AuthenticateClientOkEs11,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"authenticateClientOk"
|
||||
},
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct AuthenticateClientResponseEs11, choice.authenticateClientError),
|
||||
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_INTEGER,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"authenticateClientError"
|
||||
},
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_AuthenticateClientResponseEs11_tags_1[] = {
|
||||
(ASN_TAG_CLASS_CONTEXT | (64 << 2))
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_AuthenticateClientResponseEs11_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* authenticateClientOk */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* authenticateClientError */
|
||||
};
|
||||
asn_CHOICE_specifics_t asn_SPC_AuthenticateClientResponseEs11_specs_1 = {
|
||||
sizeof(struct AuthenticateClientResponseEs11),
|
||||
offsetof(struct AuthenticateClientResponseEs11, _asn_ctx),
|
||||
offsetof(struct AuthenticateClientResponseEs11, present),
|
||||
sizeof(((struct AuthenticateClientResponseEs11 *)0)->present),
|
||||
asn_MAP_AuthenticateClientResponseEs11_tag2el_1,
|
||||
2, /* Count of tags in the map */
|
||||
0, 0,
|
||||
2 /* Extensions start */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_AuthenticateClientResponseEs11 = {
|
||||
"AuthenticateClientResponseEs11",
|
||||
"AuthenticateClientResponseEs11",
|
||||
&asn_OP_CHOICE,
|
||||
asn_DEF_AuthenticateClientResponseEs11_tags_1,
|
||||
sizeof(asn_DEF_AuthenticateClientResponseEs11_tags_1)
|
||||
/sizeof(asn_DEF_AuthenticateClientResponseEs11_tags_1[0]), /* 1 */
|
||||
asn_DEF_AuthenticateClientResponseEs11_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_AuthenticateClientResponseEs11_tags_1)
|
||||
/sizeof(asn_DEF_AuthenticateClientResponseEs11_tags_1[0]), /* 1 */
|
||||
{ &asn_OER_type_AuthenticateClientResponseEs11_constr_1, &asn_PER_type_AuthenticateClientResponseEs11_constr_1, CHOICE_constraint },
|
||||
asn_MBR_AuthenticateClientResponseEs11_1,
|
||||
2, /* Elements count */
|
||||
&asn_SPC_AuthenticateClientResponseEs11_specs_1 /* Additional specs */
|
||||
};
|
||||
|
|
@ -1,69 +0,0 @@
|
|||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "RSPDefinitions"
|
||||
* found in "../../../asn1/rsp.asn"
|
||||
* `asn1c -fwide-types -fcompound-names -fincludes-quoted -no-gen-example`
|
||||
*/
|
||||
|
||||
#ifndef _AuthenticateClientResponseEs11_H_
|
||||
#define _AuthenticateClientResponseEs11_H_
|
||||
|
||||
|
||||
#include "asn_application.h"
|
||||
|
||||
/* Including external dependencies */
|
||||
#include "AuthenticateClientOkEs11.h"
|
||||
#include "INTEGER.h"
|
||||
#include "constr_CHOICE.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Dependencies */
|
||||
typedef enum AuthenticateClientResponseEs11_PR {
|
||||
AuthenticateClientResponseEs11_PR_NOTHING, /* No components present */
|
||||
AuthenticateClientResponseEs11_PR_authenticateClientOk,
|
||||
AuthenticateClientResponseEs11_PR_authenticateClientError
|
||||
/* Extensions may appear below */
|
||||
|
||||
} AuthenticateClientResponseEs11_PR;
|
||||
typedef enum AuthenticateClientResponseEs11__authenticateClientError {
|
||||
AuthenticateClientResponseEs11__authenticateClientError_eumCertificateInvalid = 1,
|
||||
AuthenticateClientResponseEs11__authenticateClientError_eumCertificateExpired = 2,
|
||||
AuthenticateClientResponseEs11__authenticateClientError_euiccCertificateInvalid = 3,
|
||||
AuthenticateClientResponseEs11__authenticateClientError_euiccCertificateExpired = 4,
|
||||
AuthenticateClientResponseEs11__authenticateClientError_euiccSignatureInvalid = 5,
|
||||
AuthenticateClientResponseEs11__authenticateClientError_eventIdUnknown = 6,
|
||||
AuthenticateClientResponseEs11__authenticateClientError_invalidTransactionId = 7,
|
||||
AuthenticateClientResponseEs11__authenticateClientError_undefinedError = 127
|
||||
} e_AuthenticateClientResponseEs11__authenticateClientError;
|
||||
|
||||
/* AuthenticateClientResponseEs11 */
|
||||
typedef struct AuthenticateClientResponseEs11 {
|
||||
AuthenticateClientResponseEs11_PR present;
|
||||
union AuthenticateClientResponseEs11_u {
|
||||
AuthenticateClientOkEs11_t authenticateClientOk;
|
||||
INTEGER_t authenticateClientError;
|
||||
/*
|
||||
* This type is extensible,
|
||||
* possible extensions are below.
|
||||
*/
|
||||
} choice;
|
||||
|
||||
/* Context for parsing across buffer boundaries */
|
||||
asn_struct_ctx_t _asn_ctx;
|
||||
} AuthenticateClientResponseEs11_t;
|
||||
|
||||
/* Implementation */
|
||||
extern asn_TYPE_descriptor_t asn_DEF_AuthenticateClientResponseEs11;
|
||||
extern asn_CHOICE_specifics_t asn_SPC_AuthenticateClientResponseEs11_specs_1;
|
||||
extern asn_TYPE_member_t asn_MBR_AuthenticateClientResponseEs11_1[2];
|
||||
extern asn_per_constraints_t asn_PER_type_AuthenticateClientResponseEs11_constr_1;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _AuthenticateClientResponseEs11_H_ */
|
||||
#include "asn_internal.h"
|
|
@ -1,70 +0,0 @@
|
|||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "RSPDefinitions"
|
||||
* found in "../../../asn1/rsp.asn"
|
||||
* `asn1c -fwide-types -fcompound-names -fincludes-quoted -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "AuthenticateClientResponseEs9.h"
|
||||
|
||||
static asn_oer_constraints_t asn_OER_type_AuthenticateClientResponseEs9_constr_1 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1};
|
||||
asn_per_constraints_t asn_PER_type_AuthenticateClientResponseEs9_constr_1 CC_NOTUSED = {
|
||||
{ APC_CONSTRAINED | APC_EXTENSIBLE, 1, 1, 0, 1 } /* (0..1,...) */,
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
asn_TYPE_member_t asn_MBR_AuthenticateClientResponseEs9_1[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct AuthenticateClientResponseEs9, choice.authenticateClientOk),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_AuthenticateClientOk,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"authenticateClientOk"
|
||||
},
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct AuthenticateClientResponseEs9, choice.authenticateClientError),
|
||||
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_INTEGER,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"authenticateClientError"
|
||||
},
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_AuthenticateClientResponseEs9_tags_1[] = {
|
||||
(ASN_TAG_CLASS_CONTEXT | (59 << 2))
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_AuthenticateClientResponseEs9_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* authenticateClientOk */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* authenticateClientError */
|
||||
};
|
||||
asn_CHOICE_specifics_t asn_SPC_AuthenticateClientResponseEs9_specs_1 = {
|
||||
sizeof(struct AuthenticateClientResponseEs9),
|
||||
offsetof(struct AuthenticateClientResponseEs9, _asn_ctx),
|
||||
offsetof(struct AuthenticateClientResponseEs9, present),
|
||||
sizeof(((struct AuthenticateClientResponseEs9 *)0)->present),
|
||||
asn_MAP_AuthenticateClientResponseEs9_tag2el_1,
|
||||
2, /* Count of tags in the map */
|
||||
0, 0,
|
||||
2 /* Extensions start */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_AuthenticateClientResponseEs9 = {
|
||||
"AuthenticateClientResponseEs9",
|
||||
"AuthenticateClientResponseEs9",
|
||||
&asn_OP_CHOICE,
|
||||
asn_DEF_AuthenticateClientResponseEs9_tags_1,
|
||||
sizeof(asn_DEF_AuthenticateClientResponseEs9_tags_1)
|
||||
/sizeof(asn_DEF_AuthenticateClientResponseEs9_tags_1[0]), /* 1 */
|
||||
asn_DEF_AuthenticateClientResponseEs9_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_AuthenticateClientResponseEs9_tags_1)
|
||||
/sizeof(asn_DEF_AuthenticateClientResponseEs9_tags_1[0]), /* 1 */
|
||||
{ &asn_OER_type_AuthenticateClientResponseEs9_constr_1, &asn_PER_type_AuthenticateClientResponseEs9_constr_1, CHOICE_constraint },
|
||||
asn_MBR_AuthenticateClientResponseEs9_1,
|
||||
2, /* Elements count */
|
||||
&asn_SPC_AuthenticateClientResponseEs9_specs_1 /* Additional specs */
|
||||
};
|
||||
|
|
@ -1,72 +0,0 @@
|
|||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "RSPDefinitions"
|
||||
* found in "../../../asn1/rsp.asn"
|
||||
* `asn1c -fwide-types -fcompound-names -fincludes-quoted -no-gen-example`
|
||||
*/
|
||||
|
||||
#ifndef _AuthenticateClientResponseEs9_H_
|
||||
#define _AuthenticateClientResponseEs9_H_
|
||||
|
||||
|
||||
#include "asn_application.h"
|
||||
|
||||
/* Including external dependencies */
|
||||
#include "AuthenticateClientOk.h"
|
||||
#include "INTEGER.h"
|
||||
#include "constr_CHOICE.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Dependencies */
|
||||
typedef enum AuthenticateClientResponseEs9_PR {
|
||||
AuthenticateClientResponseEs9_PR_NOTHING, /* No components present */
|
||||
AuthenticateClientResponseEs9_PR_authenticateClientOk,
|
||||
AuthenticateClientResponseEs9_PR_authenticateClientError
|
||||
/* Extensions may appear below */
|
||||
|
||||
} AuthenticateClientResponseEs9_PR;
|
||||
typedef enum AuthenticateClientResponseEs9__authenticateClientError {
|
||||
AuthenticateClientResponseEs9__authenticateClientError_eumCertificateInvalid = 1,
|
||||
AuthenticateClientResponseEs9__authenticateClientError_eumCertificateExpired = 2,
|
||||
AuthenticateClientResponseEs9__authenticateClientError_euiccCertificateInvalid = 3,
|
||||
AuthenticateClientResponseEs9__authenticateClientError_euiccCertificateExpired = 4,
|
||||
AuthenticateClientResponseEs9__authenticateClientError_euiccSignatureInvalid = 5,
|
||||
AuthenticateClientResponseEs9__authenticateClientError_matchingIdRefused = 6,
|
||||
AuthenticateClientResponseEs9__authenticateClientError_eidMismatch = 7,
|
||||
AuthenticateClientResponseEs9__authenticateClientError_noEligibleProfile = 8,
|
||||
AuthenticateClientResponseEs9__authenticateClientError_ciPKUnknown = 9,
|
||||
AuthenticateClientResponseEs9__authenticateClientError_invalidTransactionId = 10,
|
||||
AuthenticateClientResponseEs9__authenticateClientError_undefinedError = 127
|
||||
} e_AuthenticateClientResponseEs9__authenticateClientError;
|
||||
|
||||
/* AuthenticateClientResponseEs9 */
|
||||
typedef struct AuthenticateClientResponseEs9 {
|
||||
AuthenticateClientResponseEs9_PR present;
|
||||
union AuthenticateClientResponseEs9_u {
|
||||
AuthenticateClientOk_t authenticateClientOk;
|
||||
INTEGER_t authenticateClientError;
|
||||
/*
|
||||
* This type is extensible,
|
||||
* possible extensions are below.
|
||||
*/
|
||||
} choice;
|
||||
|
||||
/* Context for parsing across buffer boundaries */
|
||||
asn_struct_ctx_t _asn_ctx;
|
||||
} AuthenticateClientResponseEs9_t;
|
||||
|
||||
/* Implementation */
|
||||
extern asn_TYPE_descriptor_t asn_DEF_AuthenticateClientResponseEs9;
|
||||
extern asn_CHOICE_specifics_t asn_SPC_AuthenticateClientResponseEs9_specs_1;
|
||||
extern asn_TYPE_member_t asn_MBR_AuthenticateClientResponseEs9_1[2];
|
||||
extern asn_per_constraints_t asn_PER_type_AuthenticateClientResponseEs9_constr_1;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _AuthenticateClientResponseEs9_H_ */
|
||||
#include "asn_internal.h"
|
|
@ -1,31 +0,0 @@
|
|||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "RSPDefinitions"
|
||||
* found in "../../../asn1/rsp.asn"
|
||||
* `asn1c -fwide-types -fcompound-names -fincludes-quoted -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "AuthenticateErrorCode.h"
|
||||
|
||||
/*
|
||||
* This type is implemented using INTEGER,
|
||||
* so here we adjust the DEF accordingly.
|
||||
*/
|
||||
static const ber_tlv_tag_t asn_DEF_AuthenticateErrorCode_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_AuthenticateErrorCode = {
|
||||
"AuthenticateErrorCode",
|
||||
"AuthenticateErrorCode",
|
||||
&asn_OP_INTEGER,
|
||||
asn_DEF_AuthenticateErrorCode_tags_1,
|
||||
sizeof(asn_DEF_AuthenticateErrorCode_tags_1)
|
||||
/sizeof(asn_DEF_AuthenticateErrorCode_tags_1[0]), /* 1 */
|
||||
asn_DEF_AuthenticateErrorCode_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_AuthenticateErrorCode_tags_1)
|
||||
/sizeof(asn_DEF_AuthenticateErrorCode_tags_1[0]), /* 1 */
|
||||
{ 0, 0, INTEGER_constraint },
|
||||
0, 0, /* Defined elsewhere */
|
||||
0 /* No specifics */
|
||||
};
|
||||
|
|
@ -1,55 +0,0 @@
|
|||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "RSPDefinitions"
|
||||
* found in "../../../asn1/rsp.asn"
|
||||
* `asn1c -fwide-types -fcompound-names -fincludes-quoted -no-gen-example`
|
||||
*/
|
||||
|
||||
#ifndef _AuthenticateErrorCode_H_
|
||||
#define _AuthenticateErrorCode_H_
|
||||
|
||||
|
||||
#include "asn_application.h"
|
||||
|
||||
/* Including external dependencies */
|
||||
#include "INTEGER.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Dependencies */
|
||||
typedef enum AuthenticateErrorCode {
|
||||
AuthenticateErrorCode_invalidCertificate = 1,
|
||||
AuthenticateErrorCode_invalidSignature = 2,
|
||||
AuthenticateErrorCode_unsupportedCurve = 3,
|
||||
AuthenticateErrorCode_noSessionContext = 4,
|
||||
AuthenticateErrorCode_invalidOid = 5,
|
||||
AuthenticateErrorCode_euiccChallengeMismatch = 6,
|
||||
AuthenticateErrorCode_ciPKUnknown = 7,
|
||||
AuthenticateErrorCode_undefinedError = 127
|
||||
} e_AuthenticateErrorCode;
|
||||
|
||||
/* AuthenticateErrorCode */
|
||||
typedef INTEGER_t AuthenticateErrorCode_t;
|
||||
|
||||
/* Implementation */
|
||||
extern asn_TYPE_descriptor_t asn_DEF_AuthenticateErrorCode;
|
||||
asn_struct_free_f AuthenticateErrorCode_free;
|
||||
asn_struct_print_f AuthenticateErrorCode_print;
|
||||
asn_constr_check_f AuthenticateErrorCode_constraint;
|
||||
ber_type_decoder_f AuthenticateErrorCode_decode_ber;
|
||||
der_type_encoder_f AuthenticateErrorCode_encode_der;
|
||||
xer_type_decoder_f AuthenticateErrorCode_decode_xer;
|
||||
xer_type_encoder_f AuthenticateErrorCode_encode_xer;
|
||||
oer_type_decoder_f AuthenticateErrorCode_decode_oer;
|
||||
oer_type_encoder_f AuthenticateErrorCode_encode_oer;
|
||||
per_type_decoder_f AuthenticateErrorCode_decode_uper;
|
||||
per_type_encoder_f AuthenticateErrorCode_encode_uper;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _AuthenticateErrorCode_H_ */
|
||||
#include "asn_internal.h"
|
|
@ -1,60 +0,0 @@
|
|||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "RSPDefinitions"
|
||||
* found in "../../../asn1/rsp.asn"
|
||||
* `asn1c -fwide-types -fcompound-names -fincludes-quoted -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "AuthenticateResponseError.h"
|
||||
|
||||
asn_TYPE_member_t asn_MBR_AuthenticateResponseError_1[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct AuthenticateResponseError, transactionId),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_TransactionId,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"transactionId"
|
||||
},
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct AuthenticateResponseError, authenticateErrorCode),
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (2 << 2)),
|
||||
0,
|
||||
&asn_DEF_AuthenticateErrorCode,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"authenticateErrorCode"
|
||||
},
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_AuthenticateResponseError_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_AuthenticateResponseError_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 1, 0, 0 }, /* authenticateErrorCode */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 } /* transactionId */
|
||||
};
|
||||
asn_SEQUENCE_specifics_t asn_SPC_AuthenticateResponseError_specs_1 = {
|
||||
sizeof(struct AuthenticateResponseError),
|
||||
offsetof(struct AuthenticateResponseError, _asn_ctx),
|
||||
asn_MAP_AuthenticateResponseError_tag2el_1,
|
||||
2, /* Count of tags in the map */
|
||||
0, 0, 0, /* Optional elements (not needed) */
|
||||
2, /* First extension addition */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_AuthenticateResponseError = {
|
||||
"AuthenticateResponseError",
|
||||
"AuthenticateResponseError",
|
||||
&asn_OP_SEQUENCE,
|
||||
asn_DEF_AuthenticateResponseError_tags_1,
|
||||
sizeof(asn_DEF_AuthenticateResponseError_tags_1)
|
||||
/sizeof(asn_DEF_AuthenticateResponseError_tags_1[0]), /* 1 */
|
||||
asn_DEF_AuthenticateResponseError_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_AuthenticateResponseError_tags_1)
|
||||
/sizeof(asn_DEF_AuthenticateResponseError_tags_1[0]), /* 1 */
|
||||
{ 0, 0, SEQUENCE_constraint },
|
||||
asn_MBR_AuthenticateResponseError_1,
|
||||
2, /* Elements count */
|
||||
&asn_SPC_AuthenticateResponseError_specs_1 /* Additional specs */
|
||||
};
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "RSPDefinitions"
|
||||
* found in "../../../asn1/rsp.asn"
|
||||
* `asn1c -fwide-types -fcompound-names -fincludes-quoted -no-gen-example`
|
||||
*/
|
||||
|
||||
#ifndef _AuthenticateResponseError_H_
|
||||
#define _AuthenticateResponseError_H_
|
||||
|
||||
|
||||
#include "asn_application.h"
|
||||
|
||||
/* Including external dependencies */
|
||||
#include "TransactionId.h"
|
||||
#include "AuthenticateErrorCode.h"
|
||||
#include "constr_SEQUENCE.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* AuthenticateResponseError */
|
||||
typedef struct AuthenticateResponseError {
|
||||
TransactionId_t transactionId;
|
||||
AuthenticateErrorCode_t authenticateErrorCode;
|
||||
/*
|
||||
* This type is extensible,
|
||||
* possible extensions are below.
|
||||
*/
|
||||
|
||||
/* Context for parsing across buffer boundaries */
|
||||
asn_struct_ctx_t _asn_ctx;
|
||||
} AuthenticateResponseError_t;
|
||||
|
||||
/* Implementation */
|
||||
extern asn_TYPE_descriptor_t asn_DEF_AuthenticateResponseError;
|
||||
extern asn_SEQUENCE_specifics_t asn_SPC_AuthenticateResponseError_specs_1;
|
||||
extern asn_TYPE_member_t asn_MBR_AuthenticateResponseError_1[2];
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _AuthenticateResponseError_H_ */
|
||||
#include "asn_internal.h"
|
|
@ -1,80 +0,0 @@
|
|||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "RSPDefinitions"
|
||||
* found in "../../../asn1/rsp.asn"
|
||||
* `asn1c -fwide-types -fcompound-names -fincludes-quoted -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "AuthenticateResponseOk.h"
|
||||
|
||||
asn_TYPE_member_t asn_MBR_AuthenticateResponseOk_1[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct AuthenticateResponseOk, euiccSigned1),
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2)),
|
||||
0,
|
||||
&asn_DEF_EuiccSigned1,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"euiccSigned1"
|
||||
},
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct AuthenticateResponseOk, euiccSignature1),
|
||||
(ASN_TAG_CLASS_APPLICATION | (55 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_OCTET_STRING,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"euiccSignature1"
|
||||
},
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct AuthenticateResponseOk, euiccCertificate),
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2)),
|
||||
0,
|
||||
&asn_DEF_Certificate,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"euiccCertificate"
|
||||
},
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct AuthenticateResponseOk, eumCertificate),
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2)),
|
||||
0,
|
||||
&asn_DEF_Certificate,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"eumCertificate"
|
||||
},
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_AuthenticateResponseOk_tags_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_AuthenticateResponseOk_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, 0, 2 }, /* euiccSigned1 */
|
||||
{ (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 2, -1, 1 }, /* euiccCertificate */
|
||||
{ (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 3, -2, 0 }, /* eumCertificate */
|
||||
{ (ASN_TAG_CLASS_APPLICATION | (55 << 2)), 1, 0, 0 } /* euiccSignature1 */
|
||||
};
|
||||
asn_SEQUENCE_specifics_t asn_SPC_AuthenticateResponseOk_specs_1 = {
|
||||
sizeof(struct AuthenticateResponseOk),
|
||||
offsetof(struct AuthenticateResponseOk, _asn_ctx),
|
||||
asn_MAP_AuthenticateResponseOk_tag2el_1,
|
||||
4, /* Count of tags in the map */
|
||||
0, 0, 0, /* Optional elements (not needed) */
|
||||
4, /* First extension addition */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_AuthenticateResponseOk = {
|
||||
"AuthenticateResponseOk",
|
||||
"AuthenticateResponseOk",
|
||||
&asn_OP_SEQUENCE,
|
||||
asn_DEF_AuthenticateResponseOk_tags_1,
|
||||
sizeof(asn_DEF_AuthenticateResponseOk_tags_1)
|
||||
/sizeof(asn_DEF_AuthenticateResponseOk_tags_1[0]), /* 1 */
|
||||
asn_DEF_AuthenticateResponseOk_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_AuthenticateResponseOk_tags_1)
|
||||
/sizeof(asn_DEF_AuthenticateResponseOk_tags_1[0]), /* 1 */
|
||||
{ 0, 0, SEQUENCE_constraint },
|
||||
asn_MBR_AuthenticateResponseOk_1,
|
||||
4, /* Elements count */
|
||||
&asn_SPC_AuthenticateResponseOk_specs_1 /* Additional specs */
|
||||
};
|
||||
|
|
@ -1,49 +0,0 @@
|
|||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "RSPDefinitions"
|
||||
* found in "../../../asn1/rsp.asn"
|
||||
* `asn1c -fwide-types -fcompound-names -fincludes-quoted -no-gen-example`
|
||||
*/
|
||||
|
||||
#ifndef _AuthenticateResponseOk_H_
|
||||
#define _AuthenticateResponseOk_H_
|
||||
|
||||
|
||||
#include "asn_application.h"
|
||||
|
||||
/* Including external dependencies */
|
||||
#include "EuiccSigned1.h"
|
||||
#include "OCTET_STRING.h"
|
||||
#include "Certificate.h"
|
||||
#include "constr_SEQUENCE.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* AuthenticateResponseOk */
|
||||
typedef struct AuthenticateResponseOk {
|
||||
EuiccSigned1_t euiccSigned1;
|
||||
OCTET_STRING_t euiccSignature1;
|
||||
Certificate_t euiccCertificate;
|
||||
Certificate_t eumCertificate;
|
||||
/*
|
||||
* This type is extensible,
|
||||
* possible extensions are below.
|
||||
*/
|
||||
|
||||
/* Context for parsing across buffer boundaries */
|
||||
asn_struct_ctx_t _asn_ctx;
|
||||
} AuthenticateResponseOk_t;
|
||||
|
||||
/* Implementation */
|
||||
extern asn_TYPE_descriptor_t asn_DEF_AuthenticateResponseOk;
|
||||
extern asn_SEQUENCE_specifics_t asn_SPC_AuthenticateResponseOk_specs_1;
|
||||
extern asn_TYPE_member_t asn_MBR_AuthenticateResponseOk_1[4];
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _AuthenticateResponseOk_H_ */
|
||||
#include "asn_internal.h"
|
|
@ -1,91 +0,0 @@
|
|||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "RSPDefinitions"
|
||||
* found in "../../../asn1/rsp.asn"
|
||||
* `asn1c -fwide-types -fcompound-names -fincludes-quoted -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "AuthenticateServerRequest.h"
|
||||
|
||||
static asn_TYPE_member_t asn_MBR_AuthenticateServerRequest_1[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct AuthenticateServerRequest, serverSigned1),
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2)),
|
||||
0,
|
||||
&asn_DEF_ServerSigned1,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"serverSigned1"
|
||||
},
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct AuthenticateServerRequest, serverSignature1),
|
||||
(ASN_TAG_CLASS_APPLICATION | (55 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_OCTET_STRING,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"serverSignature1"
|
||||
},
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct AuthenticateServerRequest, euiccCiPKIdToBeUsed),
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (4 << 2)),
|
||||
0,
|
||||
&asn_DEF_SubjectKeyIdentifier,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"euiccCiPKIdToBeUsed"
|
||||
},
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct AuthenticateServerRequest, serverCertificate),
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2)),
|
||||
0,
|
||||
&asn_DEF_Certificate,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"serverCertificate"
|
||||
},
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct AuthenticateServerRequest, ctxParams1),
|
||||
-1 /* Ambiguous tag (CHOICE?) */,
|
||||
0,
|
||||
&asn_DEF_CtxParams1,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"ctxParams1"
|
||||
},
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_AuthenticateServerRequest_tags_1[] = {
|
||||
(ASN_TAG_CLASS_CONTEXT | (56 << 2)),
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_AuthenticateServerRequest_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)), 2, 0, 0 }, /* euiccCiPKIdToBeUsed */
|
||||
{ (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 0, 0, 1 }, /* serverSigned1 */
|
||||
{ (ASN_TAG_CLASS_UNIVERSAL | (16 << 2)), 3, -1, 0 }, /* serverCertificate */
|
||||
{ (ASN_TAG_CLASS_APPLICATION | (55 << 2)), 1, 0, 0 }, /* serverSignature1 */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 4, 0, 0 } /* ctxParamsForCommonAuthentication */
|
||||
};
|
||||
static asn_SEQUENCE_specifics_t asn_SPC_AuthenticateServerRequest_specs_1 = {
|
||||
sizeof(struct AuthenticateServerRequest),
|
||||
offsetof(struct AuthenticateServerRequest, _asn_ctx),
|
||||
asn_MAP_AuthenticateServerRequest_tag2el_1,
|
||||
5, /* Count of tags in the map */
|
||||
0, 0, 0, /* Optional elements (not needed) */
|
||||
5, /* First extension addition */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_AuthenticateServerRequest = {
|
||||
"AuthenticateServerRequest",
|
||||
"AuthenticateServerRequest",
|
||||
&asn_OP_SEQUENCE,
|
||||
asn_DEF_AuthenticateServerRequest_tags_1,
|
||||
sizeof(asn_DEF_AuthenticateServerRequest_tags_1)
|
||||
/sizeof(asn_DEF_AuthenticateServerRequest_tags_1[0]) - 1, /* 1 */
|
||||
asn_DEF_AuthenticateServerRequest_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_AuthenticateServerRequest_tags_1)
|
||||
/sizeof(asn_DEF_AuthenticateServerRequest_tags_1[0]), /* 2 */
|
||||
{ 0, 0, SEQUENCE_constraint },
|
||||
asn_MBR_AuthenticateServerRequest_1,
|
||||
5, /* Elements count */
|
||||
&asn_SPC_AuthenticateServerRequest_specs_1 /* Additional specs */
|
||||
};
|
||||
|
|
@ -1,50 +0,0 @@
|
|||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "RSPDefinitions"
|
||||
* found in "../../../asn1/rsp.asn"
|
||||
* `asn1c -fwide-types -fcompound-names -fincludes-quoted -no-gen-example`
|
||||
*/
|
||||
|
||||
#ifndef _AuthenticateServerRequest_H_
|
||||
#define _AuthenticateServerRequest_H_
|
||||
|
||||
|
||||
#include "asn_application.h"
|
||||
|
||||
/* Including external dependencies */
|
||||
#include "ServerSigned1.h"
|
||||
#include "OCTET_STRING.h"
|
||||
#include "SubjectKeyIdentifier.h"
|
||||
#include "Certificate.h"
|
||||
#include "CtxParams1.h"
|
||||
#include "constr_SEQUENCE.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* AuthenticateServerRequest */
|
||||
typedef struct AuthenticateServerRequest {
|
||||
ServerSigned1_t serverSigned1;
|
||||
OCTET_STRING_t serverSignature1;
|
||||
SubjectKeyIdentifier_t euiccCiPKIdToBeUsed;
|
||||
Certificate_t serverCertificate;
|
||||
CtxParams1_t ctxParams1;
|
||||
/*
|
||||
* This type is extensible,
|
||||
* possible extensions are below.
|
||||
*/
|
||||
|
||||
/* Context for parsing across buffer boundaries */
|
||||
asn_struct_ctx_t _asn_ctx;
|
||||
} AuthenticateServerRequest_t;
|
||||
|
||||
/* Implementation */
|
||||
extern asn_TYPE_descriptor_t asn_DEF_AuthenticateServerRequest;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _AuthenticateServerRequest_H_ */
|
||||
#include "asn_internal.h"
|
|
@ -1,70 +0,0 @@
|
|||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "RSPDefinitions"
|
||||
* found in "../../../asn1/rsp.asn"
|
||||
* `asn1c -fwide-types -fcompound-names -fincludes-quoted -no-gen-example`
|
||||
*/
|
||||
|
||||
#include "AuthenticateServerResponse.h"
|
||||
|
||||
static asn_oer_constraints_t asn_OER_type_AuthenticateServerResponse_constr_1 CC_NOTUSED = {
|
||||
{ 0, 0 },
|
||||
-1};
|
||||
asn_per_constraints_t asn_PER_type_AuthenticateServerResponse_constr_1 CC_NOTUSED = {
|
||||
{ APC_CONSTRAINED | APC_EXTENSIBLE, 1, 1, 0, 1 } /* (0..1,...) */,
|
||||
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
|
||||
0, 0 /* No PER value map */
|
||||
};
|
||||
asn_TYPE_member_t asn_MBR_AuthenticateServerResponse_1[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct AuthenticateServerResponse, choice.authenticateResponseOk),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_AuthenticateResponseOk,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"authenticateResponseOk"
|
||||
},
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct AuthenticateServerResponse, choice.authenticateResponseError),
|
||||
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
|
||||
-1, /* IMPLICIT tag at current level */
|
||||
&asn_DEF_AuthenticateResponseError,
|
||||
0,
|
||||
{ 0, 0, 0 },
|
||||
0, 0, /* No default value */
|
||||
"authenticateResponseError"
|
||||
},
|
||||
};
|
||||
static const ber_tlv_tag_t asn_DEF_AuthenticateServerResponse_tags_1[] = {
|
||||
(ASN_TAG_CLASS_CONTEXT | (56 << 2))
|
||||
};
|
||||
static const asn_TYPE_tag2member_t asn_MAP_AuthenticateServerResponse_tag2el_1[] = {
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* authenticateResponseOk */
|
||||
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* authenticateResponseError */
|
||||
};
|
||||
asn_CHOICE_specifics_t asn_SPC_AuthenticateServerResponse_specs_1 = {
|
||||
sizeof(struct AuthenticateServerResponse),
|
||||
offsetof(struct AuthenticateServerResponse, _asn_ctx),
|
||||
offsetof(struct AuthenticateServerResponse, present),
|
||||
sizeof(((struct AuthenticateServerResponse *)0)->present),
|
||||
asn_MAP_AuthenticateServerResponse_tag2el_1,
|
||||
2, /* Count of tags in the map */
|
||||
0, 0,
|
||||
2 /* Extensions start */
|
||||
};
|
||||
asn_TYPE_descriptor_t asn_DEF_AuthenticateServerResponse = {
|
||||
"AuthenticateServerResponse",
|
||||
"AuthenticateServerResponse",
|
||||
&asn_OP_CHOICE,
|
||||
asn_DEF_AuthenticateServerResponse_tags_1,
|
||||
sizeof(asn_DEF_AuthenticateServerResponse_tags_1)
|
||||
/sizeof(asn_DEF_AuthenticateServerResponse_tags_1[0]), /* 1 */
|
||||
asn_DEF_AuthenticateServerResponse_tags_1, /* Same as above */
|
||||
sizeof(asn_DEF_AuthenticateServerResponse_tags_1)
|
||||
/sizeof(asn_DEF_AuthenticateServerResponse_tags_1[0]), /* 1 */
|
||||
{ &asn_OER_type_AuthenticateServerResponse_constr_1, &asn_PER_type_AuthenticateServerResponse_constr_1, CHOICE_constraint },
|
||||
asn_MBR_AuthenticateServerResponse_1,
|
||||
2, /* Elements count */
|
||||
&asn_SPC_AuthenticateServerResponse_specs_1 /* Additional specs */
|
||||
};
|
||||
|
|
@ -1,59 +0,0 @@
|
|||
/*
|
||||
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
|
||||
* From ASN.1 module "RSPDefinitions"
|
||||
* found in "../../../asn1/rsp.asn"
|
||||
* `asn1c -fwide-types -fcompound-names -fincludes-quoted -no-gen-example`
|
||||
*/
|
||||
|
||||
#ifndef _AuthenticateServerResponse_H_
|
||||
#define _AuthenticateServerResponse_H_
|
||||
|
||||
|
||||
#include "asn_application.h"
|
||||
|
||||
/* Including external dependencies */
|
||||
#include "AuthenticateResponseOk.h"
|
||||
#include "AuthenticateResponseError.h"
|
||||
#include "constr_CHOICE.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Dependencies */
|
||||
typedef enum AuthenticateServerResponse_PR {
|
||||
AuthenticateServerResponse_PR_NOTHING, /* No components present */
|
||||
AuthenticateServerResponse_PR_authenticateResponseOk,
|
||||
AuthenticateServerResponse_PR_authenticateResponseError
|
||||
/* Extensions may appear below */
|
||||
|
||||
} AuthenticateServerResponse_PR;
|
||||
|
||||
/* AuthenticateServerResponse */
|
||||
typedef struct AuthenticateServerResponse {
|
||||
AuthenticateServerResponse_PR present;
|
||||
union AuthenticateServerResponse_u {
|
||||
AuthenticateResponseOk_t authenticateResponseOk;
|
||||
AuthenticateResponseError_t authenticateResponseError;
|
||||
/*
|
||||
* This type is extensible,
|
||||
* possible extensions are below.
|
||||
*/
|
||||
} choice;
|
||||
|
||||
/* Context for parsing across buffer boundaries */
|
||||
asn_struct_ctx_t _asn_ctx;
|
||||
} AuthenticateServerResponse_t;
|
||||
|
||||
/* Implementation */
|
||||
extern asn_TYPE_descriptor_t asn_DEF_AuthenticateServerResponse;
|
||||
extern asn_CHOICE_specifics_t asn_SPC_AuthenticateServerResponse_specs_1;
|
||||
extern asn_TYPE_member_t asn_MBR_AuthenticateServerResponse_1[2];
|
||||
extern asn_per_constraints_t asn_PER_type_AuthenticateServerResponse_constr_1;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _AuthenticateServerResponse_H_ */
|
||||
#include "asn_internal.h"
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue