static int MD5_Init(MD5_CTX *ctx)
{
md5_init(ctx);
- return 0;
+ return 1;
}
static void MD5_Update(MD5_CTX *ctx,
static int SHA1_Init(SHA_CTX *ctx)
{
sha1_init(ctx);
- return 0;
+ return 1;
}
static void SHA1_Update(SHA_CTX *ctx,
static int SHA256_Init(SHA256_CTX *ctx)
{
sha256_init(ctx);
- return 0;
+ return 1;
}
static void SHA256_Update(SHA256_CTX *ctx,
static int MD5_Init(MD5_CTX *ctx)
{
gcry_md_open(ctx, GCRY_MD_MD5, 0);
- return 0;
+ return 1;
}
static void MD5_Update(MD5_CTX *ctx,
static int SHA1_Init(SHA_CTX *ctx)
{
gcry_md_open(ctx, GCRY_MD_SHA1, 0);
- return 0;
+ return 1;
}
static void SHA1_Update(SHA_CTX *ctx,
static int SHA256_Init(SHA256_CTX *ctx)
{
gcry_md_open(ctx, GCRY_MD_SHA256, 0);
- return 0;
+ return 1;
}
static void SHA256_Update(SHA256_CTX *ctx,
ctx = PK11_CreateDigestContext(hash_alg);
if(!ctx)
- return -1;
+ return /* failure */ 0;
if(PK11_DigestBegin(ctx) != SECSuccess) {
PK11_DestroyContext(ctx, PR_TRUE);
- return -1;
+ return /* failure */ 0;
}
*pctx = ctx;
- return 0;
+ return /* success */ 1;
}
static void nss_hash_final(void **pctx, unsigned char *out, unsigned int len)
PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)) {
CryptCreateHash(ctx->hCryptProv, CALG_MD5, 0, 0, &ctx->hHash);
}
- return 0;
+ return 1;
}
static void MD5_Update(MD5_CTX *ctx,
PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)) {
CryptCreateHash(ctx->hCryptProv, CALG_SHA1, 0, 0, &ctx->hHash);
}
- return 0;
+ return 1;
}
static void SHA1_Update(SHA_CTX *ctx,
PROV_RSA_AES, CRYPT_VERIFYCONTEXT)) {
CryptCreateHash(ctx->hCryptProv, CALG_SHA_256, 0, 0, &ctx->hHash);
}
- return 0;
+ return 1;
}
static void SHA256_Update(SHA256_CTX *ctx,
ctxt->digest_hash = dparams;
- if(dparams->digest_init(ctxt->digest_hashctx) != 0) {
+ if(dparams->digest_init(ctxt->digest_hashctx) != 1) {
free(ctxt);
return NULL;
}