API Functions of xf::security

adler32

adler32 overload (1)

#include "xf_security/adler32.hpp"
template <int W>
void adler32 (
    hls::stream <ap_uint <32>>& adlerStrm,
    hls::stream <ap_uint <W*8>>& inStrm,
    hls::stream <ap_uint <32>>& inLenStrm,
    hls::stream <bool>& endInLenStrm,
    hls::stream <ap_uint <32>>& outStrm,
    hls::stream <bool>& endOutStrm
    )

adler32 computes the Adler-32 checksum of an input data.

Parameters:

W byte number of input data, the value of W includes 1, 2, 4, 8, 16.
adlerStrm initialize adler32 value
inStrm messages to be checked
inLenStrm length of messages to be checked.
endInLenStrm end flag of inLenStrm
outStrm checksum result
end flag of outStrm

adler32 overload (2)

#include "xf_security/adler32.hpp"
template <int W>
void adler32 (
    hls::stream <ap_uint <32>>& adlerStrm,
    hls::stream <ap_uint <W*8>>& inStrm,
    hls::stream <ap_uint <7>>& inPackLenStrm,
    hls::stream <ap_uint <32>>& outStrm,
    hls::stream <bool>& endOutStrm
    )

adler32 computes the Adler-32 checksum of an input data.

Parameters:

W byte number of input data, the value of W includes 1, 2, 4, 8, 16.
adlerStrm initialize adler32 value
inStrm messages to be checked
inPackLenStrm effective length of each pack from inStrm. inPackLen.range(4,0) = effective len of pack, inPackLen.range(6,5) = 0x1 means end of one message, inPackLen.range(6,5) = 0x2 means end of all message. messages.
outStrm checksum result
end flag of outStrm

adler32 overload (3)

#include "xf_security/adler32.hpp"
template <int W>
void adler32 (
    hls::stream <ap_uint <32>>& adlerStrm,
    hls::stream <ap_uint <W*8>>& inStrm,
    hls::stream <ap_uint <5>>& inPackLenStrm,
    hls::stream <bool>& endInPackLenStrm,
    hls::stream <ap_uint <32>>& outStrm,
    hls::stream <bool>& endOutStrm
    )

adler32 computes the Adler-32 checksum of an input data.

Parameters:

W byte number of input data, the value of W includes 1, 2, 4, 8, 16.
adlerStrm initialize adler32 value
inStrm messages to be checked
inPackLenStrm effective length of each pack from inStrm, 1~W. 0 means end of message
endInPackLenStrm end flag of inPackLenStrm, 1 “false” for 1 message, 1 “true” means no message anymore.
outStrm checksum result
end flag of outStrm

blake2b

blake2b overload (1)

#include "xf_security/blake2b.hpp"
void blake2b (
    hls::stream <ap_uint <64>>& msg_strm,
    hls::stream <ap_uint <128>>& msg_len_strm,
    hls::stream <ap_uint <512>>& key_strm,
    hls::stream <ap_uint <8>>& key_len_strm,
    hls::stream <ap_uint <8>>& out_len_strm,
    hls::stream <bool>& end_len_strm,
    hls::stream <ap_uint <8*64>>& digest_strm,
    hls::stream <bool>& end_digest_strm
    )

Top function of BLAKE2B.

The algorithm reference is : “The BLAKE2 Cryptographic Hash and Message Authentication Code (MAC)”. The implementation dataflows the sub-modules.

Parameters:

msg_strm The message being hashed.
msg_len_strm Message length in byte (0 <= msg_len <= 2^128).
key_strm The optional key.
key_len_strm Key length in byte (0 <= key_len <= 64).
out_len_strm Result hash value length in byte (0 < out_len < 64).
end_len_strm The flag to signal end of input message stream.
digest_strm The digest (hash value) stream.
end_digest_strm Flag to signal the end of the result.

desCbcEncrypt

#include "xf_security/cbc.hpp"
static void desCbcEncrypt (
    hls::stream <ap_uint <64>>& plaintextStrm,
    hls::stream <bool>& endPlaintextStrm,
    hls::stream <ap_uint <64>>& cipherkeyStrm,
    hls::stream <ap_uint <64>>& IVStrm,
    hls::stream <ap_uint <64>>& ciphertextStrm,
    hls::stream <bool>& endCiphertextStrm
    )

desCbcEncrypt is CBC encryption mode with DES single block cipher.

The algorithm reference is : “Recommendation for Block Cipher Modes of Operation - Methods and Techniques” The implementation is modified for better performance.

Parameters:

plaintextStrm Input block stream text to be encrypted, each block is 64 bits.
endPlaintextStrm End flag of block stream plaintext, 1 bit.
cipherkeyStrm Input cipher key used in encryption, 64 bits for each key.
IVStrm Initialization vector for the fisrt iteration of DES encrypition, 64 bits.
ciphertextStrm Output encrypted block stream text, each block is 64 bits.
endCiphertextStrm End flag of block stream ciphertext, 1 bit.

desCbcDecrypt

#include "xf_security/cbc.hpp"
static void desCbcDecrypt (
    hls::stream <ap_uint <64>>& ciphertextStrm,
    hls::stream <bool>& endCiphertextStrm,
    hls::stream <ap_uint <64>>& cipherkeyStrm,
    hls::stream <ap_uint <64>>& IVStrm,
    hls::stream <ap_uint <64>>& plaintextStrm,
    hls::stream <bool>& endPlaintextStrm
    )

desCbcDecrypt is CBC decryption mode with DES single block cipher.

The algorithm reference is : “Recommendation for Block Cipher Modes of Operation - Methods and Techniques” The implementation is modified for better performance.

Parameters:

ciphertextStrm Input block stream text to be decrypted, each block is 64 bits.
endCiphertextStrm End flag of block stream ciphertext, 1 bit.
cipherkeyStrm Input cipher key used in decryption, 64 bits for each key.
IVStrm Initialization vector for the fisrt iteration of DES decrypition, 64 bits.
plaintextStrm Output decrypted block stream text, each block is 64 bits.
endPlaintextStrm End flag of block stream plaintext, 1 bit.

aes128CbcEncrypt

#include "xf_security/cbc.hpp"
static void aes128CbcEncrypt (
    hls::stream <ap_uint <128>>& plaintextStrm,
    hls::stream <bool>& endPlaintextStrm,
    hls::stream <ap_uint <128>>& cipherkeyStrm,
    hls::stream <ap_uint <128>>& IVStrm,
    hls::stream <ap_uint <128>>& ciphertextStrm,
    hls::stream <bool>& endCiphertextStrm
    )

aes128CbcEncrypt is CBC encryption mode with AES-128 single block cipher.

The algorithm reference is : “Recommendation for Block Cipher Modes of Operation - Methods and Techniques” The implementation is modified for better performance.

Parameters:

plaintextStrm Input block stream text to be encrypted, each text block is 128 bits.
endPlaintextStrm End flag of block stream plaintext, 1 bit.
cipherkeyStrm Input cipher key used in encryption, 128 bits.
IVStrm Initialization vector for the fisrt iteration of AES encrypition, 128 bits.
ciphertextStrm Output encrypted block stream text, each cipher block is 128 bits.
endCiphertextStrm End flag of block stream ciphertext, 1 bit.

aes128CbcDecrypt

#include "xf_security/cbc.hpp"
static void aes128CbcDecrypt (
    hls::stream <ap_uint <128>>& ciphertextStrm,
    hls::stream <bool>& endCiphertextStrm,
    hls::stream <ap_uint <128>>& cipherkeyStrm,
    hls::stream <ap_uint <128>>& IVStrm,
    hls::stream <ap_uint <128>>& plaintextStrm,
    hls::stream <bool>& endPlaintextStrm
    )

aes128CbcDecrypt is CBC decryption mode with AES-128 single block cipher.

The algorithm reference is : “Recommendation for Block Cipher Modes of Operation - Methods and Techniques” The implementation is modified for better performance.

Parameters:

ciphertextStrm Input block stream text to be decrypted, each block is 128 bits.
endCiphertextStrm End flag of block stream ciphertext, 1 bit.
cipherkeyStrm Input cipher key used in decryption, 128 bits.
IVStrm Initialization vector for the fisrt iteration of AES decrypition, 128 bits.
plaintextStrm Output decrypted block stream text, each block is 128 bits.
endPlaintextStrm End flag of block stream plaintext, 1 bit.

aes192CbcEncrypt

#include "xf_security/cbc.hpp"
static void aes192CbcEncrypt (
    hls::stream <ap_uint <128>>& plaintextStrm,
    hls::stream <bool>& endPlaintextStrm,
    hls::stream <ap_uint <192>>& cipherkeyStrm,
    hls::stream <ap_uint <128>>& IVStrm,
    hls::stream <ap_uint <128>>& ciphertextStrm,
    hls::stream <bool>& endCiphertextStrm
    )

aes192CbcEncrypt is CBC encryption mode with AES-192 single block cipher.

The algorithm reference is : “Recommendation for Block Cipher Modes of Operation - Methods and Techniques” The implementation is modified for better performance.

Parameters:

plaintextStrm Input block stream text to be encrypted, each text block is 128 bits.
endPlaintextStrm End flag of block stream plaintext, 1 bit.
cipherkeyStrm Input cipher key used in encryption, 192 bits.
IVStrm Initialization vector for the fisrt iteration of AES encrypition, 128 bits.
ciphertextStrm Output encrypted block stream text, each cipher block is 128 bits.
endCiphertextStrm End flag of block stream ciphertext, 1 bit.

aes192CbcDecrypt

#include "xf_security/cbc.hpp"
static void aes192CbcDecrypt (
    hls::stream <ap_uint <128>>& ciphertextStrm,
    hls::stream <bool>& endCiphertextStrm,
    hls::stream <ap_uint <192>>& cipherkeyStrm,
    hls::stream <ap_uint <128>>& IVStrm,
    hls::stream <ap_uint <128>>& plaintextStrm,
    hls::stream <bool>& endPlaintextStrm
    )

aes192CbcDecrypt is CBC decryption mode with AES-192 single block cipher.

The algorithm reference is : “Recommendation for Block Cipher Modes of Operation - Methods and Techniques” The implementation is modified for better performance.

Parameters:

ciphertextStrm Input block stream text to be decrypted, each block is 128 bits.
endCiphertextStrm End flag of block stream ciphertext, 1 bit.
cipherkeyStrm Input cipher key used in decryption, 192 bits.
IVStrm Initialization vector for the fisrt iteration of AES decrypition, 128 bits.
plaintextStrm Output decrypted block stream text, each block is 128 bits.
endPlaintextStrm End flag of block stream plaintext, 1 bit.

aes256CbcEncrypt

#include "xf_security/cbc.hpp"
static void aes256CbcEncrypt (
    hls::stream <ap_uint <128>>& plaintextStrm,
    hls::stream <bool>& endPlaintextStrm,
    hls::stream <ap_uint <256>>& cipherkeyStrm,
    hls::stream <ap_uint <128>>& IVStrm,
    hls::stream <ap_uint <128>>& ciphertextStrm,
    hls::stream <bool>& endCiphertextStrm
    )

aes256CbcEncrypt is CBC encryption mode with AES-256 single block cipher.

The algorithm reference is : “Recommendation for Block Cipher Modes of Operation - Methods and Techniques” The implementation is modified for better performance.

Parameters:

plaintextStrm Input block stream text to be encrypted, each text block is 128 bits.
endPlaintextStrm End flag of block stream plaintext, 1 bit.
cipherkeyStrm Input cipher key used in encryption, 256 bits.
IVStrm Initialization vector for the fisrt iteration of AES encrypition, 128 bits.
ciphertextStrm Output encrypted block stream text, each cipher block is 128 bits.
endCiphertextStrm End flag of block stream ciphertext, 1 bit.

aes256CbcDecrypt

#include "xf_security/cbc.hpp"
static void aes256CbcDecrypt (
    hls::stream <ap_uint <128>>& ciphertextStrm,
    hls::stream <bool>& endCiphertextStrm,
    hls::stream <ap_uint <256>>& cipherkeyStrm,
    hls::stream <ap_uint <128>>& IVStrm,
    hls::stream <ap_uint <128>>& plaintextStrm,
    hls::stream <bool>& endPlaintextStrm
    )

aes256CbcDecrypt is CBC decryption mode with AES-256 single block cipher.

The algorithm reference is : “Recommendation for Block Cipher Modes of Operation - Methods and Techniques” The implementation is modified for better performance.

Parameters:

ciphertextStrm Input block stream text to be decrypted, each block is 128 bits.
endCiphertextStrm End flag of block stream ciphertext, 1 bit.
cipherkeyStrm Input cipher key used in decryption, 256 bits.
IVStrm Initialization vector for the fisrt iteration of AES decrypition, 128 bits.
plaintextStrm Output decrypted block stream text, each block is 128 bits.
endPlaintextStrm End flag of block stream plaintext, 1 bit.

aes128CcmEncrypt

#include "xf_security/ccm.hpp"
template <
    unsigned int _t = 16,
    unsigned int _q = 8
    >
void aes128CcmEncrypt (
    hls::stream <ap_uint <128>>& payloadStrm,
    hls::stream <ap_uint <128>>& cipherkeyStrm,
    hls::stream <ap_uint <8* (15-_q)>>& nonceStrm,
    hls::stream <ap_uint <128>>& ADStrm,
    hls::stream <ap_uint <64>>& lenADStrm,
    hls::stream <ap_uint <64>>& lenPldStrm,
    hls::stream <bool>& endLenStrm,
    hls::stream <ap_uint <128>>& cipherStrm,
    hls::stream <ap_uint <64>>& lenCphStrm,
    hls::stream <ap_uint <8*_t>>& tagStrm,
    hls::stream <bool>& endTagStrm
    )

aes128CcmEncrypt is CCM encryption mode with AES-128 single block cipher.

The algorithm reference is: “Recommendation for Block Cipher Modes of Operation: The CCM Mode for Authentication and Confidentiality” The implementation is modified for better performance.

Parameters:

_t Length of the MAC in byte, t is an element of {4, 6, 8, 10, 12, 14, 16}.
_q Length in byte of the binary representation of the length of the payload in byte, q is an element of {2, 3, 4, 5, 6, 7, 8}.
payloadStrm Input block stream text to be encrypted.
cipherkeyStrm Input cipher key used in encryption.
nonceStrm The nonce stream.
ADStrm Associated data stream.
lenADStrm Length of associated data in byte.
lenPldStrm Length of payload in byte.
endLenStrm Flag to signal the end of the length streams.
cipherStrm Output encrypted block stream text.
lenCphStrm Length of cipher in byte.
tagStrm The MAC stream.
endTagStrm Flag to signal the end of the MAC stream.

aes128CcmDecrypt

#include "xf_security/ccm.hpp"
template <
    unsigned int _t = 16,
    unsigned int _q = 8
    >
void aes128CcmDecrypt (
    hls::stream <ap_uint <128>>& payloadStrm,
    hls::stream <ap_uint <128>>& cipherkeyStrm,
    hls::stream <ap_uint <8* (15-_q)>>& nonceStrm,
    hls::stream <ap_uint <128>>& ADStrm,
    hls::stream <ap_uint <64>>& lenADStrm,
    hls::stream <ap_uint <64>>& lenPldStrm,
    hls::stream <bool>& endLenStrm,
    hls::stream <ap_uint <128>>& cipherStrm,
    hls::stream <ap_uint <64>>& lenCphStrm,
    hls::stream <ap_uint <8*_t>>& tagStrm,
    hls::stream <bool>& endTagStrm
    )

aes128CcmDecrypt is CCM decryption mode with AES-128 single block cipher.

