Cross-platform homomorphic encryption software library architecture, computing device and development method

Through the cross-platform homomorphic encryption software library architecture, a unified API interface and abstraction layer are provided, which solves the adaptation problem between different hardware accelerators, reduces development difficulty and cost, improves development efficiency, and realizes homomorphic encryption calculations. Cross-platform adaptation.

CN118364513BActive Publication Date: 2024-10-01INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202410782969.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-18
Publication Date
2024-10-01
Estimated Expiration
2044-06-18

AI Technical Summary

Technical Problem

The existing homomorphic encryption calculations are difficult to adapt across platforms between different hardware accelerators, resulting in increased development costs and difficulty. Especially for developers in non-cryptography fields, they need to re-develop and adapt new ones. Hardware accelerator API, leading to inefficiency.

Method used

A cross-platform homomorphic encryption software library architecture is proposed, including a program interface layer, a platform function abstraction layer and a specific platform function implementation layer. It provides a unified API interface through object-oriented design, shields the specific details of the hardware accelerator, and realizes the control of different hardware Programming framework abstraction and adaptation for accelerators.

Benefits of technology

It realizes the flexible adaptation of homomorphic encryption computing tasks between different hardware accelerators, reduces development difficulty and cost, improves development efficiency, and enables developers to directly switch hardware acceleration platforms without considering the programming framework of the underlying hardware accelerator.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118364513B_ABST
    Figure CN118364513B_ABST
Patent Text Reader

Abstract

The present application relates to the field of encryption computing, and discloses a cross-platform homomorphic encryption software library architecture, computing device and development method. The architecture includes: a program interface layer, a platform function abstraction layer and a specific platform function implementation layer; the platform function abstraction layer is deployed between the program interface layer and the specific platform function implementation layer; the program interface layer is constructed using an object-oriented design method, and is configured to provide multiple API interfaces of homomorphic encryption schemes to the host-side program; the platform function abstraction layer is configured to abstract the programming frameworks of different hardware accelerators and provide the interface of the processing function class to the program interface layer; the specific platform function implementation layer is configured to provide the processing function based on different programming frameworks to the interface of the processing function class based on the homomorphic encryption software library. The use of this software architecture can enable the homomorphic encryption software library to adapt to the host-side program across hardware acceleration platforms, improve the development efficiency of developers, and reduce development costs.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of cryptographic computing, and in particular to a cross-platform homomorphic encryption software library architecture, computing device, and development method. Background Art

[0002] Homomorphic encryption is one of the most popular cutting-edge technologies. It can perform a series of calculations directly on encrypted data without decrypting it. Homomorphic encryption can perform calculations without knowing the original data of the encrypted data. The result of the calculation is decrypted and is the same as the result obtained by directly performing the same calculation on the original data. Given the characteristics of homomorphic encryption, homomorphic encryption technology can be used to solve data privacy issues involved in migrating data-sensitive applications to the cloud. For example, financial data or medical data can be encrypted and handed over to the cloud for homomorphic encryption calculations. Only encrypted data can be seen during the calculation process, and data leakage will not occur.

[0003] Homomorphic encryption calculations are much more complex than calculations on plaintext data. For example, the time required to perform homomorphic multiplication on encrypted data is 10,000 times that of performing multiplication on the original data. At present, in order to improve the computational efficiency of homomorphic encryption, in addition to theoretically exploring faster algorithms, hardware acceleration strategies are also adopted. Hardware acceleration roughly refers to handing over part of the calculation process to hardware acceleration, such as GPU (Graphical Processing Unit), FPGA (Field Programming Gate Array), etc. Different hardware accelerators have their own corresponding homomorphic encryption software libraries, such as the cuFHE software library for GPUs and the hexl-fpga software library for FPGAs.

[0004] However, since the APIs (Application Programming Interfaces) provided by encryption software libraries of different hardware accelerators are quite different, when a new type of hardware accelerator needs to be added, developers need to redevelop the application based on the API of the new hardware accelerator, which increases the development cost. Secondly, for developers in other fields who are not familiar with the field of cryptography, the development difficulty is very high. Therefore, how to enable developers in other fields other than cryptography to conveniently use different hardware acceleration platforms to develop applications based on homomorphic encryption is a problem that needs to be solved. Summary of the invention

[0005] In view of this, the present application aims to propose a cross-platform homomorphic encryption software library architecture, computing device and development method, so as to enable the homomorphic encryption software library to adapt to the host-side program across hardware acceleration platforms, improve the development efficiency of developers and reduce development costs.

[0006] To achieve the above purpose, the technical solution of this application is as follows:

[0007] The first aspect of the embodiment of the present application provides a cross-platform homomorphic encryption software library architecture, including the following network layers: a program interface layer, a platform function abstraction layer and a specific platform function implementation layer; the platform function abstraction layer is deployed between the program interface layer and the specific platform function implementation layer;

[0008] The program interface layer is constructed using an object-oriented design method and is configured to provide a host-side program with an API interface of multiple homomorphic encryption schemes; the host-side program calls processing functions running on different hardware accelerators through the API interface to perform homomorphic encryption calculations;

[0009] The platform function abstraction layer is configured to abstract the programming frameworks of different hardware accelerators and provide an interface of a processing function class to the program interface layer;

[0010] The specific platform function implementation layer is configured to provide processing functions running based on different programming frameworks to the interface of the processing function class based on a homomorphic encryption software library.

[0011] Optionally, the API interface includes at least the following classes:

[0012] Homomorphic encryption scheme class, which is used to describe the name of the calculation process corresponding to the algorithm of the homomorphic encryption scheme, as well as the parameters required by the homomorphic encryption scheme;

[0013] A context class, used to connect the API interface with the hardware acceleration platform according to the name of the hardware acceleration platform and the homomorphic encryption scheme class object;

[0014] A key generation class, used to create a corresponding key generation object according to a context class object; the key generation object is used to generate the key required for the homomorphic encryption scheme;

[0015] Encryption class, used to encrypt plaintext data based on the context class object and the required key;

[0016] The operation class is used to determine the corresponding ciphertext operation method according to the context class object;

[0017] Decryption class, used to decrypt ciphertext data based on the context class object and the required key;

[0018] Plaintext class and ciphertext class are used to describe plaintext data and ciphertext data.

[0019] Optionally, the platform function abstraction layer is configured to include at least the following classes of interfaces:

[0020] The interface of the platform class; the platform class is used to describe the hardware acceleration platform; any platform class includes at least one kernel factory class;

[0021] The interface of the kernel factory class; the kernel factory class is used to describe the kernel factory object; the kernel factory object is used to create a corresponding processing function based on the name of the processing function; any kernel factory class includes at least one processing function class;

[0022] The interface of the processing function class; the processing function class is used to describe the logic of the processing function.

[0023] Optionally, the platform function abstraction layer is configured to provide at least the following two processing function class interfaces:

[0024] Initialization interface, used to initialize the processing function;

[0025] Execution interface, used to execute processing functions.

[0026] Optionally, the specific platform function implementation layer is configured to perform the following steps:

[0027] According to each programming framework, instantiate platform classes and kernel factory classes, and generate platform objects and kernel factory objects;

[0028] The kernel factory object instantiates processing functions adapted to various hardware acceleration platforms according to the names of the processing functions.

[0029] Optionally, the specific platform function implementation layer further includes:

[0030] Platform registration interface, used to register the hardware accelerator platform;

[0031] The kernel factory registration interface is used to register the corresponding kernel factory object with the hardware accelerator platform.

[0032] According to a second aspect of an embodiment of the present application, a homomorphic encryption computing device is provided, including:

[0033] A host-side program is configured to control the execution of a target task with a homomorphic encryption computing task, call an API interface in the cross-platform homomorphic encryption software library architecture provided by the first aspect of the embodiment of the present application, and assign the homomorphic encryption computing task to different hardware acceleration platforms for execution;

[0034] A basic abstract platform library is obtained by compiling the code of the program interface layer and the platform function abstraction layer in the cross-platform homomorphic encryption software library architecture provided by the first aspect of the embodiment of the present application, and includes multiple preset homomorphic encryption schemes; the basic abstract platform library is configured to abstract the programming frameworks of different hardware accelerators and provide an API interface to the host-side program;

[0035] A specific computing platform library set is obtained by compiling the code of the specific platform function implementation layer in the cross-platform homomorphic encryption software library architecture provided by the first aspect of the embodiment of the present application; the specific computing platform library set is configured to provide the basic abstract platform library with a homomorphic encryption software library based on different programming frameworks.

[0036] Optionally, the homomorphic encryption computing device further includes:

[0037] A platform extension module is used to dynamically add an extended hardware acceleration platform; the platform extension module is configured to build a first homomorphic encryption software library to provide the basic abstract platform library with processing functions generated based on an extended programming framework; the first homomorphic encryption software library is placed in the directory of the specific computing platform library collection.

