Coda Distributed File System
grunt.h
Go to the documentation of this file.
1/* BLURB lgpl
2 Coda File System
3 Release 6
4
5 Copyright (c) 2006 Carnegie Mellon University
6 Additional copyrights listed below
7
8This code is distributed "AS IS" without warranty of any kind under
9the terms of the GNU Library General Public Licence Version 2, as
10shown in the file LICENSE. The technical and financial contributors to
11Coda are listed in the file CREDITS.
12
13 Additional copyrights
14#*/
15
16/* helpers and private functions */
17
18#ifndef _GRUNT_H_
19#define _GRUNT_H_
20
21#include <sys/types.h>
22#include <sys/socket.h>
23#include <arpa/inet.h>
24#include <stdint.h>
25#include <stdio.h>
26
27#include "aes.h"
28
29#define bytes(bits) ((bits) / 8)
30
31static inline void dump128(char prefix, aes_block *b)
32{
33 fprintf(stderr, "%c %08x%08x%08x%08x\n", prefix, htonl(b->u32[0]),
34 htonl(b->u32[1]), htonl(b->u32[2]), htonl(b->u32[3]));
35}
36
37static inline void xor128(aes_block *out, const aes_block *in)
38{
39 out->u64[0] ^= in->u64[0];
40 out->u64[1] ^= in->u64[1];
41}
42
43/* private functions */
44/* secure_aes.c */
45void secure_aes_init(int verbose);
46int aes_cbc_encrypt(const aes_block *in, aes_block *out, size_t nblocks,
47 const aes_block *iv, aes_encrypt_ctx *ctx);
48int aes_cbc_decrypt(const aes_block *in, aes_block *out, size_t nblocks,
49 const aes_block *iv, aes_decrypt_ctx *ctx);
50
51int aes_xcbc_prf_init(void **ctx, const uint8_t *key, size_t len);
52#define aes_xcbc_prf_release aes_xcbc_mac_release
53#define aes_xcbc_prf_128 aes_xcbc_mac_128
54
55/* auth_aes_xcbc.c */
56int aes_xcbc_mac_init(void **ctx, const uint8_t *key, size_t len);
57void aes_xcbc_mac_release(void **ctx);
58void aes_xcbc_mac_128(void *ctx, const uint8_t *buf, size_t len,
59 aes_block *mac);
60
61/* secure_random.c */
63void secure_random_release(void);
64
65/* secure_init.c */
66void secure_audit(const char *event, uint32_t spi, uint32_t seq,
67 const struct sockaddr *src);
68
69/* Sadly we need this because we couldn't pass the version number to the
70 * initializers without breaking the ABI */
71void aes_ccm_tweak(void *ctx, uint32_t version);
72
73/* secure_pbkdf.c */
75
76#endif /* _GRUNT_H_ */
#define aes_decrypt_ctx
Definition: aes.h:39
#define aes_encrypt_ctx
Definition: aes.h:38
unsigned int uint32_t
Definition: coda.h:105
unsigned char uint8_t
Definition: coda.h:101
void aes_xcbc_mac_release(void **ctx)
Definition: auth_aes_xcbc.c:65
void secure_aes_init(int verbose)
Definition: secure_aes.c:457
void secure_pbkdf_init(int verbose)
Definition: secure_pbkdf.c:94
int aes_cbc_decrypt(const aes_block *in, aes_block *out, size_t nblocks, const aes_block *iv, aes_decrypt_ctx *ctx)
Definition: secure_aes.c:54
void secure_audit(const char *event, uint32_t spi, uint32_t seq, const struct sockaddr *src)
Definition: secure_init.c:135
int aes_xcbc_prf_init(void **ctx, const uint8_t *key, size_t len)
Definition: secure_aes.c:74
void secure_random_release(void)
Definition: secure_random.c:359
void secure_random_init(int verbose)
Definition: secure_random.c:344
void aes_xcbc_mac_128(void *ctx, const uint8_t *buf, size_t len, aes_block *mac)
Definition: auth_aes_xcbc.c:77
int aes_cbc_encrypt(const aes_block *in, aes_block *out, size_t nblocks, const aes_block *iv, aes_encrypt_ctx *ctx)
Definition: secure_aes.c:39
void aes_ccm_tweak(void *ctx, uint32_t version)
Definition: encr_aes_ccm.c:75
int aes_xcbc_mac_init(void **ctx, const uint8_t *key, size_t len)
Definition: auth_aes_xcbc.c:33
int verbose
Definition: mkcodabf.c:30
stderr
Definition: gensrvstats.py:48
fprintf(outFile, "Tag: SMARTFTP\n")
Definition: aes.h:28
uint64_t u64[AES_BLOCK_SIZE/sizeof(uint64_t)]
Definition: aes.h:31
uint32_t u32[AES_BLOCK_SIZE/sizeof(uint32_t)]
Definition: aes.h:30