The algorithm reference is: “Recommendation for Block Cipher Modes of Operation: The CCM Mode for Authentication and Confidentiality” The implementation is modified for better performance.

Parameters:

_t Length of the MAC in byte, t is an element of {4, 6, 8, 10, 12, 14, 16}.
_q Length in byte of the binary representation of the length of the payload in byte, q is an element of {2, 3, 4, 5, 6, 7, 8}.
payloadStrm Input block stream text to be decrypted.
cipherkeyStrm Input cipher key used in decryption.
nonceStrm The nonce stream.
ADStrm Associated data stream.
lenADStrm Length of associated data in byte.
lenPldStrm Length of payload in byte.
endLenStrm Flag to signal the end of the length streams.
cipherStrm Output decrypted block stream text.
lenCphStrm Length of cipher in byte.
tagStrm The MAC stream.
endTagStrm Flag to signal the end of the MAC stream.

aes192CcmEncrypt

#include "xf_security/ccm.hpp"
template <
    unsigned int _t = 16,
    unsigned int _q = 8
    >
void aes192CcmEncrypt (
    hls::stream <ap_uint <128>>& payloadStrm,
    hls::stream <ap_uint <192>>& cipherkeyStrm,
    hls::stream <ap_uint <8* (15-_q)>>& nonceStrm,
    hls::stream <ap_uint <128>>& ADStrm,
    hls::stream <ap_uint <64>>& lenADStrm,
    hls::stream <ap_uint <64>>& lenPldStrm,
    hls::stream <bool>& endLenStrm,
    hls::stream <ap_uint <128>>& cipherStrm,
    hls::stream <ap_uint <64>>& lenCphStrm,
    hls::stream <ap_uint <8*_t>>& tagStrm,
    hls::stream <bool>& endTagStrm
    )

aes192CcmEncrypt is CCM encryption mode with AES-192 single block cipher.

The algorithm reference is: “Recommendation for Block Cipher Modes of Operation: The CCM Mode for Authentication and Confidentiality” The implementation is modified for better performance.

Parameters:

_t Length of the MAC in byte, t is an element of {4, 6, 8, 10, 12, 14, 16}.
_q Length in byte of the binary representation of the length of the payload in byte, q is an element of {2, 3, 4, 5, 6, 7, 8}.
payloadStrm Input block stream text to be encrypted.
cipherkeyStrm Input cipher key used in encryption.
nonceStrm The nonce stream.
ADStrm Associated data stream.
lenADStrm Length of associated data in byte.
lenPldStrm Length of payload in byte.
endLenStrm Flag to signal the end of the length streams.
cipherStrm Output encrypted block stream text.
lenCphStrm Length of cipher in byte.
tagStrm The MAC stream.
endTagStrm Flag to signal the end of the MAC stream.

aes192CcmDecrypt

#include "xf_security/ccm.hpp"
template <
    unsigned int _t = 16,
    unsigned int _q = 8
    >
void aes192CcmDecrypt (
    hls::stream <ap_uint <128>>& payloadStrm,
    hls::stream <ap_uint <192>>& cipherkeyStrm,
    hls::stream <ap_uint <8* (15-_q)>>& nonceStrm,
    hls::stream <ap_uint <128>>& ADStrm,
    hls::stream <ap_uint <64>>& lenADStrm,
    hls::stream <ap_uint <64>>& lenPldStrm,
    hls::stream <bool>& endLenStrm,
    hls::stream <ap_uint <128>>& cipherStrm,
    hls::stream <ap_uint <64>>& lenCphStrm,
    hls::stream <ap_uint <8*_t>>& tagStrm,
    hls::stream <bool>& endTagStrm
    )

aes192CcmDecrypt is CCM decryption mode with AES-192 single block cipher.

The algorithm reference is: “Recommendation for Block Cipher Modes of Operation: The CCM Mode for Authentication and Confidentiality” The implementation is modified for better performance.

Parameters:

_t Length of the MAC in byte, t is an element of {4, 6, 8, 10, 12, 14, 16}.
_q Length in byte of the binary representation of the length of the payload in byte, q is an element of {2, 3, 4, 5, 6, 7, 8}.
payloadStrm Input block stream text to be decrypted.
cipherkeyStrm Input cipher key used in decryption.
nonceStrm The nonce stream.
ADStrm Associated data stream.
lenADStrm Length of associated data in byte.
lenPldStrm Length of payload in byte.
endLenStrm Flag to signal the end of the length streams.
cipherStrm Output decrypted block stream text.
lenCphStrm Length of cipher in byte.
tagStrm The MAC stream.
endTagStrm Flag to signal the end of the MAC stream.

aes256CcmEncrypt

#include "xf_security/ccm.hpp"
template <
    unsigned int _t = 16,
    unsigned int _q = 8
    >
void aes256CcmEncrypt (
    hls::stream <ap_uint <128>>& payloadStrm,
    hls::stream <ap_uint <256>>& cipherkeyStrm,
    hls::stream <ap_uint <8* (15-_q)>>& nonceStrm,
    hls::stream <ap_uint <128>>& ADStrm,
    hls::stream <ap_uint <64>>& lenADStrm,
    hls::stream <ap_uint <64>>& lenPldStrm,
    hls::stream <bool>& endLenStrm,
    hls::stream <ap_uint <128>>& cipherStrm,
    hls::stream <ap_uint <64>>& lenCphStrm,
    hls::stream <ap_uint <8*_t>>& tagStrm,
    hls::stream <bool>& endTagStrm
    )

aes256CcmEncrypt is CCM encryption mode with AES-256 single block cipher.

The algorithm reference is: “Recommendation for Block Cipher Modes of Operation: The CCM Mode for Authentication and Confidentiality” The implementation is modified for better performance.

Parameters:

_t Length of the MAC in byte, t is an element of {4, 6, 8, 10, 12, 14, 16}.
_q Length in byte of the binary representation of the length of the payload in byte, q is an element of {2, 3, 4, 5, 6, 7, 8}.
payloadStrm Input block stream text to be encrypted.
cipherkeyStrm Input cipher key used in encryption.
nonceStrm The nonce stream.
ADStrm Associated data stream.
lenADStrm Length of associated data in byte.
lenPldStrm Length of payload in byte.
endLenStrm Flag to signal the end of the length streams.
cipherStrm Output encrypted block stream text.
lenCphStrm Length of cipher in byte.
tagStrm The MAC stream.
endTagStrm Flag to signal the end of the MAC stream.

aes256CcmDecrypt

#include "xf_security/ccm.hpp"
template <
    unsigned int _t = 16,
    unsigned int _q = 8
    >
void aes256CcmDecrypt (
    hls::stream <ap_uint <128>>& payloadStrm,
    hls::stream <ap_uint <256>>& cipherkeyStrm,
    hls::stream <ap_uint <8* (15-_q)>>& nonceStrm,
    hls::stream <ap_uint <128>>& ADStrm,
    hls::stream <ap_uint <64>>& lenADStrm,
    hls::stream <ap_uint <64>>& lenPldStrm,
    hls::stream <bool>& endLenStrm,
    hls::stream <ap_uint <128>>& cipherStrm,
    hls::stream <ap_uint <64>>& lenCphStrm,
    hls::stream <ap_uint <8*_t>>& tagStrm,
    hls::stream <bool>& endTagStrm
    )

aes256CcmDecrypt is CCM decryption mode with AES-256 single block cipher.

The algorithm reference is: “Recommendation for Block Cipher Modes of Operation: The CCM Mode for Authentication and Confidentiality” The implementation is modified for better performance.

Parameters:

_t Length of the MAC in byte, t is an element of {4, 6, 8, 10, 12, 14, 16}.
_q Length in byte of the binary representation of the length of the payload in byte, q is an element of {2, 3, 4, 5, 6, 7, 8}.
payloadStrm Input block stream text to be decrypted.
cipherkeyStrm Input cipher key used in decryption.
nonceStrm The nonce stream.
ADStrm Associated data stream.
lenADStrm Length of associated data in byte.
lenPldStrm Length of payload in byte.
endLenStrm Flag to signal the end of the length streams.
cipherStrm Output decrypted block stream text.
lenCphStrm Length of cipher in byte.
tagStrm The MAC stream.
endTagStrm Flag to signal the end of the MAC stream.

desCfb1Encrypt

#include "xf_security/cfb.hpp"
static void desCfb1Encrypt (
    hls::stream <ap_uint <64>>& plaintextStrm,
    hls::stream <bool>& endPlaintextStrm,
    hls::stream <ap_uint <64>>& cipherkeyStrm,
    hls::stream <ap_uint <64>>& IVStrm,
    hls::stream <ap_uint <64>>& ciphertextStrm,
    hls::stream <bool>& endCiphertextStrm
    )

desCfb1Encrypt is CFB1 encryption mode with DES single block cipher.

The algorithm reference is : “Recommendation for Block Cipher Modes of Operation - Methods and Techniques” The implementation is modified for better performance.

Parameters:

plaintextStrm Input block stream text to be encrypted, each block is 64 bits.
endPlaintextStrm End flag of block stream plaintext, 1 bit.
cipherkeyStrm Input cipher key used in encryption, 64 bits for each key.
IVStrm Initialization vector for the fisrt iteration of DES encrypition, 64 bits.
ciphertextStrm Output encrypted block stream text, each block is 64 bits.
endCiphertextStrm End flag of block stream ciphertext, 1 bit.

desCfb1Decrypt

#include "xf_security/cfb.hpp"
static void desCfb1Decrypt (
    hls::stream <ap_uint <64>>& ciphertextStrm,
    hls::stream <bool>& endCiphertextStrm,
    hls::stream <ap_uint <64>>& cipherkeyStrm,
    hls::stream <ap_uint <64>>& IVStrm,
    hls::stream <ap_uint <64>>& plaintextStrm,
    hls::stream <bool>& endPlaintextStrm
    )

desCfb1Decrypt is CFB1 decryption mode with DES single block cipher.

The algorithm reference is : “Recommendation for Block Cipher Modes of Operation - Methods and Techniques” The implementation is modified for better performance.

Parameters:

ciphertextStrm Input block stream text to be decrypted, each block is 64 bits.
endCiphertextStrm End flag of block stream ciphertext, 1 bit.
cipherkeyStrm Input cipher key used in decryption, 64 bits for each key.
IVStrm Initialization vector for the fisrt iteration of DES decrypition, 64 bits.
plaintextStrm Output decrypted block stream text, each block is 64 bits.
endPlaintextStrm End flag of block stream plaintext, 1 bit.

aes128Cfb1Encrypt

#include "xf_security/cfb.hpp"
static void aes128Cfb1Encrypt (
    hls::stream <ap_uint <128>>& plaintextStrm,
    hls::stream <bool>& endPlaintextStrm,
    hls::stream <ap_uint <128>>& cipherkeyStrm,
    hls::stream <ap_uint <128>>& IVStrm,
    hls::stream <ap_uint <128>>& ciphertextStrm,
    hls::stream <bool>& endCiphertextStrm
    )

aes128Cfb1Encrypt is CFB1 encryption mode with AES-128 single block cipher.

The algorithm reference is : “Recommendation for Block Cipher Modes of Operation - Methods and Techniques” The implementation is modified for better performance.

Parameters:

plaintextStrm Input block stream text to be encrypted, each text block is 128 bits.
endPlaintextStrm End flag of block stream plaintext, 1 bit.
cipherkeyStrm Input cipher key used in encryption, 128 bits.
IVStrm Initialization vector for the fisrt iteration of AES encrypition, 128 bits.
ciphertextStrm Output encrypted block stream text, each cipher block is 128 bits.
endCiphertextStrm End flag of block stream ciphertext, 1 bit.

aes128Cfb1Decrypt

#include "xf_security/cfb.hpp"
static void aes128Cfb1Decrypt (
    hls::stream <ap_uint <128>>& ciphertextStrm,
    hls::stream <bool>& endCiphertextStrm,
    hls::stream <ap_uint <128>>& cipherkeyStrm,
    hls::stream <ap_uint <128>>& IVStrm,
    hls::stream <ap_uint <128>>& plaintextStrm,
    hls::stream <bool>& endPlaintextStrm
    )

aes128Cfb1Decrypt is CFB1 decryption mode with AES-128 single block cipher.

The algorithm reference is : “Recommendation for Block Cipher Modes of Operation - Methods and Techniques” The implementation is modified for better performance.

Parameters:

ciphertextStrm Input block stream text to be decrypted, each block is 128 bits.
endCiphertextStrm End flag of block stream ciphertext, 1 bit.
cipherkeyStrm Input cipher key used in decryption, 128 bits.
IVStrm Initialization vector for the fisrt iteration of AES decrypition, 128 bits.
plaintextStrm Output decrypted block stream text, each block is 128 bits.
endPlaintextStrm End flag of block stream plaintext, 1 bit.

aes192Cfb1Encrypt

#include "xf_security/cfb.hpp"
static void aes192Cfb1Encrypt (
    hls::stream <ap_uint <128>>& plaintextStrm,
    hls::stream <bool>& endPlaintextStrm,
    hls::stream <ap_uint <192>>& cipherkeyStrm,
    hls::stream <ap_uint <128>>& IVStrm,
    hls::stream <ap_uint <128>>& ciphertextStrm,
    hls::stream <bool>& endCiphertextStrm
    )

aes192Cfb1Encrypt is CFB1 encryption mode with AES-192 single block cipher.

The algorithm reference is : “Recommendation for Block Cipher Modes of Operation - Methods and Techniques” The implementation is modified for better performance.

Parameters:

plaintextStrm Input block stream text to be encrypted, each text block is 128 bits.
endPlaintextStrm End flag of block stream plaintext, 1 bit.
cipherkeyStrm Input cipher key used in encryption, 192 bits.
IVStrm Initialization vector for the fisrt iteration of AES encrypition, 128 bits.
ciphertextStrm Output encrypted block stream text, each cipher block is 128 bits.
endCiphertextStrm End flag of block stream ciphertext, 1 bit.

aes192Cfb1Decrypt

#include "xf_security/cfb.hpp"
static void aes192Cfb1Decrypt (
    hls::stream <ap_uint <128>>& ciphertextStrm,
    hls::stream <bool>& endCiphertextStrm,
    hls::stream <ap_uint <192>>& cipherkeyStrm,
    hls::stream <ap_uint <128>>& IVStrm,
    hls::stream <ap_uint <128>>& plaintextStrm,
    hls::stream <bool>& endPlaintextStrm
    )

aes192Cfb1Decrypt is CFB1 decryption mode with AES-192 single block cipher.

The algorithm reference is : “Recommendation for Block Cipher Modes of Operation - Methods and Techniques” The implementation is modified for better performance.

Parameters:

ciphertextStrm Input block stream text to be decrypted, each block is 128 bits.
endCiphertextStrm End flag of block stream ciphertext, 1 bit.
cipherkeyStrm Input cipher key used in decryption, 192 bits.
IVStrm Initialization vector for the fisrt iteration of AES decrypition, 128 bits.
plaintextStrm Output decrypted block stream text, each block is 128 bits.
endPlaintextStrm End flag of block stream plaintext, 1 bit.

aes256Cfb1Encrypt

#include "xf_security/cfb.hpp"
static void aes256Cfb1Encrypt (
    hls::stream <ap_uint <128>>& plaintextStrm,
    hls::stream <bool>& endPlaintextStrm,
    hls::stream <ap_uint <256>>& cipherkeyStrm,
    hls::stream <ap_uint <128>>& IVStrm,
    hls::stream <ap_uint <128>>& ciphertextStrm,
    hls::stream <bool>& endCiphertextStrm
    )

aes256Cfb1Encrypt is CFB1 encryption mode with AES-256 single block cipher.

