@@ -179,13 +179,13 @@ apr_status_t ssl_load_encrypted_pkey(server_rec *s, apr_pool_t *p, int idx,
179179 * are used to give a better idea as to what failed.
180180 */
181181 if (pkey_mtime ) {
182- ssl_asn1_t * asn1 = ssl_asn1_table_get (mc -> retained -> privkeys , key_id );
183- if (asn1 && (asn1 -> source_mtime == pkey_mtime )) {
184- ap_log_error (APLOG_MARK , APLOG_INFO , 0 , s , APLOGNO (02575 )
185- "Reusing existing private key from %s on restart" ,
186- ppcb_arg .pkey_file );
187- return APR_SUCCESS ;
188- }
182+ ssl_asn1_t * asn1 = ssl_asn1_table_get (mc -> retained -> privkeys , key_id );
183+ if (asn1 && (asn1 -> source_mtime == pkey_mtime )) {
184+ ap_log_error (APLOG_MARK , APLOG_INFO , 0 , s , APLOGNO (02575 )
185+ "Reusing existing private key from %s on restart" ,
186+ ppcb_arg .pkey_file );
187+ return APR_SUCCESS ;
188+ }
189189 }
190190
191191 ap_log_error (APLOG_MARK , APLOG_INFO , 0 , s , APLOGNO (02576 )
@@ -338,6 +338,11 @@ apr_status_t ssl_load_encrypted_pkey(server_rec *s, apr_pool_t *p, int idx,
338338 /* Cache the private key in the global module configuration so it
339339 * can be used after subsequent reloads. */
340340 asn1 = ssl_asn1_table_set (mc -> retained -> privkeys , key_id , pPrivateKey );
341+ if (!asn1 ) {
342+ ap_log_error (APLOG_MARK , APLOG_EMERG , 0 , s ,
343+ "mod_ssl: Failed to cache private key" );
344+ return ssl_die (s );
345+ }
341346
342347 if (ppcb_arg .nPassPhraseDialogCur != 0 ) {
343348 /* remember mtime of encrypted keys */
@@ -1024,4 +1029,4 @@ apr_status_t modssl_load_engine_keypair(server_rec *s,
10241029 vhostid , certid ? certid : "no cert" , keyid );
10251030 return APR_ENOTIMPL ;
10261031#endif
1027- }
1032+ }
0 commit comments