botan: RSA OAEP labels are not supported

This commit is contained in:
Andreas Steffen
2021-11-10 20:03:22 +01:00
parent 9cfdc32597
commit be52ad7c6d
2 changed files with 22 additions and 0 deletions
@@ -162,6 +162,7 @@ METHOD(private_key_t, decrypt, bool,
void *params, 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;
chunk_t label = chunk_empty;
const char *padding; const char *padding;
switch (scheme) switch (scheme)
@@ -190,6 +191,16 @@ METHOD(private_key_t, decrypt, bool,
return FALSE; return FALSE;
} }
if (scheme != ENCRYPT_RSA_PKCS1 && params != NULL)
{
label = *(chunk_t *)params;
if (label.len > 0)
{
DBG1(DBG_LIB, "RSA OAEP decryption with a label not supported");
return FALSE;
}
}
if (botan_pk_op_decrypt_create(&decrypt_op, this->key, padding, 0)) if (botan_pk_op_decrypt_create(&decrypt_op, this->key, padding, 0))
{ {
return FALSE; return FALSE;
@@ -143,6 +143,7 @@ METHOD(public_key_t, encrypt, bool,
{ {
botan_pk_op_encrypt_t encrypt_op; botan_pk_op_encrypt_t encrypt_op;
botan_rng_t rng; botan_rng_t rng;
chunk_t label = chunk_empty;
const char* padding; const char* padding;
switch (scheme) switch (scheme)
@@ -171,6 +172,16 @@ METHOD(public_key_t, encrypt, bool,
return FALSE; return FALSE;
} }
if (scheme != ENCRYPT_RSA_PKCS1 && params != NULL)
{
label = *(chunk_t *)params;
if (label.len > 0)
{
DBG1(DBG_LIB, "RSA OAEP encryption with a label not supported");
return FALSE;
}
}
if (!botan_get_rng(&rng, RNG_STRONG)) if (!botan_get_rng(&rng, RNG_STRONG))
{ {
return FALSE; return FALSE;