The algorithm reference is : “Recommendation for Block Cipher Modes of Operation - Methods and Techniques” The implementation is modified for better performance.

Parameters:

plaintextStrm Input block stream text to be encrypted, each text block is 128 bits.
endPlaintextStrm End flag of block stream plaintext, 1 bit.
cipherkeyStrm Input cipher key used in encryption, 256 bits.
IVStrm Initialization vector for the fisrt iteration of AES encrypition, 128 bits.
ciphertextStrm Output encrypted block stream text, each cipher block is 128 bits.
endCiphertextStrm End flag of block stream ciphertext, 1 bit.

aes256Cfb1Decrypt

#include "xf_security/cfb.hpp"
static void aes256Cfb1Decrypt (
    hls::stream <ap_uint <128>>& ciphertextStrm,
    hls::stream <bool>& endCiphertextStrm,
    hls::stream <ap_uint <256>>& cipherkeyStrm,
    hls::stream <ap_uint <128>>& IVStrm,
    hls::stream <ap_uint <128>>& plaintextStrm,
    hls::stream <bool>& endPlaintextStrm
    )

aes256Cfb1Decrypt is CFB1 decryption mode with AES-256 single block cipher.

The algorithm reference is : “Recommendation for Block Cipher Modes of Operation - Methods and Techniques” The implementation is modified for better performance.

Parameters:

ciphertextStrm Input block stream text to be decrypted, each block is 128 bits.
endCiphertextStrm End flag of block stream ciphertext, 1 bit.
cipherkeyStrm Input cipher key used in decryption, 256 bits.
IVStrm Initialization vector for the fisrt iteration of AES decrypition, 128 bits.
plaintextStrm Output decrypted block stream text, each block is 128 bits.
endPlaintextStrm End flag of block stream plaintext, 1 bit.

desCfb8Encrypt

#include "xf_security/cfb.hpp"
static void desCfb8Encrypt (
    hls::stream <ap_uint <64>>& plaintextStrm,
    hls::stream <bool>& endPlaintextStrm,
    hls::stream <ap_uint <64>>& cipherkeyStrm,
    hls::stream <ap_uint <64>>& IVStrm,
    hls::stream <ap_uint <64>>& ciphertextStrm,
    hls::stream <bool>& endCiphertextStrm
    )

desCfb8Encrypt is CFB8 encryption mode with DES single block cipher.

The algorithm reference is : “Recommendation for Block Cipher Modes of Operation - Methods and Techniques” The implementation is modified for better performance.

Parameters:

plaintextStrm Input block stream text to be encrypted, each block is 64 bits.
endPlaintextStrm End flag of block stream plaintext, 1 bit.
cipherkeyStrm Input cipher key used in encryption, 64 bits for each key.
IVStrm Initialization vector for the fisrt iteration of DES encrypition, 64 bits.
ciphertextStrm Output encrypted block stream text, each block is 64 bits.
endCiphertextStrm End flag of block stream ciphertext, 1 bit.

desCfb8Decrypt

#include "xf_security/cfb.hpp"
static void desCfb8Decrypt (
    hls::stream <ap_uint <64>>& ciphertextStrm,
    hls::stream <bool>& endCiphertextStrm,
    hls::stream <ap_uint <64>>& cipherkeyStrm,
    hls::stream <ap_uint <64>>& IVStrm,
    hls::stream <ap_uint <64>>& plaintextStrm,
    hls::stream <bool>& endPlaintextStrm
    )

desCfb8Decrypt is CFB8 decryption mode with DES single block cipher.

The algorithm reference is : “Recommendation for Block Cipher Modes of Operation - Methods and Techniques” The implementation is modified for better performance.

Parameters:

ciphertextStrm Input block stream text to be decrypted, each block is 64 bits.
endCiphertextStrm End flag of block stream ciphertext, 1 bit.
cipherkeyStrm Input cipher key used in decryption, 64 bits for each key.
IVStrm Initialization vector for the fisrt iteration of DES decrypition, 64 bits.
plaintextStrm Output decrypted block stream text, each block is 64 bits.
endPlaintextStrm End flag of block stream plaintext, 1 bit.

aes128Cfb8Encrypt

#include "xf_security/cfb.hpp"
static void aes128Cfb8Encrypt (
    hls::stream <ap_uint <128>>& plaintextStrm,
    hls::stream <bool>& endPlaintextStrm,
    hls::stream <ap_uint <128>>& cipherkeyStrm,
    hls::stream <ap_uint <128>>& IVStrm,
    hls::stream <ap_uint <128>>& ciphertextStrm,
    hls::stream <bool>& endCiphertextStrm
    )

aes128Cfb8Encrypt is CFB8 encryption mode with AES-128 single block cipher.

The algorithm reference is : “Recommendation for Block Cipher Modes of Operation - Methods and Techniques” The implementation is modified for better performance.

Parameters:

plaintextStrm Input block stream text to be encrypted, each text block is 128 bits.
endPlaintextStrm End flag of block stream plaintext, 1 bit.
cipherkeyStrm Input cipher key used in encryption, 128 bits.
IVStrm Initialization vector for the fisrt iteration of AES encrypition, 128 bits.
ciphertextStrm Output encrypted block stream text, each cipher block is 128 bits.
endCiphertextStrm End flag of block stream ciphertext, 1 bit.

aes128Cfb8Decrypt

#include "xf_security/cfb.hpp"
static void aes128Cfb8Decrypt (
    hls::stream <ap_uint <128>>& ciphertextStrm,
    hls::stream <bool>& endCiphertextStrm,
    hls::stream <ap_uint <128>>& cipherkeyStrm,
    hls::stream <ap_uint <128>>& IVStrm,
    hls::stream <ap_uint <128>>& plaintextStrm,
    hls::stream <bool>& endPlaintextStrm
    )

aes128Cfb8Decrypt is CFB8 decryption mode with AES-128 single block cipher.

The algorithm reference is : “Recommendation for Block Cipher Modes of Operation - Methods and Techniques” The implementation is modified for better performance.

Parameters:

ciphertextStrm Input block stream text to be decrypted, each block is 128 bits.
endCiphertextStrm End flag of block stream ciphertext, 1 bit.
cipherkeyStrm Input cipher key used in decryption, 128 bits.
IVStrm Initialization vector for the fisrt iteration of AES decrypition, 128 bits.
plaintextStrm Output decrypted block stream text, each block is 128 bits.
endPlaintextStrm End flag of block stream plaintext, 1 bit.

aes192Cfb8Encrypt

#include "xf_security/cfb.hpp"
static void aes192Cfb8Encrypt (
    hls::stream <ap_uint <128>>& plaintextStrm,
    hls::stream <bool>& endPlaintextStrm,
    hls::stream <ap_uint <192>>& cipherkeyStrm,
    hls::stream <ap_uint <128>>& IVStrm,
    hls::stream <ap_uint <128>>& ciphertextStrm,
    hls::stream <bool>& endCiphertextStrm
    )

aes192Cfb8Encrypt is CFB8 encryption mode with AES-192 single block cipher.

The algorithm reference is : “Recommendation for Block Cipher Modes of Operation - Methods and Techniques” The implementation is modified for better performance.

Parameters:

plaintextStrm Input block stream text to be encrypted, each text block is 128 bits.
endPlaintextStrm End flag of block stream plaintext, 1 bit.
cipherkeyStrm Input cipher key used in encryption, 192 bits.
IVStrm Initialization vector for the fisrt iteration of AES encrypition, 128 bits.
ciphertextStrm Output encrypted block stream text, each cipher block is 128 bits.
endCiphertextStrm End flag of block stream ciphertext, 1 bit.

aes192Cfb8Decrypt

#include "xf_security/cfb.hpp"
static void aes192Cfb8Decrypt (
    hls::stream <ap_uint <128>>& ciphertextStrm,
    hls::stream <bool>& endCiphertextStrm,
    hls::stream <ap_uint <192>>& cipherkeyStrm,
    hls::stream <ap_uint <128>>& IVStrm,
    hls::stream <ap_uint <128>>& plaintextStrm,
    hls::stream <bool>& endPlaintextStrm
    )

aes192Cfb8Decrypt is CFB8 decryption mode with AES-192 single block cipher.

The algorithm reference is : “Recommendation for Block Cipher Modes of Operation - Methods and Techniques” The implementation is modified for better performance.

Parameters:

ciphertextStrm Input block stream text to be decrypted, each block is 128 bits.
endCiphertextStrm End flag of block stream ciphertext, 1 bit.
cipherkeyStrm Input cipher key used in decryption, 192 bits.
IVStrm Initialization vector for the fisrt iteration of AES decrypition, 128 bits.
plaintextStrm Output decrypted block stream text, each block is 128 bits.
endPlaintextStrm End flag of block stream plaintext, 1 bit.

aes256Cfb8Encrypt

#include "xf_security/cfb.hpp"
static void aes256Cfb8Encrypt (
    hls::stream <ap_uint <128>>& plaintextStrm,
    hls::stream <bool>& endPlaintextStrm,
    hls::stream <ap_uint <256>>& cipherkeyStrm,
    hls::stream <ap_uint <128>>& IVStrm,
    hls::stream <ap_uint <128>>& ciphertextStrm,
    hls::stream <bool>& endCiphertextStrm
    )

aes256Cfb8Encrypt is CFB8 encryption mode with AES-256 single block cipher.

The algorithm reference is : “Recommendation for Block Cipher Modes of Operation - Methods and Techniques” The implementation is modified for better performance.

Parameters:

plaintextStrm Input block stream text to be encrypted, each text block is 128 bits.
endPlaintextStrm End flag of block stream plaintext, 1 bit.
cipherkeyStrm Input cipher key used in encryption, 256 bits.
IVStrm Initialization vector for the fisrt iteration of AES encrypition, 128 bits.
ciphertextStrm Output encrypted block stream text, each cipher block is 128 bits.
endCiphertextStrm End flag of block stream ciphertext, 1 bit.

aes256Cfb8Decrypt

#include "xf_security/cfb.hpp"
static void aes256Cfb8Decrypt (
    hls::stream <ap_uint <128>>& ciphertextStrm,
    hls::stream <bool>& endCiphertextStrm,
    hls::stream <ap_uint <256>>& cipherkeyStrm,
    hls::stream <ap_uint <128>>& IVStrm,
    hls::stream <ap_uint <128>>& plaintextStrm,
    hls::stream <bool>& endPlaintextStrm
    )

aes256Cfb8Decrypt is CFB8 decryption mode with AES-256 single block cipher.

The algorithm reference is : “Recommendation for Block Cipher Modes of Operation - Methods and Techniques” The implementation is modified for better performance.

Parameters:

ciphertextStrm Input block stream text to be decrypted, each block is 128 bits.
endCiphertextStrm End flag of block stream ciphertext, 1 bit.
cipherkeyStrm Input cipher key used in decryption, 256 bits.
IVStrm Initialization vector for the fisrt iteration of AES decrypition, 128 bits.
plaintextStrm Output decrypted block stream text, each block is 128 bits.
endPlaintextStrm End flag of block stream plaintext, 1 bit.

desCfb128Encrypt

#include "xf_security/cfb.hpp"
static void desCfb128Encrypt (
    hls::stream <ap_uint <64>>& plaintextStrm,
    hls::stream <bool>& endPlaintextStrm,
    hls::stream <ap_uint <64>>& cipherkeyStrm,
    hls::stream <ap_uint <64>>& IVStrm,
    hls::stream <ap_uint <64>>& ciphertextStrm,
    hls::stream <bool>& endCiphertextStrm
    )

desCfb128Encrypt is CFB128 encryption mode with DES single block cipher.

The algorithm reference is : “Recommendation for Block Cipher Modes of Operation - Methods and Techniques” The implementation is modified for better performance.

Parameters:

plaintextStrm Input block stream text to be encrypted, each block is 64 bits.
endPlaintextStrm End flag of block stream plaintext, 1 bit.
cipherkeyStrm Input cipher key used in encryption, 64 bits for each key.
IVStrm Initialization vector for the fisrt iteration of DES encrypition, 64 bits.
ciphertextStrm Output encrypted block stream text, each block is 64 bits.
endCiphertextStrm End flag of block stream ciphertext, 1 bit.

desCfb128Decrypt

#include "xf_security/cfb.hpp"
static void desCfb128Decrypt (
    hls::stream <ap_uint <64>>& ciphertextStrm,
    hls::stream <bool>& endCiphertextStrm,
    hls::stream <ap_uint <64>>& cipherkeyStrm,
    hls::stream <ap_uint <64>>& IVStrm,
    hls::stream <ap_uint <64>>& plaintextStrm,
    hls::stream <bool>& endPlaintextStrm
    )

desCfb128Decrypt is CFB128 decryption mode with DES single block cipher.

The algorithm reference is : “Recommendation for Block Cipher Modes of Operation - Methods and Techniques” The implementation is modified for better performance.

Parameters:

ciphertextStrm Input block stream text to be decrypted, each block is 64 bits.
endCiphertextStrm End flag of block stream ciphertext, 1 bit.
cipherkeyStrm Input cipher key used in decryption, 64 bits for each key.
IVStrm Initialization vector for the fisrt iteration of DES decrypition, 64 bits.
plaintextStrm Output decrypted block stream text, each block is 64 bits.
endPlaintextStrm End flag of block stream plaintext, 1 bit.

aes128Cfb128Encrypt

#include "xf_security/cfb.hpp"
static void aes128Cfb128Encrypt (
    hls::stream <ap_uint <128>>& plaintextStrm,
    hls::stream <bool>& endPlaintextStrm,
    hls::stream <ap_uint <128>>& cipherkeyStrm,
    hls::stream <ap_uint <128>>& IVStrm,
    hls::stream <ap_uint <128>>& ciphertextStrm,
    hls::stream <bool>& endCiphertextStrm
    )

aes128Cfb128Encrypt is CFB128 encryption mode with AES-128 single block cipher.

The algorithm reference is : “Recommendation for Block Cipher Modes of Operation - Methods and Techniques” The implementation is modified for better performance.

Parameters:

plaintextStrm Input block stream text to be encrypted, each text block is 128 bits.
endPlaintextStrm End flag of block stream plaintext, 1 bit.
cipherkeyStrm Input cipher key used in encryption, 128 bits.
IVStrm Initialization vector for the fisrt iteration of AES encrypition, 128 bits.
ciphertextStrm Output encrypted block stream text, each cipher block is 128 bits.
endCiphertextStrm End flag of block stream ciphertext, 1 bit.

aes128Cfb128Decrypt

#include "xf_security/cfb.hpp"
static void aes128Cfb128Decrypt (
    hls::stream <ap_uint <128>>& ciphertextStrm,
    hls::stream <bool>& endCiphertextStrm,
    hls::stream <ap_uint <128>>& cipherkeyStrm,
    hls::stream <ap_uint <128>>& IVStrm,
    hls::stream <ap_uint <128>>& plaintextStrm,
    hls::stream <bool>& endPlaintextStrm
    )

aes128Cfb128Decrypt is CFB128 decryption mode with AES-128 single block cipher.

The algorithm reference is : “Recommendation for Block Cipher Modes of Operation - Methods and Techniques” The implementation is modified for better performance.

Parameters:

ciphertextStrm Input block stream text to be decrypted, each block is 128 bits.
endCiphertextStrm End flag of block stream ciphertext, 1 bit.
cipherkeyStrm Input cipher key used in decryption, 128 bits.
IVStrm Initialization vector for the fisrt iteration of AES decrypition, 128 bits.
plaintextStrm Output decrypted block stream text, each block is 128 bits.
endPlaintextStrm End flag of block stream plaintext, 1 bit.

aes192Cfb128Encrypt

