Commit Graph

15589 Commits

Author SHA1 Message Date
Masashi Honma
ee39fd079f Fix X509_PUBKEY_set() to show correct algorithm and parameters
When build with OpenSSL, trailing program outputs these messages.

algorithm: id-ecPublicKey
parameters: prime256v1

But with wolfSSL, X509_PUBKEY_get0_param() fails.
This patch fixes wolfSSL to display the same values as OpenSSL.

This program was extracted from wpa_supplicant in order to reproduce the
issue.

----------------
int main(void)
{
    EVP_PKEY *pkey;
    X509_PUBKEY *pub = NULL;
    ASN1_OBJECT *ppkalg, *poid;
    const ASN1_OBJECT *pa_oid;
    const uint8_t *pk;
    int ppklen, ptype;
    X509_ALGOR *pa;
    void *pval;
    char buf[100];
    const uint8_t data[] = {
        0x30, 0x39, 0x30, 0x13, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, 0x08, 0x2a,
        0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07, 0x03, 0x22, 0x00, 0x03, 0x33, 0x6d, 0xb4, 0xe9, 0xab,
        0xf1, 0x1c, 0x96, 0x87, 0x5e, 0x02, 0xcc, 0x92, 0xaf, 0xf6, 0xe1, 0xed, 0x2b, 0xb2, 0xb7, 0xcc,
        0x3f, 0xd2, 0xb5, 0x4e, 0x6f, 0x20, 0xc7, 0xea, 0x2f, 0x3f, 0x42
    };
    size_t data_len = sizeof(data);
    const uint8_t *p;
    int res;

    p = data;
    pkey = d2i_PUBKEY(NULL, &p, data_len);
    if (!pkey) {
        fprintf(stderr, "d2i_PUBKEY() failed\n");
        return -1;
    }

    if (EVP_PKEY_type(EVP_PKEY_id(pkey)) != EVP_PKEY_EC) {
        fprintf(stderr, "invalid type\n");
        EVP_PKEY_free(pkey);
        return -1;
    }

    res = X509_PUBKEY_set(&pub, pkey);
    if (res != 1) {
        fprintf(stderr, "X509_PUBKEY_set() failed\n");
        return -1;
    }

    res = X509_PUBKEY_get0_param(&ppkalg, &pk, &ppklen, &pa, pub);
    if (res != 1) {
        fprintf(stderr, "X509_PUBKEY_get0_param() failed\n");
        return -1;
    }
    res = OBJ_obj2txt(buf, sizeof(buf), ppkalg, 0);
    if (res < 0 || (size_t) res >= sizeof(buf)) {
        fprintf(stderr, "OBJ_obj2txt() failed\n");
        return -1;
    }
    fprintf(stdout, "algorithm: %s\n", buf);

    X509_ALGOR_get0(&pa_oid, &ptype, (void *) &pval, pa);
    if (ptype != V_ASN1_OBJECT) {
        fprintf(stderr, "X509_ALGOR_get0() failed\n");
        return -1;
    }
    poid = pval;
    res = OBJ_obj2txt(buf, sizeof(buf), poid, 0);
    if (res < 0 || (size_t) res >= sizeof(buf)) {
        fprintf(stderr, "OBJ_obj2txt() failed\n");
        return -1;
    }
    fprintf(stdout, "parameters: %s\n", buf);

    X509_PUBKEY_free(pub);
    EVP_PKEY_free(pkey);
    return 0;
}

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
2021-11-09 07:30:58 +09:00
David Garske
4453001fac Merge pull request #4550 from kareem-wolfssl/gh4547
Fix doAsync warning in bench_ecc.
2021-11-08 13:24:18 -08:00
David Garske
478f57b347 Merge pull request #4535 from kareem-wolfssl/zd13165
Fix building with NO_ECC_KEY_EXPORT.
2021-11-08 11:11:53 -08:00
David Garske
67a11df15b Merge pull request #4548 from anhu/TlS
Fix capitalization.
2021-11-08 11:07:00 -08:00
Kareem
2f1a37769e Fix doAsync warning in bench_ecc. 2021-11-08 11:42:05 -07:00
Anthony Hu
a28e44730c Fix capitalization. 2021-11-08 11:45:49 -05:00
David Garske
3a9be7373f Merge pull request #4532 from embhorn/zd13139
Fix mem leak in HandleTlsResumption
2021-11-08 08:39:45 -08:00
John Safranek
d46b140250 Merge pull request #4544 from dgarske/hmachash 2021-11-05 15:11:07 -07:00
Kaleb Himes
ba291b519d Merge pull request #4543 from julek-wolfssl/server-echo-return
Check correct var for `server.c` echo return.
2021-11-05 11:26:15 -06:00
Eric Blankenhorn
d6264059ac Fix mem leak in HandleTlsResumption 2021-11-05 11:40:40 -05:00
David Garske
e9aa76b34e Merge pull request #4542 from SparkiDev/dh_enc_fix
DH encoding: use correct length for inner sequence
2021-11-05 08:50:43 -07:00
David Garske
4fe17cc143 Merge pull request #4527 from julek-wolfssl/zd13097
Fix a heap buffer overflow with mismatched PEM structure ZD13097
2021-11-05 08:50:28 -07:00
David Garske
7fca031346 Remove duplicate code in wc_HmacFree (looks like past merge error). 2021-11-05 08:20:39 -07:00
Juliusz Sosinowicz
6d89de4f11 Check correct var for server.c echo return. 2021-11-05 16:10:17 +01:00
Sean Parkinson
d01f0d7a4c DH encoding: use correct length for inner sequence
Only affect small DH keys (like 512 bits).
2021-11-05 15:02:14 +10:00
Chris Conlon
ae84a2a326 Merge pull request #4293 from TakayukiMatsuo/set_min_proto
Add support for value zero as version parameter for SSL_CTX_set_min/max_proto_version
2021-11-04 14:59:34 -06:00
David Garske
74a32e92eb Rename the internal "Hash" structure used by Hmac as it is too generic. 2021-11-04 11:56:00 -07:00
David Garske
16afe7ff87 Merge pull request #4540 from anhu/forLealem
Changes suggest by Lealem after he tried the instructions.
2021-11-04 11:44:18 -07:00
Anthony Hu
6f9e501f45 Changes suggest by Lealem after he tried the instructions. 2021-11-04 11:00:18 -04:00
Juliusz Sosinowicz
1faa9e66b6 Check wolfSSL_BIO_read return 2021-11-04 15:34:33 +01:00
Kareem
60a86157c7 Fix building with NO_ECC_KEY_EXPORT. 2021-11-03 16:03:26 -07:00
Sean Parkinson
8f7df68869 Merge pull request #4533 from JacobBarthelmeh/Testing
additional checks on fp montgomery return value
2021-11-04 08:36:27 +10:00
Jacob Barthelmeh
7ca95bfaca additional checks on fp montgomery return value 2021-11-03 11:40:14 -06:00
David Garske
d24bfb6bf7 Merge pull request #4530 from anhu/falcon-pqsig
The NIST round 3 Falcon Signature Scheme integration.
2021-11-03 09:35:01 -07:00
Anthony Hu
dbe3e550b0 Correct the directory to pq in reference to wolfssl-examples 2021-11-02 15:35:39 -04:00
Anthony Hu
04f27551aa Some more sensible constants. 2021-11-02 14:59:31 -04:00
David Garske
945e4a0885 Merge pull request #4529 from anhu/disable_dh
Fix for being able to build with LIBOQS but without DH
2021-11-02 08:54:40 -07:00
David Garske
b652d2e631 Merge pull request #4524 from JacobBarthelmeh/Release
bump to dev version and touch up readme
2021-11-02 08:54:14 -07:00
Anthony Hu
81def76b18 The NIST round 3 Falcon Signature Scheme integration. 2021-11-02 11:12:10 -04:00
Anthony Hu
e1cc1e831e Fix for being able to build with LIBOQS but without DH
The following configuration yielded a compile error:
./configure --with-liboqs --disable-dh

