-/* crypto/modes/wrap128.c */
/*
* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project. Mode with padding contributed by Petr Spacek
* allows you to use them for any 128 bit block cipher.
*/
-#include "cryptlib.h"
+#include "internal/cryptlib.h"
#include <openssl/modes.h>
/** RFC 3394 section 2.2.3.1 Default Initial Value */
unsigned char got_iv[8];
ret = crypto_128_unwrap_raw(key, got_iv, out, in, inlen, block);
- if (ret != inlen)
- return ret;
+ if (ret == 0)
+ return 0;
if (!iv)
iv = default_iv;
- if (CRYPTO_memcmp(out, iv, 8)) {
- OPENSSL_cleanse(out, inlen);
+ if (CRYPTO_memcmp(got_iv, iv, 8)) {
+ OPENSSL_cleanse(out, ret);
return 0;
}
- return inlen;
+ return ret;
}
/** Wrapping according to RFC 5649 section 4.1.