Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 729801 Details for
Bug 805227
app-crypt/qca-2.3.3 - /.../qca-ossl.cpp: error: invalid conversion from const char* to const unsigned char* [-fpermissive]
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
qca-openssl30.patch
qca-ossl3.patch (text/plain), 10.92 KB, created by
Thomas Bettler
on 2021-08-03 07:27:24 UTC
(
hide
)
Description:
qca-openssl30.patch
Filename:
MIME Type:
Creator:
Thomas Bettler
Created:
2021-08-03 07:27:24 UTC
Size:
10.92 KB
patch
obsolete
>diff -up qca-2.3.2/plugins/qca-ossl/qca-ossl.cpp.1~ qca-2.3.2/plugins/qca-ossl/qca-ossl.cpp >--- qca-2.3.2/plugins/qca-ossl/qca-ossl.cpp.1~ 2021-02-04 11:29:44.000000000 +0100 >+++ qca-2.3.2/plugins/qca-ossl/qca-ossl.cpp 2021-04-16 16:38:48.568496338 +0200 >@@ -1262,9 +1262,9 @@ public: > EVP_PKEY_CTX *pctx = EVP_PKEY_CTX_new_id(EVP_PKEY_HKDF, nullptr); > EVP_PKEY_derive_init(pctx); > EVP_PKEY_CTX_set_hkdf_md(pctx, EVP_sha256()); >- EVP_PKEY_CTX_set1_hkdf_salt(pctx, salt.data(), int(salt.size())); >- EVP_PKEY_CTX_set1_hkdf_key(pctx, secret.data(), int(secret.size())); >- EVP_PKEY_CTX_add1_hkdf_info(pctx, info.data(), int(info.size())); >+ EVP_PKEY_CTX_set1_hkdf_salt(pctx, reinterpret_cast<const unsigned char*>(salt.data()), int(salt.size())); >+ EVP_PKEY_CTX_set1_hkdf_key(pctx, reinterpret_cast<const unsigned char*>(secret.data()), int(secret.size())); >+ EVP_PKEY_CTX_add1_hkdf_info(pctx, reinterpret_cast<const unsigned char*>(info.data()), int(info.size())); > size_t outlen = out.size(); > EVP_PKEY_derive(pctx, reinterpret_cast<unsigned char *>(out.data()), &outlen); > EVP_PKEY_CTX_free(pctx); >@@ -1438,7 +1438,7 @@ public: > int type = EVP_PKEY_id(pkey); > > if (type == EVP_PKEY_RSA) { >- RSA *rsa = EVP_PKEY_get0_RSA(pkey); >+ RSA *rsa = EVP_PKEY_get1_RSA(pkey); > if (RSA_private_encrypt(raw.size(), > (unsigned char *)raw.data(), > (unsigned char *)out.data(), >@@ -1472,20 +1472,21 @@ public: > if (state == VerifyActive) { > if (raw_type) { > SecureArray out(EVP_PKEY_size(pkey)); >- int len = 0; >+ size_t len = 0; > > int type = EVP_PKEY_id(pkey); > > if (type == EVP_PKEY_RSA) { >- RSA *rsa = EVP_PKEY_get0_RSA(pkey); >- if ((len = RSA_public_decrypt(sig.size(), >- (unsigned char *)sig.data(), >- (unsigned char *)out.data(), >- rsa, >- RSA_PKCS1_PADDING)) == -1) { >+ EVP_PKEY_CTX *ctx = EVP_PKEY_CTX_new(pkey, nullptr); >+ if ((EVP_PKEY_decrypt_init(ctx) < 1) || >+ (EVP_PKEY_decrypt(ctx, >+ (unsigned char *)out.data(), >+ &len, >+ (unsigned char *)sig.data(), >+ sig.size()) < 1)) { > state = VerifyError; > return false; >- } >+ } > } else if (type == EVP_PKEY_DSA) { > state = VerifyError; > return false; >@@ -1932,7 +1933,7 @@ public: > return; > > // extract the public key into DER format >- RSA * rsa_pkey = EVP_PKEY_get0_RSA(evp.pkey); >+ RSA * rsa_pkey = EVP_PKEY_get1_RSA(evp.pkey); > int len = i2d_RSAPublicKey(rsa_pkey, nullptr); > SecureArray result(len); > unsigned char *p = (unsigned char *)result.data(); >@@ -1954,7 +1955,7 @@ public: > > int maximumEncryptSize(EncryptionAlgorithm alg) const override > { >- RSA *rsa = EVP_PKEY_get0_RSA(evp.pkey); >+ RSA const *rsa = EVP_PKEY_get0_RSA(evp.pkey); > int size = 0; > switch (alg) { > case EME_PKCS1v15: >@@ -1976,7 +1977,7 @@ public: > > SecureArray encrypt(const SecureArray &in, EncryptionAlgorithm alg) override > { >- RSA * rsa = EVP_PKEY_get0_RSA(evp.pkey); >+ RSA * rsa = EVP_PKEY_get1_RSA(evp.pkey); > SecureArray buf = in; > int max = maximumEncryptSize(alg); > >@@ -1993,7 +1994,7 @@ public: > pad = RSA_PKCS1_OAEP_PADDING; > break; > case EME_PKCS1v15_SSL: >- pad = RSA_SSLV23_PADDING; >+ pad = RSA_PKCS1_WITH_TLS_PADDING; > break; > case EME_NO_PADDING: > pad = RSA_NO_PADDING; >@@ -2007,8 +2008,15 @@ public: > if (isPrivate()) > ret = > RSA_private_encrypt(buf.size(), (unsigned char *)buf.data(), (unsigned char *)result.data(), rsa, pad); >- else >+ else { >+ EVP_PKEY_CTX *ctx = EVP_PKEY_CTX_new(evp.pkey, nullptr); >+ if ((EVP_PKEY_encrypt_init(ctx) <= 0) || >+ (EVP_PKEY_CTX_set_rsa_padding(ctx, pad) <= 0)) >+ return SecureArray(); >+ size_t size; >+ ret = EVP_PKEY_encrypt(ctx, (unsigned char*)result.data(), &size, (unsigned char *)buf.data(), buf.size()); > ret = RSA_public_encrypt(buf.size(), (unsigned char *)buf.data(), (unsigned char *)result.data(), rsa, pad); >+ } > > if (ret < 0) > return SecureArray(); >@@ -2019,7 +2027,7 @@ public: > > bool decrypt(const SecureArray &in, SecureArray *out, EncryptionAlgorithm alg) override > { >- RSA * rsa = EVP_PKEY_get0_RSA(evp.pkey); >+ RSA * rsa = EVP_PKEY_get1_RSA(evp.pkey); > SecureArray result(RSA_size(rsa)); > int pad; > >@@ -2031,7 +2039,7 @@ public: > pad = RSA_PKCS1_OAEP_PADDING; > break; > case EME_PKCS1v15_SSL: >- pad = RSA_SSLV23_PADDING; >+ pad = RSA_PKCS1_WITH_TLS_PADDING; > break; > case EME_NO_PADDING: > pad = RSA_NO_PADDING; >@@ -2044,10 +2052,16 @@ public: > int ret; > if (isPrivate()) > ret = RSA_private_decrypt(in.size(), (unsigned char *)in.data(), (unsigned char *)result.data(), rsa, pad); >- else >- ret = RSA_public_decrypt(in.size(), (unsigned char *)in.data(), (unsigned char *)result.data(), rsa, pad); >+ else { >+ EVP_PKEY_CTX *ctx = EVP_PKEY_CTX_new(evp.pkey, nullptr); >+ if ((EVP_PKEY_decrypt_init(ctx) <= 0) || >+ (EVP_PKEY_CTX_set_rsa_padding(ctx, pad) <= 0)) >+ return false; >+ size_t size; >+ ret = EVP_PKEY_decrypt(ctx, (unsigned char *)result.data(), &size, (unsigned char *)in.data(), in.size()); >+ } > >- if (ret < 0) >+ if (ret <= 0) > return false; > result.resize(ret); > >@@ -2182,7 +2196,7 @@ public: > > BigInteger n() const override > { >- RSA * rsa = EVP_PKEY_get0_RSA(evp.pkey); >+ RSA const * rsa = EVP_PKEY_get0_RSA(evp.pkey); > const BIGNUM *bnn; > RSA_get0_key(rsa, &bnn, nullptr, nullptr); > return bn2bi(bnn); >@@ -2190,7 +2204,7 @@ public: > > BigInteger e() const override > { >- RSA * rsa = EVP_PKEY_get0_RSA(evp.pkey); >+ RSA const * rsa = EVP_PKEY_get0_RSA(evp.pkey); > const BIGNUM *bne; > RSA_get0_key(rsa, nullptr, &bne, nullptr); > return bn2bi(bne); >@@ -2198,7 +2212,7 @@ public: > > BigInteger p() const override > { >- RSA * rsa = EVP_PKEY_get0_RSA(evp.pkey); >+ RSA const * rsa = EVP_PKEY_get0_RSA(evp.pkey); > const BIGNUM *bnp; > RSA_get0_factors(rsa, &bnp, nullptr); > return bn2bi(bnp); >@@ -2206,7 +2220,7 @@ public: > > BigInteger q() const override > { >- RSA * rsa = EVP_PKEY_get0_RSA(evp.pkey); >+ RSA const * rsa = EVP_PKEY_get0_RSA(evp.pkey); > const BIGNUM *bnq; > RSA_get0_factors(rsa, nullptr, &bnq); > return bn2bi(bnq); >@@ -2214,7 +2228,7 @@ public: > > BigInteger d() const override > { >- RSA * rsa = EVP_PKEY_get0_RSA(evp.pkey); >+ RSA const * rsa = EVP_PKEY_get0_RSA(evp.pkey); > const BIGNUM *bnd; > RSA_get0_key(rsa, nullptr, nullptr, &bnd); > return bn2bi(bnd); >@@ -2347,7 +2361,7 @@ public: > return; > > // extract the public key into DER format >- DSA * dsa_pkey = EVP_PKEY_get0_DSA(evp.pkey); >+ DSA const * dsa_pkey = EVP_PKEY_get0_DSA(evp.pkey); > int len = i2d_DSAPublicKey(dsa_pkey, nullptr); > SecureArray result(len); > unsigned char *p = (unsigned char *)result.data(); >@@ -2471,7 +2485,7 @@ public: > > DLGroup domain() const override > { >- DSA * dsa = EVP_PKEY_get0_DSA(evp.pkey); >+ DSA const * dsa = EVP_PKEY_get0_DSA(evp.pkey); > const BIGNUM *bnp, *bnq, *bng; > DSA_get0_pqg(dsa, &bnp, &bnq, &bng); > return DLGroup(bn2bi(bnp), bn2bi(bnq), bn2bi(bng)); >@@ -2479,7 +2493,7 @@ public: > > BigInteger y() const override > { >- DSA * dsa = EVP_PKEY_get0_DSA(evp.pkey); >+ DSA const * dsa = EVP_PKEY_get0_DSA(evp.pkey); > const BIGNUM *bnpub_key; > DSA_get0_key(dsa, &bnpub_key, nullptr); > return bn2bi(bnpub_key); >@@ -2487,7 +2501,7 @@ public: > > BigInteger x() const override > { >- DSA * dsa = EVP_PKEY_get0_DSA(evp.pkey); >+ DSA const * dsa = EVP_PKEY_get0_DSA(evp.pkey); > const BIGNUM *bnpriv_key; > DSA_get0_key(dsa, nullptr, &bnpriv_key); > return bn2bi(bnpriv_key); >@@ -2617,7 +2631,7 @@ public: > if (!sec) > return; > >- DH * orig = EVP_PKEY_get0_DH(evp.pkey); >+ DH const * orig = EVP_PKEY_get0_DH(evp.pkey); > DH * dh = DH_new(); > const BIGNUM *bnp, *bng, *bnpub_key; > DH_get0_pqg(orig, &bnp, nullptr, &bng); >@@ -2640,8 +2654,8 @@ public: > > SymmetricKey deriveKey(const PKeyBase &theirs) override > { >- DH * dh = EVP_PKEY_get0_DH(evp.pkey); >- DH * them = EVP_PKEY_get0_DH(static_cast<const DHKey *>(&theirs)->evp.pkey); >+ DH * dh = EVP_PKEY_get1_DH(evp.pkey); >+ DH const * them = EVP_PKEY_get0_DH(static_cast<const DHKey *>(&theirs)->evp.pkey); > const BIGNUM *bnpub_key; > DH_get0_key(them, &bnpub_key, nullptr); > >@@ -2709,7 +2723,7 @@ public: > > DLGroup domain() const override > { >- DH * dh = EVP_PKEY_get0_DH(evp.pkey); >+ DH const * dh = EVP_PKEY_get0_DH(evp.pkey); > const BIGNUM *bnp, *bng; > DH_get0_pqg(dh, &bnp, nullptr, &bng); > return DLGroup(bn2bi(bnp), bn2bi(bng)); >@@ -2717,7 +2731,7 @@ public: > > BigInteger y() const override > { >- DH * dh = EVP_PKEY_get0_DH(evp.pkey); >+ DH const * dh = EVP_PKEY_get0_DH(evp.pkey); > const BIGNUM *bnpub_key; > DH_get0_key(dh, &bnpub_key, nullptr); > return bn2bi(bnpub_key); >@@ -2725,7 +2739,7 @@ public: > > BigInteger x() const override > { >- DH * dh = EVP_PKEY_get0_DH(evp.pkey); >+ DH const * dh = EVP_PKEY_get0_DH(evp.pkey); > const BIGNUM *bnpriv_key; > DH_get0_key(dh, nullptr, &bnpriv_key); > return bn2bi(bnpriv_key);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 805227
:
728301
|
728304
|
728307
|
728310
|
728313
|
728316
|
728319
|
729801