[0038] Optionally, the basic abstract platform library is further configured to perform the following steps:

[0039] When loaded and run, the directory of the specific computing platform library set is provided through the system environment variable;

[0040] Loading the first homomorphic encryption software library in the directory;

[0041] Providing a platform registration interface in the first homomorphic encryption software library for registering an extended hardware acceleration platform;

[0042] A kernel factory registration interface is provided in the first homomorphic encryption software library for registering a kernel factory object with an extended hardware acceleration platform.

[0043] Optionally, the homomorphic encryption computing device further includes:

[0044] A scheme extension module is used to dynamically add an extended homomorphic encryption scheme; the scheme extension module is configured to build a second homomorphic encryption software library to provide the basic abstract platform library with processing functions generated based on the extended homomorphic encryption scheme; the second homomorphic encryption software library is placed in the directory of the specific computing platform library collection.

[0045] Optionally, the basic abstract platform library is further configured to perform the following steps:

[0046] When loaded and run, the directory of the specific computing platform library set is provided through the system environment variable;

[0047] Loading the second homomorphic encryption software library in the directory;

[0048] A kernel factory registration interface is provided in the second homomorphic encryption software library for registering an extended kernel factory object with a registered hardware acceleration platform.

[0049] According to a third aspect of an embodiment of the present application, a method for developing a homomorphic encryption computing device is provided. The method is used to construct the homomorphic encryption computing device provided in the second aspect of the embodiment of the present application, including:

[0050] Create a host-side program code, specify the target homomorphic encryption scheme and the target hardware acceleration platform to be used; the host-side program is used to call the corresponding API interface according to the target homomorphic encryption scheme to control the execution of homomorphic encryption computing tasks;

[0051] Based on the target homomorphic encryption scheme, create the code of the program interface layer and the code of the platform function abstraction layer, and compile and generate a basic abstract platform library for providing an API interface of the homomorphic encryption scheme to the host-side program; the host-side program calls the processing functions running on different hardware accelerators through the API interface;

[0052] Based on the target hardware acceleration platform and the corresponding homomorphic encryption software library, the code of the specific platform function implementation layer is created, and a specific computing platform library set is compiled to provide callable processing functions to the basic abstract platform library; the homomorphic encryption software library includes: a processing function for performing homomorphic encryption calculations and a processing function for generating keys.

[0053] Optionally, the method for developing the homomorphic encryption computing device further includes building an environment required for the host-side program to use the homomorphic encryption software library, specifically including:

[0054] According to the target homomorphic encryption scheme, instantiate the corresponding target homomorphic encryption scheme object, and set the corresponding parameters through the parameter configuration interface;

[0055] Instantiate a context object based on the target homomorphic encryption scheme object and the name of the target hardware acceleration platform;

[0056] Based on the context object, instantiate a key generation object;

[0057] Instantiate an encryption object and a decryption object based on the context object and the key;

[0058] Based on the context object, all processing functions required by the target homomorphic encryption scheme object are instantiated.

[0059] Optionally, before instantiating a corresponding target homomorphic encryption scheme object according to the target homomorphic encryption scheme, the method further includes:

[0060] Detect whether the names of all computing processes included in the target homomorphic encryption scheme exist in the list of processing functions supported by the target hardware acceleration platform;

[0061] If the names of all computing processes exist in the processing function list, it is determined that the target hardware acceleration platform supports the target homomorphic encryption scheme; if the target hardware acceleration platform supports the target homomorphic encryption scheme, the corresponding target homomorphic encryption scheme object is instantiated;

[0062] If the name of any computing process does not exist in the processing function list, it is determined that the target hardware acceleration platform does not support the target homomorphic encryption scheme, and an error alarm is issued.

[0063] Optionally, before instantiating the context object, also include:

[0064] Detect whether the names of all computing processes included in the target homomorphic encryption scheme object are included in the processing function list corresponding to the hardware acceleration platform to be used;

[0065] If the names of all computing processes are included in the processing function list, it is determined that the hardware acceleration platform supports the target homomorphic encryption scheme object; if the hardware acceleration platform supports the target homomorphic encryption scheme object, the context object is instantiated;

[0066] If the name of any calculation process is not included in the processing function list, it is determined that the hardware acceleration platform does not support the target homomorphic encryption scheme object; if the hardware acceleration platform does not support the target homomorphic encryption scheme object, an error alarm is issued.

[0067] Optionally, instantiate a key generation object, including:

[0068] Based on the key generation object, generate the key required by the target homomorphic encryption scheme object;

[0069] Based on the target homomorphic encryption scheme object contained in the context object, searching for the name of the corresponding computing process according to the name of the key generation algorithm in the target homomorphic encryption scheme object;

[0070] Using the name of the computing process as the name of the processing function, searching for the kernel factory object corresponding to the processing function;

[0071] Through the kernel factory object, a processing function of the target hardware acceleration platform is created according to the name of the processing function, so as to generate the key required by the target homomorphic encryption scheme object.

[0072] Optionally, the method for developing the homomorphic encryption computing device further includes adding an extended hardware acceleration platform, specifically including:

[0073] Based on the homomorphic encryption scheme to be supported, determine the functions and quantity of processing functions required by the extended hardware acceleration platform;

[0074] Based on the extended programming framework, a platform class, a kernel factory class and a processing function class in the platform function abstraction layer are created; the kernel factory class is used to create a corresponding kernel factory object based on the name of the processing function required by the extended hardware acceleration platform;

[0075] Create a platform registration interface for registering the extended hardware acceleration platform;

[0076] Creating a kernel factory registration interface for registering a kernel factory object with the extended hardware acceleration platform;

[0077] All codes created in the process of adding the extended hardware acceleration platform are compiled as a whole to generate a first homomorphic encryption software library, and placed in the directory of the specific computing platform library collection.

[0078] Optionally, after adding the extended hardware acceleration platform, it also includes:

[0079] Reload the basic abstract platform library, and obtain the directory of the specific computing platform library set through the system environment variable;

[0080] Loading the first homomorphic encryption software library in the directory;

[0081] Calling the platform registration interface of the first homomorphic encryption software library to register the extended hardware acceleration platform;

[0082] Call the kernel factory registration interface of the first homomorphic encryption software library to register the kernel factory object with the extended hardware acceleration platform.

[0083] Optionally, the method for developing the homomorphic encryption computing device further includes adding an extended homomorphic encryption scheme, specifically including:

[0084] Create an extended homomorphic encryption scheme class and determine the required algorithm and the corresponding extended processing function name;

[0085] Based on the name of the extended processing function, create a corresponding extended processing function class;

[0086] Based on the extended processing function class and various programming frameworks, creating an extended kernel factory class;

[0087] Based on each programming framework, create corresponding kernel factory registration interface;

[0088] All codes created in the process of adding the extended homomorphic encryption scheme are compiled as a whole to generate a second homomorphic encryption software library, and placed in the directory of the specific computing platform library collection.

[0089] Optionally, after adding the extended homomorphic encryption scheme, also include:

[0090] Reload the basic abstract platform library, and obtain the directory of the specific computing platform library set through the system environment variable;

[0091] Loading the second homomorphic encryption software library in the directory;

[0092] Call the kernel factory registration interface of the second homomorphic encryption software library to register the extended kernel factory object with the hardware acceleration platform.

[0093] The cross-platform homomorphic encryption software library architecture of the present application provides the host-side program with callable API interfaces of different homomorphic encryption schemes through the program interface layer, shields the specific details of the underlying hardware acceleration platform through the platform function abstraction layer, unifies the abstraction of the programming frameworks of various hardware accelerators, and provides processing functions based on different programming frameworks through the specific platform function implementation layer, thereby realizing the distribution of homomorphic encryption computing tasks to different hardware accelerators for execution only by calling the API interface.

[0094] The cross-platform homomorphic encryption software library architecture of this application provides a software development template, which shields the specific details of the hardware acceleration platform through the platform function abstraction layer, and provides an abstract computing platform to the host-side program, so that developers do not need to consider the programming framework of the underlying hardware accelerator during development. In the specific platform function implementation layer, the corresponding processing functions are developed according to the programming framework of the hardware accelerator to adapt to the characteristics of each hardware accelerator. Developers can choose the most suitable programming framework for each hardware accelerator for development, so as to give full play to the inherent characteristics of each type of hardware accelerator, thereby realizing cross-hardware accelerator platform adaptation. Developers can directly change the called API interface to realize the switching of the hardware acceleration platform without rewriting the complete host-side program, which improves the efficiency of developers and reduces development costs. BRIEF DESCRIPTION OF THE DRAWINGS

[0095] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments of the present application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0096] Figure 1 is a schematic diagram of a cross-platform homomorphic encryption software library architecture proposed in one embodiment of the present application;