#include "xf_security/cfb.hpp"
static void aes192Cfb128Encrypt (
    hls::stream <ap_uint <128>>& plaintextStrm,
    hls::stream <bool>& endPlaintextStrm,
    hls::stream <ap_uint <192>>& cipherkeyStrm,
    hls::stream <ap_uint <128>>& IVStrm,
    hls::stream <ap_uint <128>>& ciphertextStrm,
    hls::stream <bool>& endCiphertextStrm
    )

aes192Cfb128Encrypt is CFB128 encryption mode with AES-192 single block cipher.

The algorithm reference is : “Recommendation for Block Cipher Modes of Operation - Methods and Techniques” The implementation is modified for better performance.

Parameters:

plaintextStrm Input block stream text to be encrypted, each text block is 128 bits.
endPlaintextStrm End flag of block stream plaintext, 1 bit.
cipherkeyStrm Input cipher key used in encryption, 192 bits.
IVStrm Initialization vector for the fisrt iteration of AES encrypition, 128 bits.
ciphertextStrm Output encrypted block stream text, each cipher block is 128 bits.
endCiphertextStrm End flag of block stream ciphertext, 1 bit.

aes192Cfb128Decrypt

#include "xf_security/cfb.hpp"
static void aes192Cfb128Decrypt (
    hls::stream <ap_uint <128>>& ciphertextStrm,
    hls::stream <bool>& endCiphertextStrm,
    hls::stream <ap_uint <192>>& cipherkeyStrm,
    hls::stream <ap_uint <128>>& IVStrm,
    hls::stream <ap_uint <128>>& plaintextStrm,
    hls::stream <bool>& endPlaintextStrm
    )

aes192Cfb128Decrypt is CFB128 decryption mode with AES-192 single block cipher.

The algorithm reference is : “Recommendation for Block Cipher Modes of Operation - Methods and Techniques” The implementation is modified for better performance.

Parameters:

ciphertextStrm Input block stream text to be decrypted, each block is 128 bits.
endCiphertextStrm End flag of block stream ciphertext, 1 bit.
cipherkeyStrm Input cipher key used in decryption, 192 bits.
IVStrm Initialization vector for the fisrt iteration of AES decrypition, 128 bits.
plaintextStrm Output decrypted block stream text, each block is 128 bits.
endPlaintextStrm End flag of block stream plaintext, 1 bit.

aes256Cfb128Encrypt

#include "xf_security/cfb.hpp"
static void aes256Cfb128Encrypt (
    hls::stream <ap_uint <128>>& plaintextStrm,
    hls::stream <bool>& endPlaintextStrm,
    hls::stream <ap_uint <256>>& cipherkeyStrm,
    hls::stream <ap_uint <128>>& IVStrm,
    hls::stream <ap_uint <128>>& ciphertextStrm,
    hls::stream <bool>& endCiphertextStrm
    )

aes256Cfb128Encrypt is CFB128 encryption mode with AES-256 single block cipher.

The algorithm reference is : “Recommendation for Block Cipher Modes of Operation - Methods and Techniques” The implementation is modified for better performance.

Parameters:

plaintextStrm Input block stream text to be encrypted, each text block is 128 bits.
endPlaintextStrm End flag of block stream plaintext, 1 bit.
cipherkeyStrm Input cipher key used in encryption, 256 bits.
IVStrm Initialization vector for the fisrt iteration of AES encrypition, 128 bits.
ciphertextStrm Output encrypted block stream text, each cipher block is 128 bits.
endCiphertextStrm End flag of block stream ciphertext, 1 bit.

aes256Cfb128Decrypt

#include "xf_security/cfb.hpp"
static void aes256Cfb128Decrypt (
    hls::stream <ap_uint <128>>& ciphertextStrm,
    hls::stream <bool>& endCiphertextStrm,
    hls::stream <ap_uint <256>>& cipherkeyStrm,
    hls::stream <ap_uint <128>>& IVStrm,
    hls::stream <ap_uint <128>>& plaintextStrm,
    hls::stream <bool>& endPlaintextStrm
    )

aes256Cfb128Decrypt is CFB128 decryption mode with AES-256 single block cipher.

The algorithm reference is : “Recommendation for Block Cipher Modes of Operation - Methods and Techniques” The implementation is modified for better performance.

Parameters:

ciphertextStrm Input block stream text to be decrypted, each block is 128 bits.
endCiphertextStrm End flag of block stream ciphertext, 1 bit.
cipherkeyStrm Input cipher key used in decryption, 256 bits.
IVStrm Initialization vector for the fisrt iteration of AES decrypition, 128 bits.
plaintextStrm Output decrypted block stream text, each block is 128 bits.
endPlaintextStrm End flag of block stream plaintext, 1 bit.

chacha20

#include "xf_security/chacha20.hpp"
void chacha20 (
    hls::stream <ap_uint <256>>& keyStrm,
    hls::stream <ap_uint <128>>& counterNonceStrm,
    hls::stream <ap_uint <512>>& plainStrm,
    hls::stream <bool>& ePlainStrm,
    hls::stream <ap_uint <512>>& cipherStrm,
    hls::stream <bool>& eCipherStrm
    )

chahcha20 is a basic function for stream ciphering when key is “keylayout-chacha”, its layout in a 256-bit ap_uint<> likes this,

0 - 7 bit: ‘k’ 8 - 15 bit: ‘e’ 16 - 23 bit: ‘y’ 24 - 31 bit: ‘l’ … 232- 239 bit: ‘c’ 240- 247 bit: ‘h’ 248- 255 bit: ‘a’

state matrix: s[0] s[1] s[2] s[3] s[4] s[5] s[6] s[7] s[8] s[9] s[10] s[11] s[12] s[13] s[14] s[15]

128bits counterNonceStrm = counter 32 bits + nonce 96 bits the layout of the data from counteStrm 0-31 bit: counter s[12] 32-63 bit: nonce1 s[13] 64-95 bit: nonce2 s[14] 96-127 bit: nonce3 s[15]

Parameters:

keyStrm initail key
counterNonceStm initial counter and nonce
plainStrm input plain text to be encrypted
ePlainStrm the end flag of plainStrm
cipherStrm output encrypted text
eCipherStrm the end flag of cipherStrm

xchacha20

#include "xf_security/chacha20.hpp"
void xchacha20 (
    hls::stream <ap_uint <256>>& keyStrm,
    hls::stream <ap_uint <192>>& nonceStrm,
    hls::stream <ap_uint <512>>& plainStrm,
    hls::stream <bool>& ePlainStrm,
    hls::stream <ap_uint <512>>& cipherStrm,
    hls::stream <bool>& eCipherStrm
    )

xchahcha20 is variant of original chacha20 to support longer nonce of 192bits.

Parameters:

keyStrm initail key
nonceStm initial nonce
plainStrm input plain text to be encrypted
ePlainStrm the end flag of plainStrm
cipherStrm output encrypted text
eCipherStrm the end flag of cipherStrm

crc32

crc32 overload (1)

#include "xf_security/crc32.hpp"
template <int W>
void crc32 (
    hls::stream <ap_uint <32>>& crcInitStrm,
    hls::stream <ap_uint <8*W>>& inStrm,
    hls::stream <ap_uint <5>>& inPackLenStrm,
    hls::stream <bool>& endInPackLenStrm,
    hls::stream <ap_uint <32>>& outStrm,
    hls::stream <bool>& endOutStrm
    )

crc32 computes the CRC32 check value of an input data.

Parameters:

W byte number of input data, the value of W includes 1, 2, 4, 8, 16.
crcInitStrm initialize crc32 value
inStrm input messages to be checked
inPackLenStrm effetive lengths of input message pack, 1~W. 0 means end of message
endInPackLenStrm end flag of inPackLenStrm, 1 “false” for 1 message, 1 “true” means no message anymore.
outStrm crc32 result to output
endOutStrm end flag of outStrm

crc32 overload (2)

#include "xf_security/crc32.hpp"
template <int W>
void crc32 (
    hls::stream <ap_uint <32>>& crcInitStrm,
    hls::stream <ap_uint <8*W>>& inStrm,
    hls::stream <ap_uint <32>>& inLenStrm,
    hls::stream <bool>& endInStrm,
    hls::stream <ap_uint <32>>& outStrm,
    hls::stream <bool>& endOutStrm
    )

crc32 computes the CRC32 check value of an input data.

Parameters:

W byte number of input data, the value of W includes 1, 2, 4, 8, 16, 32, 64.
crcInitStrm initialize crc32 value
inStrm input messages to be checked
inLenStrm lengths of input message
endInStrm end flag of inLenStrm
outStrm crc32 result to output
endOutStrm end flag of outStrm

crc32 overload (3)

#include "xf_security/crc32.hpp"
template <int W>
void crc32 (
    hls::stream <ap_uint <32>>& crcInitStrm,
    hls::stream <ap_uint <8*W>>& inStrm,
    hls::stream <ap_uint <7>>& inPackLenStrm,
    hls::stream <bool>& endInPackLenStrm,
    hls::stream <ap_uint <32>>& outStrm,
    hls::stream <bool>& endOutStrm
    )

crc32 computes the CRC32 check value of an input data.

Parameters:

W byte number of input data, the value of W includes 32, 64.
crcInitStrm initialize crc32 value
inStrm input messages to be checked
inPackLenStrm effetive lengths of input message pack, 1~W. 0 means end of message
endInPackLenStrm end flag of inPackLenStrm, 1 “false” for 1 message, 1 “true” means no message anymore.
outStrm crc32 result to output
endOutStrm end flag of outStrm

crc32c

crc32c overload (1)

#include "xf_security/crc32c.hpp"
template <int W>
void crc32c (
    hls::stream <ap_uint <32>>& crcInitStrm,
    hls::stream <ap_uint <8*W>>& inStrm,
    hls::stream <ap_uint <32>>& inLenStrm,
    hls::stream <bool>& endInStrm,
    hls::stream <ap_uint <32>>& outStrm,
    hls::stream <bool>& endOutStrm
    )

crc32c computes the CRC32 (Castagnoli) check value of an input data.

Parameters:

W byte number of input data, the value of W includes 1, 2, 4, 8, 16, 32, 64.
crcInitStrm initialize crc32 value
inStrm input messages to be checked
inLenStrm lengths of input message
endInStrm end flag of inLenStrm
outStrm crc32 result to output
endOutStrm end flag of outStrm

crc32c overload (2)

#include "xf_security/crc32c.hpp"
template <int W>
void crc32c (
    hls::stream <ap_uint <32>>& crcInitStrm,
    hls::stream <ap_uint <8*W>>& inStrm,
    hls::stream <ap_uint <7>>& inPackLenStrm,
    hls::stream <bool>& endInPackLenStrm,
    hls::stream <ap_uint <32>>& outStrm,
    hls::stream <bool>& endOutStrm
    )

crc32c computes the CRC32 (Castagnoli) check value of an input data.

Parameters:

W byte number of input data, the value of W includes 1, 2, 4, 8, 16, 32, 64.
crcInitStrm initialize crc32 value
inStrm input messages to be checked
inPackLenStrm effetive lengths of input message pack, 1~W. 0 means end of message
endInPackLenStrm end flag of inPackLenStrm, 1 “false” for 1 message, 1 “true” means no message anymore.
outStrm crc32 result to output
endOutStrm end flag of outStrm

aes128CtrEncrypt

#include "xf_security/ctr.hpp"
static void aes128CtrEncrypt (
    hls::stream <ap_uint <128>>& plaintextStrm,
    hls::stream <bool>& endPlaintextStrm,
    hls::stream <ap_uint <128>>& cipherkeyStrm,
    hls::stream <ap_uint <128>>& IVStrm,
    hls::stream <ap_uint <128>>& ciphertextStrm,
    hls::stream <bool>& endCiphertextStrm
    )

aes128CtrEncrypt is CTR encryption mode with AES-128 single block cipher.

The algorithm reference is : “Recommendation for Block Cipher Modes of Operation - Methods and Techniques” The implementation is modified for better performance.

Parameters:

plaintextStrm Input block stream text to be encrypted, each block is 128 bits.
endPlaintextStrm End flag of block stream plaintext, 1 bit.
cipherkeyStrm Input cipher key used in encryption, 128 bits.
IVStrm Initialization vector for the fisrt iteration of AES encrypition, 128 bits.
ciphertextStrm Output encrypted block stream text, each block is 128 bits.
endCiphertextStrm End flag of block stream ciphertext, 1 bit.

aes128CtrDecrypt

#include "xf_security/ctr.hpp"
static void aes128CtrDecrypt (
    hls::stream <ap_uint <128>>& ciphertextStrm,
    hls::stream <bool>& endCiphertextStrm,
    hls::stream <ap_uint <128>>& cipherkeyStrm,
    hls::stream <ap_uint <128>>& IVStrm,
    hls::stream <ap_uint <128>>& plaintextStrm,
    hls::stream <bool>& endPlaintextStrm
    )

aes128CtrDecrypt is CTR decryption mode with AES-128 single block cipher.

The algorithm reference is : “Recommendation for Block Cipher Modes of Operation - Methods and Techniques” The implementation is modified for better performance.

Parameters:

ciphertextStrm Input block stream text to be decrypted, each block is 128 bits.
endCiphertextStrm End flag of block stream ciphertext, 1 bit.
cipherkeyStrm Input cipher key used in decryption, 128 bits.
IVStrm Initialization vector for the fisrt iteration of AES decrypition, 128 bits.
plaintextStrm Output decrypted block stream text, each block is 128 bits.
endPlaintextStrm End flag of stream plaintext, 1 bit.

aes192CtrEncrypt

#include "xf_security/ctr.hpp"
static void aes192CtrEncrypt (
    hls::stream <ap_uint <128>>& plaintextStrm,
    hls::stream <bool>& endPlaintextStrm,
    hls::stream <ap_uint <192>>& cipherkeyStrm,
    hls::stream <ap_uint <128>>& IVStrm,
    hls::stream <ap_uint <128>>& ciphertextStrm,
    hls::stream <bool>& endCiphertextStrm
    )

aes192CtrEncrypt is CTR encryption mode with AES-192 single block cipher.

The algorithm reference is : “Recommendation for Block Cipher Modes of Operation - Methods and Techniques” The implementation is modified for better performance.

Parameters:

plaintextStrm Input block stream text to be encrypted, each block is 128 bits.
endPlaintextStrm End flag of block stream plaintext, 1 bit.
cipherkeyStrm Input cipher key used in encryption, 192 bits.
IVStrm Initialization vector for the fisrt iteration of AES encrypition, 128 bits.
ciphertextStrm Output encrypted block stream text, each block is 128 bits.
endCiphertextStrm End flag of block stream ciphertext, 1 bit.

aes192CtrDecrypt

#include "xf_security/ctr.hpp"
static void aes192CtrDecrypt (
    hls::stream <ap_uint <128>>& ciphertextStrm,
    hls::stream <bool>& endCiphertextStrm,
    hls::stream <ap_uint <192>>& cipherkeyStrm,
    hls::stream <ap_uint <128>>& IVStrm,
    hls::stream <ap_uint <128>>& plaintextStrm,
    hls::stream <bool>& endPlaintextStrm
    )

aes192CtrDecrypt is CTR decryption mode with AES-192 single block cipher.

The algorithm reference is : “Recommendation for Block Cipher Modes of Operation - Methods and Techniques” The implementation is modified for better performance.

Parameters:

ciphertextStrm Input block stream text to be decrypted, each block is 128 bits.
endCiphertextStrm End flag of block stream ciphertext, 1 bit.
cipherkeyStrm Input cipher key used in decryption, 192 bits.
IVStrm Initialization vector for the fisrt iteration of AES decrypition, 128 bits.
plaintextStrm Output decrypted block stream text, each block is 128 bits.
endPlaintextStrm End flag of stream plaintext, 1 bit.

