google / psp Goto Github PK
View Code? Open in Web Editor NEWLicense: Apache License 2.0
License: Apache License 2.0
psp-open-source project ======================= This is the README file for the psp-open-source project. The PSP Security Protocol (PSP) is a security protocol created by Google for encryption in transit. PSP uses several of the concepts from IPsec ESP to provide an encryption encapsulation layer on-top of IP that is streamlined and custom-built to address the requirements of large-scale data centers. PSP is described in the "PSP Architecture Specification", which can be found in the /doc subdirectory. The project also contains a reference software implementation written in the 'C' language and a suite of packet-level test cases. The project contains the following subdirectories: /src - source code for the reference software implementation /pcap - pcap files used for testing /cfg - configuration files used for testing /test - bash scripts that implement the suite of test cases /doc - documentation including the "PSP Architecture Specification" in .pdf format /wireshark - wireshark plugin for PSP A more detailed description of the subdirectories is provided below. /src ==== Contains 3 programs and a Makefile. All the executables are built by the 'make' command. The 3 programs are: create_pcap ----------- Creates a cleartext pcap file that can be used for testing. The created packets are of the form Eth-IP-UDP-Payload with a fixed size of 1434 octets (unless the -e option is specified). All of the created packets are for the same flow (i.e., they all have the same MAC addresses, IP addresses, and UDP port numbers). Command Line Args: [-n N] [-f file_name] [-i ver] [-e] N is the number of packets to create, defaults to 1 file_name is the name of the pcap output file, defaults to "cleartext.pcap" ver is 4 or 6, 4 indicates create ipv4 packets, 6 indicates create ipv6 packets, default is 4 the -e option indicates that empty packets are to be created, where empty means the size of the l4 payload is 0 psp_encrypt ----------- Program to perform PSP encryption. Reads plaintext packets from a pcap input file. Performs the following for each packet: - Adds appropriate PSP encapsulation - Computes ICV - Encrypts data Then writes each PSP-encrypted packet to a pcap output Command Line Args: [-c psp_cfg_file_name] [-i in_file] [-o out_file] [-v] [-e] -v enables verbose mode -e forces a single bit error in each output packet, which will cause authentication to fail Defaults: psp_cfg_file: "psp_encrypt.cfg" in_file: "cleartext.pcap" out_file: "psp_encrypt.pcap" The format of the PSP encryption configuration file is: series of 32 hex bytes (e.g., 34 44 8a ...): Master Key 0 series of 32 hex bytes (e.g., 56 39 52 ...): Master Key 1 32b hex value (e.g., 9A345678), msb selects master key: SPI encap string (either "transport" or "tunnel"): PSP Encap Mode crypro algorithm string (either "aes-gcm-128" or "aes-gcm-256"): Crypto Algorithm non-negative integer with units of 4 bytes (e.g., 1): Transport Mode Crypt Offset non-negative integer with units of 4 bytes (e.g., 6): IPv4 Tunnel Mode Crypt Offset non-negative integer with units of 4 bytes (e.g., 11): IPv6 Tunnel Mode Crypt Offset virtual cookie string (either "vc" or "no-vc") Include VC in PSP Header The program uses OpenSSL crypto libraries. psp_decrypt ----------- Program to perform PSP decryption. Reads PSP-encrypted packets from a pcap input file. Performs the following for each packet: - Removes the PSP encapsulation (supports transport and tunnel encaps) - Checks that ICV is correct - Decrypts data Then writes each cleartext packet to a pcap output Command Line Args: [-c psp_cfg_file_name] [-i input_file_name] [-o output_file_name] [-v] -v enables verbose mode Defaults: psp_cfg_file: "psp_decrypt.cfg" input_file_name: "psp_encrypt.pcap" output_file_name: "psp_decrypt.pcap" The format of the PSP encryption configuration file is: series of 32 hex bytes (e.g., 34 44 8a ...): Master Key 0 series of 32 hex bytes (e.g., 56 39 52 ...): Master Key 1 The program uses OpenSSL crypto libraries. /pcap ===== Contains the following files with cleartext packets created by the create_pcap program: v4_cleartext.pcap v6_cleartext.pcap v4_cleartext_empty.pcap v6_cleartext_empty.pcap The cleartext packets are used as input for the test cases. The files with the '_empty' suffix contain packets with an L4 payload size of 0 bytes. There is also '.txt' version of each cleartext pcap file. These files have names of the form 'v4_cleartext_pcap.txt'. The '.txt' files are created using 'tcpdump' as follows: tcpdump -qns 0 -xx -r v4_cleartext.pcap > v4_cleartext_pcap.txt The purpose of the '.txt' files is to enable a 'diff' of the files input to the test cases and the files output by the test cases. In general, the test cases operate as follows: - a cleartext packet is encrypted by psp_encrypt - the output from psp_encrypt is used as input to psp_decrypt - the output from psp_decrypt is compared against the original cleartext packet Other pcap files will be created in the /pcap subdirectory when the test cases execute. /cfg ==== Contains configuration files used as input to psp_encrypt and psp_decrypt. There are multiple configuration files with different values for the various test cases. /test ===== Contains a suite of test cases, which are described below. all_tests execute all the test cases v4_transport_crypt_off_128 IPv4 input packet, transport mode encapsulation, encryption starts after L4 ports, AES-GCM-128, v4_transport_no_crypt_off_128 same as v4_transport_crypt_off_128 except encryption starts afer PSP header v4_transport_crypt_off_128_vc same as v4_transport_crypt_off_128 except PSP header includes a Virtualization Cookie (VC) field v4_transport_no_crypt_off_128_vc same as v4_transport_no_crypt_off_128 except PSP header includes a VC field, in this test case the VC field is encrypted v4_transport_crypt_off_128_empty similar to v4_transport_crypt_off_128 except size of L4 payload is 0 bytes and crypt off is configured such that no encryption is performed only authentication v4_transport_crypt_off_256 same as v4_transport_crypt_off_128 except uses AES-GCM-256 v4_transport_no_crypt_off_256 same as v4_transport_no_crypt_off_128 except uses AES-GCM-256 v4_transport_crypt_off_128_err a single bit error is forced in the packet after encryption and ICV computation, the expected result is an authentication failure v4_tunnel_crypt_off_128 v4_tunnel_no_crypt_off_128 v4_tunnel_crypt_off_256 v4_tunnel_no_crypt_off_256 same as transport mode tests with similar names except that tunnel mode encapsulation is used v6_transport_crypt_off_128 v6_transport_no_crypt_off_128 v6_transport_crypt_off_256 v6_transport_no_crypt_off_256 v6_tunnel_crypt_off_128 v6_tunnel_no_crypt_off_128 v6_tunnel_crypt_off_256 v6_tunnel_no_crypt_off_256 v6_tunnel_crypt_off_256_vc v6_tunnel_no_crypt_off_256_vc v6_tunnel_crypt_off_256_empty v6_tunnel_crypt_off_256_err same as IPv4 tests with similar names except that IPv6 input packet is used
Dear teachers
I am a follower of this project. I have a problem recently. I read the chapter of Key Derivation , but I don't quite understand how to generate secret keys for a psp stream. Could you please tell me the detail of initial handshaking ๏ผ
64-bit SPIs would dramatically simplify implementations, at least inasmuch as they avoid needing premature key rotations.
Hi
is there any utilitity (like strongswan for esp) which can be used to test PSP between two hosts? Is there any linux kernel that supports PSP?
Thank you
I can't use neper to test psp at first. Then I use command sudo ethtool -k ens33 | grep psp
to check my interface config.
It shows :
tx-tcp-psp-segmentation: off [fixed] psp-ip: off [fixed]
And I tried to turn them on using sudo ethtool -K ens33 psp-ip on
.
Then it showed :
Actual changes: psp-ip: off [requested on] Could not change any device features
Is this because my Nic doesn't support PSP?
There's a couple of typos worth fixing in the arch spec, I would submit a PR but there's no source for the PDF.
In the "Why PSP" section:
PSP uses an AEAD (Authenticated Encryption with Associated Data) method
withallows exposing things like the source and destination port numbers in
cleartext, which in turn enables firewalling/routing without decryption by
intermediate nodes in the network and richer network monitoring based on
packet sampling.
"with" -> "which".
In the "PSP Architecture -> Security Association (SA)" section:
Crypt Offset specifying the amount of
packetafter the IV allowed to be cleartext (but still
authenticated) when operating in AES-GCM mode
"packet" -> "bytes".
It is unclear how an SPI can last longer than the underlying master key in the NIC. In particular, there must be a way for receiver-side software to communicate new keys to the sender, and for there to be enough overlap (where both new and old keys are allowed) to avoid packet drops.
I didn't see any mention of the AAD format in the spec. I think it should be added.
Looking at the code I see the AAD is the entire PSP header plus any non-encrypted bytes (i.e., based on the crypt offset).
The specification claims that TCP with ISN randomization and PAWS provides good replay protection, but gives no proof.
A standard API for on-NIC firmware implementing PSP to coordinate with the host would be useful, as it would reduce the amount of hardware-specific driver code.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.