static int bf_init(PX_Cipher *c, const uint8 *key, unsigned klen, const uint8 *iv) { ossldata *od = c->ptr; static int bf_is_strong = -1; /* * Test if key len is supported. BF_set_key silently cut large keys and it * could be be a problem when user transfer crypted data from one server * to another. */ if (bf_is_strong == -1) bf_is_strong = bf_check_supported_key_len(); if (!bf_is_strong && klen > 16) return PXE_KEY_TOO_BIG; /* Key len is supported. We can use it. */ BF_set_key(&od->u.bf.key, klen, key); if (iv) memcpy(od->iv, iv, BF_BLOCK); else memset(od->iv, 0, BF_BLOCK); od->u.bf.num = 0; return 0; }
static int bf_init(PX_Cipher *c, const uint8 *key, unsigned klen, const uint8 *iv) { ossldata *od = c->ptr; unsigned bs = gen_ossl_block_size(c); static int bf_is_strong = -1; /* * Test if key len is supported. BF_set_key silently cut large keys and it * could be a problem when user transfer crypted data from one server to * another. */ if (bf_is_strong == -1) bf_is_strong = bf_check_supported_key_len(); if (!bf_is_strong && klen > 16) return PXE_KEY_TOO_BIG; /* Key len is supported. We can use it. */ od->klen = klen; memcpy(od->key, key, klen); if (iv) memcpy(od->iv, iv, bs); else memset(od->iv, 0, bs); return 0; }