This fixes bug reported on ZD13028.
2021-11-02 10:16:38 -04:00
Juliusz Sosinowicz
23487a4532 Fix a heap buffer overflow with mismatched PEM structure ZD13097 2021-11-02 11:31:22 +01:00
Sean Parkinson
2745f394e5 Merge pull request #4525 from cconlon/sslopno
TLS 1.3: check SSL_OP_NO_TLSv1_2 in TLS 1.3 clients
2021-11-02 09:40:59 +10:00
Jacob Barthelmeh
ac5e9e5e7c bump to dev version and touch up readme 2021-11-01 15:50:03 -06:00
David Garske
7e01af0121 Merge pull request #4521 from JacobBarthelmeh/Release
prepare for release v5.0.0
v5.0.0-stable
2021-11-01 12:45:22 -07:00
Jacob Barthelmeh
7c3d1c7fbc update rpm spec 2021-11-01 12:24:53 -06:00
Jacob Barthelmeh
44219906e0 add kdf.c to cs+ project 2021-11-01 12:02:53 -06:00
Daniel Pouzzner
6f18ba15b0 linuxkm: accommodate printk()->_printk() renaming in kernel 5.15+. 2021-11-01 11:49:56 -06:00
Daniel Pouzzner
742492cb5e linuxkm/Makefile: fix module sign-file error handling. 2021-11-01 11:49:48 -06:00
Jacob Barthelmeh
d869c60605 prepare for release v5.0.0 2021-11-01 11:43:25 -06:00
David Garske
99f44149eb Merge pull request #4520 from JacobBarthelmeh/Testing
add kdf.c file to IDE projects and cmake, few edge case fuzz reports, remove exe bit and c files
2021-11-01 08:35:11 -07:00
Jacob Barthelmeh
fb7baf28ca fix for xcode build and revert cmake change 2021-10-29 16:55:05 -06:00
Daniel Pouzzner
6ba55edd50 fix async warnings 2021-10-29 14:37:39 -06:00
Jacob Barthelmeh
1d91ccb41b remove exe bit on example.c and server.c 2021-10-29 13:12:43 -06:00
Jacob Barthelmeh
03bc45c5b1 check if private key exists before using with private key check function 2021-10-29 10:51:24 -06:00
David Garske
5ad580b233 Merge pull request #4517 from elms/cmake/kdf
cmake: Add `kdf.c` and `FIPS_V5`
2021-10-29 09:29:23 -07:00
JacobBarthelmeh
fc01723407 Merge pull request #4516 from dgarske/asn_templ_genname
Fix for ASN template general name parsing
2021-10-29 23:14:50 +07:00
David Garske
a6415493eb Merge pull request #4518 from douzzer/nestable-save-vector-registers
linuxkm: fixes for {save,restore}_vector_registers_x86().
2021-10-29 09:14:32 -07:00
David Garske
8a8a6cf17f Merge pull request #4515 from kareem-wolfssl/zd13006
wc_scrypt: Check for underflow in blocksSz calculation.
2021-10-29 08:23:37 -07:00
Daniel Pouzzner
ddf927ae41 linuxkm: fixes for {save,restore}_vector_registers_x86(). 2021-10-29 01:26:48 -05:00
Elms
49389f3074 cmake: Add kdf.c and FIPS_V5 2021-10-28 16:50:15 -07:00