Deleted Added
full compact
umac.c (180744) umac.c (180746)
1/* $OpenBSD: umac.c,v 1.1 2007/06/07 19:37:34 pvalchev Exp $ */
1/* $OpenBSD: umac.c,v 1.2 2007/09/12 19:39:19 stevesk Exp $ */
2/* -----------------------------------------------------------------------
3 *
4 * umac.c -- C Implementation UMAC Message Authentication
5 *
6 * Version 0.93b of rfc4418.txt -- 2006 July 18
7 *
8 * For a full description of UMAC message authentication see the UMAC
9 * world-wide-web page at http://www.cs.ucdavis.edu/~rogaway/umac

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

61
62/* ---------------------------------------------------------------------- */
63/* -- Global Includes --------------------------------------------------- */
64/* ---------------------------------------------------------------------- */
65
66#include "includes.h"
67#include <sys/types.h>
68
2/* -----------------------------------------------------------------------
3 *
4 * umac.c -- C Implementation UMAC Message Authentication
5 *
6 * Version 0.93b of rfc4418.txt -- 2006 July 18
7 *
8 * For a full description of UMAC message authentication see the UMAC
9 * world-wide-web page at http://www.cs.ucdavis.edu/~rogaway/umac

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

61
62/* ---------------------------------------------------------------------- */
63/* -- Global Includes --------------------------------------------------- */
64/* ---------------------------------------------------------------------- */
65
66#include "includes.h"
67#include <sys/types.h>
68
69#include "xmalloc.h"
69#include "umac.h"
70#include <string.h>
71#include <stdlib.h>
72#include <stddef.h>
73
74/* ---------------------------------------------------------------------- */
75/* --- Primitive Data Types --- */
76/* ---------------------------------------------------------------------- */

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

1191/* ---------------------------------------------------------------------- */
1192
1193int umac_delete(struct umac_ctx *ctx)
1194/* Deallocate the ctx structure */
1195{
1196 if (ctx) {
1197 if (ALLOC_BOUNDARY)
1198 ctx = (struct umac_ctx *)ctx->free_ptr;
70#include "umac.h"
71#include <string.h>
72#include <stdlib.h>
73#include <stddef.h>
74
75/* ---------------------------------------------------------------------- */
76/* --- Primitive Data Types --- */
77/* ---------------------------------------------------------------------- */

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

1192/* ---------------------------------------------------------------------- */
1193
1194int umac_delete(struct umac_ctx *ctx)
1195/* Deallocate the ctx structure */
1196{
1197 if (ctx) {
1198 if (ALLOC_BOUNDARY)
1199 ctx = (struct umac_ctx *)ctx->free_ptr;
1199 free(ctx);
1200 xfree(ctx);
1200 }
1201 return (1);
1202}
1203
1204/* ---------------------------------------------------------------------- */
1205
1206struct umac_ctx *umac_new(u_char key[])
1207/* Dynamically allocate a umac_ctx struct, initialize variables,
1208 * generate subkeys from key. Align to 16-byte boundary.
1209 */
1210{
1211 struct umac_ctx *ctx, *octx;
1212 size_t bytes_to_add;
1213 aes_int_key prf_key;
1214
1201 }
1202 return (1);
1203}
1204
1205/* ---------------------------------------------------------------------- */
1206
1207struct umac_ctx *umac_new(u_char key[])
1208/* Dynamically allocate a umac_ctx struct, initialize variables,
1209 * generate subkeys from key. Align to 16-byte boundary.
1210 */
1211{
1212 struct umac_ctx *ctx, *octx;
1213 size_t bytes_to_add;
1214 aes_int_key prf_key;
1215
1215 octx = ctx = malloc(sizeof(*ctx) + ALLOC_BOUNDARY);
1216 octx = ctx = xmalloc(sizeof(*ctx) + ALLOC_BOUNDARY);
1216 if (ctx) {
1217 if (ALLOC_BOUNDARY) {
1218 bytes_to_add = ALLOC_BOUNDARY -
1219 ((ptrdiff_t)ctx & (ALLOC_BOUNDARY - 1));
1220 ctx = (struct umac_ctx *)((u_char *)ctx + bytes_to_add);
1221 }
1222 ctx->free_ptr = octx;
1223 aes_key_setup(key,prf_key);

--- 49 unchanged lines hidden ---
1217 if (ctx) {
1218 if (ALLOC_BOUNDARY) {
1219 bytes_to_add = ALLOC_BOUNDARY -
1220 ((ptrdiff_t)ctx & (ALLOC_BOUNDARY - 1));
1221 ctx = (struct umac_ctx *)((u_char *)ctx + bytes_to_add);
1222 }
1223 ctx->free_ptr = octx;
1224 aes_key_setup(key,prf_key);

--- 49 unchanged lines hidden ---