X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=blobdiff_plain;f=crypto%2Fmodes%2Fmodes_lcl.h;h=7a1603bf90820b391054ad5a09872ffee5fc5847;hp=0fd11ce6c4364a7777e3e5dd539059b59404fdd1;hb=753316232243ccbf86b96c1c51ffcb41651d9ad5;hpb=2da2a4349c1598ad0648405fe175e7846d893c45 diff --git a/crypto/modes/modes_lcl.h b/crypto/modes/modes_lcl.h index 0fd11ce6c4..7a1603bf90 100644 --- a/crypto/modes/modes_lcl.h +++ b/crypto/modes/modes_lcl.h @@ -1,8 +1,10 @@ -/* ==================================================================== - * Copyright (c) 2010 The OpenSSL Project. All rights reserved. +/* + * Copyright 2010-2016 The OpenSSL Project Authors. All Rights Reserved. * - * Redistribution and use is governed by OpenSSL license. - * ==================================================================== + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html */ #include @@ -144,20 +146,19 @@ struct ccm128_context { #ifndef OPENSSL_NO_OCB -# ifdef STRICT_ALIGNMENT -typedef struct { - unsigned char a[16]; -} OCB_BLOCK; -# define ocb_block16_xor(in1,in2,out) \ - ocb_block_xor((in1)->a,(in2)->a,16,(out)->a) -# else /* STRICT_ALIGNMENT */ -typedef struct { - u64 a; - u64 b; +typedef union { + u64 a[2]; + unsigned char c[16]; } OCB_BLOCK; -# define ocb_block16_xor(in1,in2,out) \ - (out)->a=(in1)->a^(in2)->a; (out)->b=(in1)->b^(in2)->b; -# endif /* STRICT_ALIGNMENT */ +# define ocb_block16_xor(in1,in2,out) \ + ( (out)->a[0]=(in1)->a[0]^(in2)->a[0], \ + (out)->a[1]=(in1)->a[1]^(in2)->a[1] ) +# if STRICT_ALIGNMENT +# define ocb_block16_xor_misaligned(in1,in2,out) \ + ocb_block_xor((in1)->c,(in2)->c,16,(out)->c) +# else +# define ocb_block16_xor_misaligned ocb_block16_xor +# endif struct ocb128_context { /* Need both encrypt and decrypt key schedules for decryption */ @@ -165,6 +166,7 @@ struct ocb128_context { block128_f decrypt; void *keyenc; void *keydec; + ocb128_f stream; /* direction dependent */ /* Key dependent variables. Can be reused if key remains the same */ size_t l_index; size_t max_l_index;