Files
lotherk c65e756cac
ci / build (push) Successful in 35s
read the OpenSSH key container ourselves
ssh-keygen -p -m PKCS8 is not a conversion path: on OpenSSH 10.2 (Ubuntu
26.04 LTS) it ignores -m for ed25519 keys, exits 0, and leaves the container,
so every ed25519 decryption failed there. RSA still converted, which hid it.

src/openssh.c now parses the unencrypted openssh-key-v1 container directly:
ed25519 seed plus public key, or RSA n/e/d/iqmp/p/q, with the public and
private halves checked against each other. ssh-keygen is left with one job,
stripping a passphrase (-p -N ''), which works on every version. Unencrypted
keys no longer need the program at all, which the suite now asserts by
running one decryption with PATH=/nonexistent.

Verified on Debian bookworm (OpenSSH 9.2) and Ubuntu 26.04 (10.2).
2026-11-21 17:11:26 +00:00

43 lines
1.1 KiB
Makefile

PREFIX ?= /usr/local
BINDIR ?= $(PREFIX)/bin
MANDIR ?= $(PREFIX)/share/man/man1
CC ?= cc
PKG_CONFIG ?= pkg-config
CFLAGS ?= -O2 -g
override CFLAGS += -std=c99 -D_POSIX_C_SOURCE=200809L -Wall -Wextra -Wpedantic
CPPFLAGS += $(shell $(PKG_CONFIG) --cflags libcrypto 2>/dev/null)
LDLIBS += $(shell $(PKG_CONFIG) --libs libcrypto 2>/dev/null || echo -lcrypto)
SRC = src/main.c src/util.c src/armor.c src/keys.c src/openssh.c src/envelope.c
OBJ = $(SRC:.c=.o)
all: sshcrypt
sshcrypt: $(OBJ)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJ) $(LDLIBS)
%.o: %.c src/sshcrypt.h
$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
check: sshcrypt
tests/run.sh
install: sshcrypt
install -d $(DESTDIR)$(BINDIR)
install -m 0755 sshcrypt $(DESTDIR)$(BINDIR)/sshcrypt
install -d $(DESTDIR)$(MANDIR)
install -m 0644 docs/sshcrypt.1 $(DESTDIR)$(MANDIR)/sshcrypt.1
lint-man:
@if command -v mandoc >/dev/null 2>&1; then \
mandoc -Tlint docs/sshcrypt.1 && echo "man page ok"; \
else \
echo "mandoc not installed, man page not linted"; \
fi
clean:
rm -f $(OBJ) sshcrypt
.PHONY: all check install lint-man clean