1 /* ppp-crypo-priv.h - Crypto private data structures
3 * Copyright (c) 2022 Eivind Næss. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided with the
17 * 3. The name(s) of the authors of this software must not be used to
18 * endorse or promote products derived from this software without
19 * prior written permission.
21 * THE AUTHORS OF THIS SOFTWARE DISCLAIM ALL WARRANTIES WITH REGARD TO
22 * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
23 * AND FITNESS, IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
24 * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
25 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
26 * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
27 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
29 #ifndef PPP_CRYPTO_PRIV_H
30 #define PPP_CRYPTO_PRIV_H
32 #include "ppp-crypto.h"
34 #define MAX_KEY_SIZE 32
35 #define MAX_IV_SIZE 32
39 int (*init_fn)(PPP_MD_CTX *ctx);
40 int (*update_fn)(PPP_MD_CTX *ctx, const void *data, size_t cnt);
41 int (*final_fn)(PPP_MD_CTX *ctx, unsigned char *out, unsigned int *outlen);
42 void (*clean_fn)(PPP_MD_CTX *ctx);
53 int (*init_fn)(PPP_CIPHER_CTX *ctx, const unsigned char *key, const unsigned char *iv);
54 int (*update_fn)(PPP_CIPHER_CTX *ctx, unsigned char *out, int *outl, const unsigned char *in, int inl);
55 int (*final_fn)(PPP_CIPHER_CTX *ctx, unsigned char *out, int *outl);
56 void (*clean_fn)(PPP_CIPHER_CTX *ctx);
59 struct _PPP_CIPHER_CTX
62 unsigned char key[MAX_KEY_SIZE];
63 unsigned char iv[MAX_IV_SIZE];