2 * Copyright (C) 2007 Bruno Krieg, Daniel Wydler
3 * Hochschule fuer Technik Rapperswil, Switzerland
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>.
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
20 #include <crypto/hashers/hasher.h>
23 int main(int argc
, char* argv
[])
26 char *hmac_key
= "strongSwan Version " VERSION
;
27 char hmac_signature
[BUF_LEN
];
29 /* initialize library */
30 library_init(STRONGSWAN_CONF
);
31 lib
->plugins
->load(lib
->plugins
, IPSEC_PLUGINDIR
, "libstrongswan-");
33 if (!fips_compute_hmac_signature(hmac_key
, hmac_signature
))
39 * write computed HMAC signature to fips_signature.h
41 f
= fopen("fips_signature.h", "wt");
47 fprintf(f
, "/* SHA-1 HMAC signature computed over TEXT and RODATA of libstrongswan\n");
49 fprintf(f
, " * This file has been automatically generated by fips_signer\n");
50 fprintf(f
, " * Do not edit manually!\n");
53 fprintf(f
, "#ifndef FIPS_SIGNATURE_H_\n");
54 fprintf(f
, "#define FIPS_SIGNATURE_H_\n");
56 fprintf(f
, "const char *hmac_key = \"%s\";\n", hmac_key
);
57 fprintf(f
, "const char *hmac_signature = \"%s\";\n", hmac_signature
);
59 fprintf(f
, "#endif /* FIPS_SIGNATURE_H_ @} */\n");