Browse Source

Initial port to Sequoia.

generate_api archive/sequoia
Neal Walfield 3 years ago
parent
commit
0b8033b218
9 changed files with 2318 additions and 6 deletions
  1. +7
    -2
      default.conf
  2. +7
    -2
      src/Makefile
  3. +4
    -0
      src/cryptotech.c
  4. +4
    -0
      src/openpgp_compat.h
  5. +15
    -0
      src/pEp_internal.h
  6. +2151
    -0
      src/pgp_sequoia.c
  7. +115
    -0
      src/pgp_sequoia.h
  8. +6
    -0
      src/pgp_sequoia_internal.h
  9. +9
    -2
      test/Makefile

+ 7
- 2
default.conf View File

@ -204,8 +204,8 @@ SQLITE3_FROM_OS=placeholder
# gpgconf is not available for old version of GPG, for example GPG 2.0.30. Override this variable, if you compile the engine for such an old version.
GPG_CMD:=$(shell gpgconf --list-components | awk -F: '/^gpg:/ { print $$3; exit 0; }')
# Selects OpenPGP implementation. must be either `GPG` or `NETPGP`
OPENPGP=GPG
# Selects OpenPGP implementation. must be either `GPG` or `NETPGP` or `SEQUOIA`
OPENPGP=SEQUOIA
# Path of libGPGME binary
ifeq ($(BUILD_FOR),Linux)
@ -236,6 +236,11 @@ NETPGP_LIB=
NETPGP_INC=
#NETPGP_INC=-I$(PREFIX)/include
SEQUOIA_CFLAGS=$(shell pkg-config --cflags-only-other sequoia)
SEQUOIA_LDFLAGS=$(shell pkg-config --libs-only-L --libs-only-other sequoia)
SEQUOIA_LIB=$(shell pkg-config --libs-only-l sequoia)
SEQUOIA_INC=$(shell pkg-config --cflags-only-I sequoia)
######### OpenPGP #########
# CppUnit library search flag


+ 7
- 2
src/Makefile View File

@ -35,15 +35,20 @@ ifdef SQLITE3_FROM_OS
endif
ifeq ($(OPENPGP),GPG)
NO_SOURCE+= pgp_netpgp.c
NO_SOURCE+= pgp_netpgp.c pgp_sequoia.c
CFLAGS+= -DUSE_GPG $(GPGME_INC) -DLIBGPGME=\"$(LIBGPGME)\"
LDFLAGS+= $(GPGME_LIB)
# No extra LDLIBS are needed here, because GPGME is dynamically loaded
else ifeq ($(OPENPGP),NETPGP)
NO_SOURCE+= pgp_gpg.c
NO_SOURCE+= pgp_gpg.c pgp_sequoia.c
CFLAGS+= -DUSE_NETPGP $(NETGPG_INC)
LDFLAGS+= $(NETGPG_LIB)
LDLIBS+= -lnetpgp -lcurl
else ifeq ($(OPENPGP),SEQUOIA)
NO_SOURCE+= pgp_gpg.c pgp_netpgp.c
CFLAGS+= -DUSE_SEQUOIA $(SEQUOIA_CFLAGS) $(SEQUOIA_INC)
LDFLAGS+= $(SEQUOIA_LDFLAGS)
LDLIBS+= $(SEQUOIA_LIB)
else
$(error Unknown OpenPGP library: $(OPENPGP))
endif


+ 4
- 0
src/cryptotech.c View File

@ -8,6 +8,10 @@
#else
#ifdef USE_NETPGP
#include "pgp_netpgp.h"
#else
#ifdef USE_SEQUOIA
#include "pgp_sequoia.h"
#endif
#endif
#endif
//


+ 4
- 0
src/openpgp_compat.h View File

