mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-30 03:18:20 +00:00
43 lines
1.0 KiB
Mako
43 lines
1.0 KiB
Mako
// 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:
|
|
for app_id in app.u2f:
|
|
fido_entries.append((bytes.fromhex(app_id), "U2F", "", app))
|
|
for origin in app.webauthn:
|
|
rp_id_hash = sha256(origin.encode()).digest()
|
|
origin_str = " ({})".format(origin)
|
|
fido_entries.append((rp_id_hash, "WebAuthn", origin_str, app))
|
|
%>\
|
|
// clang-format off
|
|
static const U2FWellKnown u2f_well_known[] = {
|
|
% for rp_id_hash, type, origin_str, app in fido_entries:
|
|
{
|
|
// ${type} for ${app.label}${origin_str}
|
|
${c_bytes(rp_id_hash)},
|
|
${c_str(app.label)}
|
|
},
|
|
% endfor
|
|
};
|
|
// clang-format on
|
|
|
|
#endif // __U2F_KNOWNAPPS_H__
|
|
|