File: skeinwrap.c

package info (click to toggle)
ekeyd 1.1.5-8
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 812 kB
  • sloc: ansic: 5,259; sh: 333; makefile: 203; perl: 150; xml: 17
file content (29 lines) | stat: -rw-r--r-- 788 bytes parent folder | download | duplicates (5)
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
/* skeinwrap.c
 *
 * Wrappers for standard skein operations for the eKey
 *
 * Copyright 2009 Simtec Electronics
 *
 * For licence terms refer to the COPYING file.
 */

#include "skeinwrap.h"

static unsigned char keybuf[44]; /* 12 bytes serial, 32 bytes secret */

void 
PrepareSkein(EKeySkein *skein,
              const unsigned char *serial,
              const unsigned char *secret,
              const char *personalisation)
{
  int i;
  for (i = 0; i < 12; ++i) keybuf[i] = serial[i];
  for (i = 0; i < 32; ++i) keybuf[i + 12] = secret[i];
  
  Skein_256_InitExt(skein, 256, SKEIN_CFG_TREE_INFO_SEQUENTIAL,
                    keybuf, 44);
  Skein_Start_New_Type(skein, PERS);
  Skein_256_Update(skein, (unsigned char *)personalisation, 96);
  Skein_Start_New_Type(skein, MSG);
}