@ -24,6 +24,10 @@ extern "C" {
#else
#ifdef USE_NETPGP
#include "pgp_netpgp.h"
#else
#ifdef USE_SEQUOIA
#include "pgp_sequoia.h"
#endif
#endif
#endif


+ 15
- 0
src/pEp_internal.h View File

@ -91,16 +91,20 @@
#include "pEpEngine.h"
// If not specified, build for GPG
#ifndef USE_SEQUOIA
#ifndef USE_NETPGP
#ifndef USE_GPG
#define USE_GPG
#endif
#endif
#endif
#ifdef USE_GPG
#include "pgp_gpg_internal.h"
#elif defined(USE_NETPGP)
#include "pgp_netpgp_internal.h"
#elif defined(USE_SEQUOIA)
#include "pgp_sequoia_internal.h"
#endif
#include "keymanagement.h"
@ -123,6 +127,17 @@ struct _pEpSession {
gpgme_ctx_t ctx;
#elif defined(USE_NETPGP)
pEpNetPGPSession ctx;
#elif defined(USE_SEQUOIA)
sq_context_t ctx;
sq_store_t store;
sqlite3 *key_db;
sqlite3_stmt *begin_transaction;
sqlite3_stmt *commit_transaction;
sqlite3_stmt *rollback_transaction;
sqlite3_stmt *tsk_save_insert_primary;
sqlite3_stmt *tsk_save_insert_subkeys;
sqlite3_stmt *tsk_all;
sqlite3_stmt *tsk_find_by_keyid;
#endif
PEP_cryptotech_t *cryptotech;


+ 2151
- 0
src/pgp_sequoia.c
File diff suppressed because it is too large
View File


+ 115
- 0
src/pgp_sequoia.h View File

@ -0,0 +1,115 @@
// This file is under GNU General Public License 3.0
// see LICENSE.txt
#pragma once
#include "pEpEngine.h"
PEP_STATUS pgp_init(PEP_SESSION session, bool in_first);
void pgp_release(PEP_SESSION session, bool out_last);
PEP_STATUS pgp_decrypt_and_verify(
PEP_SESSION session, const char *ctext, size_t csize,
const char *dsigtext, size_t dsigsize,
char **ptext, size_t *psize, stringlist_t **keylist,
char** filename_ptr
);
PEP_STATUS pgp_encrypt_and_sign(
PEP_SESSION session, const stringlist_t *keylist, const char *ptext,
size_t psize, char **ctext, size_t *csize
);
PEP_STATUS pgp_sign_only(
PEP_SESSION session, const char* fpr, const char *ptext,
size_t psize, char **stext, size_t *ssize
);
PEP_STATUS pgp_encrypt_only(
PEP_SESSION session, const stringlist_t *keylist, const char *ptext,
size_t psize, char **ctext, size_t *csize
);
PEP_STATUS pgp_verify_text(
PEP_SESSION session, const char *text, size_t size,
const char *signature, size_t sig_size, stringlist_t **keylist
);
PEP_STATUS pgp_delete_keypair(PEP_SESSION session, const char *fpr);
PEP_STATUS pgp_export_keydata(
PEP_SESSION session, const char *fpr, char **key_data, size_t *size,
bool secret
);
PEP_STATUS pgp_find_keys(
PEP_SESSION session, const char *pattern, stringlist_t **keylist
);
PEP_STATUS pgp_list_keyinfo(
PEP_SESSION session, const char* pattern, stringpair_list_t** keyinfo_list
);
PEP_STATUS pgp_generate_keypair(
PEP_SESSION session, pEp_identity *identity
);
PEP_STATUS pgp_get_key_rating(
PEP_SESSION session,
const char *fpr,
PEP_comm_type *comm_type
);
PEP_STATUS pgp_import_keydata(PEP_SESSION session, const char *key_data,
size_t size, identity_list **private_idents);
PEP_STATUS pgp_import_private_keydata(PEP_SESSION session, const char *key_data,
size_t size, identity_list **private_idents);
PEP_STATUS pgp_recv_key(PEP_SESSION session, const char *pattern);
PEP_STATUS pgp_send_key(PEP_SESSION session, const char *pattern);
PEP_STATUS pgp_renew_key(
PEP_SESSION session,
const char *fpr,
const timestamp *ts
);
PEP_STATUS pgp_revoke_key(
PEP_SESSION session,
const char *fpr,
const char *reason
);
PEP_STATUS pgp_key_expired(
PEP_SESSION session,
const char *fpr,
const time_t when,
bool *expired
);
PEP_STATUS pgp_key_revoked(
PEP_SESSION session,
const char *fpr,
bool *revoked
);
PEP_STATUS pgp_key_created(
PEP_SESSION session,
const char *fpr,
time_t *created
);
PEP_STATUS pgp_contains_priv_key(
PEP_SESSION session,
const char *fpr,
bool *has_private);
PEP_STATUS pgp_find_private_keys(
PEP_SESSION session, const char *pattern, stringlist_t **keylist
);
PEP_STATUS pgp_binary(const char **path);
#define PGP_BINARY_PATH pgp_binary

+ 6
- 0
src/pgp_sequoia_internal.h View File

@ -0,0 +1,6 @@
// This file is under GNU General Public License 3.0
// see LICENSE.txt
#pragma once
#include <sequoia.h>

+ 9
- 2
test/Makefile View File

@ -41,6 +41,13 @@ ifeq ($(BUILD_FOR),Linux)
endif
endif
ifeq ($(OPENPGP),SEQUOIA)
LDFLAGS+= $(SEQUOIA_LDFLAGS)
LDLIBS+= $(SEQUOIA_LIB)
CFLAGS+= $(SEQUOIA_CFLAGS)
INC_FLAGS+= $(SEQUOIA_INC)
endif
ifdef SQLITE3_FROM_OS
LDLIBS+= -lsqlite3
endif
@ -121,8 +128,8 @@ endif
.PHONY: test
test: all
$(TEST_DEBUGGER) ./$(TARGET)
ulimit -n 20000; $(TEST_DEBUGGER) ./$(TARGET)
.PHONY: clean
clean:
$(RM) $(TARGET) $(OBJS) $(DEPS)


Loading…
Cancel
Save