open-quantum-safe / openssl

UNSUPPORTED Fork of OpenSSL 1.1.1 that includes prototype quantum-resistant algorithms and ciphersuites based on liboqs PLEASE SWITCH TO OQS-Provider for OpenSSL 3
https://openquantumsafe.org/
Other
294 stars 126 forks source link

Current master fails to compile with the current liboqs #260

Closed mouse07410 closed 3 years ago

mouse07410 commented 3 years ago

MacOS Catalina 10.15.7, Xcode-12.2, current master of this repo, and of liboqs.

Problem:

.  .  .  .  .
clang  -I. -Iinclude -fPIC -arch x86_64 -Ioqs/include -march=native -O3 -std=gnu18 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -DL_ENDIAN -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DRC4_ASM -DMD5_ASM -DAESNI_ASM -DVPAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DX25519_ASM -DPOLY1305_ASM -DOPENSSLDIR="\"/Users/uri/oqs-openssl/etc\"" -DENGINESDIR="\"/Users/uri/oqs-openssl/lib/engines-1.1\"" -D_REENTRANT -DNDEBUG -DOQS_DEFAULT_GROUPS=ntru_hps4096821:p521_kyber1024:p521_ntru_hps4096821:kyber1024:p384_ntru_hrss701:p384_kyber768:X225519 -I/Users/uri/src/liboqs/build/include -I/opt/local/include -MMD -MF crypto/ec/oqs_meth.d.tmp -MT crypto/ec/oqs_meth.o -c -o crypto/ec/oqs_meth.o crypto/ec/oqs_meth.c
crypto/ec/oqs_meth.c:321:14: error: use of undeclared identifier 'OQS_KEM_alg_hqc_128'; did you mean 'OQS_KEM_alg_count'?
      return OQS_KEM_alg_hqc_128;
             ^~~~~~~~~~~~~~~~~~~
             OQS_KEM_alg_count
/Users/uri/src/liboqs/build/include/oqs/kem.h:185:13: note: 'OQS_KEM_alg_count' declared here
OQS_API int OQS_KEM_alg_count(void);
            ^
crypto/ec/oqs_meth.c:321:14: warning: incompatible pointer types returning 'int (void)' from a function with result type
      'char *' [-Wincompatible-pointer-types]
      return OQS_KEM_alg_hqc_128;
             ^~~~~~~~~~~~~~~~~~~
crypto/ec/oqs_meth.c:324:14: error: use of undeclared identifier 'OQS_KEM_alg_hqc_192'; did you mean 'OQS_KEM_alg_count'?
      return OQS_KEM_alg_hqc_192;
             ^~~~~~~~~~~~~~~~~~~
             OQS_KEM_alg_count
/Users/uri/src/liboqs/build/include/oqs/kem.h:185:13: note: 'OQS_KEM_alg_count' declared here
OQS_API int OQS_KEM_alg_count(void);
            ^
crypto/ec/oqs_meth.c:324:14: warning: incompatible pointer types returning 'int (void)' from a function with result type
      'char *' [-Wincompatible-pointer-types]
      return OQS_KEM_alg_hqc_192;
             ^~~~~~~~~~~~~~~~~~~
crypto/ec/oqs_meth.c:327:14: error: use of undeclared identifier 'OQS_KEM_alg_hqc_256'; did you mean 'OQS_KEM_alg_count'?
      return OQS_KEM_alg_hqc_256;
             ^~~~~~~~~~~~~~~~~~~
             OQS_KEM_alg_count
/Users/uri/src/liboqs/build/include/oqs/kem.h:185:13: note: 'OQS_KEM_alg_count' declared here
OQS_API int OQS_KEM_alg_count(void);
            ^
crypto/ec/oqs_meth.c:327:14: warning: incompatible pointer types returning 'int (void)' from a function with result type
      'char *' [-Wincompatible-pointer-types]
      return OQS_KEM_alg_hqc_256;
             ^~~~~~~~~~~~~~~~~~~
3 warnings and 3 errors generated.
make[1]: *** [crypto/ec/oqs_meth.o] Error 1
make: *** [all] Error 2

OpenSSL config:

/opt/local/bin/perl5.26 ./Configure no-shared darwin64-x86_64-cc --openssldir=/Users/uri/oqs-openssl/etc --prefix=/Users/uri/oqs-openssl -DOQS_DEFAULT_GROUPS=ntru_hps4096821:p521_kyber1024:p521_ntru_hps4096821:kyber1024:p384_ntru_hrss701:p384_kyber768:X225519 -lm -I/Users/uri/src/liboqs/build/include -L/Users/uri/src/liboqs/build/lib

liboqs config:

