PostgreSQL Source Code  git master
sha2_openssl.c File Reference
#include "postgres.h"
#include <openssl/sha.h>
#include "common/sha2.h"
Include dependency graph for sha2_openssl.c:

Go to the source code of this file.

Functions

void pg_sha256_init (pg_sha256_ctx *ctx)
 
void pg_sha256_update (pg_sha256_ctx *ctx, const uint8 *data, size_t len)
 
void pg_sha256_final (pg_sha256_ctx *ctx, uint8 *dest)
 
void pg_sha512_init (pg_sha512_ctx *ctx)
 
void pg_sha512_update (pg_sha512_ctx *ctx, const uint8 *data, size_t len)
 
void pg_sha512_final (pg_sha512_ctx *ctx, uint8 *dest)
 
void pg_sha384_init (pg_sha384_ctx *ctx)
 
void pg_sha384_update (pg_sha384_ctx *ctx, const uint8 *data, size_t len)
 
void pg_sha384_final (pg_sha384_ctx *ctx, uint8 *dest)
 
void pg_sha224_init (pg_sha224_ctx *ctx)
 
void pg_sha224_update (pg_sha224_ctx *ctx, const uint8 *data, size_t len)
 
void pg_sha224_final (pg_sha224_ctx *ctx, uint8 *dest)
 

Function Documentation

◆ pg_sha224_final()

void pg_sha224_final ( pg_sha224_ctx ctx,
uint8 dest 
)

Definition at line 99 of file sha2_openssl.c.

References PG_SHA224_DIGEST_LENGTH, REVERSE32, SHA256_Last(), and pg_sha256_ctx::state.

100 {
101  SHA224_Final(dest, (SHA256_CTX *) ctx);
102 }

◆ pg_sha224_init()

void pg_sha224_init ( pg_sha224_ctx ctx)

Definition at line 87 of file sha2_openssl.c.

References pg_sha256_ctx::bitcount, pg_sha256_ctx::buffer, PG_SHA256_BLOCK_LENGTH, PG_SHA256_DIGEST_LENGTH, sha224_initial_hash_value, and pg_sha256_ctx::state.

88 {
89  SHA224_Init((SHA256_CTX *) ctx);
90 }

◆ pg_sha224_update()

void pg_sha224_update ( pg_sha224_ctx ctx,
const uint8 data,
size_t  len 
)

Definition at line 93 of file sha2_openssl.c.

References pg_sha256_update().

94 {
95  SHA224_Update((SHA256_CTX *) ctx, data, len);
96 }

◆ pg_sha256_final()

void pg_sha256_final ( pg_sha256_ctx ctx,
uint8 dest 
)

Definition at line 42 of file sha2_openssl.c.

References PG_SHA256_DIGEST_LENGTH, REVERSE32, SHA256_Last(), and pg_sha256_ctx::state.

43 {
44  SHA256_Final(dest, (SHA256_CTX *) ctx);
45 }

◆ pg_sha256_init()

void pg_sha256_init ( pg_sha256_ctx ctx)

◆ pg_sha256_update()

void pg_sha256_update ( pg_sha256_ctx ctx,
const uint8 data,
size_t  len 
)

Definition at line 36 of file sha2_openssl.c.

References pg_sha256_ctx::bitcount, pg_sha256_ctx::buffer, PG_SHA256_BLOCK_LENGTH, and SHA256_Transform().

37 {
38  SHA256_Update((SHA256_CTX *) ctx, data, len);
39 }

◆ pg_sha384_final()

void pg_sha384_final ( pg_sha384_ctx ctx,
uint8 dest 
)

Definition at line 80 of file sha2_openssl.c.

References PG_SHA384_DIGEST_LENGTH, REVERSE64, SHA512_Last(), and pg_sha512_ctx::state.

81 {
82  SHA384_Final(dest, (SHA512_CTX *) ctx);
83 }

◆ pg_sha384_init()

void pg_sha384_init ( pg_sha384_ctx ctx)

Definition at line 68 of file sha2_openssl.c.

References pg_sha512_ctx::bitcount, pg_sha512_ctx::buffer, PG_SHA384_BLOCK_LENGTH, PG_SHA512_DIGEST_LENGTH, sha384_initial_hash_value, and pg_sha512_ctx::state.

69 {
70  SHA384_Init((SHA512_CTX *) ctx);
71 }

◆ pg_sha384_update()

void pg_sha384_update ( pg_sha384_ctx ctx,
const uint8 data,
size_t  len 
)

Definition at line 74 of file sha2_openssl.c.

References pg_sha512_update().

75 {
76  SHA384_Update((SHA512_CTX *) ctx, data, len);
77 }

◆ pg_sha512_final()

void pg_sha512_final ( pg_sha512_ctx ctx,
uint8 dest 
)

Definition at line 61 of file sha2_openssl.c.

References PG_SHA512_DIGEST_LENGTH, REVERSE64, SHA512_Last(), and pg_sha512_ctx::state.

62 {
63  SHA512_Final(dest, (SHA512_CTX *) ctx);
64 }

◆ pg_sha512_init()

void pg_sha512_init ( pg_sha512_ctx ctx)

◆ pg_sha512_update()

void pg_sha512_update ( pg_sha512_ctx ctx,
const uint8 data,
size_t  len 
)

Definition at line 55 of file sha2_openssl.c.

References ADDINC128, pg_sha512_ctx::bitcount, pg_sha512_ctx::buffer, PG_SHA512_BLOCK_LENGTH, and SHA512_Transform().

56 {
57  SHA512_Update((SHA512_CTX *) ctx, data, len);
58 }