Build on IOS : more agressive sshkey support stripping, worked arround LLVM making undefined symbol when calling non static inline c function, stripped useless project settings

master
Edouard Tisserant 8 years ago
parent 0af98ad54a
commit 770366be34

@ -315,11 +315,9 @@
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
@ -337,7 +335,6 @@
"$(inherited)",
"$(OPENSSL_SRC)/include",
);
IPHONEOS_DEPLOYMENT_TARGET = 8.3;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
@ -361,7 +358,6 @@
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
@ -377,7 +373,6 @@
"$(inherited)",
"$(OPENSSL_SRC)/include",
);
IPHONEOS_DEPLOYMENT_TARGET = 8.3;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;

@ -81,7 +81,6 @@ __RCSID("$NetBSD$");
#include "readerwriter.h"
#include "netpgpdefs.h"
#include "crypto.h"
#include "ssh2pgp.h"
#include "defs.h"
/* read any gpg config file */
@ -242,86 +241,6 @@ readkeyring(netpgp_t *netpgp,
return 1;
}
/* read keys from ssh key files */
static int
readsshkeys(netpgp_t *netpgp, char *homedir, const char *needseckey)
{
pgp_keyring_t *pubring;
pgp_keyring_t *secring;
struct stat st;
unsigned hashtype;
char *hash;
char f[MAXPATHLEN];
char *filename;
if ((filename = netpgp_getvar(netpgp, "sshkeyfile")) == NULL) {
/* set reasonable default for RSA key */
(void) snprintf(f, sizeof(f), "%s/id_rsa.pub", homedir);
filename = f;
} else if (strcmp(&filename[strlen(filename) - 4], ".pub") != 0) {
/* got ssh keys, check for pub file name */
(void) snprintf(f, sizeof(f), "%s.pub", filename);
filename = f;
}
/* check the pub file exists */
if (stat(filename, &st) != 0) {
(void) fprintf(stderr, "readsshkeys: bad pubkey filename '%s'\n", filename);
return 0;
}
if ((pubring = calloc(1, sizeof(*pubring))) == NULL) {
(void) fprintf(stderr, "readsshkeys: bad alloc\n");
return 0;
}
/* openssh2 keys use md5 by default */
hashtype = PGP_HASH_MD5;
if ((hash = netpgp_getvar(netpgp, "hash")) != NULL) {
/* openssh 2 hasn't really caught up to anything else yet */
if (netpgp_strcasecmp(hash, "md5") == 0) {
hashtype = PGP_HASH_MD5;
} else if (netpgp_strcasecmp(hash, "sha1") == 0) {
hashtype = PGP_HASH_SHA1;
} else if (netpgp_strcasecmp(hash, "sha256") == 0) {
hashtype = PGP_HASH_SHA256;
}
}
if (!pgp_ssh2_readkeys(netpgp->io, pubring, NULL, filename, NULL, hashtype)) {
free(pubring);
(void) fprintf(stderr, "readsshkeys: can't read %s\n",
filename);
return 0;
}
if (netpgp->pubring == NULL) {
netpgp->pubring = pubring;
} else {
pgp_append_keyring(netpgp->pubring, pubring);
}
if (needseckey) {
netpgp_setvar(netpgp, "sshpubfile", filename);
/* try to take the ".pub" off the end */
if (filename == f) {
f[strlen(f) - 4] = 0x0;
} else {
(void) snprintf(f, sizeof(f), "%.*s",
(int)strlen(filename) - 4, filename);
filename = f;
}
if ((secring = calloc(1, sizeof(*secring))) == NULL) {
free(pubring);
(void) fprintf(stderr, "readsshkeys: bad alloc\n");
return 0;
}
if (!pgp_ssh2_readkeys(netpgp->io, pubring, secring, NULL, filename, hashtype)) {
free(pubring);
free(secring);
(void) fprintf(stderr, "readsshkeys: can't read sec %s\n", filename);
return 0;
}
netpgp->secring = secring;
netpgp_setvar(netpgp, "sshsecfile", filename);
}
return 1;
}
/* get the uid of the first key in the keyring */
static int
get_first_ring(pgp_keyring_t *ring, char *id, size_t len, int last)
@ -732,7 +651,7 @@ netpgp_init(netpgp_t *netpgp)
} else {
/* read from ssh keys */
last = (netpgp->pubring != NULL);
if (!readsshkeys(netpgp, homedir, netpgp_getvar(netpgp, "need seckey"))) {
if (1) {
(void) fprintf(io->errs, "Can't read ssh keys\n");
return 0;
}

@ -1111,7 +1111,7 @@ pgp_validate_file(pgp_io_t *io,
\note It is the caller's responsiblity to call
pgp_validate_result_free(result) after use.
*/
inline unsigned
static inline unsigned
_pgp_validate_mem(pgp_io_t *io,
pgp_validation_t *result,
pgp_memory_t *mem,

Loading…
Cancel
Save