diff options
Diffstat (limited to 'cipher.c')
-rw-r--r-- | cipher.c | 38 |
1 files changed, 0 insertions, 38 deletions
@@ -525,41 +525,3 @@ cipher_set_keyiv(struct sshcipher_ctx *cc, const u_char *iv, size_t len) | |||
525 | #endif | 525 | #endif |
526 | return 0; | 526 | return 0; |
527 | } | 527 | } |
528 | |||
529 | #ifdef WITH_OPENSSL | ||
530 | #define EVP_X_STATE(evp) (evp)->cipher_data | ||
531 | #define EVP_X_STATE_LEN(evp) (evp)->cipher->ctx_size | ||
532 | #endif | ||
533 | |||
534 | int | ||
535 | cipher_get_keycontext(const struct sshcipher_ctx *cc, u_char *dat) | ||
536 | { | ||
537 | #if defined(WITH_OPENSSL) && !defined(OPENSSL_NO_RC4) | ||
538 | const struct sshcipher *c = cc->cipher; | ||
539 | int plen = 0; | ||
540 | |||
541 | if (c->evptype == EVP_rc4) { | ||
542 | plen = EVP_X_STATE_LEN(cc->evp); | ||
543 | if (dat == NULL) | ||
544 | return (plen); | ||
545 | memcpy(dat, EVP_X_STATE(cc->evp), plen); | ||
546 | } | ||
547 | return (plen); | ||
548 | #else | ||
549 | return 0; | ||
550 | #endif | ||
551 | } | ||
552 | |||
553 | void | ||
554 | cipher_set_keycontext(struct sshcipher_ctx *cc, const u_char *dat) | ||
555 | { | ||
556 | #if defined(WITH_OPENSSL) && !defined(OPENSSL_NO_RC4) | ||
557 | const struct sshcipher *c = cc->cipher; | ||
558 | int plen; | ||
559 | |||
560 | if (c->evptype == EVP_rc4) { | ||
561 | plen = EVP_X_STATE_LEN(cc->evp); | ||
562 | memcpy(EVP_X_STATE(cc->evp), dat, plen); | ||
563 | } | ||
564 | #endif | ||
565 | } | ||