Elcoid
d1428cd2ae
sam: fix inconsistencies in version negotiation of sam handshake
...
This commit fixes [issue #2570 ](https://github.com/PurpleI2P/i2pd/issues/2570 ).
The [specification of the SAM protocol](https://i2p.net/en/docs/api/samv3/ )
says the following:
- "As of version 3.1 (I2P 0.9.14), the MIN and MAX parameters are optional."
- "SAM will always return the highest version possible given the MIN and MAX
constraints"
Given this, the following handshakes do not change:
```
printf "HELLO VERSION MIN=3.1 MAX=3.3\n" | nc -q 0 127.0.0.1 7656
HELLO REPLY RESULT=OK VERSION=3.3
printf "HELLO VERSION MAX=3.3\n" | nc -q 0 127.0.0.1 7656
HELLO REPLY RESULT=OK VERSION=3.3
printf "HELLO VERSION MIN=31 MAX=31\n" | nc -q 0 127.0.0.1 7656
HELLO REPLY RESULT=OK VERSION=3.1
(periods are still optional)
```
But the following ones do (the responses before and after this commit
are included):
```
printf "HELLO VERSION MAX=3.4\n" | nc -q 0 127.0.0.1 7656
before: HELLO REPLY RESULT=NOVERSION
after: HELLO REPLY RESULT=OK VERSION=3.3
printf "HELLO VERSION MIN=3.0\n" | nc -q 0 127.0.0.1 7656
before: HELLO REPLY RESULT=OK VERSION=3.0
after: HELLO REPLY RESULT=OK VERSION=3.3
printf "HELLO VERSION MIN=3.1\n" | nc -q 0 127.0.0.1 7656
before: HELLO REPLY RESULT=OK VERSION=3.1
after: HELLO REPLY RESULT=OK VERSION=3.3
printf "HELLO VERSION MIN=2.9\n" | nc -q 0 127.0.0.1 7656
before: HELLO REPLY RESULT=NOVERSION
after: HELLO REPLY RESULT=OK VERSION=3.3
printf "HELLO VERSION\n" | nc -q 0 127.0.0.1 7656
before: HELLO REPLY RESULT=NOVERSION
after: HELLO REPLY RESULT=OK VERSION=3.3
printf "HELLO VERSION MIN=3.3 MAX=3.1\n" | nc -q 0 127.0.0.1 7656
before: HELLO REPLY RESULT=OK VERSION=3.1
after: HELLO REPLY RESULT=NOVERSION
printf "HELLO VERSION MIN=3.5 MAX=2.7\n" | nc -q 0 127.0.0.1 7656
before: HELLO REPLY RESULT=OK VERSION=2.7
after: HELLO REPLY RESULT=NOVERSION
printf "HELLO VERSION MIN=2.7 MAX=3.5\n" | nc -q 0 127.0.0.1 7656
before: HELLO REPLY RESULT=NOVERSION
after: HELLO REPLY RESULT=OK VERSION=3.3
printf "HELLO VERSION MIN=aab3vsg1df MAX=fd3gfbgf1bf\n" | nc -q 0 127.0.0.1 7656
before: HELLO REPLY RESULT=OK VERSION=3.1
after: HELLO REPLY RESULT=NOVERSION
```
I included a script to automatically test these handshakes.
2026-09-25 10:52:05 -04:00
PobreGato
271e64d524
build unit tests as C++20
2026-09-23 22:18:12 -04:00
PobreGato
039d3feea7
return false instead of throwing on a url with nothing after the schema
2026-08-31 03:12:39 +03:00
PobreGato
954e98eb4d
fail on a truncated chunk instead of returning uninitialized bytes
2026-08-31 03:00:47 +03:00
Łukasz Jerciński
8df75098d0
test(HTTP): add case-insensitive header matching tests
...
Add comprehensive tests for RFC 7230 compliance (header field names
are case-insensitive):
- HTTPReq: GetHeader, GetNumHeaders, UpdateHeader, RemoveHeader
- HTTPRes: content_length(), is_chunked(), is_gzipped(), add_header,
del_header, to_string() duplicate prevention
These tests currently fail and document the expected behavior.
2026-03-27 10:24:21 +01:00
orignal
bb2b34ff4f
check more precise result of EVP_DigestVerify
2025-06-12 16:05:17 -04:00
Daniel Bermond
37fd4b4422
tests: fix test-base-64
...
test-base-64 was not updated after the following commits:
https://github.com/PurpleI2P/i2pd/commit/93cc810f2987cc90b7a4f8699655af43b36c6c23
https://github.com/PurpleI2P/i2pd/commit/bbf5c1655a5f331b36cc7e16ad0bba86bb36eed4
This leads to errors like:
In file included from /usr/include/c++/15.1.1/cassert:46,
from /build/i2pd/src/i2pd-2.57.0/tests/test-base-64.cpp:1:
/build/i2pd/src/i2pd-2.57.0/tests/test-base-64.cpp: In function ‘int main()’:
/build/i2pd/src/i2pd-2.57.0/tests/test-base-64.cpp:14:28: error: too many arguments to function ‘std::string i2p::data::ByteStreamToBase64(const uint8_t*, size_t)’
14 | assert(ByteStreamToBase64(NULL, 0, NULL, 0) == 0);
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
and:
In file included from /build/i2pd/src/i2pd-2.57.0/tests/test-base-64.cpp:4:
/build/i2pd/src/i2pd-2.57.0/build/../libi2pd/Base.h:21:21: note: declared here
21 | std::string ByteStreamToBase64 (const uint8_t * InBuffer, size_t InCount);
| ^~~~~~~~~~~~~~~~~~
/build/i2pd/src/i2pd-2.57.0/tests/test-base-64.cpp:14:47: error: no match for ‘operator==’ (operand types are ‘std::string’ {aka ‘std::__cxx11::basic_string<char>’} and ‘int’)
14 | assert(ByteStreamToBase64(NULL, 0, NULL, 0) == 0);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^~ ~
| | |
| | int
| std::string {aka std::__cxx11::basic_string<char>}
among others.
2025-06-02 23:28:51 -03:00
orignal
fc16a70f7b
use AEADChaCha20Poly1305Encryptor and AEADChaCha20Poly1305Decryptor for test
2025-01-02 18:30:16 -05:00
orignal
619ec5d9c1
fixed AEAD/Chacha20/Poly1305 test
2025-01-02 09:04:57 -05:00
orignal
f23a7f569b
pass iv to AES Encrypt/Decrypt directly. aes-test added
2024-12-08 11:08:17 -05:00
orignal
0d09a8be00
removed own implementation of x25519
2024-11-01 17:53:27 -04:00
orignal
9668ea9338
removed C++11 support
2024-09-02 10:18:08 -04:00
orignal
8ffc1486a4
test-eddsa added
2023-12-18 09:32:12 -05:00
R4SAS
77142e59ee
[http] fix query detection, addresshelper processing, update tests
...
Signed-off-by: R4SAS <r4sas@i2pmail.org >
2023-02-14 18:51:14 +00:00
R4SAS
3cee8bfcb2
Update tests and corresponding makefiles ( #1862 )
2023-01-30 04:17:49 +03:00
orignal
8a106eb09e
fixed test-http-req
2023-01-28 17:18:54 -05:00
R4SAS
446bbf6b93
Merge pull request #1812 from barracuda156/tests
...
Add implementation of tests with CMake, plus a few minor fixes
2023-01-01 10:55:29 +00:00
orignal
b4c226f4b3
EdDSA blinding test
2022-11-27 10:54:17 -05:00
barracuda156
61bcfebcc8
Add CMake support for tests
2022-11-26 06:32:56 +08:00
orignal
3a77e7ba2d
remove dependancy from localization
2021-09-04 18:55:51 -04:00
R4SAS
ec98ff297c
Make blinding test runnable
2021-08-24 13:23:10 +03:00
Daniel Bermond
7d220fb2eb
[tests] fix compilation of test-blinding
...
test-blinding currently fails to build with the following error:
In file included from ../libi2pd/Timestamp.cpp:19:
../libi2pd/RouterContext.h:21:10: fatal error:
I18N_langs.h: No such file or directory
21 | #include "I18N_langs.h"
| ^~~~~~~~~~~~~~
compilation terminated.
2021-08-23 17:22:28 -03:00
orignal
0d2d7e5e71
fixed Elligator tests
2020-01-21 17:53:48 -05:00
orignal
0e666e7d6a
encoding fail test
2020-01-21 10:53:11 -05:00
orignal
f498fabd27
fix for openssl 1.1
2020-01-21 10:52:51 -05:00
orignal
9ed58e5186
encode with highY
2019-12-10 14:10:12 -05:00
orignal
36eaaa748c
handle case when encoded key is (p-1)/2
2019-12-10 13:40:04 -05:00
orignal
4d7b86ca26
elligator test added
2019-12-10 13:20:23 -05:00
orignal
64707dbb22
key blinding test
2019-05-31 11:57:16 -04:00
orignal
abc4f6c70b
fixed bug with chacha20 encryption of short messages
2018-12-03 13:36:17 -05:00
orignal
7efb47fed4
send NTCP2 frame from I2NP messages
2018-12-02 14:24:39 -05:00
orignal
ef6db64e9f
correct chacha20 for multiple messages
2018-11-30 16:21:11 -05:00
orignal
e68f1dbc99
AEAD/Chacha20/Poly1305 encrypt multiple buffers
2018-11-30 14:41:14 -05:00
orignal
5447259e1a
AEAD/ChaCha20/Poly1305 decryption and SessionCreate prcessing
2018-06-13 16:16:23 -04:00
orignal
6b9061515f
AEAD/ChaCha20/Poly1305 test added
2018-06-13 12:25:32 -04:00
orignal
bf1e1ad457
eliminate extra dependencies
2018-06-13 10:49:14 -04:00
orignal
7fa5b06359
x25519 unti test
2018-06-12 18:29:06 -04:00
Jeff Becker
4cc3b7f9fb
restructure build to separate the 3 main components into 3 subdirectories
...
libi2pd for core libs
libi2pd_client for i2pd client libs
daemon for i2pd daemon libs
2017-04-21 06:33:45 -04:00
orignal
bd2c2acd5f
use CryptoProA params for GOST R 34.10-2012 256 bits
2017-03-21 11:48:34 -04:00
orignal
13aab750dd
GOST signature unit test added
2017-03-21 10:45:57 -04:00
orignal
7a51abc2f9
GOST unit tests added
2017-03-21 09:44:09 -04:00
orignal
44a3e08095
GOST unit tests added
2017-03-21 09:43:36 -04:00
hagen
02ac638bd4
* HTTP.cpp : add comments, update test case
2016-07-01 00:34:31 +00:00
hagen
2d252e6459
* HTTP.cpp : rename method
2016-06-28 14:31:40 +00:00
hagen
7f26670173
+ tests/test-base-64.cpp
2016-06-28 01:45:14 +00:00
hagen
a973630cb4
* fix tests
2016-06-27 13:11:10 +00:00
hagen
8589493581
* add test for MergeChunkedResponse() ( #432 )
2016-06-01 00:14:40 +00:00
hagen
43a90d7b98
* HTTP.cpp : fix parse_header_line ( #501 )
2016-05-26 00:08:00 +00:00
hagen
b68f06ca83
* update tests
2016-05-24 12:40:24 +00:00
hagen
a15aad9f9c
* unit-tests
2016-04-27 00:39:12 +00:00