Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RIOT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cm-projects
RIOT
Commits
7a49bd07
Commit
7a49bd07
authored
6 years ago
by
Silke Hofstra
Browse files
Options
Downloads
Patches
Plain Diff
tests: add test for the libb2 package
parent
07c0ac81
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
tests/pkg_libb2/Makefile
+14
-0
14 additions, 0 deletions
tests/pkg_libb2/Makefile
tests/pkg_libb2/main.c
+86
-0
86 additions, 0 deletions
tests/pkg_libb2/main.c
tests/pkg_libb2/tests/01-run.py
+18
-0
18 additions, 0 deletions
tests/pkg_libb2/tests/01-run.py
with
118 additions
and
0 deletions
tests/pkg_libb2/Makefile
0 → 100644
+
14
−
0
View file @
7a49bd07
include
../Makefile.tests_common
# BLAKE2s + BLAKE2 is too big for these boards
BOARD_INSUFFICIENT_MEMORY
:=
arduino-duemilanove arduino-uno chronos
\
mega-xplained msb-430 msb-430h nucleo-f031k6
\
nucleo-f042k6 nucleo-l031k6 telosb waspmote-pro
\
wsn430-v1_3b wsn430-v1_4 z1
TEST_ON_CI_WHITELIST
+=
all
USEPKG
+=
libb2
USEMODULE
+=
embunit
include
$(RIOTBASE)/Makefile.include
This diff is collapsed.
Click to expand it.
tests/pkg_libb2/main.c
0 → 100644
+
86
−
0
View file @
7a49bd07
/*
* Copyright (C) 2018 Silke Hofstra
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @ingroup tests
* @{
*
* @file
* @brief Test the libb2 package
*
* @author Silke Hofstra <silke@slxh.eu>
*
* @}
*/
#include
<string.h>
#include
"embUnit.h"
#include
"blake2.h"
const
uint8_t
msg
[]
=
{
0x00
,
0x01
,
0x02
,
0x03
,
0x04
,
0x05
,
0x06
,
0x07
,
0x08
,
0x09
,
0x0a
,
0x0b
,
0x0c
};
const
uint8_t
key
[]
=
{
0x00
,
0x01
,
0x02
,
0x03
,
0x04
,
0x05
,
0x06
,
0x07
,
0x08
,
0x09
,
0x0a
,
0x0b
,
0x0c
,
0x0d
,
0x0e
,
0x0f
,
0x10
,
0x11
,
0x12
,
0x13
,
0x14
,
0x15
,
0x16
,
0x17
,
0x18
,
0x19
,
0x1a
,
0x1b
,
0x1c
,
0x1d
,
0x1e
,
0x1f
,
0x20
,
0x21
,
0x22
,
0x23
,
0x24
,
0x25
,
0x26
,
0x27
,
0x28
,
0x29
,
0x2a
,
0x2b
,
0x2c
,
0x2d
,
0x2e
,
0x2f
,
0x30
,
0x31
,
0x32
,
0x33
,
0x34
,
0x35
,
0x36
,
0x37
,
0x38
,
0x39
,
0x3a
,
0x3b
,
0x3c
,
0x3d
,
0x3e
,
0x3f
};
const
uint8_t
b2s
[]
=
{
0xf5
,
0xc4
,
0xbe
,
0xc6
,
0xd6
,
0x2f
,
0xc6
,
0x08
,
0xbf
,
0x41
,
0xcc
,
0x11
,
0x5f
,
0x16
,
0xd6
,
0x1c
,
0x7e
,
0xfd
,
0x3f
,
0xf6
,
0xc6
,
0x56
,
0x92
,
0xbb
,
0xe0
,
0xaf
,
0xff
,
0xb1
,
0xfe
,
0xde
,
0x74
,
0x75
};
const
uint8_t
b2b
[]
=
{
0x43
,
0xd4
,
0x4b
,
0xfa
,
0x18
,
0x76
,
0x8c
,
0x59
,
0x89
,
0x6b
,
0xf7
,
0xed
,
0x17
,
0x65
,
0xcb
,
0x2d
,
0x14
,
0xaf
,
0x8c
,
0x26
,
0x02
,
0x66
,
0x03
,
0x90
,
0x99
,
0xb2
,
0x5a
,
0x60
,
0x3e
,
0x4d
,
0xdc
,
0x50
,
0x39
,
0xd6
,
0xef
,
0x3a
,
0x91
,
0x84
,
0x7d
,
0x10
,
0x88
,
0xd4
,
0x01
,
0xc0
,
0xc7
,
0xe8
,
0x47
,
0x78
,
0x1a
,
0x8a
,
0x59
,
0x0d
,
0x33
,
0xa3
,
0xc6
,
0xcb
,
0x4d
,
0xf0
,
0xfa
,
0xb1
,
0xc2
,
0xf2
,
0x23
,
0x55
};
/* Test BLAKE2s */
static
void
test_blake2s
(
void
)
{
uint8_t
hash
[
BLAKE2S_OUTBYTES
];
int
res
=
blake2s
(
hash
,
msg
,
key
,
sizeof
hash
,
sizeof
msg
,
BLAKE2S_KEYBYTES
);
TEST_ASSERT
(
res
==
0
);
TEST_ASSERT
(
memcmp
(
b2s
,
hash
,
sizeof
hash
)
==
0
);
}
/* Test BLAKE2b */
static
void
test_blake2b
(
void
)
{
uint8_t
hash
[
BLAKE2B_OUTBYTES
];
int
res
=
blake2b
(
hash
,
msg
,
key
,
sizeof
hash
,
sizeof
msg
,
BLAKE2B_KEYBYTES
);
TEST_ASSERT
(
res
==
0
);
TEST_ASSERT
(
memcmp
(
b2b
,
hash
,
sizeof
hash
)
==
0
);
}
Test
*
tests_blake2
(
void
)
{
EMB_UNIT_TESTFIXTURES
(
fixtures
)
{
new_TestFixture
(
test_blake2s
),
new_TestFixture
(
test_blake2b
),
};
EMB_UNIT_TESTCALLER
(
blake2_tests
,
NULL
,
NULL
,
fixtures
);
return
(
Test
*
)
&
blake2_tests
;
}
int
main
(
void
)
{
TESTS_START
();
TESTS_RUN
(
tests_blake2
());
TESTS_END
();
return
0
;
}
This diff is collapsed.
Click to expand it.
tests/pkg_libb2/tests/01-run.py
0 → 100755
+
18
−
0
View file @
7a49bd07
#!/usr/bin/env python3
# Copyright (C) 2017 Freie Universität Berlin
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
import
sys
from
testrunner
import
run
def
testfunc
(
child
):
child
.
expect_exact
(
'
OK (2 tests)
'
)
if
__name__
==
"
__main__
"
:
sys
.
exit
(
run
(
testfunc
))
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment