<feed xmlns='http://www.w3.org/2005/Atom'>
<title>nitrokey-rs/src, branch v0.6.0</title>
<subtitle>Rust interface to libnitrokey</subtitle>
<id>https://git.ireas.org/nitrokey-rs/atom?h=v0.6.0</id>
<link rel='self' href='https://git.ireas.org/nitrokey-rs/atom?h=v0.6.0'/>
<link rel='alternate' type='text/html' href='https://git.ireas.org/nitrokey-rs/'/>
<updated>2020-02-03T10:31:21Z</updated>
<entry>
<title>Refactor string handling in util</title>
<updated>2020-02-03T10:31:21Z</updated>
<author>
<name>Robin Krahl</name>
<email>robin.krahl@ireas.org</email>
</author>
<published>2020-01-28T16:56:53Z</published>
<link rel='alternate' type='text/html' href='https://git.ireas.org/nitrokey-rs/commit/?id=d905aafe208536203dd319e5dc48bd250180a8ef'/>
<id>urn:sha1:d905aafe208536203dd319e5dc48bd250180a8ef</id>
<content type='text'>
The util module provides helper methods to deal with the C strings
returned by libnitrokey.  The current implementation has to problems:
- It causes unnecessary allocations if we only want to look at the
  string, for example in get_serial_number.
- If the conversion from a CStr to a String fails, the string pointer
  is not freed.

Therefore this patch introduces the run_with_str function that executes
a function with the string returned by libnitrokey and then makes sure
that the pointer is freed correctly.
</content>
</entry>
<entry>
<title>Represent serial numbers using SerialNumber struct</title>
<updated>2020-02-03T10:30:57Z</updated>
<author>
<name>Robin Krahl</name>
<email>robin.krahl@ireas.org</email>
</author>
<published>2020-01-28T16:38:47Z</published>
<link rel='alternate' type='text/html' href='https://git.ireas.org/nitrokey-rs/commit/?id=4fb865af37093d9b0ee039d8ae48fb2a820f3760'/>
<id>urn:sha1:4fb865af37093d9b0ee039d8ae48fb2a820f3760</id>
<content type='text'>
In a previous commit, we changed the serial number representation from a
string to an integer.  This made it easier to compare serial numbers,
but also introduced new problems:
- Serial numbers should be formatted consistently, for example as
  "{:#010x}".  It is hard to ensure this for an integer value.
- The format of the serial number may be subject to change.  Users
  should not rely too much on the u32 representation.

Therefore we introduce a new SerialNumber struct that represents a
serial number.  Currently it only stores a u32 value.  The following
traits and functions can be used to access its value:
- FromStr for string parsing
- ToString/Display for string formatting
- as_u32 to access the underlying integer value
</content>
</entry>
<entry>
<title>Use NK_get_status to implement Device::get_config</title>
<updated>2020-02-03T09:22:13Z</updated>
<author>
<name>Robin Krahl</name>
<email>robin.krahl@ireas.org</email>
</author>
<published>2020-01-29T12:52:19Z</published>
<link rel='alternate' type='text/html' href='https://git.ireas.org/nitrokey-rs/commit/?id=c1f48ce6c614586042db8891d2eebf19d2212ce4'/>
<id>urn:sha1:c1f48ce6c614586042db8891d2eebf19d2212ce4</id>
<content type='text'>
libnitrokey’s NK_read_config function returns a pointer to an array that
has been allocated using new[].  We would have to delete this pointer
using delete[], but we only have access to free.  Therefore this patch
modifies the Device::get_config function to call NK_get_status instead
of NK_read_config.

This also makes the code more safe as we get the data as a struct
instead of an array.  It does not add much overhead as NK_read_config
also executes the GET_STATUS command on the Nitrokey device.
</content>
</entry>
<entry>
<title>Implement From&lt;&amp;NK_status&gt; for RawConfig</title>
<updated>2020-02-03T09:19:21Z</updated>
<author>
<name>Robin Krahl</name>
<email>robin.krahl@ireas.org</email>
</author>
<published>2020-01-29T13:04:06Z</published>
<link rel='alternate' type='text/html' href='https://git.ireas.org/nitrokey-rs/commit/?id=4a9dab94400cb00ae1e28485ddc64d46cf27ed3c'/>
<id>urn:sha1:4a9dab94400cb00ae1e28485ddc64d46cf27ed3c</id>
<content type='text'>
This makes it easier to parse only the config part of the NK_status
struct and avoids code duplication in the upcoming get_config
refactoring.
</content>
</entry>
<entry>
<title>Merge branch 'hotfix-0.5.2' into next</title>
<updated>2020-01-28T20:23:13Z</updated>
<author>
<name>Robin Krahl</name>
<email>robin.krahl@ireas.org</email>
</author>
<published>2020-01-28T20:23:08Z</published>
<link rel='alternate' type='text/html' href='https://git.ireas.org/nitrokey-rs/commit/?id=395ace0131ef6cd655a222734f2cc8d037395a3b'/>
<id>urn:sha1:395ace0131ef6cd655a222734f2cc8d037395a3b</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Regenerate temporary passwords with null bytes</title>
<updated>2020-01-28T20:05:33Z</updated>
<author>
<name>Robin Krahl</name>
<email>robin.krahl@ireas.org</email>
</author>
<published>2020-01-28T19:31:56Z</published>
<link rel='alternate' type='text/html' href='https://git.ireas.org/nitrokey-rs/commit/?id=ebd754d88330478981f65e4724cc561ceff4f9e7'/>
<id>urn:sha1:ebd754d88330478981f65e4724cc561ceff4f9e7</id>
<content type='text'>
Previously, we silently cut off temporary passwords that contained a
null byte.  With the change to CString, we returned a LibraryError
instead.  With this patch, we change to generate_password function to
continue generating passwords until we have a password without a null
byte.

