Skip to main content
  • Home
  • login
  • Browse the archive

    swh mirror partner logo
swh logo
SoftwareHeritage
Software
Heritage
Mirror
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

Raw File
Permalink

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
content badge Iframe embedding
swh:1:cnt:43d9a212e55fd9c0e54acd95613f46913a09cee9
/*
 * Copyright 2022-2023 The OpenSSL Project Authors. All Rights Reserved.
 *
 * Licensed under the Apache License 2.0 (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
 * https://www.openssl.org/source/license.html
 */

#include <crypto/sm4.h>
#include "prov/ciphercommon.h"
#include "crypto/sm4_platform.h"

PROV_CIPHER_FUNC(void, xts_stream,
                 (const unsigned char *in, unsigned char *out, size_t len,
                  const SM4_KEY *key1, const SM4_KEY *key2,
                  const unsigned char iv[16], const int enc));

typedef struct prov_sm4_xts_ctx_st {
    /* Must be first */
    PROV_CIPHER_CTX base;

    /* SM4 key schedules to use */
    union {
        OSSL_UNION_ALIGN;
        SM4_KEY ks;
    } ks1, ks2;

    /*-
     * XTS standard to use with SM4-XTS algorithm
     *
     * Must be 0 or 1,
     * 0 for XTS mode specified by GB/T 17964-2021
     * 1 for XTS mode specified by IEEE Std 1619-2007
     */
    int xts_standard;

    XTS128_CONTEXT xts;

    /* Stream function for XTS mode specified by GB/T 17964-2021 */
    OSSL_xts_stream_fn stream_gb;
    /* Stream function for XTS mode specified by IEEE Std 1619-2007 */
    OSSL_xts_stream_fn stream;
} PROV_SM4_XTS_CTX;

const PROV_CIPHER_HW *ossl_prov_cipher_hw_sm4_xts(size_t keybits);

ENEA — Copyright (C), ENEA. License: GNU AGPLv3+.
Legal notes  ::  JavaScript license information ::  Web API

back to top