Exemple #1
0
void des3_encrypt_pubkey(unsigned char *key,
                         unsigned char *blk, int len) {
    DESContext ourkeys[3];
    des_key_setup(GET_32BIT_MSB_FIRST(key),
                  GET_32BIT_MSB_FIRST(key+4), &ourkeys[0]);
    des_key_setup(GET_32BIT_MSB_FIRST(key+8),
                  GET_32BIT_MSB_FIRST(key+12), &ourkeys[1]);
    des_key_setup(GET_32BIT_MSB_FIRST(key),
                  GET_32BIT_MSB_FIRST(key+4), &ourkeys[2]);
    des_3cbc_encrypt(blk, blk, len, ourkeys);
}
Exemple #2
0
void cipher_encrypt(CipherContext * context, unsigned char *dest, const unsigned char *src, unsigned int len)
{
    switch (context->type) {
    case SSH_CIPHER_NONE:
        memcpy(dest, src, len);
        break;

#ifdef WITH_IDEA
    case SSH_CIPHER_IDEA:
        idea_cfb_encrypt(&context->u.idea.key, context->u.idea.iv, dest, src, len);
        break;
#endif                          /* WITH_IDEA */

#ifdef WITH_DES
    case SSH_CIPHER_DES:
        des_cbc_encrypt(&context->u.des.key, context->u.des.iv, dest, src, len);
        break;
#endif                          /* WITH_DES */

    case SSH_CIPHER_3DES:
        des_3cbc_encrypt(&context->u.des3.key1, context->u.des3.iv1, &context->u.des3.key2, context->u.des3.iv2, &context->u.des3.key3, context->u.des3.iv3, dest, src, len);
        break;

#ifdef WITH_ARCFOUR
    case SSH_CIPHER_ARCFOUR:
        arcfour_encrypt(&context->u.arcfour, dest, src, len);
        break;
#endif                          /* WITH_ARCFOUR */

#ifdef WITH_BLOWFISH
    case SSH_CIPHER_BLOWFISH:
        blowfish_cbc_encrypt(&context->u.blowfish, dest, src, len);
        break;
#endif                          /* WITH_BLOWFISH */

    default:
        fatal("cipher_encrypt: unknown cipher: %d", context->type);
    }
}
Exemple #3
0
static void des3_encrypt_blk(unsigned char *blk, int len) {
    des_3cbc_encrypt(blk, blk, len, cskeys);
}