The chance of generating a password with a null byte is ca. 10 % for our
temporary password with 25 characters.  Therefore the chance of having
to re-generate the password multiple times is low enough that we don’t
bother with re-generating only the null bytes of the password for the
time being.  This should be improved in the future.
</content>
</entry>
<entry>
<title>Remove AuthenticatedDevice::temp_password_ptr</title>
<updated>2020-01-28T20:05:13Z</updated>
<author>
<name>Robin Krahl</name>
<email>robin.krahl@ireas.org</email>
</author>
<published>2020-01-28T18:47:39Z</published>
<link rel='alternate' type='text/html' href='https://git.ireas.org/nitrokey-rs/commit/?id=777cbd0fee8187325b0272d3264b535828d4b4ea'/>
<id>urn:sha1:777cbd0fee8187325b0272d3264b535828d4b4ea</id>
<content type='text'>
We introduced the AuthenticatedDevice::temp_password_ptr function to
reduce the number of casts needed in our code base.  Since we switched
from Vec&lt;u8&gt; to CString, we no longer have to cast the return value of
as_ptr.  Therefore we can remove the temp_password_ptr function to
reduce code complexity.
</content>
</entry>
<entry>
<title>Use CString to store temporary passwords</title>
<updated>2020-01-28T20:05:03Z</updated>
<author>
<name>Robin Krahl</name>
<email>robin.krahl@ireas.org</email>
</author>
<published>2020-01-28T18:42:41Z</published>
<link rel='alternate' type='text/html' href='https://git.ireas.org/nitrokey-rs/commit/?id=669fbb40d894460e9603dcf6e953373e53a19347'/>
<id>urn:sha1:669fbb40d894460e9603dcf6e953373e53a19347</id>
<content type='text'>
This patch changes the generate_password function and the User and Admin
structs to use a CString instead of a Vec&lt;u8&gt; when storing temporary
passwords.  This makes sure that the strings that are passed to the C
API are properly null-terminated.
</content>
</entry>
<entry>
<title>Always store serial numbers as integers</title>
<updated>2020-01-28T11:02:28Z</updated>
<author>
<name>Robin Krahl</name>
<email>robin.krahl@ireas.org</email>
</author>
<published>2020-01-26T13:26:01Z</published>
<link rel='alternate' type='text/html' href='https://git.ireas.org/nitrokey-rs/commit/?id=24eebcdaaa32d55bf49d069d8320be5dbd6fdab9'/>
<id>urn:sha1:24eebcdaaa32d55bf49d069d8320be5dbd6fdab9</id>
<content type='text'>
This patch consistently uses u32 integers to store and return the serial
number of a Nitrokey device.  This makes it easier to convert and
compare the serial number, as it is a unique representation and as
formatting an integer cannot fail.  For more details, see this RFC:
	https://lists.sr.ht/~ireas/nitrokey-rs-dev/%3C20200126074816.GA1314%40ireas.org%3E
</content>
</entry>
<entry>
<title>Add String value to the Error::UnexpectedError variant</title>
<updated>2020-01-28T10:54:20Z</updated>
<author>
<name>Robin Krahl</name>
<email>robin.krahl@ireas.org</email>
</author>
<published>2020-01-28T09:07:23Z</published>
<link rel='alternate' type='text/html' href='https://git.ireas.org/nitrokey-rs/commit/?id=da8727996efacec4280696caefee3feecea4eae7'/>
<id>urn:sha1:da8727996efacec4280696caefee3feecea4eae7</id>
<content type='text'>
To make debugging of unexpected errors easier, this patch adds an
associated String value with a description of the unexpected behavior to
the UnexpectedError variant of the Error enum.
</content>
</entry>
</feed>
