1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- #ifndef __SPIR_HPP__
- #define __SPIR_HPP__
- #include <string>
- #include <stdint.h>
- using std::string;
- class SPIR {
- public:
- typedef uint64_t DBEntry; // The type of each DB entry (64 bits)
- static void init(uint32_t nthreads); // Call this once at startup
- };
- class SPIR_Client {
- public:
- // constructor
- SPIR_Client(uint8_t r, string &pub_params); // 2^r records in the database; pub_params will be _filled in_
- // preprocessing
- string preproc_PIRs(uint32_t num_pirs); // returns the string to send to the server
- void preproc_handle(const string &server_preproc);
- // SPIR query for index idx
- string query(size_t idx); // returns the string to send to the server
- // process the server's response to yield the server's db[(idx + rot)%N] + blind
- // where N=2^r, idx is provided by the client above, and
- // db, rot, and blind are provided by the server below
- SPIR::DBEntry process_reply(const string &server_reply);
- };
- class SPIR_Server {
- public:
- // constructor
- SPIR_Server(uint8_t r, const string &client_pub_params);
- // preprocessing
- string preproc_PIR(const string &client_preproc); // returns the string to reply to the client
-
- // SPIR query on the given database of N=2^r records, each of type DBEntry
- // rotate the database by rot, and blind each entry in the database additively with blind
- // returns the string to reply to the client
- string process_query(const string &client_query, const SPIR::DBEntry *db,
- size_t rot, SPIR::DBEntry blind);
- };
- #endif
|