1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-22 15:38:11 +00:00

legacy: auto-generate U2F/FIDO apps

This commit is contained in:
matejcik 2019-11-28 14:45:42 +01:00 committed by matejcik
parent a46fd6f508
commit f5a6342844
2 changed files with 42 additions and 195 deletions

View File

@ -1,195 +0,0 @@
/*
* This file is part of the Trezor project, https://trezor.io/
*
* Copyright (C) 2016 Jochen Hoenicke <hoenicke@gmail.com>
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __U2F_KNOWNAPPS_H_INCLUDED__
#define __U2F_KNOWNAPPS_H_INCLUDED__
#include <stdint.h>
#include "u2f/u2f.h"
typedef struct {
const uint8_t appid[U2F_APPID_SIZE];
const char *appname;
} U2FWellKnown;
// contents generated via script in
// trezor-common/defs/webauthn/gen.py
// do not edit manually
// clang-format off
static const U2FWellKnown u2f_well_known[] = {
{
// WebAuthn: www.binance.com
{ 0xc3, 0x40, 0x8c, 0x04, 0x47, 0x88, 0xae, 0xa5, 0xb3, 0xdf, 0x30, 0x89, 0x52, 0xfd, 0x8c, 0xa3, 0xc7, 0x0e, 0x21, 0xfe, 0xf4, 0xf6, 0xc1, 0xc2, 0x37, 0x4c, 0xaa, 0x1d, 0xf9, 0xb2, 0x8d, 0xdd },
"Binance"
},
{
// U2F
{ 0x12, 0x74, 0x3b, 0x92, 0x12, 0x97, 0xb7, 0x7f, 0x11, 0x35, 0xe4, 0x1f, 0xde, 0xdd, 0x4a, 0x84, 0x6a, 0xfe, 0x82, 0xe1, 0xf3, 0x69, 0x32, 0xa9, 0x91, 0x2f, 0x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4, 0xd5, 0xef, 0xcb, 0x83 },
"Dropbox"
},
{
// U2F
{ 0xf3, 0xe2, 0x04, 0x2f, 0x94, 0x60, 0x7d, 0xa0, 0xa9, 0xc1, 0xf3, 0xb9, 0x5e, 0x0d, 0x2f, 0x2b, 0xb2, 0xe0, 0x69, 0xc5, 0xbb, 0x4f, 0xa7, 0x64, 0xaf, 0xfa, 0x64, 0x7d, 0x84, 0x7b, 0x7e, 0xd6 },
"Duo"
},
{
// U2F
{ 0x69, 0x66, 0xab, 0xe3, 0x67, 0x4e, 0xa2, 0xf5, 0x30, 0x79, 0xeb, 0x71, 0x01, 0x97, 0x84, 0x8c, 0x9b, 0xe6, 0xf3, 0x63, 0x99, 0x2f, 0xd0, 0x29, 0xe9, 0x89, 0x84, 0x47, 0xcb, 0x9f, 0x00, 0x84 },
"FastMail"
},
{
// U2F
{ 0x9d, 0x61, 0x44, 0x2f, 0x5c, 0xe1, 0x33, 0xbd, 0x46, 0x54, 0x4f, 0xc4, 0x2f, 0x0a, 0x6d, 0x54, 0xc0, 0xde, 0xb8, 0x88, 0x40, 0xca, 0xc2, 0xb6, 0xae, 0xfa, 0x65, 0x14, 0xf8, 0x93, 0x49, 0xe9 },
"Fedora"
},
{
// U2F
{ 0xa4, 0xe2, 0x2d, 0xca, 0xfe, 0xa7, 0xe9, 0x0e, 0x12, 0x89, 0x50, 0x11, 0x39, 0x89, 0xfc, 0x45, 0x97, 0x8d, 0xc9, 0xfb, 0x87, 0x76, 0x75, 0x60, 0x51, 0x6c, 0x1c, 0x69, 0xdf, 0xdf, 0xd1, 0x96 },
"Gandi"
},
{
// WebAuthn: gandi.net
{ 0x54, 0xce, 0x65, 0x1e, 0xd7, 0x15, 0xb4, 0xaa, 0xa7, 0x55, 0xee, 0xce, 0xbd, 0x4e, 0xa0, 0x95, 0x08, 0x15, 0xb3, 0x34, 0xbd, 0x07, 0xd1, 0x09, 0x89, 0x3e, 0x96, 0x30, 0x18, 0xcd, 0xdb, 0xd9 },
"Gandi"
},
{
// U2F
{ 0x70, 0x61, 0x7d, 0xfe, 0xd0, 0x65, 0x86, 0x3a, 0xf4, 0x7c, 0x15, 0x55, 0x6c, 0x91, 0x79, 0x88, 0x80, 0x82, 0x8c, 0xc4, 0x07, 0xfd, 0xf7, 0x0a, 0xe8, 0x50, 0x11, 0x56, 0x94, 0x65, 0xa0, 0x75 },
"GitHub"
},
{
// WebAuthn: github.com
{ 0x3a, 0xeb, 0x00, 0x24, 0x60, 0x38, 0x1c, 0x6f, 0x25, 0x8e, 0x83, 0x95, 0xd3, 0x02, 0x6f, 0x57, 0x1f, 0x0d, 0x9a, 0x76, 0x48, 0x8d, 0xcd, 0x83, 0x76, 0x39, 0xb1, 0x3a, 0xed, 0x31, 0x65, 0x60 },
"GitHub"
},
{
// U2F
{ 0xe7, 0xbe, 0x96, 0xa5, 0x1b, 0xd0, 0x19, 0x2a, 0x72, 0x84, 0x0d, 0x2e, 0x59, 0x09, 0xf7, 0x2b, 0xa8, 0x2a, 0x2f, 0xe9, 0x3f, 0xaa, 0x62, 0x4f, 0x03, 0x39, 0x6b, 0x30, 0xe4, 0x94, 0xc8, 0x04 },
"GitLab"
},
{
// U2F
{ 0xa5, 0x46, 0x72, 0xb2, 0x22, 0xc4, 0xcf, 0x95, 0xe1, 0x51, 0xed, 0x8d, 0x4d, 0x3c, 0x76, 0x7a, 0x6c, 0xc3, 0x49, 0x43, 0x59, 0x43, 0x79, 0x4e, 0x88, 0x4f, 0x3d, 0x02, 0x3a, 0x82, 0x29, 0xfd },
"Google"
},
{
// WebAuthn: google.com
{ 0xd4, 0xc9, 0xd9, 0x02, 0x73, 0x26, 0x27, 0x1a, 0x89, 0xce, 0x51, 0xfc, 0xaf, 0x32, 0x8e, 0xd6, 0x73, 0xf1, 0x7b, 0xe3, 0x34, 0x69, 0xff, 0x97, 0x9e, 0x8a, 0xb8, 0xdd, 0x50, 0x1e, 0x66, 0x4f },
"Google"
},
{
// U2F
{ 0x53, 0xa1, 0x5b, 0xa4, 0x2a, 0x7c, 0x03, 0x25, 0xb8, 0xdb, 0xee, 0x28, 0x96, 0x34, 0xa4, 0x8f, 0x58, 0xae, 0xa3, 0x24, 0x66, 0x45, 0xd5, 0xff, 0x41, 0x8f, 0x9b, 0xb8, 0x81, 0x98, 0x85, 0xa9 },
"Keeper"
},
{
// U2F
{ 0xd6, 0x5f, 0x00, 0x5e, 0xf4, 0xde, 0xa9, 0x32, 0x0c, 0x99, 0x73, 0x05, 0x3c, 0x95, 0xff, 0x60, 0x20, 0x11, 0x5d, 0x5f, 0xec, 0x1b, 0x7f, 0xee, 0x41, 0xa5, 0x78, 0xe1, 0x8d, 0xf9, 0xca, 0x8c },
"Keeper"
},
{
// U2F
{ 0xd7, 0x55, 0xc5, 0x27, 0xa8, 0x6b, 0xf7, 0x84, 0x45, 0xc2, 0x82, 0xe7, 0x13, 0xdc, 0xb8, 0x6d, 0x46, 0xff, 0x8b, 0x3c, 0xaf, 0xcf, 0xb7, 0x3b, 0x2e, 0x8c, 0xbe, 0x6c, 0x08, 0x84, 0xcb, 0x24 },
"LastPass"
},
{
// WebAuthn: secure.login.gov
{ 0xf8, 0x3f, 0xc3, 0xa1, 0xb2, 0x89, 0xa0, 0xde, 0xc5, 0xc1, 0xc8, 0xaa, 0x07, 0xe9, 0xb5, 0xdd, 0x9c, 0xbb, 0x76, 0xf6, 0xb2, 0xf5, 0x60, 0x60, 0x17, 0x66, 0x72, 0x68, 0xe5, 0xb9, 0xc4, 0x5e },
"login.gov"
},
{
// WebAuthn: login.microsoft.com
{ 0x35, 0x6c, 0x9e, 0xd4, 0xa0, 0x93, 0x21, 0xb9, 0x69, 0x5f, 0x1e, 0xaf, 0x91, 0x82, 0x03, 0xf1, 0xb5, 0x5f, 0x68, 0x9d, 0xa6, 0x1f, 0xbc, 0x96, 0x18, 0x4c, 0x15, 0x7d, 0xda, 0x68, 0x0c, 0x81 },
"Microsoft"
},
{
// WebAuthn: mojeid.cz
{ 0xab, 0x2d, 0xaf, 0x07, 0x43, 0xde, 0x78, 0x2a, 0x70, 0x18, 0x9a, 0x0f, 0x5e, 0xfc, 0x30, 0x90, 0x2f, 0x92, 0x5b, 0x9f, 0x9a, 0x18, 0xc5, 0xd7, 0x14, 0x1b, 0x7b, 0x12, 0xf8, 0xa0, 0x10, 0x0c },
"mojeID"
},
{
// U2F
{ 0x08, 0xb2, 0xa3, 0xd4, 0x19, 0x39, 0xaa, 0x31, 0x66, 0x84, 0x93, 0xcb, 0x36, 0xcd, 0xcc, 0x4f, 0x16, 0xc4, 0xd9, 0xb4, 0xc8, 0x23, 0x8b, 0x73, 0xc2, 0xf6, 0x72, 0xc0, 0x33, 0x00, 0x71, 0x97 },
"Slush Pool"
},
{
// U2F
{ 0x38, 0x80, 0x4f, 0x2e, 0xff, 0x74, 0xf2, 0x28, 0xb7, 0x41, 0x51, 0xc2, 0x01, 0xaa, 0x82, 0xe7, 0xe8, 0xee, 0xfc, 0xac, 0xfe, 0xcf, 0x23, 0xfa, 0x14, 0x6b, 0x13, 0xa3, 0x76, 0x66, 0x31, 0x4f },
"Slush Pool"
},
{
// U2F
{ 0x2a, 0xc6, 0xad, 0x09, 0xa6, 0xd0, 0x77, 0x2c, 0x44, 0xda, 0x73, 0xa6, 0x07, 0x2f, 0x9d, 0x24, 0x0f, 0xc6, 0x85, 0x4a, 0x70, 0xd7, 0x9c, 0x10, 0x24, 0xff, 0x7c, 0x75, 0x59, 0x59, 0x32, 0x92 },
"Stripe"
},
{
// U2F
{ 0x1b, 0x3c, 0x16, 0xdd, 0x2f, 0x7c, 0x46, 0xe2, 0xb4, 0xc2, 0x89, 0xdc, 0x16, 0x74, 0x6b, 0xcc, 0x60, 0xdf, 0xcf, 0x0f, 0xb8, 0x18, 0xe1, 0x32, 0x15, 0x52, 0x6e, 0x14, 0x08, 0xe7, 0xf4, 0x68 },
"u2f.bin.coffee"
},
{
// WebAuthn: webauthn.bin.coffee
{ 0xa6, 0x42, 0xd2, 0x1b, 0x7c, 0x6d, 0x55, 0xe1, 0xce, 0x23, 0xc5, 0x39, 0x98, 0x28, 0xd2, 0xc7, 0x49, 0xbf, 0x6a, 0x6e, 0xf2, 0xfe, 0x03, 0xcc, 0x9e, 0x10, 0xcd, 0xf4, 0xed, 0x53, 0x08, 0x8b },
"webauthn.bin.coffee"
},
{
// WebAuthn: webauthn.io
{ 0x74, 0xa6, 0xea, 0x92, 0x13, 0xc9, 0x9c, 0x2f, 0x74, 0xb2, 0x24, 0x92, 0xb3, 0x20, 0xcf, 0x40, 0x26, 0x2a, 0x94, 0xc1, 0xa9, 0x50, 0xa0, 0x39, 0x7f, 0x29, 0x25, 0x0b, 0x60, 0x84, 0x1e, 0xf0 },
"WebAuthn.io"
},
{
// WebAuthn: webauthn.me
{ 0xf9, 0x5b, 0xc7, 0x38, 0x28, 0xee, 0x21, 0x0f, 0x9f, 0xd3, 0xbb, 0xe7, 0x2d, 0x97, 0x90, 0x80, 0x13, 0xb0, 0xa3, 0x75, 0x9e, 0x9a, 0xea, 0x3d, 0x0a, 0xe3, 0x18, 0x76, 0x6c, 0xd2, 0xe1, 0xad },
"WebAuthn.me"
},
{
// WebAuthn: demo.yubico.com
{ 0xc4, 0x6c, 0xef, 0x82, 0xad, 0x1b, 0x54, 0x64, 0x77, 0x59, 0x1d, 0x00, 0x8b, 0x08, 0x75, 0x9e, 0xc3, 0xe6, 0xd2, 0xec, 0xb4, 0xf3, 0x94, 0x74, 0xbf, 0xea, 0x69, 0x69, 0x92, 0x5d, 0x03, 0xb7 },
"demo.yubico.com"
},
};
// clang-format on
#endif // U2F_KNOWNAPPS_INCLUDED

View File

@ -0,0 +1,42 @@
// 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 u2f in app.u2f:
fido_entries.append((bytes.fromhex(u2f), "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__