libaacs | branch: master | npzacs <[email protected]> | Fri Oct 22 15:57:25 2010 +0300| [6d5028f36f80bc1c11ef7a27a90578941b276ace] | committer: npzacs
Added crypto_create_nonce() and crypto_randomize() wrappers > http://git.videolan.org/gitweb.cgi/libaacs.git/?a=commit;h=6d5028f36f80bc1c11ef7a27a90578941b276ace --- src/libaacs/crypto.c | 10 ++++++++++ src/libaacs/crypto.h | 4 ++++ 2 files changed, 14 insertions(+), 0 deletions(-) diff --git a/src/libaacs/crypto.c b/src/libaacs/crypto.c index 48ef0dd..385feab 100644 --- a/src/libaacs/crypto.c +++ b/src/libaacs/crypto.c @@ -275,3 +275,13 @@ void crypto_aacs_title_hash(const uint8_t *ukf, uint64_t len, uint8_t *hash) { gcry_md_hash_buffer(GCRY_MD_SHA1, hash, ukf, len); } + +void crypto_randomize(uint8_t *buf, size_t len) +{ + gcry_randomize(buf, len, 1); +} + +void crypto_create_nonce(uint8_t *buf, size_t len) +{ + gcry_create_nonce(buf, len); +} diff --git a/src/libaacs/crypto.h b/src/libaacs/crypto.h index 9b2c5b0..9ddeabd 100644 --- a/src/libaacs/crypto.h +++ b/src/libaacs/crypto.h @@ -22,6 +22,7 @@ #include <util/attributes.h> +#include <stdlib.h> #include <stdint.h> AACS_PRIVATE int crypto_init(void); @@ -31,4 +32,7 @@ AACS_PRIVATE void crypto_aacs_sign(const uint8_t *c, const uint8_t *privk, uint8 uint8_t *n, const uint8_t *dhp); AACS_PRIVATE void crypto_aacs_title_hash(const uint8_t *ukf, uint64_t len, uint8_t *hash); +AACS_PRIVATE void crypto_randomize(uint8_t *buf, size_t len); +AACS_PRIVATE void crypto_create_nonce(uint8_t *buf, size_t len); + #endif /* CRYPTO_H_ */ _______________________________________________ libaacs-devel mailing list [email protected] http://mailman.videolan.org/listinfo/libaacs-devel
