Bug 2162851 - Review Request: symcrypt - Cryptographic library
Summary: Review Request: symcrypt - Cryptographic library
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: Package Review
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Nobody's working on this, feel free to take it
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-01-21 13:23 UTC by Benson Muite
Modified: 2024-03-01 17:22 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Bug
Embargoed:


Attachments (Terms of Use)
Proposed change for a package (1.62 KB, patch)
2023-03-07 18:01 UTC, Petr Menšík
no flags Details | Diff
Include all headers patch (2.36 KB, patch)
2023-03-08 13:03 UTC, Petr Menšík
no flags Details | Diff

Description Benson Muite 2023-01-21 13:23:44 UTC
Spec URL: https://download.copr.fedorainfracloud.org/results/fed500/SymCrypt/fedora-rawhide-x86_64/05281093-SymCrypt/SymCrypt.spec
SRPM URL: https://download.copr.fedorainfracloud.org/results/fed500/SymCrypt/fedora-rawhide-x86_64/05281093-SymCrypt/SymCrypt-103.1.0-1.fc38.src.rpm

Description:
SymCrypt is the core cryptographic function library
currently used by Windows.

Fedora Account System Username: fed500

Comment 1 Petr Menšík 2023-02-07 20:45:07 UTC
The package seems fine. I would recommend moving headers into separate subdirectory and adding -I to flags on pkgconfig file. Those files have no direct relation to symcrypt. /usr/include/resource.h file look especially generic and unrelated. But it has no conflict AFAIK.

Another thing is Patch0 should be offered to upstream for inclusion. But it would have to be done a different way. Perhaps use CMake's find_library() macro and skip internal if found would be accepted. Then link to MR should be included above the patch tag.

I do not think CMAKE_BUILD_TYPE=Debug should be used for a Fedora package. RelWithDebInfo would be more appropriate. We want it optimized, just not stripped.

More important is not using Fedora's macros for cmake. Please use

- %cmake instead of cmake ..
- %cmake_build instead of make

It seems upstream does not provide install target, so %cmake_install cannot be used. Add install -p parameter to keep unmodified files stable at least.

Comment 2 Petr Menšík 2023-02-07 20:48:52 UTC
Package Review
==============

Legend:
[x] = Pass, [!] = Fail, [-] = Not applicable, [?] = Not evaluated
[ ] = Manual review needed



===== MUST items =====

C/C++:
[x]: Package does not contain kernel modules.
[x]: Package contains no static executables.
[x]: If your application is a C or C++ application you must list a
     BuildRequires against gcc, gcc-c++ or clang.
[x]: Header files in -devel subpackage, if present.
[x]: ldconfig not called in %post and %postun for Fedora 28 and later.
[x]: Package does not contain any libtool archives (.la)
[x]: Rpath absent or only used for internal libs.
[x]: Development (unversioned) .so files in -devel subpackage, if present.

Generic:
[x]: Package is licensed with an open-source compatible license and meets
     other legal requirements as defined in the legal section of Packaging
     Guidelines.
[x]: License field in the package spec file matches the actual license.
     Note: Checking patched sources after %prep for licenses. Licenses
     found: "Unknown or generated", "MIT License", "BSD 3-Clause License
     BSD 2-Clause License GNU General Public License", "BSD 2-Clause
     License". 101 files have unknown license. Detailed output of
     licensecheck in
     /home/pemensik/fedora/rawhide/2162851-SymCrypt/licensecheck.txt
[x]: License file installed when any subpackage combination is installed.
[x]: If the package is under multiple licenses, the licensing breakdown
     must be documented in the spec.
[x]: %build honors applicable compiler flags or justifies otherwise.
[x]: Package contains no bundled libraries without FPC exception.
[x]: Changelog in prescribed format.
[x]: Sources contain only permissible code or content.
[-]: Package contains desktop file if it is a GUI application.
[x]: Development files must be in a -devel package
[x]: Package uses nothing in %doc for runtime.
[x]: Package consistently uses macros (instead of hard-coded directory
     names).
