Deleted Added
full compact
crypto.c (330106) crypto.c (338530)
1/*
2 * HMS: we need to test:
3 * - OpenSSL versions, if we are building with them
4 * - our versions
5 *
6 * We may need to test with(out) OPENSSL separately.
7 */
8
9#include <config.h>
10#include "crypto.h"
11#include <ctype.h>
12#include "isc/string.h"
13#include "ntp_md5.h"
14
1/*
2 * HMS: we need to test:
3 * - OpenSSL versions, if we are building with them
4 * - our versions
5 *
6 * We may need to test with(out) OPENSSL separately.
7 */
8
9#include <config.h>
10#include "crypto.h"
11#include <ctype.h>
12#include "isc/string.h"
13#include "ntp_md5.h"
14
15/* HMS: We may not have OpenSSL, but we have our own AES-128-CMAC */
16#define CMAC "AES128CMAC"
17#ifdef OPENSSL
18# include "openssl/cmac.h"
19# define AES_128_KEY_SIZE 16
20#endif /* OPENSSL */
21
22#ifndef EVP_MAX_MD_SIZE
23# define EVP_MAX_MD_SIZE 32
24#endif
25
26struct key *key_ptr;
27size_t key_cnt = 0;
28
29typedef struct key Key_T;

--- 10 unchanged lines hidden (view full) ---

40{
41 u_int len = 0;
42 size_t slen = 0;
43 int key_type;
44
45 INIT_SSL();
46 key_type = keytype_from_text(macname, NULL);
47
15#ifndef EVP_MAX_MD_SIZE
16# define EVP_MAX_MD_SIZE 32
17#endif
18
19struct key *key_ptr;
20size_t key_cnt = 0;
21
22typedef struct key Key_T;

--- 10 unchanged lines hidden (view full) ---

33{
34 u_int len = 0;
35 size_t slen = 0;
36 int key_type;
37
38 INIT_SSL();
39 key_type = keytype_from_text(macname, NULL);
40
48#ifdef OPENSSL
41#if defined(OPENSSL) && defined(ENABLE_CMAC)
49 /* Check if CMAC key type specific code required */
50 if (key_type == NID_cmac) {
51 CMAC_CTX * ctx = NULL;
52 u_char keybuf[AES_128_KEY_SIZE];
53
54 /* adjust key size (zero padded buffer) if necessary */
55 if (AES_128_KEY_SIZE > key_size) {
56 memcpy(keybuf, key_data, key_size);

--- 279 unchanged lines hidden ---
42 /* Check if CMAC key type specific code required */
43 if (key_type == NID_cmac) {
44 CMAC_CTX * ctx = NULL;
45 u_char keybuf[AES_128_KEY_SIZE];
46
47 /* adjust key size (zero padded buffer) if necessary */
48 if (AES_128_KEY_SIZE > key_size) {
49 memcpy(keybuf, key_data, key_size);

--- 279 unchanged lines hidden ---