]> git.ipfire.org Git - thirdparty/openssl.git/blame - crypto/s390x_arch.h
s390x assembly pack: extend s390x capability vector.
[thirdparty/openssl.git] / crypto / s390x_arch.h
CommitLineData
bc4e831c
PS
1/*
2 * Copyright 2017 The OpenSSL Project Authors. All Rights Reserved.
3 *
4 * Licensed under the OpenSSL license (the "License"). You may not use
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
8 */
9
10#ifndef S390X_ARCH_H
11# define S390X_ARCH_H
12
13# ifndef __ASSEMBLER__
14
15/*
16 * The field elements of OPENSSL_s390xcap_P are the 64-bit words returned by
17 * the STFLE instruction followed by the 64-bit word pairs returned by
18 * instructions' QUERY functions. If STFLE returns fewer data or an instruction
19 * is not supported, the corresponding field elements are zero.
20 */
21struct OPENSSL_s390xcap_st {
22 unsigned long long stfle[4];
23 unsigned long long kimd[2];
24 unsigned long long klmd[2];
25 unsigned long long km[2];
26 unsigned long long kmc[2];
27 unsigned long long kmac[2];
28 unsigned long long kmctr[2];
29 unsigned long long kmo[2];
30 unsigned long long kmf[2];
31 unsigned long long prno[2];
32 unsigned long long kma[2];
33};
34
35extern struct OPENSSL_s390xcap_st OPENSSL_s390xcap_P;
36
37/* convert facility bit number or function code to bit mask */
38# define S390X_CAPBIT(i) (1ULL << (63 - (i) % 64))
39
40# endif
41
42/* OPENSSL_s390xcap_P offsets [bytes] */
43# define S390X_STFLE 0x00
44# define S390X_KIMD 0x20
45# define S390X_KLMD 0x30
46# define S390X_KM 0x40
47# define S390X_KMC 0x50
48# define S390X_KMAC 0x60
49# define S390X_KMCTR 0x70
50# define S390X_KMO 0x80
51# define S390X_KMF 0x90
52# define S390X_PRNO 0xa0
53# define S390X_KMA 0xb0
54
55/* Facility Bit Numbers */
56# define S390X_VX 129
57# define S390X_VXD 134
58# define S390X_VXE 135
59
60/* Function Codes */
61
62/* all instructions */
63# define S390X_QUERY 0
64
65/* kimd/klmd */
66# define S390X_SHA3_224 32
67# define S390X_SHA3_256 33
68# define S390X_SHA3_384 34
69# define S390X_SHA3_512 35
70# define S390X_SHAKE_128 36
71# define S390X_SHAKE_256 37
72# define S390X_GHASH 65
73
74/* km/kmc/kmac/kmctr/kmo/kmf/kma */
75# define S390X_AES_128 18
76# define S390X_AES_192 19
77# define S390X_AES_256 20
78
79/* prno */
80# define S390X_TRNG 114
81
82#endif