diff options
author | Zhanna Tsitkov <tsitkova@mit.edu> | 2009-09-30 22:33:41 +0000 |
---|---|---|
committer | Zhanna Tsitkov <tsitkova@mit.edu> | 2009-09-30 22:33:41 +0000 |
commit | cb1fe7f9bbab7c09c483bac964f4d045b91aec66 (patch) | |
tree | 836dab3fde0e3202cf6bc8c7eaba2f18c9bbde49 /src/lib/crypto/openssl/sha1 | |
parent | e9c2e78bdd51ea150e46c9297f7abf5f5590522a (diff) | |
download | krb5-cb1fe7f9bbab7c09c483bac964f4d045b91aec66.tar.gz krb5-cb1fe7f9bbab7c09c483bac964f4d045b91aec66.tar.xz krb5-cb1fe7f9bbab7c09c483bac964f4d045b91aec66.zip |
Crypto modularity proj: SHS_INFO structure is defined differently for crypto impl's. Files hash_sha1.c and yhash.h are affected by this difference. Move hash_provider into the backend
The following bigredbutton is used to suppress svn complains about the trailing spaces in the moved/copied dirs.
bigredbutton: whitespace
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@22815 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/lib/crypto/openssl/sha1')
-rw-r--r-- | src/lib/crypto/openssl/sha1/shs.c | 18 | ||||
-rw-r--r-- | src/lib/crypto/openssl/sha1/shs.h | 8 |
2 files changed, 13 insertions, 13 deletions
diff --git a/src/lib/crypto/openssl/sha1/shs.c b/src/lib/crypto/openssl/sha1/shs.c index 9fb60f87c..7cc864bb8 100644 --- a/src/lib/crypto/openssl/sha1/shs.c +++ b/src/lib/crypto/openssl/sha1/shs.c @@ -3,12 +3,19 @@ #include <sys/types.h> #endif #include <string.h> +#define h0init 0x67452301L +#define h1init 0xEFCDAB89L +#define h2init 0x98BADCFEL +#define h3init 0x10325476L +#define h4init 0xC3D2E1F0L /* Initialize the SHS values */ void shsInit(SHS_INFO *shsInfo) { EVP_MD_CTX_init(&shsInfo->ossl_sha1_ctx ); EVP_DigestInit_ex(&shsInfo->ossl_sha1_ctx , EVP_sha1(), NULL); + shsInfo->digestLen = 0; + memset(shsInfo->digestBuf, 0 , sizeof(shsInfo->digestBuf)); } /* Update SHS for a block of data */ @@ -22,13 +29,8 @@ void shsUpdate(SHS_INFO *shsInfo, const SHS_BYTE *buffer, unsigned int count) void shsFinal(SHS_INFO *shsInfo) { - unsigned char *digest_buf = NULL; - - digest_buf = (unsigned char *)OPENSSL_malloc( sizeof(shsInfo->digest)); - - EVP_DigestFinal_ex(&shsInfo->ossl_sha1_ctx , digest_buf , &shsInfo->digest_len); - - memcpy(shsInfo->digest, digest_buf, shsInfo->digest_len); - OPENSSL_free(digest_buf); + EVP_DigestFinal_ex(&shsInfo->ossl_sha1_ctx ,(unsigned char *)shsInfo->digestBuf , &shsInfo->digestLen); EVP_MD_CTX_cleanup(&shsInfo->ossl_sha1_ctx ); } + + diff --git a/src/lib/crypto/openssl/sha1/shs.h b/src/lib/crypto/openssl/sha1/shs.h index 66e91b69b..772c72ac6 100644 --- a/src/lib/crypto/openssl/sha1/shs.h +++ b/src/lib/crypto/openssl/sha1/shs.h @@ -22,11 +22,9 @@ typedef krb5_ui_4 SHS_LONG; /* The structure for storing SHS info */ typedef struct { - EVP_MD_CTX ossl_sha1_ctx; - unsigned int digest_len; - SHS_LONG digest[ 5 ]; /* Message digest */ - SHS_LONG countLo, countHi; /* 64-bit bit count */ - SHS_LONG data[ 16 ]; /* SHS data buffer */ + EVP_MD_CTX ossl_sha1_ctx; + unsigned char digestBuf[SHS_DIGESTSIZE]; /* output */ + unsigned int digestLen; /* output */ } SHS_INFO; /* Message digest functions (shs.c) */ |