mirror of
				https://github.com/drwetter/testssl.sh.git
				synced 2025-10-31 05:45:26 +01:00 
			
		
		
		
	Adding a hex2curves util.
This commit is contained in:
		
							
								
								
									
										36
									
								
								utils/hexstream2curves.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										36
									
								
								utils/hexstream2curves.sh
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,36 @@ | ||||
| #!/bin/bash | ||||
|  | ||||
| hs="$1" | ||||
| len=${#hs} | ||||
| echo "# curves: $((len/4))" | ||||
|  | ||||
| mapfile="etc/curves-mapping.txt" | ||||
| [ -s $mapfile ] || mapfile="../$mapfile" | ||||
| [ -s $mapfile ] || exit 255 | ||||
|  | ||||
| cur="" | ||||
| first=true | ||||
|  | ||||
| for ((i=0; i<len ; i+=4)); do | ||||
| 	printf "%02d" "$i" | ||||
| 	echo -n ": ${hs:$i:4}" | ||||
| 	grepstr="0x${hs:$i:2},0x${hs:$((i+2)):2}" | ||||
|         echo -n " --> $grepstr --> " | ||||
|         cur=$(grep -i -E "^ *${grepstr}" $mapfile | awk '{ print $3 }') | ||||
| 	if [[ $grepstr == 0x00,0xff ]]; then | ||||
| 		echo TPM_ECC_NONE | ||||
| 	else | ||||
| 		echo $cur | ||||
| 	fi | ||||
| 	if "$first"; then | ||||
| 		curves="$cur" | ||||
| 		first=false | ||||
| 	else | ||||
| 		curves="$curves:$cur" | ||||
| 	fi | ||||
| done | ||||
|  | ||||
| echo | ||||
| # remove leading : because of GREASE, and trailing because of TPM_ECC_NONE | ||||
| curves="${curves%:}" | ||||
| echo ${curves#:} | ||||
		Reference in New Issue
	
	Block a user
	 Alexander Troost
					Alexander Troost