Fix RC4-MD5 based ciphersuites
[openssl.git] / providers / implementations / ciphers / cipher_aes_hw_s390x.inc
index 805fa91e5f370a4ed16c1b421eb7308c91f0f221..ff88673f14048ccd388378b8b8d0d42a592cc5d1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2001-2019 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2001-2020 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
@@ -17,9 +17,9 @@
 #define s390x_aes_cbc_initkey    cipher_hw_aes_initkey
 #define s390x_aes_cfb1_initkey   cipher_hw_aes_initkey
 #define s390x_aes_ctr_initkey    cipher_hw_aes_initkey
-#define s390x_aes_cbc_cipher_hw  cipher_hw_generic_cbc
-#define s390x_aes_cfb1_cipher_hw cipher_hw_generic_cfb1
-#define s390x_aes_ctr_cipher_hw  cipher_hw_generic_ctr
+#define s390x_aes_cbc_cipher_hw  ossl_cipher_hw_generic_cbc
+#define s390x_aes_cfb1_cipher_hw ossl_cipher_hw_generic_cfb1
+#define s390x_aes_ctr_cipher_hw  ossl_cipher_hw_generic_ctr
 
 #define S390X_aes_128_ofb128_CAPABLE S390X_aes_128_ofb_CAPABLE
 #define S390X_aes_192_ofb128_CAPABLE S390X_aes_192_ofb_CAPABLE
@@ -99,6 +99,7 @@ static int s390x_aes_ofb128_cipher_hw(PROV_CIPHER_CTX *dat, unsigned char *out,
         }
     }
 
+    memcpy(dat->iv, adat->plat.s390x.param.kmo_kmf.cv, dat->ivlen);
     adat->plat.s390x.res = n;
     return 1;
 }
@@ -161,6 +162,7 @@ static int s390x_aes_cfb128_cipher_hw(PROV_CIPHER_CTX *dat, unsigned char *out,
         }
     }
 
+    memcpy(dat->iv, adat->plat.s390x.param.kmo_kmf.cv, dat->ivlen);
     adat->plat.s390x.res = n;
     return 1;
 }
@@ -187,13 +189,15 @@ static int s390x_aes_cfb8_cipher_hw(PROV_CIPHER_CTX *dat, unsigned char *out,
 
     s390x_kmf(in, len, out, adat->plat.s390x.fc,
               &adat->plat.s390x.param.kmo_kmf);
+    memcpy(dat->iv, adat->plat.s390x.param.kmo_kmf.cv, dat->ivlen);
     return 1;
 }
 
 #define PROV_CIPHER_HW_declare(mode)                                           \
 static const PROV_CIPHER_HW s390x_aes_##mode = {                               \
     s390x_aes_##mode##_initkey,                                                \
-    s390x_aes_##mode##_cipher_hw                                               \
+    s390x_aes_##mode##_cipher_hw,                                              \
+    cipher_hw_aes_copyctx                                                      \
 };
 #define PROV_CIPHER_HW_select(mode)                                            \
 if ((keybits == 128 && S390X_aes_128_##mode##_CAPABLE)                         \