# BioShare: An Open Framework for Trusted Biometric Authentication under User Control
## 4 Sample Implementation
### Enclave Module (EM)  
The BioShare Enclave Module is implemented as trusted code that runs in the Intel SGX enclave on the server side. On other TEEs such as ARM TrustZone and RISC-V keystone, we have to develop new code due to incompatibilities between them. In order to achieve the goal \"develop once and deploy anywhere\", we use Microsoft Open Enclave SDK [46] to resolve compatibility issues between different TEEs, and other opensource projects including Google Asylo [47] and Huawei secGear [48] etc., provide similar functionality.  
\begin{table}
\begin{tabular}{l c c c c c c} \hline \hline \multirow{2}{*}{**Open-Source Project**} & \multicolumn{2}{c}{**Functionality**} & \multicolumn{2}{c}{**Hardware support**} & \multirow{2}{*}{**Language**} & \multirow{2}{*}{**License**} \\ \cline{2-2} \cline{6-7}  & **Recognition** & & & & & \\ \hline
**SeetaFace Engine** & Yes & Yes & Yes & Yes & C++ & BSD \\ \hline
**SeetaFace Engine2** & Yes & Yes & Yes & Yes & C++ & BSD \\ \hline
**SeetaFace2** & Yes & Yes & Yes & Yes & C++ & BSD \\ \hline
**FaceBoxes** & No & No & Yes & Yes & C++ & BSD \\ \hline
**libfacetedection** & No & No & Yes & Yes & C & BSD \\ \hline
**OpenCV 4** & Yes & Yes & Yes & No & C++ & BSD \\ \hline
**RetinaFace** & Yes & Yes & Yes & No & Python & MIT \\ \hline
**deepinsight/insightface** & Yes & Yes & Yes & No & Python & MIT \\ \hline \hline \end{tabular}
\end{table}
Table 4: Typical Opensource Projects for Facial Recognition.  
Figure 2: The flow chart of face recognition.  
\begin{table}
\begin{tabular}{l c c c c} \hline \hline
**Model** & **ACER** & **TPR@FPR = 1\%** & **TPR@FPR = 0.1\%** & **FLOPS** \\ \hline FishNet150 & 0.00144 & 0.999668 & 0.998330 & 6452.72M \\ \hline FishNet150 & 0.00181 & 1.0 & 0.9996 & 6452.72M \\ \hline FishNet150 & 0.00496 & 0.998664 & 0.990648 & 6452.72M \\ \hline MobileNet v2 & 0.00228 & 0.9996 & 0.9993 & 306.17M \\ \hline MobileNet v2 & 0.00387 & 0.999433 & 0.997662 & 306.17M \\ \hline MobileNet v2 & 0.00402 & 0.9996 & 0.992623 & 306.17M \\ \hline MobileLiteNet54 & 0.00242 & 1.0 & 0.99846 & 220.91M \\ \hline MobileLiteNet54+-e & 0.00242 & 1.0 & 0.996994 & 220.91M \\ \hline FeatherNetA & 0.00261 & 1.00 & 0.961590 & 79.99M \\ \hline FeatherNetB & 0.00168 & 1.0 & 0.997662 & 83.05M \\ \hline
**Ensembled all** & **0** & **1** & **1** & **-** \\ \hline \hline \end{tabular}
\end{table}
Table 5: Test Results of Liveness Detection Models.  
We have developed invocation interfaces to authenticate both facial image data and facial feature data, and experimenters can specify either raw data or feature data in service requests from network applications. We use the open-source code SeetaFace2 to conduct facial recognition and comparison. If the input is facial feature data, the service request will be processed with high performance due to the low computing overhead of the feature comparison algorithm, but this is achieved with low compatibility because the input feature data must be extracted with the same algorithm as that of the Enclave Module. If the input is facial image data, the service request will be processed with higher computing costs but with better compatibility. The experimental results are described in Section 5.2.