Commit Graph

38 Commits

Author SHA1 Message Date
Andreas Rheinhardt 636631d9db Remove unnecessary libavutil/(avutil|common|internal).h inclusions
Some of these were made possible by moving several common macros to
libavutil/macros.h.

While just at it, also improve the other headers a bit.

Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-02-24 12:56:49 +01:00
Andreas Rheinhardt a240097ecd avutil: Switch crypto APIs to size_t
Announced in e435beb1ea.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-04-27 10:43:13 -03:00
Clément Bœsch 651ee93461 Merge commit 'e435beb1ea5380a90774dbf51fdc8c941e486551'
* commit 'e435beb1ea5380a90774dbf51fdc8c941e486551':
  crypto: consistently use size_t as type for length parameters

Merged-by: Clément Bœsch <cboesch@gopro.com>
2017-05-05 13:04:38 +02:00
Diego Biurrun e435beb1ea crypto: consistently use size_t as type for length parameters
size_t is the correct type to use for sizes.
2017-01-09 15:17:43 +01:00
Derek Buitenhuis 96d616052b Merge commit 'd12b5b2f135aade4099f4b26b0fe678656158c13'
* commit 'd12b5b2f135aade4099f4b26b0fe678656158c13':
  build: Split test programs off into separate files

Some conversions done by: James Almer <jamrial@gmail.com>
Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-05-11 19:13:03 +01:00
Diego Biurrun d12b5b2f13 build: Split test programs off into separate files
This avoids spurious library rebuilds when only the test program
code is changed and simplifies the build system.
2016-04-07 16:14:42 +02:00
Ganesh Ajjanagadde 07d4fe3a87 avutil: use EINVAL instead of -1 for the return code of crypto related init functions
These functions return an error typically when the key size is an
incorrect number. AVERROR(EINVAL) is more specific than -1.

Reviewed-by: Ronald S. Bultje <rsbultje@gmail.com>
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
2015-10-18 15:17:58 -04:00
Vittorio Giovara 2f9b652e8c lavu: Drop deprecated context size variables
Deprecated in 10/2012.
2015-08-28 16:04:27 +02:00
Michael Niedermayer e0be5c4fbe avutil/sha: Protect macro arguments with ()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-18 22:50:41 +01:00
James Almer 7e4fe5162a lavu/sha: Fully unroll the transform function loops
crypto_bench SHA-1 and SHA-256 results using an AMD Athlon X2 7750+, mingw32-w64 GCC 4.7.3 x86_64

Before:
lavu       SHA-1        size: 1048576  runs:   1024  time:    9.012 +- 0.162
lavu       SHA-256      size: 1048576  runs:   1024  time:   19.625 +- 0.173

After:
lavu       SHA-1        size: 1048576  runs:   1024  time:    7.948 +- 0.154
lavu       SHA-256      size: 1048576  runs:   1024  time:   17.841 +- 0.170

Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-11 21:55:59 +02:00
Michael Niedermayer 90b40b45d4 avutil/sha:make const tables static const
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-11 16:49:21 +02:00
Michael Niedermayer 636c2dd438 avutil/sha: reorder Maj arguments
about 1% speedup

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-06-02 18:51:09 +02:00
Michael Niedermayer 3c200aa693 Merge commit '1fda184a85178cfd7b98d9e308d18e1ded76a511'
* commit '1fda184a85178cfd7b98d9e308d18e1ded76a511':
  avutil: Add av_cold attributes to init functions missing them

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-05 12:53:50 +02:00
Diego Biurrun 1fda184a85 avutil: Add av_cold attributes to init functions missing them 2013-05-04 22:48:05 +02:00
Michael Niedermayer 99efd59626 Merge commit 'cb45553f577f8e0ebfe05d3287e1b6fa5859b967'
* commit 'cb45553f577f8e0ebfe05d3287e1b6fa5859b967':
  Remove pointless #undefs of previously forbidden functions.
  fate: Add dependencies for bmp, cdxl, dfa, mp3

