chromium/third_party/private_membership/README.chromium

Name: PSM (Private Set Membership) client side
URL: N/A - The repository is internal to Google
Version: N/A
Date: 2023-09-15
License: Apache Version 2.0
License File: LICENSE
Security Critical: yes
Shipped: yes

Description:

Private Set Membership (PSM) is a cryptographic protocol that
allows users to privately query whether the user's identifier is a
member of a set of identifiers held by a server in a
privacy-preserving manner.

For privacy, the Private Set Membership protocol guarantees the
following:
- The server does not learn any information about the sensitive
portion of the user's queried identifier. In particular, this also
means that the server does not learn whether the queried
identifier was a member or not.
- The querying user learns no information about the set of
identifiers that are stored by the server beyond whether the
querying user's identifier is a member or not of the server-held
set of identifiers. In other words, the querying user learns the
bare minimum amount of information which is only the answer of the
membership query.

Local Modifications:

Applying local modifications live in //third_party/private_membership/patches/
can be done by running the following commands:

$ export PSM_CLIENT_PATH=<path-to-chromium>/src/third_party/private_membership/patches
$ cd <path-to-chromium>/src
$ for patch in $PSM_CLIENT_PATH/patches/*; do patch -s -p1 < $patch; done

In case of conflict, update those patches accordingly and save them back in
//third_party/private_membership/patches/. The most recent patch has been
produced automatically from the lastest version of the PSM library using the
following commands:

$ export PATH_TO_CHROMIUM=<path-to-chromium>
$ export PATH_TO_PSM_LIB=<path-to-psm-lib>
$
$ # Remove old version and prepare empty directory in Chromium codebase.
$ cd $PATH_TO_CHROMIUM/src/third_party/private_membership
$ rm -rf src && mkdir src
$
$ # Copy client C++ and proto files to Chromium.
$ cp $PATH_TO_PSM_LIB/private_membership/rlwe/client/proto/*.proto src
$ cp $PATH_TO_PSM_LIB/private_membership/rlwe/client/cpp/private_membership_rlwe_client* src
$ cp -a $PATH_TO_PSM_LIB/private_membership/rlwe/client/cpp/internal src
$
$ # Remove BUILD files since Chromium uses GN (see BUILD.gn).
$ rm src/**/BUILD
$
$ # Fix C++ includes.
$ find src \( -name '*.h' -o -name '*.cc' \) -type f -print0 | xargs -0 sed -i 's/#include "private_membership\/rlwe\/client\/cpp/#include "third_party\/private_membership\/src/g'
$ find src \( -name '*.h' -o -name '*.cc' \) -type f -print0 | xargs -0 sed -i 's/#include "private_membership\/rlwe\/client\/proto/#include "third_party\/private_membership\/src/g'
$ find src \( -name '*.h' -o -name '*.cc' \) -type f -print0 | xargs -0 sed -i 's/#include "shell_encryption\//#include "third_party\/shell-encryption\/src\//g'
$ find src \( -name '*.h' -o -name '*.cc' \) -type f -print0 | xargs -0 sed -i 's/#include "private_join_and_compute\//#include "third_party\/private-join-and-compute\/src\//g'
$ find src \( -name '*.h' -o -name '*.cc' \) -type f -print0 | xargs -0 sed -i 's/#include "third_party\/private_membership\/src\/open_source\/chromium\/private_membership_export.h"/#include "third_party\/private_membership\/base\/private_membership_export.h"/g'
$
$ # Fix C++ header guards.
$ find src -name '*.h' -type f -print0 | xargs -0 sed -i 's/PRIVATE_MEMBERSHIP_RLWE_CLIENT_CPP/THIRD_PARTY_PRIVATE_MEMBERSHIP_SRC/g'
$
$ # Fix proto imports.
$ find src -name '*.proto' -type f -print0 | xargs -0 sed -i 's/import "shell_encryption\/serialization.proto";/import "serialization.proto";/g'
$ find src -name '*.proto' -type f -print0 | xargs -0 sed -i 's/import "private_membership\/rlwe\/client\/proto\//import "/g'
$
$ # Generate updated patch.
$ git diff > new.patch
$ mv new.patch patches/0001-Chromium-fixes-for-PSM-client-library.patch