[0097] Figure 2 This is one of the schematic diagrams of the architecture of a homomorphic encryption computing device in one embodiment of the present application;

[0098] Figure 3 This is the second schematic diagram of the architecture of the homomorphic encryption computing device in one embodiment of the present application;

[0099] Figure 4 This is the third schematic diagram of the architecture of the homomorphic encryption computing device in one embodiment of the present application;

[0100] Figure 5 It is a flowchart of a method for developing a homomorphic encryption computing device proposed in one embodiment of the present application. DETAILED DESCRIPTION

[0101] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0102] It should be understood that the references to "one embodiment" or "an embodiment" throughout the specification mean that the specific features, structures, or characteristics associated with the embodiment are included in at least one embodiment of the present application. Therefore, the references to "in one embodiment" or "in an embodiment" appearing throughout the specification do not necessarily refer to the same embodiment. In addition, these specific features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.

[0103] In the various embodiments of the present application, it should be understood that the size of the serial numbers of the following processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0104] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as described in detail in the present application.

[0105] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application may be combined with each other.

[0106] Commonly used hardware accelerators include TPU (Tensor Processing Unit), GPU (Graphical Processing Unit), FPGA (Field Programming Gate Array), MLU (Machine Learning Unit), etc. In order for applications to use hardware accelerators for homomorphic encryption calculations, developers need to write corresponding processing functions (usually called Kernel) based on the programming framework supporting the hardware accelerator and hand them over to the hardware accelerator for execution.

[0107] Different hardware accelerators have their own programming frameworks and include different development interfaces. Usually, programming frameworks for hardware accelerators include CUDA (Compute Unified Device Architecture), Verilog HDL hardware description language, VHDL (Very-High-Speed ​​Integrated Circuit Hardware Description Language), HLS (High-Level Synthesis), etc. If an application needs to adapt to a new hardware accelerator, developers need to build a complete application from top to bottom based on the new programming framework. For developers who are not familiar with the field of cryptography (such as developers in the financial and medical fields), the development difficulty is high and the workload is large, making development difficult.

[0108] In order to reduce the difficulty of developing homomorphic encryption computing across hardware acceleration platforms, this application provides a cross-platform homomorphic encryption software library architecture to achieve compatibility with different hardware accelerators. The application will be described in detail below with reference to the accompanying drawings and in combination with embodiments.

[0109] Figure 1 Schematic diagram of a cross-platform homomorphic encryption software library architecture proposed in one embodiment of the present application. Figure 1 As shown, the architecture is oriented to the hardware accelerator and includes: the following network layers: a program interface layer, a platform function abstraction layer and a specific platform function implementation layer; the platform function abstraction layer is deployed between the program interface layer and the specific platform function implementation layer;

[0110] The program interface layer is constructed using an object-oriented design method and is configured to provide a host-side program with an API interface of multiple homomorphic encryption schemes; the host-side program calls processing functions running on different hardware accelerators through the API interface to perform homomorphic encryption calculations;

[0111] The platform function abstraction layer is configured to abstract the programming frameworks of different hardware accelerators and provide an interface of a processing function class to the program interface layer;

[0112] The specific platform function implementation layer is configured to provide processing functions running based on different programming frameworks to the interface of the processing function class based on a homomorphic encryption software library.

[0113] In this embodiment, the cross-platform homomorphic encryption software library architecture is divided according to logical functions, from top to bottom, including the program interface layer, the platform function abstraction layer, and the specific platform function implementation layer.

[0114] (1) Program interface layer, which provides the host program with an API interface for calling the homomorphic encryption scheme. The API design of this layer is independent of the specific hardware accelerator. When developing the API of the program interface layer, there is no restriction on how to implement it on the hardware acceleration platform. The API is independent of the hardware acceleration platform. When developing the API, it is developed for the unified abstract computing platform provided by the platform function abstraction layer. There is no need to consider the specific hardware accelerator. Therefore, there is no need to develop complete applications for different programming frameworks, which saves a lot of work and improves development efficiency.

[0115] In one embodiment, the design of the program interface layer adopts an object-oriented design method, which is specifically related to the field that the API is oriented to. In this embodiment, the API is oriented to the field of cryptographic computing, so when developing the API, the terminology in the field of cryptographic computing is used to express the operations that the API needs to perform. By designing the API based on the relevant terminology in the field to which the functions implemented by the API belong, it is convenient for application developers in the field to understand and speed up development.

[0116] (2) Platform function abstraction layer: This layer shields the details of the underlying hardware acceleration platform and describes an abstract computing platform that includes multiple processing functions (i.e., kernels) required for homomorphic encryption calculations. The calculation process required by various homomorphic encryption solution classes in the program interface layer is implemented by calling the functional interface of the processing function of this layer. In the program interface layer, the corresponding processing function in the specific platform function implementation layer can be called through the functional interface of the processing function of this layer. For example, the calculation process name of the encryption algorithm corresponding to the BGV scheme is BGV_encrypt, so the homomorphic encryption platform function abstraction layer needs to include a functional interface of a processing function named BGV_encrypt.

[0117] (3) The specific platform function implementation layer, which instantiates the platform class, kernel factory class, and processing function class defined in the platform function abstraction layer according to the specific hardware accelerator platform (such as GPU, FPGA, etc.). At this time, the processing function can be optimized and developed according to the characteristics of the hardware accelerator to improve the execution efficiency of homomorphic encryption calculations. The specific platform function implementation layer instantiates the abstract computing platform defined in the platform function abstraction layer and provides the API with homomorphic encryption solutions based on different hardware accelerators for calling.

[0118] In this embodiment, the specific hardware accelerator is abstracted through the platform function abstraction layer, thereby shielding the specific details of each hardware accelerator, and providing a unified API interface based on each homomorphic encryption scheme, so that developers do not need to consider the programming framework when changing the hardware platform, which greatly reduces the development difficulty and improves the efficiency of cross-platform development of homomorphic encryption computing devices. In the specific platform function implementation layer, the processing functions of each hardware acceleration platform are instantiated and created to realize the selection of different hardware acceleration platforms to perform homomorphic encryption calculations by calling APIs.

[0119] At the specific platform function implementation layer, developers can use the programming framework that best suits the characteristics of the hardware accelerator for development, so as to give full play to the inherent characteristics of various types of hardware accelerators. The API of the program interface layer is designed based on the terminology in the field to facilitate the understanding of application developers in different fields, so as to reduce the difficulty of application development and speed up development efficiency. Since the API at the program interface is independent of the hardware accelerator, the program developed using this API can be executed on any hardware accelerator that supports this API without modification. That is, the application developed using the homomorphic encryption software library architecture proposed in this scheme can be compatible with existing and subsequently developed hardware accelerators based on new programming frameworks.

[0120] As an implementation method of the present application, the API interface includes at least the following classes:

[0121] Homomorphic encryption scheme class, which is used to describe the name of the calculation process corresponding to the algorithm of the homomorphic encryption scheme, as well as the parameters required by the homomorphic encryption scheme;

[0122] A context class, used to connect the API interface with the hardware acceleration platform according to the name of the hardware acceleration platform and the homomorphic encryption scheme class object;

[0123] A key generation class, used to create a corresponding key generation object according to a context class object; the key generation object is used to generate the key required for the homomorphic encryption scheme;

[0124] Encryption class, used to encrypt plaintext data based on the context class object and the required key;

[0125] The operation class is used to determine the corresponding ciphertext operation method according to the context class object;

[0126] Decryption class, used to decrypt ciphertext data based on the context class object and the required key;

[0127] Plaintext class and ciphertext class are used to describe plaintext data and ciphertext data.

[0128] In this embodiment, the API interface of the design program interface layer provides a series of functional classes. Specifically, it includes the following classes:

[0129] (1) Homomorphic encryption scheme class: for example, the fully homomorphic encryption scheme BGV (Brakerski-Gentry-Vaikuntanathan), the fully homomorphic encryption scheme based on fault-tolerant learning BFV (Brakerski-Fan-Vercauteren), etc. The homomorphic encryption scheme class contains a hash data structure, which is used to store the various algorithms required by the homomorphic encryption scheme (including operation algorithms, encryption algorithms, and decryption algorithms), and the names of the calculation processes corresponding to the algorithms. For example, the calculation process name corresponding to the encryption algorithm Enc required by the BGV scheme is BGV_encrypt.

[0130] The homomorphic encryption scheme class also includes a parameter configuration interface, which is used to set the parameters required for the homomorphic encryption scheme (such as security level, vector dimension, etc.). The parameters of homomorphic encryption are usually related to the specific encryption scheme. The following are some common parameters:

[0131] Modulus: The modulus is usually a large prime number that defines the size of a finite field or multiplicative group. The choice of modulus has an important impact on the security and performance of the encryption scheme;

