Commit 313c06bf authored by Michael Müller's avatar Michael Müller Committed by Alexandre Julliard

bcrypt: Implement BCryptGetProperty for BCRYPT_AUTH_TAG_LENGTH.

parent ba1ed443
...@@ -566,6 +566,20 @@ static NTSTATUS get_alg_property( const struct algorithm *alg, const WCHAR *prop ...@@ -566,6 +566,20 @@ static NTSTATUS get_alg_property( const struct algorithm *alg, const WCHAR *prop
} }
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
if (!strcmpW( prop, BCRYPT_AUTH_TAG_LENGTH ))
{
BCRYPT_AUTH_TAG_LENGTHS_STRUCT *tag_length = (void *)buf;
if (alg->mode != MODE_ID_GCM) return STATUS_NOT_SUPPORTED;
*ret_size = sizeof(*tag_length);
if (tag_length && size < *ret_size) return STATUS_BUFFER_TOO_SMALL;
if (tag_length)
{
tag_length->dwMinLength = 12;
tag_length->dwMaxLength = 16;
tag_length->dwIncrement = 1;
}
return STATUS_SUCCESS;
}
break; break;
default: default:
......
...@@ -709,24 +709,24 @@ static void test_BCryptEncrypt(void) ...@@ -709,24 +709,24 @@ static void test_BCryptEncrypt(void)
size = 0; size = 0;
ret = BCryptGetProperty(aes, BCRYPT_AUTH_TAG_LENGTH, NULL, 0, &size, 0); ret = BCryptGetProperty(aes, BCRYPT_AUTH_TAG_LENGTH, NULL, 0, &size, 0);
todo_wine ok(ret == STATUS_NOT_SUPPORTED, "got %08x\n", ret); ok(ret == STATUS_NOT_SUPPORTED, "got %08x\n", ret);
ret = BCryptSetProperty(aes, BCRYPT_CHAINING_MODE, (UCHAR*)BCRYPT_CHAIN_MODE_GCM, sizeof(BCRYPT_CHAIN_MODE_GCM), 0); ret = BCryptSetProperty(aes, BCRYPT_CHAINING_MODE, (UCHAR*)BCRYPT_CHAIN_MODE_GCM, sizeof(BCRYPT_CHAIN_MODE_GCM), 0);
ok(ret == STATUS_SUCCESS, "got %08x\n", ret); ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
size = 0; size = 0;
ret = BCryptGetProperty(aes, BCRYPT_AUTH_TAG_LENGTH, NULL, 0, &size, 0); ret = BCryptGetProperty(aes, BCRYPT_AUTH_TAG_LENGTH, NULL, 0, &size, 0);
todo_wine ok(ret == STATUS_SUCCESS, "got %08x\n", ret); ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
todo_wine ok(size == sizeof(tag_length), "got %u\n", size); ok(size == sizeof(tag_length), "got %u\n", size);
size = 0; size = 0;
memset(&tag_length, 0, sizeof(tag_length)); memset(&tag_length, 0, sizeof(tag_length));
ret = BCryptGetProperty(aes, BCRYPT_AUTH_TAG_LENGTH, (UCHAR*)&tag_length, sizeof(tag_length), &size, 0); ret = BCryptGetProperty(aes, BCRYPT_AUTH_TAG_LENGTH, (UCHAR*)&tag_length, sizeof(tag_length), &size, 0);
todo_wine ok(ret == STATUS_SUCCESS, "got %08x\n", ret); ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
todo_wine ok(size == sizeof(tag_length), "got %u\n", size); ok(size == sizeof(tag_length), "got %u\n", size);
todo_wine ok(tag_length.dwMinLength == 12, "Expected 12, got %d\n", tag_length.dwMinLength); ok(tag_length.dwMinLength == 12, "Expected 12, got %d\n", tag_length.dwMinLength);
todo_wine ok(tag_length.dwMaxLength == 16, "Expected 16, got %d\n", tag_length.dwMaxLength); ok(tag_length.dwMaxLength == 16, "Expected 16, got %d\n", tag_length.dwMaxLength);
todo_wine ok(tag_length.dwIncrement == 1, "Expected 1, got %d\n", tag_length.dwIncrement); ok(tag_length.dwIncrement == 1, "Expected 1, got %d\n", tag_length.dwIncrement);
len = 0xdeadbeef; len = 0xdeadbeef;
size = sizeof(len); size = sizeof(len);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment