home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / Servidores / apache_2.2.8-win32-x86-no_ssl.msi / Data1.cab / _E8DDBF5B2409A4A6DDFF824726DC65EB < prev    next >
Text File  |  2006-08-03  |  3KB  |  75 lines

  1. /* Licensed to the Apache Software Foundation (ASF) under one or more
  2.  * contributor license agreements.  See the NOTICE file distributed with
  3.  * this work for additional information regarding copyright ownership.
  4.  * The ASF licenses this file to You under the Apache License, Version 2.0
  5.  * (the "License"); you may not use this file except in compliance with
  6.  * the License.  You may obtain a copy of the License at
  7.  *
  8.  *     http://www.apache.org/licenses/LICENSE-2.0
  9.  *
  10.  * Unless required by applicable law or agreed to in writing, software
  11.  * distributed under the License is distributed on an "AS IS" BASIS,
  12.  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13.  * See the License for the specific language governing permissions and
  14.  * limitations under the License.
  15.  */
  16.  
  17. #ifndef APR_RANDOM_H
  18. #define APR_RANDOM_H
  19.  
  20. #include <apr_pools.h>
  21.  
  22. typedef struct apr_crypto_hash_t apr_crypto_hash_t;
  23.  
  24. typedef void apr_crypto_hash_init_t(apr_crypto_hash_t *hash);
  25. typedef void apr_crypto_hash_add_t(apr_crypto_hash_t *hash,const void *data,
  26.                                    apr_size_t bytes);
  27. typedef void apr_crypto_hash_finish_t(apr_crypto_hash_t *hash,
  28.                                       unsigned char *result);
  29.  
  30. /* FIXME: make this opaque */
  31. struct apr_crypto_hash_t {
  32.     apr_crypto_hash_init_t *init;
  33.     apr_crypto_hash_add_t *add;
  34.     apr_crypto_hash_finish_t *finish;
  35.     apr_size_t size;
  36.     void *data;
  37. };
  38.  
  39. APR_DECLARE(apr_crypto_hash_t *) apr_crypto_sha256_new(apr_pool_t *p);
  40.  
  41. typedef struct apr_random_t apr_random_t;
  42.  
  43. APR_DECLARE(void) apr_random_init(apr_random_t *g,apr_pool_t *p,
  44.                                   apr_crypto_hash_t *pool_hash,
  45.                                   apr_crypto_hash_t *key_hash,
  46.                                   apr_crypto_hash_t *prng_hash);
  47. APR_DECLARE(apr_random_t *) apr_random_standard_new(apr_pool_t *p);
  48. APR_DECLARE(void) apr_random_add_entropy(apr_random_t *g,
  49.                                          const void *entropy_,
  50.                                          apr_size_t bytes);
  51. APR_DECLARE(apr_status_t) apr_random_insecure_bytes(apr_random_t *g,
  52.                                                     void *random,
  53.                                                     apr_size_t bytes);
  54. APR_DECLARE(apr_status_t) apr_random_secure_bytes(apr_random_t *g,
  55.                                                   void *random,
  56.                                                   apr_size_t bytes);
  57. APR_DECLARE(void) apr_random_barrier(apr_random_t *g);
  58. APR_DECLARE(apr_status_t) apr_random_secure_ready(apr_random_t *r);
  59. APR_DECLARE(apr_status_t) apr_random_insecure_ready(apr_random_t *r);
  60.  
  61. /* Call this in the child after forking to mix the randomness
  62.    pools. Note that its generally a bad idea to fork a process with a
  63.    real PRNG in it - better to have the PRNG externally and get the
  64.    randomness from there. However, if you really must do it, then you
  65.    should supply all your entropy to all the PRNGs - don't worry, they
  66.    won't produce the same output.
  67.  
  68.    Note that apr_proc_fork() calls this for you, so only weird
  69.    applications need ever call it themselves.
  70. */
  71. struct apr_proc_t;
  72. APR_DECLARE(void) apr_random_after_fork(struct apr_proc_t *proc);
  73.  
  74. #endif /* ndef APR_RANDOM_H */
  75.