[0132] Primitive: In some homomorphic encryption schemes (such as the ElGamal encryption scheme), the primitive is an important parameter. It is an element with special properties in a finite field or multiplicative group, which is used to generate public and private keys;

[0133] Private key: It is secret information known only to the key holder and is used for operations such as decryption and signing. In homomorphic encryption, the private key is usually a random number used to generate the public key and perform decryption operations;

[0134] Public key: It is a public secret information used for encryption and signature verification. In homomorphic encryption, the public key is usually generated by a private key and primitives through some mathematical transformation.

[0135] (2) Context class: Its input is the homomorphic encryption solution class object and the hardware accelerator platform name, which is used to connect the API interface with the specific platform function implementation layer.

[0136] (3) Key generation class: Its input is the context class object. According to the context class, a corresponding key generation object is created to generate the key required for the specified homomorphic encryption scheme;

[0137] (4) Encryption class: Its input is the context class object and the required key. It contains an encryption method used to encrypt plaintext into ciphertext;

[0138] (5) Operation class: Its input is the context class object, which corresponds to the operation methods that can be used on the ciphertext, such as addition, multiplication, and negation;

[0139] (6) Decryption class: Its input is the context class and the required key, and contains a decryption method for decrypting ciphertext into plaintext;

[0140] (7) Plaintext class and ciphertext class: used to represent plaintext data and ciphertext data respectively.

[0141] As an implementation of the present application, the platform function abstraction layer is configured to include at least the following types of interfaces:

[0142] The interface of the platform class; the platform class is used to describe the hardware acceleration platform; any platform class includes at least one kernel factory class;

[0143] The interface of the kernel factory class; the kernel factory class is used to describe the kernel factory object; the kernel factory object is used to create a corresponding processing function based on the name of the processing function; any kernel factory class includes at least one processing function class;

[0144] The interface of the processing function class; the processing function class is used to describe the logic of the processing function.

[0145] In this embodiment, the role of the platform function abstraction layer is to shield the details of the underlying hardware accelerator and describe an abstract homomorphic encryption computing platform that includes multiple required processing functions. The calculation process required by various homomorphic encryption scheme classes in the program interface layer is to implement its function by calling the functional interface of the processing function class in this layer. For example, the calculation process name of the encryption algorithm corresponding to the BGV scheme is BGV_encrypt, then the platform function abstraction layer needs to include a functional interface of a processing function class named BGV_encrypt.

[0146] The platform function abstraction layer includes three categories, namely platform class, kernel factory class and processing function class. The platform function abstraction layer does not directly contain specific processing functions, but provides the functional interface of the processing function class to the API interface. Specifically, according to the functional classification, this layer contains three categories, as follows:

[0147] (1) Platform class: a class that describes the homomorphic encryption abstract computing platform. The platform class does not directly contain the required processing functions, but contains objects responsible for creating processing functions (i.e., kernel factories);

[0148] (2) Kernel factory class: a corresponding processing function can be created based on the processing function name. In this embodiment, a kernel factory object can create multiple processing functions, and the types of processing functions that can be created by a kernel factory object include at least one of the following: a processing function for encryption operation, or a processing function for generating a key;

[0149] (3) Processing function class: a class used to describe the functions of different processing functions.

[0150] When developing the platform function abstraction layer, developers create corresponding platform classes according to the hardware accelerators that need to be adapted. Each platform class includes at least one kernel factory class, and each kernel factory class can be used to create corresponding processing functions according to the names of one or more corresponding processing functions.

[0151] As an implementation of the present application, the platform function abstraction layer is configured to provide at least the following two processing function class interfaces:

[0152] Initialization interface, used to initialize the processing function;

[0153] Execution interface, used to execute processing functions.

[0154] In this embodiment, the interface of the processing function class provided by the platform function abstraction layer is a functional interface, specifically, including two interfaces, namely:

[0155] Initialization interface: used to initialize the corresponding processing function;

[0156] Execution interface: used to execute processing functions.

[0157] In this embodiment, the APIs of various homomorphic encryption schemes contained in the program interface layer implement their functions by calling the interfaces provided by the processing function classes of this layer, and ultimately the execution of the processing functions is implemented by the specific platform function implementation layer.

[0158] As an implementation method of the present application, the specific platform function implementation layer is configured to perform the following steps:

[0159] According to each programming framework, instantiate platform classes and kernel factory classes, and generate platform objects and kernel factory objects;

[0160] The kernel factory object instantiates processing functions adapted to various hardware acceleration platforms according to the names of the processing functions.

[0161] In this embodiment, the specific platform function implementation layer instantiates the platform class, kernel factory class and processing function class defined in the platform function abstraction layer. In the specific platform function implementation layer, according to the specific hardware accelerator, the platform class is instantiated to obtain the corresponding platform object (i.e., the hardware acceleration platform), and the kernel factory class is instantiated to obtain the corresponding kernel factory object. Then, the kernel factory object is used to instantiate and create the corresponding processing function according to the name of the processing function contained therein. In this embodiment, the processing function in the specific platform function implementation layer can be implemented using the programming framework of any hardware accelerator. Developers can use the most suitable programming framework for development based on each hardware acceleration platform to give full play to the inherent characteristics of the hardware acceleration platform.

[0162] As an implementation method of the present application, the specific platform function implementation layer further includes:

[0163] Platform registration interface, used to register the hardware accelerator platform;

[0164] The kernel factory registration interface is used to register the corresponding kernel factory object with the hardware accelerator platform.

[0165] In this embodiment, in the specific platform function implementation layer, each homomorphic encryption software library generated based on different programming frameworks also includes an interface for registering the platform and an interface for registering the kernel factory. When the homomorphic encryption software library is loaded, the corresponding platform object and kernel factory object are registered through these two interfaces to provide the host-side program with an optional hardware acceleration platform for executing homomorphic encryption computing tasks.

[0166] Based on the unified inventive concept, an embodiment of the present application provides a homomorphic encryption computing device, which includes:

[0167] The host-side program is configured to control the execution of a target task with a homomorphic encryption computing task, call the API interface provided by the cross-platform homomorphic encryption software library architecture described in the above embodiment, and assign the homomorphic encryption computing task to different hardware acceleration platforms for execution;

[0168] A basic abstract platform library is obtained by compiling the codes of the program interface layer and the platform function abstraction layer in the cross-platform homomorphic encryption software library architecture described in the above embodiment, and includes multiple preset homomorphic encryption schemes; the basic abstract platform library is configured to abstract the programming frameworks of different hardware accelerators and provide an API interface to the host-side program;

[0169] The specific computing platform library set is obtained by compiling the code of the specific platform function implementation layer in the cross-platform homomorphic encryption software library architecture described in the above embodiments; the specific computing platform library set is configured to provide the basic abstract platform library with a homomorphic encryption software library based on different programming frameworks.

[0170] Figure 2 This is one of the schematic diagrams of the architecture of the homomorphic encryption computing device in one embodiment of the present application. Figure 2 As shown, the homomorphic encryption computing device in this embodiment has a modular structure, which specifically includes three parts: a host-side program, a basic abstract platform library, and a specific computing platform library set.

[0171] Specifically, the host-side program is responsible for data preprocessing and process control tasks, and calls the API interface provided by the basic abstract platform library to assign homomorphic encryption computing tasks to the hardware accelerator for execution.

[0172] The basic abstract platform library is obtained by compiling the code of the program interface layer and the platform function abstraction layer in the cross-platform homomorphic encryption software library architecture described in the above embodiments, namely, the application program interface API layer and the platform function abstraction layer. The basic abstract platform library is used to provide API interfaces of various homomorphic encryption schemes to the host-side program, and to abstract the functions of each hardware acceleration platform in the specific computing platform library set. This layer presets some directly callable homomorphic encryption scheme API interfaces, such as BGV API interface, BFV API interface, etc.

[0173] The specific computing platform library set is obtained by compiling the code of the specific platform function implementation layer in the cross-platform homomorphic encryption software library architecture described in the above embodiment, which includes homomorphic encryption software libraries generated by programming frameworks for different hardware accelerators. For example, the homomorphic encryption acceleration library libGPU_HE.so for GPU, the homomorphic encryption acceleration library libFPGA_HE.so for FPGA, etc.

[0174] In this embodiment, by building a modular system structure, the host-side application and the specific hardware acceleration platform are isolated, so that developers in different fields can develop the host-side program or the hardware acceleration platform separately, simplifying the application development process and improving development efficiency.

[0175] In this embodiment, the hardware acceleration platform is abstracted through the basic abstract platform library, and an API interface for implementing corresponding operations is provided to the host-side program, so that developers in different fields do not need to consider the specific details of the hardware acceleration platform when developing host-side programs, thereby reducing the difficulty of development and improving development efficiency. A homomorphic encryption software library based on different programming frameworks is provided in the specific computing platform library collection to support cross-platform execution of host-side programs on different hardware accelerators.