aes256CtrEncrypt

#include "xf_security/ctr.hpp"
static void aes256CtrEncrypt (
    hls::stream <ap_uint <128>>& plaintextStrm,
    hls::stream <bool>& endPlaintextStrm,
    hls::stream <ap_uint <256>>& cipherkeyStrm,
    hls::stream <ap_uint <128>>& IVStrm,
    hls::stream <ap_uint <128>>& ciphertextStrm,
    hls::stream <bool>& endCiphertextStrm
    )

aes256CtrEncrypt is CTR encryption mode with AES-256 single block cipher.

The algorithm reference is : “Recommendation for Block Cipher Modes of Operation - Methods and Techniques” The implementation is modified for better performance.

Parameters:

plaintextStrm Input block stream text to be encrypted, each block is 128 bits.
endPlaintextStrm End flag of block stream plaintext, 1 bit.
cipherkeyStrm Input cipher key used in encryption, 256 bits.
IVStrm Initialization vector for the fisrt iteration of AES encrypition, 128 bits.
ciphertextStrm Output encrypted block stream text, each block is 128 bits.
endCiphertextStrm End flag of block stream ciphertext, 1 bit.

aes256CtrDecrypt

#include "xf_security/ctr.hpp"
static void aes256CtrDecrypt (
    hls::stream <ap_uint <128>>& ciphertextStrm,
    hls::stream <bool>& endCiphertextStrm,
    hls::stream <ap_uint <256>>& cipherkeyStrm,
    hls::stream <ap_uint <128>>& IVStrm,
    hls::stream <ap_uint <128>>& plaintextStrm,
    hls::stream <bool>& endPlaintextStrm
    )

aes256CtrDecrypt is CTR decryption mode with AES-256 single block cipher.

The algorithm reference is : “Recommendation for Block Cipher Modes of Operation - Methods and Techniques” The implementation is modified for better performance.

Parameters:

ciphertextStrm Input block stream text to be decrypted, each block is 128 bits.
endCiphertextStrm End flag of block stream ciphertext, 1 bit.
cipherkeyStrm Input cipher key used in decryption, 256 bits.
IVStrm Initialization vector for the fisrt iteration of AES decrypition, 128 bits.
plaintextStrm Output decrypted block stream text, each block is 128 bits.
endPlaintextStrm End flag of stream plaintext, 1 bit.

desEncrypt

#include "xf_security/des.hpp"
static void desEncrypt (
    ap_uint <64> in,
    ap_uint <64> key,
    ap_uint <64>& out
    )

desEncrypt is the basic function for ciphering one block with one cipher key using DES

Parameters:

in input one plain text to be encrypted, 64 bits.
key input cipher key, 64 bits.
out output encrypted text, 64 bits.

desDecrypt

#include "xf_security/des.hpp"
static void desDecrypt (
    ap_uint <64> in,
    ap_uint <64> cipherKey,
    ap_uint <64>& out
    )

desDecrypt is the basic function for decrypt one block with one cipher key using DES

Parameters:

in input one encrypted text to be decrypted, 64 bits.
cipherKey input cipher key, 64 bits.
out output decrypted text, 64 bits.

des3Encrypt

#include "xf_security/des.hpp"
static void des3Encrypt (
    ap_uint <64> in,
    ap_uint <64> key1,
    ap_uint <64> key2,
    ap_uint <64> key3,
    ap_uint <64>& out
    )

des3Encrypt is the basic function for ciphering one block with three cipher keys using 3DES

Parameters:

in input one plain text to be encrypted, 64 bits.
key1 input cipher key, 64 bits.
key2 input cipher key, 64 bits.
key3 input cipher key, 64 bits.
out output encrypted text, 64 bits.

des3Decrypt

#include "xf_security/des.hpp"
static void des3Decrypt (
    ap_uint <64> in,
    ap_uint <64> key1,
    ap_uint <64> key2,
    ap_uint <64> key3,
    ap_uint <64>& out
    )

des3Decrypt is the basic function for decrypt one block with three cipher keys using 3DES

Parameters:

in input one encrypted text to be decrypted, 64 bits.
key1 input cipher key, 64 bits.
key2 input cipher key, 64 bits.
key3 input cipher key, 64 bits.
out output decrypted text, 64 bits.

desEcbEncrypt

#include "xf_security/ecb.hpp"
static void desEcbEncrypt (
    hls::stream <ap_uint <64>>& plaintextStrm,
    hls::stream <bool>& endPlaintextStrm,
    hls::stream <ap_uint <64>>& cipherkeyStrm,
    hls::stream <ap_uint <64>>& ciphertextStrm,
    hls::stream <bool>& endCiphertextStrm
    )

desEcbEncrypt is ECB encryption mode with DES single block cipher.

The algorithm reference is : “Recommendation for Block Cipher Modes of Operation - Methods and Techniques” The implementation is modified for better performance.

Parameters:

plaintextStrm Input block stream text to be encrypted, each block is 64 bits.
endPlaintextStrm End flag of block stream plaintext, 1 bit.
cipherkeyStrm Input cipher key used in encryption, 64 bits for each key.
ciphertextStrm Output encrypted block stream text, each block is 64 bits.
endCiphertextStrm End flag of block stream ciphertext, 1 bit.

desEcbDecrypt

#include "xf_security/ecb.hpp"
static void desEcbDecrypt (
    hls::stream <ap_uint <64>>& ciphertextStrm,
    hls::stream <bool>& endCiphertextStrm,
    hls::stream <ap_uint <64>>& cipherkeyStrm,
    hls::stream <ap_uint <64>>& plaintextStrm,
    hls::stream <bool>& endPlaintextStrm
    )

desEcbDecrypt is ECB decryption mode with DES single block cipher.

The algorithm reference is : “Recommendation for Block Cipher Modes of Operation - Methods and Techniques” The implementation is modified for better performance.

Parameters:

ciphertextStrm Input block stream to be decrypted, each block is 64 bits.
endCiphertextStrm End flag of block stream ciphertext, 1 bit.
cipherkeyStrm Input cipher key used in decryption, 64 bits for each key.
plaintextStrm Output decrypted block stream text, each block is 64 bits.
endPlaintextStrm End flag of block stream plaintext, 1 bit.

aes128EcbEncrypt

#include "xf_security/ecb.hpp"
static void aes128EcbEncrypt (
    hls::stream <ap_uint <128>>& plaintextStrm,
    hls::stream <bool>& endPlaintextStrm,
    hls::stream <ap_uint <128>>& cipherkeyStrm,
    hls::stream <ap_uint <128>>& ciphertextStrm,
    hls::stream <bool>& endCiphertextStrm
    )

aes128EcbEncrypt is ECB encryption mode with AES-128 single block cipher.

The algorithm reference is : “Recommendation for Block Cipher Modes of Operation - Methods and Techniques” The implementation is modified for better performance.

Parameters:

plaintextStrm Input block stream text to be encrypted, each block is 128 bits.
endPlaintextStrm End flag of block stream plaintext, 1 bit.
cipherkeyStrm Input cipher key used in encryption, 128 bits.
ciphertextStrm Output encrypted block stream text, each block is 128 bits.
endCiphertextStrm End flag of block stream ciphertext, 1 bit.

aes128EcbDecrypt

#include "xf_security/ecb.hpp"
static void aes128EcbDecrypt (
    hls::stream <ap_uint <128>>& ciphertextStrm,
    hls::stream <bool>& endCiphertextStrm,
    hls::stream <ap_uint <128>>& cipherkeyStrm,
    hls::stream <ap_uint <128>>& plaintextStrm,
    hls::stream <bool>& endPlaintextStrm
    )

aes128EcbDecrypt is ECB decryption mode with AES-128 single block cipher.

The algorithm reference is : “Recommendation for Block Cipher Modes of Operation - Methods and Techniques” The implementation is modified for better performance.

Parameters:

ciphertextStrm Input block stream to be decrypted, each block is 128 bits.
endCiphertextStrm End flag of block stream ciphertext, 1 bit.
cipherkeyStrm Input cipher key used in decryption, 128 bits.
plaintextStrm Output decrypted block stream text, each block is 128 bits.
endPlaintextStrm End flag of block stream plaintext, 1 bit.

aes192EcbEncrypt

#include "xf_security/ecb.hpp"
static void aes192EcbEncrypt (
    hls::stream <ap_uint <128>>& plaintextStrm,
    hls::stream <bool>& endPlaintextStrm,
    hls::stream <ap_uint <192>>& cipherkeyStrm,
    hls::stream <ap_uint <128>>& ciphertextStrm,
    hls::stream <bool>& endCiphertextStrm
    )

aes192EcbEncrypt is ECB encryption mode with AES-192 single block cipher.

The algorithm reference is : “Recommendation for Block Cipher Modes of Operation - Methods and Techniques” The implementation is modified for better performance.

Parameters:

plaintextStrm Input block stream text to be encrypted, each block is 128 bits.
endPlaintextStrm End flag of block stream plaintext, 1 bit.
cipherkeyStrm Input cipher key used in encryption, 192 bits.
ciphertextStrm Output encrypted block stream text, each block is 128 bits.
endCiphertextStrm End flag of block stream ciphertext, 1 bit.

aes192EcbDecrypt

#include "xf_security/ecb.hpp"
static void aes192EcbDecrypt (
    hls::stream <ap_uint <128>>& ciphertextStrm,
    hls::stream <bool>& endCiphertextStrm,
    hls::stream <ap_uint <192>>& cipherkeyStrm,
    hls::stream <ap_uint <128>>& plaintextStrm,
    hls::stream <bool>& endPlaintextStrm
    )

aes192EcbDecrypt is ECB decryption mode with AES-192 single block cipher.

The algorithm reference is : “Recommendation for Block Cipher Modes of Operation - Methods and Techniques” The implementation is modified for better performance.

Parameters:

ciphertextStrm Input block stream to be decrypted, each block is 128 bits.
endCiphertextStrm End flag of block stream ciphertext, 1 bit.
cipherkeyStrm Input cipher key used in decryption, 192 bits.
plaintextStrm Output decrypted block stream text, each block is 128 bits.
endPlaintextStrm End flag of block stream plaintext, 1 bit.

aes256EcbEncrypt

#include "xf_security/ecb.hpp"
static void aes256EcbEncrypt (
    hls::stream <ap_uint <128>>& plaintextStrm,
    hls::stream <bool>& endPlaintextStrm,
    hls::stream <ap_uint <256>>& cipherkeyStrm,
    hls::stream <ap_uint <128>>& ciphertextStrm,
    hls::stream <bool>& endCiphertextStrm
    )

aes256EcbEncrypt is ECB encryption mode with AES-256 single block cipher.

The algorithm reference is : “Recommendation for Block Cipher Modes of Operation - Methods and Techniques” The implementation is modified for better performance.

Parameters:

plaintextStrm Input block stream text to be encrypted, each block is 128 bits.
endPlaintextStrm End flag of block stream plaintext, 1 bit.
cipherkeyStrm Input cipher key used in encryption, 256 bits.
ciphertextStrm Output encrypted block stream text, each block is 128 bits.
endCiphertextStrm End flag of block stream ciphertext, 1 bit.

aes256EcbDecrypt

#include "xf_security/ecb.hpp"
static void aes256EcbDecrypt (
    hls::stream <ap_uint <128>>& ciphertextStrm,
    hls::stream <bool>& endCiphertextStrm,
    hls::stream <ap_uint <256>>& cipherkeyStrm,
    hls::stream <ap_uint <128>>& plaintextStrm,
    hls::stream <bool>& endPlaintextStrm
    )

aes256EcbDecrypt is ECB decryption mode with AES-256 single block cipher.

The algorithm reference is : “Recommendation for Block Cipher Modes of Operation - Methods and Techniques” The implementation is modified for better performance.

Parameters:

ciphertextStrm Input block stream to be decrypted, each block is 128 bits.
endCiphertextStrm End flag of block stream ciphertext, 1 bit.
cipherkeyStrm Input cipher key used in decryption, 256 bits.
plaintextStrm Output decrypted block stream text, each block is 128 bits.
endPlaintextStrm End flag of block stream plaintext, 1 bit.

nistp256Sign

#include "xf_security/ecdsa_nistp256.hpp"
bool nistp256Sign (
    ap_uint <256> hash,
    ap_uint <256> k,
    ap_uint <256> privateKey,
    ap_uint <256>& r,
    ap_uint <256>& s
    )

signing function. It will return true if input parameters are legal, otherwise return false.

Parameters:

hash digest value of message to be signed, with length set to 256.
k A random key to sign the message, should kept different each time to be used.
privateKey Private Key to sign the message
r part of signing pair {r, s}
s part of signing pair {r, s}

nistp256Verify

#include "xf_security/ecdsa_nistp256.hpp"
bool nistp256Verify (
    ap_uint <256> r,
    ap_uint <256> s,
    ap_uint <256> hash,
    ap_uint <256> Px,
    ap_uint <256> Py
    )

verifying function. It will return true if verified, otherwise false.

Parameters:

r part of signing pair {r, s}
s part of signing pair {r, s}
hash digest value of message to be signed, with length set to 256.
Px X coordinate of public key point P.
Py Y coordinate of public key point P.

aes128GcmEncrypt

#include "xf_security/gcm.hpp"
static void aes128GcmEncrypt (
    hls::stream <ap_uint <128>>& payloadStrm,
    hls::stream <ap_uint <128>>& cipherkeyStrm,
    hls::stream <ap_uint <96>>& IVStrm,
    hls::stream <ap_uint <128>>& AADStrm,
    hls::stream <ap_uint <64>>& lenAADStrm,
    hls::stream <ap_uint <64>>& lenPldStrm,
    hls::stream <bool>& endLenStrm,
    hls::stream <ap_uint <128>>& cipherStrm,
    hls::stream <ap_uint <64>>& lenCphStrm,
    hls::stream <ap_uint <128>>& tagStrm,
    hls::stream <bool>& endTagStrm
    )

aes128GcmEncrypt is GCM encryption mode with AES-128 single block cipher.

The algorithm reference is : “IEEE Standard for Authenticated Encryption with Length Expansion for Storage Devices” The implementation is modified for better performance.

Parameters:

payloadStrm Input block stream text to be encrypted.
cipherkeyStrm Input cipher key used in encryption.
IVStrm Initialization vector stream.
AADStrm Additional authenticated data stream.
lenAADStrm Length of additional authenticated data in bits.
lenPldStrm Length of payload in bits.
endLenStrm Flag to signal the end of the length streams.
cipherStrm Output encrypted block stream text.
lenCphStrm Length of cipher in bits.
tagStrm The MAC stream.
endTagStrm Flag to signal the end of the MAC stream.

aes128GcmDecrypt

#include "xf_security/gcm.hpp"
static void aes128GcmDecrypt (
    hls::stream <ap_uint <128>>& payloadStrm,
    hls::stream <ap_uint <128>>& cipherkeyStrm,
    hls::stream <ap_uint <96>>& IVStrm,
    hls::stream <ap_uint <128>>& AADStrm,
    hls::stream <ap_uint <64>>& lenAADStrm,
    hls::stream <ap_uint <64>>& lenPldStrm,
    hls::stream <bool>& endLenStrm,
    hls::stream <ap_uint <128>>& cipherStrm,
    hls::stream <ap_uint <64>>& lenCphStrm,
    hls::stream <ap_uint <128>>& tagStrm,
    hls::stream <bool>& endTagStrm
    )

aes128GcmDecrypt is GCM decryption mode with AES-128 single block cipher.

