- NAME
- SYNOPSIS
- DESCRIPTION
- RETURN VALUES
- CONFORMING TO
- SEE ALSO
- COPYRIGHT

# NAME

sms4_set_encrypt_key, sms4_set_decrypt_key, sms4_encrypt, sms4_decrypt, sms4_encrypt_init, sms4_encrypt_8blocks, sms4_encrypt_16blocks, sms4_ecb_encrypt, sms4_cbc_encrypt, sms4_cfb128_encrypt, sms4_ofb128_encrypt, sms4_ctr128_encrypt, sms4_wrap_key, sms4_unwrap_key - SM4 Block Cipher

# SYNOPSIS

     #include <openssl/sms4.h>

     void sms4_set_encrypt_key(sms4_key_t *key, const unsigned char *user_key);
     void sms4_set_decrypt_key(sms4_key_t *key, const unsigned char *user_key);
     void sms4_encrypt(const unsigned char *in, unsigned char *out, const sms4_key_t *key);
     #define sms4_decrypt(in,out,key)  sms4_encrypt(in,out,key)

     void sms4_encrypt_init(sms4_key_t *key);
     void sms4_encrypt_8blocks(const unsigned char *in, unsigned char *out, const sms4_key_t *key);
     void sms4_encrypt_16blocks(const unsigned char *in, unsigned char *out, const sms4_key_t *key);

     void sms4_ecb_encrypt(const unsigned char *in, unsigned char *out,
            const sms4_key_t *key, int enc);
     void sms4_cbc_encrypt(const unsigned char *in, unsigned char *out,
            size_t len, const sms4_key_t *key, unsigned char *iv, int enc);
     void sms4_cfb128_encrypt(const unsigned char *in, unsigned char *out,
            size_t len, const sms4_key_t *key, unsigned char *iv, int *num, int enc);
     void sms4_ofb128_encrypt(const unsigned char *in, unsigned char *out,
            size_t len, const sms4_key_t *key, unsigned char *iv, int *num);
     void sms4_ctr128_encrypt(const unsigned char *in, unsigned char *out,
            size_t len, const sms4_key_t *key, unsigned char *iv,
            unsigned char ecount_buf[SMS4_BLOCK_SIZE], unsigned int *num);

     int sms4_wrap_key(sms4_key_t *key, const unsigned char *iv,
            unsigned char *out, const unsigned char *in, unsigned int inlen);
     int sms4_unwrap_key(sms4_key_t *key, const unsigned char *iv,
            unsigned char *out, const unsigned char *in, unsigned int inlen);

# DESCRIPTION

Applications should use the higher level functions RETURN VALUES

sm3_init(), sm3_update(), sm3_final(), sm3_compress() and sm3() return void.

# CONFORMING TO

GM/T 0004-2012 SM3 Cryptogrpahic Hash Algorithm.

# SEE ALSO

COPYRIGHT

Copyright 2014-2019 The GmSSL Project. All Rights Reserved.

Licensed under the GmSSL license (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at http://gmssl.org/license.html.