credentials: Added void *params to public_key encrypt() and private_key decrypt() methods
This commit is contained in:
@@ -90,7 +90,7 @@ METHOD(private_key_t, sign, bool,
|
|||||||
|
|
||||||
METHOD(private_key_t, decrypt, bool,
|
METHOD(private_key_t, decrypt, bool,
|
||||||
private_tkm_private_key_t *this, encryption_scheme_t scheme,
|
private_tkm_private_key_t *this, encryption_scheme_t scheme,
|
||||||
chunk_t crypto, chunk_t *plain)
|
void *params, chunk_t crypto, chunk_t *plain)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ METHOD(public_key_t, verify, bool,
|
|||||||
|
|
||||||
METHOD(public_key_t, encrypt_, bool,
|
METHOD(public_key_t, encrypt_, bool,
|
||||||
private_tkm_public_key_t *this, encryption_scheme_t scheme,
|
private_tkm_public_key_t *this, encryption_scheme_t scheme,
|
||||||
chunk_t plain, chunk_t *crypto)
|
void *params, chunk_t plain, chunk_t *crypto)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -388,7 +388,7 @@ METHOD(private_key_t, get_type, key_type_t,
|
|||||||
|
|
||||||
METHOD(private_key_t, decrypt, bool,
|
METHOD(private_key_t, decrypt, bool,
|
||||||
private_private_key_t *this, encryption_scheme_t scheme,
|
private_private_key_t *this, encryption_scheme_t scheme,
|
||||||
chunk_t crypto, chunk_t *plain)
|
void *params, chunk_t crypto, chunk_t *plain)
|
||||||
{
|
{
|
||||||
DBG1(DBG_LIB, "private key decryption is currently not supported via JNI");
|
DBG1(DBG_LIB, "private key decryption is currently not supported via JNI");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|||||||
@@ -67,12 +67,13 @@ struct private_key_t {
|
|||||||
* Decrypt a chunk of data.
|
* Decrypt a chunk of data.
|
||||||
*
|
*
|
||||||
* @param scheme expected encryption scheme used
|
* @param scheme expected encryption scheme used
|
||||||
|
* @param params optional parameters required by the specified scheme
|
||||||
* @param crypto chunk containing encrypted data
|
* @param crypto chunk containing encrypted data
|
||||||
* @param plain where to allocate decrypted data
|
* @param plain where to allocate decrypted data
|
||||||
* @return TRUE if data decrypted and plaintext allocated
|
* @return TRUE if data decrypted and plaintext allocated
|
||||||
*/
|
*/
|
||||||
bool (*decrypt)(private_key_t *this, encryption_scheme_t scheme,
|
bool (*decrypt)(private_key_t *this, encryption_scheme_t scheme,
|
||||||
chunk_t crypto, chunk_t *plain);
|
void *params, chunk_t crypto, chunk_t *plain);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the strength of the key in bits.
|
* Get the strength of the key in bits.
|
||||||
|
|||||||
@@ -182,12 +182,13 @@ struct public_key_t {
|
|||||||
* Encrypt a chunk of data.
|
* Encrypt a chunk of data.
|
||||||
*
|
*
|
||||||
* @param scheme encryption scheme to use
|
* @param scheme encryption scheme to use
|
||||||
|
* @param params optional parameters required by the specified scheme
|
||||||
* @param plain chunk containing plaintext data
|
* @param plain chunk containing plaintext data
|
||||||
* @param crypto where to allocate encrypted data
|
* @param crypto where to allocate encrypted data
|
||||||
* @return TRUE if data successfully encrypted
|
* @return TRUE if data successfully encrypted
|
||||||
*/
|
*/
|
||||||
bool (*encrypt)(public_key_t *this, encryption_scheme_t scheme,
|
bool (*encrypt)(public_key_t *this, encryption_scheme_t scheme,
|
||||||
chunk_t plain, chunk_t *crypto);
|
void *params, chunk_t plain, chunk_t *crypto);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if two public keys are equal.
|
* Check if two public keys are equal.
|
||||||
|
|||||||
@@ -391,7 +391,7 @@ METHOD(private_key_t, get_type, key_type_t,
|
|||||||
|
|
||||||
METHOD(private_key_t, decrypt, bool,
|
METHOD(private_key_t, decrypt, bool,
|
||||||
private_agent_private_key_t *this, encryption_scheme_t scheme,
|
private_agent_private_key_t *this, encryption_scheme_t scheme,
|
||||||
chunk_t crypto, chunk_t *plain)
|
void *params, chunk_t crypto, chunk_t *plain)
|
||||||
{
|
{
|
||||||
DBG1(DBG_LIB, "private key decryption not supported by ssh-agent");
|
DBG1(DBG_LIB, "private key decryption not supported by ssh-agent");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|||||||
@@ -538,7 +538,7 @@ METHOD(private_key_t, sign, bool,
|
|||||||
|
|
||||||
METHOD(private_key_t, decrypt, bool,
|
METHOD(private_key_t, decrypt, bool,
|
||||||
private_bliss_private_key_t *this, encryption_scheme_t scheme,
|
private_bliss_private_key_t *this, encryption_scheme_t scheme,
|
||||||
chunk_t crypto, chunk_t *plain)
|
void *params, chunk_t crypto, chunk_t *plain)
|
||||||
{
|
{
|
||||||
DBG1(DBG_LIB, "encryption scheme %N not supported",
|
DBG1(DBG_LIB, "encryption scheme %N not supported",
|
||||||
encryption_scheme_names, scheme);
|
encryption_scheme_names, scheme);
|
||||||
|
|||||||
@@ -220,7 +220,7 @@ METHOD(public_key_t, verify, bool,
|
|||||||
|
|
||||||
METHOD(public_key_t, encrypt_, bool,
|
METHOD(public_key_t, encrypt_, bool,
|
||||||
private_bliss_public_key_t *this, encryption_scheme_t scheme,
|
private_bliss_public_key_t *this, encryption_scheme_t scheme,
|
||||||
chunk_t plain, chunk_t *crypto)
|
void *params, chunk_t plain, chunk_t *crypto)
|
||||||
{
|
{
|
||||||
DBG1(DBG_LIB, "encryption scheme %N not supported",
|
DBG1(DBG_LIB, "encryption scheme %N not supported",
|
||||||
encryption_scheme_names, scheme);
|
encryption_scheme_names, scheme);
|
||||||
|
|||||||
@@ -168,8 +168,8 @@ START_TEST(test_bliss_sign_fail)
|
|||||||
ck_assert(!pubkey->get_fingerprint(pubkey, KEYID_PGPV4, &fp));
|
ck_assert(!pubkey->get_fingerprint(pubkey, KEYID_PGPV4, &fp));
|
||||||
|
|
||||||
/* encryption / decryption operation is not defined for BLISS */
|
/* encryption / decryption operation is not defined for BLISS */
|
||||||
ck_assert(!pubkey->encrypt(pubkey, ENCRYPT_UNKNOWN, chunk_empty, NULL));
|
ck_assert(!pubkey->encrypt(pubkey, ENCRYPT_UNKNOWN, NULL, chunk_empty, NULL));
|
||||||
ck_assert(!privkey->decrypt(privkey, ENCRYPT_UNKNOWN, chunk_empty, NULL));
|
ck_assert(!privkey->decrypt(privkey, ENCRYPT_UNKNOWN, NULL, chunk_empty, NULL));
|
||||||
|
|
||||||
/* sign with invalid signature scheme */
|
/* sign with invalid signature scheme */
|
||||||
ck_assert(!privkey->sign(privkey, SIGN_UNKNOWN, NULL, msg, &signature));
|
ck_assert(!privkey->sign(privkey, SIGN_UNKNOWN, NULL, msg, &signature));
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ METHOD(private_key_t, sign, bool,
|
|||||||
|
|
||||||
METHOD(private_key_t, decrypt, bool,
|
METHOD(private_key_t, decrypt, bool,
|
||||||
private_botan_ec_private_key_t *this, encryption_scheme_t scheme,
|
private_botan_ec_private_key_t *this, encryption_scheme_t scheme,
|
||||||
chunk_t crypto, chunk_t *plain)
|
void *params, chunk_t crypto, chunk_t *plain)
|
||||||
{
|
{
|
||||||
DBG1(DBG_LIB, "EC private key decryption not implemented");
|
DBG1(DBG_LIB, "EC private key decryption not implemented");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ METHOD(public_key_t, verify, bool,
|
|||||||
|
|
||||||
METHOD(public_key_t, encrypt, bool,
|
METHOD(public_key_t, encrypt, bool,
|
||||||
private_botan_ec_public_key_t *this, encryption_scheme_t scheme,
|
private_botan_ec_public_key_t *this, encryption_scheme_t scheme,
|
||||||
chunk_t crypto, chunk_t *plain)
|
void *params, chunk_t crypto, chunk_t *plain)
|
||||||
{
|
{
|
||||||
DBG1(DBG_LIB, "EC public key encryption not implemented");
|
DBG1(DBG_LIB, "EC public key encryption not implemented");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ METHOD(private_key_t, sign, bool,
|
|||||||
|
|
||||||
METHOD(private_key_t, decrypt, bool,
|
METHOD(private_key_t, decrypt, bool,
|
||||||
private_private_key_t *this, encryption_scheme_t scheme,
|
private_private_key_t *this, encryption_scheme_t scheme,
|
||||||
chunk_t crypto, chunk_t *plain)
|
void *params, chunk_t crypto, chunk_t *plain)
|
||||||
{
|
{
|
||||||
DBG1(DBG_LIB, "EdDSA private key decryption not implemented");
|
DBG1(DBG_LIB, "EdDSA private key decryption not implemented");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ METHOD(public_key_t, verify, bool,
|
|||||||
|
|
||||||
METHOD(public_key_t, encrypt, bool,
|
METHOD(public_key_t, encrypt, bool,
|
||||||
private_public_key_t *this, encryption_scheme_t scheme,
|
private_public_key_t *this, encryption_scheme_t scheme,
|
||||||
chunk_t crypto, chunk_t *plain)
|
void *params, chunk_t crypto, chunk_t *plain)
|
||||||
{
|
{
|
||||||
DBG1(DBG_LIB, "EdDSA public key encryption not implemented");
|
DBG1(DBG_LIB, "EdDSA public key encryption not implemented");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ METHOD(private_key_t, sign, bool,
|
|||||||
|
|
||||||
METHOD(private_key_t, decrypt, bool,
|
METHOD(private_key_t, decrypt, bool,
|
||||||
private_botan_rsa_private_key_t *this, encryption_scheme_t scheme,
|
private_botan_rsa_private_key_t *this, encryption_scheme_t scheme,
|
||||||
chunk_t crypto, chunk_t *plain)
|
void *params, chunk_t crypto, chunk_t *plain)
|
||||||
{
|
{
|
||||||
botan_pk_op_decrypt_t decrypt_op;
|
botan_pk_op_decrypt_t decrypt_op;
|
||||||
const char *padding;
|
const char *padding;
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ METHOD(public_key_t, verify, bool,
|
|||||||
|
|
||||||
METHOD(public_key_t, encrypt, bool,
|
METHOD(public_key_t, encrypt, bool,
|
||||||
private_botan_rsa_public_key_t *this, encryption_scheme_t scheme,
|
private_botan_rsa_public_key_t *this, encryption_scheme_t scheme,
|
||||||
chunk_t plain, chunk_t *crypto)
|
void *params, chunk_t plain, chunk_t *crypto)
|
||||||
{
|
{
|
||||||
botan_pk_op_encrypt_t encrypt_op;
|
botan_pk_op_encrypt_t encrypt_op;
|
||||||
botan_rng_t rng;
|
botan_rng_t rng;
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ end:
|
|||||||
|
|
||||||
METHOD(private_key_t, decrypt, bool,
|
METHOD(private_key_t, decrypt, bool,
|
||||||
private_curve25519_private_key_t *this, encryption_scheme_t scheme,
|
private_curve25519_private_key_t *this, encryption_scheme_t scheme,
|
||||||
chunk_t crypto, chunk_t *plain)
|
void *params, chunk_t crypto, chunk_t *plain)
|
||||||
{
|
{
|
||||||
DBG1(DBG_LIB, "encryption scheme %N not supported", encryption_scheme_names,
|
DBG1(DBG_LIB, "encryption scheme %N not supported", encryption_scheme_names,
|
||||||
scheme);
|
scheme);
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ METHOD(public_key_t, verify, bool,
|
|||||||
|
|
||||||
METHOD(public_key_t, encrypt_, bool,
|
METHOD(public_key_t, encrypt_, bool,
|
||||||
private_curve25519_public_key_t *this, encryption_scheme_t scheme,
|
private_curve25519_public_key_t *this, encryption_scheme_t scheme,
|
||||||
chunk_t plain, chunk_t *crypto)
|
void *params, chunk_t plain, chunk_t *crypto)
|
||||||
{
|
{
|
||||||
DBG1(DBG_LIB, "encryption scheme %N not supported", encryption_scheme_names,
|
DBG1(DBG_LIB, "encryption scheme %N not supported", encryption_scheme_names,
|
||||||
scheme);
|
scheme);
|
||||||
|
|||||||
@@ -278,7 +278,7 @@ METHOD(private_key_t, sign, bool,
|
|||||||
|
|
||||||
METHOD(private_key_t, decrypt, bool,
|
METHOD(private_key_t, decrypt, bool,
|
||||||
private_gcrypt_rsa_private_key_t *this, encryption_scheme_t scheme,
|
private_gcrypt_rsa_private_key_t *this, encryption_scheme_t scheme,
|
||||||
chunk_t encrypted, chunk_t *plain)
|
void *params, chunk_t encrypted, chunk_t *plain)
|
||||||
{
|
{
|
||||||
gcry_error_t err;
|
gcry_error_t err;
|
||||||
gcry_sexp_t in, out;
|
gcry_sexp_t in, out;
|
||||||
|
|||||||
@@ -237,7 +237,7 @@ METHOD(public_key_t, verify, bool,
|
|||||||
|
|
||||||
METHOD(public_key_t, encrypt_, bool,
|
METHOD(public_key_t, encrypt_, bool,
|
||||||
private_gcrypt_rsa_public_key_t *this, encryption_scheme_t scheme,
|
private_gcrypt_rsa_public_key_t *this, encryption_scheme_t scheme,
|
||||||
chunk_t plain, chunk_t *encrypted)
|
void *params, chunk_t plain, chunk_t *encrypted)
|
||||||
{
|
{
|
||||||
gcry_sexp_t in, out;
|
gcry_sexp_t in, out;
|
||||||
gcry_error_t err;
|
gcry_error_t err;
|
||||||
|
|||||||
@@ -494,7 +494,7 @@ METHOD(private_key_t, sign, bool,
|
|||||||
|
|
||||||
METHOD(private_key_t, decrypt, bool,
|
METHOD(private_key_t, decrypt, bool,
|
||||||
private_gmp_rsa_private_key_t *this, encryption_scheme_t scheme,
|
private_gmp_rsa_private_key_t *this, encryption_scheme_t scheme,
|
||||||
chunk_t crypto, chunk_t *plain)
|
void *params, chunk_t crypto, chunk_t *plain)
|
||||||
{
|
{
|
||||||
chunk_t em, stripped;
|
chunk_t em, stripped;
|
||||||
bool success = FALSE;
|
bool success = FALSE;
|
||||||
|
|||||||
@@ -313,7 +313,7 @@ METHOD(public_key_t, verify, bool,
|
|||||||
|
|
||||||
METHOD(public_key_t, encrypt_, bool,
|
METHOD(public_key_t, encrypt_, bool,
|
||||||
private_gmp_rsa_public_key_t *this, encryption_scheme_t scheme,
|
private_gmp_rsa_public_key_t *this, encryption_scheme_t scheme,
|
||||||
chunk_t plain, chunk_t *crypto)
|
void *params, chunk_t plain, chunk_t *crypto)
|
||||||
{
|
{
|
||||||
chunk_t em;
|
chunk_t em;
|
||||||
u_char *pos;
|
u_char *pos;
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ METHOD(private_key_t, sign, bool,
|
|||||||
|
|
||||||
METHOD(private_key_t, decrypt, bool,
|
METHOD(private_key_t, decrypt, bool,
|
||||||
private_openssl_ec_private_key_t *this, encryption_scheme_t scheme,
|
private_openssl_ec_private_key_t *this, encryption_scheme_t scheme,
|
||||||
chunk_t crypto, chunk_t *plain)
|
void *params, chunk_t crypto, chunk_t *plain)
|
||||||
{
|
{
|
||||||
DBG1(DBG_LIB, "EC private key decryption not implemented");
|
DBG1(DBG_LIB, "EC private key decryption not implemented");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ METHOD(public_key_t, verify, bool,
|
|||||||
|
|
||||||
METHOD(public_key_t, encrypt, bool,
|
METHOD(public_key_t, encrypt, bool,
|
||||||
private_openssl_ec_public_key_t *this, encryption_scheme_t scheme,
|
private_openssl_ec_public_key_t *this, encryption_scheme_t scheme,
|
||||||
chunk_t crypto, chunk_t *plain)
|
void *params, chunk_t crypto, chunk_t *plain)
|
||||||
{
|
{
|
||||||
DBG1(DBG_LIB, "EC public key encryption not implemented");
|
DBG1(DBG_LIB, "EC public key encryption not implemented");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ error:
|
|||||||
|
|
||||||
METHOD(private_key_t, decrypt, bool,
|
METHOD(private_key_t, decrypt, bool,
|
||||||
private_private_key_t *this, encryption_scheme_t scheme,
|
private_private_key_t *this, encryption_scheme_t scheme,
|
||||||
chunk_t crypto, chunk_t *plain)
|
void *params, chunk_t crypto, chunk_t *plain)
|
||||||
{
|
{
|
||||||
DBG1(DBG_LIB, "EdDSA private key decryption not implemented");
|
DBG1(DBG_LIB, "EdDSA private key decryption not implemented");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ METHOD(public_key_t, verify, bool,
|
|||||||
|
|
||||||
METHOD(public_key_t, encrypt, bool,
|
METHOD(public_key_t, encrypt, bool,
|
||||||
private_public_key_t *this, encryption_scheme_t scheme,
|
private_public_key_t *this, encryption_scheme_t scheme,
|
||||||
chunk_t crypto, chunk_t *plain)
|
void *params, chunk_t crypto, chunk_t *plain)
|
||||||
{
|
{
|
||||||
DBG1(DBG_LIB, "encryption scheme %N not supported", encryption_scheme_names,
|
DBG1(DBG_LIB, "encryption scheme %N not supported", encryption_scheme_names,
|
||||||
scheme);
|
scheme);
|
||||||
|
|||||||
@@ -644,7 +644,7 @@ static bool decrypt(private_openssl_pkcs7_t *this,
|
|||||||
{
|
{
|
||||||
/* get encryptedKey from internal structure; TODO fixup */
|
/* get encryptedKey from internal structure; TODO fixup */
|
||||||
chunk = openssl_asn1_str2chunk(ri->ktri->encryptedKey);
|
chunk = openssl_asn1_str2chunk(ri->ktri->encryptedKey);
|
||||||
if (private->decrypt(private, ENCRYPT_RSA_PKCS1,
|
if (private->decrypt(private, ENCRYPT_RSA_PKCS1, NULL,
|
||||||
chunk, &key))
|
chunk, &key))
|
||||||
{
|
{
|
||||||
private->destroy(private);
|
private->destroy(private);
|
||||||
|
|||||||
@@ -306,7 +306,7 @@ METHOD(private_key_t, sign, bool,
|
|||||||
|
|
||||||
METHOD(private_key_t, decrypt, bool,
|
METHOD(private_key_t, decrypt, bool,
|
||||||
private_openssl_rsa_private_key_t *this, encryption_scheme_t scheme,
|
private_openssl_rsa_private_key_t *this, encryption_scheme_t scheme,
|
||||||
chunk_t crypto, chunk_t *plain)
|
void *params, chunk_t crypto, chunk_t *plain)
|
||||||
{
|
{
|
||||||
int padding, len;
|
int padding, len;
|
||||||
char *decrypted;
|
char *decrypted;
|
||||||
|
|||||||
@@ -307,7 +307,7 @@ METHOD(public_key_t, verify, bool,
|
|||||||
|
|
||||||
METHOD(public_key_t, encrypt, bool,
|
METHOD(public_key_t, encrypt, bool,
|
||||||
private_openssl_rsa_public_key_t *this, encryption_scheme_t scheme,
|
private_openssl_rsa_public_key_t *this, encryption_scheme_t scheme,
|
||||||
chunk_t plain, chunk_t *crypto)
|
void *params, chunk_t plain, chunk_t *crypto)
|
||||||
{
|
{
|
||||||
int padding, len;
|
int padding, len;
|
||||||
char *encrypted;
|
char *encrypted;
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ METHOD(private_key_t, sign_not_allowed, bool,
|
|||||||
|
|
||||||
METHOD(private_key_t, decrypt_not_allowed, bool,
|
METHOD(private_key_t, decrypt_not_allowed, bool,
|
||||||
private_key_t *this, encryption_scheme_t scheme,
|
private_key_t *this, encryption_scheme_t scheme,
|
||||||
chunk_t crypto, chunk_t *plain)
|
void *params, chunk_t crypto, chunk_t *plain)
|
||||||
{
|
{
|
||||||
DBG1(DBG_LIB, "decryption failed - signature only key");
|
DBG1(DBG_LIB, "decryption failed - signature only key");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|||||||
@@ -388,7 +388,7 @@ METHOD(private_key_t, sign, bool,
|
|||||||
|
|
||||||
METHOD(private_key_t, decrypt, bool,
|
METHOD(private_key_t, decrypt, bool,
|
||||||
private_pkcs11_private_key_t *this, encryption_scheme_t scheme,
|
private_pkcs11_private_key_t *this, encryption_scheme_t scheme,
|
||||||
chunk_t crypt, chunk_t *plain)
|
void *params, chunk_t crypt, chunk_t *plain)
|
||||||
{
|
{
|
||||||
CK_MECHANISM_PTR mechanism;
|
CK_MECHANISM_PTR mechanism;
|
||||||
CK_SESSION_HANDLE session;
|
CK_SESSION_HANDLE session;
|
||||||
|
|||||||
@@ -307,7 +307,7 @@ METHOD(public_key_t, verify, bool,
|
|||||||
|
|
||||||
METHOD(public_key_t, encrypt, bool,
|
METHOD(public_key_t, encrypt, bool,
|
||||||
private_pkcs11_public_key_t *this, encryption_scheme_t scheme,
|
private_pkcs11_public_key_t *this, encryption_scheme_t scheme,
|
||||||
chunk_t plain, chunk_t *crypt)
|
void *params, chunk_t plain, chunk_t *crypt)
|
||||||
{
|
{
|
||||||
CK_MECHANISM_PTR mechanism;
|
CK_MECHANISM_PTR mechanism;
|
||||||
CK_SESSION_HANDLE session;
|
CK_SESSION_HANDLE session;
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ static bool decrypt(private_key_t *private, chunk_t key, chunk_t iv, int oid,
|
|||||||
DBG1(DBG_LIB, "unsupported content encryption algorithm");
|
DBG1(DBG_LIB, "unsupported content encryption algorithm");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (!private->decrypt(private, ENCRYPT_RSA_PKCS1, key, &plain_key))
|
if (!private->decrypt(private, ENCRYPT_RSA_PKCS1, NULL, key, &plain_key))
|
||||||
{
|
{
|
||||||
DBG1(DBG_LIB, "symmetric key could not be decrypted with rsa");
|
DBG1(DBG_LIB, "symmetric key could not be decrypted with rsa");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -438,7 +438,7 @@ static bool encrypt_key(certificate_t *cert, chunk_t in, chunk_t *out)
|
|||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (!key->encrypt(key, ENCRYPT_RSA_PKCS1, in, out))
|
if (!key->encrypt(key, ENCRYPT_RSA_PKCS1, NULL, in, out))
|
||||||
{
|
{
|
||||||
key->destroy(key);
|
key->destroy(key);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|||||||
@@ -207,7 +207,7 @@ METHOD(private_key_t, sign, bool,
|
|||||||
|
|
||||||
METHOD(private_key_t, decrypt, bool,
|
METHOD(private_key_t, decrypt, bool,
|
||||||
private_wolfssl_ec_private_key_t *this, encryption_scheme_t scheme,
|
private_wolfssl_ec_private_key_t *this, encryption_scheme_t scheme,
|
||||||
chunk_t crypto, chunk_t *plain)
|
void *params, chunk_t crypto, chunk_t *plain)
|
||||||
{
|
{
|
||||||
DBG1(DBG_LIB, "EC private key decryption not implemented");
|
DBG1(DBG_LIB, "EC private key decryption not implemented");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|||||||
@@ -195,7 +195,7 @@ METHOD(public_key_t, verify, bool,
|
|||||||
|
|
||||||
METHOD(public_key_t, encrypt, bool,
|
METHOD(public_key_t, encrypt, bool,
|
||||||
private_wolfssl_ec_public_key_t *this, encryption_scheme_t scheme,
|
private_wolfssl_ec_public_key_t *this, encryption_scheme_t scheme,
|
||||||
chunk_t crypto, chunk_t *plain)
|
void *params, chunk_t crypto, chunk_t *plain)
|
||||||
{
|
{
|
||||||
DBG1(DBG_LIB, "EC public key encryption not implemented");
|
DBG1(DBG_LIB, "EC public key encryption not implemented");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ METHOD(private_key_t, sign, bool,
|
|||||||
|
|
||||||
METHOD(private_key_t, decrypt, bool,
|
METHOD(private_key_t, decrypt, bool,
|
||||||
private_private_key_t *this, encryption_scheme_t scheme,
|
private_private_key_t *this, encryption_scheme_t scheme,
|
||||||
chunk_t crypto, chunk_t *plain)
|
void *params, chunk_t crypto, chunk_t *plain)
|
||||||
{
|
{
|
||||||
DBG1(DBG_LIB, "EdDSA private key decryption not implemented");
|
DBG1(DBG_LIB, "EdDSA private key decryption not implemented");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ METHOD(public_key_t, verify, bool,
|
|||||||
|
|
||||||
METHOD(public_key_t, encrypt, bool,
|
METHOD(public_key_t, encrypt, bool,
|
||||||
private_public_key_t *this, encryption_scheme_t scheme,
|
private_public_key_t *this, encryption_scheme_t scheme,
|
||||||
chunk_t crypto, chunk_t *plain)
|
void *params, chunk_t crypto, chunk_t *plain)
|
||||||
{
|
{
|
||||||
DBG1(DBG_LIB, "encryption scheme %N not supported", encryption_scheme_names,
|
DBG1(DBG_LIB, "encryption scheme %N not supported", encryption_scheme_names,
|
||||||
scheme);
|
scheme);
|
||||||
|
|||||||
@@ -243,7 +243,7 @@ METHOD(private_key_t, sign, bool,
|
|||||||
|
|
||||||
METHOD(private_key_t, decrypt, bool,
|
METHOD(private_key_t, decrypt, bool,
|
||||||
private_wolfssl_rsa_private_key_t *this, encryption_scheme_t scheme,
|
private_wolfssl_rsa_private_key_t *this, encryption_scheme_t scheme,
|
||||||
chunk_t crypto, chunk_t *plain)
|
void *params, chunk_t crypto, chunk_t *plain)
|
||||||
{
|
{
|
||||||
int padding, mgf, len;
|
int padding, mgf, len;
|
||||||
enum wc_HashType hash;
|
enum wc_HashType hash;
|
||||||
|
|||||||
@@ -218,7 +218,7 @@ METHOD(public_key_t, verify, bool,
|
|||||||
|
|
||||||
METHOD(public_key_t, encrypt, bool,
|
METHOD(public_key_t, encrypt, bool,
|
||||||
private_wolfssl_rsa_public_key_t *this, encryption_scheme_t scheme,
|
private_wolfssl_rsa_public_key_t *this, encryption_scheme_t scheme,
|
||||||
chunk_t plain, chunk_t *crypto)
|
void *params, chunk_t plain, chunk_t *crypto)
|
||||||
{
|
{
|
||||||
int padding, mgf, len;
|
int padding, mgf, len;
|
||||||
enum wc_HashType hash;
|
enum wc_HashType hash;
|
||||||
|
|||||||
@@ -379,7 +379,7 @@ START_TEST(test_ed25519_gen)
|
|||||||
key2->destroy(key2);
|
key2->destroy(key2);
|
||||||
|
|
||||||
/* decryption not supported */
|
/* decryption not supported */
|
||||||
ck_assert(!key->decrypt(key, ENCRYPT_UNKNOWN, msg, NULL));
|
ck_assert(!key->decrypt(key, ENCRYPT_UNKNOWN, NULL, msg, NULL));
|
||||||
|
|
||||||
/* wrong signature scheme */
|
/* wrong signature scheme */
|
||||||
ck_assert(!key->sign(key, SIGN_ED448, NULL, msg, &sig));
|
ck_assert(!key->sign(key, SIGN_ED448, NULL, msg, &sig));
|
||||||
@@ -414,7 +414,7 @@ START_TEST(test_ed25519_gen)
|
|||||||
pubkey2->destroy(pubkey2);
|
pubkey2->destroy(pubkey2);
|
||||||
|
|
||||||
/* encryption not supported */
|
/* encryption not supported */
|
||||||
ck_assert(!pubkey->encrypt(pubkey, ENCRYPT_UNKNOWN, msg, NULL));
|
ck_assert(!pubkey->encrypt(pubkey, ENCRYPT_UNKNOWN, NULL, msg, NULL));
|
||||||
|
|
||||||
/* verify with wrong signature scheme */
|
/* verify with wrong signature scheme */
|
||||||
ck_assert(!pubkey->verify(pubkey, SIGN_ED448, NULL, msg, sig));
|
ck_assert(!pubkey->verify(pubkey, SIGN_ED448, NULL, msg, sig));
|
||||||
|
|||||||
@@ -440,7 +440,7 @@ START_TEST(test_ed448_gen)
|
|||||||
key2->destroy(key2);
|
key2->destroy(key2);
|
||||||
|
|
||||||
/* decryption not supported */
|
/* decryption not supported */
|
||||||
ck_assert(!key->decrypt(key, ENCRYPT_UNKNOWN, msg, NULL));
|
ck_assert(!key->decrypt(key, ENCRYPT_UNKNOWN, NULL, msg, NULL));
|
||||||
|
|
||||||
/* wrong signature scheme */
|
/* wrong signature scheme */
|
||||||
ck_assert(!key->sign(key, SIGN_ED25519, NULL, msg, &sig));
|
ck_assert(!key->sign(key, SIGN_ED25519, NULL, msg, &sig));
|
||||||
@@ -475,7 +475,7 @@ START_TEST(test_ed448_gen)
|
|||||||
pubkey2->destroy(pubkey2);
|
pubkey2->destroy(pubkey2);
|
||||||
|
|
||||||
/* encryption not supported */
|
/* encryption not supported */
|
||||||
ck_assert(!pubkey->encrypt(pubkey, ENCRYPT_UNKNOWN, msg, NULL));
|
ck_assert(!pubkey->encrypt(pubkey, ENCRYPT_UNKNOWN, NULL, msg, NULL));
|
||||||
|
|
||||||
/* verify with wrong signature scheme */
|
/* verify with wrong signature scheme */
|
||||||
ck_assert(!pubkey->verify(pubkey, SIGN_ED25519, NULL, msg, sig));
|
ck_assert(!pubkey->verify(pubkey, SIGN_ED25519, NULL, msg, sig));
|
||||||
|
|||||||
@@ -1628,7 +1628,7 @@ static status_t send_key_exchange_encrypt(private_tls_peer_t *this,
|
|||||||
this->alert->add(this->alert, TLS_FATAL, TLS_CERTIFICATE_UNKNOWN);
|
this->alert->add(this->alert, TLS_FATAL, TLS_CERTIFICATE_UNKNOWN);
|
||||||
return NEED_MORE;
|
return NEED_MORE;
|
||||||
}
|
}
|
||||||
if (!public->encrypt(public, ENCRYPT_RSA_PKCS1,
|
if (!public->encrypt(public, ENCRYPT_RSA_PKCS1, NULL,
|
||||||
chunk_from_thing(premaster), &encrypted))
|
chunk_from_thing(premaster), &encrypted))
|
||||||
{
|
{
|
||||||
public->destroy(public);
|
public->destroy(public);
|
||||||
|
|||||||
@@ -805,8 +805,8 @@ static status_t process_key_exchange_encrypted(private_tls_server_t *this,
|
|||||||
rng->destroy(rng);
|
rng->destroy(rng);
|
||||||
|
|
||||||
if (this->private &&
|
if (this->private &&
|
||||||
this->private->decrypt(this->private,
|
this->private->decrypt(this->private, ENCRYPT_RSA_PKCS1, NULL,
|
||||||
ENCRYPT_RSA_PKCS1, encrypted, &decrypted))
|
encrypted, &decrypted))
|
||||||
{
|
{
|
||||||
if (decrypted.len == sizeof(premaster) &&
|
if (decrypted.len == sizeof(premaster) &&
|
||||||
untoh16(decrypted.ptr) == this->client_version)
|
untoh16(decrypted.ptr) == this->client_version)
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ METHOD(private_key_t, sign, bool,
|
|||||||
|
|
||||||
METHOD(private_key_t, decrypt, bool,
|
METHOD(private_key_t, decrypt, bool,
|
||||||
private_tpm_private_key_t *this, encryption_scheme_t scheme,
|
private_tpm_private_key_t *this, encryption_scheme_t scheme,
|
||||||
chunk_t crypt, chunk_t *plain)
|
void *params, chunk_t crypt, chunk_t *plain)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user