[0176] As an implementation manner of the present application, the homomorphic encryption computing device further includes:

[0177] A platform extension module is used to dynamically add an extended hardware acceleration platform; the platform extension module is configured to build a first homomorphic encryption software library to provide the basic abstract platform library with processing functions generated based on an extended programming framework; the first homomorphic encryption software library is placed in the directory of the specific computing platform library collection.

[0178] In one embodiment, the homomorphic encryption computing device also includes a platform expansion module that supports the dynamic addition of a new hardware acceleration platform in addition to a preset hardware acceleration platform. Figure 3 This is the second schematic diagram of the architecture of the homomorphic encryption computing device in one embodiment of the present application. Figure 3 As shown, the homomorphic encryption computing device includes: a host-side program, a basic abstract platform library, a specific computing platform library set and a platform extension module.

[0179] In this embodiment, when adding a new hardware acceleration platform, the developer uses the platform extension module to generate a first homomorphic encryption software library based on the programming framework of the new hardware accelerator, and adds it to the directory of the specific computing platform library set, and puts it together with the preset homomorphic encryption software libraries of each hardware acceleration platform, so that when the specific computing platform library set is loaded, the newly added first homomorphic encryption software library can be automatically recognized to register the new hardware acceleration platform. The first homomorphic encryption software library usually includes the processing functions required for each homomorphic encryption scheme in the basic abstract platform library, specifically including processing functions for performing homomorphic encryption calculations and processing functions for generating keys.

[0180] In this embodiment, when the hardware acceleration platform existing in the specific computing platform library set cannot meet the needs, developers can flexibly add new hardware acceleration platforms through the platform extension module without rewriting the entire application, thereby improving the flexibility and convenience of the development process.

[0181] As an implementation manner of the present application, the basic abstract platform library is further configured to perform the following steps:

[0182] When loaded and run, the directory of the specific computing platform library set is provided through the system environment variable;

[0183] Loading the first homomorphic encryption software library in the directory;

[0184] Providing a platform registration interface in the first homomorphic encryption software library for registering an extended hardware acceleration platform;

[0185] A kernel factory registration interface is provided in the first homomorphic encryption software library for registering a kernel factory object with an extended hardware acceleration platform.

[0186] In the above embodiment, after the developer adds a new hardware acceleration platform through the platform extension module, the next time the basic abstract platform library is loaded and run, it will automatically obtain the directory of the specific computing platform library set through the system environment variables, and then load all homomorphic encryption software libraries in the directory (including the newly added first homomorphic encryption software library).

[0187] When creating each homomorphic encryption software library, a platform registration interface for registering the corresponding platform object and a kernel factory registration interface for registering the kernel factory object are provided therein. In this embodiment, when the first homomorphic encryption software library is loaded, the platform registration interface therein is first executed to register the corresponding hardware acceleration platform (platform object). Then, the kernel factory registration interface is executed again to register the kernel factory object with the registered hardware acceleration platform. Then, the kernel factory object can be used to create a processing function according to the name of the specific processing function.

[0188] As an implementation manner of the present application, the homomorphic encryption computing device further includes:

[0189] A scheme extension module is used to dynamically add an extended homomorphic encryption scheme; the scheme extension module is configured to build a second homomorphic encryption software library to provide the basic abstract platform library with processing functions generated based on the extended homomorphic encryption scheme; the second homomorphic encryption software library is placed in the directory of the specific computing platform library collection.

[0190] In one embodiment, the homomorphic encryption computing device also includes a scheme expansion module for dynamically adding new homomorphic encryption schemes other than the preset homomorphic encryption schemes. Figure 4 This is the third schematic diagram of the architecture of the homomorphic encryption computing device in one embodiment of the present application. Figure 4 As shown, the homomorphic encryption computing device includes: a host-side program, a basic abstract platform library, a specific computing platform library set and a solution extension module.

[0191] In this embodiment, when adding a new homomorphic encryption scheme API, the developer uses the scheme extension module to generate a second homomorphic encryption software library based on the newly added homomorphic encryption scheme, and adds it to the directory of the specific computing platform library set, so that when the specific computing platform library set is loaded, the newly added second homomorphic encryption software library can be automatically identified to register the corresponding kernel factory object to the specified hardware acceleration platform to be run. The second homomorphic encryption software library usually includes the processing functions required by the hardware acceleration platform to be run based on the new homomorphic encryption scheme, specifically including the processing functions used to perform homomorphic encryption calculations in the new homomorphic encryption scheme, and the processing functions used to generate keys.

[0192] In this embodiment, when the preset homomorphic encryption scheme provided by the basic abstract platform library cannot meet the needs, developers can flexibly add customized homomorphic encryption schemes through the scheme extension module without rewriting the complete homomorphic encryption computing device, thereby improving the flexibility and convenience of the development process.

[0193] As an implementation manner of the present application, the basic abstract platform library is further configured to perform the following steps:

[0194] When loaded and run, the directory of the specific computing platform library set is provided through the system environment variable;

[0195] Loading the second homomorphic encryption software library in the directory;

[0196] A kernel factory registration interface is provided in the second homomorphic encryption software library for registering an extended kernel factory object with a registered hardware acceleration platform.

[0197] In the above embodiment, after the developer adds a new homomorphic encryption scheme through the scheme extension module, the next time the basic abstract platform library is loaded and run, it will automatically obtain the directory of the specific computing platform library set through the system environment variables, and then load all homomorphic encryption software libraries in the directory (including the newly added second homomorphic encryption software library).

[0198] When creating each homomorphic encryption software library, a platform registration interface for registering the corresponding platform object and a kernel factory registration interface for registering the kernel factory object are provided therein. In this embodiment, when the second homomorphic encryption software library is loaded, the platform registration interface therein is first executed to register the corresponding hardware acceleration platform (platform object). Then, the kernel factory registration interface is executed again to register the kernel factory object with the registered hardware acceleration platform. Then, the kernel factory object can be used to create a processing function according to the name of the specific processing function.

[0199] Based on the unified inventive concept, an embodiment of the present application provides a method for developing a homomorphic encryption computing device, which is used to construct the homomorphic encryption computing device described in the above embodiment, including:

[0200] S11: Create a host-side program code, specify the target homomorphic encryption scheme and the target hardware acceleration platform to be used; the host-side program is used to call the corresponding API interface according to the target homomorphic encryption scheme to control the execution of homomorphic encryption computing tasks;

[0201] S12: Based on the target homomorphic encryption scheme, create the code of the program interface layer and the code of the platform function abstraction layer, and compile and generate a basic abstract platform library for providing an API interface of the homomorphic encryption scheme to the host-side program; the host-side program calls the processing functions running on different hardware accelerators through the API interface;

[0202] S13: Based on the target hardware acceleration platform and the corresponding homomorphic encryption software library, create the code of the specific platform function implementation layer, and compile and generate a specific computing platform library set to provide callable processing functions to the basic abstract platform library; the homomorphic encryption software library includes: a processing function for performing homomorphic encryption calculations and a processing function for generating keys.

[0203] Figure 5 Flowchart of a method for developing a homomorphic encryption computing device according to an embodiment of the present application. Figure 5 As shown in FIG. 1 , the program modules that need to be developed by the development method mainly include three parts: a host-side program, a basic abstract platform library, and a specific computing platform library set. When developing a homomorphic encryption computing device for a specific target field (such as the financial field or the medical field), it is necessary to specify the target homomorphic encryption scheme to be adopted in the host-side program, as well as the target hardware acceleration platform for performing homomorphic encryption computing.

[0204] After determining the homomorphic encryption scheme and hardware acceleration platform, based on the homomorphic encryption software library architecture in the above embodiment, create the code of the program interface layer and the code of the platform function abstraction layer, and compile to generate a basic abstract platform library to provide the host-side program with an API interface of the target homomorphic encryption scheme.

[0205] According to the specified target hardware acceleration platform, based on the programming framework of the target hardware accelerator, create a specific platform function implementation layer (including homomorphic encryption software library), the software library includes the processing functions of encryption calculation and key generation to support the target homomorphic encryption scheme. Compile the code of the specific platform function implementation layer to generate a specific computing platform library set.

[0206] As an implementation mode of the present application, the method for developing the homomorphic encryption computing device further includes building an environment required for the host-side program to use the homomorphic encryption software library, specifically including:

[0207] According to the target homomorphic encryption scheme, instantiate the corresponding target homomorphic encryption scheme object, and set the corresponding parameters through the parameter configuration interface;

[0208] Instantiate a context object based on the target homomorphic encryption scheme object and the name of the target hardware acceleration platform;

