- const struct ccmode_xts *enc, *dec;
-
- if(!g_crypto_funcs)
- panic("%s: corecrypto not registered!\n", __FUNCTION__);
-
- enc = g_crypto_funcs->ccaes_xts_encrypt;
- dec = g_crypto_funcs->ccaes_xts_decrypt;
-
- if(!enc && !dec)
- panic("%s: xts mode not registered? enc=%p, dec=%p\n", __FUNCTION__, enc, dec);
-
- /* Make sure the context size for the mode fits in the one we have */
- if((enc->size>sizeof(xts->enc)) || (dec->size>sizeof(xts->dec)))
- panic("%s: inconsistent size for AES-XTS context", __FUNCTION__);
-
- enc->init(enc, xts->enc, keylen, key1, key2);
- dec->init(dec, xts->dec, keylen, key1, key2);
-
- return 0; //never fails
+ const struct ccmode_xts *enc, *dec;
+
+ if (!g_crypto_funcs) {
+ panic("%s: corecrypto not registered!\n", __FUNCTION__);
+ }
+
+ enc = g_crypto_funcs->ccaes_xts_encrypt;
+ dec = g_crypto_funcs->ccaes_xts_decrypt;
+
+ if (!enc || !dec) {
+ panic("%s: xts mode not registered? enc=%p, dec=%p\n", __FUNCTION__, enc, dec);
+ }
+
+ /* Make sure the context size for the mode fits in the one we have */
+ if ((enc->size > sizeof(xts->enc)) || (dec->size > sizeof(xts->dec))) {
+ panic("%s: inconsistent size for AES-XTS context", __FUNCTION__);
+ }
+
+ int rc = enc->init(enc, xts->enc, keylen, key1, key2);
+ rc |= dec->init(dec, xts->dec, keylen, key1, key2);
+
+ return rc;