~ubuntu-branches/ubuntu/feisty/apache2/feisty

« back to all changes in this revision

Viewing changes to srclib/apr/random/unix/sha2_glue.c

  • Committer: Bazaar Package Importer
  • Author(s): Andreas Barth
  • Date: 2006-12-09 21:05:45 UTC
  • mfrom: (0.6.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20061209210545-h70s0xaqc2v8vqr2
Tags: 2.2.3-3.2
* Non-maintainer upload.
* 043_ajp_connection_reuse: Patch from upstream Bugzilla, fixing a critical
  issue with regard to connection reuse in mod_proxy_ajp.
  Closes: #396265

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <apr.h>
 
2
#include <apr_random.h>
 
3
#include <apr_pools.h>
 
4
#include "sha2.h"
 
5
 
 
6
static void sha256_init(apr_crypto_hash_t *h)
 
7
    {
 
8
    apr__SHA256_Init(h->data);
 
9
    }
 
10
 
 
11
static void sha256_add(apr_crypto_hash_t *h,const void *data,
 
12
                          apr_size_t bytes)
 
13
    {
 
14
    apr__SHA256_Update(h->data,data,bytes);
 
15
    }
 
16
 
 
17
static void sha256_finish(apr_crypto_hash_t *h,unsigned char *result)
 
18
    {
 
19
    apr__SHA256_Final(result,h->data);
 
20
    }
 
21
 
 
22
APR_DECLARE(apr_crypto_hash_t *) apr_crypto_sha256_new(apr_pool_t *p)
 
23
    {
 
24
    apr_crypto_hash_t *h=apr_palloc(p,sizeof *h);
 
25
 
 
26
    h->data=apr_palloc(p,sizeof(SHA256_CTX));
 
27
    h->init=sha256_init;
 
28
    h->add=sha256_add;
 
29
    h->finish=sha256_finish;
 
30
    h->size=256/8;
 
31
 
 
32
    return h;
 
33
    }