[0209] Based on the context object, instantiate a key generation object;

[0210] Instantiate an encryption object and a decryption object based on the context object and the key;

[0211] Based on the context object, all processing functions required by the target homomorphic encryption scheme object are instantiated.

[0212] In the above embodiment, in addition to developing the code for the host-side program, the basic abstract platform library, and the specific computing platform library, it is also necessary to build the usage environment required by the host-side program to use the homomorphic encryption software library. In this embodiment, the specific steps for building the operating environment are as follows:

[0213] (1) Instantiate the target homomorphic encryption scheme object to be adopted, and set relevant parameters through the parameter configuration interface. When instantiating the target homomorphic scheme object, you need to specify all the algorithms used by the scheme (including operation algorithm, encryption algorithm, decryption algorithm), and the calculation process corresponding to the algorithm;

[0214] (2) Instantiate the context object according to the name of the target homomorphic encryption scheme object and the target hardware acceleration platform;

[0215] (3) Based on the instantiated context object, instantiate the key generation object to generate various encryption and decryption keys;

[0216] (4) Based on the key created by the context object and the key generation object, the encryption object and the decryption object are instantiated. It is worth noting that this process queries the corresponding calculation process name based on the name of the encryption and decryption algorithm. Since the calculation process name is the same as the processing function name, the connection with the processing function of the corresponding target hardware platform is realized based on the queried calculation process name;

[0217] (5) Instantiate the required processing functions based on the context object. It is worth noting that in this process, the name of the calculation process corresponding to the homomorphic encryption scheme object is queried based on the name of the algorithm. If the query is empty, it means that this homomorphic encryption scheme does not support this algorithm.

[0218] Through the above steps, the environment required for using the homomorphic encryption software library is built, and developers can perform corresponding homomorphic encryption related processing on the target data by calling the API of the above target homomorphic encryption scheme. For example, calling the encryption method of the encryption object to encrypt the plaintext data, or calling the addition operation of the addition operation object to perform addition calculation on the ciphertext data.

[0219] As an implementation manner of the present application, before instantiating a corresponding target homomorphic encryption scheme object according to the target homomorphic encryption scheme, it also includes:

[0220] Detect whether the names of all computing processes included in the target homomorphic encryption scheme exist in the list of processing functions supported by the target hardware acceleration platform;

[0221] If the names of all computing processes exist in the processing function list, it is determined that the target hardware acceleration platform supports the target homomorphic encryption scheme; if the target hardware acceleration platform supports the target homomorphic encryption scheme, the corresponding target homomorphic encryption scheme object is instantiated;

[0222] If the name of any computing process does not exist in the processing function list, it is determined that the target hardware acceleration platform does not support the target homomorphic encryption scheme, and an error alarm is issued.

[0223] In one embodiment, before instantiating the target homomorphic encryption scheme, it is also necessary to detect whether all the computing processes included in the target homomorphic encryption scheme are supported by the processing function of the target hardware acceleration platform. Specifically, since the name of the computing process is the same as the name of the processing function, it is possible to determine whether the target acceleration platform supports the target homomorphic encryption scheme by querying whether the names of all the computing processes included in the target homomorphic encryption scheme are included in the list of processing functions supported by the target hardware acceleration platform.

[0224] If the names of all calculation processes are included in the processing function list, it indicates that the target acceleration platform supports the target homomorphic encryption scheme. On this basis, the target homomorphic encryption scheme object is further instantiated; if there are calculation process names that are not included in the processing function list, it indicates that the target acceleration platform does not support the target homomorphic encryption scheme. At this time, an alarm message is generated and fed back to the developer so that the developer can change the target hardware acceleration platform or the target homomorphic encryption scheme.

[0225] Optionally, the warning information includes: the name of the computing process in the target homomorphic encryption scheme that is not supported by the target hardware acceleration platform.

[0226] In this embodiment, before instantiating the target homomorphic encryption scheme object, if the target homomorphic encryption scheme is not supported by the target hardware acceleration platform, an alarm message is used to prompt the developer to promptly change the encryption scheme or hardware acceleration platform to avoid the application being unable to run after development is completed, thereby further improving development efficiency.

[0227] As an implementation manner of the present application, before instantiating the context object, the method further includes:

[0228] Detect whether the names of all computing processes included in the target homomorphic encryption scheme object are included in the processing function list corresponding to the hardware acceleration platform to be used;

[0229] If the names of all computing processes are included in the processing function list, it is determined that the hardware acceleration platform supports the target homomorphic encryption scheme object; if the hardware acceleration platform supports the target homomorphic encryption scheme object, the context object is instantiated;

[0230] If the name of any calculation process is not included in the processing function list, it is determined that the hardware acceleration platform does not support the target homomorphic encryption scheme object; if the hardware acceleration platform does not support the target homomorphic encryption scheme object, an error alarm is issued.

[0231] In one embodiment, after the target homomorphic encryption scheme class is instantiated and the target homomorphic encryption scheme object is created, before the context object is instantiated, it is necessary to first check whether the target homomorphic encryption scheme object is supported by the target hardware acceleration platform. First, the registered platform object is searched according to the name of the target hardware acceleration platform, and then the names of all the calculation processes included in the target homomorphic encryption scheme are checked to see whether they are included in the list of processing functions supported by the target hardware acceleration platform to determine whether the target acceleration platform supports the target homomorphic encryption scheme.

[0232] If the names of all calculation processes are included in the processing function list of the target hardware acceleration platform, it indicates that the target acceleration platform supports the target homomorphic encryption scheme. On this basis, the context object is further instantiated; if there are names of calculation processes that are not included in the processing function list, it indicates that the target acceleration platform does not support the target homomorphic encryption scheme. At this time, an alarm message is generated and fed back to the developer so that the developer can change the target hardware acceleration platform to support the target homomorphic encryption scheme.

[0233] Optionally, the warning information includes: the name of the computing process in the target homomorphic encryption scheme that is not supported by the target hardware acceleration platform.

[0234] In this embodiment, before instantiating the context object, if the target homomorphic encryption scheme is not supported by the target hardware acceleration platform, an alarm message is used to prompt the developer to promptly replace the target hardware acceleration platform to avoid the application being unable to run after development is completed, thereby further improving development efficiency.

[0235] As an implementation mode of the present application, instantiating a key generation object includes:

[0236] Based on the key generation object, generate the key required by the target homomorphic encryption scheme object;

[0237] Based on the target homomorphic encryption scheme object contained in the context object, searching for the name of the corresponding computing process according to the name of the key generation algorithm in the target homomorphic encryption scheme object;

[0238] Using the name of the computing process as the name of the processing function, searching for the kernel factory object corresponding to the processing function;

[0239] Through the kernel factory object, a processing function of the target hardware acceleration platform is created according to the name of the processing function, so as to generate the key required by the target homomorphic encryption scheme object.

[0240] In the above embodiment, the specific steps of instantiating the key generation object are as follows:

[0241] (1) Based on the homomorphic encryption scheme object contained in the context object, query the name of the key generation algorithm. Usually, the name of the key generation algorithm is fixed, for example, the name of the key generation algorithm of the BGV object is BGVgenerator;

[0242] (2) According to the name of the key generation algorithm, query the name of the corresponding calculation process. Usually the name of the calculation process can be customized by the developer, and usually the name of the calculation process is consistent with the name of the processing function;

[0243] (3) Determine the name of the corresponding processing function based on the name of the calculation process, and then find the corresponding kernel factory object based on the name of the processing function;

[0244] (4) Create a corresponding processing function according to the name of the processing function through the kernel factory object;

[0245] (5) Initialization is performed through the functional initialization interface of the processing function, and then the processing function is executed through the execution interface to create the key required in the target homomorphic encryption scheme.

[0246] As an implementation of the present application, the method for developing the homomorphic encryption computing device further includes adding an extended hardware acceleration platform, specifically including:

[0247] Based on the homomorphic encryption scheme to be supported, determine the functions and quantity of processing functions required by the extended hardware acceleration platform;

[0248] Based on the extended programming framework, a platform class, a kernel factory class and a processing function class in the platform function abstraction layer are created; the kernel factory class is used to create a corresponding kernel factory object based on the name of the processing function required by the extended hardware acceleration platform;

[0249] Create a platform registration interface for registering the extended hardware acceleration platform;

[0250] Creating a kernel factory registration interface for registering a kernel factory object with the extended hardware acceleration platform;

[0251] All codes created in the process of adding the extended hardware acceleration platform are compiled as a whole to generate a first homomorphic encryption software library, and placed in the directory of the specific computing platform library collection.

[0252] In this embodiment, after the initial homomorphic encryption computing device is created, it also supports dynamically adding an extended hardware acceleration platform during subsequent use. The specific steps are as follows:

