The introduced SHA1_NOFINAL hasher was not sufficient for EAP-AKA,
[strongswan.git] / src / libstrongswan / fips / fips_signer.c
1 /*
2 * Copyright (C) 2007 Bruno Krieg, Daniel Wydler
3 * Hochschule fuer Technik Rapperswil, Switzerland
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 *
15 * $Id$
16 */
17
18 #include <stdio.h>
19
20 #include <crypto/hashers/hasher.h>
21 #include "fips.h"
22
23 int main(int argc, char* argv[])
24 {
25 FILE *f;
26 char *hmac_key = "strongSwan Version " VERSION;
27 char hmac_signature[BUF_LEN];
28
29 if (!fips_compute_hmac_signature(hmac_key, hmac_signature))
30 {
31 exit(1);
32 }
33
34 /**
35 * write computed HMAC signature to fips_signature.h
36 */
37 f = fopen("fips_signature.h", "wt");
38
39 if (f == NULL)
40 {
41 exit(1);
42 }
43 fprintf(f, "/* SHA-1 HMAC signature computed over TEXT and RODATA of libstrongswan\n");
44 fprintf(f, " *\n");
45 fprintf(f, " * This file has been automatically generated by fips_signer\n");
46 fprintf(f, " * Do not edit manually!\n");
47 fprintf(f, " */\n");
48 fprintf(f, "\n");
49 fprintf(f, "#ifndef FIPS_SIGNATURE_H_\n");
50 fprintf(f, "#define FIPS_SIGNATURE_H_\n");
51 fprintf(f, "\n");
52 fprintf(f, "const char *hmac_key = \"%s\";\n", hmac_key);
53 fprintf(f, "const char *hmac_signature = \"%s\";\n", hmac_signature);
54 fprintf(f, "\n");
55 fprintf(f, "#endif /* FIPS_SIGNATURE_H_ @} */\n");
56 fclose(f);
57 exit(0);
58 }