Bug 1375180

Summary: CryptoPP::CMAC_Base::Update assert failed with tegrarcm
Product: [Fedora] Fedora Reporter: Nicolas Chauvet (kwizart) <kwizart>
Component: cryptoppAssignee: nucleo <alekcejk>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 28CC: alekcejk, dennis, ebenard, mstevens, pwhalen
Target Milestone: ---Keywords: Reopened
Target Release: ---Flags: pwhalen: needinfo? (alekcejk)
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: cryptopp-5.6.5-2.fc27 cryptopp-5.6.5-2.fc26 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-03-06 17:21:15 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Bug Depends On:    
Bug Blocks: 245418    

Description Nicolas Chauvet (kwizart) 2016-09-12 12:06:33 UTC
Description of problem:

Using the following command in tegrarcm (which use system cryptopp):

$ tegrarcm --bct trimslice-spi.bct  --bootloader u-boot.bin --loadaddr=0x00108000
bct file: trimslice-spi.bct
booloader file: u-boot.bin
load addr 0x108000
entry addr 0x108000
device id: 0x7820
uid:  0x0288500343609257
tegrarcm: cmac.cpp:60: virtual void CryptoPP::CMAC_Base::Update(const byte*, size_t): Assertion `(input && length) || !(input || length)' failed.
Aborted



Version-Release number of selected component (if applicable):
cryptopp-5.6.3-4.fc24 ( Last time I've checked, this worked with the version in fedora 22 with the same tegrarcm code base).

How reproducible:
always

Steps to Reproduce:
tegrarcm is very dependent on the ARM hardware connected, so it might not be easy to reproduce easily.


Actual results:
tegrarcm: cmac.cpp:60: virtual void CryptoPP::CMAC_Base::Update(const byte*, size_t): Assertion `(input && length) || !(input || length)' failed.
Aborted


Expected results:
Tegrarcm should upload the firmware to the device without issue.

Additional info:
tegrarcm doesn't call Update directly, so it sounds like the failed assert is in the cryptopp code base.

(will look into cryptopp 3.6.4 once available).

Comment 1 Nicolas Chauvet (kwizart) 2016-09-12 14:35:56 UTC
downgrading to 3.6.2 worked from:
http://koji.fedoraproject.org/koji/buildinfo?buildID=696888

Comment 2 Eric BENARD 2016-09-20 07:40:35 UTC
The problem comes from the addition of asserts in 3.6.3 in the code which are supposed to be used only during development and debug.
They are enabled when -DDEBUG is defined (which seems to be the case in redhat/fedora) and now the documentation clearly states that -DNDEBUG must be used when packaging cryptopp :

README update here :
https://github.com/weidai11/cryptopp/commit/553049ba297d89d9e8fbf2204acb40a8a53f5cd6

More details here :
https://github.com/weidai11/cryptopp/issues/277

So the solution to this problem is to add -DNDEBUG in the CXXFLAGS

Comment 3 Nicolas Chauvet (kwizart) 2016-09-26 13:25:53 UTC
@eric
Thx for the links.
FYI fedora does not build with -DDEBUG (not even -DNDEBUG)

As you can see with the build.log
http://koji.fedoraproject.org/koji/buildinfo?buildID=785670
https://kojipkgs.fedoraproject.org//packages/cryptopp/5.6.3/5.fc26/data/logs/x86_64/build.log

Here are the current CFLAGS for x86_64:
$ rpm -E %{optflags}
-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic

So my understanding is that we need to enforce -DNDEBUG for building cryptopp.
I'm not sure to see where is is required (exept from the README). I only see that asserts are set if using -DDEBUG. But that was master branch, not the current branch.

Comment 4 Fedora Admin XMLRPC Client 2016-11-28 15:42:53 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 5 Nicolas Chauvet (kwizart) 2017-02-13 18:36:41 UTC
Seems something related to usb reset.
I cannot reproduce anymore using tegrarcm.

Comment 6 Dennis Gilmore 2017-03-14 20:47:39 UTC
reopening as I am hitting this on rawhide

Comment 7 Fedora End Of Life 2017-07-25 22:59:44 UTC
This message is a reminder that Fedora 24 is nearing its end of life.
Approximately 2 (two) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 24. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '24'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 24 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

Comment 8 Fedora End Of Life 2017-08-08 17:18:42 UTC
Fedora 24 changed to end-of-life (EOL) status on 2017-08-08. Fedora 24 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.

Comment 9 Paul Whalen 2017-08-15 20:13:35 UTC
This is still an issue in f26, reopening.

Comment 10 Nicolas Chauvet (kwizart) 2018-01-08 20:42:00 UTC
Yep cryptopp is still broken wrt tegrarcm usage.
I've built a vanilla cryptopp (using GNUMakefile) and everything is back to normal here.

Fedora scratch build yet:
https://koji.fedoraproject.org/koji/taskinfo?taskID=24083042
https://src.fedoraproject.org/rpms/cryptopp/pull-request/1

Comment 11 Fedora End Of Life 2018-02-20 15:29:47 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 28 development cycle.
Changing version to '28'.

Comment 12 Fedora Update System 2018-02-20 15:32:41 UTC
cryptopp-5.6.5-2.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2018-5a249b4214

Comment 13 Fedora Update System 2018-02-20 15:33:04 UTC
cryptopp-5.6.5-2.fc27 has been submitted as an update to Fedora 27. https://bodhi.fedoraproject.org/updates/FEDORA-2018-a0a356fb68

Comment 14 Fedora Update System 2018-02-20 17:50:45 UTC
cryptopp-5.6.5-2.fc26 has been pushed to the Fedora 26 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-5a249b4214

Comment 15 Fedora Update System 2018-02-21 17:16:59 UTC
cryptopp-5.6.5-2.fc27 has been pushed to the Fedora 27 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-a0a356fb68

Comment 16 Fedora Update System 2018-03-06 17:21:15 UTC
cryptopp-5.6.5-2.fc27 has been pushed to the Fedora 27 stable repository. If problems still persist, please make note of it in this bug report.

Comment 17 Fedora Update System 2018-03-20 17:27:45 UTC
cryptopp-5.6.5-2.fc26 has been pushed to the Fedora 26 stable repository. If problems still persist, please make note of it in this bug report.