]> git.meshlink.io Git - meshlink/commitdiff
Don't abort() on low-level crypto errors, just return false.
authorGuus Sliepen <guus@tinc-vpn.org>
Wed, 20 Jul 2011 06:19:18 +0000 (08:19 +0200)
committerGuus Sliepen <guus@tinc-vpn.org>
Wed, 20 Jul 2011 06:19:18 +0000 (08:19 +0200)
The abort() calls were accidentily left in for debugging.

src/openssl/ecdh.c
src/openssl/ecdsa.c

index 4dd399f8c8f42464343625cbb25768e05cf06a02..804605c43908379264859d91062080e0e08a49de 100644 (file)
@@ -32,19 +32,19 @@ bool ecdh_generate_public(ecdh_t *ecdh, void *pubkey) {
        *ecdh = EC_KEY_new_by_curve_name(NID_secp521r1);
        if(!EC_KEY_generate_key(*ecdh)) {
                logger(LOG_ERR, "Generating EC key failed: %s", ERR_error_string(ERR_get_error(), NULL));
-               abort();
+               return false;
        }
        
        const EC_POINT *point = EC_KEY_get0_public_key(*ecdh);
        if(!point) {
                logger(LOG_ERR, "Getting public key failed: %s", ERR_error_string(ERR_get_error(), NULL));
-               abort();
+               return false;
        }
 
        size_t result = EC_POINT_point2oct(EC_KEY_get0_group(*ecdh), point, POINT_CONVERSION_COMPRESSED, pubkey, ECDH_SIZE, NULL);
        if(!result) {
                logger(LOG_ERR, "Converting EC_POINT to binary failed: %s", ERR_error_string(ERR_get_error(), NULL));
-               abort();
+               return false;
        }
 
        return true;
@@ -54,13 +54,13 @@ 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();
+               return false;
        }
 
        int result = EC_POINT_oct2point(EC_KEY_get0_group(*ecdh), point, pubkey, ECDH_SIZE, NULL);
        if(!result) {
                logger(LOG_ERR, "Converting binary to EC_POINT failed: %s", ERR_error_string(ERR_get_error(), NULL));
-               abort();
+               return false;
        }
 
        result = ECDH_compute_key(shared, ECDH_SIZE, point, *ecdh, NULL);
index 43464d8835b60c9c37280c682b14e2696965d5f3..85c6a47b38eb89507dc0d0f7435c9dd847d70908 100644 (file)
@@ -38,7 +38,7 @@ bool ecdsa_set_base64_public_key(ecdsa_t *ecdsa, const char *p) {
 
        if(!o2i_ECPublicKey(ecdsa, &ppubkey, len)) {
                logger(LOG_DEBUG, "o2i_ECPublicKey failed: %s", ERR_error_string(ERR_get_error(), NULL));
-               abort();
+               return false;
        }
 
        return true;