The algorithm reference is : “IEEE Standard for Authenticated Encryption with Length Expansion for Storage Devices” The implementation is modified for better performance.

Parameters:

payloadStrm Input block stream text to be decrypted.
cipherkeyStrm Input cipher key used in decryption.
IVStrm Initialization vector stream.
AADStrm Additional authenticated data stream.
lenAADStrm Length of additional authenticated data in bits.
lenPldStrm Length of payload in bits.
endLenStrm Flag to signal the end of the length streams.
cipherStrm Output decrypted block stream text.
lenCphStrm Length of cipher in bits.
tagStrm The MAC stream.
endTagStrm Flag to signal the end of the MAC stream.

aes192GcmEncrypt

#include "xf_security/gcm.hpp"
static void aes192GcmEncrypt (
    hls::stream <ap_uint <128>>& payloadStrm,
    hls::stream <ap_uint <192>>& cipherkeyStrm,
    hls::stream <ap_uint <96>>& IVStrm,
    hls::stream <ap_uint <128>>& AADStrm,
    hls::stream <ap_uint <64>>& lenAADStrm,
    hls::stream <ap_uint <64>>& lenPldStrm,
    hls::stream <bool>& endLenStrm,
    hls::stream <ap_uint <128>>& cipherStrm,
    hls::stream <ap_uint <64>>& lenCphStrm,
    hls::stream <ap_uint <128>>& tagStrm,
    hls::stream <bool>& endTagStrm
    )

aes192GcmEncrypt is GCM encryption mode with AES-192 single block cipher.

The algorithm reference is : “IEEE Standard for Authenticated Encryption with Length Expansion for Storage Devices” The implementation is modified for better performance.

Parameters:

payloadStrm Input block stream text to be encrypted.
cipherkeyStrm Input cipher key used in encryption.
IVStrm Initialization vector stream.
AADStrm Additional authenticated data stream.
lenAADStrm Length of additional authenticated data in bits.
lenPldStrm Length of payload in bits.
endLenStrm Flag to signal the end of the length streams.
cipherStrm Output encrypted block stream text.
lenCphStrm Length of cipher in bits.
tagStrm The MAC stream.
endTagStrm Flag to signal the end of the MAC stream.

aes192GcmDecrypt

#include "xf_security/gcm.hpp"
static void aes192GcmDecrypt (
    hls::stream <ap_uint <128>>& payloadStrm,
    hls::stream <ap_uint <192>>& cipherkeyStrm,
    hls::stream <ap_uint <96>>& IVStrm,
    hls::stream <ap_uint <128>>& AADStrm,
    hls::stream <ap_uint <64>>& lenAADStrm,
    hls::stream <ap_uint <64>>& lenPldStrm,
    hls::stream <bool>& endLenStrm,
    hls::stream <ap_uint <128>>& cipherStrm,
    hls::stream <ap_uint <64>>& lenCphStrm,
    hls::stream <ap_uint <128>>& tagStrm,
    hls::stream <bool>& endTagStrm
    )

aes192GcmDecrypt is GCM decryption mode with AES-192 single block cipher.

The algorithm reference is : “IEEE Standard for Authenticated Encryption with Length Expansion for Storage Devices” The implementation is modified for better performance.

Parameters:

payloadStrm Input block stream text to be decrypted.
cipherkeyStrm Input cipher key used in decryption.
IVStrm Initialization vector stream.
AADStrm Additional authenticated data stream.
lenAADStrm Length of additional authenticated data in bits.
lenPldStrm Length of payload in bits.
endLenStrm Flag to signal the end of the length streams.
cipherStrm Output decrypted block stream text.
lenCphStrm Length of cipher in bits.
tagStrm The MAC stream.
endTagStrm Flag to signal the end of the MAC stream.

aes256GcmEncrypt

#include "xf_security/gcm.hpp"
static void aes256GcmEncrypt (
    hls::stream <ap_uint <128>>& payloadStrm,
    hls::stream <ap_uint <256>>& cipherkeyStrm,
    hls::stream <ap_uint <96>>& IVStrm,
    hls::stream <ap_uint <128>>& AADStrm,
    hls::stream <ap_uint <64>>& lenAADStrm,
    hls::stream <ap_uint <64>>& lenPldStrm,
    hls::stream <bool>& endLenStrm,
    hls::stream <ap_uint <128>>& cipherStrm,
    hls::stream <ap_uint <64>>& lenCphStrm,
    hls::stream <ap_uint <128>>& tagStrm,
    hls::stream <bool>& endTagStrm
    )

aes256GcmEncrypt is GCM encryption mode with AES-256 single block cipher.

The algorithm reference is : “IEEE Standard for Authenticated Encryption with Length Expansion for Storage Devices” The implementation is modified for better performance.

Parameters:

payloadStrm Input block stream text to be encrypted.
cipherkeyStrm Input cipher key used in encryption.
IVStrm Initialization vector stream.
AADStrm Additional authenticated data stream.
lenAADStrm Length of additional authenticated data in bits.
lenPldStrm Length of payload in bits.
endLenStrm Flag to signal the end of the length streams.
cipherStrm Output encrypted block stream text.
lenCphStrm Length of cipher in bits.
tagStrm The MAC stream.
endTagStrm Flag to signal the end of the MAC stream.

aes256GcmDecrypt

#include "xf_security/gcm.hpp"
static void aes256GcmDecrypt (
    hls::stream <ap_uint <128>>& payloadStrm,
    hls::stream <ap_uint <256>>& cipherkeyStrm,
    hls::stream <ap_uint <96>>& IVStrm,
    hls::stream <ap_uint <128>>& AADStrm,
    hls::stream <ap_uint <64>>& lenAADStrm,
    hls::stream <ap_uint <64>>& lenPldStrm,
    hls::stream <bool>& endLenStrm,
    hls::stream <ap_uint <128>>& cipherStrm,
    hls::stream <ap_uint <64>>& lenCphStrm,
    hls::stream <ap_uint <128>>& tagStrm,
    hls::stream <bool>& endTagStrm
    )

aes256GcmDecrypt is GCM decryption mode with AES-2562 single block cipher.

The algorithm reference is : “IEEE Standard for Authenticated Encryption with Length Expansion for Storage Devices” The implementation is modified for better performance.

Parameters:

payloadStrm Input block stream text to be decrypted.
cipherkeyStrm Input cipher key used in decryption.
IVStrm Initialization vector stream.
AADStrm Additional authenticated data stream.
lenAADStrm Length of additional authenticated data in bits.
lenPldStrm Length of payload in bits.
endLenStrm Flag to signal the end of the length streams.
cipherStrm Output decrypted block stream text.
lenCphStrm Length of cipher in bits.
tagStrm The MAC stream.
endTagStrm Flag to signal the end of the MAC stream.

aes128Gmac

#include "xf_security/gmac.hpp"
void aes128Gmac (
    hls::stream <ap_uint <128>>& dataStrm,
    hls::stream <ap_uint <64>>& lenDataStrm,
    hls::stream <ap_uint <128>>& cipherkeyStrm,
    hls::stream <ap_uint <96>>& IVStrm,
    hls::stream <ap_uint <128>>& tagStrm
    )

GMAC using AES-128 block cipher.

Galois Message Authentication Code (GMAC) is a mechanism to provide data origin authentication.

Parameters:

dataStrm Input text stream to be authenticated.
lenDataStrm The length of the data in bits.
cipherkeyStrm Input cihperkey to calculate the hash subkey and E(K,Y0).
IVStrm Initialization vector.
tagStrm The MAC stream.

aes192Gmac

#include "xf_security/gmac.hpp"
void aes192Gmac (
    hls::stream <ap_uint <128>>& dataStrm,
    hls::stream <ap_uint <64>>& lenDataStrm,
    hls::stream <ap_uint <192>>& cipherkeyStrm,
    hls::stream <ap_uint <96>>& IVStrm,
    hls::stream <ap_uint <128>>& tagStrm
    )

GMAC using AES-192 block cipher.

Galois Message Authentication Code (GMAC) is a mechanism to provide data origin authentication.

Parameters:

dataStrm Input text stream to be authenticated.
lenDataStrm The length of the data in bits.
cipherkeyStrm Input cihperkey to calculate the hash subkey and E(K,Y0).
IVStrm Initialization vector.
tagStrm The MAC stream.

aes256Gmac

#include "xf_security/gmac.hpp"
void aes256Gmac (
    hls::stream <ap_uint <128>>& dataStrm,
    hls::stream <ap_uint <64>>& lenDataStrm,
    hls::stream <ap_uint <256>>& cipherkeyStrm,
    hls::stream <ap_uint <96>>& IVStrm,
    hls::stream <ap_uint <128>>& tagStrm
    )

GMAC using AES-256 block cipher.

Galois Message Authentication Code (GMAC) is a mechanism to provide data origin authentication.

Parameters:

dataStrm Input text stream to be authenticated.
lenDataStrm The length of the data in bits.
cipherkeyStrm Input cihperkey to calculate the hash subkey and E(K,Y0).
IVStrm Initialization vector.
tagStrm The MAC stream.

hmac

#include "xf_security/hmac.hpp"
template <
    int dataW,
    int lW,
    int hshW,
    int keyLen,
    int blockSize,
    template< int iW, int ilW, int oW > class F
    >
void hmac (
    hls::stream <ap_uint <dataW>>& keyStrm,
    hls::stream <ap_uint <dataW>>& msgStrm,
    hls::stream <ap_uint <lW>>& msgLenStrm,
    hls::stream <bool>& eLenStrm,
    hls::stream <ap_uint <hshW>>& hshStrm,
    hls::stream <bool>& eHshStrm
    )

Compute HMAC value according to specified hash function and input data.

keyW, keyStrm, keyLenStrm, msgW, msgStrm, and msgLenStrm would be used as parameters or input for the hash function, so they need to align with the API of the hash function.

Hash function is wrapped to a template struct which must have a static function named hash .

Take md5 for example:

template <int msgW, int lW, int hshW> struct md5_wrapper { static void hash(hls::stream<ap_uint<msgW> >& msgStrm, hls::stream<lW>& lenStrm, hls::stream<bool>& eLenStrm, hls::stream<ap_uint<hshW> >& hshStrm, hls::stream<bool>& eHshStrm) { xf::security::md5(msgStrm, lenStrm, eLenStrm, hshStrm, eHshStrm); } };

then use hmac like this,

xf::security::hmac<32, 32, 64, 128, 64, md5_wrapper> (…);

Parameters:

dataW the width of input stream keyStrm and msgStrm.
lW the with of input msgLenstrm.
blockSize the block size (in bytes) of the underlying hash function (e.g. 64 bytes for md5 and SHA-1).
hshW the width of output stream hshStrm.
keyLen lenght of key (in bytes)
F a wrapper of hash function which must have a static fucntion named hash .
keyStrm input key stream.
msgStrm input meassge stream.
msgLenStrm the length stream of input message stream.
eLenStrm the end flag of length stream.
hshStrm output stream.
eHshStrm end flag of output stream hshStrm.

keccak_256

#include "xf_security/keccak256.hpp"
static void keccak_256 (
    hls::stream <ap_uint <64>>& msgStrm,
    hls::stream <ap_uint <128>>& msgLenStrm,
    hls::stream <bool>& endMsgLenStrm,
    hls::stream <ap_uint <256>>& digestStrm,
    hls::stream <bool>& endDigestStrm
    )

Top function of KECCAK-256.

The algorithm reference is : “The KECCAK SHA-3 submission-Version 3”.

Parameters:

msgStrm The message being hashed.
msgLenStrm Message length in byte.
endMsgLenStrm The flag to signal end of input message stream.
digestStrm Output digest stream.
endDigestStrm End flag for output digest stream.

md4

#include "xf_security/md4.hpp"
static void md4 (
    hls::stream <ap_uint <32>>& msg_strm,
    hls::stream <ap_uint <64>>& len_strm,
    hls::stream <bool>& end_len_strm,
    hls::stream <ap_uint <128>>& digest_strm,
    hls::stream <bool>& end_digest_strm
    )

Top function of MD4.

The algorithm reference is: “The MD4 Message-Digest Algorithm”.

Parameters:

msg_strm The message being hashed.
len_strm The message length in byte.
end_len_strm The flag to signal end of input message stream.
digest_strm The digest (fingerprint) stream.
end_digest_strm Flag to signal the end of the result.

md5

#include "xf_security/md5.hpp"
static void md5 (
    hls::stream <ap_uint <32>>& msg_strm,
    hls::stream <ap_uint <64>>& len_strm,
    hls::stream <bool>& end_len_strm,
    hls::stream <ap_uint <128>>& digest_strm,
    hls::stream <bool>& end_digest_strm
    )

Top function of MD5.

The algorithm reference is : “The MD5 Message-Digest Algorithm”.

Parameters:

msg_strm The message being hashed.
len_strm The message length in byte.
end_len_strm The flag to signal end of input message stream.
digest_strm The digest (fingerprint) stream.
end_digest_strm Flag to signal the end of the result.

desOfbEncrypt

#include "xf_security/ofb.hpp"
static void desOfbEncrypt (
    hls::stream <ap_uint <64>>& plaintextStrm,
    hls::stream <bool>& endPlaintextStrm,
    hls::stream <ap_uint <64>>& cipherkeyStrm,
    hls::stream <ap_uint <64>>& IVStrm,
    hls::stream <ap_uint <64>>& ciphertextStrm,
    hls::stream <bool>& endCiphertextStrm
    )

desOfbEncrypt is OFB encryption mode with DES single block cipher.

The algorithm reference is : “Recommendation for Block Cipher Modes of Operation - Methods and Techniques” The implementation is modified for better performance.

Parameters:

plaintextStrm Input block stream text to be encrypted, each block is 64 bits.
endPlaintextStrm End flag of block stream plaintext, 1 bit.
cipherkeyStrm Input cipher key used in encryption, 64 bits for each key.
IVStrm Initialization vector for the fisrt iteration of DES encrypition, 64 bits.
ciphertextStrm Output encrypted block stream text, each block is 64 bits.
endCiphertextStrm End flag of block stream ciphertext, 1 bit.

desOfbDecrypt

#include "xf_security/ofb.hpp"
static void desOfbDecrypt (
    hls::stream <ap_uint <64>>& ciphertextStrm,
    hls::stream <bool>& endCiphertextStrm,
    hls::stream <ap_uint <64>>& cipherkeyStrm,
    hls::stream <ap_uint <64>>& IVStrm,
    hls::stream <ap_uint <64>>& plaintextStrm,
    hls::stream <bool>& endPlaintextStrm
    )

desOfbDecrypt is OFB decryption mode with DES single block cipher.

The algorithm reference is : “Recommendation for Block Cipher Modes of Operation - Methods and Techniques” The implementation is modified for better performance.

Parameters:

ciphertextStrm Input block stream to be decrypted, each block is 64 bits.
endCiphertextStrm End flag of block stream ciphertext, 1 bit.
cipherkeyStrm Input cipher key used in decryption, 64 bits for each key.
IVStrm Initialization vector for the fisrt iteration of DES decrypition, 64 bits.
plaintextStrm Output decrypted block stream text, each block is 64 bits.
endPlaintextStrm End flag of block stream plaintext, 1 bit.

aes128OfbEncrypt

#include "xf_security/ofb.hpp"
static void aes128OfbEncrypt (
    hls::stream <ap_uint <128>>& plaintextStrm,
    hls::stream <bool>& endPlaintextStrm,
    hls::stream <ap_uint <128>>& cipherkeyStrm,
    hls::stream <ap_uint <128>>& IVStrm,
    hls::stream <ap_uint <128>>& ciphertextStrm,
    hls::stream <bool>& endCiphertextStrm
    )

aes128OfbEncrypt is OFB encryption mode with AES-128 single block cipher.

