mirror of
https://github.com/open-quantum-safe/liboqs.git
synced 2025-10-04 00:02:01 -04:00
Add support for LMS and XMSS. Key generation and signing are disabled behind a feature flag labelled "hazardous experimental." --------- Signed-off-by: Duc Tri Nguyen <dnguye69@gmu.edu> Signed-off-by: Spencer Wilson <spencer.wilson@uwaterloo.ca> Signed-off-by: Norman Ashley <nashley@cisco.com> Signed-off-by: Douglas Stebila <dstebila@uwaterloo.ca> Co-authored-by: Duc Tri Nguyen <dnguye69@gmu.edu> Co-authored-by: Douglas Stebila <dstebila@uwaterloo.ca> Co-authored-by: Duc Nguyen <106774416+ducnguyen-sb@users.noreply.github.com> Co-authored-by: Douglas Stebila <dstebila@users.noreply.github.com> Co-authored-by: Duc Nguyen <ductri.nguyen@sandboxquantum.com> Co-authored-by: Spencer Wilson <spencer.wilson@uwaterloo.ca> Co-authored-by: Jason Goertzen <133878263+jgoertzen-sb@users.noreply.github.com>
79 lines
2.4 KiB
C
79 lines
2.4 KiB
C
/*
|
|
* dump_alg_info.c
|
|
*
|
|
* Print algorithm information in YAML format; used in conjunction with test_alg_info.py.
|
|
*
|
|
* SPDX-License-Identifier: MIT
|
|
*/
|
|
|
|
#include <stdbool.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
#include <oqs/oqs.h>
|
|
|
|
int main(void) {
|
|
|
|
OQS_init();
|
|
// iterate through KEMs and print info
|
|
printf("KEMs:\n");
|
|
for (size_t i = 0; i < OQS_KEM_algs_length; i++) {
|
|
const char *kem_name = OQS_KEM_alg_identifier(i);
|
|
printf(" %s:\n", kem_name);
|
|
OQS_KEM *kem = OQS_KEM_new(kem_name);
|
|
if (kem == NULL) {
|
|
printf(" isnull: true\n");
|
|
continue;
|
|
}
|
|
printf(" isnull: false\n");
|
|
printf(" claimed-nist-level: %d\n", kem->claimed_nist_level);
|
|
printf(" claimed-security: %s\n", kem->ind_cca ? "IND-CCA2" : "IND-CPA");
|
|
printf(" length-public-key: %zu\n", kem->length_public_key);
|
|
printf(" length-ciphertext: %zu\n", kem->length_ciphertext);
|
|
printf(" length-secret-key: %zu\n", kem->length_secret_key);
|
|
printf(" length-shared-secret: %zu\n", kem->length_shared_secret);
|
|
OQS_KEM_free(kem);
|
|
}
|
|
|
|
// iterate through signature schemes and print info
|
|
printf("SIGs:\n");
|
|
for (size_t i = 0; i < OQS_SIG_algs_length; i++) {
|
|
const char *sig_name = OQS_SIG_alg_identifier(i);
|
|
printf(" %s:\n", sig_name);
|
|
OQS_SIG *sig = OQS_SIG_new(sig_name);
|
|
if (sig == NULL) {
|
|
printf(" isnull: true\n");
|
|
continue;
|
|
}
|
|
printf(" isnull: false\n");
|
|
printf(" claimed-nist-level: %d\n", sig->claimed_nist_level);
|
|
printf(" claimed-security: %s\n", sig->euf_cma ? "EUF-CMA" : "none");
|
|
printf(" length-public-key: %zu\n", sig->length_public_key);
|
|
printf(" length-secret-key: %zu\n", sig->length_secret_key);
|
|
printf(" length-signature: %zu\n", sig->length_signature);
|
|
OQS_SIG_free(sig);
|
|
}
|
|
|
|
// iterate through stateful signature schemes and print info
|
|
printf("SIG_STFLs:\n");
|
|
for (size_t i = 0; i < OQS_SIG_STFL_algs_length; i++) {
|
|
const char *sig_name = OQS_SIG_STFL_alg_identifier(i);
|
|
printf(" %s:\n", sig_name);
|
|
OQS_SIG_STFL *sig = OQS_SIG_STFL_new(sig_name);
|
|
if (sig == NULL) {
|
|
printf(" isnull: true\n");
|
|
continue;
|
|
}
|
|
printf(" isnull: false\n");
|
|
printf(" claimed-security: %s\n", sig->euf_cma ? "EUF-CMA" : "none");
|
|
printf(" length-public-key: %zu\n", sig->length_public_key);
|
|
printf(" length-secret-key: %zu\n", sig->length_secret_key);
|
|
printf(" length-signature: %zu\n", sig->length_signature);
|
|
OQS_SIG_STFL_free(sig);
|
|
}
|
|
|
|
OQS_destroy();
|
|
}
|
|
|