From eb7690e81f527ae36ecc05e567848606ccebde01 Mon Sep 17 00:00:00 2001 From: Philippe Reynes Date: Wed, 29 Apr 2020 15:26:16 +0200 Subject: test/py: vboot: add a test to check fit signature on fit with padding The pytest vboot does all his tests on fit without padding. We add the same tests on fit with padding. Reviewed-by: Simon Glass Signed-off-by: Philippe Reynes --- test/py/tests/test_vboot.py | 52 ++++++++++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 19 deletions(-) (limited to 'test') diff --git a/test/py/tests/test_vboot.py b/test/py/tests/test_vboot.py index e67f2b3d0f..6b998cfd70 100644 --- a/test/py/tests/test_vboot.py +++ b/test/py/tests/test_vboot.py @@ -30,11 +30,16 @@ import u_boot_utils as util import vboot_forge TESTDATA = [ - ['sha1', '', False], - ['sha1', '-pss', False], - ['sha256', '', False], - ['sha256', '-pss', False], - ['sha256', '-pss', True], + ['sha1', '', None, False], + ['sha1', '', '-E -p 0x10000', False], + ['sha1', '-pss', None, False], + ['sha1', '-pss', '-E -p 0x10000', False], + ['sha256', '', None, False], + ['sha256', '', '-E -p 0x10000', False], + ['sha256', '-pss', None, False], + ['sha256', '-pss', '-E -p 0x10000', False], + ['sha256', '-pss', None, True], + ['sha256', '-pss', '-E -p 0x10000', True], ] @pytest.mark.boardspec('sandbox') @@ -43,8 +48,8 @@ TESTDATA = [ @pytest.mark.requiredtool('fdtget') @pytest.mark.requiredtool('fdtput') @pytest.mark.requiredtool('openssl') -@pytest.mark.parametrize("sha_algo,padding,required", TESTDATA) -def test_vboot(u_boot_console, sha_algo, padding, required): +@pytest.mark.parametrize("sha_algo,padding,sign_options,required", TESTDATA) +def test_vboot(u_boot_console, sha_algo, padding, sign_options, required): """Test verified boot signing with mkimage and verification with 'bootm'. This works using sandbox only as it needs to update the device tree used @@ -104,7 +109,7 @@ def test_vboot(u_boot_console, sha_algo, padding, required): util.run_and_log(cons, [mkimage, '-D', dtc_args, '-f', '%s%s' % (datadir, its), fit]) - def sign_fit(sha_algo): + def sign_fit(sha_algo, options): """Sign the FIT Signs the FIT and writes the signature into it. It also writes the @@ -113,10 +118,13 @@ def test_vboot(u_boot_console, sha_algo, padding, required): Args: sha_algo: Either 'sha1' or 'sha256', to select the algorithm to use. + options: Options to provide to mkimage. """ + args = [mkimage, '-F', '-k', tmpdir, '-K', dtb, '-r', fit] + if options: + args += options.split(' ') cons.log.action('%s: Sign images' % sha_algo) - util.run_and_log(cons, [mkimage, '-F', '-k', tmpdir, '-K', dtb, - '-r', fit]) + util.run_and_log(cons, args) def replace_fit_totalsize(size): """Replace FIT header's totalsize with something greater. @@ -154,7 +162,7 @@ def test_vboot(u_boot_console, sha_algo, padding, required): util.run_and_log(cons, 'openssl req -batch -new -x509 -key %s%s.key ' '-out %s%s.crt' % (tmpdir, name, tmpdir, name)) - def test_with_algo(sha_algo, padding): + def test_with_algo(sha_algo, padding, sign_options): """Test verified boot with the given hash algorithm. This is the main part of the test code. The same procedure is followed @@ -163,6 +171,9 @@ def test_vboot(u_boot_console, sha_algo, padding, required): Args: sha_algo: Either 'sha1' or 'sha256', to select the algorithm to use. + padding: Either '' or '-pss', to select the padding to use for the + rsa signature algorithm. + sign_options: Options to mkimage when signing a fit image. """ # Compile our device tree files for kernel and U-Boot. These are # regenerated here since mkimage will modify them (by adding a @@ -176,7 +187,7 @@ def test_vboot(u_boot_console, sha_algo, padding, required): run_bootm(sha_algo, 'unsigned images', 'dev-', True) # Sign images with our dev keys - sign_fit(sha_algo) + sign_fit(sha_algo, sign_options) run_bootm(sha_algo, 'signed images', 'dev+', True) # Create a fresh .dtb without the public keys @@ -187,7 +198,7 @@ def test_vboot(u_boot_console, sha_algo, padding, required): run_bootm(sha_algo, 'unsigned config', '%s+ OK' % sha_algo, True) # Sign images with our dev keys - sign_fit(sha_algo) + sign_fit(sha_algo, sign_options) run_bootm(sha_algo, 'signed config', 'dev+', True) cons.log.action('%s: Check signed config on the host' % sha_algo) @@ -209,7 +220,7 @@ def test_vboot(u_boot_console, sha_algo, padding, required): # Create a new properly signed fit and replace header bytes make_fit('sign-configs-%s%s.its' % (sha_algo, padding)) - sign_fit(sha_algo) + sign_fit(sha_algo, sign_options) bcfg = u_boot_console.config.buildconfig max_size = int(bcfg.get('config_fit_signature_max_size', 0x10000000), 0) existing_size = replace_fit_totalsize(max_size + 1) @@ -240,7 +251,7 @@ def test_vboot(u_boot_console, sha_algo, padding, required): cons, [fit_check_sign, '-f', fit, '-k', dtb], 1, 'Failed to verify required signature') - def test_required_key(sha_algo, padding): + def test_required_key(sha_algo, padding, sign_options): """Test verified boot with the given hash algorithm. This function tests if U-Boot rejects an image when a required key isn't @@ -248,6 +259,9 @@ def test_vboot(u_boot_console, sha_algo, padding, required): Args: sha_algo: Either 'sha1' or 'sha256', to select the algorithm to use + padding: Either '' or '-pss', to select the padding to use for the + rsa signature algorithm. + sign_options: Options to mkimage when signing a fit image. """ # Compile our device tree files for kernel and U-Boot. These are # regenerated here since mkimage will modify them (by adding a @@ -260,12 +274,12 @@ def test_vboot(u_boot_console, sha_algo, padding, required): # Build the FIT with prod key (keys required) and sign it. This puts the # signature into sandbox-u-boot.dtb, marked 'required' make_fit('sign-configs-%s%s-prod.its' % (sha_algo, padding)) - sign_fit(sha_algo) + sign_fit(sha_algo, sign_options) # Build the FIT with dev key (keys NOT required). This adds the # signature into sandbox-u-boot.dtb, NOT marked 'required'. make_fit('sign-configs-%s%s.its' % (sha_algo, padding)) - sign_fit(sha_algo) + sign_fit(sha_algo, sign_options) # So now sandbox-u-boot.dtb two signatures, for the prod and dev keys. # Only the prod key is set as 'required'. But FIT we just built has @@ -297,9 +311,9 @@ def test_vboot(u_boot_console, sha_algo, padding, required): old_dtb = cons.config.dtb cons.config.dtb = dtb if required: - test_required_key(sha_algo, padding) + test_required_key(sha_algo, padding, sign_options) else: - test_with_algo(sha_algo, padding) + test_with_algo(sha_algo, padding, sign_options) finally: # Go back to the original U-Boot with the correct dtb. cons.config.dtb = old_dtb -- cgit v1.2.3 From bf6ad91629d05c58c99d0cd763f865ae0670102a Mon Sep 17 00:00:00 2001 From: Chunfeng Yun Date: Sat, 2 May 2020 11:35:10 +0200 Subject: test: dm: add test item for ofnode_get_child_count() Add a test item for ofnode_get_child_count() Signed-off-by: Chunfeng Yun Signed-off-by: Frank Wunderlich Reviewed-by: Simon Glass Reviewed-by: Weijie Gao --- arch/sandbox/dts/test.dts | 18 ++++++++++++++++++ test/dm/ofnode.c | 21 +++++++++++++++++++++ 2 files changed, 39 insertions(+) (limited to 'test') diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts index 4bccfbe6e1..9c00e94501 100644 --- a/arch/sandbox/dts/test.dts +++ b/arch/sandbox/dts/test.dts @@ -218,6 +218,24 @@ compatible = "denx,u-boot-fdt-test1"; }; + i-test { + compatible = "mediatek,u-boot-fdt-test"; + #address-cells = <1>; + #size-cells = <0>; + + subnode@0 { + reg = <0>; + }; + + subnode@1 { + reg = <1>; + }; + + subnode@2 { + reg = <2>; + }; + }; + devres-test { compatible = "denx,u-boot-devres-test"; }; diff --git a/test/dm/ofnode.c b/test/dm/ofnode.c index 1c49eaf38b..07d5c7d7a6 100644 --- a/test/dm/ofnode.c +++ b/test/dm/ofnode.c @@ -113,3 +113,24 @@ static int dm_test_ofnode_read_chosen(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_ofnode_read_chosen, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); + +static int dm_test_ofnode_get_child_count(struct unit_test_state *uts) +{ + ofnode node, child_node; + u32 val; + + node = ofnode_path("/i-test"); + ut_assert(ofnode_valid(node)); + + val = ofnode_get_child_count(node); + ut_asserteq(3, val); + + child_node = ofnode_first_subnode(node); + ut_assert(ofnode_valid(child_node)); + val = ofnode_get_child_count(child_node); + ut_asserteq(0, val); + + return 0; +} +DM_TEST(dm_test_ofnode_get_child_count, + DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); -- cgit v1.2.3 From 00c82acfe9aadaa624699e4579dace583f944449 Mon Sep 17 00:00:00 2001 From: Chunfeng Yun Date: Sat, 2 May 2020 11:35:12 +0200 Subject: test: dm: phy: add a test item for the phy_bulk API Add a test item for the phy_bulk API Signed-off-by: Chunfeng Yun Signed-off-by: Frank Wunderlich Reviewed-by: Weijie Gao Reviewed-by: Simon Glass Reviewed-by: Jagan Teki --- arch/sandbox/dts/test.dts | 11 +++++++++++ test/dm/phy.c | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) (limited to 'test') diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts index 9c00e94501..15cd2330a3 100644 --- a/arch/sandbox/dts/test.dts +++ b/arch/sandbox/dts/test.dts @@ -159,12 +159,23 @@ broken; }; + phy_provider2: gen_phy@2 { + compatible = "sandbox,phy"; + #phy-cells = <0>; + }; + gen_phy_user: gen_phy_user { compatible = "simple-bus"; phys = <&phy_provider0 0>, <&phy_provider0 1>, <&phy_provider1>; phy-names = "phy1", "phy2", "phy3"; }; + gen_phy_user1: gen_phy_user1 { + compatible = "simple-bus"; + phys = <&phy_provider0 0>, <&phy_provider2>; + phy-names = "phy1", "phy2"; + }; + some-bus { #address-cells = <1>; #size-cells = <0>; diff --git a/test/dm/phy.c b/test/dm/phy.c index 21d92194b9..92455d94af 100644 --- a/test/dm/phy.c +++ b/test/dm/phy.c @@ -110,3 +110,36 @@ static int dm_test_phy_ops(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_phy_ops, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); + +static int dm_test_phy_bulk(struct unit_test_state *uts) +{ + struct phy_bulk phys; + struct udevice *parent; + + /* test normal operations */ + ut_assertok(uclass_get_device_by_name(UCLASS_SIMPLE_BUS, + "gen_phy_user1", &parent)); + + ut_assertok(generic_phy_get_bulk(parent, &phys)); + ut_asserteq(2, phys.count); + + ut_asserteq(0, generic_phy_init_bulk(&phys)); + ut_asserteq(0, generic_phy_power_on_bulk(&phys)); + ut_asserteq(0, generic_phy_power_off_bulk(&phys)); + ut_asserteq(0, generic_phy_exit_bulk(&phys)); + + /* has a known problem phy */ + ut_assertok(uclass_get_device_by_name(UCLASS_SIMPLE_BUS, + "gen_phy_user", &parent)); + + ut_assertok(generic_phy_get_bulk(parent, &phys)); + ut_asserteq(3, phys.count); + + ut_asserteq(0, generic_phy_init_bulk(&phys)); + ut_asserteq(-EIO, generic_phy_power_on_bulk(&phys)); + ut_asserteq(-EIO, generic_phy_power_off_bulk(&phys)); + ut_asserteq(0, generic_phy_exit_bulk(&phys)); + + return 0; +} +DM_TEST(dm_test_phy_bulk, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); -- cgit v1.2.3 From e3f5c9cb0fcc95aa9287b5f8609294fe1a59b9da Mon Sep 17 00:00:00 2001 From: AKASHI Takahiro Date: Tue, 21 Apr 2020 09:38:17 +0900 Subject: lib/crypto, efi_loader: move some headers to include/crypto Pkcs7_parse.h and x509_parser.h are used in UEFI subsystem, in particular, secure boot. So move them to include/crypto to avoid relative paths. Suggested-by: Heinrich Schuchardt Signed-off-by: AKASHI Takahiro Don't include include x509_parser.h twice. Reviewed-by: Heinrich Schuchardt --- include/crypto/pkcs7_parser.h | 69 +++++++++++++++++++++++++++++++++++++++ include/crypto/x509_parser.h | 61 ++++++++++++++++++++++++++++++++++ lib/crypto/pkcs7_parser.c | 4 +++ lib/crypto/pkcs7_parser.h | 69 --------------------------------------- lib/crypto/x509_cert_parser.c | 4 +++ lib/crypto/x509_parser.h | 61 ---------------------------------- lib/crypto/x509_public_key.c | 6 ++-- lib/efi_loader/efi_image_loader.c | 2 +- lib/efi_loader/efi_signature.c | 2 +- lib/efi_loader/efi_variable.c | 2 +- test/lib/asn1.c | 4 +-- 11 files changed, 147 insertions(+), 137 deletions(-) create mode 100644 include/crypto/pkcs7_parser.h create mode 100644 include/crypto/x509_parser.h delete mode 100644 lib/crypto/pkcs7_parser.h delete mode 100644 lib/crypto/x509_parser.h (limited to 'test') diff --git a/include/crypto/pkcs7_parser.h b/include/crypto/pkcs7_parser.h new file mode 100644 index 0000000000..b8234da45a --- /dev/null +++ b/include/crypto/pkcs7_parser.h @@ -0,0 +1,69 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* PKCS#7 crypto data parser internal definitions + * + * Copyright (C) 2012 Red Hat, Inc. All Rights Reserved. + * Written by David Howells (dhowells@redhat.com) + */ + +#ifndef _PKCS7_PARSER_H +#define _PKCS7_PARSER_H + +#include +#include +#include "x509_parser.h" + +#define kenter(FMT, ...) \ + pr_devel("==> %s("FMT")\n", __func__, ##__VA_ARGS__) +#define kleave(FMT, ...) \ + pr_devel("<== %s()"FMT"\n", __func__, ##__VA_ARGS__) + +struct pkcs7_signed_info { + struct pkcs7_signed_info *next; + struct x509_certificate *signer; /* Signing certificate (in msg->certs) */ + unsigned index; + bool unsupported_crypto; /* T if not usable due to missing crypto */ + bool blacklisted; + + /* Message digest - the digest of the Content Data (or NULL) */ + const void *msgdigest; + unsigned msgdigest_len; + + /* Authenticated Attribute data (or NULL) */ + unsigned authattrs_len; + const void *authattrs; + unsigned long aa_set; +#define sinfo_has_content_type 0 +#define sinfo_has_signing_time 1 +#define sinfo_has_message_digest 2 +#define sinfo_has_smime_caps 3 +#define sinfo_has_ms_opus_info 4 +#define sinfo_has_ms_statement_type 5 + time64_t signing_time; + + /* Message signature. + * + * This contains the generated digest of _either_ the Content Data or + * the Authenticated Attributes [RFC2315 9.3]. If the latter, one of + * the attributes contains the digest of the the Content Data within + * it. + * + * THis also contains the issuing cert serial number and issuer's name + * [PKCS#7 or CMS ver 1] or issuing cert's SKID [CMS ver 3]. + */ + struct public_key_signature *sig; +}; + +struct pkcs7_message { + struct x509_certificate *certs; /* Certificate list */ + struct x509_certificate *crl; /* Revocation list */ + struct pkcs7_signed_info *signed_infos; + u8 version; /* Version of cert (1 -> PKCS#7 or CMS; 3 -> CMS) */ + bool have_authattrs; /* T if have authattrs */ + + /* Content Data (or NULL) */ + enum OID data_type; /* Type of Data */ + size_t data_len; /* Length of Data */ + size_t data_hdrlen; /* Length of Data ASN.1 header */ + const void *data; /* Content Data (or 0) */ +}; +#endif /* _PKCS7_PARSER_H */ diff --git a/include/crypto/x509_parser.h b/include/crypto/x509_parser.h new file mode 100644 index 0000000000..4cbdc1d661 --- /dev/null +++ b/include/crypto/x509_parser.h @@ -0,0 +1,61 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* X.509 certificate parser internal definitions + * + * Copyright (C) 2012 Red Hat, Inc. All Rights Reserved. + * Written by David Howells (dhowells@redhat.com) + */ + +#ifndef _X509_PARSER_H +#define _X509_PARSER_H + +#include +#include +#include + +struct x509_certificate { + struct x509_certificate *next; + struct x509_certificate *signer; /* Certificate that signed this one */ + struct public_key *pub; /* Public key details */ + struct public_key_signature *sig; /* Signature parameters */ + char *issuer; /* Name of certificate issuer */ + char *subject; /* Name of certificate subject */ + struct asymmetric_key_id *id; /* Issuer + Serial number */ + struct asymmetric_key_id *skid; /* Subject + subjectKeyId (optional) */ + time64_t valid_from; + time64_t valid_to; + const void *tbs; /* Signed data */ + unsigned tbs_size; /* Size of signed data */ + unsigned raw_sig_size; /* Size of sigature */ + const void *raw_sig; /* Signature data */ + const void *raw_serial; /* Raw serial number in ASN.1 */ + unsigned raw_serial_size; + unsigned raw_issuer_size; + const void *raw_issuer; /* Raw issuer name in ASN.1 */ + const void *raw_subject; /* Raw subject name in ASN.1 */ + unsigned raw_subject_size; + unsigned raw_skid_size; + const void *raw_skid; /* Raw subjectKeyId in ASN.1 */ + unsigned index; + bool seen; /* Infinite recursion prevention */ + bool verified; + bool self_signed; /* T if self-signed (check unsupported_sig too) */ + bool unsupported_key; /* T if key uses unsupported crypto */ + bool unsupported_sig; /* T if signature uses unsupported crypto */ + bool blacklisted; +}; + +/* + * x509_cert_parser.c + */ +extern void x509_free_certificate(struct x509_certificate *cert); +extern struct x509_certificate *x509_cert_parse(const void *data, size_t datalen); +extern int x509_decode_time(time64_t *_t, size_t hdrlen, + unsigned char tag, + const unsigned char *value, size_t vlen); + +/* + * x509_public_key.c + */ +extern int x509_get_sig_params(struct x509_certificate *cert); +extern int x509_check_for_self_signed(struct x509_certificate *cert); +#endif /* _X509_PARSER_H */ diff --git a/lib/crypto/pkcs7_parser.c b/lib/crypto/pkcs7_parser.c index f5dda1179f..0ee207b6b1 100644 --- a/lib/crypto/pkcs7_parser.c +++ b/lib/crypto/pkcs7_parser.c @@ -20,7 +20,11 @@ #include #include #include +#ifdef __UBOOT__ +#include +#else #include "pkcs7_parser.h" +#endif #include "pkcs7.asn1.h" MODULE_DESCRIPTION("PKCS#7 parser"); diff --git a/lib/crypto/pkcs7_parser.h b/lib/crypto/pkcs7_parser.h deleted file mode 100644 index b8234da45a..0000000000 --- a/lib/crypto/pkcs7_parser.h +++ /dev/null @@ -1,69 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later */ -/* PKCS#7 crypto data parser internal definitions - * - * Copyright (C) 2012 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - */ - -#ifndef _PKCS7_PARSER_H -#define _PKCS7_PARSER_H - -#include -#include -#include "x509_parser.h" - -#define kenter(FMT, ...) \ - pr_devel("==> %s("FMT")\n", __func__, ##__VA_ARGS__) -#define kleave(FMT, ...) \ - pr_devel("<== %s()"FMT"\n", __func__, ##__VA_ARGS__) - -struct pkcs7_signed_info { - struct pkcs7_signed_info *next; - struct x509_certificate *signer; /* Signing certificate (in msg->certs) */ - unsigned index; - bool unsupported_crypto; /* T if not usable due to missing crypto */ - bool blacklisted; - - /* Message digest - the digest of the Content Data (or NULL) */ - const void *msgdigest; - unsigned msgdigest_len; - - /* Authenticated Attribute data (or NULL) */ - unsigned authattrs_len; - const void *authattrs; - unsigned long aa_set; -#define sinfo_has_content_type 0 -#define sinfo_has_signing_time 1 -#define sinfo_has_message_digest 2 -#define sinfo_has_smime_caps 3 -#define sinfo_has_ms_opus_info 4 -#define sinfo_has_ms_statement_type 5 - time64_t signing_time; - - /* Message signature. - * - * This contains the generated digest of _either_ the Content Data or - * the Authenticated Attributes [RFC2315 9.3]. If the latter, one of - * the attributes contains the digest of the the Content Data within - * it. - * - * THis also contains the issuing cert serial number and issuer's name - * [PKCS#7 or CMS ver 1] or issuing cert's SKID [CMS ver 3]. - */ - struct public_key_signature *sig; -}; - -struct pkcs7_message { - struct x509_certificate *certs; /* Certificate list */ - struct x509_certificate *crl; /* Revocation list */ - struct pkcs7_signed_info *signed_infos; - u8 version; /* Version of cert (1 -> PKCS#7 or CMS; 3 -> CMS) */ - bool have_authattrs; /* T if have authattrs */ - - /* Content Data (or NULL) */ - enum OID data_type; /* Type of Data */ - size_t data_len; /* Length of Data */ - size_t data_hdrlen; /* Length of Data ASN.1 header */ - const void *data; /* Content Data (or 0) */ -}; -#endif /* _PKCS7_PARSER_H */ diff --git a/lib/crypto/x509_cert_parser.c b/lib/crypto/x509_cert_parser.c index 4e41cffd23..18f5407a07 100644 --- a/lib/crypto/x509_cert_parser.c +++ b/lib/crypto/x509_cert_parser.c @@ -18,7 +18,11 @@ #include #endif #include +#ifdef __UBOOT__ +#include +#else #include "x509_parser.h" +#endif #include "x509.asn1.h" #include "x509_akid.asn1.h" diff --git a/lib/crypto/x509_parser.h b/lib/crypto/x509_parser.h deleted file mode 100644 index 4cbdc1d661..0000000000 --- a/lib/crypto/x509_parser.h +++ /dev/null @@ -1,61 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later */ -/* X.509 certificate parser internal definitions - * - * Copyright (C) 2012 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - */ - -#ifndef _X509_PARSER_H -#define _X509_PARSER_H - -#include -#include -#include - -struct x509_certificate { - struct x509_certificate *next; - struct x509_certificate *signer; /* Certificate that signed this one */ - struct public_key *pub; /* Public key details */ - struct public_key_signature *sig; /* Signature parameters */ - char *issuer; /* Name of certificate issuer */ - char *subject; /* Name of certificate subject */ - struct asymmetric_key_id *id; /* Issuer + Serial number */ - struct asymmetric_key_id *skid; /* Subject + subjectKeyId (optional) */ - time64_t valid_from; - time64_t valid_to; - const void *tbs; /* Signed data */ - unsigned tbs_size; /* Size of signed data */ - unsigned raw_sig_size; /* Size of sigature */ - const void *raw_sig; /* Signature data */ - const void *raw_serial; /* Raw serial number in ASN.1 */ - unsigned raw_serial_size; - unsigned raw_issuer_size; - const void *raw_issuer; /* Raw issuer name in ASN.1 */ - const void *raw_subject; /* Raw subject name in ASN.1 */ - unsigned raw_subject_size; - unsigned raw_skid_size; - const void *raw_skid; /* Raw subjectKeyId in ASN.1 */ - unsigned index; - bool seen; /* Infinite recursion prevention */ - bool verified; - bool self_signed; /* T if self-signed (check unsupported_sig too) */ - bool unsupported_key; /* T if key uses unsupported crypto */ - bool unsupported_sig; /* T if signature uses unsupported crypto */ - bool blacklisted; -}; - -/* - * x509_cert_parser.c - */ -extern void x509_free_certificate(struct x509_certificate *cert); -extern struct x509_certificate *x509_cert_parse(const void *data, size_t datalen); -extern int x509_decode_time(time64_t *_t, size_t hdrlen, - unsigned char tag, - const unsigned char *value, size_t vlen); - -/* - * x509_public_key.c - */ -extern int x509_get_sig_params(struct x509_certificate *cert); -extern int x509_check_for_self_signed(struct x509_certificate *cert); -#endif /* _X509_PARSER_H */ diff --git a/lib/crypto/x509_public_key.c b/lib/crypto/x509_public_key.c index 676c0df174..571af9a0ad 100644 --- a/lib/crypto/x509_public_key.c +++ b/lib/crypto/x509_public_key.c @@ -16,15 +16,17 @@ #include #endif #include -#ifndef __UBOOT__ +#ifdef __UBOOT__ +#include +#else #include #include #include #include #include #include "asymmetric_keys.h" -#endif #include "x509_parser.h" +#endif /* * Set up the signature parameters in an X.509 certificate. This involves diff --git a/lib/efi_loader/efi_image_loader.c b/lib/efi_loader/efi_image_loader.c index 6c270ce94f..5a9a6424cc 100644 --- a/lib/efi_loader/efi_image_loader.c +++ b/lib/efi_loader/efi_image_loader.c @@ -13,7 +13,7 @@ #include #include #include -#include "../lib/crypto/pkcs7_parser.h" +#include "crypto/pkcs7_parser.h" const efi_guid_t efi_global_variable_guid = EFI_GLOBAL_VARIABLE_GUID; const efi_guid_t efi_guid_device_path = EFI_DEVICE_PATH_PROTOCOL_GUID; diff --git a/lib/efi_loader/efi_signature.c b/lib/efi_loader/efi_signature.c index 658e3547da..150ce41f36 100644 --- a/lib/efi_loader/efi_signature.c +++ b/lib/efi_loader/efi_signature.c @@ -10,11 +10,11 @@ #include #include #include +#include #include #include #include #include -#include "../lib/crypto/pkcs7_parser.h" const efi_guid_t efi_guid_image_security_database = EFI_IMAGE_SECURITY_DATABASE_GUID; diff --git a/lib/efi_loader/efi_variable.c b/lib/efi_loader/efi_variable.c index 7df881a74b..0c6d1deb58 100644 --- a/lib/efi_loader/efi_variable.c +++ b/lib/efi_loader/efi_variable.c @@ -12,9 +12,9 @@ #include #include #include +#include #include #include -#include "../lib/crypto/pkcs7_parser.h" enum efi_secure_mode { EFI_MODE_SETUP, diff --git a/test/lib/asn1.c b/test/lib/asn1.c index d2b3f67e68..8661fdd306 100644 --- a/test/lib/asn1.c +++ b/test/lib/asn1.c @@ -13,10 +13,10 @@ #include #ifdef CONFIG_PKCS7_MESSAGE_PARSER -#include "../../lib/crypto/pkcs7_parser.h" +#include #else #ifdef CONFIG_X509_CERTIFICATE_PARSER -#include "../../lib/crypto/x509_parser.h" +#include #endif #endif -- cgit v1.2.3 From 5827c2545849441dd60467565aac11964259972f Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Mon, 4 May 2020 12:21:51 +0200 Subject: test: stabilize test_efi_secboot When setting up the console via function efi_console_register() we call query_console_serial(). This functions sends an escape sequence to the terminal to query the display size. The response is another escape sequence. console.run_command_list() is looking for a regular expression '^==>'. If the escape sequence for the screen size precedes the prompt without a line break, no match is found. When efi_disk_register() is called before efi_console_register() this leads to a test failuere of the UEFI secure boot tests. We can avoid the problem if the first UEFI command passed to u_boot_console.run_command_list() produces output. This patch achieves this by appending '; echo' to the first UEFI related command of the problematic tests. Signed-off-by: Heinrich Schuchardt --- test/py/tests/test_efi_secboot/test_authvar.py | 8 ++++---- test/py/tests/test_efi_secboot/test_signed.py | 4 ++-- test/py/tests/test_efi_secboot/test_unsigned.py | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) (limited to 'test') diff --git a/test/py/tests/test_efi_secboot/test_authvar.py b/test/py/tests/test_efi_secboot/test_authvar.py index 55dcaa95f1..9912694a3e 100644 --- a/test/py/tests/test_efi_secboot/test_authvar.py +++ b/test/py/tests/test_efi_secboot/test_authvar.py @@ -133,7 +133,7 @@ class TestEfiAuthVar(object): output = u_boot_console.run_command_list([ 'host bind 0 %s' % disk_img, 'fatload host 0:1 4000000 PK.auth', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize PK', + 'setenv -e -nv -bs -rt -at -i 4000000,$filesize PK; echo', 'fatload host 0:1 4000000 KEK.auth', 'setenv -e -nv -bs -rt -at -i 4000000,$filesize KEK', 'fatload host 0:1 4000000 db.auth', @@ -174,7 +174,7 @@ class TestEfiAuthVar(object): output = u_boot_console.run_command_list([ 'host bind 0 %s' % disk_img, 'fatload host 0:1 4000000 PK.auth', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize PK', + 'setenv -e -nv -bs -rt -at -i 4000000,$filesize PK; echo', 'fatload host 0:1 4000000 KEK.auth', 'setenv -e -nv -bs -rt -at -i 4000000,$filesize KEK', 'fatload host 0:1 4000000 db.auth', @@ -215,7 +215,7 @@ class TestEfiAuthVar(object): output = u_boot_console.run_command_list([ 'host bind 0 %s' % disk_img, 'fatload host 0:1 4000000 PK.auth', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize PK', + 'setenv -e -nv -bs -rt -at -i 4000000,$filesize PK; echo', 'fatload host 0:1 4000000 KEK.auth', 'setenv -e -nv -bs -rt -at -i 4000000,$filesize KEK', 'fatload host 0:1 4000000 db.auth', @@ -249,7 +249,7 @@ class TestEfiAuthVar(object): output = u_boot_console.run_command_list([ 'host bind 0 %s' % disk_img, 'fatload host 0:1 4000000 PK.auth', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize PK', + 'setenv -e -nv -bs -rt -at -i 4000000,$filesize PK; echo', 'fatload host 0:1 4000000 KEK.auth', 'setenv -e -nv -bs -rt -at -i 4000000,$filesize KEK', 'fatload host 0:1 4000000 db.auth', diff --git a/test/py/tests/test_efi_secboot/test_signed.py b/test/py/tests/test_efi_secboot/test_signed.py index 584282b338..fc722ab506 100644 --- a/test/py/tests/test_efi_secboot/test_signed.py +++ b/test/py/tests/test_efi_secboot/test_signed.py @@ -29,7 +29,7 @@ class TestEfiSignedImage(object): # Test Case 1a, run signed image if no db/dbx output = u_boot_console.run_command_list([ 'host bind 0 %s' % disk_img, - 'efidebug boot add 1 HELLO1 host 0:1 /helloworld.efi.signed ""', + 'efidebug boot add 1 HELLO1 host 0:1 /helloworld.efi.signed ""; echo', 'efidebug boot next 1', 'bootefi bootmgr']) assert(re.search('Hello, world!', ''.join(output))) @@ -81,7 +81,7 @@ class TestEfiSignedImage(object): output = u_boot_console.run_command_list([ 'host bind 0 %s' % disk_img, 'fatload host 0:1 4000000 db.auth', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize dbx', + 'setenv -e -nv -bs -rt -at -i 4000000,$filesize dbx; echo', 'fatload host 0:1 4000000 KEK.auth', 'setenv -e -nv -bs -rt -at -i 4000000,$filesize KEK', 'fatload host 0:1 4000000 PK.auth', diff --git a/test/py/tests/test_efi_secboot/test_unsigned.py b/test/py/tests/test_efi_secboot/test_unsigned.py index 22d849afb8..a4af845c51 100644 --- a/test/py/tests/test_efi_secboot/test_unsigned.py +++ b/test/py/tests/test_efi_secboot/test_unsigned.py @@ -30,7 +30,7 @@ class TestEfiUnsignedImage(object): output = u_boot_console.run_command_list([ 'host bind 0 %s' % disk_img, 'fatload host 0:1 4000000 KEK.auth', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize KEK', + 'setenv -e -nv -bs -rt -at -i 4000000,$filesize KEK; echo', 'fatload host 0:1 4000000 PK.auth', 'setenv -e -nv -bs -rt -at -i 4000000,$filesize PK']) assert(not re.search('Failed to set EFI variable', ''.join(output))) @@ -58,7 +58,7 @@ class TestEfiUnsignedImage(object): output = u_boot_console.run_command_list([ 'host bind 0 %s' % disk_img, 'fatload host 0:1 4000000 db_hello.auth', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize db', + 'setenv -e -nv -bs -rt -at -i 4000000,$filesize db; echo', 'fatload host 0:1 4000000 KEK.auth', 'setenv -e -nv -bs -rt -at -i 4000000,$filesize KEK', 'fatload host 0:1 4000000 PK.auth', @@ -82,7 +82,7 @@ class TestEfiUnsignedImage(object): output = u_boot_console.run_command_list([ 'host bind 0 %s' % disk_img, 'fatload host 0:1 4000000 db_hello.auth', - 'setenv -e -nv -bs -rt -at -i 4000000,$filesize dbx', + 'setenv -e -nv -bs -rt -at -i 4000000,$filesize dbx; echo', 'fatload host 0:1 4000000 KEK.auth', 'setenv -e -nv -bs -rt -at -i 4000000,$filesize KEK', 'fatload host 0:1 4000000 PK.auth', -- cgit v1.2.3 From d0ba026bd22e4b1dfe918da8460bb418bc9f3217 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Wed, 6 May 2020 18:26:07 +0200 Subject: test: describe naming conventions for macro UNIT_TEST Strict naming conventions have to be followed for Python function generate_ut_subtest() to collect C unit tests to be executed via command 'ut'. Describe the requirements both on the C as well on the Python side. Signed-off-by: Heinrich Schuchardt Reviewed-by: Stephen Warren Reviewed-by: Simon Glass --- include/test/test.h | 24 +++++++++++++++++++++++- test/py/tests/test_ut.py | 17 ++++++++++++++++- 2 files changed, 39 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/include/test/test.h b/include/test/test.h index 2a75211008..029288de88 100644 --- a/include/test/test.h +++ b/include/test/test.h @@ -41,7 +41,29 @@ struct unit_test { int flags; }; -/* Declare a new unit test */ +/** + * UNIT_TEST() - create linker generated list entry for unit a unit test + * + * The macro UNIT_TEST() is used to create a linker generated list entry. These + * list entries are enumerate tests that can be execute using the ut command. + * The list entries are used both by the implementation of the ut command as + * well as in a related Python test. + * + * For Python testing the subtests are collected in Python function + * generate_ut_subtest() by applying a regular expression to the lines of file + * u-boot.sym. The list entries have to follow strict naming conventions to be + * matched by the expression. + * + * Use UNIT_TEST(foo_test_bar, _flags, foo_test) for a test bar in test suite + * foo that can be executed via command 'ut foo bar' and is implemented in + * function foo_test_bar(). + * + * @_name: concatenation of name of the test suite, "_test_", and the name + * of the test + * @_flags: an integer field that can be evaluated by the test suite + * implementation + * @_suite: name of the test suite concatenated with "_test" + */ #define UNIT_TEST(_name, _flags, _suite) \ ll_entry_declare(struct unit_test, _name, _suite) = { \ .file = __FILE__, \ diff --git a/test/py/tests/test_ut.py b/test/py/tests/test_ut.py index 6c7b8dd2b3..01c2b3ffa1 100644 --- a/test/py/tests/test_ut.py +++ b/test/py/tests/test_ut.py @@ -22,7 +22,22 @@ def test_ut_dm_init(u_boot_console): fh.write(data) def test_ut(u_boot_console, ut_subtest): - """Execute a "ut" subtest.""" + """Execute a "ut" subtest. + + The subtests are collected in function generate_ut_subtest() from linker + generated lists by applying a regular expression to the lines of file + u-boot.sym. The list entries are created using the C macro UNIT_TEST(). + + Strict naming conventions have to be followed to match the regular + expression. Use UNIT_TEST(foo_test_bar, _flags, foo_test) for a test bar in + test suite foo that can be executed via command 'ut foo bar' and is + implemented in C function foo_test_bar(). + + Args: + u_boot_console (ConsoleBase): U-Boot console + ut_subtest (str): test to be executed via command ut, e.g 'foo bar' to + execute command 'ut foo bar' + """ output = u_boot_console.run_command('ut ' + ut_subtest) assert output.endswith('Failures: 0') -- cgit v1.2.3 From be51c3ca088695e851daf38677d4a8f0fe666f77 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Wed, 6 May 2020 18:26:08 +0200 Subject: test: fix naming of test functions in the log test suite Both the nolog as well as the syslog tests were not found by Python function generate_ut_subtest() due to not following the nameing requirements imposed by the regular expression used to find linker generated list entries in file u-boot.sym. Adjust the naming of test functions. With the patch the following tests are executed successfully for sandbox_defconfig: test/py/tests/test_ut.py::test_ut[ut_log_syslog_debug] PASSED test/py/tests/test_ut.py::test_ut[ut_log_syslog_err] PASSED test/py/tests/test_ut.py::test_ut[ut_log_syslog_info] PASSED test/py/tests/test_ut.py::test_ut[ut_log_syslog_nodebug] PASSED test/py/tests/test_ut.py::test_ut[ut_log_syslog_notice] PASSED test/py/tests/test_ut.py::test_ut[ut_log_syslog_warning] PASSED The nolog tests are only executed if CONFIG_LOG=n and CONFIG_CONSOLE_RECORD=y. Reported-by: Simon Glass Signed-off-by: Heinrich Schuchardt --- test/log/nolog_test.c | 24 ++++++++++++------------ test/log/syslog_test.c | 48 ++++++++++++++++++++++++------------------------ 2 files changed, 36 insertions(+), 36 deletions(-) (limited to 'test') diff --git a/test/log/nolog_test.c b/test/log/nolog_test.c index 84619521c9..c418ed07c9 100644 --- a/test/log/nolog_test.c +++ b/test/log/nolog_test.c @@ -19,7 +19,7 @@ DECLARE_GLOBAL_DATA_PTR; #define BUFFSIZE 32 -static int nolog_test_log_err(struct unit_test_state *uts) +static int log_test_nolog_err(struct unit_test_state *uts) { char buf[BUFFSIZE]; @@ -31,9 +31,9 @@ static int nolog_test_log_err(struct unit_test_state *uts) ut_assertok(ut_check_console_end(uts)); return 0; } -LOG_TEST(nolog_test_log_err); +LOG_TEST(log_test_nolog_err); -static int nolog_test_log_warning(struct unit_test_state *uts) +static int log_test_nolog_warning(struct unit_test_state *uts) { char buf[BUFFSIZE]; @@ -45,9 +45,9 @@ static int nolog_test_log_warning(struct unit_test_state *uts) ut_assertok(ut_check_console_end(uts)); return 0; } -LOG_TEST(nolog_test_log_warning); +LOG_TEST(log_test_nolog_warning); -static int nolog_test_log_notice(struct unit_test_state *uts) +static int log_test_nolog_notice(struct unit_test_state *uts) { char buf[BUFFSIZE]; @@ -59,9 +59,9 @@ static int nolog_test_log_notice(struct unit_test_state *uts) ut_assertok(ut_check_console_end(uts)); return 0; } -LOG_TEST(nolog_test_log_notice); +LOG_TEST(log_test_nolog_notice); -static int nolog_test_log_info(struct unit_test_state *uts) +static int log_test_nolog_info(struct unit_test_state *uts) { char buf[BUFFSIZE]; @@ -73,7 +73,7 @@ static int nolog_test_log_info(struct unit_test_state *uts) ut_assertok(ut_check_console_end(uts)); return 0; } -LOG_TEST(nolog_test_log_info); +LOG_TEST(log_test_nolog_info); #undef _DEBUG #define _DEBUG 0 @@ -90,7 +90,7 @@ static int nolog_test_nodebug(struct unit_test_state *uts) } LOG_TEST(nolog_test_nodebug); -static int nolog_test_log_nodebug(struct unit_test_state *uts) +static int log_test_nolog_nodebug(struct unit_test_state *uts) { char buf[BUFFSIZE]; @@ -102,7 +102,7 @@ static int nolog_test_log_nodebug(struct unit_test_state *uts) ut_assertok(ut_check_console_end(uts)); return 0; } -LOG_TEST(nolog_test_log_nodebug); +LOG_TEST(log_test_nolog_nodebug); #undef _DEBUG #define _DEBUG 1 @@ -120,7 +120,7 @@ static int nolog_test_debug(struct unit_test_state *uts) } LOG_TEST(nolog_test_debug); -static int nolog_test_log_debug(struct unit_test_state *uts) +static int log_test_nolog_debug(struct unit_test_state *uts) { char buf[BUFFSIZE]; @@ -132,4 +132,4 @@ static int nolog_test_log_debug(struct unit_test_state *uts) ut_assertok(ut_check_console_end(uts)); return 0; } -LOG_TEST(nolog_test_log_debug); +LOG_TEST(log_test_nolog_debug); diff --git a/test/log/syslog_test.c b/test/log/syslog_test.c index 6ca5760eac..26536ebca7 100644 --- a/test/log/syslog_test.c +++ b/test/log/syslog_test.c @@ -92,12 +92,12 @@ static int sb_log_tx_handler(struct udevice *dev, void *packet, } /** - * syslog_test_log_err() - test log_err() function + * log_test_syslog_err() - test log_err() function * * @uts: unit test state * Return: 0 = success */ -static int syslog_test_log_err(struct unit_test_state *uts) +static int log_test_syslog_err(struct unit_test_state *uts) { int old_log_level = gd->default_log_level; struct sb_log_env env; @@ -106,7 +106,7 @@ static int syslog_test_log_err(struct unit_test_state *uts) gd->default_log_level = LOGL_INFO; env_set("ethact", "eth@10002000"); env_set("log_hostname", "sandbox"); - env.expected = "<3>sandbox uboot: syslog_test_log_err() " + env.expected = "<3>sandbox uboot: log_test_syslog_err() " "testing log_err\n"; env.uts = uts; sandbox_eth_set_tx_handler(0, sb_log_tx_handler); @@ -119,15 +119,15 @@ static int syslog_test_log_err(struct unit_test_state *uts) return 0; } -LOG_TEST(syslog_test_log_err); +LOG_TEST(log_test_syslog_err); /** - * syslog_test_log_warning() - test log_warning() function + * log_test_syslog_warning() - test log_warning() function * * @uts: unit test state * Return: 0 = success */ -static int syslog_test_log_warning(struct unit_test_state *uts) +static int log_test_syslog_warning(struct unit_test_state *uts) { int old_log_level = gd->default_log_level; struct sb_log_env env; @@ -136,7 +136,7 @@ static int syslog_test_log_warning(struct unit_test_state *uts) gd->default_log_level = LOGL_INFO; env_set("ethact", "eth@10002000"); env_set("log_hostname", "sandbox"); - env.expected = "<4>sandbox uboot: syslog_test_log_warning() " + env.expected = "<4>sandbox uboot: log_test_syslog_warning() " "testing log_warning\n"; env.uts = uts; sandbox_eth_set_tx_handler(0, sb_log_tx_handler); @@ -150,15 +150,15 @@ static int syslog_test_log_warning(struct unit_test_state *uts) return 0; } -LOG_TEST(syslog_test_log_warning); +LOG_TEST(log_test_syslog_warning); /** - * syslog_test_log_notice() - test log_notice() function + * log_test_syslog_notice() - test log_notice() function * * @uts: unit test state * Return: 0 = success */ -static int syslog_test_log_notice(struct unit_test_state *uts) +static int log_test_syslog_notice(struct unit_test_state *uts) { int old_log_level = gd->default_log_level; struct sb_log_env env; @@ -167,7 +167,7 @@ static int syslog_test_log_notice(struct unit_test_state *uts) gd->default_log_level = LOGL_INFO; env_set("ethact", "eth@10002000"); env_set("log_hostname", "sandbox"); - env.expected = "<5>sandbox uboot: syslog_test_log_notice() " + env.expected = "<5>sandbox uboot: log_test_syslog_notice() " "testing log_notice\n"; env.uts = uts; sandbox_eth_set_tx_handler(0, sb_log_tx_handler); @@ -181,15 +181,15 @@ static int syslog_test_log_notice(struct unit_test_state *uts) return 0; } -LOG_TEST(syslog_test_log_notice); +LOG_TEST(log_test_syslog_notice); /** - * syslog_test_log_info() - test log_info() function + * log_test_syslog_info() - test log_info() function * * @uts: unit test state * Return: 0 = success */ -static int syslog_test_log_info(struct unit_test_state *uts) +static int log_test_syslog_info(struct unit_test_state *uts) { int old_log_level = gd->default_log_level; struct sb_log_env env; @@ -198,7 +198,7 @@ static int syslog_test_log_info(struct unit_test_state *uts) gd->default_log_level = LOGL_INFO; env_set("ethact", "eth@10002000"); env_set("log_hostname", "sandbox"); - env.expected = "<6>sandbox uboot: syslog_test_log_info() " + env.expected = "<6>sandbox uboot: log_test_syslog_info() " "testing log_info\n"; env.uts = uts; sandbox_eth_set_tx_handler(0, sb_log_tx_handler); @@ -212,15 +212,15 @@ static int syslog_test_log_info(struct unit_test_state *uts) return 0; } -LOG_TEST(syslog_test_log_info); +LOG_TEST(log_test_syslog_info); /** - * syslog_test_log_debug() - test log_debug() function + * log_test_syslog_debug() - test log_debug() function * * @uts: unit test state * Return: 0 = success */ -static int syslog_test_log_debug(struct unit_test_state *uts) +static int log_test_syslog_debug(struct unit_test_state *uts) { int old_log_level = gd->default_log_level; struct sb_log_env env; @@ -229,7 +229,7 @@ static int syslog_test_log_debug(struct unit_test_state *uts) gd->default_log_level = LOGL_DEBUG; env_set("ethact", "eth@10002000"); env_set("log_hostname", "sandbox"); - env.expected = "<7>sandbox uboot: syslog_test_log_debug() " + env.expected = "<7>sandbox uboot: log_test_syslog_debug() " "testing log_debug\n"; env.uts = uts; sandbox_eth_set_tx_handler(0, sb_log_tx_handler); @@ -243,10 +243,10 @@ static int syslog_test_log_debug(struct unit_test_state *uts) return 0; } -LOG_TEST(syslog_test_log_debug); +LOG_TEST(log_test_syslog_debug); /** - * syslog_test_log_nodebug() - test logging level filter + * log_test_syslog_nodebug() - test logging level filter * * Verify that log_debug() does not lead to a log message if the logging level * is set to LOGL_INFO. @@ -254,7 +254,7 @@ LOG_TEST(syslog_test_log_debug); * @uts: unit test state * Return: 0 = success */ -static int syslog_test_log_nodebug(struct unit_test_state *uts) +static int log_test_syslog_nodebug(struct unit_test_state *uts) { int old_log_level = gd->default_log_level; struct sb_log_env env; @@ -263,7 +263,7 @@ static int syslog_test_log_nodebug(struct unit_test_state *uts) gd->default_log_level = LOGL_INFO; env_set("ethact", "eth@10002000"); env_set("log_hostname", "sandbox"); - env.expected = "<7>sandbox uboot: syslog_test_log_nodebug() " + env.expected = "<7>sandbox uboot: log_test_syslog_nodebug() " "testing log_debug\n"; env.uts = uts; sandbox_eth_set_tx_handler(0, sb_log_tx_handler); @@ -277,4 +277,4 @@ static int syslog_test_log_nodebug(struct unit_test_state *uts) return 0; } -LOG_TEST(syslog_test_log_nodebug); +LOG_TEST(log_test_syslog_nodebug); -- cgit v1.2.3