tls-crypto: Fix usage of chunk_from_chars()
authorTobias Brunner <tobias@strongswan.org>
Wed, 29 Jan 2020 09:02:38 +0000 (10:02 +0100)
committerTobias Brunner <tobias@strongswan.org>
Thu, 30 Jan 2020 17:18:06 +0000 (18:18 +0100)
See 8ea13bbc5ccd for details.

References #3249.

src/libtls/tls_crypto.c

index 0ec2f5c..ebadb91 100644 (file)
@@ -1409,6 +1409,8 @@ METHOD(tls_crypto_t, sign, bool,
 {
        if (this->tls->get_version(this->tls) >= TLS_1_2)
        {
+               const chunk_t hashsig_def = chunk_from_chars(
+                                       TLS_HASH_SHA1, TLS_SIG_RSA, TLS_HASH_SHA1, TLS_SIG_ECDSA);
                signature_scheme_t scheme;
                bio_reader_t *reader;
                uint8_t hash, alg;
@@ -1417,8 +1419,7 @@ METHOD(tls_crypto_t, sign, bool,
 
                if (!hashsig.len)
                {       /* fallback if none given */
-                       hashsig = chunk_from_chars(
-                               TLS_HASH_SHA1, TLS_SIG_RSA, TLS_HASH_SHA1, TLS_SIG_ECDSA);
+                       hashsig = hashsig_def;
                }
                reader = bio_reader_create(hashsig);
                while (reader->remaining(reader) >= 2)