/*
+ * Copyright (C) 2018 Tobias Brunner
* Copyright (C) 2005-2006 Martin Willi
* Copyright (C) 2005 Jan Hutter
- * Hochschule fuer Technik Rapperswil
+ * HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
#include "prf.h"
+#include <asn1/oid.h>
+
ENUM_BEGIN(pseudo_random_function_names, PRF_UNDEFINED, PRF_CAMELLIA128_XCBC,
"PRF_UNDEFINED",
"PRF_FIPS_SHA1_160",
"PRF_AES128_CMAC");
ENUM_END(pseudo_random_function_names, PRF_AES128_CMAC);
+/*
+ * Described in header.
+ */
+pseudo_random_function_t pseudo_random_function_from_oid(int oid)
+{
+ switch (oid)
+ {
+ case OID_HMAC_SHA1:
+ return PRF_HMAC_SHA1;
+ case OID_HMAC_SHA256:
+ return PRF_HMAC_SHA2_256;
+ case OID_HMAC_SHA384:
+ return PRF_HMAC_SHA2_384;
+ case OID_HMAC_SHA512:
+ return PRF_HMAC_SHA2_512;
+ case OID_HMAC_SHA224:
+ case OID_HMAC_SHA512_224:
+ case OID_HMAC_SHA512_256:
+ default:
+ return PRF_UNDEFINED;
+ }
+}
/*
+ * Copyright (C) 2018 Tobias Brunner
* Copyright (C) 2005-2006 Martin Willi
* Copyright (C) 2005 Jan Hutter
- * Hochschule fuer Technik Rapperswil
+ * HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
void (*destroy)(prf_t *this);
};
+/**
+ * Conversion of ASN.1 OID to PRF algorithm.
+ *
+ * @param oid ASN.1 OID
+ * @return encryption algorithm, PRF_UNDEFINED if OID unsupported
+ */
+pseudo_random_function_t pseudo_random_function_from_oid(int oid);
+
#endif /** PRF_H_ @}*/