~aritra1911/openssl_madness

48d61be2cda21a07120eaa5ab77e1b9372554445 — Aritra Sarkar 2 years ago e4edeaf
Update Makefile
2 files changed, 12 insertions(+), 8 deletions(-)

M Makefile
M notes.txt
M Makefile => Makefile +9 -5
@@ 1,11 1,15 @@
CFLAGS = -Wall -Wextra -pedantic -std=c99
LIBS = -lcrypto

ifdef OPENSSLDIR
	IDIR = -I$(OPENSSLDIR)/include
	LDIR = -L$(OPENSSLDIR)/lib -L$(OPENSSLDIR)/lib64
	CFLAGS += -I$(OPENSSLDIR)/include
	LDFLAGS += -L$(OPENSSLDIR)/lib -L$(OPENSSLDIR)/lib64 \
		   -Wl,--enable-new-dtags,-rpath,$(OPENSSLDIR)/lib \
		   -Wl,--enable-new-dtags,-rpath,$(OPENSSLDIR)/lib64
endif

CFLAGS += -Wall -Wextra -pedantic -std=c99
LDFLAGS += $(LIBS)

ifneq ($(strip $(DEBUG)),)
	CFLAGS += -g -O0
endif


@@ 15,10 19,10 @@ endif
all: madness

madness: madness.o
	$(CC) $(LIBS) $(LDIR) -o $@ $^
	$(CC) $(LDFLAGS) -o $@ $^

madness.o: madness.c
	$(CC) $(CFLAGS) $(IDIR) -c -o $@ $^
	$(CC) $(CFLAGS) -c -o $@ $^

clean:
	$(RM) *.o madness

M notes.txt => notes.txt +3 -3
@@ 31,12 31,12 @@ Hello, World!
#################

# Test whether encryption works or not.
$ fortune -s | ./madness -e -k pubkey.pem | /opt/openssl-3.0.0-beta1/bin/openssl pkeyutl -decrypt -inkey key.pem -pkeyopt rsa_padding_mode:oaep
$ fortune -s | ./madness -e -k pubkey.pem | /opt/openssl/bin/openssl pkeyutl -decrypt -inkey key.pem -pkeyopt rsa_padding_mode:oaep


# Test whether decryption works or not.
❯ fortune -s | /usr/local/build/openssl-3.0.0-beta1/bin/openssl pkeyutl -encrypt -inkey pubkey.pem -pubin -pkeyopt rsa_padding_mode:oaep | ./madness -dk key.pem
$ fortune -s | /opt/openssl/bin/openssl pkeyutl -encrypt -inkey pubkey.pem -pubin -pkeyopt rsa_padding_mode:oaep | ./madness -dk key.pem

# OR : Use our own tool #

❯ fortune -l | ./madness -ek pubkey.pem | ./madness -dk key.pem
$ fortune -l | ./madness -ek pubkey.pem | ./madness -dk key.pem