Pure C client for PurritoBin and other networking projects
Go to file
Érico Rolim 1fc274535e Fix compilation under glibc.
Some feature macros behaved differently from the ones in musl.
2020-09-24 20:48:22 -03:00
extern/libbaseencode Fix code for C99 compliance, add -pedantic. 2020-09-20 22:18:29 -03:00
.gitignore Add very simple gemini client. 2020-09-18 19:52:42 -03:00
LICENSE Add README and LICENSE. 2020-09-13 21:40:15 -03:00
README.md Add configure script to make it work on BSD. 2020-09-14 10:20:48 -03:00
comm.c Fix code for C99 compliance, add -pedantic. 2020-09-20 22:18:29 -03:00
configure Add configure script to make it work on BSD. 2020-09-14 10:20:48 -03:00
encrypt.c Fix bug in decrypt_mmap. 2020-09-17 16:21:27 -03:00
files.c Enable streams for read_from_mmap. 2020-09-24 03:40:38 -03:00
formats.c Add get_encryption_params. 2020-09-13 20:17:03 -03:00
gemi.c Fix compilation under glibc. 2020-09-24 20:48:22 -03:00
gemini.c Enable very ugly browsing with gemini client. 2020-09-24 04:00:40 -03:00
gemini.h Split scheme detection logic, use where possible. 2020-09-24 05:05:34 -03:00
makefile Update gemini client. 2020-09-24 03:29:59 -03:00
mmap_file.c Fix compilation under glibc. 2020-09-24 20:48:22 -03:00
mmap_file.h Fix compilation under glibc. 2020-09-24 20:48:22 -03:00
purr.c Fix compilation under glibc. 2020-09-24 20:48:22 -03:00
purr.h Split scheme detection logic, use where possible. 2020-09-24 05:05:34 -03:00
read_certs.c Add and use bearssl_free_certs. 2020-09-17 16:21:13 -03:00
read_certs.h Add and use bearssl_free_certs. 2020-09-17 16:21:13 -03:00
socket.c Split functionality into different files. 2020-09-10 23:33:52 -03:00
tests.c Split scheme detection logic, use where possible. 2020-09-24 05:05:34 -03:00
urls.c Fix compilation under glibc. 2020-09-24 20:48:22 -03:00

README.md

purr-c

This is a pure C client for the PurritoBin pastebin server, and uses PurritoBin's author's instance in https://bsd.ac by default.

It was written as an exercise for learning network and crypto libraries, and uses BearSSL for symmetric encryption (supported by PurritoBin's online interface as well as its suggested clients) and SSL interaction with the server. libbaseencode has been vendored in (can be found in external/libbaseencode), but has also gone through some changes, namely removing null-byte checking from the base64 encoding function, adding an output length parameter to the base64 decoding function and fixing Valgrind warnings about out-of-bounds accesses.

The code has a few instances of // TODO: remove hack comments and the like, which I hope to get to someday.

Usage

Usage information can be viewed with purr -h.

Build dependencies

The only external dependency is BearSSL, and GNU Make and a C compiler are required for building. This program can use either Linux's getrandom(2) system call or BSD's arc4random_buf(3) function.

Building

$ ./configure # creates config.mk
$ make
$ make install PREFIX=$HOME/.local/bin

Acknowledgements

  • Thomas Pornin for BearSSL
  • Laurent Bercot for s6-networking (even though it's no longer in use here)
  • epsilon-0 for PurritoBin (and the valuable help while I was testing this program)
  • paolostivanin for libbaseencode