[x]: Package is named according to the Package Naming Guidelines.
[x]: Package does not generate any conflict.
[x]: Package obeys FHS, except libexecdir and /usr/target.
[-]: If the package is a rename of another package, proper Obsoletes and
     Provides are present.
[x]: Requires correct, justified where necessary.
[x]: Spec file is legible and written in American English.
[-]: Package contains systemd file(s) if in need.
[x]: Useful -debuginfo package or justification otherwise.
[x]: Package is not known to require an ExcludeArch tag.
[x]: Large documentation must go in a -doc subpackage. Large could be size
     (~1MB) or number of files.
     Note: Documentation size is 20480 bytes in 2 files.
[x]: Package complies to the Packaging Guidelines
[x]: Package successfully compiles and builds into binary rpms on at least
     one supported primary architecture.
[x]: Package installs properly.
[x]: Rpmlint is run on all rpms the build produces.
     Note: There are rpmlint messages (see attachment).
[x]: If (and only if) the source package includes the text of the
     license(s) in its own file, then that file, containing the text of the
     license(s) for the package is included in %license.
[x]: Package requires other packages for directories it uses.
[x]: Package must own all directories that it creates.
[x]: Package does not own files or directories owned by other packages.
[x]: Package uses either %{buildroot} or $RPM_BUILD_ROOT
[x]: Package does not run rm -rf %{buildroot} (or $RPM_BUILD_ROOT) at the
     beginning of %install.
[x]: Macros in Summary, %description expandable at SRPM build time.
[x]: Dist tag is present.
[x]: Package does not contain duplicates in %files.
[x]: Permissions on files are set properly.
[x]: Package must not depend on deprecated() packages.
[x]: Package use %makeinstall only when make install DESTDIR=... doesn't
     work.
[x]: Package is named using only allowed ASCII characters.
[x]: Package does not use a name that already exists.
[x]: Package is not relocatable.
[x]: Sources used to build the package match the upstream source, as
     provided in the spec URL.
[x]: Spec file name must match the spec package %{name}, in the format
     %{name}.spec.
[x]: File names are valid UTF-8.
[x]: Packages must not store files under /srv, /opt or /usr/local

===== SHOULD items =====

Generic:
[!]: Uses parallel make %{?_smp_mflags} macro.
[-]: If the source package does not include license text(s) as a separate
     file from upstream, the packager SHOULD query upstream to include it.
[x]: Final provides and requires are sane (see attachments).
[?]: Package functions as described.
[x]: Latest version is packaged.
[x]: Package does not include license text files separate from upstream.
[!]: Patches link to upstream bugs/comments/lists or are otherwise
     justified.
[-]: Sources are verified with gpgverify first in %prep if upstream
     publishes signatures.
     Note: gpgverify is not used.
[x]: %check is present and all tests pass.
[!]: Packages should try to preserve timestamps of original installed
     files.
[x]: Reviewer should test that the package builds in mock.
[x]: Buildroot is not present
[x]: Package has no %clean section with rm -rf %{buildroot} (or
     $RPM_BUILD_ROOT)
[x]: No file requires outside of /etc, /bin, /sbin, /usr/bin, /usr/sbin.
[x]: Fully versioned dependency in subpackages if applicable.
[x]: Packager, Vendor, PreReq, Copyright tags should not be in spec file
[x]: The placement of pkgconfig(.pc) files are correct.
[x]: Sources can be downloaded from URI in Source: tag
[x]: SourceX is a working URL.
[!]: Package should compile and build into binary rpms on all supported
     architectures.
[x]: Spec use %global instead of %define unless justified.

===== EXTRA items =====

Generic:
[x]: Rpmlint is run on debuginfo package(s).
     Note: There are rpmlint messages (see attachment).
