add EVP_CIPH_FLAG_LENGTH_BITS from 0.9.8-stable
authorDr. Stephen Henson <steve@openssl.org>
Mon, 15 Feb 2010 19:17:55 +0000 (19:17 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Mon, 15 Feb 2010 19:17:55 +0000 (19:17 +0000)
crypto/evp/evp.h
crypto/evp/evp_locl.h

index f0848d24a02ee0a051419e702dd5da3beadf8f6c..6714bbb67456169074c6479ec69849a73e0885a2 100644 (file)
@@ -342,6 +342,10 @@ struct evp_cipher_st
 #define        EVP_CIPH_RAND_KEY               0x200
 /* cipher has its own additional copying logic */
 #define        EVP_CIPH_CUSTOM_COPY            0x400
+/* Allow use default ASN1 get/set iv */
+#define                EVP_CIPH_FLAG_DEFAULT_ASN1      0x1000
+/* Buffer length in bits not bytes: CFB1 mode only */
+#define                EVP_CIPH_FLAG_LENGTH_BITS       0x2000
 
 /* ctrl() values */
 
index 34e4a65af6b0a4bce7fbd512624d1fd5ad14cee9..465747471e323547b6a7c2b58bc13926ac7ba921 100644 (file)
@@ -115,7 +115,7 @@ static int cname##_cfb##cbits##_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
        if (inl<chunk) chunk=inl;\
        while(inl && inl>=chunk)\
            {\
-           cprefix##_cfb##cbits##_encrypt(in, out, (long)(cbits==1?chunk*8:chunk), &((kstruct *)ctx->cipher_data)->ksched, ctx->iv, &ctx->num, ctx->encrypt);\
+            cprefix##_cfb##cbits##_encrypt(in, out, (long)((cbits==1) && !(ctx->flags & EVP_CIPH_FLAG_LENGTH_BITS) ?inl*8:inl), &((kstruct *)ctx->cipher_data)->ksched, ctx->iv, &ctx->num, ctx->encrypt);\
            inl-=chunk;\
            in +=chunk;\
            out+=chunk;\