ctx = EVP_CIPHER_CTX_new();
if (ctx == NULL)
return 0;
+ if (EVP_CipherInit(ctx, sa->evp, sa->secret, NULL, 0) < 0)
+ (*ndo->ndo_warning)(ndo, "espkey init failed");
+ EVP_CipherInit(ctx, NULL, NULL, iv, 0);
/*
* Allocate a buffer for the decrypted data.
* The output buffer must be separate from the input buffer, and
(*ndo->ndo_warning)(ndo, "can't allocate memory for decryption buffer");
return 0;
}
- if (EVP_CipherInit(ctx, sa->evp, sa->secret, NULL, 0) < 0)
- (*ndo->ndo_warning)(ndo, "espkey init failed");
- EVP_CipherInit(ctx, NULL, NULL, iv, 0);
EVP_Cipher(ctx, output_buffer, buf, len);
EVP_CIPHER_CTX_free(ctx);
if (sa->evp) {
ctx = EVP_CIPHER_CTX_new();
if (ctx != NULL) {
+ if (EVP_CipherInit(ctx, sa->evp, secret, NULL, 0) < 0)
+ (*ndo->ndo_warning)(ndo, "espkey init failed");
+
+ p = ivoff;
+ EVP_CipherInit(ctx, NULL, NULL, p, 0);
+ len = ep - (p + ivlen);
+
/*
* Allocate a buffer for the decrypted data.
* The output buffer must be separate from the
return -1;
}
- if (EVP_CipherInit(ctx, sa->evp, secret, NULL, 0) < 0)
- (*ndo->ndo_warning)(ndo, "espkey init failed");
-
- p = ivoff;
- EVP_CipherInit(ctx, NULL, NULL, p, 0);
- len = ep - (p + ivlen);
-
EVP_Cipher(ctx, output_buffer, p + ivlen, len);
EVP_CIPHER_CTX_free(ctx);
/*