[0253] (1) First, determine the homomorphic encryption scheme that the extended hardware accelerator needs to support, and then determine the number and specific functions of the processing functions that the hardware acceleration platform needs to implement;

[0254] (2) Based on the programming framework of the hardware accelerator, implement the platform class, kernel factory class and processing function class defined in the platform function abstraction layer, where the kernel factory class can create a corresponding processing function based on the name of the processing function;

[0255] (3) Create a platform registration interface to register the platform object (hardware acceleration platform) created based on the platform class defined in the previous step;

[0256] (4) Create a kernel factory registration interface to register the corresponding kernel factory object with the registered platform object;

[0257] (5) Compile the above code to generate a first homomorphic encryption software library and place it in the directory of the specific computing platform library collection.

[0258] As an implementation mode of the present application, after adding the extended hardware acceleration platform, it also includes:

[0259] Reload the basic abstract platform library, and obtain the directory of the specific computing platform library set through the system environment variable;

[0260] Loading the first homomorphic encryption software library in the directory;

[0261] Calling the platform registration interface of the first homomorphic encryption software library to register the extended hardware acceleration platform;

[0262] Call the kernel factory registration interface of the first homomorphic encryption software library to register the kernel factory object with the extended hardware acceleration platform.

[0263] In the above embodiment, after the first homomorphic encryption software library is added to the directory of the specific computing platform library set, when the basic abstract platform library is loaded and run next time, the directory of the specific computing platform library set will be automatically known through the system environment variable, and then all homomorphic encryption software libraries (including the first homomorphic encryption software library) in the directory will be loaded. In the process of loading the homomorphic encryption software library, the platform registration interface of the homomorphic encryption software library is first executed to register the corresponding hardware acceleration platform, and then the kernel factory registration interface therein is executed to register the corresponding kernel factory object with the registered hardware acceleration platform. For the first homomorphic encryption software library, when loading, the platform registration interface therein is first executed to register the extended hardware acceleration platform, and then the kernel factory registration interface is executed to register the corresponding kernel factory object with the extended hardware acceleration platform.

[0264] As an implementation mode of the present application, the method for developing the homomorphic encryption computing device further includes adding an extended homomorphic encryption scheme, specifically including:

[0265] Create an extended homomorphic encryption scheme class and determine the required algorithm and the corresponding extended processing function name;

[0266] Based on the name of the extended processing function, create a corresponding extended processing function class;

[0267] Based on the extended processing function class and various programming frameworks, creating an extended kernel factory class;

[0268] Based on each programming framework, create corresponding kernel factory registration interface;

[0269] All codes created in the process of adding the extended homomorphic encryption scheme are compiled as a whole to generate a second homomorphic encryption software library, and placed in the directory of the specific computing platform library collection.

[0270] In one embodiment, after the initial homomorphic encryption computing device is created, it also supports dynamically adding an extended homomorphic encryption scheme during subsequent use. The specific steps are as follows:

[0271] (1) First, determine the hardware acceleration platform required to run the extended homomorphic encryption scheme, define the extended homomorphic encryption scheme class, and determine the algorithms required by the homomorphic encryption scheme class (including operation algorithms, encryption algorithms, and decryption algorithms), as well as the calculation process names corresponding to the algorithms (the same as the processing function names). Optionally, if some algorithms are detected to already exist during the definition of the extended homomorphic encryption scheme class, they can be directly reused. For new algorithms that do not currently exist, further define the corresponding names of the algorithms;

[0272] (2) If a new processing function name appears, create an extended processing function class named based on the name of the processing function;

[0273] (3) Based on the extended processing function class, create an extended kernel factory class;

[0274] (4) Create a kernel factory registration interface to register the corresponding kernel factory object with the hardware acceleration platform to be run;

[0275] (5) Compile the code created in the above steps as a whole to generate a second homomorphic encryption software library and place it in the directory of the specific computing platform library collection. The application calls this second homomorphic encryption software library through the API of the extended homomorphic encryption solution, and can use the extended homomorphic encryption solution just like using the preset homomorphic encryption solution.

[0276] As an implementation mode of the present application, after adding the extended homomorphic encryption scheme, it also includes:

[0277] Reload the basic abstract platform library, and obtain the directory of the specific computing platform library set through the system environment variable;

[0278] Loading the second homomorphic encryption software library in the directory;

[0279] Call the kernel factory registration interface of the second homomorphic encryption software library to register the extended kernel factory object with the hardware acceleration platform.

[0280] In the above embodiment, after the extended second homomorphic encryption software library is placed in the directory of the specific computing platform library set, the basic abstract platform library will automatically obtain the directory of the specific computing platform library set through the system environment variable when it is loaded and run next time, and then load all homomorphic encryption software libraries (including the second homomorphic encryption software library) in the directory. In the process of loading the homomorphic encryption software library, the platform registration interface of the homomorphic encryption software library is first executed to register the corresponding hardware acceleration platform, and then the kernel factory registration interface therein is executed to register the corresponding kernel factory object with the registered hardware acceleration platform. For the extended second homomorphic encryption software library, the kernel factory registration interface therein is executed when loading, and the corresponding kernel factory object is registered with the specified hardware acceleration platform.

[0281] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the protection scope of the present application.

[0282] For the method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the order of the actions described, because according to the present application, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and components involved are not necessarily required by the present application.

[0283] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, devices, or computer program products. Therefore, the embodiments of the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the embodiments of the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

[0284] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0285] These computer program instructions can also be added to a computer readable memory that can guide a computer or other programmable data processing terminal device to work in a specific way, so that the instructions added to the computer readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0286] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0287] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they are aware of the basic creative concepts. Therefore, the present application is interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present application.

[0288] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.

[0289] The above is a detailed introduction to the cross-platform homomorphic encryption software library architecture, computing device and development method provided by the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for general technical personnel in this field, according to the idea of ​​the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A cross-platform homomorphic encryption software library architecture, characterized in that: The network layer includes the following: a program interface layer, a platform function abstraction layer and a specific platform function implementation layer; the platform function abstraction layer is deployed between the program interface layer and the specific platform function implementation layer; The program interface layer is constructed using an object-oriented design method and is configured to provide a host-side program with multiple API interfaces of homomorphic encryption schemes; the host-side program calls processing functions running on different hardware accelerators through the API interface to perform homomorphic encryption calculations; the API interface includes at least the following classes: a homomorphic encryption scheme class, which is used to describe the name of the calculation process corresponding to the algorithm of the homomorphic encryption scheme, and the parameters required for the homomorphic encryption scheme; a context class, which is used to connect the API interface with the hardware acceleration platform according to the name of the hardware acceleration platform and the homomorphic encryption scheme class object; The key generation class is used to create the corresponding key generation object according to the context class object; The key generation object is used to generate the key required for the homomorphic encryption scheme; the encryption class is used to encrypt the plaintext data according to the context class object and the required key; the operation class is used to determine the corresponding ciphertext operation method according to the context class object; the decryption class is used to decrypt the ciphertext data according to the context class object and the required key; Plaintext class and ciphertext class are used to describe plaintext data and ciphertext data; The platform function abstraction layer is configured to abstract the programming frameworks of different hardware accelerators and provide an interface of a processing function class to the program interface layer; The specific platform function implementation layer is configured to provide processing functions running based on different programming frameworks to the interface of the processing function class based on a homomorphic encryption software library.

2. The cross-platform homomorphic encryption software library architecture according to claim 1, characterized in that: The platform function abstraction layer is configured to include at least the following class interfaces: The interface of the platform class; the platform class is used to describe the hardware acceleration platform; any platform class includes at least one kernel factory class; The interface of the kernel factory class; the kernel factory class is used to describe the kernel factory object; the kernel factory object is used to create a corresponding processing function based on the name of the processing function; any kernel factory class includes at least one processing function class; The interface of the processing function class; the processing function class is used to describe the logic of the processing function.

3. The cross-platform homomorphic encryption software library architecture according to claim 2, characterized in that: The platform function abstraction layer is configured to provide at least the following two processing function class interfaces: Initialization interface, used to initialize the processing function; Execution interface, used to execute processing functions.

4. The cross-platform homomorphic encryption software library architecture according to claim 2, characterized in that: The specific platform function implementation layer is configured to perform the following steps: According to each programming framework, instantiate the platform class and kernel factory class, and generate platform objects and kernel factory objects; The kernel factory object instantiates processing functions adapted to various hardware acceleration platforms according to the names of the processing functions.

5. The cross-platform homomorphic encryption software library architecture according to claim 4, characterized in that: The specific platform function implementation layer also includes: Platform registration interface, used to register the hardware accelerator platform; The kernel factory registration interface is used to register the corresponding kernel factory object with the hardware accelerator platform.

