mirror of
https://github.com/estkme-group/lpac
synced 2025-06-29 16:22:57 +02:00
Compare commits
258 commits
v0.0.3-alp
...
main
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 | ||
|
cbe5b18ff4 | ||
|
912334ae82 | ||
|
193382201b | ||
|
1db35a7ce7 | ||
|
6e6d5228a5 | ||
|
d993bccf6f | ||
|
9b32fb266e | ||
|
38fc54aa8a | ||
|
3c881eef7e | ||
|
ff6c5f3543 | ||
|
58faf61a52 | ||
|
8dcc3cda31 | ||
|
2dd4a00d69 | ||
|
2696f3e9f3 | ||
|
dee7542145 | ||
|
228fc5d56d | ||
|
003fd33d27 | ||
|
d36479e9b9 | ||
|
76baec728a | ||
|
4fe8cd37e0 | ||
|
4368b8da80 | ||
|
f6defde74a | ||
|
45c530d7af | ||
|
b917f6e57a | ||
|
0767033c71 | ||
|
d0b5d1c3aa | ||
|
29dc4ba9c8 | ||
|
09bbc3ed00 | ||
|
88ed7b2521 | ||
|
c02c2d08ec | ||
9b921430b4 | |||
|
2cd764e57f | ||
|
3755b498ce | ||
|
16c03a2c61 | ||
|
4d811ebbbc | ||
|
743969ab06 | ||
|
9abef2c9dc | ||
29984b3422 | |||
|
4aa1fff0da | ||
|
15bfcbc19f | ||
|
ddde4d006d | ||
|
19cb4fdd2d | ||
|
66267498a1 | ||
|
f28f871b21 | ||
|
ba6d542eca | ||
|
ecfc1e22a4 | ||
|
b4fe4a501c | ||
|
d6565b952d | ||
|
3a958dba4f | ||
|
a69841fe9c | ||
|
b370d0d8d1 | ||
|
dd568c3e0e | ||
|
07ebec684c | ||
|
67b0ab857a | ||
|
760da11b9a | ||
|
66bd3b17cb | ||
|
64b3647997 | ||
|
eedf6c2bac | ||
|
034b8736f2 | ||
|
e7fb4c2e6c | ||
|
24fbcef72b | ||
|
733f5dc433 | ||
|
24132c6918 | ||
|
39d657065a | ||
|
6fd2c9c850 | ||
e31777fd4b | |||
|
e027b1e0ed | ||
|
09ef027a28 | ||
|
75d69130ba | ||
|
c29f1d40f1 | ||
a877988b0f | |||
|
bb7cc6baf3 | ||
|
593cc6be40 | ||
|
0c94aecfa4 | ||
|
03f2fedb43 | ||
|
d61f50faf1 | ||
|
2afae0fbc6 | ||
|
69bdf09a11 |
786 changed files with 10939 additions and 65511 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
|
107
.github/workflows/build.yaml
vendored
107
.github/workflows/build.yaml
vendored
|
@ -1,58 +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: [ubuntu-latest, macos-latest]
|
||||
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
|
||||
uses: actions/checkout@v3
|
||||
- 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 update
|
||||
sudo apt install -y libpcsclite-dev libcurl4-openssl-dev gcc make cmake gcc-mingw-w64 g++-mingw-w64 unzip
|
||||
|
||||
- name: Build for Linux
|
||||
if: runner.os == 'Linux'
|
||||
run: |
|
||||
mkdir build && cd build && cmake .. && make -j$(nproc)
|
||||
chmod +x output/lpac
|
||||
tar -czvf lpac-linux-x86_64.tar.gz -C output .
|
||||
shell: bash
|
||||
- name: Build for ${{ matrix.build.name }}
|
||||
run: ./scripts/build-ci.sh ${{ matrix.build.variant }}
|
||||
|
||||
- name: Build for Windows
|
||||
if: runner.os == 'Linux'
|
||||
run: |
|
||||
mkdir build-mingw && cd build-mingw && cmake -DLINUX_MINGW32=ON .. && make -j$(nproc)
|
||||
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
|
||||
zip -r -j lpac-windows-x86_64.zip output/*
|
||||
- name: Get short SHA
|
||||
run: echo "SHA7=$(echo ${GITHUB_SHA} | cut -c1-7)" >> $GITHUB_ENV
|
||||
|
||||
- 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: Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
- name: Upload ${{ matrix.build.name }} to Artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
files: |
|
||||
build-mingw/lpac-windows-x86_64.zip
|
||||
build/lpac-linux-x86_64.tar.gz
|
||||
build/lpac-macos-universal.zip
|
||||
name: lpac-${{ env.SHA7 }}-${{ matrix.build.artifact }}
|
||||
path: ${{ github.workspace }}/build/*.*
|
||||
|
||||
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:
|
||||
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,36 +1,71 @@
|
|||
option(LINUX_MINGW32 "Build for windows on Linux" OFF)
|
||||
cmake_minimum_required (VERSION 3.15)
|
||||
|
||||
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()
|
||||
|
||||
cmake_minimum_required (VERSION 2.8.12)
|
||||
project (lpac)
|
||||
if(WIN32)
|
||||
add_subdirectory(dlfcn-win32)
|
||||
set(DL_LIBRARY dlfcn-win32)
|
||||
else()
|
||||
set(DL_LIBRARY dl)
|
||||
endif()
|
||||
|
||||
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()
|
||||
|
|
64
README.md
64
README.md
|
@ -1,15 +1,51 @@
|
|||
## Compile for Linux
|
||||
```
|
||||
mkdir build
|
||||
cd build
|
||||
cmake ..
|
||||
make
|
||||
```
|
||||
# lpac
|
||||
|
||||
## Compile for Windows (MINGW32 on Linux)
|
||||
```
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -DLINUX_MINGW32=ON ..
|
||||
make
|
||||
```
|
||||
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 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
|
||||
|
||||
## Usage
|
||||
|
||||
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.
|
||||
|
||||
[latest]: https://github.com/estkme-group/lpac/releases/latest
|
||||
|
||||
## Software Ecosystem
|
||||
|
||||
- [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
|
||||
|
||||
[easylpac]: https://github.com/creamlike1024/EasyLPAC/releases/latest
|
||||
[openeuicc]: https://gitea.angry.im/PeterCxy/OpenEUICC
|
||||
[openeuicc-mirror]: https://github.com/estkme-group/openeuicc
|
||||
|
||||
## Thanks
|
||||
|
||||
[![Contributors][contrib]][contributors]
|
||||
|
||||
[contrib]: https://contrib.rocks/image?repo=estkme-group/lpac
|
||||
[contributors]: https://github.com/estkme-group/lpac/graphs/contributors
|
||||
|
||||
---
|
||||
|
||||
## License
|
||||
|
||||
- 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}/..>)
|
||||
|
|
19
cjson/LICENSE
Normal file
19
cjson/LICENSE
Normal file
|
@ -0,0 +1,19 @@
|
|||
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
|
||||
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.
|
13
cjson/cJSON_ex.c
Normal file
13
cjson/cJSON_ex.c
Normal file
|
@ -0,0 +1,13 @@
|
|||
#include "cJSON_ex.h"
|
||||
|
||||
CJSON_PUBLIC(cJSON *) cJSON_AddStringOrNullToObject(cJSON *const object, const char *const name, const char *const string)
|
||||
{
|
||||
if (string)
|
||||
{
|
||||
return cJSON_AddStringToObject(object, name, string);
|
||||
}
|
||||
else
|
||||
{
|
||||
return cJSON_AddNullToObject(object, name);
|
||||
}
|
||||
}
|
5
cjson/cJSON_ex.h
Normal file
5
cjson/cJSON_ex.h
Normal file
|
@ -0,0 +1,5 @@
|
|||
#pragma once
|
||||
|
||||
#include "cJSON.h"
|
||||
|
||||
CJSON_PUBLIC(cJSON *) cJSON_AddStringOrNullToObject(cJSON *const object, const char *const name, const char *const string);
|
31
cmake/FindPCSCLite.cmake
Normal file
31
cmake/FindPCSCLite.cmake
Normal file
|
@ -0,0 +1,31 @@
|
|||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(PC_PCSCLITE libpcsclite)
|
||||
|
||||
find_path(PCSCLITE_INCLUDE_DIR
|
||||
NAMES winscard.h pcsclite.h wintypes.h debuglog.h ifdhandler.h reader.h
|
||||
HINTS ${PC_PCSCLITE_INCLUDEDIR}
|
||||
${PC_PCSCLITE_INCLUDE_DIRS}
|
||||
${PC_PCSCLITE_INCLUDE_DIRS}/PCSC
|
||||
${CMAKE_INSTALL_PREFIX}/include
|
||||
)
|
||||
find_library(PCSCLITE_LIBRARIES NAMES pcsclite libpcsclite PCSC
|
||||
HINTS ${PC_PCSCLITE_LIBDIR}
|
||||
${PC_PCSCLITE_LIBRARY_DIRS}
|
||||
${CMAKE_INSTALL_PREFIX}/lib
|
||||
${CMAKE_INSTALL_PREFIX}/lib64
|
||||
)
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set PCSCLITE_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(PCSCLite DEFAULT_MSG PCSCLITE_LIBRARIES PCSCLITE_INCLUDE_DIR)
|
||||
|
||||
mark_as_advanced(PCSCLITE_LIBRARIES PCSCLITE_INCLUDE_DIR)
|
||||
|
||||
if(PCSCLITE_FOUND AND NOT TARGET PCSCLite::PCSCLite)
|
||||
add_library(PCSCLite::PCSCLite UNKNOWN IMPORTED)
|
||||
set_target_properties(PCSCLite::PCSCLite PROPERTIES
|
||||
IMPORTED_LOCATION "${PCSCLITE_LIBRARIES}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${PCSCLITE_INCLUDE_DIR}"
|
||||
)
|
||||
endif()
|
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.
|
|
@ -414,8 +414,11 @@ void *dlopen( const char *file, int mode )
|
|||
* LOAD_WITH_ALTERED_SEARCH_PATH is used to make it behave more closely
|
||||
* to UNIX's search paths (start with system folders instead of current
|
||||
* folder).
|
||||
* FIXME: Remove LOAD_WITH_ALTERED_SEARCH_PATH because it lead to Undefined
|
||||
* Behavior and doesn't provide expected search paths.
|
||||
* See also: https://github.com/dlfcn-win32/dlfcn-win32/issues/104
|
||||
*/
|
||||
hModule = LoadLibraryExA( lpFileName, NULL, LOAD_WITH_ALTERED_SEARCH_PATH );
|
||||
hModule = LoadLibraryExA( lpFileName, NULL, 0 );
|
||||
|
||||
if( !hModule )
|
||||
{
|
||||
|
@ -755,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()
|
|
@ -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(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)
|
||||
{
|
||||
uint8_t 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;
|
||||
|
@ -99,7 +44,7 @@ static int at_expect(char **response, const char *expected)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int apdu_interface_connect(void)
|
||||
static int apdu_interface_connect(struct euicc_ctx *ctx)
|
||||
{
|
||||
const char *device;
|
||||
|
||||
|
@ -116,6 +61,7 @@ static int apdu_interface_connect(void)
|
|||
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))
|
||||
|
@ -139,14 +85,14 @@ static int apdu_interface_connect(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void apdu_interface_disconnect(void)
|
||||
static void apdu_interface_disconnect(struct euicc_ctx *ctx)
|
||||
{
|
||||
fclose(fuart);
|
||||
fuart = NULL;
|
||||
logic_channel = 0;
|
||||
}
|
||||
|
||||
static int apdu_interface_transmit(uint8_t **rx, uint32_t *rx_len, const uint8_t *tx, uint32_t tx_len)
|
||||
static int apdu_interface_transmit(struct euicc_ctx *ctx, uint8_t **rx, uint32_t *rx_len, const uint8_t *tx, uint32_t tx_len)
|
||||
{
|
||||
int fret = 0;
|
||||
int ret;
|
||||
|
@ -162,12 +108,12 @@ static int apdu_interface_transmit(uint8_t **rx, uint32_t *rx_len, const uint8_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(uint8_t **rx, uint32_t *rx_len, const uint8_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;
|
||||
|
@ -214,7 +160,7 @@ exit:
|
|||
return fret;
|
||||
}
|
||||
|
||||
static int apdu_interface_logic_channel_open(const uint8_t *aid, uint8_t aid_len)
|
||||
static int apdu_interface_logic_channel_open(struct euicc_ctx *ctx, const uint8_t *aid, uint8_t aid_len)
|
||||
{
|
||||
char *response;
|
||||
|
||||
|
@ -247,7 +193,7 @@ static int apdu_interface_logic_channel_open(const uint8_t *aid, uint8_t aid_len
|
|||
return logic_channel;
|
||||
}
|
||||
|
||||
static void apdu_interface_logic_channel_close(uint8_t channel)
|
||||
static void apdu_interface_logic_channel_close(struct euicc_ctx *ctx, uint8_t channel)
|
||||
{
|
||||
if (!logic_channel)
|
||||
{
|
||||
|
@ -257,7 +203,7 @@ static void apdu_interface_logic_channel_close(uint8_t channel)
|
|||
at_expect(NULL, NULL);
|
||||
}
|
||||
|
||||
int libapduinterface_main(struct euicc_apdu_interface *ifstruct)
|
||||
static int libapduinterface_init(struct euicc_apdu_interface *ifstruct)
|
||||
{
|
||||
memset(ifstruct, 0, sizeof(struct euicc_apdu_interface));
|
||||
|
||||
|
@ -267,5 +213,30 @@ int libapduinterface_main(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;
|
||||
}
|
||||
|
||||
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,17 +1,23 @@
|
|||
#include "pcsc.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef __MINGW32__
|
||||
#ifdef _WIN32
|
||||
#include <winscard.h>
|
||||
#include "pcsc_win32.h"
|
||||
#else
|
||||
#include <PCSC/wintypes.h>
|
||||
#include <PCSC/winscard.h>
|
||||
#endif
|
||||
|
||||
#include <cjson/cJSON_ex.h>
|
||||
#include <euicc/interface.h>
|
||||
|
||||
#define INTERFACE_SELECT_ENV "DRIVER_IFID"
|
||||
|
||||
#define EUICC_INTERFACE_BUFSZ 264
|
||||
|
||||
// #define APDU_ST33_MAGIC "\x90\xBD\x36\xBB\x00"
|
||||
|
@ -24,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;
|
||||
|
@ -36,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;
|
||||
}
|
||||
|
||||
|
@ -49,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);
|
||||
|
@ -62,14 +72,14 @@ 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;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int pcsc_iter_reader(int (*callback)(int index, const char *reader))
|
||||
static int pcsc_iter_reader(int (*callback)(int index, const char *reader, void *userdata), void *userdata)
|
||||
{
|
||||
int ret;
|
||||
LPSTR psReader;
|
||||
|
@ -80,7 +90,7 @@ static int pcsc_iter_reader(int (*callback)(int index, const char *reader))
|
|||
char *p = pcsc_mszReaders + i;
|
||||
if (*p == '\0')
|
||||
{
|
||||
ret = callback(n, psReader);
|
||||
ret = callback(n, psReader, userdata);
|
||||
if (ret < 0)
|
||||
return -1;
|
||||
if (ret > 0)
|
||||
|
@ -96,16 +106,16 @@ static int pcsc_iter_reader(int (*callback)(int index, const char *reader))
|
|||
return -1;
|
||||
}
|
||||
|
||||
static int pcsc_open_hCard_iter(int index, const char *reader)
|
||||
static int pcsc_open_hCard_iter(int index, const char *reader, void *userdata)
|
||||
{
|
||||
int ret;
|
||||
int id;
|
||||
DWORD dwActiveProtocol;
|
||||
|
||||
id = 0;
|
||||
if (getenv("DRIVER_IFID"))
|
||||
if (getenv(INTERFACE_SELECT_ENV))
|
||||
{
|
||||
id = atoi(getenv("DRIVER_IFID"));
|
||||
id = atoi(getenv(INTERFACE_SELECT_ENV));
|
||||
}
|
||||
|
||||
if (id != index)
|
||||
|
@ -116,7 +126,7 @@ static int pcsc_open_hCard_iter(int index, const char *reader)
|
|||
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;
|
||||
}
|
||||
|
||||
|
@ -125,7 +135,7 @@ static int pcsc_open_hCard_iter(int index, const char *reader)
|
|||
|
||||
static int pcsc_open_hCard(void)
|
||||
{
|
||||
return pcsc_iter_reader(pcsc_open_hCard_iter);
|
||||
return pcsc_iter_reader(pcsc_open_hCard_iter, NULL);
|
||||
}
|
||||
|
||||
static void pcsc_close(void)
|
||||
|
@ -154,7 +164,7 @@ static void pcsc_close(void)
|
|||
pcsc_mszReaders = NULL;
|
||||
}
|
||||
|
||||
static int pcsc_transmit_lowlevel(uint8_t *rx, uint32_t *rx_len, const uint8_t *tx, uint32_t tx_len)
|
||||
static int pcsc_transmit_lowlevel(uint8_t *rx, uint32_t *rx_len, const uint8_t *tx, const uint8_t tx_len)
|
||||
{
|
||||
int ret;
|
||||
DWORD rx_len_merged;
|
||||
|
@ -163,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;
|
||||
}
|
||||
|
||||
|
@ -254,16 +264,59 @@ err:
|
|||
return -1;
|
||||
}
|
||||
|
||||
static int apdu_interface_connect(void)
|
||||
static int json_print(cJSON *jpayload)
|
||||
{
|
||||
cJSON *jroot = NULL;
|
||||
char *jstr = NULL;
|
||||
|
||||
if (jpayload == NULL)
|
||||
{
|
||||
goto err;
|
||||
}
|
||||
|
||||
jroot = cJSON_CreateObject();
|
||||
if (jroot == NULL)
|
||||
{
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (cJSON_AddStringOrNullToObject(jroot, "type", "driver") == NULL)
|
||||
{
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (cJSON_AddItemReferenceToObject(jroot, "payload", jpayload) == 0)
|
||||
{
|
||||
goto err;
|
||||
}
|
||||
|
||||
jstr = cJSON_PrintUnformatted(jroot);
|
||||
|
||||
if (jstr == NULL)
|
||||
{
|
||||
goto err;
|
||||
}
|
||||
cJSON_Delete(jroot);
|
||||
|
||||
fprintf(stdout, "%s\n", jstr);
|
||||
fflush(stdout);
|
||||
|
||||
free(jstr);
|
||||
jstr = NULL;
|
||||
|
||||
return 0;
|
||||
|
||||
err:
|
||||
cJSON_Delete(jroot);
|
||||
free(jstr);
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int apdu_interface_connect(struct euicc_ctx *ctx)
|
||||
{
|
||||
uint8_t rx[EUICC_INTERFACE_BUFSZ];
|
||||
uint32_t rx_len;
|
||||
|
||||
if (pcsc_ctx_open() < 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (pcsc_open_hCard() < 0)
|
||||
{
|
||||
return -1;
|
||||
|
@ -275,12 +328,12 @@ static int apdu_interface_connect(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void apdu_interface_disconnect(void)
|
||||
static void apdu_interface_disconnect(struct euicc_ctx *ctx)
|
||||
{
|
||||
pcsc_close();
|
||||
}
|
||||
|
||||
static int apdu_interface_transmit(uint8_t **rx, uint32_t *rx_len, const uint8_t *tx, uint32_t tx_len)
|
||||
static int apdu_interface_transmit(struct euicc_ctx *ctx, uint8_t **rx, uint32_t *rx_len, const uint8_t *tx, uint32_t tx_len)
|
||||
{
|
||||
*rx = malloc(EUICC_INTERFACE_BUFSZ);
|
||||
if (!*rx)
|
||||
|
@ -300,20 +353,57 @@ static int apdu_interface_transmit(uint8_t **rx, uint32_t *rx_len, const uint8_t
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int apdu_interface_logic_channel_open(const uint8_t *aid, uint8_t aid_len)
|
||||
static int apdu_interface_logic_channel_open(struct euicc_ctx *ctx, const uint8_t *aid, uint8_t aid_len)
|
||||
{
|
||||
return pcsc_logic_channel_open(aid, aid_len);
|
||||
}
|
||||
|
||||
static void apdu_interface_logic_channel_close(uint8_t channel)
|
||||
static void apdu_interface_logic_channel_close(struct euicc_ctx *ctx, uint8_t channel)
|
||||
{
|
||||
pcsc_logic_channel_close(channel);
|
||||
}
|
||||
|
||||
int libapduinterface_main(struct euicc_apdu_interface *ifstruct)
|
||||
static int pcsc_list_iter(int index, const char *reader, void *userdata)
|
||||
{
|
||||
cJSON *json = userdata;
|
||||
cJSON *jreader;
|
||||
char index_str[16];
|
||||
|
||||
snprintf(index_str, sizeof(index_str), "%d", index);
|
||||
|
||||
jreader = cJSON_CreateObject();
|
||||
if (!jreader)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!cJSON_AddStringOrNullToObject(jreader, "env", index_str))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!cJSON_AddStringOrNullToObject(jreader, "name", reader))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!cJSON_AddItemToArray(json, jreader))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int libapduinterface_init(struct euicc_apdu_interface *ifstruct)
|
||||
{
|
||||
memset(ifstruct, 0, sizeof(struct euicc_apdu_interface));
|
||||
|
||||
if (pcsc_ctx_open() < 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
ifstruct->connect = apdu_interface_connect;
|
||||
ifstruct->disconnect = apdu_interface_disconnect;
|
||||
ifstruct->logic_channel_open = apdu_interface_logic_channel_open;
|
||||
|
@ -322,3 +412,61 @@ int libapduinterface_main(struct euicc_apdu_interface *ifstruct)
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int libapduinterface_main(int argc, char **argv)
|
||||
{
|
||||
if (argc < 2)
|
||||
{
|
||||
fprintf(stderr, "Usage: %s <list>\n", argv[0]);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (strcmp(argv[1], "list") == 0)
|
||||
{
|
||||
cJSON *payload;
|
||||
cJSON *data;
|
||||
|
||||
payload = cJSON_CreateObject();
|
||||
if (!payload)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!cJSON_AddStringOrNullToObject(payload, "env", INTERFACE_SELECT_ENV))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
data = cJSON_CreateArray();
|
||||
if (!data)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
pcsc_iter_reader(pcsc_list_iter, data);
|
||||
|
||||
if (!cJSON_AddItemToObject(payload, "data", data))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
json_print(payload);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
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;
|
353
driver/apdu/stdio.c
Normal file
353
driver/apdu/stdio.c
Normal file
|
@ -0,0 +1,353 @@
|
|||
#include "stdio.h"
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <cjson/cJSON_ex.h>
|
||||
#include <euicc/interface.h>
|
||||
#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)
|
||||
{
|
||||
uint32_t len = 0;
|
||||
char buffer[2];
|
||||
char *obuf_new = NULL;
|
||||
|
||||
*obuf = malloc(1);
|
||||
if ((*obuf) == NULL)
|
||||
{
|
||||
goto err;
|
||||
}
|
||||
(*obuf)[0] = '\0';
|
||||
|
||||
while (fgets(buffer, sizeof(buffer), fp) != NULL)
|
||||
{
|
||||
uint32_t fgets_len = strlen(buffer);
|
||||
|
||||
len += fgets_len + 1;
|
||||
obuf_new = realloc(*obuf, len);
|
||||
if (obuf_new == NULL)
|
||||
{
|
||||
goto err;
|
||||
}
|
||||
*obuf = obuf_new;
|
||||
strcat(*obuf, buffer);
|
||||
|
||||
if (buffer[fgets_len - 1] == '\n')
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
(*obuf)[strcspn(*obuf, "\n")] = 0;
|
||||
|
||||
return 0;
|
||||
|
||||
err:
|
||||
free(*obuf);
|
||||
*obuf = NULL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int json_print(cJSON *jpayload)
|
||||
{
|
||||
cJSON *jroot = NULL;
|
||||
char *jstr = NULL;
|
||||
|
||||
if (jpayload == NULL)
|
||||
{
|
||||
goto err;
|
||||
}
|
||||
|
||||
jroot = cJSON_CreateObject();
|
||||
if (jroot == NULL)
|
||||
{
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (cJSON_AddStringOrNullToObject(jroot, "type", "apdu") == NULL)
|
||||
{
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (cJSON_AddItemReferenceToObject(jroot, "payload", jpayload) == 0)
|
||||
{
|
||||
goto err;
|
||||
}
|
||||
|
||||
jstr = cJSON_PrintUnformatted(jroot);
|
||||
|
||||
if (jstr == NULL)
|
||||
{
|
||||
goto err;
|
||||
}
|
||||
cJSON_Delete(jroot);
|
||||
|
||||
fprintf(stdout, "%s\n", jstr);
|
||||
fflush(stdout);
|
||||
|
||||
free(jstr);
|
||||
jstr = NULL;
|
||||
|
||||
return 0;
|
||||
|
||||
err:
|
||||
cJSON_Delete(jroot);
|
||||
free(jstr);
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int json_request(const char *func, const uint8_t *param, unsigned param_len)
|
||||
{
|
||||
int fret = 0;
|
||||
char *param_hex = NULL;
|
||||
cJSON *jpayload = NULL;
|
||||
|
||||
if (param && param_len)
|
||||
{
|
||||
param_hex = malloc((2 * param_len) + 1);
|
||||
if (param_hex == NULL)
|
||||
{
|
||||
goto err;
|
||||
}
|
||||
if (euicc_hexutil_bin2hex(param_hex, (2 * param_len) + 1, param, param_len) < 0)
|
||||
{
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
param_hex = NULL;
|
||||
}
|
||||
|
||||
jpayload = cJSON_CreateObject();
|
||||
if (jpayload == NULL)
|
||||
{
|
||||
goto err;
|
||||
}
|
||||
if (cJSON_AddStringOrNullToObject(jpayload, "func", func) == NULL)
|
||||
{
|
||||
goto err;
|
||||
}
|
||||
if (cJSON_AddStringOrNullToObject(jpayload, "param", param_hex) == NULL)
|
||||
{
|
||||
goto err;
|
||||
}
|
||||
free(param_hex);
|
||||
param_hex = NULL;
|
||||
|
||||
fret = json_print(jpayload);
|
||||
cJSON_Delete(jpayload);
|
||||
jpayload = NULL;
|
||||
goto exit;
|
||||
|
||||
err:
|
||||
fret = -1;
|
||||
exit:
|
||||
cJSON_Delete(jpayload);
|
||||
free(param_hex);
|
||||
return fret;
|
||||
}
|
||||
|
||||
static int json_response(int *ecode, uint8_t **data, uint32_t *data_len)
|
||||
{
|
||||
int fret = 0;
|
||||
char *data_json;
|
||||
cJSON *data_jroot;
|
||||
cJSON *data_payload;
|
||||
cJSON *jtmp;
|
||||
|
||||
if (data)
|
||||
{
|
||||
*data = NULL;
|
||||
}
|
||||
|
||||
if (afgets(&data_json, stdin) < 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
data_jroot = cJSON_Parse(data_json);
|
||||
free(data_json);
|
||||
data_json = NULL;
|
||||
if (data_jroot == NULL)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
jtmp = cJSON_GetObjectItem(data_jroot, "type");
|
||||
if (!jtmp)
|
||||
{
|
||||
goto err;
|
||||
}
|
||||
if (!cJSON_IsString(jtmp))
|
||||
{
|
||||
goto err;
|
||||
}
|
||||
if (strcmp("apdu", jtmp->valuestring) != 0)
|
||||
{
|
||||
goto err;
|
||||
}
|
||||
|
||||
data_payload = cJSON_GetObjectItem(data_jroot, "payload");
|
||||
if (!data_payload)
|
||||
{
|
||||
goto err;
|
||||
}
|
||||
if (!cJSON_IsObject(data_payload))
|
||||
{
|
||||
goto err;
|
||||
}
|
||||
|
||||
jtmp = cJSON_GetObjectItem(data_payload, "ecode");
|
||||
if (!jtmp)
|
||||
{
|
||||
goto err;
|
||||
}
|
||||
if (!cJSON_IsNumber(jtmp))
|
||||
{
|
||||
goto err;
|
||||
}
|
||||
*ecode = jtmp->valueint;
|
||||
|
||||
jtmp = cJSON_GetObjectItem(data_payload, "data");
|
||||
if (jtmp && cJSON_IsString(jtmp) && data && data_len)
|
||||
{
|
||||
*data_len = strlen(jtmp->valuestring) / 2;
|
||||
*data = malloc(*data_len);
|
||||
if (!*data)
|
||||
{
|
||||
goto err;
|
||||
}
|
||||
if (euicc_hexutil_hex2bin_r(*data, *data_len, jtmp->valuestring, strlen(jtmp->valuestring)) < 0)
|
||||
{
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
|
||||
fret = 0;
|
||||
goto exit;
|
||||
|
||||
err:
|
||||
fret = -1;
|
||||
free(*data);
|
||||
if (data)
|
||||
{
|
||||
*data = NULL;
|
||||
}
|
||||
if (data_len)
|
||||
{
|
||||
*data_len = 0;
|
||||
}
|
||||
*ecode = -1;
|
||||
exit:
|
||||
free(data_json);
|
||||
cJSON_Delete(data_jroot);
|
||||
return fret;
|
||||
}
|
||||
|
||||
// {"type":"apdu","payload":{"ecode":0}}
|
||||
static int apdu_interface_connect(struct euicc_ctx *ctx)
|
||||
{
|
||||
int ecode;
|
||||
|
||||
if (json_request("connect", NULL, 0))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (json_response(&ecode, NULL, NULL))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return ecode;
|
||||
}
|
||||
|
||||
// {"type":"apdu","payload":{"ecode":0}}
|
||||
static void apdu_interface_disconnect(struct euicc_ctx *ctx)
|
||||
{
|
||||
int ecode;
|
||||
|
||||
json_request("disconnect", NULL, 0);
|
||||
json_response(&ecode, NULL, NULL);
|
||||
}
|
||||
|
||||
// {"type":"apdu","payload":{"ecode":1}}
|
||||
static int apdu_interface_logic_channel_open(struct euicc_ctx *ctx, const uint8_t *aid, uint8_t aid_len)
|
||||
{
|
||||
int ecode;
|
||||
|
||||
if (json_request("logic_channel_open", aid, aid_len))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (json_response(&ecode, NULL, NULL))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return ecode;
|
||||
}
|
||||
|
||||
// {"type":"apdu","payload":{"ecode":0}}
|
||||
static void apdu_interface_logic_channel_close(struct euicc_ctx *ctx, uint8_t channel)
|
||||
{
|
||||
int ecode;
|
||||
|
||||
json_request("logic_channel_close", &channel, sizeof(channel));
|
||||
json_response(&ecode, NULL, NULL);
|
||||
}
|
||||
|
||||
// {"type":"apdu","payload":{"ecode":0,"data":"BF3E125A10890490320010012345000123456789019000"}}
|
||||
// {"type":"apdu","payload":{"ecode":0,"data":"BF3C17811574657374726F6F74736D64732E67736D612E636F6D9000"}}
|
||||
// {"type":"apdu","payload":{"ecode":0,"data":"BF2281C6810302010082030202008303040600840F8101008204000628248304000019228504067F36C08603090200870302030088020490A916041481370F5125D0B1D408D4C3B232E6D25E795BEBFBAA16041481370F5125D0B1D408D4C3B232E6D25E795BEBFB990206C004030000010C0D47492D42412D55502D30343139AC48801F312E322E3834302E313233343536372F6D79506C6174666F726D4C6162656C812568747470733A2F2F6D79636F6D70616E792E636F6D2F6D79444C4F415265676973747261729000"}}
|
||||
static int apdu_interface_transmit(struct euicc_ctx *ctx, uint8_t **rx, uint32_t *rx_len, const uint8_t *tx, uint32_t tx_len)
|
||||
{
|
||||
int ecode;
|
||||
|
||||
if (json_request("transmit", tx, tx_len))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (json_response(&ecode, rx, rx_len))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return ecode;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
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_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,102 +1,19 @@
|
|||
#include "stdio.h"
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <cjson/cJSON.h>
|
||||
|
||||
#include <cjson/cJSON_ex.h>
|
||||
#include <euicc/interface.h>
|
||||
|
||||
static int hexutil_bin2hex(char *output, unsigned output_len, const 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(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;
|
||||
|
||||
|
@ -152,7 +69,7 @@ static int json_print(cJSON *jpayload)
|
|||
goto err;
|
||||
}
|
||||
|
||||
if (cJSON_AddStringToObject(jroot, "type", "http") == NULL)
|
||||
if (cJSON_AddStringOrNullToObject(jroot, "type", "http") == NULL)
|
||||
{
|
||||
goto err;
|
||||
}
|
||||
|
@ -184,18 +101,19 @@ err:
|
|||
return -1;
|
||||
}
|
||||
|
||||
static int json_request(const char *url, const uint8_t *tx, uint32_t tx_len)
|
||||
static int json_request(const char *url, const uint8_t *tx, uint32_t tx_len, const char **headers)
|
||||
{
|
||||
int fret = 0;
|
||||
char *tx_hex = NULL;
|
||||
cJSON *jpayload = NULL;
|
||||
cJSON *jheaders = NULL;
|
||||
|
||||
tx_hex = malloc((2 * tx_len) + 1);
|
||||
if (tx_hex == NULL)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
@ -205,17 +123,33 @@ static int json_request(const char *url, const uint8_t *tx, uint32_t tx_len)
|
|||
{
|
||||
goto err;
|
||||
}
|
||||
if (cJSON_AddStringToObject(jpayload, "url", url) == NULL)
|
||||
if (cJSON_AddStringOrNullToObject(jpayload, "url", url) == NULL)
|
||||
{
|
||||
goto err;
|
||||
}
|
||||
if (cJSON_AddStringToObject(jpayload, "tx", tx_hex) == NULL)
|
||||
if (cJSON_AddStringOrNullToObject(jpayload, "tx", tx_hex) == NULL)
|
||||
{
|
||||
goto err;
|
||||
}
|
||||
free(tx_hex);
|
||||
tx_hex = NULL;
|
||||
|
||||
jheaders = cJSON_AddArrayToObject(jpayload, "headers");
|
||||
if (jheaders == NULL)
|
||||
{
|
||||
goto err;
|
||||
}
|
||||
|
||||
for (int i = 0; headers[i] != NULL; i++)
|
||||
{
|
||||
cJSON *jh = cJSON_CreateString(headers[i]);
|
||||
if (jh == NULL)
|
||||
{
|
||||
goto err;
|
||||
}
|
||||
cJSON_AddItemToArray(jheaders, jh);
|
||||
}
|
||||
|
||||
fret = json_print(jpayload);
|
||||
cJSON_Delete(jpayload);
|
||||
jpayload = NULL;
|
||||
|
@ -230,7 +164,7 @@ exit:
|
|||
}
|
||||
|
||||
// {"type":"http","payload":{"rcode":404,"rx":"333435"}}
|
||||
static int http_interface_transmit(const char *url, uint32_t *rcode, uint8_t **rx, uint32_t *rx_len, const uint8_t *tx, uint32_t tx_len)
|
||||
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 **headers)
|
||||
{
|
||||
int fret = 0;
|
||||
char *rx_json;
|
||||
|
@ -240,7 +174,7 @@ static int http_interface_transmit(const char *url, uint32_t *rcode, uint8_t **r
|
|||
|
||||
*rx = NULL;
|
||||
|
||||
json_request(url, tx, tx_len);
|
||||
json_request(url, tx, tx_len, headers);
|
||||
if (afgets(&rx_json, stdin) < 0)
|
||||
{
|
||||
return -1;
|
||||
|
@ -304,7 +238,7 @@ static int http_interface_transmit(const char *url, uint32_t *rcode, uint8_t **r
|
|||
{
|
||||
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;
|
||||
}
|
||||
|
@ -317,13 +251,14 @@ err:
|
|||
free(*rx);
|
||||
*rx = NULL;
|
||||
*rx_len = 0;
|
||||
*rcode = 500;
|
||||
exit:
|
||||
free(rx_json);
|
||||
cJSON_Delete(rx_jroot);
|
||||
return fret;
|
||||
}
|
||||
|
||||
int libhttpinterface_main(struct euicc_http_interface *ifstruct)
|
||||
static int libhttpinterface_init(struct euicc_http_interface *ifstruct)
|
||||
{
|
||||
memset(ifstruct, 0, sizeof(struct euicc_http_interface));
|
||||
|
||||
|
@ -331,3 +266,20 @@ int libhttpinterface_main(struct euicc_http_interface *ifstruct)
|
|||
|
||||
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_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()
|
||||
|
|
503
euicc/LICENSE
Normal file
503
euicc/LICENSE
Normal file
|
@ -0,0 +1,503 @@
|
|||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
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 this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
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
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser 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 Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "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
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY 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
|
||||
LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey 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 library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
|
|
@ -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"
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue