projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Don't use wildcards in filenames in configure.in.
[tinc]
/
src
/
openssl
/
ecdh.c
diff --git
a/src/openssl/ecdh.c
b/src/openssl/ecdh.c
index
7640674
..
8432420
100644
(file)
--- a/
src/openssl/ecdh.c
+++ b/
src/openssl/ecdh.c
@@
-28,13
+28,6
@@
#include "ecdh.h"
#include "logger.h"
#include "ecdh.h"
#include "logger.h"
-// TODO: proper KDF
-static void *kdf(const void *in, size_t inlen, void *out, size_t *outlen) {
- memcpy(out, in, inlen);
- *outlen = inlen;
- return out;
-}
-
bool ecdh_generate_public(ecdh_t *ecdh, void *pubkey) {
*ecdh = EC_KEY_new_by_curve_name(NID_secp521r1);
if(!EC_KEY_generate_key(*ecdh)) {
bool ecdh_generate_public(ecdh_t *ecdh, void *pubkey) {
*ecdh = EC_KEY_new_by_curve_name(NID_secp521r1);
if(!EC_KEY_generate_key(*ecdh)) {
@@
-59,14
+52,18
@@
bool ecdh_generate_public(ecdh_t *ecdh, void *pubkey) {
bool ecdh_compute_shared(ecdh_t *ecdh, const void *pubkey, void *shared) {
EC_POINT *point = EC_POINT_new(EC_KEY_get0_group(*ecdh));
bool ecdh_compute_shared(ecdh_t *ecdh, const void *pubkey, void *shared) {
EC_POINT *point = EC_POINT_new(EC_KEY_get0_group(*ecdh));
+ if(!point) {
+ logger(LOG_ERR, "EC_POINT_new() failed: %s", ERR_error_string(ERR_get_error(), NULL));
+ abort();
+ }
int result = EC_POINT_oct2point(EC_KEY_get0_group(*ecdh), point, pubkey, ECDH_SIZE, NULL);
int result = EC_POINT_oct2point(EC_KEY_get0_group(*ecdh), point, pubkey, ECDH_SIZE, NULL);
- if(!
poin
t) {
+ if(!
resul
t) {
logger(LOG_ERR, "Converting binary to EC_POINT failed: %s", ERR_error_string(ERR_get_error(), NULL));
abort();
}
logger(LOG_ERR, "Converting binary to EC_POINT failed: %s", ERR_error_string(ERR_get_error(), NULL));
abort();
}
- result = ECDH_compute_key(shared, ECDH_SIZE, point, *ecdh,
kdf
);
+ result = ECDH_compute_key(shared, ECDH_SIZE, point, *ecdh,
NULL
);
EC_POINT_free(point);
EC_KEY_free(*ecdh);
*ecdh = NULL;
EC_POINT_free(point);
EC_KEY_free(*ecdh);
*ecdh = NULL;