Fix NULL init of KEM and Sig contexts (#477)

* Added example_kem/sig and speed_kem/sig to Visual Studio.

* Added check for NULL method name in KEM/Sig context generation. Avoids a crash in the following strcasecmp if NULL is passed as argument.
This commit is contained in:
Christian Paquin 2019-04-24 13:10:48 -04:00 committed by Douglas Stebila
parent a8b6c2c1d6
commit 64c6af6921
2 changed files with 6 additions and 0 deletions

View File

@ -30,6 +30,9 @@ OQS_API int OQS_KEM_alg_count() {
}
OQS_API OQS_KEM *OQS_KEM_new(const char *method_name) {
if (method_name == NULL) {
return NULL;
}
if (0 == strcasecmp(method_name, OQS_KEM_alg_default)) {
return OQS_KEM_new(OQS_KEM_DEFAULT);
} else if (0 == strcasecmp(method_name, OQS_KEM_alg_bike1_l1)) {

View File

@ -33,6 +33,9 @@ OQS_API int OQS_SIG_alg_count() {
}
OQS_API OQS_SIG *OQS_SIG_new(const char *method_name) {
if (method_name == NULL) {
return NULL;
}
if (0 == strcasecmp(method_name, OQS_SIG_alg_default)) {
return OQS_SIG_new(OQS_SIG_DEFAULT);
} else if (0 == strcasecmp(method_name, OQS_SIG_alg_picnic_L1_FS)) {