{"action":"created","issue":{"url":"https://api.github.com/repos/eugeneia/snabbswitch/issues/11","repository_url":"https://api.github.com/repos/eugeneia/snabbswitch","labels_url":"https://api.github.com/repos/eugeneia/snabbswitch/issues/11/labels{/name}","comments_url":"https://api.github.com/repos/eugeneia/snabbswitch/issues/11/comments","events_url":"https://api.github.com/repos/eugeneia/snabbswitch/issues/11/events","html_url":"https://github.com/eugeneia/snabbswitch/pull/11","id":128148082,"number":11,"title":"lib.ipsec.esp: second iteration [wip]","user":{"login":"eugeneia","id":4933566,"avatar_url":"https://avatars.githubusercontent.com/u/4933566?v=3","gravatar_id":"","url":"https://api.github.com/users/eugeneia","html_url":"https://github.com/eugeneia","followers_url":"https://api.github.com/users/eugeneia/followers","following_url":"https://api.github.com/users/eugeneia/following{/other_user}","gists_url":"https://api.github.com/users/eugeneia/gists{/gist_id}","starred_url":"https://api.github.com/users/eugeneia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eugeneia/subscriptions","organizations_url":"https://api.github.com/users/eugeneia/orgs","repos_url":"https://api.github.com/users/eugeneia/repos","events_url":"https://api.github.com/users/eugeneia/events{/privacy}","received_events_url":"https://api.github.com/users/eugeneia/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":15,"created_at":"2016-01-22T12:31:45Z","updated_at":"2016-02-04T19:14:53Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/eugeneia/snabbswitch/pulls/11","html_url":"https://github.com/eugeneia/snabbswitch/pull/11","diff_url":"https://github.com/eugeneia/snabbswitch/pull/11.diff","patch_url":"https://github.com/eugeneia/snabbswitch/pull/11.patch"},"body":"The code in `lib.ipsec.esp` is in a “proof of concept” stage but lacks tests, in the next few days I will hopefully be able to address the following issues:\r\n\r\n* Obtain reference PCAP dumps from a known ESP flow (both encrypted and decrypted), e.g.: `aes128-gcm12` IPv6 transport mode, with known key/salt/SPI values\r\n* Add unit tests that confirm our implementation is able to truthfully produce and decrypt above PCAP dumps\r\n* Add a benchmark to confirm performance to match the Intel AES-NI whitepaper\r\n\r\nThe current implementation has the following known bugs that need to be addressed:\r\n\r\n* Transmit truncated 32bit sequence number (don't implement anti-replay on receiver side for now), see https://tools.ietf.org/html/rfc4303#section-3.3.3. As of now `lib.ipsec.esp` sends a 64bit sequence number, of which the first four octets are stored in the ESP header and the other four are sent as the initialization vector. Sequence number verification is currently broken and should be removed.\r\n* Transmit independent 64bit IV in front of ciphertext, see https://tools.ietf.org/html/rfc4106#section-3. As of now the 64bit sequence number is wrongly used as the IV.\r\n* Correctly implement minimal padding (ciphertext aligned to 4 byte boundary, see\r\n https://tools.ietf.org/html/rfc4303#section-2.4 and https://tools.ietf.org/html/rfc4106#section-7).\r\n\r\nCc @hb9cwp to keep him in the loop."},"comment":{"url":"https://api.github.com/repos/eugeneia/snabbswitch/issues/comments/180008345","html_url":"https://github.com/eugeneia/snabbswitch/pull/11#issuecomment-180008345","issue_url":"https://api.github.com/repos/eugeneia/snabbswitch/issues/11","id":180008345,"user":{"login":"eugeneia","id":4933566,"avatar_url":"https://avatars.githubusercontent.com/u/4933566?v=3","gravatar_id":"","url":"https://api.github.com/users/eugeneia","html_url":"https://github.com/eugeneia","followers_url":"https://api.github.com/users/eugeneia/followers","following_url":"https://api.github.com/users/eugeneia/following{/other_user}","gists_url":"https://api.github.com/users/eugeneia/gists{/gist_id}","starred_url":"https://api.github.com/users/eugeneia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eugeneia/subscriptions","organizations_url":"https://api.github.com/users/eugeneia/orgs","repos_url":"https://api.github.com/users/eugeneia/repos","events_url":"https://api.github.com/users/eugeneia/events{/privacy}","received_events_url":"https://api.github.com/users/eugeneia/received_events","type":"User","site_admin":false},"created_at":"2016-02-04T19:14:53Z","updated_at":"2016-02-04T19:14:53Z","body":"@corsix For some reason, I can't get the encryption/decryption routines to “pick up” the “Additional Authentication Data”. E.g. the AAD doesn't impact the resulting ICV. I threw together a little test case: https://github.com/eugeneia/snabbswitch/blob/9fd0119f5a0bbb10c4b905c1b1e896e64d1cc142/src/lib/ipsec/aad_test.lua\r\n\r\nI checked both the Intel routines and your transliteration and they exhibit the same behavior, so this really isn't your problem problem and I guessing its some silly mistake in how I call the routines. Anyways, I can't make much sense of the assembler code so any hints would be highly appreciated."}}