changed key derivation function, using scrypt (from tarsnap) now instead of my own derivation function

This commit is contained in:
git@daemon.de
2014-01-16 15:25:09 +01:00
parent ce0ec4d5ec
commit 691786cc68
66 changed files with 5449 additions and 1042 deletions

View File

@@ -1,4 +1,4 @@
# Makefile.in generated by automake 1.12.4 from Makefile.am.
# Makefile.in generated by automake 1.12.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2012 Free Software Foundation, Inc.

View File

@@ -18,6 +18,7 @@ extern "C" {
#include "pcp/pad.h"
#include "pcp/platform.h"
#include "pcp/randomart.h"
#include "pcp/scrypt.h"
#include "pcp/uthash.h"
#include "pcp/vault.h"
#include "pcp/version.h"

View File

@@ -6,9 +6,13 @@
/* Define to 1 if you have the <arpa/inet.h> header file. */
#undef HAVE_ARPA_INET_H
/* Define to 1 if you have the `be32toh' function. */
/* Define if be32toh() is available */
#undef HAVE_BE32TOH
/* Define to 1 if you have the declaration of `be64enc', and to 0 if you
don't. */
#undef HAVE_DECL_BE64ENC
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
@@ -48,7 +52,7 @@
/* Define to 1 if you have the `getopt_long' function. */
#undef HAVE_GETOPT_LONG
/* Define to 1 if you have the `htobe32' function. */
/* Define if htobe32() is available */
#undef HAVE_HTOBE32
/* Define to 1 if you have the <inttypes.h> header file. */
@@ -81,6 +85,9 @@
/* Define to 1 if you have the `perror' function. */
#undef HAVE_PERROR
/* Define to 1 if you have the `posix_memalign' function. */
#undef HAVE_POSIX_MEMALIGN
/* Define to 1 if you have the `sizeof' function. */
#undef HAVE_SIZEOF

View File

@@ -37,6 +37,7 @@
#include "z85.h"
#include "uthash.h"
#include "jenhash.h"
#include "scrypt.h"
/*
PCP private key structure. Most fields are self explanatory.
@@ -138,20 +139,8 @@ unsigned char * pcp_gennonce();
void pcpedit_key(char *keyid);
// proprietary key derivation function. derives an
// secure encryption key from the given passphrase by
// calculating a SALSA20 hash from it HCYCLES times.
//
// turns the result into a proper CURVE25519 secret
// key. allocates memory for key and it is up to the
// user to free it after use.
//
// deprecation warning: maybe removed once the libsodium
// developers incorporated some key derivation function
// into libsodium. so far, there's none but word goes
// that perhaps something like scrypt() from the star
// distribution may be added in the future.
unsigned char *pcp_derivekey(char *passphrase);
// use scrypt() to create a key from a passphrase and a nonce
unsigned char *pcp_derivekey(char *passphrase, unsigned char *nonce);
pcp_key_t *pcp_derive_pcpkey (pcp_key_t *ours, char *theirs);

42
include/pcp/scrypt.h Normal file
View File

@@ -0,0 +1,42 @@
/*
This file is part of Pretty Curved Privacy (pcp1).
Copyright (C) 2013 T.Linden.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
You can contact me by mail: <tlinden AT cpan DOT org>.
*/
#ifndef _HAVE_PCP_SCRYPT_H
#define _HAVE_PCP_SCRYPT_H
#include <sys/types.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <sodium.h>
#include "crypto_scrypt.h"
#include "mem.h"
#include "defines.h"
unsigned char * pcp_scrypt(char *passwd, size_t passwdlen, unsigned char *nonce);
#endif // _HAVE_PCP_SCRYPT_H