The algorithm reference is : “Recommendation for Block Cipher Modes of Operation - Methods and Techniques” The implementation is modified for better performance.

Parameters:

plaintextStrm Input block stream text to be encrypted, each block is 128 bits.
endPlaintextStrm End flag of block stream plaintext, 1 bit.
cipherkeyStrm Input cipher key used in encryption, 128 bits.
IVStrm Initialization vector for the fisrt iteration of AES encrypition, 128 bits.
ciphertextStrm Output encrypted block stream text, each block is 128 bits.
endCiphertextStrm End flag of block stream ciphertext, 1 bit.

aes128OfbDecrypt

#include "xf_security/ofb.hpp"
static void aes128OfbDecrypt (
    hls::stream <ap_uint <128>>& ciphertextStrm,
    hls::stream <bool>& endCiphertextStrm,
    hls::stream <ap_uint <128>>& cipherkeyStrm,
    hls::stream <ap_uint <128>>& IVStrm,
    hls::stream <ap_uint <128>>& plaintextStrm,
    hls::stream <bool>& endPlaintextStrm
    )

aes128OfbDecrypt is OFB decryption mode with AES-128 single block cipher.

The algorithm reference is : “Recommendation for Block Cipher Modes of Operation - Methods and Techniques” The implementation is modified for better performance.

Parameters:

ciphertextStrm Input block stream to be decrypted, each block is 128 bits.
endCiphertextStrm End flag of block stream ciphertext, 1 bit.
cipherkeyStrm Input cipher key used in decryption, 128 bits.
IVStrm Initialization vector for the fisrt iteration of AES decrypition, 128 bits.
plaintextStrm Output decrypted block stream text, each block is 128 bits.
endPlaintextStrm End flag of block stream plaintext, 1 bit.

aes192OfbEncrypt

#include "xf_security/ofb.hpp"
static void aes192OfbEncrypt (
    hls::stream <ap_uint <128>>& plaintextStrm,
    hls::stream <bool>& endPlaintextStrm,
    hls::stream <ap_uint <192>>& cipherkeyStrm,
    hls::stream <ap_uint <128>>& IVStrm,
    hls::stream <ap_uint <128>>& ciphertextStrm,
    hls::stream <bool>& endCiphertextStrm
    )

aes192OfbEncrypt is OFB encryption mode with AES-192 single block cipher.

The algorithm reference is : “Recommendation for Block Cipher Modes of Operation - Methods and Techniques” The implementation is modified for better performance.

Parameters:

plaintextStrm Input block stream text to be encrypted, each block is 128 bits.
endPlaintextStrm End flag of block stream plaintext, 1 bit.
cipherkeyStrm Input cipher key used in encryption, 192 bits.
IVStrm Initialization vector for the fisrt iteration of AES encrypition, 128 bits.
ciphertextStrm Output encrypted block stream text, each block is 128 bits.
endCiphertextStrm End flag of block stream ciphertext, 1 bit.

aes192OfbDecrypt

#include "xf_security/ofb.hpp"
static void aes192OfbDecrypt (
    hls::stream <ap_uint <128>>& ciphertextStrm,
    hls::stream <bool>& endCiphertextStrm,
    hls::stream <ap_uint <192>>& cipherkeyStrm,
    hls::stream <ap_uint <128>>& IVStrm,
    hls::stream <ap_uint <128>>& plaintextStrm,
    hls::stream <bool>& endPlaintextStrm
    )

aes192OfbDecrypt is OFB decryption mode with AES-192 single block cipher.

The algorithm reference is : “Recommendation for Block Cipher Modes of Operation - Methods and Techniques” The implementation is modified for better performance.

Parameters:

ciphertextStrm Input block stream to be decrypted, each block is 128 bits.
endCiphertextStrm End flag of block stream ciphertext, 1 bit.
cipherkeyStrm Input cipher key used in decryption, 192 bits.
IVStrm Initialization vector for the fisrt iteration of AES decrypition, 128 bits.
plaintextStrm Output decrypted block stream text, each block is 128 bits.
endPlaintextStrm End flag of block stream plaintext, 1 bit.

aes256OfbEncrypt

#include "xf_security/ofb.hpp"
static void aes256OfbEncrypt (
    hls::stream <ap_uint <128>>& plaintextStrm,
    hls::stream <bool>& endPlaintextStrm,
    hls::stream <ap_uint <256>>& cipherkeyStrm,
    hls::stream <ap_uint <128>>& IVStrm,
    hls::stream <ap_uint <128>>& ciphertextStrm,
    hls::stream <bool>& endCiphertextStrm
    )

aes256OfbEncrypt is OFB encryption mode with AES-256 single block cipher.

The algorithm reference is : “Recommendation for Block Cipher Modes of Operation - Methods and Techniques” The implementation is modified for better performance.

Parameters:

plaintextStrm Input block stream text to be encrypted, each block is 128 bits.
endPlaintextStrm End flag of block stream plaintext, 1 bit.
cipherkeyStrm Input cipher key used in encryption, 256 bits.
IVStrm Initialization vector for the fisrt iteration of AES encrypition, 128 bits.
ciphertextStrm Output encrypted block stream text, each block is 128 bits.
endCiphertextStrm End flag of block stream ciphertext, 1 bit.

aes256OfbDecrypt

#include "xf_security/ofb.hpp"
static void aes256OfbDecrypt (
    hls::stream <ap_uint <128>>& ciphertextStrm,
    hls::stream <bool>& endCiphertextStrm,
    hls::stream <ap_uint <256>>& cipherkeyStrm,
    hls::stream <ap_uint <128>>& IVStrm,
    hls::stream <ap_uint <128>>& plaintextStrm,
    hls::stream <bool>& endPlaintextStrm
    )

aes256OfbDecrypt is OFB decryption mode with AES-256 single block cipher.

The algorithm reference is : “Recommendation for Block Cipher Modes of Operation - Methods and Techniques” The implementation is modified for better performance.

Parameters:

ciphertextStrm Input block stream to be decrypted, each block is 128 bits.
endCiphertextStrm End flag of block stream ciphertext, 1 bit.
cipherkeyStrm Input cipher key used in decryption, 256 bits.
IVStrm Initialization vector for the fisrt iteration of AES decrypition, 128 bits.
plaintextStrm Output decrypted block stream text, each block is 128 bits.
endPlaintextStrm End flag of block stream plaintext, 1 bit.

poly1305

#include "xf_security/poly1305.hpp"
void poly1305 (
    hls::stream <ap_uint <256>>& keyStrm,
    hls::stream <ap_uint <128>>& payloadStrm,
    hls::stream <ap_uint <64>>& lenPldStrm,
    hls::stream <bool>& endLenStrm,
    hls::stream <ap_uint <128>>& tagStrm
    )

The poly1305 takes a 32-byte one-time key and a message and produces a 16-byte tag. This tag is used to authenticate the message.

Parameters:

keyStrm Corresponding message key
payloadStrm For a massage, input block stream text, 128 bits per block, less than 128 bits, high padding 0
lenPldStrm Length of a massage in byte.
endLenStrm Flag to signal the end of the length streams.
tagStrm Return a 16-byte tag to to authenticate the message.

poly1305MultiChan

#include "xf_security/poly1305.hpp"
template <int N>
void poly1305MultiChan (
    hls::stream <ap_uint <256>>& keyStrm,
    hls::stream <ap_uint <128>>& payloadStrm,
    hls::stream <ap_uint <64>>& lenPldStrm,
    hls::stream <bool>& endLenStrm,
    hls::stream <ap_uint <128>>& tagStrm
    )

The poly1305MultiChan takes N 32-byte one-time keys and N messages and produces N 16-byte tags. These tags are used to authenticate the corresponding messages.

Parameters:

N Channel number
keyStrm Corresponding message key
payloadStrm For a massage, input block stream text, 128 bits per block, less than 128 bits, high padding 0
lenPldStrm Length of a massage in byte.
endLenStrm Flag to signal the end of the length streams.
tagStrm Return a 16-byte tag to to authenticate the message.

rc4

#include "xf_security/rc4.hpp"
static void rc4 (
    hls::stream <ap_uint <8>>& keyStrm,
    hls::stream <bool>& eKeyStrm,
    hls::stream <ap_uint <8>>& plainStream,
    hls::stream <bool>& ePlainStream,
    hls::stream <ap_uint <8>>& cipherStream,
    hls::stream <bool>& eCipherStream
    )

Rc_4 is the basic function for stream ciphering keyLength defined as the number of bytes in the key and can be in the range 1<= keylength <=256, typically between 5 and 16, corresponding to a key length of 40-128 bits.

Parameters:

keyStrm initail key
eKeyStrm end flag of keyStrm
plaintStrm input plain text to be encrypted
ePlaintStrm the end flag of plaintStrm
cipherStrm output encrypted text
eCipherStrm the end flag of cipherStrm

sha1

#include "xf_security/sha1.hpp"
template <unsigned int w>
void sha1 (
    hls::stream <ap_uint <w>>& msg_strm,
    hls::stream <ap_uint <64>>& len_strm,
    hls::stream <bool>& end_len_strm,
    hls::stream <ap_uint <5*w>>& digest_strm,
    hls::stream <bool>& end_digest_strm
    )

Top function of SHA-1.

The algorithm reference is : “Secure Hash Standard”, which published by NIST in February 2012. The implementation dataflows the pre-processing part and message digest part.

Parameters:

w The bit width of each input message word, default value is 32.
msg_strm The message being hashed.
len_strm The message length in byte.
end_len_strm The flag to signal end of input message stream.
digest_strm Output digest stream.
end_digest_strm End flag for output digest stream.

sha224

#include "xf_security/sha224_256.hpp"
template <int m_width>
void sha224 (
    hls::stream <ap_uint <m_width>>& msg_strm,
    hls::stream <ap_uint <64>>& len_strm,
    hls::stream <bool>& end_len_strm,
    hls::stream <ap_uint <224>>& hash_strm,
    hls::stream <bool>& end_hash_strm
    )

SHA-224 algorithm with ap_uint stream input and output.

Parameters:

m_width the input message stream width, currently only 32 allowed.
msg_strm the message being hashed.
len_strm the length message being hashed.
end_len_strm the flag for end of message length input.
hash_strm the result.
end_hash_strm the flag for end of hash output.

sha256

#include "xf_security/sha224_256.hpp"
template <int m_width>
void sha256 (
    hls::stream <ap_uint <m_width>>& msg_strm,
    hls::stream <ap_uint <64>>& len_strm,
    hls::stream <bool>& end_len_strm,
    hls::stream <ap_uint <256>>& hash_strm,
    hls::stream <bool>& end_hash_strm
    )

SHA-256 algorithm with ap_uint stream input and output.

Parameters:

m_width the input message stream width, currently only 32 allowed.
msg_strm the message being hashed.
len_strm the length message being hashed.
end_len_strm the flag for end of message length input.
hash_strm the result.
end_hash_strm the flag for end of hash output.

sha3_224

#include "xf_security/sha3.hpp"
static void sha3_224 (
    hls::stream <ap_uint <64>>& msgStrm,
    hls::stream <ap_uint <128>>& msgLenStrm,
    hls::stream <bool>& endMsgLenStrm,
    hls::stream <ap_uint <224>>& digestStrm,
    hls::stream <bool>& endDigestStrm
    )

Top function of SHA3-224.

The algorithm reference is : “SHA-3 Standard : Permutation-Based Hash and Extendable-Output Functions”.

Parameters:

msgStrm The message being hashed.
msgLenStrm Message length in byte.
endMsgLenStrm The flag to signal end of input message stream.
digestStrm Output digest stream.
endDigestStrm End flag for output digest stream.

sha3_256

#include "xf_security/sha3.hpp"
static void sha3_256 (
    hls::stream <ap_uint <64>>& msgStrm,
    hls::stream <ap_uint <128>>& msgLenStrm,
    hls::stream <bool>& endMsgLenStrm,
    hls::stream <ap_uint <256>>& digestStrm,
    hls::stream <bool>& endDigestStrm
    )

Top function of SHA3-256.

The algorithm reference is : “SHA-3 Standard : Permutation-Based Hash and Extendable-Output Functions”.

Parameters:

msgStrm The message being hashed.
msgLenStrm Message length in byte.
endMsgLenStrm The flag to signal end of input message stream.
digestStrm Output digest stream.
endDigestStrm End flag for output digest stream.

sha3_384

#include "xf_security/sha3.hpp"
static void sha3_384 (
    hls::stream <ap_uint <64>>& msgStrm,
    hls::stream <ap_uint <128>>& msgLenStrm,
    hls::stream <bool>& endMsgLenStrm,
    hls::stream <ap_uint <384>>& digestStrm,
    hls::stream <bool>& endDigestStrm
    )

Top function of SHA3-384.

The algorithm reference is : “SHA-3 Standard : Permutation-Based Hash and Extendable-Output Functions”.

Parameters:

msgStrm The message being hashed.
msgLenStrm Message length in byte.
endMsgLenStrm The flag to signal end of input message stream.
digestStrm Output digest stream.
endDigestStrm End flag for output digest stream.

sha3_512

#include "xf_security/sha3.hpp"
static void sha3_512 (
    hls::stream <ap_uint <64>>& msgStrm,
    hls::stream <ap_uint <128>>& msgLenStrm,
    hls::stream <bool>& endMsgLenStrm,
    hls::stream <ap_uint <512>>& digestStrm,
    hls::stream <bool>& endDigestStrm
    )

Top function of SHA3-512.

The algorithm reference is : “SHA-3 Standard : Permutation-Based Hash and Extendable-Output Functions”.

Parameters:

msgStrm The message being hashed.
msgLenStrm Message length in byte.
endMsgLenStrm The flag to signal end of input message stream.
digestStrm Output digest stream.
endDigestStrm End flag for output digest stream.

shake128

#include "xf_security/sha3.hpp"
static void shake128 (
    hls::stream <ap_uint <64>>& msgStrm,
    hls::stream <ap_uint <128>>& msgLenStrm,
    hls::stream <bool>& endMsgLenStrm,
    hls::stream <ap_uint <128>>& digestStrm,
    hls::stream <bool>& endDigestStrm
    )

Top function of SHAKE-128.

The algorithm reference is : “SHA-3 Standard : Permutation-Based Hash and Extendable-Output Functions”.

Parameters:

msgStrm The message being hashed.
msgLenStrm Message length in byte.
endMsgLenStrm The flag to signal end of input message stream.
digestStrm Output digest stream.
endDigestStrm End flag for output digest stream.

shake256

#include "xf_security/sha3.hpp"
static void shake256 (
    hls::stream <ap_uint <64>>& msgStrm,
    hls::stream <ap_uint <128>>& msgLenStrm,
    hls::stream <bool>& endMsgLenStrm,
    hls::stream <ap_uint <256>>& digestStrm,
    hls::stream <bool>& endDigestStrm
    )

Top function of SHAKE-256.

The algorithm reference is : “SHA-3 Standard : Permutation-Based Hash and Extendable-Output Functions”.

Parameters:

msgStrm The message being hashed.
msgLenStrm Message length in byte.
endMsgLenStrm The flag to signal end of input message stream.
digestStrm Output digest stream.
endDigestStrm End flag for output digest stream.

sha384

#include "xf_security/sha512_t.hpp"
template <unsigned int w>
void sha384 (
    hls::stream <ap_uint <w>>& msg_strm,
    hls::stream <ap_uint <128>>& len_strm,
    hls::stream <bool>& end_len_strm,
    hls::stream <ap_uint <384>>& digest_strm,
    hls::stream <bool>& end_digest_strm
    )

SHA-384 algorithm with stream input and output.

