cmac: zero_iv should be const
Remove CMAC_resume()While it is a neat design detail of CMAC that you can resume it afterhaving finalized it, nothing uses this functionality and it adds somegross things such as retaining interm
Remove CMAC_resume()While it is a neat design detail of CMAC that you can resume it afterhaving finalized it, nothing uses this functionality and it adds somegross things such as retaining intermediate secrets in the CMAC ctx.Once this is gone, we can simplify the CMAC code a bit.ok jsing
show more ...
Remove now unnecessary NULL check before EVP_CIPHER_CTX_cleanup()
Curious to see if explicitly ignoring the return value appeases Coverity
Avoid calling EVP_CIPHER_CTX_reset() on a NULL ctx
Clean up EVP_CIPHER_CTX_init() usage in cmac.cThis replaces usage of EVP_CIPHER_CTX_init() with EVEP_CIPHER_CTX_new(),and EVP_CIPHER_CTX_cleanup() with EVP_CIPHER_CTX_reset().This also replaces
Clean up EVP_CIPHER_CTX_init() usage in cmac.cThis replaces usage of EVP_CIPHER_CTX_init() with EVEP_CIPHER_CTX_new(),and EVP_CIPHER_CTX_cleanup() with EVP_CIPHER_CTX_reset().This also replaces usage of malloc with calloc, and free with freezero.ok tb@
Replace .pkey_base_id with a .base_method pointerEvery EVP_PKEY_ASN1_METHOD is either an ASN.1 method or an alias.As such it resolves to an underlying ASN.1 method (in one step).This information
Replace .pkey_base_id with a .base_method pointerEvery EVP_PKEY_ASN1_METHOD is either an ASN.1 method or an alias.As such it resolves to an underlying ASN.1 method (in one step).This information can be stored in a base_method pointer in allusionto the pkey_base_id, which is the name for the nid (aka pkey_id akatype) of the underlying method.For an ASN.1 method, the base method is itself, so the base methodis set as a pointer to itself. For an alias it is of course a pointerto the underlying method. Then obviously ameth->pkey_base_id is thesame as ameth->base_method->pkey_id, so rework all ASN.1 methods tofollow that.ok jsing
Clean up and fix pkey_cmac_keygen()A void pointer can be passed without any cast or assigning it to anintermediate variable. That's one of hte puzzling things in old OpenSSLcode: there are plenty
Clean up and fix pkey_cmac_keygen()A void pointer can be passed without any cast or assigning it to anintermediate variable. That's one of hte puzzling things in old OpenSSLcode: there are plenty of unnecessary casts and assignments of voidpointers.Make use of this fact and rework the function to be single exit, errorcheck consistently, including the EVP_PKEY_assign() call that can'treally fail and free the cmkey on exit.Why coverity didn't flag this one is another mystery.ok jsing
cmac: use block_size rather than blThis is purely mechanical apart from a single line wrap.
Disallow ciphers with EVP_CIPH_FLAG_CUSTOM_CIPHER in CMACThese are usually AEAD ciphers, for which CMAC makes little sense (if youneed a MAC and all you have is an AEAD, you don't need CMAC, you c
Disallow ciphers with EVP_CIPH_FLAG_CUSTOM_CIPHER in CMACThese are usually AEAD ciphers, for which CMAC makes little sense (if youneed a MAC and all you have is an AEAD, you don't need CMAC, you can justuse a zero length cipher text). Also, since the CMAC implementation onlyallows 64 and 128 bit block sizes, the AEADs would error out later anyway.The only family of ciphers this effectively excludes is AES key wrap, forwhich CMAC makes little sense.One notable side effect of doing this is that the EVP_Cipher() returnvalue checks in the CMAC code magically become correct. EVP. What's not tolove about it.ok jsing
Ignore ENGINE at the API boundaryThis removes the remaining ENGINE members from various internal structsand functions. Any ENGINE passed into a public API is now completelyignored functions retur
Ignore ENGINE at the API boundaryThis removes the remaining ENGINE members from various internal structsand functions. Any ENGINE passed into a public API is now completelyignored functions returning an ENGINE always return NULL.ok jsing
Clean up CMAC implementation a littleAdd explanatory comments that refer to the spec so that all the weirddances make a little more sense. It turns out that this implmeentationonly supports block
Clean up CMAC implementation a littleAdd explanatory comments that refer to the spec so that all the weirddances make a little more sense. It turns out that this implmeentationonly supports block ciphers with block sizes of 64 and 128 bits, soenforce this with a check.Simplify make_kn() to make a little more sense and make it constanttime. Some stylistic fixes like checking pointers explicitly againstNULL and shuffle things into an order that makes a bit more sense.Includes a fix for a warning reported by Viktor Szakats inhttps://github.com/libressl/portable/issues/926ok jsing
Hide symbols in cmacok tb@
spelling fixes; from paul tagliamontei removed the arithmetics -> arithmetic changes, as i felt theywere not clearly correctok tb
Make internal header file names consistentLibcrypto currently has a mess of *_lcl.h, *_locl.h, and *_local.h namesused for internal headers. Move all these headers we inherited fromOpenSSL to *_l
Make internal header file names consistentLibcrypto currently has a mess of *_lcl.h, *_locl.h, and *_local.h namesused for internal headers. Move all these headers we inherited fromOpenSSL to *_local.h, reserving the name *_internal.h for our own code.Similarly, move dtls_locl.h and ssl_locl.h to dtls_local and ssl_local.h.constant_time_locl.h is moved to constant_time.h since it's special.Adjust all .c files in libcrypto, libssl and regress.The diff is mechanical with the exception of tls13_quic.c, where#include <ssl_locl.h> was fixed manually.discussed with jsing,no objection bcook
Change the pkey.ptr from char * to void *Now that EVP_PKEY is opaque, there is no reason to keep the ptr memberof the pkey union as a weird char pointer, a void pointer will do. Thisavoids a few
Change the pkey.ptr from char * to void *Now that EVP_PKEY is opaque, there is no reason to keep the ptr memberof the pkey union as a weird char pointer, a void pointer will do. Thisavoids a few stupid casts and simplifies an upcoming diff.ok jsing
Include evp_locl.h where it will be needed once most structs fromevp.h will be moved to evp_locl.h in an upcoming bump.ok inoguchi
Correct spelling of OPENSSL_cleanse.ok miod@
if (x) FOO_free(x) -> FOO_free(x).Improves readability, keeps the code smaller so that it is warmer in yourcache.review & ok deraadt@
Principle of least surprise: make CMAC_CTX_free(), OCSP_REQ_CTX_free() andX509_STORE_CTX_free() accept NULL pointers as input without dereferencing them,like all the other well-behaved *_CTX_free()
Principle of least surprise: make CMAC_CTX_free(), OCSP_REQ_CTX_free() andX509_STORE_CTX_free() accept NULL pointers as input without dereferencing them,like all the other well-behaved *_CTX_free() functions do.
Only import cryptlib.h in the four source files that actually need it.Remove the openssl public includes from cryptlib.h and add a small numberof includes into the source files that actually need t
Only import cryptlib.h in the four source files that actually need it.Remove the openssl public includes from cryptlib.h and add a small numberof includes into the source files that actually need them. While here,also sort/group/tidy the includes.ok beck@ miod@
Stop including standard headers via cryptlib.h - pull in the headers thatare needed in the source files that actually require them.ok beck@ miod@
More KNF.
KNF
tags as requested by miod and tedu
12