The Open Group Base Specifications Issue 7
IEEE Std 1003.1-2008, 2016 Edition
Copyright © 2001-2016 The IEEE and The Open Group

NAME

encrypt - encoding function (CRYPT)

SYNOPSIS

[XSI] [Option Start] #include <unistd.h>

void encrypt(char
block[64], int edflag); [Option End]

DESCRIPTION

The encrypt() function shall provide access to an implementation-defined encoding algorithm. The key generated by setkey() is used to encrypt the string block with encrypt().

The block argument to encrypt() shall be an array of length 64 bytes containing only the bytes with values of 0 and 1. The array is modified in place to a similar array using the key set by setkey(). If edflag is 0, the argument is encoded. If edflag is 1, the argument may be decoded (see the APPLICATION USAGE section); if the argument is not decoded, errno shall be set to [ENOSYS].

The encrypt() function shall not change the setting of errno if successful. An application wishing to check for error situations should set errno to 0 before calling encrypt(). If errno is non-zero on return, an error has occurred.

The encrypt() function need not be thread-safe.

RETURN VALUE

The encrypt() function shall not return a value.

ERRORS

The encrypt() function shall fail if:

[ENOSYS]
The functionality is not supported on this implementation.

The following sections are informative.

EXAMPLES

None.

APPLICATION USAGE

Historical implementations of the encrypt() function used a rather primitive encoding algorithm.

In some environments, decoding might not be implemented. This is related to some Government restrictions on encryption and decryption routines. Historical practice has been to ship a different version of the encryption library without the decryption feature in the routines supplied. Thus the exported version of encrypt() does encoding but not decoding.

RATIONALE

None.

FUTURE DIRECTIONS

A future version of the standard may mark this interface as obsolete or remove it altogether.

SEE ALSO

crypt, setkey

XBD <unistd.h>

CHANGE HISTORY

First released in Issue 1. Derived from Issue 1 of the SVID.

Issue 5

A note indicating that this function need not be reentrant is added to the DESCRIPTION.

Issue 6

In the DESCRIPTION, the note about reentrancy is expanded to cover thread-safety.

Issue 7

Austin Group Interpretation 1003.1-2001 #156 is applied.

POSIX.1-2008, Technical Corrigendum 2, XSH/TC2-2008/0085 [899] is applied.

End of informative text.

 

return to top of page

UNIX ® is a registered Trademark of The Open Group.
POSIX ® is a registered Trademark of The IEEE.
Copyright © 2001-2016 The IEEE and The Open Group, All Rights Reserved
[ Main Index | XBD | XSH | XCU | XRAT ]