6. A homomorphic encryption computing device, characterized in that: include: A host-side program configured to control the execution of a target task with a homomorphic encryption computing task, call an API interface provided by the cross-platform homomorphic encryption software library architecture described in any one of claims 1 to 5, and assign the homomorphic encryption computing task to different hardware acceleration platforms for execution; A basic abstract platform library, obtained by compiling the code of the program interface layer and the platform function abstraction layer in the cross-platform homomorphic encryption software library architecture described in any one of claims 1 to 5, and comprising multiple preset homomorphic encryption schemes; The basic abstract platform library is configured to abstract programming frameworks of different hardware accelerators and provide an API interface to the host-side program; A specific computing platform library set is obtained by compiling the code of the specific platform function implementation layer in the cross-platform homomorphic encryption software library architecture described in any one of claims 1-5; the specific computing platform library set is configured to provide the basic abstract platform library with a homomorphic encryption software library based on different programming frameworks.

7. The homomorphic encryption computing device according to claim 6, characterized in that: Also includes: Platform extension module, used to dynamically add extended hardware acceleration platforms; The platform extension module is configured to build a first homomorphic encryption software library for providing the basic abstract platform library with processing functions generated based on an extended programming framework; the first homomorphic encryption software library is placed in the directory of the specific computing platform library collection.

8. The homomorphic encryption computing device according to claim 7, characterized in that: The base abstract platform library is further configured to perform the following steps: When loaded and run, the directory of the specific computing platform library set is provided through the system environment variable; Loading the first homomorphic encryption software library in the directory; Providing a platform registration interface in the first homomorphic encryption software library for registering an extended hardware acceleration platform; A kernel factory registration interface is provided in the first homomorphic encryption software library for registering a kernel factory object with an extended hardware acceleration platform.

9. The homomorphic encryption computing device according to claim 6, characterized in that: Also includes: Scheme extension module, used to dynamically add extended homomorphic encryption schemes; The scheme extension module is configured to build a second homomorphic encryption software library for providing the basic abstract platform library with processing functions generated based on the extended homomorphic encryption scheme; the second homomorphic encryption software library is placed in the directory of the specific computing platform library collection.

10. The homomorphic encryption computing device according to claim 9, characterized in that: The base abstract platform library is further configured to perform the following steps: When loaded and run, the directory of the specific computing platform library set is provided through the system environment variable; Loading the second homomorphic encryption software library in the directory; A kernel factory registration interface is provided in the second homomorphic encryption software library for registering an extended kernel factory object with a registered hardware acceleration platform.

11. A method for developing a homomorphic encryption computing device, characterized in that: A homomorphic encryption computing device for constructing any one of claims 6 to 10, comprising: Create a host-side program code, specify the target homomorphic encryption scheme and the target hardware acceleration platform to be used; the host-side program is used to call the corresponding API interface according to the target homomorphic encryption scheme to control the execution of homomorphic encryption computing tasks; Based on the target homomorphic encryption scheme, create the code of the program interface layer and the code of the platform function abstraction layer, and compile and generate a basic abstract platform library for providing an API interface of the homomorphic encryption scheme to the host-side program; the host-side program calls the processing functions running on different hardware accelerators through the API interface; Based on the target hardware acceleration platform and the corresponding homomorphic encryption software library, the code of the specific platform function implementation layer is created, and a specific computing platform library set is compiled to provide callable processing functions to the basic abstract platform library; the homomorphic encryption software library includes: a processing function for performing homomorphic encryption calculations and a processing function for generating keys.

12. The method for developing a homomorphic encryption computing device according to claim 11, characterized in that: It also includes the environment required to build the host-side program to use the homomorphic encryption software library, including: According to the target homomorphic encryption scheme, instantiate the corresponding target homomorphic encryption scheme object, and set the corresponding parameters through the parameter configuration interface; Instantiate a context object based on the target homomorphic encryption scheme object and the name of the target hardware acceleration platform; Based on the context object, instantiate a key generation object; Instantiate an encryption object and a decryption object based on the context object and the key; Based on the context object, all processing functions required by the target homomorphic encryption scheme object are instantiated.

13. The method for developing a homomorphic encryption computing device according to claim 12, characterized in that: Before instantiating a corresponding target homomorphic encryption scheme object according to the target homomorphic encryption scheme, the method further includes: Detect whether the names of all computing processes included in the target homomorphic encryption scheme exist in the list of processing functions supported by the target hardware acceleration platform; If the names of all computing processes exist in the processing function list, it is determined that the target hardware acceleration platform supports the target homomorphic encryption scheme; if the target hardware acceleration platform supports the target homomorphic encryption scheme, the corresponding target homomorphic encryption scheme object is instantiated; If the name of any computing process does not exist in the processing function list, it is determined that the target hardware acceleration platform does not support the target homomorphic encryption scheme, and an error alarm is issued.

14. The method for developing a homomorphic encryption computing device according to claim 12, characterized in that: Before instantiating the context object, also include: Detect whether the names of all computing processes included in the target homomorphic encryption scheme object are included in the processing function list corresponding to the hardware acceleration platform to be used; If the names of all computing processes are included in the processing function list, it is determined that the hardware acceleration platform supports the target homomorphic encryption scheme object; if the hardware acceleration platform supports the target homomorphic encryption scheme object, the context object is instantiated; If the name of any calculation process is not included in the processing function list, it is determined that the hardware acceleration platform does not support the target homomorphic encryption scheme object; if the hardware acceleration platform does not support the target homomorphic encryption scheme object, an error alarm is issued.

15. The method for developing a homomorphic encryption computing device according to claim 12, characterized in that: Instantiate a key generation object, including: Based on the key generation object, generate the key required by the target homomorphic encryption scheme object; Based on the target homomorphic encryption scheme object contained in the context object, searching for the name of the corresponding computing process according to the name of the key generation algorithm in the target homomorphic encryption scheme object; Using the name of the computing process as the name of the processing function, searching for the kernel factory object corresponding to the processing function; Through the kernel factory object, a processing function of the target hardware acceleration platform is created according to the name of the processing function, so as to generate the key required by the target homomorphic encryption scheme object.

16. The method for developing a homomorphic encryption computing device according to claim 11, characterized in that: It also includes a hardware acceleration platform that adds extensions, including: Based on the homomorphic encryption scheme to be supported, determine the functions and quantity of processing functions required by the extended hardware acceleration platform; Based on the extended programming framework, a platform class, a kernel factory class and a processing function class in the platform function abstraction layer are created; the kernel factory class is used to create a corresponding kernel factory object based on the name of the processing function required by the extended hardware acceleration platform; Create a platform registration interface for registering the extended hardware acceleration platform; Creating a kernel factory registration interface for registering a kernel factory object with the extended hardware acceleration platform; All codes created in the process of adding the extended hardware acceleration platform are compiled as a whole to generate a first homomorphic encryption software library, and placed in the directory of the specific computing platform library collection.

17. The method for developing a homomorphic encryption computing device according to claim 16, characterized in that: After adding the extended hardware acceleration platform, it also includes: Reload the basic abstract platform library, and obtain the directory of the specific computing platform library set through the system environment variable; Loading the first homomorphic encryption software library in the directory; Calling the platform registration interface of the first homomorphic encryption software library to register the extended hardware acceleration platform; Call the kernel factory registration interface of the first homomorphic encryption software library to register the kernel factory object with the extended hardware acceleration platform.

18. The method for developing a homomorphic encryption computing device according to claim 11, characterized in that: It also includes adding extended homomorphic encryption schemes, including: Create an extended homomorphic encryption scheme class and determine the required algorithm and the corresponding extended processing function name; Based on the name of the extended processing function, create a corresponding extended processing function class; Based on the extended processing function class and various programming frameworks, creating an extended kernel factory class; Based on each programming framework, create corresponding kernel factory registration interface; All codes created in the process of adding the extended homomorphic encryption scheme are compiled as a whole to generate a second homomorphic encryption software library, and placed in the directory of the specific computing platform library collection.

19. The method for developing a homomorphic encryption computing device according to claim 18, characterized in that: After adding the extended homomorphic encryption scheme, it also includes: Reload the basic abstract platform library, and obtain the directory of the specific computing platform library set through the system environment variable; Loading the second homomorphic encryption software library in the directory; Call the kernel factory registration interface of the second homomorphic encryption software library to register the extended kernel factory object with the hardware acceleration platform.

Citation Information

Patent Citations

  • Hardware acceleration system and method for implementing cryptographic algorithm

    CN112887093A

  • Hardware accelerator of fully homomorphic encryption algorithm, homomorphic encryption method and electronic equipment

    CN116488788A

  • Federal learning training acceleration method based on hardware acceleration card

    CN117874790A

  • Hardware architecture for accelerating torus fully homomorphic encryption(TFHE) with streaming core and folded fully pipelined fft

    KR102616119B1

  • Low latency calculation transcryption method

    US20210391976A1