[x]: Rpmlint is run on all installed packages.
     Note: There are rpmlint messages (see attachment).
[x]: Large data in /usr/share should live in a noarch subpackage if package
     is arched.
[x]: Spec file according to URL is the same as in SRPM.


Rpmlint
-------
Checking: SymCrypt-103.1.0-1.fc38.x86_64.rpm
          SymCrypt-devel-103.1.0-1.fc38.x86_64.rpm
          SymCrypt-debuginfo-103.1.0-1.fc38.x86_64.rpm
          SymCrypt-debugsource-103.1.0-1.fc38.x86_64.rpm
          SymCrypt-103.1.0-1.fc38.src.rpm
============================================================= rpmlint session starts =============================================================
rpmlint: 2.4.0
configuration:
    /usr/lib/python3.11/site-packages/rpmlint/configdefaults.toml
    /etc/xdg/rpmlint/fedora-legacy-licenses.toml
    /etc/xdg/rpmlint/fedora-spdx-licenses.toml
    /etc/xdg/rpmlint/fedora.toml
    /etc/xdg/rpmlint/scoring.toml
    /etc/xdg/rpmlint/users-groups.toml
    /etc/xdg/rpmlint/warn-on-functions.toml
rpmlintrc: [PosixPath('/tmp/tmpljnant9k')]
checks: 31, packages: 5

SymCrypt-devel.x86_64: E: no-ldconfig-symlink /usr/lib64/libsymcrypt.so
SymCrypt-devel.x86_64: W: no-documentation
SymCrypt.x86_64: W: library-not-linked-against-libc /usr/lib64/libsymcrypt.so.103.1.0
SymCrypt-devel.x86_64: W: library-not-linked-against-libc /usr/lib64/libsymcrypt.so
SymCrypt-debuginfo.x86_64: E: files-duplicated-waste 1315680
============================== 5 packages and 0 specfiles checked; 2 errors, 3 warnings, 2 badness; has taken 0.8 s ==============================




Rpmlint (debuginfo)
-------------------
Checking: SymCrypt-devel-debuginfo-103.1.0-1.fc38.x86_64.rpm
          SymCrypt-debuginfo-103.1.0-1.fc38.x86_64.rpm
============================================================= rpmlint session starts =============================================================
rpmlint: 2.4.0
configuration:
    /usr/lib/python3.11/site-packages/rpmlint/configdefaults.toml
    /etc/xdg/rpmlint/fedora-legacy-licenses.toml
    /etc/xdg/rpmlint/fedora-spdx-licenses.toml
    /etc/xdg/rpmlint/fedora.toml
    /etc/xdg/rpmlint/scoring.toml
    /etc/xdg/rpmlint/users-groups.toml
    /etc/xdg/rpmlint/warn-on-functions.toml
rpmlintrc: [PosixPath('/tmp/tmppqlrbmf9')]
checks: 31, packages: 2

SymCrypt-debuginfo.x86_64: E: files-duplicated-waste 1315680
============================== 2 packages and 0 specfiles checked; 1 errors, 0 warnings, 1 badness; has taken 0.3 s ==============================





Rpmlint (installed packages)
----------------------------
============================ rpmlint session starts ============================
rpmlint: 2.4.0
configuration:
    /usr/lib/python3.11/site-packages/rpmlint/configdefaults.toml
    /etc/xdg/rpmlint/fedora-legacy-licenses.toml
    /etc/xdg/rpmlint/fedora-spdx-licenses.toml
    /etc/xdg/rpmlint/fedora.toml
    /etc/xdg/rpmlint/scoring.toml
    /etc/xdg/rpmlint/users-groups.toml
    /etc/xdg/rpmlint/warn-on-functions.toml
checks: 31, packages: 5

