diff options
| author | tb <> | 2024-01-02 20:48:40 +0000 |
|---|---|---|
| committer | tb <> | 2024-01-02 20:48:40 +0000 |
| commit | e68a8fbd2cc3b79ef62036f138139aa5a162062c (patch) | |
| tree | 121501fbf595bd6dc9e87da13e3cae87eace46df /src | |
| parent | 83574b85802cfad8ade18e740dd8fd554183d2cf (diff) | |
| download | openbsd-e68a8fbd2cc3b79ef62036f138139aa5a162062c.tar.gz openbsd-e68a8fbd2cc3b79ef62036f138139aa5a162062c.tar.bz2 openbsd-e68a8fbd2cc3b79ef62036f138139aa5a162062c.zip | |
Move the trivial EVP_CIPHER getters down
They are now below the CMS ASN.1 IV stuff, but above the EVP_CIPHER_meth*
API, which are setters, in a way.
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libcrypto/evp/evp_cipher.c | 66 |
1 files changed, 35 insertions, 31 deletions
diff --git a/src/lib/libcrypto/evp/evp_cipher.c b/src/lib/libcrypto/evp/evp_cipher.c index 0e8c565b7e..367cfb6e67 100644 --- a/src/lib/libcrypto/evp/evp_cipher.c +++ b/src/lib/libcrypto/evp/evp_cipher.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: evp_cipher.c,v 1.9 2024/01/02 20:00:45 tb Exp $ */ | 1 | /* $OpenBSD: evp_cipher.c,v 1.10 2024/01/02 20:48:40 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -741,12 +741,6 @@ EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, const EVP_CIPHER_CTX *in) | |||
| 741 | } | 741 | } |
| 742 | 742 | ||
| 743 | int | 743 | int |
| 744 | EVP_CIPHER_block_size(const EVP_CIPHER *cipher) | ||
| 745 | { | ||
| 746 | return cipher->block_size; | ||
| 747 | } | ||
| 748 | |||
| 749 | int | ||
| 750 | EVP_CIPHER_CTX_block_size(const EVP_CIPHER_CTX *ctx) | 744 | EVP_CIPHER_CTX_block_size(const EVP_CIPHER_CTX *ctx) |
| 751 | { | 745 | { |
| 752 | return ctx->cipher->block_size; | 746 | return ctx->cipher->block_size; |
| @@ -765,12 +759,6 @@ EVP_CIPHER_CTX_encrypting(const EVP_CIPHER_CTX *ctx) | |||
| 765 | } | 759 | } |
| 766 | 760 | ||
| 767 | unsigned long | 761 | unsigned long |
| 768 | EVP_CIPHER_flags(const EVP_CIPHER *cipher) | ||
| 769 | { | ||
| 770 | return cipher->flags; | ||
| 771 | } | ||
| 772 | |||
| 773 | unsigned long | ||
| 774 | EVP_CIPHER_CTX_flags(const EVP_CIPHER_CTX *ctx) | 762 | EVP_CIPHER_CTX_flags(const EVP_CIPHER_CTX *ctx) |
| 775 | { | 763 | { |
| 776 | return ctx->cipher->flags; | 764 | return ctx->cipher->flags; |
| @@ -806,12 +794,6 @@ EVP_CIPHER_CTX_set_cipher_data(EVP_CIPHER_CTX *ctx, void *cipher_data) | |||
| 806 | } | 794 | } |
| 807 | 795 | ||
| 808 | int | 796 | int |
| 809 | EVP_CIPHER_iv_length(const EVP_CIPHER *cipher) | ||
| 810 | { | ||
| 811 | return cipher->iv_len; | ||
| 812 | } | ||
| 813 | |||
| 814 | int | ||
| 815 | EVP_CIPHER_CTX_iv_length(const EVP_CIPHER_CTX *ctx) | 797 | EVP_CIPHER_CTX_iv_length(const EVP_CIPHER_CTX *ctx) |
| 816 | { | 798 | { |
| 817 | int iv_length = 0; | 799 | int iv_length = 0; |
| @@ -837,24 +819,12 @@ EVP_CIPHER_CTX_buf_noconst(EVP_CIPHER_CTX *ctx) | |||
| 837 | } | 819 | } |
| 838 | 820 | ||
| 839 | int | 821 | int |
| 840 | EVP_CIPHER_key_length(const EVP_CIPHER *cipher) | ||
| 841 | { | ||
| 842 | return cipher->key_len; | ||
| 843 | } | ||
| 844 | |||
| 845 | int | ||
| 846 | EVP_CIPHER_CTX_key_length(const EVP_CIPHER_CTX *ctx) | 822 | EVP_CIPHER_CTX_key_length(const EVP_CIPHER_CTX *ctx) |
| 847 | { | 823 | { |
| 848 | return ctx->key_len; | 824 | return ctx->key_len; |
| 849 | } | 825 | } |
| 850 | 826 | ||
| 851 | int | 827 | int |
| 852 | EVP_CIPHER_nid(const EVP_CIPHER *cipher) | ||
| 853 | { | ||
| 854 | return cipher->nid; | ||
| 855 | } | ||
| 856 | |||
| 857 | int | ||
| 858 | EVP_CIPHER_CTX_nid(const EVP_CIPHER_CTX *ctx) | 828 | EVP_CIPHER_CTX_nid(const EVP_CIPHER_CTX *ctx) |
| 859 | { | 829 | { |
| 860 | return ctx->cipher->nid; | 830 | return ctx->cipher->nid; |
| @@ -1036,6 +1006,40 @@ EVP_CIPHER_type(const EVP_CIPHER *cipher) | |||
| 1036 | } | 1006 | } |
| 1037 | } | 1007 | } |
| 1038 | 1008 | ||
| 1009 | /* | ||
| 1010 | * Accessors. First the trivial getters, then the setters for the method API. | ||
| 1011 | */ | ||
| 1012 | |||
| 1013 | int | ||
| 1014 | EVP_CIPHER_nid(const EVP_CIPHER *cipher) | ||
| 1015 | { | ||
| 1016 | return cipher->nid; | ||
| 1017 | } | ||
| 1018 | |||
| 1019 | int | ||
| 1020 | EVP_CIPHER_block_size(const EVP_CIPHER *cipher) | ||
| 1021 | { | ||
| 1022 | return cipher->block_size; | ||
| 1023 | } | ||
| 1024 | |||
| 1025 | int | ||
| 1026 | EVP_CIPHER_key_length(const EVP_CIPHER *cipher) | ||
| 1027 | { | ||
| 1028 | return cipher->key_len; | ||
| 1029 | } | ||
| 1030 | |||
| 1031 | int | ||
| 1032 | EVP_CIPHER_iv_length(const EVP_CIPHER *cipher) | ||
| 1033 | { | ||
| 1034 | return cipher->iv_len; | ||
| 1035 | } | ||
| 1036 | |||
| 1037 | unsigned long | ||
| 1038 | EVP_CIPHER_flags(const EVP_CIPHER *cipher) | ||
| 1039 | { | ||
| 1040 | return cipher->flags; | ||
| 1041 | } | ||
| 1042 | |||
| 1039 | EVP_CIPHER * | 1043 | EVP_CIPHER * |
| 1040 | EVP_CIPHER_meth_new(int cipher_type, int block_size, int key_len) | 1044 | EVP_CIPHER_meth_new(int cipher_type, int block_size, int key_len) |
| 1041 | { | 1045 | { |
