File: apiweb.c

package info (click to toggle)
spplus 1.0-10
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 1,060 kB
  • ctags: 250
  • sloc: sh: 8,331; ansic: 2,004; makefile: 64; php: 50; awk: 43
file content (42 lines) | stat: -rw-r--r-- 1,016 bytes parent folder | download
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
30
31
32
33
34
35
36
37
38
39
40
41
42
/* NOM........  apiWeb.c				*/
/* OBJET......  High Level API secure functions		*/
/* PROJET.....	Integration to SFP			*/
/* REFERENCES.                         			*/
/* VERSION....  1.0                    			*/
/* HISTORIQUE.  					*/


/*----------------------------------------------------------*/
/*			Include Files													*/
/*----------------------------------------------------------*/

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "sha.h"
#include "des.h"




/*--------------------------------------------------------------
 *			HMacCalcul()
 *--------------------------------------------------------------
 */
int  HMacCalcul(unsigned char* merKey,unsigned char* dataIn, int lgDataIn,unsigned char* hMac)
{
unsigned char h[20];
unsigned char Ks[8];

   if (!memcmp(merKey,merKey+20,4))
   	return 1;

   GenKs(Ks);

   DecryptCBC(Ks,merKey,24);
   Hmac(merKey,20,dataIn,lgDataIn,h);
   ConvertInAsciiStream(h,20,hMac);
   return 0;
}