Bug 195010 - [crypto] sha1 authentication has problem with byte order assumption
Summary: [crypto] sha1 authentication has problem with byte order assumption
Status: Closed Not A Bug
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 9.1-RELEASE
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-11-14 15:38 UTC by bettina
Modified: 2015-07-02 11:17 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description bettina 2014-11-14 15:38:57 UTC
sys/crypto/sha1.c is missing the include file of sys/endian.h so the check like the following won't work. And since unsupported is not defined any check of BYTE_ORDR following this always evaluate to true. See sha1_step and sha1_result for the reference of BYTE_ORDER. Problem occurs when communicating to non-BSD system. 

/* sanity check */
#if BYTE_ORDER != BIG_ENDIAN
# if BYTE_ORDER != LITTLE_ENDIAN
#  define unsupported 1
# endif
#endif
Comment 1 Christian Brueffer freebsd_committer freebsd_triage 2015-07-01 18:40:40 UTC
From what it looks like, endian.h is included through other headers (e.g., types.h which includes machine/endian.h, which ultimately defined the endianess macros used here), so this shouldn't be an issue.

Could you elaborate on what kind of communication issues with non-BSD systems you are seeing?  Are you referring to IPsec use, or something else?

If you provide more details, maybe we can help you diagnose the problem you're seeing.
Comment 2 bettina 2015-07-02 11:13:51 UTC
Thanks for the information. The system where the BSD code is ported does not have endian.h in sys/types.h.  We already took care of the problem.   Consider this not-a-bug.  Thanks!
Comment 3 Christian Brueffer freebsd_committer freebsd_triage 2015-07-02 11:17:29 UTC
Thanks for the update, that explains it.  Sorry for the long reaction time to this report!