Conflicts:
	doc/examples/muxing.c
	libavfilter/filtfmts.c
	libavutil/des.c
	libavutil/eval.c
	libavutil/log.c
	libavutil/parseutils.c
	tests/fate/mp3.mak

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-12-05 13:34:45 +01:00
Anton Khirnov cb45553f57 Remove pointless #undefs of previously forbidden functions. 2012-12-04 21:40:22 +01:00
Michael Niedermayer ac090fa68c lavu: keep context size variables
They are essential to be able to use the utils without av_malloc()
That is for example use with malloc(), memalign(), some other
private allocation function, on the stack or others.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-28 14:33:41 +01:00
Michael Niedermayer f391e405df Merge commit 'e002e3291e6dc7953f843abf56fc14f08f238b21'
* commit 'e002e3291e6dc7953f843abf56fc14f08f238b21':
  Use the new aes/md5/sha/tree allocation functions
  avutil: Add functions for allocating opaque contexts for algorithms
  svq3: fix pointer type warning
  svq3: replace unsafe pointer casting with intreadwrite macros
  parseutils-test: various cleanups

Conflicts:
	doc/APIchanges
	libavcodec/svq3.c
	libavutil/parseutils.c
	libavutil/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-12 14:52:34 +02:00
Martin Storsjö 9a92aea27b avutil: Add functions for allocating opaque contexts for algorithms
The current API where the plain size is exposed is not of much
use - in most cases it is allocated dynamically anyway.

If allocated e.g. on the stack via an uint8_t array, there's no
guarantee that the struct's members are aligned properly (unless
the array is overallocated and the opaque pointer within it
manually aligned to some unspecified alignment).

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-10-11 23:35:27 +03:00
Michael Niedermayer 4e4ae2f82c sha: change loop condition to be tighter.
This makes no change to the way the code functions, but should make
it easier for static analyzers to see the valid range for i

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-11 02:42:18 +02:00
Michael Niedermayer 04b53746ad Merge remote-tracking branch 'qatar/master'
* qatar/master:
  rtpdec: Use 4 byte startcodes for H.264
  matroskadec: Mark variable as av_unused.
  Move some conditionally used variables into the block where they are used.
  Drop some completely unnecessary av_unused attributes.
  swscale: Remove unused variable alpMmxFilter.
  Drop unnecessary av_uninit attributes from some variable declarations.
  movenc: Support muxing wmapro in ismv/isma
  mpegtsenc: Add an AVOption for forcing a new PAT/PMT/SDT to be written
  swscale: move YUV2PACKED16WRAPPER() macro down to where it is used.
  swscale: handle gray16 as a "planar" YUV format (Y-only, of course).
  swscale: use yuv2packed1() functions for unscaled chroma also.
  swscale: fix incorrect chroma bias in yuv2rgb48_1_c().
  swscale: fix invalid memory accesses in yuvpacked1() functions.
  Move PS2 MMI code below the mips subdirectory, where it belongs.
  mips: Move MMI function declarations to a header.
  build: Set correct dependencies for rtmp* protocols implemented by librtmp.

Conflicts:
	libavcodec/ac3enc_template.c
	libavformat/mpegtsenc.c
	libswscale/output.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-02-14 01:53:31 +01:00
Diego Biurrun 6df5c528ca Move some conditionally used variables into the block where they are used.
This allows dropping the av_unused argument from them.
2012-02-13 19:20:54 +01:00
Michael Niedermayer 5d4fd1d1ad Merge remote-tracking branch 'qatar/master'
* qatar/master: (36 commits)
  ARM: allow unaligned buffer in fixed-point NEON FFT4
  fate: test more FFT etc sizes
  dca: set AVCodecContext frame_size for DTS audio
  YASM: Shut up unused variable compiler warning with --disable-yasm.
  x86_32: Fix build on x86_32 with --disable-yasm.
  iirfilter: add fate test
  doxygen: Add qmul docs.
  ogg: propagate return values and return more meaningful error values
  H.264: fix overreads of qscale_table
  Remove unused static tables and static inline functions.
  eval: clear Parser instances before using
  dct-test: remove 'ref' function pointer from tables
  build: Remove deleted 'check' target from .PHONY list.
  oggdec: Abort Ogg header parsing when encountering a data packet.
  Add LGPL license boilerplate to files lacking it.
  mxfenc: small typo fix
  doxygen: Fix documentation for some VP8 functions.
  sha: use AV_RB32() instead of assuming buffer can be cast to uint32_t*
  des: allow unaligned input and output buffers
  aes: allow unaligned input and output buffers
  ...

