diff options
Diffstat (limited to 'src/crypto')
-rw-r--r-- | src/crypto/privkey.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/crypto/privkey.c b/src/crypto/privkey.c index 0b10e9cf..7ef04880 100644 --- a/src/crypto/privkey.c +++ b/src/crypto/privkey.c @@ -69,6 +69,12 @@ struct asn1_cursor private_key = { .len = ( ( size_t ) private_key_len ), }; +/** Default private key */ +static struct asn1_cursor default_private_key = { + .data = private_key_data, + .len = ( ( size_t ) private_key_len ), +}; + /** Private key setting */ static struct setting privkey_setting __setting ( SETTING_CRYPTO, privkey ) = { .name = "privkey", @@ -92,8 +98,8 @@ static int privkey_apply_settings ( void ) { if ( ALLOW_KEY_OVERRIDE ) { /* Restore default private key */ - private_key.data = private_key_data; - private_key.len = ( ( size_t ) private_key_len ); + memcpy ( &private_key, &default_private_key, + sizeof ( private_key ) ); /* Fetch new private key, if any */ free ( key_data ); |