SymCrypt-devel.x86_64: E: no-ldconfig-symlink /usr/lib64/libsymcrypt.so
SymCrypt-devel.x86_64: W: no-documentation
SymCrypt-devel.x86_64: W: library-not-linked-against-libc /usr/lib64/libsymcrypt.so
SymCrypt.x86_64: W: library-not-linked-against-libc /usr/lib64/libsymcrypt.so.103.1.0
SymCrypt-debuginfo.x86_64: E: files-duplicated-waste 1315680
 5 packages and 0 specfiles checked; 2 errors, 3 warnings, 2 badness; has taken 1.1 s 



Source checksums
----------------
https://github.com/microsoft/SymCrypt/archive/refs/tags/v103.1.0.tar.gz :
  CHECKSUM(SHA256) this package     : 4abc78a99bd3fdbdc5dd4e4a652c4193e9d52c3082a551d0ef6b4275b0e09314
  CHECKSUM(SHA256) upstream package : 4abc78a99bd3fdbdc5dd4e4a652c4193e9d52c3082a551d0ef6b4275b0e09314


Requires
--------
SymCrypt (rpmlib, GLIBC filtered):
    libjitterentropy.so.3()(64bit)
    rtld(GNU_HASH)

SymCrypt-devel (rpmlib, GLIBC filtered):
    /usr/bin/pkg-config
    SymCrypt(x86-64)
    libjitterentropy.so.3()(64bit)
    rtld(GNU_HASH)

SymCrypt-debuginfo (rpmlib, GLIBC filtered):

SymCrypt-debugsource (rpmlib, GLIBC filtered):



Provides
--------
SymCrypt:
    SymCrypt
    SymCrypt(x86-64)
    libsymcrypt.so.103()(64bit)
    libsymcrypt.so.103(VERSION_101.0)(64bit)
    libsymcrypt.so.103(VERSION_101.2)(64bit)
    libsymcrypt.so.103(VERSION_102.0)(64bit)
    libsymcrypt.so.103(VERSION_103.0)(64bit)
    libsymcrypt.so.103(VERSION_103.1)(64bit)

SymCrypt-devel:
    SymCrypt-devel
    SymCrypt-devel(x86-64)
    libsymcrypt.so.103()(64bit)
    libsymcrypt.so.103(VERSION_101.0)(64bit)
    libsymcrypt.so.103(VERSION_101.2)(64bit)
    libsymcrypt.so.103(VERSION_102.0)(64bit)
    libsymcrypt.so.103(VERSION_103.0)(64bit)
    libsymcrypt.so.103(VERSION_103.1)(64bit)
    pkgconfig(symcrypt)

SymCrypt-debuginfo:
    SymCrypt-debuginfo
    SymCrypt-debuginfo(x86-64)
    debuginfo(build-id)
    libsymcrypt.so.103-103.1.0-1.fc38.x86_64.debug()(64bit)
    libsymcrypt.so.103.1.0-103.1.0-1.fc38.x86_64.debug()(64bit)

SymCrypt-debugsource:
    SymCrypt-debugsource
    SymCrypt-debugsource(x86-64)



Generated by fedora-review 0.9.0 (6761b6c) last change: 2022-08-23
Command line :/usr/bin/fedora-review -b 2162851
Buildroot used: fedora-rawhide-x86_64
Active plugins: Generic, Shell-api, C/C++
Disabled plugins: fonts, Ocaml, Perl, PHP, SugarActivity, Haskell, R, Python, Java
Disabled flags: EPEL6, EPEL7, DISTTAG, BATCH, EXARCH

Comment 3 Petr Menšík 2023-02-07 20:54:26 UTC
Recommendation from comment #1 still applies, but found only SHOULD issues to solve. Accepting the review, thank you for the package!

Comment 4 Fedora Admin user for bugzilla script actions 2023-02-15 13:55:05 UTC
The Pagure repository was created at https://src.fedoraproject.org/rpms/symcrypt

Comment 5 Petr Menšík 2023-03-07 18:01:09 UTC
Created attachment 1948770 [details]
Proposed change for a package

