Changes between 0.9.1c and 0.9.2
+ *) Add new function, EVP_MD_CTX_copy() to replace frequent use of memcpy.
+ [Eric A. Young, (from changes to C2Net SSLeay, integrated by Mark Cox)]
+
*) Make sure `make rehash' target really finds the `openssl' program.
[Ralf S. Engelschall, Matthias Loepfe <Matthias.Loepfe@adnovum.ch>]
*size=ctx->digest->md_size;
memset(&(ctx->md),0,sizeof(ctx->md));
}
+
+int EVP_MD_CTX_copy(EVP_MD_CTX *out, EVP_MD_CTX *in)
+{
+ if ((in == NULL) || (in->digest == NULL)) {
+ EVPerr(EVP_F_EVP_MD_CTX_COPY,EVP_R_INPUT_NOT_INITALISED);
+ return 0;
+ }
+ memcpy((char *)out,(char *)in,in->digest->ctx_size);
+ return 1;
+}
#define EVP_F_EVP_SIGNFINAL 107
#define EVP_F_EVP_VERIFYFINAL 108
#define EVP_F_RC2_MAGIC_TO_METH 109
+#define EVP_F_EVP_MD_CTX_COPY 110
/* Reason codes. */
#define EVP_R_BAD_DECRYPT 100
#define EVP_R_UNSUPPORTED_KEY_SIZE 108
#define EVP_R_WRONG_FINAL_BLOCK_LENGTH 109
#define EVP_R_WRONG_PUBLIC_KEY_TYPE 110
+#define EVP_R_INPUT_NOT_INITALISED 111
#ifndef NOPROTO
+int EVP_MD_CTX_copy(EVP_MD_CTX *out,EVP_MD_CTX *in);
void EVP_DigestInit(EVP_MD_CTX *ctx, EVP_MD *type);
void EVP_DigestUpdate(EVP_MD_CTX *ctx,unsigned char *d,unsigned int cnt);
void EVP_DigestFinal(EVP_MD_CTX *ctx,unsigned char *md,unsigned int *s);
#else
+int EVP_MD_CTX_copy();
void EVP_DigestInit();
void EVP_DigestUpdate();
void EVP_DigestFinal();
#define EVP_F_EVP_SIGNFINAL 107
#define EVP_F_EVP_VERIFYFINAL 108
#define EVP_F_RC2_MAGIC_TO_METH 109
+#define EVP_F_EVP_MD_CTX_COPY 110
/* Reason codes. */
#define EVP_R_BAD_DECRYPT 100
#define EVP_R_UNSUPPORTED_KEY_SIZE 108
#define EVP_R_WRONG_FINAL_BLOCK_LENGTH 109
#define EVP_R_WRONG_PUBLIC_KEY_TYPE 110
+#define EVP_R_INPUT_NOT_INITALISED 111
#ifdef __cplusplus
}
{ERR_PACK(0,EVP_F_EVP_SIGNFINAL,0), "EVP_SignFinal"},
{ERR_PACK(0,EVP_F_EVP_VERIFYFINAL,0), "EVP_VerifyFinal"},
{ERR_PACK(0,EVP_F_RC2_MAGIC_TO_METH,0), "RC2_MAGIC_TO_METH"},
+{ERR_PACK(0,EVP_F_EVP_MD_CTX_COPY,0), "EVP_MD_CTX_copy"},
{0,NULL},
};
{EVP_R_UNSUPPORTED_KEY_SIZE ,"unsupported key size"},
{EVP_R_WRONG_FINAL_BLOCK_LENGTH ,"wrong final block length"},
{EVP_R_WRONG_PUBLIC_KEY_TYPE ,"wrong public key type"},
+{EVP_R_INPUT_NOT_INITALISED ,"input not initalised"},
{0,NULL},
};
MS_STATIC EVP_MD_CTX tmp_ctx;
*siglen=0;
- memcpy(&tmp_ctx,ctx,sizeof(EVP_MD_CTX));
+ EVP_MD_CTX_copy(&tmp_ctx,ctx);
EVP_DigestFinal(&tmp_ctx,&(m[0]),&m_len);
for (i=0; i<4; i++)
{
EVPerr(EVP_F_EVP_VERIFYFINAL,EVP_R_WRONG_PUBLIC_KEY_TYPE);
return(-1);
}
- memcpy(&tmp_ctx,ctx,sizeof(EVP_MD_CTX));
+ EVP_MD_CTX_copy(&tmp_ctx,ctx);
EVP_DigestFinal(&tmp_ctx,&(m[0]),&m_len);
if (ctx->digest->verify == NULL)
{