Skip to contentSkip to conversation

unit: Add PBKDF2 tests from iwd

PATCH In review Andrew Zaborowski 2 participants 4 messages Oct 9, 2017 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 unit: Add PBKDF2 tests from iwd

Test l_pkcs5_pbkdf2 using test data from iwd with the exception of the test case that contained a \0 inside the password string.

---
 .gitignore         |   1 +
 Makefile.am        |   5 +-
 unit/test-pbkdf2.c | 206 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 211 insertions(+), 1 deletion(-)
 create mode 100644 unit/test-pbkdf2.c
.gitignore +1 -0
index 8d7c374..369bbe9 100644
@@ -53,6 +53,7 @@ unit/test-tls
 unit/test-pem
 unit/test-uuid
 unit/test-key
+unit/test-pbkdf2
 unit/cert-*.pem
 unit/cert-*.csr
 unit/cert-*.srl
Makefile.am +4 -1
index 98c06ca..9b4ca06 100644
@@ -133,7 +133,8 @@ unit_tests = unit/test-unit \
 			unit/test-util \
 			unit/test-uintset \
 			unit/test-base64 \
-			unit/test-uuid
+			unit/test-uuid \
+			unit/test-pbkdf2
 
 dbus_tests = unit/test-hwdb \
 			unit/test-dbus \
@@ -234,6 +235,8 @@ unit_test_uintset_LDADD = ell/libell-private.la
 
 unit_test_base64_LDADD = ell/libell-private.la
 
+unit_test_pbkdf2_LDADD = ell/libell-private.la
+
 unit_test_pem_LDADD = ell/libell-private.la
 unit_test_pem_DEPENDENCIES = $(cert_files)
 
unit/test-pbkdf2.c new file +206 -0

206 lines not on this page · raw message

Signature · 1 line
2.11.0
#1 lore raw

Hi Andrew,

Quoted 2 lines · Andrew Zaborowski

Test l_pkcs5_pbkdf2 using test data from iwd with the exception of the test case that contained a \0 inside the password string.

So the obvious question is why that test was excepted?

Quoted 7 lines
---
  .gitignore         |   1 +
  Makefile.am        |   5 +-
  unit/test-pbkdf2.c | 206 +++++++++++++++++++++++++++++++++++++++++++++++++++++
  3 files changed, 211 insertions(+), 1 deletion(-)

create mode 100644 unit/test-pbkdf2.c

Regards,
-Denis

#2 lore raw

Hi Denis,

Quoted 5 lines · Denis Kenzior
Quoted 2 lines · Andrew Zaborowski

Test l_pkcs5_pbkdf2 using test data from iwd with the exception of the test case that contained a \0 inside the password string.

So the obvious question is why that test was excepted?

Because in the ell implementation I treat the password as a C string so it can't have a \0 in the middle, while the iwd version would take a length parameter. We don't have a use case for non-C-string passwords but RFC8018 doesn't exactly prohibit them or define what is considered a password.

"Throughout this document, a password is considered to be an octet string of arbitrary length whose interpretation as a text string is unspecified. In the interest of interoperability, however, it is recommended that applications follow some common text encoding rules. ASCII and UTF-8 [RFC3629] are two possibilities. (ASCII is a subset of UTF-8.)

Although the selection of passwords is outside the scope of this document, guidelines have been published [NISTSP63] that may well be taken into account."

Best regards

#3 lore raw

Hi Andrew,

Quoted 22 lines · Andrew Zaborowski

Hi Denis,

Quoted 5 lines · Denis Kenzior
Quoted 2 lines · Andrew Zaborowski

Test l_pkcs5_pbkdf2 using test data from iwd with the exception of the test case that contained a \0 inside the password string.

So the obvious question is why that test was excepted?

Because in the ell implementation I treat the password as a C string so it can't have a \0 in the middle, while the iwd version would take a length parameter. We don't have a use case for non-C-string passwords but RFC8018 doesn't exactly prohibit them or define what is considered a password.

"Throughout this document, a password is considered to be an octet string of arbitrary length whose interpretation as a text string is unspecified. In the interest of interoperability, however, it is recommended that applications follow some common text encoding rules. ASCII and UTF-8 [RFC3629] are two possibilities. (ASCII is a subset of UTF-8.)

Quoted 6 lines

Although the selection of passwords is outside the scope of this document, guidelines have been published [NISTSP63] that may well be taken into account."

Best regards

Sweet. So I took the liberty of copy-pasting this explanation into the patch description (git commit --amend) and pushed it out ;)

Regards,
-Denis