X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=blobdiff_plain;f=fips%2Fdsa%2Ffips_dsa_sign.c;h=ea1bd8730358d77f4597b6ce69622fa3ecea8b94;hp=7223589af3a324def636cbba18d4c3c0a74d43aa;hb=549c4ad35b07c494d380e06d422af522cb21d108;hpb=7c8ced94c32131f24d469d2899f3339f77c47aa1 diff --git a/fips/dsa/fips_dsa_sign.c b/fips/dsa/fips_dsa_sign.c index 7223589af3..ea1bd87303 100644 --- a/fips/dsa/fips_dsa_sign.c +++ b/fips/dsa/fips_dsa_sign.c @@ -3,7 +3,7 @@ * project 2007. */ /* ==================================================================== - * Copyright (c) 2007 The OpenSSL Project. All rights reserved. + * Copyright (c) 2011 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -76,21 +76,42 @@ DSA_SIG * FIPS_dsa_sign_ctx(DSA *dsa, EVP_MD_CTX *ctx) DSA_SIG *s; unsigned char dig[EVP_MAX_MD_SIZE]; unsigned int dlen; - EVP_DigestFinal_ex(ctx, dig, &dlen); + FIPS_digestfinal(ctx, dig, &dlen); s = dsa->meth->dsa_do_sign(dig,dlen,dsa); OPENSSL_cleanse(dig, dlen); return s; } +DSA_SIG * FIPS_dsa_sign_digest(DSA *dsa, const unsigned char *dig, int dlen) + { + if (FIPS_selftest_failed()) + { + FIPSerr(FIPS_F_FIPS_DSA_SIGN_DIGEST, FIPS_R_SELFTEST_FAILED); + return NULL; + } + return dsa->meth->dsa_do_sign(dig, dlen, dsa); + } + int FIPS_dsa_verify_ctx(DSA *dsa, EVP_MD_CTX *ctx, DSA_SIG *s) { int ret=-1; unsigned char dig[EVP_MAX_MD_SIZE]; unsigned int dlen; - EVP_DigestFinal_ex(ctx, dig, &dlen); + FIPS_digestfinal(ctx, dig, &dlen); ret=dsa->meth->dsa_do_verify(dig,dlen,s,dsa); OPENSSL_cleanse(dig, dlen); return ret; } +int FIPS_dsa_verify_digest(DSA *dsa, + const unsigned char *dig, int dlen, DSA_SIG *s) + { + if (FIPS_selftest_failed()) + { + FIPSerr(FIPS_F_FIPS_DSA_VERIFY_DIGEST, FIPS_R_SELFTEST_FAILED); + return -1; + } + return dsa->meth->dsa_do_verify(dig,dlen,s,dsa); + } + #endif