Current package does not use %cmake macro with additional parameters passed by build system. It includes prefix parameter for example, which is contained in pkg-config file.

I suggest some changes to the current spec. First make it possible to skip checks. Use %cmake_build for multithread building. Also run %cmake_install, even though it does not seem to help now.

Comment 6 Benson Muite 2023-03-08 10:58:13 UTC
Thanks. Made most of the updates. Getting following from fedora-review on AArch64, see 
https://copr.fedorainfracloud.org/coprs/fed500/SymCrypt/build/5612997/

SymCrypt.aarch64: E: undefined-non-weak-symbol /usr/lib64/libsymcrypt.so.103.1.0 __aarch64_ldset4_relax	(/usr/lib64/libsymcrypt.so.103.1.0)
SymCrypt.aarch64: E: undefined-non-weak-symbol /usr/lib64/libsymcrypt.so.103.1.0 __aarch64_ldadd8_relax	(/usr/lib64/libsymcrypt.so.103.1.0)
SymCrypt-devel.aarch64: E: no-ldconfig-symlink /usr/lib64/libsymcrypt.so
SymCrypt-devel.aarch64: W: no-documentation
SymCrypt-devel.aarch64: W: library-not-linked-against-libc /usr/lib64/libsymcrypt.so
SymCrypt.aarch64: W: library-not-linked-against-libc /usr/lib64/libsymcrypt.so.103.1.0
SymCrypt-debuginfo.aarch64: E: files-duplicated-waste 1445656
SymCrypt-devel.aarch64: E: double-slash-in-pkgconfig-path /usr/lib64/pkgconfig/symcrypt.pc includedir=${prefix}//usr/include/symcrypt

Once have resolved, will upload to the repo.

Comment 7 Petr Menšík 2023-03-08 12:37:32 UTC
Oh, found created SymCrypt-devel package is not usable. It is missing main symcrypt.h header and its dependencies. It seems those headers should go into subdirectory, because they need a lot of files with names unrelated to the package.

Tried to use it for building SymCrypt-OpenSSL, but found there are missing headers in it.

Comment 8 Petr Menšík 2023-03-08 13:03:56 UTC
Created attachment 1949025 [details]
Include all headers patch

Additional change on top of previous. Make devel require pkgconfig to own %_libdir/pkgconfig directory. And include also static headers from source dir into headers, making them hopefully usable. Because there are quite a lot required local files, move headers into %_includedir/SymCrypt subdirectory. Should provide working pkg-config including those paths.

Comment 9 Benson Muite 2023-03-08 18:28:55 UTC
Thanks for updated patch. May need to explicitly link glibc:
https://download.copr.fedorainfracloud.org/results/fed500/SymCrypt/fedora-rawhide-aarch64/05615546-SymCrypt/fedora-review/review.txt

Comment 10 Petr Menšík 2023-03-10 18:01:45 UTC
I have borrowed an aarch64 machine and tested installing the built package. It is linked to glibc, at least it reports so:

# ls -l /usr/lib64/libsymcrypt.so*
-rwxr-xr-x. 1 root root 404040 Mar 10 11:24 /usr/lib64/libsymcrypt.so
-rwxr-xr-x. 1 root root 404040 Mar 10 11:24 /usr/lib64/libsymcrypt.so.103
-rwxr-xr-x. 1 root root 404048 Mar 10 11:24 /usr/lib64/libsymcrypt.so.103.1.0
# ldd /usr/lib64/libsymcrypt.so 
	linux-vdso.so.1 (0x0000ffff9150a000)
	libjitterentropy.so.3 => /lib64/libjitterentropy.so.3 (0x0000ffff91420000)
	libc.so.6 => /lib64/libc.so.6 (0x0000ffff91260000)
	/lib/ld-linux-aarch64.so.1 (0x0000ffff914cd000)

