/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include"blapit.h" #include"secport.h" #include"secerr.h"
/* * Prepare a buffer for any padded CBC encryption algorithm, growing to the * appropriate boundary and filling with the appropriate padding. * blockSize must be a power of 2. * * NOTE: If arena is non-NULL, we re-allocate from there, otherwise * we assume (and use) XP memory (re)allocation.
*/ unsignedchar *
CBC_PadBuffer(PLArenaPool *arena, unsignedchar *inbuf, unsignedint inlen, unsignedint *outlen, int blockSize)
{ unsignedchar *outbuf; unsignedint des_len; unsignedint i; unsignedchar des_pad_len;
/* * We need from 1 to blockSize bytes -- we *always* grow. * The extra bytes contain the value of the length of the padding: * if we have 2 bytes of padding, then the padding is "0x02, 0x02".
*/
des_len = (inlen + blockSize) & ~(blockSize - 1);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.