const EVP_CIPHER *evp;
int authlen = 0;
char *colon, *p;
+ const char *real_decode;
colon = strchr(decode, ':');
if (colon == NULL) {
p = strstr(decode, "-cbc");
*p = '\0';
}
- evp = EVP_get_cipherbyname(decode);
+ /*
+ * Not all versions of libcrypto support calls to add aliases
+ * to ciphers - newer versions of libressl don't - so, instead
+ * of making "3des" an alias for "des_ede3_cbc", if attempting
+ * to get the cipher fails and the name is "3des", we try
+ * "des_ede3_cbc".
+ */
+ real_decode = decode;
+ if (strcmp(real_decode, "3des") == 0)
+ real_decode = "des-ede3-cbc";
+ evp = EVP_get_cipherbyname(real_decode);
if (!evp) {
- (*ndo->ndo_warning)(ndo, "failed to find cipher algo %s\n", decode);
+ if (decode != real_decode)
+ (*ndo->ndo_warning)(ndo, "failed to find cipher algo %s (%s)\n", real_decode, decode);
+ else
+ (*ndo->ndo_warning)(ndo, "failed to find cipher algo %s\n", decode);
sa->evp = NULL;
sa->authlen = 0;
sa->ivlen = 0;
#if !defined(OPENSSL_API_COMPAT) || OPENSSL_API_COMPAT < 0x10100000L
OpenSSL_add_all_algorithms();
#endif
- EVP_add_cipher_alias(SN_des_ede3_cbc, "3des");
}
DIAG_ON_DEPRECATION
u_int ttl_hl USED_IF_LIBCRYPTO)
{
const struct newesp *esp;
- const u_char *ep;
#ifdef HAVE_LIBCRYPTO
+ const u_char *ep;
const struct ip *ip;
struct sa_list *sa = NULL;
const struct ip6_hdr *ip6 = NULL;
ndo->ndo_protocol = "esp";
esp = (const struct newesp *)bp;
- /* 'ep' points to the end of available data. */
- ep = ndo->ndo_snapend;
+ nd_print_protocol_caps(ndo);
- if ((const u_char *)(esp + 1) >= ep) {
- nd_print_trunc(ndo);
- return;
- }
- ND_PRINT("ESP(spi=0x%08x", GET_BE_U_4(esp->esp_spi));
+ ND_PRINT("(spi=0x%08x", GET_BE_U_4(esp->esp_spi));
ND_PRINT(",seq=0x%x)", GET_BE_U_4(esp->esp_seq));
ND_PRINT(", length %u", length);
#ifdef HAVE_LIBCRYPTO
+ /* 'ep' points to the end of available data. */
+ ep = ndo->ndo_snapend;
+
/* initialize SAs */
if (ndo->ndo_sa_list_head == NULL) {
if (!ndo->ndo_espsecret)