mark all block comments that need format preserving so that
[openssl.git] / engines / ccgost / gost_crypt.c
index 52aef15acf4b93db5c078bed22112a9cb2502b41..a6aa4f1a1e6f69879815ede1fca1a6af3e5a349a 100644 (file)
@@ -8,6 +8,7 @@
  **********************************************************************/
 #include <string.h>
 #include "gost89.h"
+#include <openssl/err.h>
 #include <openssl/rand.h>
 #include "e_gost_err.h"
 #include "gost_lcl.h"
@@ -241,13 +242,13 @@ static void gost_cnt_next (void *ctx, unsigned char *iv, unsigned char *buf)
                {
                memcpy(buf1,iv,8);
                }       
-       g = buf1[0]|(buf1[1]<<8)|(buf1[2]<<16)|(buf1[3]<<24);
+       g = buf1[0]|(buf1[1]<<8)|(buf1[2]<<16)|((word32)buf1[3]<<24);
        g += 0x01010101;
        buf1[0]=(unsigned char)(g&0xff);
        buf1[1]=(unsigned char)((g>>8)&0xff);
        buf1[2]=(unsigned char)((g>>16)&0xff);
        buf1[3]=(unsigned char)((g>>24)&0xff);
-       g = buf1[4]|(buf1[5]<<8)|(buf1[6]<<16)|(buf1[7]<<24);
+       g = buf1[4]|(buf1[5]<<8)|(buf1[6]<<16)|((word32)buf1[7]<<24);
        go = g;
        g += 0x01010104;
        if (go > g)      /*  overflow*/
@@ -426,13 +427,13 @@ int gost89_set_asn1_parameters(EVP_CIPHER_CTX *ctx,ASN1_TYPE *params)
        ASN1_OCTET_STRING *os = NULL;
        if (!gcp)
                {
-               GOSTerr(GOST_F_GOST89_SET_ASN1_PARAMETERS, GOST_R_NO_MEMORY);
+               GOSTerr(GOST_F_GOST89_SET_ASN1_PARAMETERS, ERR_R_MALLOC_FAILURE);
                return 0;
                }
        if (!ASN1_OCTET_STRING_set(gcp->iv, ctx->iv, ctx->cipher->iv_len))
                {
                GOST_CIPHER_PARAMS_free(gcp);
-               GOSTerr(GOST_F_GOST89_SET_ASN1_PARAMETERS, GOST_R_NO_MEMORY);
+               GOSTerr(GOST_F_GOST89_SET_ASN1_PARAMETERS, ERR_R_MALLOC_FAILURE);
                return 0;
                }
        ASN1_OBJECT_free(gcp->enc_param_set);
@@ -443,7 +444,7 @@ int gost89_set_asn1_parameters(EVP_CIPHER_CTX *ctx,ASN1_TYPE *params)
        if (!buf)
                {
                GOST_CIPHER_PARAMS_free(gcp);
-               GOSTerr(GOST_F_GOST89_SET_ASN1_PARAMETERS, GOST_R_NO_MEMORY);
+               GOSTerr(GOST_F_GOST89_SET_ASN1_PARAMETERS, ERR_R_MALLOC_FAILURE);
                return 0;
                }
        i2d_GOST_CIPHER_PARAMS(gcp, &p);
@@ -454,7 +455,7 @@ int gost89_set_asn1_parameters(EVP_CIPHER_CTX *ctx,ASN1_TYPE *params)
        if(!os || !ASN1_OCTET_STRING_set(os, buf, len))
                {
                OPENSSL_free(buf);
-               GOSTerr(GOST_F_GOST89_SET_ASN1_PARAMETERS, GOST_R_NO_MEMORY);
+               GOSTerr(GOST_F_GOST89_SET_ASN1_PARAMETERS, ERR_R_MALLOC_FAILURE);
                return 0;
                }
        OPENSSL_free(buf);
@@ -631,4 +632,3 @@ int gost_imit_cleanup(EVP_MD_CTX *ctx)
        memset(ctx->md_data,0,sizeof(struct ossl_gost_imit_ctx));
        return 1;
        }
-