The algorithm reference is : “Secure Hash Standard”, which published by NIST in February 2012. The implementation dataflows the pre-processing part and message digest part.

Parameters:

w The bit width of each input message word, default value is 64.
msg_strm The message being hashed.
len_strm The message length in byte.
end_len_strm The flag to signal end of input message stream.
digest_strm Output digest stream.
end_digest_strm End flag for output digest stream.

sha512

#include "xf_security/sha512_t.hpp"
template <unsigned int w>
void sha512 (
    hls::stream <ap_uint <w>>& msg_strm,
    hls::stream <ap_uint <128>>& len_strm,
    hls::stream <bool>& end_len_strm,
    hls::stream <ap_uint <512>>& digest_strm,
    hls::stream <bool>& end_digest_strm
    )

SHA-512 algorithm with stream input and output.

The algorithm reference is : “Secure Hash Standard”, which published by NIST in February 2012. The implementation dataflows the pre-processing part and message digest part.

Parameters:

w The bit width of each input message word, default value is 64.
msg_strm The message being hashed.
len_strm The message length in byte.
end_len_strm The flag to signal end of input message stream.
digest_strm Output digest stream.
end_digest_strm End flag for output digest stream.

sha512_t

#include "xf_security/sha512_t.hpp"
template <
    unsigned int w,
    unsigned int t
    >
void sha512_t (
    hls::stream <ap_uint <w>>& msg_strm,
    hls::stream <ap_uint <128>>& len_strm,
    hls::stream <bool>& end_len_strm,
    hls::stream <ap_uint <t>>& digest_strm,
    hls::stream <bool>& end_digest_strm
    )

SHA-512/t algorithm with stream input and output.

The algorithm reference is : “Secure Hash Standard”, which published by NIST in February 2012. The implementation dataflows the pre-processing part and message digest part.

Parameters:

w The bit width of each input message word, default value is 64.
t The bit width of the digest which depends on specific algorithm, typically is 224 or 256.
msg_strm The message being hashed.
len_strm The message length in byte.
end_len_strm The flag to signal end of input message stream.
digest_strm Output digest stream.
end_digest_strm End flag for output digest stream.

sm3

#include "xf_security/sm234.hpp"
void sm3 (
    hls::stream <ap_uint <64>>& msgStrm,
    hls::stream <ap_uint <64>>& lenStrm,
    hls::stream <bool>& endLenStrm,
    hls::stream <ap_uint <256>>& hashStrm,
    hls::stream <bool>& endHashStrm
    )

SM3 function to genrate digest value for input messages.

Parameters:

msgStrm Stream to input messages to be signed.
lenStrm Stream to input length of input messages.
endLenStrm Stream of end flag of lenStrm.
hashStrm Stream to output digests of messges.
endHashStrm Stream of end flag of hashStrm.

evaluate

#include "xf_security/vdf.hpp"
template <
    int L,
    int N
    >
void evaluate (
    ap_uint <L> g,
    ap_uint <L> l,
    ap_uint <L> modulus,
    ap_uint <L> r2Mod,
    ap_uint <N> t,
    ap_uint <L>& y,
    ap_uint <L>& pi
    )

evaluate evalute function of verifiable delay function

Parameters:

L bit width
N bit width
g is the base element given as input to the VDF evaluator
l is a random prime
modulus is a security parameter
r2Mod Pre-calculated Montgomery parameter
t is a time bound
y is output of evaluate
pi is a proof

verifyWesolowski

#include "xf_security/vdf.hpp"
template <
    int L,
    int N
    >
bool verifyWesolowski (
    ap_uint <L> g,
    ap_uint <L> l,
    ap_uint <L> modulus,
    ap_uint <L> r2Mod,
    ap_uint <L> tMod,
    ap_uint <N> t,
    ap_uint <L> y,
    ap_uint <L>& pi
    )

verifyWesolowski verify function of verifiable delay function

Parameters:

L bit width
N bit width
g is the base element given as input to the VDF evaluator
l is a random prime
modulus is a security parameter
r2Mod Pre-calculated Montgomery parameter
tMod is a time bound’s Pre-calculation value
t is a time bound
y is output of evaluate
pi is a proof

verifyPietrzak

#include "xf_security/vdf.hpp"
template <
    int L,
    int N
    >
bool verifyPietrzak (
    ap_uint <L> g,
    ap_uint <L> modulus,
    ap_uint <L> r2Mod,
    ap_uint <N> T,
    ap_uint <L> y
    )

verifyPietrzak verify function of verifiable delay function, its algorithm: if T is even, return (N, x, T/2, y) = (N, x^(r+2^(T/2)), T/2, x^(r*2^(T/2)+2^T)), if T is odd, return (N, x, (T+1)/2, y) = (N, x^(r+2^((T-1)/2)), T/2, x^(r*2^((T+1)/2)+2^T))

Parameters:

L bit width
N bit width
g is the base element given as input to the VDF evaluator
modulus is a security parameter
r2Mod Pre-calculated Montgomery parameter
T is a time bound
y is output of evaluate

aes128XtsEncrypt

#include "xf_security/xts.hpp"
static void aes128XtsEncrypt (
    hls::stream <ap_uint <128>>& plaintextStrm,
    hls::stream <bool>& endPlaintextStrm,
    hls::stream <ap_uint <64>>& lenStrm,
    hls::stream <ap_uint <128>>& cipherkeyStrm,
    hls::stream <ap_uint <128>>& IVStrm,
    hls::stream <ap_uint <128>>& ciphertextStrm,
    hls::stream <bool>& endCiphertextStrm
    )

aes128XtsEncrypt is XTS encryption mode with AES-128 single block cipher.

The algorithm reference is : “IEEE Standard for Cryptographic Protection of Data on Block-Oriented Storage Devices” The implementation is optimized for better performance in FPGA.

Parameters:

plaintextStrm Input block stream text to be encrypted, each block is 128 bits.
endPlaintextStrm End flag of block stream plaintext, 1 bit.
lenStrm Total length of plaintext in bit, 64 bits.
cipherkeyStrm Input two cipher key used in encryption, 128 bits.
IVStrm Initialization vector for the fisrt iteration of AES encrypition, 128 bits.
ciphertextStrm Output encrypted block stream text, 128 bits.
endCiphertextStrm End flag of stream ciphertext, 1 bit.

aes128XtsDecrypt

#include "xf_security/xts.hpp"
static void aes128XtsDecrypt (
    hls::stream <ap_uint <128>>& ciphertextStrm,
    hls::stream <bool>& endCiphertextStrm,
    hls::stream <ap_uint <64>>& lenStrm,
    hls::stream <ap_uint <128>>& cipherkeyStrm,
    hls::stream <ap_uint <128>>& IVStrm,
    hls::stream <ap_uint <128>>& plaintextStrm,
    hls::stream <bool>& endPlaintextStrm
    )

aes128XtsDecrypt is XTS decryption mode with AES-128 single block cipher.

The algorithm reference is : “IEEE Standard for Cryptographic Protection of Data on Block-Oriented Storage Devices” The implementation is optimized for better performance in FPGA.

Parameters:

ciphertextStrm Input block stream text to be decrypted, each block is 128 bits.
endCiphertextStrm End flag of block stream ciphertext, 1 bit.
lenStrm Total length of plaintext in bit, 64 bits.
cipherkeyStrm Input two cipher key used in decryption, 128 bits.
IVStrm Initialization vector for the fisrt iteration of AES encrypition, 128 bits.
plaintextStrm Output decrypted block stream text, each block is 128 bits.
endPlaintextStrm End flag of block stream plaintext, 1 bit.

aes256XtsEncrypt

#include "xf_security/xts.hpp"
static void aes256XtsEncrypt (
    hls::stream <ap_uint <128>>& plaintextStrm,
    hls::stream <bool>& endPlaintextStrm,
    hls::stream <ap_uint <64>>& lenStrm,
    hls::stream <ap_uint <256>>& cipherkeyStrm,
    hls::stream <ap_uint <128>>& IVStrm,
    hls::stream <ap_uint <128>>& ciphertextStrm,
    hls::stream <bool>& endCiphertextStrm
    )

aes256XtsEncrypt is XTS encryption mode with AES-256 single block cipher.

The algorithm reference is : “IEEE Standard for Cryptographic Protection of Data on Block-Oriented Storage Devices” The implementation is optimized for better performance in FPGA.

Parameters:

plaintextStrm Input block stream text to be encrypted, each block is 128 bits.
endPlaintextStrm End flag of block stream plaintext, 1 bit.
lenStrm Total length of plaintext in bit, 64 bits.
cipherkeyStrm Input two cipher key used in encryption, 256 bits.
IVStrm Initialization vector for the fisrt iteration of AES encrypition, 128 bits.
ciphertextStrm Output encrypted block stream text, 128 bits.
endCiphertextStrm End flag of stream ciphertext, 1 bit.

aes256XtsDecrypt

#include "xf_security/xts.hpp"
static void aes256XtsDecrypt (
    hls::stream <ap_uint <128>>& ciphertextStrm,
    hls::stream <bool>& endCiphertextStrm,
    hls::stream <ap_uint <64>>& lenStrm,
    hls::stream <ap_uint <256>>& cipherkeyStrm,
    hls::stream <ap_uint <128>>& IVStrm,
    hls::stream <ap_uint <128>>& plaintextStrm,
    hls::stream <bool>& endPlaintextStrm
    )

aes256XtsDecrypt is XTS decryption mode with AES-256 single block cipher.

The algorithm reference is : “IEEE Standard for Cryptographic Protection of Data on Block-Oriented Storage Devices” The implementation is optimized for better performance in FPGA.

Parameters:

ciphertextStrm Input block stream text to be decrypted, each block is 128 bits.
endCiphertextStrm End flag of block stream ciphertext, 1 bit.
lenStrm Total length of plaintext in bit, 64 bits.
cipherkeyStrm Input two cipher key used in decryption, 256 bits.
IVStrm Initialization vector for the fisrt iteration of AES encrypition, 128 bits.
plaintextStrm Output decrypted block stream text, each block is 128 bits.
endPlaintextStrm End flag of block stream plaintext, 1 bit.
#include "aes.hpp"
template <>
class aesEnc <128>: public xf::security::aesTable

// fields

ap_uint <128> key_list[11]

Inherited Members

// fields

const ap_uint <16> p16box[256]
const ap_uint <32> i32box[256]
const ap_uint <8> ssbox[256]
const ap_uint <8> iibox[256]
#include "aes.hpp"
template <>
class aesDec <128>: public xf::security::aesTable

// fields

ap_uint <128> key_list[11]

Inherited Members

// fields

const ap_uint <16> p16box[256]
const ap_uint <32> i32box[256]
const ap_uint <8> ssbox[256]
const ap_uint <8> iibox[256]
#include "asymmetric.hpp"

RSA encryption/decryption class.

Parameters:

N BitWdith of modulus of key.
L BitWdith of exponents of RSA encryption and decryption
template <
    int N,
    int L
    >
class rsa

// fields

ap_uint <L> exponent
ap_uint <N> modulus
ap_uint <N> rMod

updateKey

updateKey overload (1)

void updateKey (
    ap_uint <N> inputModulus,
    ap_uint <L> inputExponent
    )

Update key before use it to encrypt message.

Parameters:

inputModulus Modulus in RSA public key.
inputExponent Exponent in RSA public key or private key.

updateKey overload (2)

void updateKey (
    ap_uint <N> inputModulus,
    ap_uint <L> inputExponent,
    ap_uint <N> inputRMod
    )

Update key before use it to encrypt message.

Parameters:

inputModulus Modulus in RSA public key.
inputExponent Exponent in RSA public key or private key.
inputRMod 2^(2 * N) mod modulus, pre-calculated by user

process

void process (
    ap_uint <N> message,
    ap_uint <N>& result
    )

Encrypt message and get result. It does not include any padding scheme.

Parameters:

message Message to be encrypted/decrypted
result Generated encrypted/decrypted result.
#include "dsa.hpp"

Digital Signature. This class provide signing and verifying functions. Generation of domain parameters, key pairs and per-message secrect number requires key management mechanism and is not covered in this class.

Parameters:

L bit length of prime modulus.
N bit length of prime divisor. Selection of L and N is fixed in FIPS.186-4, section 4.2. Choice of pair {L, N} are: {1024, 160}, {2048, 224}, {2048, 256}, {3072, 256}
H bit length of Digest value
template <
    int L,
    int N,
    int H
    >
class dsa

// fields

ap_uint <L> p
ap_uint <N> q
ap_uint <L> g
ap_uint <N> x
ap_uint <L> y
ap_uint <L> rMod

Fields

ap_uint <L> p

Prime modulus, a domain parameter.

ap_uint <N> q

Prime divisor, a domain parameter.

ap_uint <L> g

generator of a subgroup of order q in GF(p), a domain parameter

ap_uint <N> x

private key

ap_uint <L> y

public key

ap_uint <L> rMod

a parameter determined by p, rMod = 2^(2*L) mod p

updateSigningParam

updateSigningParam overload (1)

void updateSigningParam (
    ap_uint <L> inputP,
    ap_uint <N> inputQ,
    ap_uint <L> inputG,
    ap_uint <N> inputX
    )

Set up domain parameters for DSA signing when a set of new domain parameter will be used. rMod is not provided which need to be calculated on Chip.

Parameters:

inputP Input prime modulus.
inputQ Input prime divisor.
inputG Input generator of a subgroup of order inputQ in GF(inputQ).
inputX Input private key

updateSigningParam overload (2)

void updateSigningParam (
    ap_uint <L> inputP,
    ap_uint <N> inputQ,
    ap_uint <L> inputG,
    ap_uint <N> inputX,
    ap_uint <L> inputRMod
    )

Set up domain parameters for DSA signing when a set of new domain parameter will be used.

Parameters:

inputP Input prime modulus.
inputQ Input prime divisor.
inputG Input generator of a subgroup of order inputQ in GF(inputQ).
inputX Input private key
rMod Input rMode, provided by user.

updateVerifyingParam

updateVerifyingParam overload (1)

void updateVerifyingParam (
    ap_uint <L> inputP,
    ap_uint <N> inputQ,
    ap_uint <L> inputG,
    ap_uint <L> inputY
    )

Set up domain parameters for DSA Verifying when a set of new domain parameter will be used. rMod is not provided which need to be calculated on Chip.

Parameters:

inputP Input prime modulus.
inputQ Input prime divisor.
inputG Input generator of a subgroup of order inputQ in GF(inputQ).
inputY Input public key

updateVerifyingParam overload (2)

void updateVerifyingParam (
    ap_uint <L> inputP,
    ap_uint <N> inputQ,
    ap_uint <L> inputG,
    ap_uint <L> inputY,
    ap_uint <L> inputRMod
    )

Set up domain parameters for DSA Verifying when a set of new domain parameter will be used.

Parameters:

inputP Input prime modulus.
inputQ Input prime divisor.
inputG Input generator of a subgroup of order inputQ in GF(inputQ).
inputY Input public key
rMod Input rMode, provided by user.

sign

void sign (
    ap_uint <H> digest,
    ap_uint <N> k,
    ap_uint <N>& r,
    ap_uint <N>& s
    )

DSA signing function.

Parameters:

digest Digest value of message to be signed.
k A per-message secret number.
r Element of signature pair.
s Element of signature pair. Pair(r, s) forms a complete signature pair of DSA.

verify

bool verify (
    ap_uint <H> digest,
    ap_uint <N> r,
    ap_uint <N> s
    )

DSA verifying function. It returns true if verified, otherwise false.

Parameters:

digest Digest value of message to be verified.
r Element of signature pair.
s Element of signature pair. Pair(r, s) forms a complete signature pair of DSA.