mirror of
https://github.com/polhenarejos/pico-hsm.git
synced 2026-02-07 19:18:23 +00:00
and add the Enterprise / Commercial licensing option.
Main changes:
- Replace GPLv3 headers with AGPLv3 headers in source files.
- Update LICENSE file to the full AGPLv3 text.
- Add ENTERPRISE.md describing the dual-licensing model:
* Community Edition: AGPLv3 (strong copyleft, including network use).
* Enterprise / Commercial Edition: proprietary license for production /
multi-user / OEM use without the obligation to disclose derivative code.
- Update README with a new "License and Commercial Use" section pointing to
ENTERPRISE.md and clarifying how companies can obtain a commercial license.
Why this change:
- AGPLv3 ensures that modified versions offered as a service or deployed
in production environments must provide corresponding source code.
- The Enterprise / Commercial edition provides organizations with an
alternative proprietary license that allows internal, large-scale, or OEM
use (bulk provisioning, policy enforcement, inventory / revocation,
custom attestation, signed builds) without AGPL disclosure obligations.
This commit formally marks the first release that is dual-licensed:
AGPLv3 for the Community Edition and a proprietary commercial license
for Enterprise customers.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
68 lines
2.4 KiB
C
68 lines
2.4 KiB
C
/*
|
|
* This file is part of the Pico HSM distribution (https://github.com/polhenarejos/pico-hsm).
|
|
* Copyright (c) 2022 Pol Henarejos.
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU Affero General Public License as published by
|
|
* the Free Software Foundation, version 3.
|
|
*
|
|
* This program 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
|
|
* Affero General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#include "sc_hsm.h"
|
|
#include "files.h"
|
|
|
|
int cmd_list_keys() {
|
|
/* First we send DEV private key */
|
|
/* Both below conditions should be always TRUE */
|
|
if (search_file(EF_PRKD_DEV)) {
|
|
res_APDU_size += put_uint16_t_be(EF_PRKD_DEV, res_APDU + res_APDU_size);
|
|
}
|
|
if (search_file(EF_KEY_DEV)) {
|
|
res_APDU_size += put_uint16_t_be(EF_KEY_DEV, res_APDU + res_APDU_size);
|
|
}
|
|
//first CC
|
|
for (int i = 0; i < dynamic_files; i++) {
|
|
file_t *f = &dynamic_file[i];
|
|
if ((f->fid & 0xff00) == (KEY_PREFIX << 8)) {
|
|
res_APDU[res_APDU_size++] = KEY_PREFIX;
|
|
res_APDU[res_APDU_size++] = f->fid & 0xff;
|
|
}
|
|
}
|
|
for (int i = 0; i < dynamic_files; i++) {
|
|
file_t *f = &dynamic_file[i];
|
|
if ((f->fid & 0xff00) == (PRKD_PREFIX << 8)) {
|
|
res_APDU[res_APDU_size++] = PRKD_PREFIX;
|
|
res_APDU[res_APDU_size++] = f->fid & 0xff;
|
|
}
|
|
}
|
|
//second CD
|
|
for (int i = 0; i < dynamic_files; i++) {
|
|
file_t *f = &dynamic_file[i];
|
|
if ((f->fid & 0xff00) == (CD_PREFIX << 8)) {
|
|
res_APDU[res_APDU_size++] = CD_PREFIX;
|
|
res_APDU[res_APDU_size++] = f->fid & 0xff;
|
|
}
|
|
}
|
|
|
|
for (int i = 0; i < dynamic_files; i++) {
|
|
file_t *f = &dynamic_file[i];
|
|
if ((f->fid & 0xff00) == (DCOD_PREFIX << 8)) {
|
|
res_APDU[res_APDU_size++] = DCOD_PREFIX;
|
|
res_APDU[res_APDU_size++] = f->fid & 0xff;
|
|
}
|
|
}
|
|
#if !defined(ENABLE_EMULATION) && !defined(ESP_PLATFORM)
|
|
if ((apdu.rlen + 2 + 10) % 64 == 0) { // FIX for strange behaviour with PSCS and multiple of 64
|
|
res_APDU[res_APDU_size++] = 0;
|
|
res_APDU[res_APDU_size++] = 0;
|
|
}
|
|
#endif
|
|
return SW_OK();
|
|
}
|