Change DH_up() -> DH_up_ref()
[openssl.git] / crypto / evp / m_sha.c
index af4e434a2258348a672f0384a2f6f03f774c54e4..acb7a44c5ebe49cc2b93d4fd94fe9b5fced76fc7 100644 (file)
  * [including the GNU Public Licence.]
  */
 
  * [including the GNU Public Licence.]
  */
 
+#ifndef OPENSSL_NO_SHA
 #include <stdio.h>
 #include "cryptlib.h"
 #include <stdio.h>
 #include "cryptlib.h"
-#include "evp.h"
-#include "objects.h"
-#include "x509.h"
+#include <openssl/evp.h>
+#include <openssl/objects.h>
+#include <openssl/x509.h>
 
 
-static EVP_MD sha_md=
+static int init(EVP_MD_CTX *ctx)
+       { return SHA_Init(ctx->md_data); }
+
+static int update(EVP_MD_CTX *ctx,const void *data,unsigned long count)
+       { return SHA_Update(ctx->md_data,data,count); }
+
+static int final(EVP_MD_CTX *ctx,unsigned char *md)
+       { return SHA_Final(md,ctx->md_data); }
+
+static const EVP_MD sha_md=
        {
        NID_sha,
        NID_shaWithRSAEncryption,
        SHA_DIGEST_LENGTH,
        {
        NID_sha,
        NID_shaWithRSAEncryption,
        SHA_DIGEST_LENGTH,
-       SHA_Init,
-       SHA_Update,
-       SHA_Final,
+       0,
+       init,
+       update,
+       final,
+       NULL,
        EVP_PKEY_RSA_method,
        SHA_CBLOCK,
        sizeof(EVP_MD *)+sizeof(SHA_CTX),
        };
 
        EVP_PKEY_RSA_method,
        SHA_CBLOCK,
        sizeof(EVP_MD *)+sizeof(SHA_CTX),
        };
 
-EVP_MD *EVP_sha()
+const EVP_MD *EVP_sha(void)
        {
        return(&sha_md);
        }
        {
        return(&sha_md);
        }
-
+#endif