aboutsummaryrefslogtreecommitdiffstats
path: root/openssl_missing.c
blob: e675932a10046c7c902a7ede0b426176eb6fed15 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*
 * $Id$
 * 'OpenSSL for Ruby' project
 * Copyright (C) 2001-2002  Michal Rokos <m.rokos@sh.cvut.cz>
 * All rights reserved.
 */
/*
 * This program is licenced under the same licence as Ruby.
 * (See the file 'LICENCE'.)
 */
#if !defined(OPENSSL_NO_HMAC)

#include <string.h>
#include <openssl/hmac.h>

/* to hmac.[ch] */
int
HMAC_CTX_copy(HMAC_CTX *out, HMAC_CTX *in)
{
	if (in == NULL) {
        	/* HMACerr(HMAC_CTX_COPY,HMAC_R_INPUT_NOT_INITIALIZED); */
        	return 0;
    	}
	memcpy(out, in, sizeof(HMAC_CTX));

	if (!EVP_MD_CTX_copy(&out->md_ctx, &in->md_ctx)) {
		return 0;
	}
	if (!EVP_MD_CTX_copy(&out->i_ctx, &in->i_ctx)) {
		return 0;
	}
	if (!EVP_MD_CTX_copy(&out->o_ctx, &in->o_ctx)) {
		return 0;
	}
	return 1;
}

#endif /* NO_HMAC */