Fix kyber commands bugs

This commit is contained in:
Zhi Guan
2026-01-12 21:53:39 +08:00
parent 3afd4a047b
commit de57d7fce1
5 changed files with 19 additions and 14 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2025 The GmSSL Project. All Rights Reserved.
* Copyright 2014-2026 The GmSSL Project. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
@@ -49,6 +49,8 @@ int kyberdecap_main(int argc, char **argv)
KYBER_CIPHERTEXT ciphertext;
init_zeta();
memset(&key, 0, sizeof(key));
argc--;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2025 The GmSSL Project. All Rights Reserved.
* Copyright 2014-2026 The GmSSL Project. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
@@ -19,10 +19,6 @@
static const char *usage = "-pubkey file [-out file] -outkey file [-verbose]\n";
// decap 中的out一定是secret而in 一定是ciphertext
// encap 中的out 是decap的in因此encap中的out是ciphertext而输出的secret是特殊的
static const char *options =
"Options\n"
" -pubkey file Input public key file\n"
@@ -52,6 +48,7 @@ int kyberencap_main(int argc, char **argv)
uint8_t outkey[32];
init_zeta();
argc--;
argv++;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2025 The GmSSL Project. All Rights Reserved.
* Copyright 2014-2026 The GmSSL Project. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
@@ -42,6 +42,8 @@ int kyberkeygen_main(int argc, char **argv)
uint8_t *ppubout = pubout;
size_t outlen = 0, puboutlen = 0;
init_zeta();
memset(&key, 0, sizeof(key));
argc--;