2019-11-28 13:45:42 +00:00
|
|
|
// This file is automatically generated from u2f_knownapps.h.mako
|
|
|
|
// DO NOT EDIT
|
|
|
|
|
|
|
|
#ifndef __U2F_KNOWNAPPS_H__
|
|
|
|
#define __U2F_KNOWNAPPS_H__
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include "u2f/u2f.h"
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
const uint8_t appid[U2F_APPID_SIZE];
|
|
|
|
const char *appname;
|
|
|
|
} U2FWellKnown;
|
|
|
|
|
|
|
|
<%
|
|
|
|
from hashlib import sha256
|
|
|
|
|
|
|
|
def c_bytes(rp_id_hash):
|
|
|
|
return "{ " + ", ".join(["0x%02x" % x for x in rp_id_hash]) + " }"
|
|
|
|
|
|
|
|
fido_entries = []
|
|
|
|
for app in fido:
|
2020-07-30 10:11:26 +00:00
|
|
|
for u2f in app.u2f:
|
|
|
|
fido_entries.append((u2f["label"], bytes.fromhex(u2f["app_id"]), "U2F", app))
|
2019-11-28 13:45:42 +00:00
|
|
|
for origin in app.webauthn:
|
|
|
|
rp_id_hash = sha256(origin.encode()).digest()
|
2020-07-30 10:11:26 +00:00
|
|
|
fido_entries.append((origin, rp_id_hash, "WebAuthn", app))
|
2019-11-28 13:45:42 +00:00
|
|
|
%>\
|
|
|
|
// clang-format off
|
|
|
|
static const U2FWellKnown u2f_well_known[] = {
|
2020-07-30 10:11:26 +00:00
|
|
|
% for label, rp_id_hash, type, app in fido_entries:
|
2019-11-28 13:45:42 +00:00
|
|
|
{
|
2020-07-30 10:11:26 +00:00
|
|
|
// ${type} for ${app.name}
|
2019-11-28 13:45:42 +00:00
|
|
|
${c_bytes(rp_id_hash)},
|
2020-07-30 10:11:26 +00:00
|
|
|
${c_str(label)}
|
2019-11-28 13:45:42 +00:00
|
|
|
},
|
|
|
|
% endfor
|
|
|
|
};
|
|
|
|
// clang-format on
|
|
|
|
|
|
|
|
#endif // __U2F_KNOWNAPPS_H__
|