Conflicts:
	libavcodec/dct-test.c
	libavcodec/libvpxenc.c
	libavcodec/x86/dsputil_mmx.c
	libavcodec/x86/h264_qpel_mmx.c
	libavfilter/x86/gradfun.c
	libavformat/oggdec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-07-05 02:26:17 +02:00
Kostya Shishkov 3e2aa268f6 sha: use AV_RB32() instead of assuming buffer can be cast to uint32_t*
Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-07-04 11:16:52 +01:00
Michael Niedermayer 10d2ae8cf7 Merge remote branch 'qatar/master'
* qatar/master:
  Makefile: Include dependencies for test tools, too
  Remove a version check in av_log made unnecessary by the big bump.
  update last major version increase dates in APIchanges
  Reduce picture size for yadif.
  oggdec: use av_freep() instead of av_free()
  avio: Fix sanity checks in ffurl_read*
  libavformat: Free AVFormatContext->streams
  libavformat: Make protocols pass URLContext as log context where available
  asf: remove commented out code in asf_read_seek
not pulled:  libpostproc: Remove crufty code disabled by the big bump.
  Reflect 0.7_beta1 release in the Changelog
not pulled:  sws: remove disabled cruft.
  lavu: remove disabled ff_random_get_seed cruft.
  lavu: remove disabled sha1 cruft.

Conflicts:
	Changelog
	libavutil/sha1.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-04-21 03:37:05 +02:00
Anton Khirnov 488d2b6349 lavu: remove disabled sha1 cruft. 2011-04-19 21:50:10 +02:00
Mans Rullgard 2912e87a6c Replace FFmpeg with Libav in licence headers
Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-03-19 13:33:20 +00:00
Måns Rullgård 8fc0162ac4 Add av_ prefix to bswap macros
Originally committed as revision 24170 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-07-10 22:12:30 +00:00
Måns Rullgård e6b22522c9 bswap: change ME to NE in macro names
Other parts of FFmpeg use NE (native endian) rather than ME (machine).
This makes it consistent.

Originally committed as revision 24169 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-07-10 22:09:01 +00:00
Måns Rullgård 32f40ace25 sha: add missing include
Originally committed as revision 22449 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-03-11 02:32:08 +00:00
Måns Rullgård 2ed6f39944 Replace many includes of libavutil/common.h with what is actually needed
This reduces the number of false dependencies on header files and
speeds up compilation.

Originally committed as revision 22407 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-03-09 17:39:19 +00:00
Carl Eugen Hoyos 0fcbcad140 Include sha1.h from sha.c: It contains several prototypes.
Originally committed as revision 22099 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-02-28 02:32:16 +00:00
Kostya Shishkov a768816c33 Simplify expression as suggested by Måns Rullgård
Originally committed as revision 21756 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-02-11 14:08:40 +00:00
Kostya Shishkov 045b60bf9b Make SHA digest function write digest value with AV_WN32 instead of assuming
that output may be written as uint32_t since output buffer may not be aligned
(and it's silly to force alignment on it) and it does not work in that case
properly on some architectures.

Originally committed as revision 21754 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-02-11 11:45:35 +00:00
Diego Biurrun 8b4e7c28fb Mark conditionally used variable T2 as av_unused; avoids the warning:
libavutil/sha.c:183: warning: unused variable `T2'

Originally committed as revision 19551 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-07-30 21:21:30 +00:00
Kostya Shishkov 87d718aefc cosmetics: reindent after last commit
Originally committed as revision 19450 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-07-17 04:30:49 +00:00
Kostya Shishkov aa5a99ae0c Add SHA-2 hashing
Originally committed as revision 19449 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-07-17 04:30:06 +00:00
Kostya Shishkov 451ae25724 Prepare SHA code to handle SHA-2 as well. For now rename files and functions
and leave av_sha1_* functions for compatibility until next major bump.

Originally committed as revision 19394 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-07-10 15:50:49 +00:00