env RUN_TESTS_PARALLEL_UPPER=FALSE cmake -GNinja .. -DOQS_USE_OPENSSL=ON -DOQS_USE_CPU_EXTENSIONS=ON -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX=/opt/local -DOQS_KEM_DEFAULT="OQS_KEM_alg_ntru_hps4096821" -DOQS_SIG_DEFAULT="OQS_SIG_alg_falcon_1024" -DCMAKE_BUILD_TYPE=Release

All the liboqs tests pass, except for 8 skipped: 381 passed, 8 skipped in 204.52s (0:03:24)

If it matters, doing in liboqs directory after successful build/test/install:

$ rg alg_count build/include/
build/include/oqs/kem.h
185:OQS_API int OQS_KEM_alg_count(void);

build/include/oqs/sig.h
187:OQS_API int OQS_SIG_alg_count(void);
$ rg OQS_KEM_alg_hqc_256 build/include/
build/include/oqs/kem.h
72:#define OQS_KEM_alg_hqc_256_1_cca2 "HQC-256-1-CCA2"
74:#define OQS_KEM_alg_hqc_256_2_cca2 "HQC-256-2-CCA2"
76:#define OQS_KEM_alg_hqc_256_3_cca2 "HQC-256-3-CCA2"
$ 
dstebila commented 3 years ago

Are you sure you're using the most recent liboqs? HQC algorithm identifiers changed when https://github.com/open-quantum-safe/liboqs/pull/851, so there should not be any occurrences of HQC-256-1-CCA2 in the liboqs source code anymore.

mouse07410 commented 3 years ago
$ pwd
/Users/uri/src/liboqs
$ git remote -v
origin  https://github.com/open-quantum-safe/liboqs.git (fetch)
origin  https://github.com/open-quantum-safe/liboqs.git (push)
$ git branch
* master
$ git pull --recurse-submodules
Already up to date.
$ rg OQS_KEM_alg_hqc_256
src/kem/kem.h
72:#define OQS_KEM_alg_hqc_256_1_cca2 "HQC-256-1-CCA2"
74:#define OQS_KEM_alg_hqc_256_2_cca2 "HQC-256-2-CCA2"
76:#define OQS_KEM_alg_hqc_256_3_cca2 "HQC-256-3-CCA2"

src/kem/hqc/kem_hqc_256_2_cca2.c
15: kem->method_name = OQS_KEM_alg_hqc_256_2_cca2;

src/kem/hqc/kem_hqc_256_3_cca2.c
15: kem->method_name = OQS_KEM_alg_hqc_256_3_cca2;

src/kem/hqc/kem_hqc_256_1_cca2.c
15: kem->method_name = OQS_KEM_alg_hqc_256_1_cca2;

src/kem/kem.c
36:     OQS_KEM_alg_hqc_256_1_cca2,
37:     OQS_KEM_alg_hqc_256_2_cca2,
38:     OQS_KEM_alg_hqc_256_3_cca2,
202:    } else if (0 == strcasecmp(method_name, OQS_KEM_alg_hqc_256_1_cca2)) {
208:    } else if (0 == strcasecmp(method_name, OQS_KEM_alg_hqc_256_2_cca2)) {
214:    } else if (0 == strcasecmp(method_name, OQS_KEM_alg_hqc_256_3_cca2)) {
582:    } else if (0 == strcasecmp(method_name, OQS_KEM_alg_hqc_256_1_cca2)) {
588:    } else if (0 == strcasecmp(method_name, OQS_KEM_alg_hqc_256_2_cca2)) {
594:    } else if (0 == strcasecmp(method_name, OQS_KEM_alg_hqc_256_3_cca2)) {
$ rg OQS_KEM_alg_count
src/kem/kem.h
185:OQS_API int OQS_KEM_alg_count(void);

src/kem/kem.c
89:OQS_API int OQS_KEM_alg_count() {
$ 
dstebila commented 3 years ago

We renamed master to main, in liboqs do git checkout main.

mouse07410 commented 3 years ago

We renamed master to main, in liboqs do git checkout main

Oh... Thanks.

Yes, main branch seems to behave much better:

$ git branch
* main
. . . . .
372 passed, 8 skipped in 84.72s (0:01:24)
. . . . .
rg OQS_KEM_alg_count
src/kem/kem.h
179:OQS_API int OQS_KEM_alg_count(void);

src/kem/kem.c
86:OQS_API int OQS_KEM_alg_count() {
$ rg OQS_KEM_alg_hqc_256
src/kem/kem.h
70:#define OQS_KEM_alg_hqc_256 "HQC-256"

src/kem/hqc/kem_hqc_256.c
15: kem->method_name = OQS_KEM_alg_hqc_256;

src/kem/kem.c
35:     OQS_KEM_alg_hqc_256,
193:    } else if (0 == strcasecmp(method_name, OQS_KEM_alg_hqc_256)) {
555:    } else if (0 == strcasecmp(method_name, OQS_KEM_alg_hqc_256)) {
$