/* Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.
*/
/* _ _ * _ __ ___ ___ __| | ___ ___| | mod_ssl * | '_ ` _ \ / _ \ / _` | / __/ __| | Apache Interface to OpenSSL * | | | | | | (_) | (_| | \__ \__ \ | * |_| |_| |_|\___/ \__,_|___|___/___/_| * |_____| * ssl_engine_rand.c * Random Number Generator Seeding
*/ /* ``The generation of random numbers is too important
to be left to chance.'' */
#include"ssl_private.h"
/* _________________________________________________________________ ** ** Support for better seeding of SSL library's RNG ** _________________________________________________________________
*/
/* * seed in the current time (usually just 4 bytes)
*/
my_seed.t = time(NULL);
/* * seed in the current process id (usually just 4 bytes)
*/
my_seed.pid = mc->pid;
l = sizeof(my_seed);
RAND_seed((unsignedchar *)&my_seed, l);
nDone += l;
/* * seed in some current state of the run-time stack (128 bytes)
*/
n = ssl_rand_choosenum(0, sizeof(stackdata)-128-1);
RAND_seed(stackdata+n, 128);
nDone += 128;
}
}
}
ap_log_error(APLOG_MARK, APLOG_TRACE2, 0, s, "%sSeeding PRNG with %d bytes of entropy", prefix, nDone);
if (RAND_status() == 0)
ap_log_error(APLOG_MARK, APLOG_WARNING, 0, s, APLOGNO(01990) "%sPRNG still contains insufficient entropy!", prefix);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.