# rpmlint /root/SymCrypt/rpm/fedora/aarch64/SymCrypt-devel-103.1.0-2.fc37.aarch64.rpm 
======================================================================================= rpmlint session starts ======================================================================================
rpmlint: 2.4.0
configuration:
    /usr/lib/python3.11/site-packages/rpmlint/configdefaults.toml
    /etc/xdg/rpmlint/fedora-legacy-licenses.toml
    /etc/xdg/rpmlint/fedora-spdx-licenses.toml
    /etc/xdg/rpmlint/fedora.toml
    /etc/xdg/rpmlint/scoring.toml
    /etc/xdg/rpmlint/users-groups.toml
    /etc/xdg/rpmlint/warn-on-functions.toml
checks: 31, packages: 1

SymCrypt-devel.aarch64: E: no-ldconfig-symlink /usr/lib64/libsymcrypt.so
SymCrypt-devel.aarch64: W: no-documentation
SymCrypt-devel.aarch64: W: library-not-linked-against-libc /usr/lib64/libsymcrypt.so

Those are reported on my builds, but yours are not so different:
# ls -l /usr/lib64/libsymcrypt.so*
-rwxr-xr-x. 1 root root 469704 Mar  7 19:00 /usr/lib64/libsymcrypt.so
lrwxrwxrwx. 1 root root     22 Mar  7 19:00 /usr/lib64/libsymcrypt.so.103 -> libsymcrypt.so.103.1.0
-rwxr-xr-x. 1 root root 469712 Mar  7 19:00 /usr/lib64/libsymcrypt.so.103.1.0

I think the libsymcrypt.so should be made symlink to libsymcrypt.so.103, not a copy. That is a problem to be solved.
But they reference at least libc.so.6, so that is probably some mis-detection. Not sure why.

But readelf is missing libc reference:
# readelf -ds /usr/lib64/libsymcrypt.so | head

Dynamic section at offset 0x6f580 contains 27 entries:
  Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)             Shared library: [libjitterentropy.so.3]
 0x000000000000000e (SONAME)             Library soname: [libsymcrypt.so.103]
 0x0000000000000010 (SYMBOLIC)           0x0
 0x0000000000000019 (INIT_ARRAY)         0x7e788
 0x000000000000001b (INIT_ARRAYSZ)       8 (bytes)
 0x000000000000001a (FINI_ARRAY)         0x7e790
 0x000000000000001c (FINI_ARRAYSZ)       8 (bytes)

It is the same on x86_64 build. Other libraries contain also Shared library: [libc.so.6]. Something should be tuned in the build system I guess.

Comment 11 Petr Menšík 2023-03-10 20:39:40 UTC
Btw created my own testing builds here:
https://copr.fedorainfracloud.org/coprs/pemensik/symcrypt/

I have prepared also SymCrypt-OpenSSL package to do some testing. I don't want to maintain it, so I won't start my review of it. But if someone wants to use it, be my guest.
My specs:
https://github.com/pemensik/SymCrypt/tree/fedora/rpm/fedora
https://github.com/pemensik/SymCrypt-OpenSSL/tree/fedora

Comment 12 Petr Menšík 2023-03-28 09:40:30 UTC
I have started looking into Symcrypt library because of bug #2161326, which requested fixing bind libraries when running with engine using this library. I think it is just Symcrypt which needs fixing in this case. Applications running just fine with OpenSSL default engine will crash in some cases. It might be fine for applications allocating all intermediate crypto state structures on heap and aligned to 16B. But Symcrypt-OpeSSL is not ready as a whole system replacement of default crypto engine in my opinion.

Reported the issue upstream, without good resolution so far:
https://github.com/microsoft/SymCrypt-OpenSSL/issues/59

Comment 13 Petr Menšík 2023-11-09 15:04:44 UTC
Stepping out of the review, although it seems ready. Ping me to reverify.

Comment 14 Xavier Bachelot 2024-03-01 17:22:34 UTC
awilliam


Note You need to log in before you can comment on or make changes to this bug.