Kyber: Implementation in wolfSSL#7318
Merged
dgarske merged 1 commit intowolfSSL:masterfrom Mar 14, 2024
Merged
Conversation
5fc8fd6 to
a2695be
Compare
dgarske
requested changes
Mar 13, 2024
Member
dgarske
left a comment
There was a problem hiding this comment.
./configure --enable-kyber --enable-smallstack --enable-intelasm && make
...
wolfcrypt/src/wc_kyber_asm.S:12065:21: error: invalid operand for instruction
movzbl %bl, %r10b
^~~~~
wolfcrypt/src/wc_kyber_asm.S:12066:21: error: invalid operand for instruction
movzbl %bl, %cl
^~~
wolfcrypt/src/wc_kyber_asm.S:12126:21: error: invalid operand for instruction
movzbl %bl, %r10b
^~~~~
wolfcrypt/src/wc_kyber_asm.S:12127:21: error: invalid operand for instruction
movzbl %bl, %cl
^~~
wolfcrypt/src/wc_kyber_asm.S:12187:21: error: invalid operand for instruction
movzbl %bl, %r10b
^~~~~
wolfcrypt/src/wc_kyber_asm.S:12188:21: error: invalid operand for instruction
movzbl %bl, %cl
^~~
wolfcrypt/src/wc_kyber_asm.S:12248:21: error: invalid operand for instruction
CC examples/client/client-client.o
movzbl %bl, %r10b
^~~~~
wolfcrypt/src/wc_kyber_asm.S:12249:21: error: invalid operand for instruction
movzbl %bl, %cl
^~~
wolfcrypt/src/wc_kyber_asm.S:12309:21: error: invalid operand for instruction
movzbl %bl, %r10b
^~~~~
wolfcrypt/src/wc_kyber_asm.S:12310:21: error: invalid operand for instruction
movzbl %bl, %cl
^~~
wolfcrypt/src/wc_kyber_asm.S:12370:21: error: invalid operand for instruction
movzbl %bl, %r10b
^~~~~
wolfcrypt/src/wc_kyber_asm.S:12371:21: error: invalid operand for instruction
movzbl %bl, %cl
^~~
wolfcrypt/src/wc_kyber_asm.S:12431:21: error: invalid operand for instruction
movzbl %bl, %r10b
^~~~~
wolfcrypt/src/wc_kyber_asm.S:12432:21: error: invalid operand for instruction
movzbl %bl, %cl
^~~
wolfcrypt/src/wc_kyber_asm.S:12495:21: error: invalid operand for instruction
movzbl %bl, %r10b
^~~~~
wolfcrypt/src/wc_kyber_asm.S:12496:21: error: invalid operand for instruction
movzbl %bl, %cl
^~~
wolfcrypt/src/wc_kyber_asm.S:12686:21: error: invalid operand for instruction
movzbl %bl, %r10b
^~~~~
wolfcrypt/src/wc_kyber_asm.S:12687:21: error: invalid operand for instruction
movzbl %bl, %cl
^~~
wolfcrypt/src/wc_kyber_asm.S:12751:21: error: invalid operand for instruction
movzbl %bl, %r10b
^~~~~
wolfcrypt/src/wc_kyber_asm.S:12752:21: error: invalid operand for instruction
movzbl %bl, %cl
^~~
wolfcrypt/src/wc_kyber_asm.S:12817:21: error: invalid operand for instruction
movzbl %bl, %r10b
^~~~~
wolfcrypt/src/wc_kyber_asm.S:12818:21: error: invalid operand for instruction
movzbl %bl, %cl
^~~
Apple clang version 15.0.0 (clang-1500.3.9.4)
Target: x86_64-apple-darwin23.3.0
Thread model: posix```
Member
There was a problem hiding this comment.
void kyber_init()
^
void
1 error generated.```
Member
There was a problem hiding this comment.
ovject -> object. 4 places in code.
Member
There was a problem hiding this comment.
Encapsuluate -> Encapsulate. Two places
Member
There was a problem hiding this comment.
deistributions -> distributions
Contributor
Author
|
Assembly code fixed. |
dgarske
requested changes
Mar 13, 2024
Member
dgarske
left a comment
There was a problem hiding this comment.
Builds, but fails.
./configure --enable-kyber --enable-smallstack --enable-intelasm && make
./wolfcrypt/test/testwolfcrypt
...
KYBER test failed!
error L=35378
[fiducial line numbers: 8247 25532 38178 50526]
Many build errors with: ./configure --enable-kyber=small --enable-smallstack --enable-intelasm && make. Lots also without the intelasm.
./wolfssl/wolfcrypt/wc_kyber.h:124:18: error: use of undeclared identifier 'KYBER512_K'; did you mean 'KYBER512'?
sword16 priv[KYBER_MAX_K * KYBER_N];
^~~~~~~~~~~
KYBER512
./wolfssl/wolfcrypt/kyber.h:148:37: note: expanded from macro 'KYBER_MAX_K'
#define KYBER_MAX_K KYBER512_K
^
./wolfssl/wolfcrypt/kyber.h:156:5: note: 'KYBER512' declared here
KYBER512 = 0,
^
In file included from wolfcrypt/benchmark/benchmark.c:171:
./wolfssl/wolfcrypt/wc_kyber.h:126:17: error: use of undeclared identifier 'KYBER512_K'; did you mean 'KYBER512'?
sword16 pub[KYBER_MAX_K * KYBER_N];
^~~~~~~~~~~
KYBER512
./wolfssl/wolfcrypt/kyber.h:148:37: note: expanded from macro 'KYBER_MAX_K'
#define KYBER_MAX_K KYBER512_K
^
./wolfssl/wolfcrypt/kyber.h:156:5: note: 'KYBER512' declared here
KYBER512 = 0,
^
In file included from wolfcrypt/src/wc_kyber_poly.c:31:
./wolfssl/wolfcrypt/wc_kyber.h:124:18: error: use of undeclared identifier 'KYBER512_K'; did you mean 'KYBER512'?
sword16 priv[KYBER_MAX_K * KYBER_N];
^~~~~~~~~~~
KYBER512
./wolfssl/wolfcrypt/kyber.h:148:37: note: expanded from macro 'KYBER_MAX_K'
#define KYBER_MAX_K KYBER512_K
^
./wolfssl/wolfcrypt/kyber.h:156:5: note: 'KYBER512' declared here
KYBER512 = 0,
^
In file included from wolfcrypt/src/wc_kyber_poly.c:31:
./wolfssl/wolfcrypt/wc_kyber.h:126:17: error: use of undeclared identifier 'KYBER512_K'; did you mean 'KYBER512'?
sword16 pub[KYBER_MAX_K * KYBER_N];
^~~~~~~~~~~
KYBER512
./wolfssl/wolfcrypt/kyber.h:148:37: note: expanded from macro 'KYBER_MAX_K'
#define KYBER_MAX_K KYBER512_K
^
./wolfssl/wolfcrypt/kyber.h:156:5: note: 'KYBER512' declared here
KYBER512 = 0,
^
wolfcrypt/src/wc_kyber_poly.c:1280:35: error: unused parameter 'prf' [-Werror,-Wunused-parameter]
int kyber_gen_matrix(KYBER_PRF_T* prf, sword16* a, int kp, byte* seed,
^
wolfcrypt/src/wc_kyber_poly.c:1280:49: error: unused parameter 'a' [-Werror,-Wunused-parameter]
int kyber_gen_matrix(KYBER_PRF_T* prf, sword16* a, int kp, byte* seed,
^
wolfcrypt/src/wc_kyber_poly.c:1280:56: error: unused parameter 'kp' [-Werror,-Wunused-parameter]
int kyber_gen_matrix(KYBER_PRF_T* prf, sword16* a, int kp, byte* seed,
^
wolfcrypt/src/wc_kyber_poly.c:1280:66: error: unused parameter 'seed' [-Werror,-Wunused-parameter]
int kyber_gen_matrix(KYBER_PRF_T* prf, sword16* a, int kp, byte* seed,
^
wolfcrypt/src/wc_kyber_poly.c:1281:9: error: unused parameter 'transposed' [-Werror,-Wunused-parameter]
int transposed)
^
wolfcrypt/src/wc_kyber_poly.c:1843:34: error: unused parameter 'prf' [-Werror,-Wunused-parameter]
int kyber_get_noise(KYBER_PRF_T* prf, int kp, sword16* vec1,
^
wolfcrypt/src/wc_kyber_poly.c:1843:43: error: unused parameter 'kp' [-Werror,-Wunused-parameter]
int kyber_get_noise(KYBER_PRF_T* prf, int kp, sword16* vec1,
^
wolfcrypt/src/wc_kyber_poly.c:1843:56: error: unused parameter 'vec1' [-Werror,-Wunused-parameter]
int kyber_get_noise(KYBER_PRF_T* prf, int kp, sword16* vec1,
^
wolfcrypt/src/wc_kyber_poly.c:1844:14: error: unused parameter 'vec2' [-Werror,-Wunused-parameter]
sword16* vec2, sword16* poly, byte* seed)
^
wolfcrypt/src/wc_kyber_poly.c:1844:29: error: unused parameter 'poly' [-Werror,-Wunused-parameter]
sword16* vec2, sword16* poly, byte* seed)
^
wolfcrypt/src/wc_kyber_poly.c:1844:41: error: unused parameter 'seed' [-Werror,-Wunused-parameter]
sword16* vec2, sword16* poly, byte* seed)
^
13 errors generated.
make[2]: *** [wolfcrypt/src/src_libwolfssl_la-wc_kyber_poly.lo] Error 1
make[2]: *** Waiting for unfinished jobs....
wolfcrypt/benchmark/benchmark.c:9195:13: error: use of undeclared identifier 'KYBER512_CIPHER_TEXT_SIZE'
byte ct[KYBER_MAX_CIPHER_TEXT_SIZE];
^
./wolfssl/wolfcrypt/kyber.h:151:37: note: expanded from macro 'KYBER_MAX_CIPHER_TEXT_SIZE'
#define KYBER_MAX_CIPHER_TEXT_SIZE KYBER512_CIPHER_TEXT_SIZE
^
3 errors generated.```
Member
There was a problem hiding this comment.
deistributions -> distributions. Four places
Put Kyber implementation into wolfSSL.
Contributor
Author
|
Can't do --enable-kyber=small. |
Contributor
Author
|
Assembly code works now. |
dgarske
approved these changes
Mar 14, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Put Kyber implementation into wolfSSL.
Testing
Regression tested kyber.
--enable-kyber no defaults to wolfSSL when liboqs is not specified.
Checklist