#include "postgres.h"
#include <time.h>
#include "px.h"
#include "sha2.h"
Go to the source code of this file.
Functions | |
void | init_sha224 (PX_MD *h) |
void | init_sha256 (PX_MD *h) |
void | init_sha384 (PX_MD *h) |
void | init_sha512 (PX_MD *h) |
static unsigned | int_sha224_len (PX_MD *h) |
static unsigned | int_sha224_block_len (PX_MD *h) |
static void | int_sha224_update (PX_MD *h, const uint8 *data, unsigned dlen) |
static void | int_sha224_reset (PX_MD *h) |
static void | int_sha224_finish (PX_MD *h, uint8 *dst) |
static void | int_sha224_free (PX_MD *h) |
static unsigned | int_sha256_len (PX_MD *h) |
static unsigned | int_sha256_block_len (PX_MD *h) |
static void | int_sha256_update (PX_MD *h, const uint8 *data, unsigned dlen) |
static void | int_sha256_reset (PX_MD *h) |
static void | int_sha256_finish (PX_MD *h, uint8 *dst) |
static void | int_sha256_free (PX_MD *h) |
static unsigned | int_sha384_len (PX_MD *h) |
static unsigned | int_sha384_block_len (PX_MD *h) |
static void | int_sha384_update (PX_MD *h, const uint8 *data, unsigned dlen) |
static void | int_sha384_reset (PX_MD *h) |
static void | int_sha384_finish (PX_MD *h, uint8 *dst) |
static void | int_sha384_free (PX_MD *h) |
static unsigned | int_sha512_len (PX_MD *h) |
static unsigned | int_sha512_block_len (PX_MD *h) |
static void | int_sha512_update (PX_MD *h, const uint8 *data, unsigned dlen) |
static void | int_sha512_reset (PX_MD *h) |
static void | int_sha512_finish (PX_MD *h, uint8 *dst) |
static void | int_sha512_free (PX_MD *h) |
void init_sha224 | ( | PX_MD * | h | ) |
Definition at line 239 of file internal-sha2.c.
References px_digest::block_size, px_digest::finish, px_digest::free, px_digest::p, px_digest::ptr, px_alloc, px_digest::reset, px_digest::result_size, and px_digest::update.
{ SHA224_CTX *ctx; ctx = px_alloc(sizeof(*ctx)); memset(ctx, 0, sizeof(*ctx)); md->p.ptr = ctx; md->result_size = int_sha224_len; md->block_size = int_sha224_block_len; md->reset = int_sha224_reset; md->update = int_sha224_update; md->finish = int_sha224_finish; md->free = int_sha224_free; md->reset(md); }
void init_sha256 | ( | PX_MD * | h | ) |
Definition at line 259 of file internal-sha2.c.
References px_digest::block_size, px_digest::finish, px_digest::free, px_digest::p, px_digest::ptr, px_alloc, px_digest::reset, px_digest::result_size, and px_digest::update.
{ SHA256_CTX *ctx; ctx = px_alloc(sizeof(*ctx)); memset(ctx, 0, sizeof(*ctx)); md->p.ptr = ctx; md->result_size = int_sha256_len; md->block_size = int_sha256_block_len; md->reset = int_sha256_reset; md->update = int_sha256_update; md->finish = int_sha256_finish; md->free = int_sha256_free; md->reset(md); }
void init_sha384 | ( | PX_MD * | h | ) |
Definition at line 279 of file internal-sha2.c.
References px_digest::block_size, px_digest::finish, px_digest::free, px_digest::p, px_digest::ptr, px_alloc, px_digest::reset, px_digest::result_size, and px_digest::update.
{ SHA384_CTX *ctx; ctx = px_alloc(sizeof(*ctx)); memset(ctx, 0, sizeof(*ctx)); md->p.ptr = ctx; md->result_size = int_sha384_len; md->block_size = int_sha384_block_len; md->reset = int_sha384_reset; md->update = int_sha384_update; md->finish = int_sha384_finish; md->free = int_sha384_free; md->reset(md); }
void init_sha512 | ( | PX_MD * | h | ) |
Definition at line 299 of file internal-sha2.c.
References px_digest::block_size, px_digest::finish, px_digest::free, px_digest::p, px_digest::ptr, px_alloc, px_digest::reset, px_digest::result_size, and px_digest::update.
{ SHA512_CTX *ctx; ctx = px_alloc(sizeof(*ctx)); memset(ctx, 0, sizeof(*ctx)); md->p.ptr = ctx; md->result_size = int_sha512_len; md->block_size = int_sha512_block_len; md->reset = int_sha512_reset; md->update = int_sha512_update; md->finish = int_sha512_finish; md->free = int_sha512_free; md->reset(md); }
static unsigned int_sha224_block_len | ( | PX_MD * | h | ) | [static] |
Definition at line 53 of file internal-sha2.c.
{
return SHA224_BLOCK_LENGTH;
}
Definition at line 75 of file internal-sha2.c.
References px_digest::p, px_digest::ptr, and SHA224_Final().
{ SHA224_CTX *ctx = (SHA224_CTX *) h->p.ptr; SHA224_Final(dst, ctx); }
static void int_sha224_free | ( | PX_MD * | h | ) | [static] |
Definition at line 83 of file internal-sha2.c.
References px_digest::p, px_digest::ptr, and px_free.
{ SHA224_CTX *ctx = (SHA224_CTX *) h->p.ptr; memset(ctx, 0, sizeof(*ctx)); px_free(ctx); px_free(h); }
static unsigned int_sha224_len | ( | PX_MD * | h | ) | [static] |
Definition at line 47 of file internal-sha2.c.
{
return SHA224_DIGEST_LENGTH;
}
static void int_sha224_reset | ( | PX_MD * | h | ) | [static] |
Definition at line 67 of file internal-sha2.c.
References px_digest::p, px_digest::ptr, and SHA224_Init().
{ SHA224_CTX *ctx = (SHA224_CTX *) h->p.ptr; SHA224_Init(ctx); }
Definition at line 59 of file internal-sha2.c.
References px_digest::p, px_digest::ptr, and SHA224_Update().
{ SHA224_CTX *ctx = (SHA224_CTX *) h->p.ptr; SHA224_Update(ctx, data, dlen); }
static unsigned int_sha256_block_len | ( | PX_MD * | h | ) | [static] |
Definition at line 101 of file internal-sha2.c.
{
return SHA256_BLOCK_LENGTH;
}
Definition at line 123 of file internal-sha2.c.
References px_digest::p, px_digest::ptr, and SHA256_Final.
{ SHA256_CTX *ctx = (SHA256_CTX *) h->p.ptr; SHA256_Final(dst, ctx); }
static void int_sha256_free | ( | PX_MD * | h | ) | [static] |
Definition at line 131 of file internal-sha2.c.
References px_digest::p, px_digest::ptr, and px_free.
{ SHA256_CTX *ctx = (SHA256_CTX *) h->p.ptr; memset(ctx, 0, sizeof(*ctx)); px_free(ctx); px_free(h); }
static unsigned int_sha256_len | ( | PX_MD * | h | ) | [static] |
Definition at line 95 of file internal-sha2.c.
{
return SHA256_DIGEST_LENGTH;
}
static void int_sha256_reset | ( | PX_MD * | h | ) | [static] |
Definition at line 115 of file internal-sha2.c.
References px_digest::p, px_digest::ptr, and SHA256_Init.
{ SHA256_CTX *ctx = (SHA256_CTX *) h->p.ptr; SHA256_Init(ctx); }
Definition at line 107 of file internal-sha2.c.
References px_digest::p, px_digest::ptr, and SHA256_Update.
{ SHA256_CTX *ctx = (SHA256_CTX *) h->p.ptr; SHA256_Update(ctx, data, dlen); }
static unsigned int_sha384_block_len | ( | PX_MD * | h | ) | [static] |
Definition at line 149 of file internal-sha2.c.
{
return SHA384_BLOCK_LENGTH;
}
Definition at line 171 of file internal-sha2.c.
References px_digest::p, px_digest::ptr, and SHA384_Final.
{ SHA384_CTX *ctx = (SHA384_CTX *) h->p.ptr; SHA384_Final(dst, ctx); }
static void int_sha384_free | ( | PX_MD * | h | ) | [static] |
Definition at line 179 of file internal-sha2.c.
References px_digest::p, px_digest::ptr, and px_free.
{ SHA384_CTX *ctx = (SHA384_CTX *) h->p.ptr; memset(ctx, 0, sizeof(*ctx)); px_free(ctx); px_free(h); }
static unsigned int_sha384_len | ( | PX_MD * | h | ) | [static] |
Definition at line 143 of file internal-sha2.c.
{
return SHA384_DIGEST_LENGTH;
}
static void int_sha384_reset | ( | PX_MD * | h | ) | [static] |
Definition at line 163 of file internal-sha2.c.
References px_digest::p, px_digest::ptr, and SHA384_Init.
{ SHA384_CTX *ctx = (SHA384_CTX *) h->p.ptr; SHA384_Init(ctx); }
Definition at line 155 of file internal-sha2.c.
References px_digest::p, px_digest::ptr, and SHA384_Update.
{ SHA384_CTX *ctx = (SHA384_CTX *) h->p.ptr; SHA384_Update(ctx, data, dlen); }
static unsigned int_sha512_block_len | ( | PX_MD * | h | ) | [static] |
Definition at line 197 of file internal-sha2.c.
{
return SHA512_BLOCK_LENGTH;
}
Definition at line 219 of file internal-sha2.c.
References px_digest::p, px_digest::ptr, and SHA512_Final.
{ SHA512_CTX *ctx = (SHA512_CTX *) h->p.ptr; SHA512_Final(dst, ctx); }
static void int_sha512_free | ( | PX_MD * | h | ) | [static] |
Definition at line 227 of file internal-sha2.c.
References px_digest::p, px_digest::ptr, and px_free.
{ SHA512_CTX *ctx = (SHA512_CTX *) h->p.ptr; memset(ctx, 0, sizeof(*ctx)); px_free(ctx); px_free(h); }
static unsigned int_sha512_len | ( | PX_MD * | h | ) | [static] |
Definition at line 191 of file internal-sha2.c.
{
return SHA512_DIGEST_LENGTH;
}
static void int_sha512_reset | ( | PX_MD * | h | ) | [static] |
Definition at line 211 of file internal-sha2.c.
References px_digest::p, px_digest::ptr, and SHA512_Init.
{ SHA512_CTX *ctx = (SHA512_CTX *) h->p.ptr; SHA512_Init(ctx); }
Definition at line 203 of file internal-sha2.c.
References px_digest::p, px_digest::ptr, and SHA512_Update.
{ SHA512_CTX *ctx = (SHA512_CTX *) h->p.ptr; SHA512_Update(ctx, data, dlen); }